Skip to content

Commit

Permalink
ta: crypto_perf: correct coding style issue in symm tests
Browse files Browse the repository at this point in the history
Sort out some coding style issue that are better being fixed for
test TAs implementation consistency. No functional changes.

Fixes: e18381f ("xtest: combine aes_perf and hash_perf TAs into crypto_perf")
Signed-off-by: Etienne Carriere <[email protected]>
  • Loading branch information
etienne-lms committed Feb 11, 2024
1 parent 7692eb6 commit 17d344f
Showing 1 changed file with 30 additions and 43 deletions.
73 changes: 30 additions & 43 deletions ta/crypto_perf/ta_crypto_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ static bool is_inbuf_a_secure_memref(TEE_Param *param)
* the buffer is nonsecure.
*/
res = TEE_CheckMemoryAccessRights(TEE_MEMORY_ACCESS_ANY_OWNER |
TEE_MEMORY_ACCESS_READ |
TEE_MEMORY_ACCESS_SECURE,
param->memref.buffer, 1);
TEE_MEMORY_ACCESS_READ |
TEE_MEMORY_ACCESS_SECURE,
param->memref.buffer, 1);
return (res == TEE_SUCCESS);
}

Expand All @@ -63,9 +63,9 @@ static bool is_outbuf_a_secure_memref(TEE_Param *param)
* the buffer is nonsecure.
*/
res = TEE_CheckMemoryAccessRights(TEE_MEMORY_ACCESS_ANY_OWNER |
TEE_MEMORY_ACCESS_WRITE |
TEE_MEMORY_ACCESS_SECURE,
param->memref.buffer, 1);
TEE_MEMORY_ACCESS_WRITE |
TEE_MEMORY_ACCESS_SECURE,
param->memref.buffer, 1);
return (res == TEE_SUCCESS);
}

Expand All @@ -87,8 +87,8 @@ static __maybe_unused TEE_Result flush_memref_buffer(TEE_Param *param __unused)
#endif /* CFG_CACHE_API */

TEE_Result cmd_cipher_process(uint32_t param_types,
TEE_Param params[TEE_NUM_PARAMS],
bool use_sdp)
TEE_Param params[TEE_NUM_PARAMS],
bool use_sdp)
{
TEE_Result res = TEE_ERROR_GENERIC;
int n = 0;
Expand Down Expand Up @@ -155,7 +155,7 @@ TEE_Result cmd_cipher_process(uint32_t param_types,
for (i = 0; i < insz / unit; i++) {
res = do_update(crypto_op, in, unit, out, &outsz);
CHECK(res, "TEE_CipherUpdate/TEE_AEUpdate", return res;);
in = (void *)((uintptr_t)in + unit);
in = (void *)((uintptr_t)in + unit);
out = (void *)((uintptr_t)out + unit);
}
if (insz % unit) {
Expand Down Expand Up @@ -185,22 +185,18 @@ TEE_Result cmd_cipher_prepare_key(uint32_t param_types, TEE_Param params[4])
uint32_t keysize = 0;
const uint8_t *ivp = NULL;
size_t ivlen = 0;
static uint8_t cipher_key[] = { 0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B,
0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13,
0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B,
0x1C, 0x1D, 0x1E, 0x1F };
static uint8_t cipher_key2[] = { 0x20, 0x21, 0x22, 0x23,
0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2A, 0x2B,
0x2C, 0x2D, 0x2E, 0x2F,
0x30, 0x31, 0x32, 0x33,
0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3A, 0x3B,
0x3C, 0x3D, 0x3E, 0x3F };
static uint8_t cipher_key[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
};
static uint8_t cipher_key2[] = {
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F
};
uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,
TEE_PARAM_TYPE_VALUE_INPUT,
TEE_PARAM_TYPE_NONE,
Expand Down Expand Up @@ -260,8 +256,7 @@ TEE_Result cmd_cipher_prepare_key(uint32_t param_types, TEE_Param params[4])
CHECK(res, "TEE_PopulateTransientObject", return res;);

if (algo == TEE_ALG_AES_XTS) {
res = TEE_AllocateTransientObject(objectType, keysize,
&hkey2);
res = TEE_AllocateTransientObject(objectType, keysize, &hkey2);
CHECK(res, "TEE_AllocateTransientObject", return res;);

attr.content.ref.buffer = cipher_key2;
Expand Down Expand Up @@ -364,22 +359,14 @@ TEE_Result cmd_hash_prepare_op(uint32_t param_types, TEE_Param params[4])
uint32_t max_key_size = 0;
uint32_t hash_algo = 0;
static uint8_t mac_key[] = {
0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B,
0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13,
0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B,
0x1C, 0x1D, 0x1E, 0x1F,
0x20, 0x21, 0x22, 0x23,
0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2A, 0x2B,
0x2C, 0x2D, 0x2E, 0x2F,
0x30, 0x31, 0x32, 0x33,
0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3A, 0x3B,
0x3C, 0x3D, 0x3E, 0x3F
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F
};
uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,
TEE_PARAM_TYPE_NONE,
Expand Down

0 comments on commit 17d344f

Please sign in to comment.