From a2daf88b2657a346a7f5c88ebe5ab2d1a977dd15 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 28 Nov 2016 16:12:11 -0500 Subject: [PATCH] Fixed base32 encoding --- Makefile | 4 +--- crypto/encoding/Makefile | 5 +++-- crypto/encoding/base32.c | 4 +--- include/libp2p/crypto/encoding/base32.h | 1 + 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 9aa990e..2373033 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,7 @@ DEBUG = true export DEBUG -OBJS = crypto/rsa.o crypto/sha256.o crypto/encoding/base58.o crypto/encoding/base64.o \ - crypto/encoding/x509.o thirdparty/mbedtls/*.o crypto/encoding/base16.o \ - hashmap/hashmap.o +OBJS = crypto/*.o crypto/encoding/*.o thirdparty/mbedtls/*.o hashmap/hashmap.o compile: diff --git a/crypto/encoding/Makefile b/crypto/encoding/Makefile index 3fae2a2..7fdf705 100644 --- a/crypto/encoding/Makefile +++ b/crypto/encoding/Makefile @@ -2,8 +2,9 @@ CC = gcc CFLAGS = -O0 -I../../include -g3 LFLAGS = DEPS = ../../include/libp2p/crypto/encoding/base58.h ../../include/libp2p/crypto/encoding/base64.h \ - ../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h -OBJS = base58.o base64.o x509.o base16.o + ../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h \ + ../../include/libp2p/crypto/encoding/base32.h +OBJS = base58.o base64.o x509.o base16.o base32.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) diff --git a/crypto/encoding/base32.c b/crypto/encoding/base32.c index 7930c37..25b9bdd 100644 --- a/crypto/encoding/base32.c +++ b/crypto/encoding/base32.c @@ -37,8 +37,6 @@ * */ -#include - /* Get prototype. */ /* Get size_t. */ # include @@ -639,7 +637,7 @@ base32_decode_alloc_ctx (struct base32_decode_context *ctx, int libp2p_crypto_encoding_base32_encode(const unsigned char* incoming, size_t incoming_length, unsigned char* results, size_t* results_length) { base32_encode(incoming, incoming_length, results, *results_length); - results_length = strlen(results); + *results_length = strlen(results); return 1; } diff --git a/include/libp2p/crypto/encoding/base32.h b/include/libp2p/crypto/encoding/base32.h index 923ab6a..a4c3550 100644 --- a/include/libp2p/crypto/encoding/base32.h +++ b/include/libp2p/crypto/encoding/base32.h @@ -1,6 +1,7 @@ #ifndef __LIBP2P_CRYPTO_ENCODING_BASE32_H__ #define __LIBP2P_CRYPTO_ENCODING_BASE32_H__ +#include /** * Encode in Base32 format