summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/p5_pbev2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/p5_pbev2.c')
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index 4ce06a94ab..1bbdb10c71 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -194,7 +194,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
194 if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; 194 if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
195 195
196 /* Create random IV */ 196 /* Create random IV */
197 RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)); 197 if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
198 goto err;
198 199
199 /* Dummy cipherinit to just setup the IV */ 200 /* Dummy cipherinit to just setup the IV */
200 EVP_CipherInit(&ctx, cipher, NULL, iv, 0); 201 EVP_CipherInit(&ctx, cipher, NULL, iv, 0);
@@ -212,7 +213,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
212 if (!(osalt->data = Malloc (saltlen))) goto merr; 213 if (!(osalt->data = Malloc (saltlen))) goto merr;
213 osalt->length = saltlen; 214 osalt->length = saltlen;
214 if (salt) memcpy (osalt->data, salt, saltlen); 215 if (salt) memcpy (osalt->data, salt, saltlen);
215 else if (RAND_bytes (osalt->data, saltlen) <= 0) goto merr; 216 else if (RAND_pseudo_bytes (osalt->data, saltlen) < 0) goto merr;
216 217
217 if(iter <= 0) iter = PKCS5_DEFAULT_ITER; 218 if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
218 if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr; 219 if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr;