summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-25 22:41:50 +0000
committertb <>2023-12-25 22:41:50 +0000
commit300118cc12494f95fb30223002b6de69650702fe (patch)
treedc1229eb4699c885e57a5e0b5c50414620b682c7 /src/lib
parent40d322a685789a37eb5cb94014694014e56be6af (diff)
downloadopenbsd-300118cc12494f95fb30223002b6de69650702fe.tar.gz
openbsd-300118cc12494f95fb30223002b6de69650702fe.tar.bz2
openbsd-300118cc12494f95fb30223002b6de69650702fe.zip
Move EVP_PKEY_assign() a bit up and tweak it slightly
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 2e78d7e5cd..f92684fdd7 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.49 2023/12/25 21:55:31 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.50 2023/12/25 22:41:50 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 *
@@ -278,6 +278,15 @@ EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len)
278 return 1; 278 return 1;
279} 279}
280 280
281int
282EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
283{
284 if (!EVP_PKEY_set_type(pkey, type))
285 return 0;
286
287 return (pkey->pkey.ptr = key) != NULL;
288}
289
281EVP_PKEY * 290EVP_PKEY *
282EVP_PKEY_new_raw_private_key(int type, ENGINE *engine, 291EVP_PKEY_new_raw_private_key(int type, ENGINE *engine,
283 const unsigned char *private_key, size_t len) 292 const unsigned char *private_key, size_t len)
@@ -399,15 +408,6 @@ EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, size_t len,
399 return NULL; 408 return NULL;
400} 409}
401 410
402int
403EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
404{
405 if (!EVP_PKEY_set_type(pkey, type))
406 return 0;
407 pkey->pkey.ptr = key;
408 return (key != NULL);
409}
410
411void * 411void *
412EVP_PKEY_get0(const EVP_PKEY *pkey) 412EVP_PKEY_get0(const EVP_PKEY *pkey)
413{ 413{