From ca49f0d3ab90b920535219d8bb58c222125ae2ef Mon Sep 17 00:00:00 2001 From: Harish Jenny K N Date: Mon, 28 Feb 2022 21:36:31 +0530 Subject: [PATCH] crypto_test: Get the return value of TEE_GetObjectInfo1 Get the TEE_GetObjectInfo1 to know if failure has happened Signed-off-by: Harish Jenny K N Change-Id: Ifa0560fdb67e26084992b987ac177df5cedf4354 --- internal_api/crypto_test.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/internal_api/crypto_test.c b/internal_api/crypto_test.c index 9984b27..bd781e7 100644 --- a/internal_api/crypto_test.c +++ b/internal_api/crypto_test.c @@ -500,7 +500,11 @@ static int warp_sym_op(TEE_ObjectHandle key, expectInfoM.keyInformation[0].keySize = 0; expectInfoM.keyInformation[0].requiredKeyUsage = 0; - TEE_GetObjectInfo1(key, &info); + ret = TEE_GetObjectInfo1(key, &info); + if (ret != TEE_SUCCESS) { + PRI_FAIL("TEE_GetObjectInfo1 Failed : 0x%x", ret); + goto err; + } ret = TEE_AllocateOperation(&handle, alg, mode, info.maxObjectSize); if (ret != TEE_SUCCESS) { @@ -579,7 +583,8 @@ static int warp_sym_op(TEE_ObjectHandle key, TEE_FreeOperation(handle); return 0; err: - TEE_FreeOperation(handle); + if (handle) + TEE_FreeOperation(handle); return 1; } @@ -732,7 +737,11 @@ static int warp_asym_op(TEE_ObjectHandle key, TEE_OperationHandle handle = (TEE_OperationHandle)NULL; TEE_ObjectInfo info; - TEE_GetObjectInfo1(key, &info); + ret = TEE_GetObjectInfo1(key, &info); + if (ret != TEE_SUCCESS) { + PRI_FAIL("TEE_GetObjectInfo1 Failed : 0x%x", ret); + goto err; + } ret = TEE_AllocateOperation(&handle, alg, mode, info.maxObjectSize); if (ret != TEE_SUCCESS) { @@ -795,7 +804,8 @@ static int warp_asym_op(TEE_ObjectHandle key, return 0; err: - TEE_FreeOperation(handle); + if (handle) + TEE_FreeOperation(handle); return 1; }