summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2018-08-24 19:21:10 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2018-08-24 19:21:10 +0000
commit611254c803998d79d502aeff0fb169a8c23f2568 (patch)
tree152c5ffd3aa91652ece7d6c8d2b6784e8758f8eb
parent87e7e4b3d20f3b9826aefb0a669a85927bbb840a (diff)
Make X509_OBJECT_up_ref_count return an int.
Based on OpenSSL commit c5ebfcab713a82a1d46a51c8c2668c419425b387 tested in a bulk by sthen ok jsing
-rw-r--r--lib/libcrypto/x509/x509_lu.c12
-rw-r--r--lib/libcrypto/x509/x509_vfy.h4
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);