diff options
author | Jerome Forissier <jerome.forissier@linaro.org> | 2018-04-23 09:41:23 +0200 |
---|---|---|
committer | Jérôme Forissier <jerome.forissier@linaro.org> | 2018-04-23 18:10:53 +0200 |
commit | 3018c8e066bf7f44dc543b3015262f764a577389 (patch) | |
tree | 394ebb9ed2a9ac2d354350dd78a89e1334c92dab /core/lib | |
parent | a3f5668a0cae797a8eee1c0f3287983c5eb749eb (diff) |
core: ltc: ECC signature verification: fix return code
The GP TEE Internal Core specification mandates that
TEE_AsymmetricVerifyDigest() must return TEE_SUCCESS if the signature
is valid, TEE_ERROR_SIGNATURE_INVALID if it is invalid, or panic if any
other error oocurs.
In the current implementation, TEE_ERROR_SIGNATURE_INVALID will never
happen with the ECC algorithms. Fix that by properly checking the
return code and signature status of the LibTomCrypt function.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib/libtomcrypt/src/tee_ltc_provider.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/core/lib/libtomcrypt/src/tee_ltc_provider.c b/core/lib/libtomcrypt/src/tee_ltc_provider.c index cba33c20..2bd6400d 100644 --- a/core/lib/libtomcrypt/src/tee_ltc_provider.c +++ b/core/lib/libtomcrypt/src/tee_ltc_provider.c @@ -1734,11 +1734,7 @@ TEE_Result crypto_acipher_ecc_verify(uint32_t algo, struct ecc_public_key *key, mp_read_unsigned_bin(s, (uint8_t *)sig + sig_len/2, sig_len/2); ltc_res = ecc_verify_hash_raw(r, s, msg, msg_len, <c_stat, <c_key); - if ((ltc_res == CRYPT_OK) && (ltc_stat == 1)) - res = TEE_SUCCESS; - else - res = TEE_ERROR_GENERIC; - + res = convert_ltc_verify_status(ltc_res, ltc_stat); out: mp_clear_multi(key_z, r, s, NULL); return res; |