提交 03922a63 编写于 作者: D Dr. Stephen Henson

more PKCS12 opacity

Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 a40d5949
...@@ -233,11 +233,12 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, ...@@ -233,11 +233,12 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen,
if ((attrib = PKCS12_get_attr(bag, NID_localKeyID))) if ((attrib = PKCS12_get_attr(bag, NID_localKeyID)))
lkid = attrib->value.octet_string; lkid = attrib->value.octet_string;
switch (M_PKCS12_bag_type(bag)) { switch (PKCS12_bag_type(bag)) {
case NID_keyBag: case NID_keyBag:
if (!pkey || *pkey) if (!pkey || *pkey)
return 1; return 1;
if ((*pkey = EVP_PKCS82PKEY(bag->value.keybag)) == NULL) *pkey = EVP_PKCS82PKEY(PKCS12_SAFEBAG_get0_p8inf(bag));
if (*pkey == NULL)
return 0; return 0;
break; break;
...@@ -253,7 +254,7 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, ...@@ -253,7 +254,7 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen,
break; break;
case NID_certBag: case NID_certBag:
if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate) if (PKCS12_cert_bag_type(bag) != NID_x509Certificate)
return 1; return 1;
if ((x509 = PKCS12_certbag2x509(bag)) == NULL) if ((x509 = PKCS12_certbag2x509(bag)) == NULL)
return 0; return 0;
...@@ -283,7 +284,8 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, ...@@ -283,7 +284,8 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen,
break; break;
case NID_safeContentsBag: case NID_safeContentsBag:
return parse_bags(bag->value.safes, pass, passlen, pkey, ocerts); return parse_bags(PKCS12_SAFEBAG_get0_safes(bag), pass, passlen, pkey,
ocerts);
default: default:
return 1; return 1;
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
# include <openssl/hmac.h> # include <openssl/hmac.h>
# include <openssl/rand.h> # include <openssl/rand.h>
# include <openssl/pkcs12.h> # include <openssl/pkcs12.h>
# include "p12_lcl.h"
# define TK26_MAC_KEY_LEN 32 # define TK26_MAC_KEY_LEN 32
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/pkcs12.h> #include <openssl/pkcs12.h>
#include "p12_lcl.h"
/* PKCS#12 password change routine */ /* PKCS#12 password change routine */
...@@ -202,7 +203,7 @@ static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass) ...@@ -202,7 +203,7 @@ static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass)
X509_SIG *p8new; X509_SIG *p8new;
int p8_nid, p8_saltlen, p8_iter; int p8_nid, p8_saltlen, p8_iter;
if (M_PKCS12_bag_type(bag) != NID_pkcs8ShroudedKeyBag) if (PKCS12_bag_type(bag) != NID_pkcs8ShroudedKeyBag)
return 1; return 1;
if ((p8 = PKCS8_decrypt(bag->value.shkeybag, oldpass, -1)) == NULL) if ((p8 = PKCS8_decrypt(bag->value.shkeybag, oldpass, -1)) == NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册