polarssl: fix return code of entropy function
[project/ustream-ssl.git] / ustream-polarssl.c
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;
 }