]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add SM2 support for EVP_PKEY_Q_keygen
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Tue, 22 Nov 2022 19:53:38 +0000 (19:53 +0000)
committerTomas Mraz <tomas@openssl.org>
Thu, 24 Nov 2022 15:29:38 +0000 (16:29 +0100)
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 <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19736)

crypto/evp/evp_lib.c
doc/man3/EVP_PKEY_keygen.pod

index 98bb25655d713bcaffc6de9544482d3ceaa9783f..a8dbfbfada04f64eb4db23561c106e992440060b 100644 (file)
@@ -1215,7 +1215,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;
     }
index 87644cc5c3756863ae9ab656d4634424d0107006..433123618606f736ac9b2b8868d6402ede153919 100644 (file)
@@ -100,7 +100,7 @@ If I<type> is C<RSA>,
 a B<size_t> parameter must be given to specify the size of the RSA key.
 If I<type> is C<EC>,
 a string parameter must be given to specify the name of the EC curve.
-If I<type> is C<X25519>, C<X448>, C<ED25519>, or C<ED448>
+If I<type> is C<X25519>, C<X448>, C<ED25519>, C<ED448>, or C<SM2>
 no further parameter is needed.
 
 =head1 RETURN VALUES