summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/p5_pbev2.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-03-03 07:51:25 +0000
committerBodo Möller <bodo@openssl.org>2000-03-03 07:51:25 +0000
commitd6f68fa3149102bc6778935c700af5c7b4044d7d (patch)
tree3d77118b24f5544f9b9f4c34148b662a4cb83e38 /crypto/asn1/p5_pbev2.c
parent645820f27312908bde98c10310701f11f0ba6073 (diff)
Fix for previous patch: If RAND_pseudo_bytes returns 0, this is not an error.
Diffstat (limited to 'crypto/asn1/p5_pbev2.c')
-rw-r--r--crypto/asn1/p5_pbev2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/asn1/p5_pbev2.c b/crypto/asn1/p5_pbev2.c
index 648983e7f8..1bbdb10c71 100644
--- a/crypto/asn1/p5_pbev2.c
+++ b/crypto/asn1/p5_pbev2.c
@@ -194,7 +194,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
/* Create random IV */
- RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher));
+ if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
+ goto err;
/* Dummy cipherinit to just setup the IV */
EVP_CipherInit(&ctx, cipher, NULL, iv, 0);
@@ -212,7 +213,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 if (RAND_pseudo_bytes (osalt->data, saltlen) <= 0) goto merr;
+ else if (RAND_pseudo_bytes (osalt->data, saltlen) < 0) goto merr;
if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr;