aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/p5_pbev2.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/p5_pbev2.c')
-rw-r--r--crypto/asn1/p5_pbev2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/p5_pbev2.c b/crypto/asn1/p5_pbev2.c
index 502a8c399d..44d5b5bc6e 100644
--- a/crypto/asn1/p5_pbev2.c
+++ b/crypto/asn1/p5_pbev2.c
@@ -194,7 +194,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
/* Create random IV */
- RAND_bytes(iv, EVP_CIPHER_iv_length(cipher));
+ RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher));
/* Dummy cipherinit to just setup the IV */
EVP_CipherInit(&ctx, cipher, NULL, iv, 0);
@@ -212,7 +212,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
if (!(osalt->data = Malloc (saltlen))) goto merr;
osalt->length = saltlen;
if (salt) memcpy (osalt->data, salt, saltlen);
- else RAND_bytes (osalt->data, saltlen);
+ else if (RAND_bytes (osalt->data, saltlen) <= 0) goto merr;
if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr;