Browse Source

common: remove b64_decode

We don't use it, and it's buggy (will always return NULL)

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
travis-experimental
Antoine Poinsot 4 years ago
committed by Christian Decker
parent
commit
07bb931fed
  1. 21
      common/base64.c
  2. 1
      common/base64.h

21
common/base64.c

@ -14,24 +14,3 @@ char *b64_encode(const tal_t *ctx, const u8 *data, size_t len)
len, sodium_base64_VARIANT_ORIGINAL);
return str;
}
u8 *b64_decode(const tal_t *ctx, const char *str, size_t len)
{
size_t bin_len = len + 1;
u8 *ret = tal_arr(ctx, u8, bin_len);
if (!sodium_base642bin(ret,
tal_count(ret),
(const char * const)str,
len,
NULL,
&bin_len,
NULL,
sodium_base64_VARIANT_ORIGINAL))
return tal_free(ret);
ret[bin_len] = 0;
tal_resize(&ret, bin_len + 1);
return ret;
}

1
common/base64.h

@ -5,6 +5,5 @@
#include <ccan/tal/tal.h>
char *b64_encode(const tal_t *ctx, const u8 *data, size_t len);
u8 *b64_decode(const tal_t *ctx, const char *str, size_t len);
#endif /* LIGHTNING_COMMON_BASE64_H */

Loading…
Cancel
Save