diff options
Diffstat (limited to 'src/lib/libcrypto/cms/cms_pwri.c')
-rw-r--r-- | src/lib/libcrypto/cms/cms_pwri.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index b7c3038027..89f7925938 100644 --- a/src/lib/libcrypto/cms/cms_pwri.c +++ b/src/lib/libcrypto/cms/cms_pwri.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_pwri.c,v 1.7 2014/07/11 15:42:34 miod Exp $ */ | 1 | /* $OpenBSD: cms_pwri.c,v 1.8 2014/10/22 13:02:04 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -51,12 +51,13 @@ | |||
51 | * ==================================================================== | 51 | * ==================================================================== |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #include <stdlib.h> | ||
55 | |||
54 | #include <openssl/aes.h> | 56 | #include <openssl/aes.h> |
55 | #include <openssl/asn1t.h> | 57 | #include <openssl/asn1t.h> |
56 | #include <openssl/cms.h> | 58 | #include <openssl/cms.h> |
57 | #include <openssl/err.h> | 59 | #include <openssl/err.h> |
58 | #include <openssl/pem.h> | 60 | #include <openssl/pem.h> |
59 | #include <openssl/rand.h> | ||
60 | #include <openssl/x509v3.h> | 61 | #include <openssl/x509v3.h> |
61 | 62 | ||
62 | #include "asn1_locl.h" | 63 | #include "asn1_locl.h" |
@@ -130,8 +131,7 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, | |||
130 | ivlen = EVP_CIPHER_CTX_iv_length(&ctx); | 131 | ivlen = EVP_CIPHER_CTX_iv_length(&ctx); |
131 | 132 | ||
132 | if (ivlen > 0) { | 133 | if (ivlen > 0) { |
133 | if (RAND_pseudo_bytes(iv, ivlen) <= 0) | 134 | arc4random_buf(iv, ivlen); |
134 | goto err; | ||
135 | if (EVP_EncryptInit_ex(&ctx, NULL, NULL, NULL, iv) <= 0) { | 135 | if (EVP_EncryptInit_ex(&ctx, NULL, NULL, NULL, iv) <= 0) { |
136 | CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD, | 136 | CMSerr(CMS_F_CMS_ADD0_RECIPIENT_PASSWORD, |
137 | ERR_R_EVP_LIB); | 137 | ERR_R_EVP_LIB); |
@@ -297,7 +297,7 @@ kek_wrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, | |||
297 | memcpy(out + 4, in, inlen); | 297 | memcpy(out + 4, in, inlen); |
298 | /* Add random padding to end */ | 298 | /* Add random padding to end */ |
299 | if (olen > inlen + 4) | 299 | if (olen > inlen + 4) |
300 | RAND_pseudo_bytes(out + 4 + inlen, olen - 4 - inlen); | 300 | arc4random_buf(out + 4 + inlen, olen - 4 - inlen); |
301 | /* Encrypt twice */ | 301 | /* Encrypt twice */ |
302 | EVP_EncryptUpdate(ctx, out, &dummy, out, olen); | 302 | EVP_EncryptUpdate(ctx, out, &dummy, out, olen); |
303 | EVP_EncryptUpdate(ctx, out, &dummy, out, olen); | 303 | EVP_EncryptUpdate(ctx, out, &dummy, out, olen); |