* 遗漏代码,证书为一层时公私钥匹配问题
This commit is contained in:
13
src/x509.c
13
src/x509.c
@@ -176,7 +176,7 @@ finish:
|
||||
X509* x509_get_root_ca(const char *file, STACK_OF(X509) **stack_ca)
|
||||
{
|
||||
int x509_cnt = 0;
|
||||
X509 *x = NULL, *end = NULL;
|
||||
X509 *x = NULL, *node = NULL, *root = NULL;
|
||||
BIO *bio = NULL;
|
||||
STACK_OF(X509) *stack_x509 = NULL;
|
||||
|
||||
@@ -199,13 +199,13 @@ X509* x509_get_root_ca(const char *file, STACK_OF(X509) **stack_ca)
|
||||
if (0 == X509_NAME_cmp(X509_get_issuer_name(x), X509_get_subject_name(x)))
|
||||
{
|
||||
/*This is root ca**/
|
||||
root = x;
|
||||
continue;
|
||||
X509_free(x);
|
||||
};
|
||||
/*This is last ca*/
|
||||
if (x509_get_last_ca(file, x) == 0)
|
||||
{
|
||||
end = x;
|
||||
node = x;
|
||||
continue;
|
||||
}
|
||||
sk_X509_push(stack_x509, x);
|
||||
@@ -214,10 +214,13 @@ X509* x509_get_root_ca(const char *file, STACK_OF(X509) **stack_ca)
|
||||
}
|
||||
if (x509_cnt >= 1)
|
||||
*stack_ca = stack_x509;
|
||||
|
||||
if (node != NULL)
|
||||
X509_free(root);
|
||||
else
|
||||
node = root;
|
||||
BIO_free (bio);
|
||||
finish:
|
||||
return end;
|
||||
return node;
|
||||
}
|
||||
|
||||
static X509 *
|
||||
|
||||
Reference in New Issue
Block a user