From: Felix Fietkau Date: Mon, 30 Mar 2015 12:55:47 +0000 (+0200) Subject: polarssl: fix return code of entropy function X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=db1c50c090bad72eb5c28b1867b7564708ba7f3c;p=oweals%2Fopenwrt-ustream-ssl.git polarssl: fix return code of entropy function Signed-off-by: Felix Fietkau --- diff --git a/ustream-polarssl.c b/ustream-polarssl.c index e5c8455..cbf24cb 100644 --- a/ustream-polarssl.c +++ b/ustream-polarssl.c @@ -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; } diff --git a/ustream-polarssl.h b/ustream-polarssl.h index dfc287d..3265472 100644 --- a/ustream-polarssl.h +++ b/ustream-polarssl.h @@ -26,6 +26,7 @@ #include #include #include +#include #if POLARSSL_VERSION_MAJOR > 1 || POLARSSL_VERSION_MINOR >= 3 #define USE_VERSION_1_3