polarssl: fix return code of entropy function
authorFelix Fietkau <nbd@openwrt.org>
Mon, 30 Mar 2015 12:55:47 +0000 (14:55 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 30 Mar 2015 12:57:36 +0000 (14:57 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ustream-polarssl.c
ustream-polarssl.h

index e5c84557381dd5a1d56e14923bdef6c2b1dbb134..cbf24cb44d9b4a504b4d0798963b60270ad7adf2 100644 (file)
@@ -79,7 +79,9 @@ static bool urandom_init(void)
 
 static int _urandom(void *ctx, unsigned char *out, size_t len)
 {
-       read(urandom_fd, out, len);
+       if (read(urandom_fd, out, len) < 0)
+               return POLARSSL_ERR_ENTROPY_SOURCE_FAILED;
+
        return 0;
 }
 
index dfc287df345e4f88b25c32e799d67dd59574fabd..32654720d904cadbdee62a67cb8c3d47d517d2fc 100644 (file)
@@ -26,6 +26,7 @@
 #include <polarssl/rsa.h>
 #include <polarssl/error.h>
 #include <polarssl/version.h>
+#include <polarssl/entropy.h>
 
 #if POLARSSL_VERSION_MAJOR > 1 || POLARSSL_VERSION_MINOR >= 3
 #define USE_VERSION_1_3