diff options
author | jsing <> | 2014-10-22 13:02:04 +0000 |
---|---|---|
committer | jsing <> | 2014-10-22 13:02:04 +0000 |
commit | a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8 (patch) | |
tree | 32d920c77e1ecf12be5fad632b9ae71343194a7c /src/lib/libcrypto/pkcs7 | |
parent | 5a6d7fd5a10b0ad084948463b25822d91091b325 (diff) | |
download | openbsd-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/pkcs7')
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_doit.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 8f1e393635..d69aff8f41 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pk7_doit.c,v 1.29 2014/07/25 06:05:32 doug Exp $ */ | 1 | /* $OpenBSD: pk7_doit.c,v 1.30 2014/10/22 13:02:04 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -57,11 +57,11 @@ | |||
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/err.h> | 63 | #include <openssl/err.h> |
63 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
64 | #include <openssl/rand.h> | ||
65 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
66 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
67 | 67 | ||
@@ -324,8 +324,7 @@ PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
324 | ivlen = EVP_CIPHER_iv_length(evp_cipher); | 324 | ivlen = EVP_CIPHER_iv_length(evp_cipher); |
325 | xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_type(evp_cipher)); | 325 | xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_type(evp_cipher)); |
326 | if (ivlen > 0) | 326 | if (ivlen > 0) |
327 | if (RAND_pseudo_bytes(iv, ivlen) <= 0) | 327 | arc4random_buf(iv, ivlen); |
328 | goto err; | ||
329 | if (EVP_CipherInit_ex(ctx, evp_cipher, NULL, NULL, | 328 | if (EVP_CipherInit_ex(ctx, evp_cipher, NULL, NULL, |
330 | NULL, 1) <= 0) | 329 | NULL, 1) <= 0) |
331 | goto err; | 330 | goto err; |