diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index ed1b412225..58283ca8f0 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -900,13 +900,13 @@ int ec_validate(const void *keydata, int selection, int checktype) if (!ossl_prov_is_running()) return 0; + if ((selection & EC_POSSIBLE_SELECTIONS) == 0) + return 1; /* nothing to validate */ + ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(eck)); if (ctx == NULL) return 0; - if ((selection & EC_POSSIBLE_SELECTIONS) == 0) - return 1; /* nothing to validate */ - if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) { int flags = EC_KEY_get_flags(eck);