summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/p5_crpt.c
diff options
context:
space:
mode:
authorbeck <>2017-01-29 17:49:23 +0000
committerbeck <>2017-01-29 17:49:23 +0000
commit957b11334a7afb14537322f0e4795b2e368b3f59 (patch)
tree1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/evp/p5_crpt.c
parentdf96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff)
downloadopenbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/evp/p5_crpt.c')
-rw-r--r--src/lib/libcrypto/evp/p5_crpt.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/libcrypto/evp/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c
index 1d02cbf4a6..75a631bf98 100644
--- a/src/lib/libcrypto/evp/p5_crpt.c
+++ b/src/lib/libcrypto/evp/p5_crpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_crpt.c,v 1.17 2016/11/08 20:01:06 miod Exp $ */ 1/* $OpenBSD: p5_crpt.c,v 1.18 2017/01/29 17:49:23 beck 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 1999. 3 * project 1999.
4 */ 4 */
@@ -90,7 +90,7 @@ PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
90 /* Extract useful info from parameter */ 90 /* Extract useful info from parameter */
91 if (param == NULL || param->type != V_ASN1_SEQUENCE || 91 if (param == NULL || param->type != V_ASN1_SEQUENCE ||
92 param->value.sequence == NULL) { 92 param->value.sequence == NULL) {
93 EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_DECODE_ERROR); 93 EVPerror(EVP_R_DECODE_ERROR);
94 return 0; 94 return 0;
95 } 95 }
96 96
@@ -100,15 +100,14 @@ PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
100 100
101 pbuf = param->value.sequence->data; 101 pbuf = param->value.sequence->data;
102 if (!(pbe = d2i_PBEPARAM(NULL, &pbuf, param->value.sequence->length))) { 102 if (!(pbe = d2i_PBEPARAM(NULL, &pbuf, param->value.sequence->length))) {
103 EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_DECODE_ERROR); 103 EVPerror(EVP_R_DECODE_ERROR);
104 return 0; 104 return 0;
105 } 105 }
106 106
107 if (!pbe->iter) 107 if (!pbe->iter)
108 iter = 1; 108 iter = 1;
109 else if ((iter = ASN1_INTEGER_get(pbe->iter)) <= 0) { 109 else if ((iter = ASN1_INTEGER_get(pbe->iter)) <= 0) {
110 EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, 110 EVPerror(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS);
111 EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS);
112 return 0; 111 return 0;
113 } 112 }
114 salt = pbe->salt->data; 113 salt = pbe->salt->data;
@@ -138,12 +137,12 @@ PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
138 goto err; 137 goto err;
139 } 138 }
140 if ((size_t)EVP_CIPHER_key_length(cipher) > sizeof(md_tmp)) { 139 if ((size_t)EVP_CIPHER_key_length(cipher) > sizeof(md_tmp)) {
141 EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_BAD_KEY_LENGTH); 140 EVPerror(EVP_R_BAD_KEY_LENGTH);
142 goto err; 141 goto err;
143 } 142 }
144 memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher)); 143 memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher));
145 if ((size_t)EVP_CIPHER_iv_length(cipher) > 16) { 144 if ((size_t)EVP_CIPHER_iv_length(cipher) > 16) {
146 EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN, EVP_R_IV_TOO_LARGE); 145 EVPerror(EVP_R_IV_TOO_LARGE);
147 goto err; 146 goto err;
148 } 147 }
149 memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)), 148 memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)),