Fix decoder error on SM2 private key

Added sm2 testcases to endecode_test.c.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25266)
This commit is contained in:
Jamie Cui 2024-08-22 11:41:50 +08:00 committed by Tomas Mraz
parent 14c45338e9
commit 25bd0c77bf
2 changed files with 39 additions and 7 deletions

View file

@ -1032,6 +1032,10 @@ DOMAIN_KEYS(ECExplicitTri2G);
IMPLEMENT_TEST_SUITE(ECExplicitTri2G, "EC", 0)
IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitTri2G, "EC")
# endif
# ifndef OPENSSL_NO_SM2
KEYS(SM2);
IMPLEMENT_TEST_SUITE(SM2, "SM2", 0)
# endif
KEYS(ED25519);
IMPLEMENT_TEST_SUITE(ED25519, "ED25519", 1)
KEYS(ED448);
@ -1396,6 +1400,9 @@ int setup_tests(void)
# ifndef OPENSSL_NO_EC2M
MAKE_DOMAIN_KEYS(ECExplicitTriNamedCurve, "EC", ec_explicit_tri_params_nc);
MAKE_DOMAIN_KEYS(ECExplicitTri2G, "EC", ec_explicit_tri_params_explicit);
# endif
# ifndef OPENSSL_NO_SM2
MAKE_KEYS(SM2, "SM2", NULL);
# endif
MAKE_KEYS(ED25519, "ED25519", NULL);
MAKE_KEYS(ED448, "ED448", NULL);
@ -1442,6 +1449,9 @@ int setup_tests(void)
ADD_TEST_SUITE_LEGACY(ECExplicitTriNamedCurve);
ADD_TEST_SUITE(ECExplicitTri2G);
ADD_TEST_SUITE_LEGACY(ECExplicitTri2G);
# endif
# ifndef OPENSSL_NO_SM2
ADD_TEST_SUITE(SM2);
# endif
ADD_TEST_SUITE(ED25519);
ADD_TEST_SUITE(ED448);
@ -1499,6 +1509,9 @@ void cleanup_tests(void)
# ifndef OPENSSL_NO_EC2M
FREE_DOMAIN_KEYS(ECExplicitTriNamedCurve);
FREE_DOMAIN_KEYS(ECExplicitTri2G);
# endif
# ifndef OPENSSL_NO_SM2
FREE_KEYS(SM2);
# endif
FREE_KEYS(ED25519);
FREE_KEYS(ED448);