Transform TEE_ERROR_NOT_SUPPORTED to TEE_ERROR_BAD_PARAMETERS for TEE_AEInit() 71/297171/2
authorDongsun Lee <ds73.lee@samsung.com>
Fri, 11 Aug 2023 06:23:07 +0000 (15:23 +0900)
committerDong Sun Lee <ds73.lee@samsung.com>
Fri, 11 Aug 2023 06:49:46 +0000 (06:49 +0000)
Change-Id: I710f25150a3da78f2b7c606987a3ba9226d413ce

ta/src/cmd_exec.c
ta/src/crypto_auth.c

index c760b76daac9ce1dfd0ef4ac98ca69182d015628..c71bc3f2b6e90b3de3f4ac63fc3676618a8d7898 100644 (file)
@@ -2673,6 +2673,9 @@ TEE_Result KM_ExecCmdCipherInit(TEE_Param param[4])
 
        // Do Cipher Init
        ret = TEE_AEInit(op, iv.data, iv.data_size, tag_len_bits, 0, 0);
+       if (TEE_ERROR_NOT_SUPPORTED == ret) {
+               ret = TEE_ERROR_BAD_PARAMETERS;
+       }
        if (TEE_SUCCESS != ret) {
                LOG("TEE_AEInit failed with error=%x.", ret);
                goto clean;
index c8b1270bb7e1a0113acd528915821a38849024c5..726a68ad97b3d921bb650439986f5ae8ad369a4d 100644 (file)
@@ -36,6 +36,9 @@ TEE_Result KM_AuthEncrypt(TEE_OperationHandle hndl, void *iv, uint32_t iv_size,
        }
 
        ret = TEE_AEInit(hndl, iv, (size_t)iv_size, tag_len_bits, aad_size, payload_len_bits);
+       if (TEE_ERROR_NOT_SUPPORTED == ret) {
+               ret = TEE_ERROR_BAD_PARAMETERS;
+       }
        if (TEE_SUCCESS != ret) {
                LOG("TEE_AEInit failed with error=%x.", ret);
                return ret;
@@ -62,6 +65,9 @@ TEE_Result KM_AuthDecrypt(TEE_OperationHandle hndl, void *iv, uint32_t iv_size,
        TEE_Result ret = TEE_SUCCESS;
 
        ret = TEE_AEInit(hndl, iv, (size_t)iv_size, tag_len_bits, aad_size, payload_len_bits);
+       if (TEE_ERROR_NOT_SUPPORTED == ret) {
+               ret = TEE_ERROR_BAD_PARAMETERS;
+       }
        if (TEE_SUCCESS != ret) {
                LOG("TEE_AEInit failed with error=%x.", ret);
                return ret;