Simplify X509_STORE_CTX_get1_chain.

(Imported from upstream's bf2d129194d5a8f2ccf5ff5261ab755e4fc9f98e)
This commit is contained in:
Adam Langley 2014-06-20 12:00:00 -07:00
parent d81f801f6d
commit a216d03d0e

View File

@ -2115,16 +2115,9 @@ STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx)
STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx) STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx)
{ {
size_t i; if (!ctx->chain)
X509 *x; return NULL;
STACK_OF(X509) *chain; return X509_chain_up_ref(ctx->chain);
if (!ctx->chain || !(chain = sk_X509_dup(ctx->chain))) return NULL;
for (i = 0; i < sk_X509_num(chain); i++)
{
x = sk_X509_value(chain, i);
CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
}
return chain;
} }
X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx) X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx)