Provide X509_STORE_up_ref().
authorjsing <jsing@openbsd.org>
Thu, 22 Feb 2018 17:15:09 +0000 (17:15 +0000)
committerjsing <jsing@openbsd.org>
Thu, 22 Feb 2018 17:15:09 +0000 (17:15 +0000)
lib/libcrypto/Symbols.list
lib/libcrypto/x509/x509_lu.c
lib/libcrypto/x509/x509_vfy.h

index 46cb15f..9396056 100644 (file)
@@ -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
index 6cde29f..175b8b6 100644 (file)
@@ -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)
 {
index 47a1ec6..57c19ac 100644 (file)
@@ -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);