diff options
author | Paul Yang <kaishen.yy@antfin.com> | 2020-03-04 23:49:43 +0800 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-09-22 08:18:09 +0100 |
commit | d0b79f8631c0f522c514175be4e4fbe984cf8f6c (patch) | |
tree | 4606888f35caaf5c2d6646ac4da4d98d75ab5d56 /crypto/evp/pmeth_gn.c | |
parent | 7ee511d093758360ed421e420cc29d9aaf11f143 (diff) |
Add SM2 signature algorithm to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12536)
Diffstat (limited to 'crypto/evp/pmeth_gn.c')
-rw-r--r-- | crypto/evp/pmeth_gn.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c index f370ad05fb..05394deca8 100644 --- a/crypto/evp/pmeth_gn.c +++ b/crypto/evp/pmeth_gn.c @@ -20,12 +20,6 @@ #include "crypto/evp.h" #include "evp_local.h" -/* TODO(3.0) remove when provider SM2 key generation is implemented */ -#ifdef TMP_SM2_HACK -# include <openssl/ec.h> -# include "internal/sizes.h" -#endif - static int gen_init(EVP_PKEY_CTX *ctx, int operation) { int ret = 0; @@ -39,12 +33,6 @@ static int gen_init(EVP_PKEY_CTX *ctx, int operation) if (ctx->keymgmt == NULL || ctx->keymgmt->gen_init == NULL) goto legacy; -/* TODO remove when provider SM2 key generation is implemented */ -#ifdef TMP_SM2_HACK - if (ctx->pmeth != NULL && ctx->pmeth->pkey_id == EVP_PKEY_SM2) - goto legacy; -#endif - switch (operation) { case EVP_PKEY_OP_PARAMGEN: ctx->op.keymgmt.genctx = @@ -214,32 +202,6 @@ int EVP_PKEY_gen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) */ (*ppkey)->type = ctx->legacy_keytype; -/* TODO remove when SM2 key have been cleanly separated from EC keys */ -#ifdef TMP_SM2_HACK - /* - * Legacy SM2 keys are implemented as EC_KEY with a twist. The legacy - * key generation detects the SM2 curve and "magically" changes the pkey - * id accordingly. - * Since we don't have SM2 in the provider implementation, we need to - * downgrade the generated provider side key to a legacy one under the - * same conditions. - * - * THIS IS AN UGLY BUT TEMPORARY HACK - */ - { - char curve_name[OSSL_MAX_NAME_SIZE] = ""; - - if (!EVP_PKEY_get_utf8_string_param(*ppkey, OSSL_PKEY_PARAM_GROUP_NAME, - curve_name, sizeof(curve_name), - NULL) - || strcmp(curve_name, "SM2") != 0) - goto end; - } - - if (!evp_pkey_downgrade(*ppkey) - || !EVP_PKEY_set_alias_type(*ppkey, EVP_PKEY_SM2)) - ret = 0; -#endif goto end; legacy: |