| 4ddaad52 | 12-Aug-2022 |
Lars Persson <larper@axis.com> |
core: mbedtls: Add ECC signature size check
The ECC signature implementation must check that the output buffer has sufficient space to store the signature. This check was missing in the mbedtls vers
core: mbedtls: Add ECC signature size check
The ECC signature implementation must check that the output buffer has sufficient space to store the signature. This check was missing in the mbedtls version of ecc_sign.
Fixes: ad6cfae7c0 ("libmbedtls: support mbedtls ECC function") Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Lars Persson <lars.persson@axis.com>
show more ...
|
| 613122b1 | 09-Mar-2022 |
Jerome Forissier <jerome@forissier.org> |
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@f
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>
show more ...
|
| 5e5dcaf2 | 09-Mar-2022 |
Jerome Forissier <jerome@forissier.org> |
core: mbedtls: add curve type to domain parameter group ID conversion
MBedTLS functions mbedtls_ecp_group_load() and mbedtls_ecdsa_genkey() take a group ID parameter of type mbedtls_ecp_group_id whi
core: mbedtls: add curve type to domain parameter group ID conversion
MBedTLS functions mbedtls_ecp_group_load() and mbedtls_ecdsa_genkey() take a group ID parameter of type mbedtls_ecp_group_id which is an enum (MBEDTLS_ECP_DP_SECP192R1, etc.). The code in lib/libmbedtls/core/ecc.c incorrectly passes a uint32_t TEE curve ID instead (TEE_ECC_CURVE_NIST_P192, etc.). By chance the values happen to be the same for all the NIST curves, but not for SM2. Fix that by introducing a conversion function.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| c84eee63 | 27-Jan-2021 |
Jerome Forissier <jerome@forissier.org> |
core: add support for SM2 using MBed TLS
The SM2 algorithms (PKE, KEP and DSA) are currently implemented using LibTomCrypt. They are automatically disabled when MBed TLS is selected as the core cryp
core: add support for SM2 using MBed TLS
The SM2 algorithms (PKE, KEP and DSA) are currently implemented using LibTomCrypt. They are automatically disabled when MBed TLS is selected as the core crypto library (that is, when CFG_CRYPTOLIB_NAME=mbedtls CFG_CRYPTOLIB_DIR=lib/libmbedtls).
This commit removes this restriction by porting the relevant files (core/lib/libtomcrypt/sm2-{dsa,kep,pke}.c) over to the MBed TLS API in lib/libmbedtls/core.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 9c525fe4 | 03-Feb-2021 |
Jerome Forissier <jerome@forissier.org> |
libmbedtls: core: fix copy of AES context
The mbedtls_aes_context type cannot generally be copied with a simple assignment (dst = src) because it contains a pointer field ('rk') which needs to point
libmbedtls: core: fix copy of AES context
The mbedtls_aes_context type cannot generally be copied with a simple assignment (dst = src) because it contains a pointer field ('rk') which needs to point to the 'buf' field. The current code is incorrect and causes errors in xtest 4003 on all platforms that do not have CFG_CRYPTO_WITH_CE=y. When CE is enabled, a different structure mbedtls_aes_context from aes_alt.h is used and the copy is correct.
Introduce a helper function: mbed_copy_mbedtls_aes_context() to perform the copy operation and use it when copying AES ECB, CBC and CTR contexts.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|