From: jsing Date: Thu, 22 Feb 2018 17:17:09 +0000 (+0000) Subject: Provide X509_OBJECT_get0_X509() and X509_OBJECT_get0_X509_CRL(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=340c28343f7d2dd441367e99904ad5ba0334a5a1;p=openbsd Provide X509_OBJECT_get0_X509() and X509_OBJECT_get0_X509_CRL(). --- diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 9396056f6ec..ac0f39918e1 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -2747,6 +2747,8 @@ X509_NAME_print_ex X509_NAME_print_ex_fp X509_NAME_set X509_OBJECT_free_contents +X509_OBJECT_get0_X509 +X509_OBJECT_get0_X509_CRL X509_OBJECT_idx_by_subject X509_OBJECT_retrieve_by_subject X509_OBJECT_retrieve_match diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index 175b8b6c05b..3a28c06d20a 100644 --- a/lib/libcrypto/x509/x509_lu.c +++ b/lib/libcrypto/x509/x509_lu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lu.c,v 1.24 2018/02/22 17:15:09 jsing Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.25 2018/02/22 17:17:09 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -533,6 +533,22 @@ X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, return sk_X509_OBJECT_value(h, idx); } +X509 * +X509_OBJECT_get0_X509(const X509_OBJECT *xo) +{ + if (xo != NULL && xo->type == X509_LU_X509) + return xo->data.x509; + return NULL; +} + +X509_CRL * +X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo) +{ + if (xo != NULL && xo->type == X509_LU_CRL) + return xo->data.crl; + return NULL; +} + STACK_OF(X509) * X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) { @@ -656,7 +672,6 @@ X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x) return NULL; } - /* Try to get issuer certificate from store. Due to limitations * of the API this can only retrieve a single certificate matching * a given subject name. However it will fill the cache with all diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h index 57c19acd184..a62f89a64e1 100644 --- a/lib/libcrypto/x509/x509_vfy.h +++ b/lib/libcrypto/x509/x509_vfy.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.h,v 1.22 2018/02/22 17:15:09 jsing Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.23 2018/02/22 17:17:09 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -426,6 +426,8 @@ X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); void X509_OBJECT_up_ref_count(X509_OBJECT *a); void X509_OBJECT_free_contents(X509_OBJECT *a); +X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo); +X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo); X509_STORE *X509_STORE_new(void); void X509_STORE_free(X509_STORE *v);