diff options
author | Matt Caswell <matt@openssl.org> | 2021-01-21 15:12:30 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-02-01 08:59:27 +0000 |
commit | ec7aef3356336012f77101f5c97e2e736e0c61ee (patch) | |
tree | 6c9ad6a7cd14330c1fe93c2d7c727c5c11c92b13 /providers | |
parent | a2a5506b9329b978a2a5b11a518b9789446ad310 (diff) |
Ensure EC keys with a private key but without a public key can be created
In 1.1.1 and earlier it was possible to create EC_KEYs that did not have
the public key in it. We need to ensure that this continues to work in 3.0.
Fixes #12612
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13922)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/keymgmt/ec_kmgmt.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index 8b020711fb..fc49aad1b9 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -353,7 +353,7 @@ int common_import(void *keydata, int selection, const OSSL_PARAM params[], * following combinations: * - domain parameters (+optional other params) * - public key with associated domain parameters (+optional other params) - * - private key with associated public key and domain parameters + * - private key with associated domain parameters and optional public key * (+optional other params) * * This means: @@ -363,12 +363,8 @@ int common_import(void *keydata, int selection, const OSSL_PARAM params[], */ if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) == 0) return 0; - if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0 - && (selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) == 0) - return 0; - if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) - ok = ok && ec_group_fromdata(ec, params); + ok = ok && ec_group_fromdata(ec, params); /* * sm2_curve: import the keys or domparams only on SM2 Curve |