summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp
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
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')
-rw-r--r--src/lib/libcrypto/evp/evp.h3
-rw-r--r--src/lib/libcrypto/evp/p_lib.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 853abe6b8e..09df7db64b 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp.h,v 1.53 2017/08/28 17:48:02 jsing Exp $ */ 1/* $OpenBSD: evp.h,v 1.54 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 *
@@ -894,6 +894,7 @@ struct gost_key_st;
894 894
895EVP_PKEY *EVP_PKEY_new(void); 895EVP_PKEY *EVP_PKEY_new(void);
896void EVP_PKEY_free(EVP_PKEY *pkey); 896void EVP_PKEY_free(EVP_PKEY *pkey);
897int EVP_PKEY_up_ref(EVP_PKEY *pkey);
897 898
898EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, 899EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
899 long length); 900 long length);
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 */