diff options
author | Jerome Forissier <jerome@forissier.org> | 2019-12-17 09:19:56 +0100 |
---|---|---|
committer | Jérôme Forissier <jerome@forissier.org> | 2020-01-07 14:14:36 +0100 |
commit | 91fc6bd89309eebdfbe3d7203a046958b8c5a3eb (patch) | |
tree | 9a216c84c284809895210d04bc2b3bba7768a338 /core/lib | |
parent | f9a78287dd1217877e079f0c3cc83f6181a51dc7 (diff) |
core: crypto: add support for SM2 PKE
Adds SM2 Public Key Encryption [1] using LibTomCrypt. The TA interface
complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 is enabled with CFG_CRYPTO_SM2_PKE=y (default y) which currently
requires that CFG_CRYPTOLIB_NAME=tomcrypt. An Mbed TLS implementation
could be added later if needed.
[1] http://www.gmbz.org.cn/main/postDetail.html?id=20180724110812
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib/libtomcrypt/ecc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/lib/libtomcrypt/ecc.c b/core/lib/libtomcrypt/ecc.c index 8322ba2e..051da77e 100644 --- a/core/lib/libtomcrypt/ecc.c +++ b/core/lib/libtomcrypt/ecc.c @@ -124,6 +124,13 @@ static TEE_Result ecc_get_curve_info(uint32_t curve, uint32_t algo, (algo != TEE_ALG_ECDH_P521)) return TEE_ERROR_BAD_PARAMETERS; break; + case TEE_ECC_CURVE_SM2: + size_bits = 256; + size_bytes = 32; + name = "SM2"; + if ((algo != 0) && (algo != TEE_ALG_SM2_PKE)) + return TEE_ERROR_BAD_PARAMETERS; + break; default: return TEE_ERROR_NOT_SUPPORTED; } |