summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/p_lib.c
diff options
context:
space:
mode:
authorjsing <>2018-02-14 16:40:42 +0000
committerjsing <>2018-02-14 16:40:42 +0000
commita841f3159cebe1cb93dc24fb368b0b614c07563e (patch)
treef9384e235ff20f3ae10f583b133d2c3cbb299b62 /src/lib/libcrypto/evp/p_lib.c
parentb67d1c3350cb5ebce3d8cc42491ccf21a0e2e482 (diff)
downloadopenbsd-a841f3159cebe1cb93dc24fb368b0b614c07563e.tar.gz
openbsd-a841f3159cebe1cb93dc24fb368b0b614c07563e.tar.bz2
openbsd-a841f3159cebe1cb93dc24fb368b0b614c07563e.zip
Provide EVP_PKEY_up_ref().
Diffstat (limited to 'src/lib/libcrypto/evp/p_lib.c')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c9
1 files changed, 8 insertions, 1 deletions
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 @@
1/* $OpenBSD: p_lib.c,v 1.17 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.18 2018/02/14 16:40:42 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -204,6 +204,13 @@ EVP_PKEY_new(void)
204 return (ret); 204 return (ret);
205} 205}
206 206
207int
208EVP_PKEY_up_ref(EVP_PKEY *pkey)
209{
210 int refs = CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
211 return ((refs > 1) ? 1 : 0);
212}
213
207/* Setup a public key ASN1 method and ENGINE from a NID or a string. 214/* Setup a public key ASN1 method and ENGINE from a NID or a string.
208 * If pkey is NULL just return 1 or 0 if the algorithm exists. 215 * If pkey is NULL just return 1 or 0 if the algorithm exists.
209 */ 216 */