diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_enc.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_ess.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_pwri.c | 10 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index 09a0d155b4..cce6e95b5e 100644 --- a/src/lib/libcrypto/cms/cms_enc.c +++ b/src/lib/libcrypto/cms/cms_enc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_enc.c,v 1.18 2019/08/11 10:50:23 jsing Exp $ */ | 1 | /* $OpenBSD: cms_enc.c,v 1.19 2019/08/11 10:54:11 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -119,8 +119,7 @@ cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
| 119 | /* Generate a random IV if we need one */ | 119 | /* Generate a random IV if we need one */ |
| 120 | ivlen = EVP_CIPHER_CTX_iv_length(ctx); | 120 | ivlen = EVP_CIPHER_CTX_iv_length(ctx); |
| 121 | if (ivlen > 0) { | 121 | if (ivlen > 0) { |
| 122 | if (RAND_bytes(iv, ivlen) <= 0) | 122 | arc4random_buf(iv, ivlen); |
| 123 | goto err; | ||
| 124 | piv = iv; | 123 | piv = iv; |
| 125 | } | 124 | } |
| 126 | } else if (EVP_CIPHER_asn1_to_param(ctx, calg->parameter) <= 0) { | 125 | } else if (EVP_CIPHER_asn1_to_param(ctx, calg->parameter) <= 0) { |
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index c460ba86e2..223612ca43 100644 --- a/src/lib/libcrypto/cms/cms_ess.c +++ b/src/lib/libcrypto/cms/cms_ess.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_ess.c,v 1.18 2019/08/11 10:50:23 jsing Exp $ */ | 1 | /* $OpenBSD: cms_ess.c,v 1.19 2019/08/11 10:54:11 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -129,8 +129,7 @@ CMS_ReceiptRequest_create0(unsigned char *id, int idlen, int allorfirst, | |||
| 129 | else { | 129 | else { |
| 130 | if (!ASN1_STRING_set(rr->signedContentIdentifier, NULL, 32)) | 130 | if (!ASN1_STRING_set(rr->signedContentIdentifier, NULL, 32)) |
| 131 | goto merr; | 131 | goto merr; |
| 132 | if (RAND_bytes(rr->signedContentIdentifier->data, 32) <= 0) | 132 | arc4random_buf(rr->signedContentIdentifier->data, 32); |
| 133 | goto err; | ||
| 134 | } | 133 | } |
| 135 | 134 | ||
| 136 | sk_GENERAL_NAMES_pop_free(rr->receiptsTo, GENERAL_NAMES_free); | 135 | sk_GENERAL_NAMES_pop_free(rr->receiptsTo, GENERAL_NAMES_free); |
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index 6120cee4c9..6423ddeaf9 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.23 2019/08/11 10:50:23 jsing Exp $ */ | 1 | /* $OpenBSD: cms_pwri.c,v 1.24 2019/08/11 10:54:11 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -136,8 +136,7 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, | |||
| 136 | ivlen = EVP_CIPHER_CTX_iv_length(ctx); | 136 | ivlen = EVP_CIPHER_CTX_iv_length(ctx); |
| 137 | 137 | ||
| 138 | if (ivlen > 0) { | 138 | if (ivlen > 0) { |
| 139 | if (RAND_bytes(iv, ivlen) <= 0) | 139 | arc4random_buf(iv, ivlen); |
| 140 | goto err; | ||
| 141 | if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0) { | 140 | if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0) { |
| 142 | CMSerror(ERR_R_EVP_LIB); | 141 | CMSerror(ERR_R_EVP_LIB); |
| 143 | goto err; | 142 | goto err; |
| @@ -305,9 +304,8 @@ kek_wrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, | |||
| 305 | out[3] = in[2] ^ 0xFF; | 304 | out[3] = in[2] ^ 0xFF; |
| 306 | memcpy(out + 4, in, inlen); | 305 | memcpy(out + 4, in, inlen); |
| 307 | /* Add random padding to end */ | 306 | /* Add random padding to end */ |
| 308 | if (olen > inlen + 4 && | 307 | if (olen > inlen + 4) |
| 309 | RAND_bytes(out + 4 + inlen, olen - 4 - inlen) <= 0) | 308 | arc4random_buf(out + 4 + inlen, olen - 4 - inlen); |
| 310 | return 0; | ||
| 311 | /* Encrypt twice */ | 309 | /* Encrypt twice */ |
| 312 | if (!EVP_EncryptUpdate(ctx, out, &dummy, out, olen) || | 310 | if (!EVP_EncryptUpdate(ctx, out, &dummy, out, olen) || |
| 313 | !EVP_EncryptUpdate(ctx, out, &dummy, out, olen)) | 311 | !EVP_EncryptUpdate(ctx, out, &dummy, out, olen)) |
