From 9ab92ded71efa989c5de986a2be3734423fcef28 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Wed, 28 Jun 2023 14:37:37 +0200 Subject: [PATCH] core: tee_svc_cryp: report RSAES_PKCS1_OAEP_MGF1 bad hash ID Fixes syscall_asymm_operate() to report inconsistent hash algorithm specified as attribute for TEE_ALG_RSAES_PKCS1_OAEP_MGF1_* operations as OP-TEE only supports the hash predefined for the request algorithm TEE_ALG_RSAES_PKCS1_OAEP_MGF1_xxx. Link: https://github.com/OP-TEE/optee_os/issues/6143 Reviewed-by: Jens Wiklander Signed-off-by: Etienne Carriere --- core/tee/tee_svc_cryp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tee/tee_svc_cryp.c b/core/tee/tee_svc_cryp.c index eda285c213b..85b095444c0 100644 --- a/core/tee/tee_svc_cryp.c +++ b/core/tee/tee_svc_cryp.c @@ -4257,14 +4257,14 @@ TEE_Result syscall_asymm_operate(unsigned long state, if (params[n].content.ref.length != sizeof(hash)) { res = TEE_ERROR_BAD_PARAMETERS; - break; + goto out; } memcpy(&hash, params[n].content.ref.buffer, sizeof(hash)); if (hash != TEE_INTERNAL_HASH_TO_ALGO(cs->algo)) { res = TEE_ERROR_NOT_SUPPORTED; - break; + goto out; } } }