Skip to content

Commit

Permalink
xtest: combine aes_perf, hash_perf and asym_cipher_perf into crypto_perf
Browse files Browse the repository at this point in the history
There is quite a bit of copy in these files.So, I consolidate the code
to make it easier to maintain.

Signed-off-by: Zexi Yu <[email protected]>
  • Loading branch information
yuzexiyzx committed Sep 19, 2023
1 parent 2be5b36 commit d7350b2
Show file tree
Hide file tree
Showing 34 changed files with 1,115 additions and 1,395 deletions.
4 changes: 1 addition & 3 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/host/xtest \
$(LOCAL_PATH)/ta/storage_benchmark/include \
$(LOCAL_PATH)/ta/concurrent/include \
$(LOCAL_PATH)/ta/concurrent_large/include \
$(LOCAL_PATH)/ta/hash_perf/include \
$(LOCAL_PATH)/ta/asym_cipher_perf/include \
$(LOCAL_PATH)/ta/aes_perf/include \
$(LOCAL_PATH)/ta/crypto_perf/include \
$(LOCAL_PATH)/ta/socket/include \
$(LOCAL_PATH)/ta/sdp_basic/include \
$(LOCAL_PATH)/ta/tpm_log_test/include \
Expand Down
4 changes: 1 addition & 3 deletions host/xtest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ CFLAGS += -I../../ta/sims_keepalive/include
CFLAGS += -I../../ta/storage_benchmark/include
CFLAGS += -I../../ta/concurrent/include
CFLAGS += -I../../ta/concurrent_large/include
CFLAGS += -I../../ta/hash_perf/include
CFLAGS += -I../../ta/asym_cipher_perf/include
CFLAGS += -I../../ta/aes_perf/include
CFLAGS += -I../../ta/crypto_perf/include
CFLAGS += -I../../ta/socket/include
CFLAGS += -I../../ta/sdp_basic/include
CFLAGS += -I../../ta/tpm_log_test/include
Expand Down
10 changes: 5 additions & 5 deletions host/xtest/aes_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ta_aes_perf.h>
#include <ta_crypto_perf.h>
#include <tee_client_api.h>
#include <tee_client_api_extensions.h>
#include <time.h>
Expand Down Expand Up @@ -109,7 +109,7 @@ static void check_res(TEEC_Result res, const char *errmsg, uint32_t *orig)
static void open_ta(void)
{
TEEC_Result res = TEEC_ERROR_GENERIC;
TEEC_UUID uuid = TA_AES_PERF_UUID;
TEEC_UUID uuid = TA_CRYPTO_PERF_UUID;
uint32_t err_origin = 0;

res = TEEC_InitializeContext(NULL, &ctx);
Expand Down Expand Up @@ -354,7 +354,7 @@ static void prepare_key(int decrypt, int keysize, int mode)
TEEC_Result res = TEEC_ERROR_GENERIC;
uint32_t ret_origin = 0;
TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
uint32_t cmd = TA_AES_PERF_CMD_PREPARE_KEY;
uint32_t cmd = TA_CIPHER_PERF_CMD_PREPARE_KEY;

op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_INPUT,
TEEC_NONE, TEEC_NONE);
Expand Down Expand Up @@ -432,8 +432,8 @@ void aes_perf_run_test(int mode, int keysize, int decrypt, size_t size, size_t u
TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
int n0 = n;
double sd = 0;
uint32_t cmd = is_sdp_test ? TA_AES_PERF_CMD_PROCESS_SDP :
TA_AES_PERF_CMD_PROCESS;
uint32_t cmd = is_sdp_test ? TA_CIPHER_PERF_CMD_PROCESS_SDP :
TA_CIPHER_PERF_CMD_PROCESS;

if (input_buffer == BUFFER_UNSPECIFIED)
input_buffer = BUFFER_SHM_ALLOCATED;
Expand Down
3 changes: 1 addition & 2 deletions host/xtest/asym_cipher_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ta_asym_cipher_perf.h>
#include <tee_client_api.h>
#include <tee_client_api_extensions.h>
#include <time.h>
Expand Down Expand Up @@ -62,7 +61,7 @@ static void check_res(TEEC_Result res, const char *errmsg, uint32_t *orig)

static void open_ta(void)
{
TEEC_UUID uuid = TA_ASYM_CIPHER_PERF_UUID;
TEEC_UUID uuid = TA_CRYPTO_PERF_UUID;
TEEC_Result res = TEEC_ERROR_GENERIC;
uint32_t err_origin = 0;

Expand Down
5 changes: 1 addition & 4 deletions host/xtest/crypto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
#ifndef XTEST_CRYPTO_COMMON_H
#define XTEST_CRYPTO_COMMON_H

#include "ta_aes_perf.h"
#include "ta_hash_perf.h"
#include "ta_asym_cipher_perf.h"

#include "ta_crypto_perf.h"

#define AES_PERF_INPLACE 0

Expand Down
2 changes: 1 addition & 1 deletion host/xtest/hash_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void check_res(TEEC_Result res, const char *errmsg, uint32_t *orig)
static void open_ta(void)
{
TEEC_Result res = TEEC_ERROR_GENERIC;
TEEC_UUID uuid = TA_HASH_PERF_UUID;
TEEC_UUID uuid = TTA_CRYPTO_PERF_UUID;
uint32_t err_origin = 0;

res = TEEC_InitializeContext(NULL, &ctx);
Expand Down
4 changes: 1 addition & 3 deletions ta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ add_library(${PROJECT_NAME} INTERFACE)

target_include_directories(${PROJECT_NAME}
INTERFACE include
INTERFACE aes_perf/include
INTERFACE concurrent/include
INTERFACE concurrent_large/include
INTERFACE create_fail_test/include
Expand All @@ -13,8 +12,7 @@ target_include_directories(${PROJECT_NAME}
INTERFACE os_test/include
INTERFACE rpc_test/include
INTERFACE sdp_basic/include
INTERFACE hash_perf/include
INTERFACE asym_cipher_perf/include
INTERFACE crypto_perf/include
INTERFACE sims/include
INTERFACE miss/include
INTERFACE sims_keepalive/include
Expand Down
4 changes: 1 addition & 3 deletions ta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ TA_DIRS := create_fail_test \
concurrent \
concurrent_large \
storage_benchmark \
hash_perf \
aes_perf \
asym_cipher_perf \
crypto_perf \
socket \
supp_plugin \
large \
Expand Down
38 changes: 0 additions & 38 deletions ta/aes_perf/include/ta_aes_perf.h

This file was deleted.

16 changes: 0 additions & 16 deletions ta/aes_perf/include/ta_aes_perf_priv.h

This file was deleted.

21 changes: 0 additions & 21 deletions ta/aes_perf/include/user_ta_header_defines.h

This file was deleted.

Loading

0 comments on commit d7350b2

Please sign in to comment.