From db1c50c090bad72eb5c28b1867b7564708ba7f3c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 30 Mar 2015 14:55:47 +0200 Subject: [PATCH] polarssl: fix return code of entropy function Signed-off-by: Felix Fietkau --- ustream-polarssl.c | 4 +++- ustream-polarssl.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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 -- 2.11.0