summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_pss.c
diff options
context:
space:
mode:
authorjsing <>2014-10-22 13:02:04 +0000
committerjsing <>2014-10-22 13:02:04 +0000
commita2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8 (patch)
tree32d920c77e1ecf12be5fad632b9ae71343194a7c /src/lib/libcrypto/rsa/rsa_pss.c
parent5a6d7fd5a10b0ad084948463b25822d91091b325 (diff)
downloadopenbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.tar.gz
openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.tar.bz2
openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.zip
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@
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_pss.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_pss.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c
index f841b2f8a3..5e137a3090 100644
--- a/src/lib/libcrypto/rsa/rsa_pss.c
+++ b/src/lib/libcrypto/rsa/rsa_pss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pss.c,v 1.10 2014/07/13 12:53:46 miod Exp $ */ 1/* $OpenBSD: rsa_pss.c,v 1.11 2014/10/22 13:02:04 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -57,12 +57,12 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h>
60#include <string.h> 61#include <string.h>
61 62
62#include <openssl/bn.h> 63#include <openssl/bn.h>
63#include <openssl/err.h> 64#include <openssl/err.h>
64#include <openssl/evp.h> 65#include <openssl/evp.h>
65#include <openssl/rand.h>
66#include <openssl/rsa.h> 66#include <openssl/rsa.h>
67#include <openssl/sha.h> 67#include <openssl/sha.h>
68 68
@@ -243,8 +243,7 @@ RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
243 ERR_R_MALLOC_FAILURE); 243 ERR_R_MALLOC_FAILURE);
244 goto err; 244 goto err;
245 } 245 }
246 if (RAND_bytes(salt, sLen) <= 0) 246 arc4random_buf(salt, sLen);
247 goto err;
248 } 247 }
249 maskedDBLen = emLen - hLen - 1; 248 maskedDBLen = emLen - hLen - 1;
250 H = EM + maskedDBLen; 249 H = EM + maskedDBLen;