summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2018-02-22 17:15:10 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2018-02-22 17:15:10 +0000
commitb6f49bd79d8e7d1b019dbea5cc098e686d378a9f (patch)
tree580d9197a49070345875147f8f05b856dba5ae0a /lib
parent015e804f6a4a11a2900079a181c5d4435d79749d (diff)
Provide X509_STORE_up_ref().
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/Symbols.list1
-rw-r--r--lib/libcrypto/x509/x509_lu.c9
-rw-r--r--lib/libcrypto/x509/x509_vfy.h8
3 files changed, 14 insertions, 4 deletions
diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list
index 46cb15fc431..9396056f6ec 100644
--- a/lib/libcrypto/Symbols.list
+++ b/lib/libcrypto/Symbols.list
@@ -2886,6 +2886,7 @@ X509_STORE_set_flags
X509_STORE_set_purpose
X509_STORE_set_trust
X509_STORE_set_verify_cb
+X509_STORE_up_ref
X509_TRUST_add
X509_TRUST_cleanup
X509_TRUST_get0
diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c
index 6cde29fefcf..175b8b6c05b 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.23 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: x509_lu.c,v 1.24 2018/02/22 17:15:09 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -268,6 +268,13 @@ X509_STORE_free(X509_STORE *vfy)
free(vfy);
}
+int
+X509_STORE_up_ref(X509_STORE *x)
+{
+ int refs = CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_STORE);
+ return (refs > 1) ? 1 : 0;
+}
+
X509_LOOKUP *
X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
{
diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h
index 47a1ec67922..57c19acd184 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.21 2018/02/22 17:11:30 jsing Exp $ */
+/* $OpenBSD: x509_vfy.h,v 1.22 2018/02/22 17:15:09 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -426,11 +426,13 @@ 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_STORE *X509_STORE_new(void );
-void X509_STORE_free(X509_STORE *v);
+X509_STORE *X509_STORE_new(void);
+void X509_STORE_free(X509_STORE *v);
+int X509_STORE_up_ref(X509_STORE *x);
STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);
STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm);
+
int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
int X509_STORE_set_trust(X509_STORE *ctx, int trust);