diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-02-16 19:54:08 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-03-04 07:48:45 +1000 |
commit | f552d900459cbacd82433b688b237cd6870663cd (patch) | |
tree | 8fca1cf5a0274525e750cf74e890a3ac7f7eb671 /crypto/evp/pmeth_gn.c | |
parent | 4a98ad086a6db9a8646244bd6e6517f9fff11762 (diff) |
Add Serializers for EC
Provide EC serializers for text, pem and der.
EC parameters use ANS1 'CHOICE' - which means they are more embedded than other parameters used by
other KEY types (which normally have a SEQUENCE at the top level).
For this reason the ANS1_STRING type that was being passed around has been changed to a void so that the
code can still be shared with EC.
The EC serializer only supports named curves currently.
NOTE the serializer code assumes PKCS8 format - if the older encode methods are needed they will need to be
added in another PR. (Probably when deserialization is considered).
EVP_PKEY_key_fromdata_init was changed from using a keypair selection to all bits of a key. A side effect of this was
that the very restrictive checks in the ecx code needed to be relaxed as it was assuming all selection flags were non
optional. As this is not the case for any other key the code has been modified.
Fixed a bug in legacy_ctrl_str_to_params() - "ecdh_cofactor_mode" was being incorrectly converted to the wrong keyname.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11107)
Diffstat (limited to 'crypto/evp/pmeth_gn.c')
-rw-r--r-- | crypto/evp/pmeth_gn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c index 4bea1a1b86..84149fabd7 100644 --- a/crypto/evp/pmeth_gn.c +++ b/crypto/evp/pmeth_gn.c @@ -230,7 +230,7 @@ int EVP_PKEY_fromdata(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey, OSSL_PARAM params[]) if (ctx->operation == EVP_PKEY_OP_PARAMFROMDATA) selection = OSSL_KEYMGMT_SELECT_ALL_PARAMETERS; else - selection = OSSL_KEYMGMT_SELECT_KEYPAIR; + selection = OSSL_KEYMGMT_SELECT_ALL; keydata = evp_keymgmt_util_fromdata(*ppkey, ctx->keymgmt, selection, params); @@ -261,6 +261,6 @@ const OSSL_PARAM *EVP_PKEY_key_fromdata_settable(EVP_PKEY_CTX *ctx) /* We call fromdata_init to get ctx->keymgmt populated */ if (fromdata_init(ctx, EVP_PKEY_OP_UNDEFINED)) return evp_keymgmt_import_types(ctx->keymgmt, - OSSL_KEYMGMT_SELECT_KEYPAIR); + OSSL_KEYMGMT_SELECT_ALL); return NULL; } |