From 285e743c634b331b091f681d69c529dd38ccb3bf Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 22 Feb 2018 17:15:09 +0000 Subject: [PATCH] Provide X509_STORE_up_ref(). --- lib/libcrypto/Symbols.list | 1 + lib/libcrypto/x509/x509_lu.c | 9 ++++++++- lib/libcrypto/x509/x509_vfy.h | 8 +++++--- 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); -- 2.20.1