summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2018-02-22 17:17:10 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2018-02-22 17:17:10 +0000
commit78986d5bc316a4f587b9b5e5ddd32f8bd3ab2282 (patch)
treebe11899a2502f683ca9470f231457fa987a7bd5b /lib
parentb6f49bd79d8e7d1b019dbea5cc098e686d378a9f (diff)
Provide X509_OBJECT_get0_X509() and X509_OBJECT_get0_X509_CRL().
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/Symbols.list2
-rw-r--r--lib/libcrypto/x509/x509_lu.c19
-rw-r--r--lib/libcrypto/x509/x509_vfy.h4
3 files changed, 22 insertions, 3 deletions
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);