summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2021-04-24 18:16:39 +0000
committertb <>2021-04-24 18:16:39 +0000
commit6b7899114d6b9acd6fbc1fc2f5129bf1ca98ac1c (patch)
tree5fe67401a5c77b9234e42a433276ba38bfbf1e60 /src/lib
parentca2a0baae4895fc7e2315d23e3758c1df3058d3d (diff)
downloadopenbsd-6b7899114d6b9acd6fbc1fc2f5129bf1ca98ac1c.tar.gz
openbsd-6b7899114d6b9acd6fbc1fc2f5129bf1ca98ac1c.tar.bz2
openbsd-6b7899114d6b9acd6fbc1fc2f5129bf1ca98ac1c.zip
Do not leave errors on the error stack on PKCS12_parse() success.
Fix is the same as OpenSSL commit ffbf304d4832bd51bb0618f8ca5b7c26647ee664 Found by Alex Gaynor with a new pyca cryptography regress test. ok inoguchi
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/pkcs12/p12_kiss.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c
index 102ca3563b..e0385393d7 100644
--- a/src/lib/libcrypto/pkcs12/p12_kiss.c
+++ b/src/lib/libcrypto/pkcs12/p12_kiss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_kiss.c,v 1.19 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: p12_kiss.c,v 1.20 2021/04/24 18:16:39 tb 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 */
@@ -132,10 +132,12 @@ PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
132 132
133 while ((x = sk_X509_pop(ocerts))) { 133 while ((x = sk_X509_pop(ocerts))) {
134 if (pkey && *pkey && cert && !*cert) { 134 if (pkey && *pkey && cert && !*cert) {
135 ERR_set_mark();
135 if (X509_check_private_key(x, *pkey)) { 136 if (X509_check_private_key(x, *pkey)) {
136 *cert = x; 137 *cert = x;
137 x = NULL; 138 x = NULL;
138 } 139 }
140 ERR_pop_to_mark();
139 } 141 }
140 142
141 if (ca && x) { 143 if (ca && x) {