From 2570f27d69bb85b814b497e3daeaaa28425bf18a Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 14 Mar 2018 19:10:01 +0100 Subject: removed assert from arc4random --- code/ecp/crypto/Makefile | 9 ++++++--- code/ecp/crypto/arc4random/arc4random.c | 7 +------ 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'code/ecp/crypto') diff --git a/code/ecp/crypto/Makefile b/code/ecp/crypto/Makefile index 36ecbfc..45a1e2d 100644 --- a/code/ecp/crypto/Makefile +++ b/code/ecp/crypto/Makefile @@ -1,10 +1,13 @@ include ../Makefile.platform CFLAGS=$(CFLAGS_PL) $(PIC) -Iinclude -I.. -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -obj = e_chacha20poly1305.o crypto.o +obj = crypto.o e_chacha20poly1305.o obj_dep = compat/explicit_bzero.o compat/timingsafe_memcmp.o compat/timingsafe_bcmp.o \ - chacha/chacha.o poly1305/poly1305.o curve25519/curve25519.o curve25519/curve25519-generic.o \ - sha/sha256.o sha/sha512.o arc4random/arc4random.o + chacha/chacha.o poly1305/poly1305.o \ + curve25519/curve25519.o curve25519/curve25519-generic.o \ + sha/sha256.o sha/sha512.o \ + arc4random/arc4random.o + subdirs = compat curve25519 chacha poly1305 sha arc4random diff --git a/code/ecp/crypto/arc4random/arc4random.c b/code/ecp/crypto/arc4random/arc4random.c index e891dd6..23ce9b7 100755 --- a/code/ecp/crypto/arc4random/arc4random.c +++ b/code/ecp/crypto/arc4random/arc4random.c @@ -29,7 +29,6 @@ #include #include #include -#include #define ARC4R_KEYSZ 32 #define ARC4R_IVSZ 8 @@ -66,8 +65,6 @@ static int (*getentropy) (void* buf, size_t n); static inline void _rs_init(rand_state* st, u8 *buf, size_t n) { - assert(n >= (ARC4R_KEYSZ + ARC4R_IVSZ)); - chacha_keysetup(&st->rs_chacha, buf, ARC4R_KEYSZ * 8, 0); chacha_ivsetup(&st->rs_chacha, buf + ARC4R_KEYSZ); } @@ -104,9 +101,7 @@ _rs_stir(rand_state* st) u8 rnd[ARC4R_KEYSZ + ARC4R_IVSZ]; - int r = getentropy(rnd, sizeof rnd); - assert(r == 0); - + getentropy(rnd, sizeof rnd); _rs_rekey(st, rnd, sizeof(rnd)); /* invalidate rs_buf */ -- cgit v1.2.3