summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/evp/p_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-02-14 16:40:42 +0000
committerjsing <jsing@openbsd.org>2018-02-14 16:40:42 +0000
commit7550320a00ea03391c36509169eab314de57fa35 (patch)
tree984c31dce4342290fcd1e739a56083c62005800c /lib/libcrypto/evp/p_lib.c
parentStart providing parts of the OpenSSL 1.1 API. (diff)
downloadwireguard-openbsd-7550320a00ea03391c36509169eab314de57fa35.tar.xz
wireguard-openbsd-7550320a00ea03391c36509169eab314de57fa35.zip
Provide EVP_PKEY_up_ref().
Diffstat (limited to 'lib/libcrypto/evp/p_lib.c')
-rw-r--r--lib/libcrypto/evp/p_lib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libcrypto/evp/p_lib.c b/lib/libcrypto/evp/p_lib.c
index 0d4cd26d45b..e001755ef18 100644
--- a/lib/libcrypto/evp/p_lib.c
+++ b/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p_lib.c,v 1.17 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: p_lib.c,v 1.18 2018/02/14 16:40:42 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -204,6 +204,13 @@ EVP_PKEY_new(void)
return (ret);
}
+int
+EVP_PKEY_up_ref(EVP_PKEY *pkey)
+{
+ int refs = CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
+ return ((refs > 1) ? 1 : 0);
+}
+
/* Setup a public key ASN1 method and ENGINE from a NID or a string.
* If pkey is NULL just return 1 or 0 if the algorithm exists.
*/