summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/ameth_lib.c
diff options
context:
space:
mode:
authortb <>2022-01-10 11:52:43 +0000
committertb <>2022-01-10 11:52:43 +0000
commita447c077ad67d6e81ed1a4fbe9003875add773c2 (patch)
tree1fec6a88d05f741604c6f6549798d45c11a3aef3 /src/lib/libcrypto/asn1/ameth_lib.c
parent0af4f789497e3f3ba6818138f64585c080464044 (diff)
downloadopenbsd-a447c077ad67d6e81ed1a4fbe9003875add773c2.tar.gz
openbsd-a447c077ad67d6e81ed1a4fbe9003875add773c2.tar.bz2
openbsd-a447c077ad67d6e81ed1a4fbe9003875add773c2.zip
Prepare to provide EVP_PKEY_check()
This allows checking the validity of an EVP_PKEY. Only RSA and EC keys are supported. If a check function is set the EVP_PKEY_METHOD, it will be used, otherwise the check function on the EVP_PKEY_ASN1_METHOD is used. The default ASN.1 methods wrap RSA_check_key() and EC_KEY_check_key(), respectively. The corresponding setters are EVP_PKEY_{asn1,meth}_set_check(). It is unclear why the PKEY method has no const while the ASN.1 method has const. Requested by tobhe and used by PHP 8.1. Based on OpenSSL commit 2aee35d3 ok inoguchi jsing
Diffstat (limited to 'src/lib/libcrypto/asn1/ameth_lib.c')
-rw-r--r--src/lib/libcrypto/asn1/ameth_lib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c
index ed7f5bd3e4..96669bbd2f 100644
--- a/src/lib/libcrypto/asn1/ameth_lib.c
+++ b/src/lib/libcrypto/asn1/ameth_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ameth_lib.c,v 1.23 2021/12/12 21:30:13 tb Exp $ */ 1/* $OpenBSD: ameth_lib.c,v 1.24 2022/01/10 11:52:43 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -429,3 +429,10 @@ EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
429{ 429{
430 ameth->pkey_ctrl = pkey_ctrl; 430 ameth->pkey_ctrl = pkey_ctrl;
431} 431}
432
433void
434EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
435 int (*pkey_check)(const EVP_PKEY *pk))
436{
437 ameth->pkey_check = pkey_check;
438}