summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-02-22 16:38:43 +0000
committerjsing <jsing@openbsd.org>2018-02-22 16:38:43 +0000
commite5cfd1dc1ce1ef66f5c8dae179ea623094d8080e (patch)
tree9825b0717da8bce49b78145907c650097c1673b8
parentIn x509.h rev. 1.30 2018/02/20 17:04:58, jsing@ provided (diff)
downloadwireguard-openbsd-e5cfd1dc1ce1ef66f5c8dae179ea623094d8080e.tar.xz
wireguard-openbsd-e5cfd1dc1ce1ef66f5c8dae179ea623094d8080e.zip
Provide BIO_up_ref().
-rw-r--r--lib/libcrypto/Symbols.list1
-rw-r--r--lib/libcrypto/bio/bio.h3
-rw-r--r--lib/libcrypto/bio/bio_lib.c9
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list
index 4e29e85236e..854baed64a7 100644
--- a/lib/libcrypto/Symbols.list
+++ b/lib/libcrypto/Symbols.list
@@ -362,6 +362,7 @@ BIO_sock_should_retry
BIO_socket_ioctl
BIO_socket_nbio
BIO_test_flags
+BIO_up_ref
BIO_vfree
BIO_vprintf
BIO_vsnprintf
diff --git a/lib/libcrypto/bio/bio.h b/lib/libcrypto/bio/bio.h
index 0a05d64929b..b85f7181bcd 100644
--- a/lib/libcrypto/bio/bio.h
+++ b/lib/libcrypto/bio/bio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio.h,v 1.38 2018/02/20 18:17:17 tb Exp $ */
+/* $OpenBSD: bio.h,v 1.39 2018/02/22 16:38:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -603,6 +603,7 @@ BIO *BIO_new_fp(FILE *stream, int close_flag);
BIO * BIO_new(BIO_METHOD *type);
int BIO_set(BIO *a, BIO_METHOD *type);
int BIO_free(BIO *a);
+int BIO_up_ref(BIO *bio);
void *BIO_get_data(BIO *a);
void BIO_set_data(BIO *a, void *ptr);
void BIO_set_init(BIO *a, int init);
diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c
index 8ad54cefd2f..ddab5428817 100644
--- a/lib/libcrypto/bio/bio_lib.c
+++ b/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio_lib.c,v 1.26 2018/02/20 17:55:26 tb Exp $ */
+/* $OpenBSD: bio_lib.c,v 1.27 2018/02/22 16:38:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -151,6 +151,13 @@ BIO_vfree(BIO *a)
BIO_free(a);
}
+int
+BIO_up_ref(BIO *bio)
+{
+ int refs = CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO);
+ return (refs > 1) ? 1 : 0;
+}
+
void *
BIO_get_data(BIO *a)
{