summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-25 21:37:26 +0000
committertb <>2023-12-25 21:37:26 +0000
commitc4be2856518cdc4682a716b0db9c070fc255ea75 (patch)
treec59e542652d17111eb7aeb304007f76a93b9d335 /src/lib
parentb959cc6d20b4cfa1d1572e4991fee713b0a2b803 (diff)
downloadopenbsd-c4be2856518cdc4682a716b0db9c070fc255ea75.tar.gz
openbsd-c4be2856518cdc4682a716b0db9c070fc255ea75.tar.bz2
openbsd-c4be2856518cdc4682a716b0db9c070fc255ea75.zip
Move EVP_PKEY_free() up next to evp_pkey_free_pkey_ptr()
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 6cecad20d4..f819717cbc 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.45 2023/12/25 21:36:05 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.46 2023/12/25 21:37:26 tb 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 *
@@ -224,6 +224,24 @@ evp_pkey_free_pkey_ptr(EVP_PKEY *pkey)
224 pkey->pkey.ptr = NULL; 224 pkey->pkey.ptr = NULL;
225} 225}
226 226
227void
228EVP_PKEY_free(EVP_PKEY *x)
229{
230 int i;
231
232 if (x == NULL)
233 return;
234
235 i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_EVP_PKEY);
236 if (i > 0)
237 return;
238
239 evp_pkey_free_pkey_ptr(x);
240 if (x->attributes)
241 sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
242 free(x);
243}
244
227/* Setup a public key ASN1 method from a NID or a string. 245/* Setup a public key ASN1 method from a NID or a string.
228 * If pkey is NULL just return 1 or 0 if the algorithm exists. 246 * If pkey is NULL just return 1 or 0 if the algorithm exists.
229 */ 247 */
@@ -582,24 +600,6 @@ EVP_PKEY_base_id(const EVP_PKEY *pkey)
582 return EVP_PKEY_type(pkey->type); 600 return EVP_PKEY_type(pkey->type);
583} 601}
584 602
585void
586EVP_PKEY_free(EVP_PKEY *x)
587{
588 int i;
589
590 if (x == NULL)
591 return;
592
593 i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_EVP_PKEY);
594 if (i > 0)
595 return;
596
597 evp_pkey_free_pkey_ptr(x);
598 if (x->attributes)
599 sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
600 free(x);
601}
602
603static int 603static int
604unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent, const char *kstr) 604unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent, const char *kstr)
605{ 605{