openssl: Check that EC keys don't have explicit params for internally loaded keys

Keys loaded via generic loader (KEY_ANY) or from a PKCS#12 file (or an
engine) don't go through the openssl_ec_private_key_load() constructor
that checks for explicit parameters.
This commit is contained in:
Tobias Brunner
2026-05-19 17:27:33 +02:00
parent ab19f691c7
commit a26dd3da33
@@ -319,7 +319,8 @@ private_key_t *openssl_ec_private_key_create(EVP_PKEY *key, bool engine)
{
private_openssl_ec_private_key_t *this;
if (EVP_PKEY_base_id(key) != EVP_PKEY_EC)
if (EVP_PKEY_base_id(key) != EVP_PKEY_EC ||
openssl_check_explicit_params(key))
{
EVP_PKEY_free(key);
return NULL;