From 46a19bb71c8fc6c92ab3232fabed04c101299518 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 24 Aug 2018 19:21:09 +0000 Subject: [PATCH] Make X509_OBJECT_up_ref_count return an int. Based on OpenSSL commit c5ebfcab713a82a1d46a51c8c2668c419425b387 tested in a bulk by sthen ok jsing --- lib/libcrypto/x509/x509_lu.c | 12 +++++------- lib/libcrypto/x509/x509_vfy.h | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index 5121ae31ec1..f21103c700d 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.29 2018/05/18 17:46:17 tb Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.30 2018/08/24 19:21:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -65,7 +65,6 @@ #include "x509_lcl.h" static void X509_OBJECT_dec_ref_count(X509_OBJECT *a); -/* static void X509_OBJECT_up_ref_count(X509_OBJECT *a); */ X509_LOOKUP * X509_LOOKUP_new(X509_LOOKUP_METHOD *method) @@ -445,17 +444,16 @@ X509_OBJECT_dec_ref_count(X509_OBJECT *a) } } -/*static*/ void +int X509_OBJECT_up_ref_count(X509_OBJECT *a) { switch (a->type) { case X509_LU_X509: - CRYPTO_add(&a->data.x509->references, 1, CRYPTO_LOCK_X509); - break; + return X509_up_ref(a->data.x509); case X509_LU_CRL: - CRYPTO_add(&a->data.crl->references, 1, CRYPTO_LOCK_X509_CRL); - break; + return X509_CRL_up_ref(a->data.crl); } + return 1; } int diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h index a29c2f00d3b..c5eae9d3983 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.29 2018/05/18 22:02:23 tb Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.30 2018/08/24 19:21:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -423,7 +423,7 @@ int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name); X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name); X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); -void X509_OBJECT_up_ref_count(X509_OBJECT *a); +int X509_OBJECT_up_ref_count(X509_OBJECT *a); int X509_OBJECT_get_type(const X509_OBJECT *a); void X509_OBJECT_free_contents(X509_OBJECT *a); X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo); -- 2.20.1