diff options
Diffstat (limited to 'src/lib/libcrypto/pem/pem_lib.c')
-rw-r--r-- | src/lib/libcrypto/pem/pem_lib.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 26b1876f36..1ebae53e74 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pem_lib.c,v 1.34 2014/07/23 20:43:56 miod Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.35 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 | * |
@@ -58,6 +58,7 @@ | |||
58 | 58 | ||
59 | #include <ctype.h> | 59 | #include <ctype.h> |
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include <stdlib.h> | ||
61 | #include <string.h> | 62 | #include <string.h> |
62 | 63 | ||
63 | #include <openssl/opensslconf.h> | 64 | #include <openssl/opensslconf.h> |
@@ -67,7 +68,6 @@ | |||
67 | #include <openssl/objects.h> | 68 | #include <openssl/objects.h> |
68 | #include <openssl/pem.h> | 69 | #include <openssl/pem.h> |
69 | #include <openssl/pkcs12.h> | 70 | #include <openssl/pkcs12.h> |
70 | #include <openssl/rand.h> | ||
71 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
72 | 72 | ||
73 | #ifndef OPENSSL_NO_DES | 73 | #ifndef OPENSSL_NO_DES |
@@ -390,8 +390,7 @@ PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, | |||
390 | kstr = (unsigned char *)buf; | 390 | kstr = (unsigned char *)buf; |
391 | } | 391 | } |
392 | OPENSSL_assert(enc->iv_len <= (int)sizeof(iv)); | 392 | OPENSSL_assert(enc->iv_len <= (int)sizeof(iv)); |
393 | if (RAND_pseudo_bytes(iv, enc->iv_len) < 0) /* Generate a salt */ | 393 | arc4random_buf(iv, enc->iv_len); /* Generate a salt */ |
394 | goto err; | ||
395 | /* The 'iv' is used as the iv and as a salt. It is | 394 | /* The 'iv' is used as the iv and as a salt. It is |
396 | * NOT taken from the BytesToKey function */ | 395 | * NOT taken from the BytesToKey function */ |
397 | if (!EVP_BytesToKey(enc, EVP_md5(), iv, kstr, klen, 1, | 396 | if (!EVP_BytesToKey(enc, EVP_md5(), iv, kstr, klen, 1, |