From a841f3159cebe1cb93dc24fb368b0b614c07563e Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 14 Feb 2018 16:40:42 +0000 Subject: Provide EVP_PKEY_up_ref(). --- src/lib/libcrypto/evp/p_lib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/evp/p_lib.c') diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 0d4cd26d45..e001755ef1 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/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. */ -- cgit v1.2.3-55-g6feb