Home
last modified time | relevance | path

Searched hist:"7 e35937aae6d65507bab36f10bd46249de6a835c" (Results 1 – 1 of 1) sorted by relevance

/optee_os/core/tee/
H A Dtee_svc_cryp.c7e35937aae6d65507bab36f10bd46249de6a835c Mon Jan 25 15:03:52 UTC 2021 Jerome Forissier <jerome@forissier.org> core: crypto: sm2: do not panic core if key allocation fails

During SM2 key derivation via syscall_cryp_derive_key(), if
crypto_acipher_alloc_ecc_public_key() fails for whatever reason in
get_sm2_kep_params(), peer_key and/or peer_eph_key are left in an invalid
state and it is incorrect to call crypto_acipher_free_ecc_public_key()
in this case. Doing so causes a core panic:

E/TC:? 0 assertion 'key->ops && key->ops->free' failed at core/crypto/crypto.c:702 <crypto_acipher_free_ecc_public_key>
E/TC:1 0 Panic at core/kernel/assert.c:28 <_assert_break>

Fix the get_sm2_kep_params() cleanup code to avoid this situation.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>