summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pkcs12/p12_crpt.c
diff options
context:
space:
mode:
authormiod <>2016-11-08 20:01:06 +0000
committermiod <>2016-11-08 20:01:06 +0000
commit5605f577187336e02b609bad906ab42478c7340a (patch)
tree39318fe771bd94c87998e1dd5db6fa0412737647 /src/lib/libcrypto/pkcs12/p12_crpt.c
parentb7cb70902c58c927b969ecac46828718a5ff0497 (diff)
downloadopenbsd-5605f577187336e02b609bad906ab42478c7340a.tar.gz
openbsd-5605f577187336e02b609bad906ab42478c7340a.tar.bz2
openbsd-5605f577187336e02b609bad906ab42478c7340a.zip
Stricter checks of ASN1_INTEGER to reject ASN1_NEG_INTEGER in places when
they don't make sense. ok beck@
Diffstat (limited to 'src/lib/libcrypto/pkcs12/p12_crpt.c')
-rw-r--r--src/lib/libcrypto/pkcs12/p12_crpt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_crpt.c b/src/lib/libcrypto/pkcs12/p12_crpt.c
index 0f215d2fe2..f2d635fc62 100644
--- a/src/lib/libcrypto/pkcs12/p12_crpt.c
+++ b/src/lib/libcrypto/pkcs12/p12_crpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_crpt.c,v 1.12 2015/09/10 15:56:25 jsing Exp $ */ 1/* $OpenBSD: p12_crpt.c,v 1.13 2016/11/08 20:01:06 miod 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 */
@@ -94,8 +94,11 @@ PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
94 94
95 if (!pbe->iter) 95 if (!pbe->iter)
96 iter = 1; 96 iter = 1;
97 else 97 else if ((iter = ASN1_INTEGER_get(pbe->iter)) <= 0) {
98 iter = ASN1_INTEGER_get (pbe->iter); 98 PKCS12err(PKCS12_F_PKCS12_PBE_KEYIVGEN, PKCS12_R_DECODE_ERROR);
99 PBEPARAM_free(pbe);
100 return 0;
101 }
99 salt = pbe->salt->data; 102 salt = pbe->salt->data;
100 saltlen = pbe->salt->length; 103 saltlen = pbe->salt->length;
101 if (!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_KEY_ID, 104 if (!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_KEY_ID,