core: mbedtls: sm2: fix SM2 key generation
ecc_get_keysize() lacks a case for TEE_ECC_CURVE_SM2, which prevents the
generation of a SM2 key pair. Fix this.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
diff --git a/lib/libmbedtls/core/ecc.c b/lib/libmbedtls/core/ecc.c
index 4acc601..0fc0d77 100644
--- a/lib/libmbedtls/core/ecc.c
+++ b/lib/libmbedtls/core/ecc.c
@@ -91,6 +91,13 @@
(algo != TEE_ALG_ECDH_P521))
return TEE_ERROR_BAD_PARAMETERS;
break;
+ case TEE_ECC_CURVE_SM2:
+ *key_size_bits = 256;
+ *key_size_bytes = 32;
+ if (algo != 0 && algo != TEE_ALG_SM2_DSA_SM3 &&
+ algo != TEE_ALG_SM2_KEP && algo != TEE_ALG_SM2_PKE)
+ return TEE_ERROR_BAD_PARAMETERS;
+ break;
default:
*key_size_bits = 0;
*key_size_bytes = 0;