summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2016-11-04 10:29:20 +0000
committerBob Beck <beck@cvs.openbsd.org>2016-11-04 10:29:20 +0000
commit23b63084f5c438eee81335f4d22e3adead7a9bec (patch)
treecc21e8d26420e70b6f8ecf1a88b92e5f92dcadae /lib/libcrypto/x509
parentf6c04f3c81cd15d2577d6a86697114166bcf694e (diff)
Add X509_up_ref, from boring
ok jsing@
Diffstat (limited to 'lib/libcrypto/x509')
-rw-r--r--lib/libcrypto/x509/x509.h4
-rw-r--r--lib/libcrypto/x509/x_all.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/libcrypto/x509/x509.h b/lib/libcrypto/x509/x509.h
index 1c4c44b5889..1d5467b47da 100644
--- a/lib/libcrypto/x509/x509.h
+++ b/lib/libcrypto/x509/x509.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509.h,v 1.24 2016/09/04 16:49:24 jsing Exp $ */
+/* $OpenBSD: x509.h,v 1.25 2016/11/04 10:29:19 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1281,6 +1281,8 @@ int X509_TRUST_get_flags(X509_TRUST *xp);
char *X509_TRUST_get0_name(X509_TRUST *xp);
int X509_TRUST_get_trust(X509_TRUST *xp);
+int X509_up_ref(X509 *x);
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
diff --git a/lib/libcrypto/x509/x_all.c b/lib/libcrypto/x509/x_all.c
index 21a85354457..74ff179b657 100644
--- a/lib/libcrypto/x509/x_all.c
+++ b/lib/libcrypto/x509/x_all.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x_all.c,v 1.21 2015/10/13 14:03:26 jsing Exp $ */
+/* $OpenBSD: x_all.c,v 1.22 2016/11/04 10:29:19 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -600,3 +600,10 @@ PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,
return(ASN1_item_digest(ASN1_ITEM_rptr(PKCS7_ISSUER_AND_SERIAL), type,
(char *)data, md, len));
}
+
+int
+X509_up_ref(X509 *x)
+{
+ int i = CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
+ return i > 1 ? 1 : 0;
+}