aboutsummaryrefslogtreecommitdiffstats
path: root/apps/lib
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-11-02 11:04:06 +0000
committerMatt Caswell <matt@openssl.org>2020-11-25 16:45:03 +0000
commit0f386f2eb036d3efc61427b0f83cf5db654d0d49 (patch)
tree8d92e93edefa0ef1f2f592b64f3d3410744a564e /apps/lib
parent931d5b4b27fcc907e3ff4d4328c59a5f285a44fb (diff)
downloadopenssl-0f386f2eb036d3efc61427b0f83cf5db654d0d49.tar.gz
Remove deprecation warning suppression from genpkey
genpkey was supressing deprecation warnings in order to support ENGINE functionality. We move all of that into a separate file so that we don't need to suppress the warnings anymore. Fixes #13118 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13454)
Diffstat (limited to 'apps/lib')
-rw-r--r--apps/lib/engine.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/lib/engine.c b/apps/lib/engine.c
index f47c94fbce..4d9adc2818 100644
--- a/apps/lib/engine.c
+++ b/apps/lib/engine.c
@@ -17,6 +17,7 @@
#include <string.h> /* strcmp */
#include <openssl/types.h> /* Ensure we have the ENGINE type, regardless */
+#include <openssl/err.h>
#ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
#endif
@@ -145,3 +146,31 @@ EVP_PKEY *load_engine_public_key(ENGINE *e, const char *keyid,
return rv;
}
+int get_legacy_pkey_id(OSSL_LIB_CTX *libctx, const char *algname, ENGINE *e)
+{
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *tmpeng = NULL;
+ int pkey_id = NID_undef;
+
+ ERR_set_mark();
+ ameth = EVP_PKEY_asn1_find_str(&tmpeng, algname, -1);
+
+#if !defined(OPENSSL_NO_ENGINE)
+ ENGINE_finish(tmpeng);
+
+ if (ameth == NULL && e != NULL)
+ ameth = ENGINE_get_pkey_asn1_meth_str(e, algname, -1);
+ else
+#endif
+ /* We're only interested if it comes from an ENGINE */
+ if (tmpeng == NULL)
+ ameth = NULL;
+
+ ERR_pop_to_mark();
+ if (ameth == NULL)
+ return NID_undef;
+
+ EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
+
+ return pkey_id;
+}