From a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 22 Oct 2014 13:02:04 +0000 Subject: Use arc4random_buf() instead of RAND_bytes() or RAND_pseudo_bytes(). arc4random_buf() is guaranteed to always succeed - it is worth noting that a number of the replaced function calls were already missing return value checks. ok deraadt@ --- src/lib/libcrypto/rsa/rsa_ssl.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/lib/libcrypto/rsa/rsa_ssl.c') diff --git a/src/lib/libcrypto/rsa/rsa_ssl.c b/src/lib/libcrypto/rsa/rsa_ssl.c index a5fe5004b1..73262f29c1 100644 --- a/src/lib/libcrypto/rsa/rsa_ssl.c +++ b/src/lib/libcrypto/rsa/rsa_ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ssl.c,v 1.13 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: rsa_ssl.c,v 1.14 2014/10/22 13:02:04 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -57,11 +57,11 @@ */ #include +#include #include #include #include -#include #include int @@ -85,13 +85,10 @@ RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, /* pad out with non-zero random data */ j = tlen - 3 - 8 - flen; - if (RAND_bytes(p, j) <= 0) - return 0; + arc4random_buf(p, j); for (i = 0; i < j; i++) { - while (*p == '\0') { - if (RAND_bytes(p, 1) <= 0) - return 0; - } + while (*p == '\0') + arc4random_buf(p, 1); p++; } -- cgit v1.2.3-55-g6feb