summaryrefslogtreecommitdiffstats
path: root/providers/defltprov.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-02-16 19:54:08 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-03-04 07:48:45 +1000
commitf552d900459cbacd82433b688b237cd6870663cd (patch)
tree8fca1cf5a0274525e750cf74e890a3ac7f7eb671 /providers/defltprov.c
parent4a98ad086a6db9a8646244bd6e6517f9fff11762 (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 'providers/defltprov.c')
-rw-r--r--providers/defltprov.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/providers/defltprov.c b/providers/defltprov.c
index 9400eee0c9..0f66aa2b71 100644
--- a/providers/defltprov.c
+++ b/providers/defltprov.c
@@ -471,17 +471,17 @@ static const OSSL_ALGORITHM deflt_serializer[] = {
#endif
#ifndef OPENSSL_NO_EC
- { "X25519", "provider=default,format=text,type=private",
+ { "X25519", "provider=default,fips=yes,format=text,type=private",
x25519_priv_print_serializer_functions },
- { "X25519", "provider=default,format=text,type=public",
+ { "X25519", "provider=default,fips=yes,format=text,type=public",
x25519_pub_print_serializer_functions },
- { "X25519", "provider=default,format=der,type=private",
+ { "X25519", "provider=default,fips=yes,format=der,type=private",
x25519_priv_der_serializer_functions },
- { "X25519", "provider=default,format=der,type=public",
+ { "X25519", "provider=default,fips=yes,format=der,type=public",
x25519_pub_der_serializer_functions },
- { "X25519", "provider=default,format=pem,type=private",
+ { "X25519", "provider=default,fips=yes,format=pem,type=private",
x25519_priv_pem_serializer_functions },
- { "X25519", "provider=default,format=pem,type=public",
+ { "X25519", "provider=default,fips=yes,format=pem,type=public",
x25519_pub_pem_serializer_functions },
{ "X448", "provider=default,format=text,type=private",
@@ -496,8 +496,26 @@ static const OSSL_ALGORITHM deflt_serializer[] = {
x448_priv_pem_serializer_functions },
{ "X448", "provider=default,format=pem,type=public",
x448_pub_pem_serializer_functions },
-#endif
+ { "EC", "provider=default,fips=yes,format=text,type=private",
+ ec_priv_text_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=text,type=public",
+ ec_pub_text_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=text,type=parameters",
+ ec_param_text_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=der,type=private",
+ ec_priv_der_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=der,type=public",
+ ec_pub_der_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=der,type=parameters",
+ ec_param_der_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=pem,type=private",
+ ec_priv_pem_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=pem,type=public",
+ ec_pub_pem_serializer_functions },
+ { "EC", "provider=default,fips=yes,format=pem,type=parameters",
+ ec_param_pem_serializer_functions },
+#endif
{ NULL, NULL, NULL }
};