提交 5ba7c902 编写于 作者: R Richard Levitte

Beautifying. Sorry, but code that's slammed to the far left is not

very readable in my opinion.
上级 3916800f
...@@ -75,44 +75,49 @@ int PKCS12_parse (PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, ...@@ -75,44 +75,49 @@ int PKCS12_parse (PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
STACK **ca) STACK **ca)
{ {
/* Check for NULL PKCS12 structure */ /* Check for NULL PKCS12 structure */
if(!p12) { if(!p12)
{
PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER);
return 0; return 0;
} }
/* Allocate stack for ca certificates if needed */ /* Allocate stack for ca certificates if needed */
if ((ca != NULL) && (*ca == NULL)) { if ((ca != NULL) && (*ca == NULL))
if (!(*ca = sk_new(NULL))) { {
if (!(*ca = sk_new(NULL)))
{
PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE);
return 0; return 0;
} }
} }
if(pkey) *pkey = NULL; if(pkey) *pkey = NULL;
if(cert) *cert = NULL; if(cert) *cert = NULL;
/* Check the mac */ /* Check the mac */
if (!PKCS12_verify_mac (p12, pass, -1)) { if (!PKCS12_verify_mac (p12, pass, -1))
{
PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_MAC_VERIFY_FAILURE); PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_MAC_VERIFY_FAILURE);
goto err; goto err;
} }
if (!parse_pk12 (p12, pass, -1, pkey, cert, ca)) { if (!parse_pk12 (p12, pass, -1, pkey, cert, ca))
{
PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR);
goto err; goto err;
} }
return 1; return 1;
err: err:
if (pkey && *pkey) EVP_PKEY_free (*pkey); if (pkey && *pkey) EVP_PKEY_free (*pkey);
if (cert && *cert) X509_free (*cert); if (cert && *cert) X509_free (*cert);
if (ca) sk_pop_free (*ca, X509_free); if (ca) sk_pop_free (*ca, X509_free);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册