From 1c8b17358fef7daca24d090cfbd5fca2e65ab388 Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Tue, 22 Nov 2022 19:53:38 +0000 Subject: Add SM2 support for EVP_PKEY_Q_keygen There is no reason preventing this API to support SM2, which gives us a simple method to do SM2 key gen. CLA: trivial Reviewed-by: Hugo Landau Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/19736) (cherry picked from commit 3f32d29ad464591ed968a1e430111e1525280f4c) --- crypto/evp/evp_lib.c | 3 ++- doc/man3/EVP_PKEY_keygen.pod | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index d88066d0a2..61640a3488 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -1201,7 +1201,8 @@ EVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq, } else if (OPENSSL_strcasecmp(type, "ED25519") != 0 && OPENSSL_strcasecmp(type, "X25519") != 0 && OPENSSL_strcasecmp(type, "ED448") != 0 - && OPENSSL_strcasecmp(type, "X448") != 0) { + && OPENSSL_strcasecmp(type, "X448") != 0 + && OPENSSL_strcasecmp(type, "SM2") != 0) { ERR_raise(ERR_LIB_EVP, ERR_R_PASSED_INVALID_ARGUMENT); goto end; } diff --git a/doc/man3/EVP_PKEY_keygen.pod b/doc/man3/EVP_PKEY_keygen.pod index 87644cc5c3..4331236186 100644 --- a/doc/man3/EVP_PKEY_keygen.pod +++ b/doc/man3/EVP_PKEY_keygen.pod @@ -100,7 +100,7 @@ If I is C, a B parameter must be given to specify the size of the RSA key. If I is C, a string parameter must be given to specify the name of the EC curve. -If I is C, C, C, or C +If I is C, C, C, C, or C no further parameter is needed. =head1 RETURN VALUES -- cgit v1.2.3