-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xtest: combine aes and hash into crypto_perf and add SM4 algorithm
There is quite a bit of copy in these files.So, I cosolidate the code to make it easier to maintain.In addition, SM4 algorithm is added. Signed-off-by: Zexi Yu <yuzexi@hisilicon.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
- Loading branch information
Showing
27 changed files
with
706 additions
and
810 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
local_module := e626662e-c0e2-485c-b8c8-09fbce6edf3d.ta | ||
local_module := 02a42f43-d8b7-4a57-aa4d-87bd9b5587cb.ta | ||
include $(BUILD_OPTEE_MK) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BINARY = 02a42f43-d8b7-4a57-aa4d-87bd9b5587cb | ||
|
||
include ../ta_common.mk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/* | ||
* Copyright (c) 2015, Linaro Limited | ||
*/ | ||
|
||
#ifndef TA_CRYPTO_PERF_H | ||
#define TA_CRYPTO_PERF_H | ||
|
||
#define TA_CRYPTO_PERF_UUID { 0x02a42f43, 0xd8b7, 0x4a57, \ | ||
{ 0xaa, 0x4d, 0x87, 0xbd, 0x9b, 0x55, 0x87, 0xcb } } | ||
|
||
/* | ||
* Commands implemented by the TA | ||
*/ | ||
|
||
#define TA_CRYPTO_PERF_CMD_CIPHER_PREPARE_KEY 0 | ||
#define TA_CRYPTO_PERF_CMD_CIPHER_PROCESS 1 | ||
#define TA_CRYPTO_PERF_CMD_CIPHER_PROCESS_SDP 2 | ||
#define TA_CRYPTO_PERF_CMD_HASH_PREPARE_OP 3 | ||
#define TA_CRYPTO_PERF_CMD_HASH_PROCESS 4 | ||
|
||
/* | ||
* Supported AES modes of operation | ||
*/ | ||
|
||
#define TA_AES_ECB 0 | ||
#define TA_AES_CBC 1 | ||
#define TA_AES_CTR 2 | ||
#define TA_AES_XTS 3 | ||
#define TA_AES_GCM 4 | ||
|
||
#define TA_SM4_ECB 5 | ||
#define TA_SM4_CBC 6 | ||
#define TA_SM4_CTR 7 | ||
#define TA_SM4_XTS 8 | ||
|
||
/* | ||
* AES key sizes | ||
*/ | ||
#define AES_128 128 | ||
#define AES_192 192 | ||
#define AES_256 256 | ||
|
||
/* | ||
* Supported hash algorithms | ||
*/ | ||
|
||
#define TA_SHA_SHA1 0 | ||
#define TA_SHA_SHA224 1 | ||
#define TA_SHA_SHA256 2 | ||
#define TA_SHA_SHA384 3 | ||
#define TA_SHA_SHA512 4 | ||
#define TA_SM3 5 | ||
#define TA_HMAC_SHA1 6 | ||
#define TA_HMAC_SHA224 7 | ||
#define TA_HMAC_SHA256 8 | ||
#define TA_HMAC_SHA384 9 | ||
#define TA_HMAC_SHA512 10 | ||
#define TA_HMAC_SM3 11 | ||
|
||
#define PKCS_V1_5_MIN 11 | ||
#define BITS_TO_BYTES(len) (((len) + 7) / 8) | ||
#define OAEP_HASH_LEN(hsz) ((hsz) * 2) | ||
#define OAEP_OTHER_LEN 2 | ||
#define PSS_OTHER_LEN 2 | ||
|
||
#define DERCODE_SHA1_LEN 15 | ||
#define DERCODE_SHA_LEN 19 | ||
#define SHA1_LEN 20 | ||
#define SHA224_LEN 28 | ||
#define SHA256_LEN 32 | ||
#define SHA384_LEN 48 | ||
#define SHA512_LEN 64 | ||
|
||
#endif /* TA_CRYPTO_PERF_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/* | ||
* Copyright (c) 2015, Linaro Limited | ||
*/ | ||
|
||
#ifndef TA_CRYPTO_PERF_PRIV_H | ||
#define TA_CRYPTO_PERF_PRIV_H | ||
|
||
#include <tee_api.h> | ||
|
||
TEE_Result cmd_cipher_prepare_key(uint32_t param_types, TEE_Param params[4]); | ||
TEE_Result cmd_cipher_process(uint32_t param_types, TEE_Param params[4], | ||
bool sdp); | ||
TEE_Result cmd_hash_prepare_op(uint32_t param_types, TEE_Param params[4]); | ||
TEE_Result cmd_hash_process(uint32_t param_types, TEE_Param params[4]); | ||
void cmd_clean_obj(void); | ||
void cmd_clean_res(void); | ||
|
||
#endif /* TA_CRYPTO_PERF_PRIV_H */ |
36 changes: 18 additions & 18 deletions
36
...ash_perf/include/user_ta_header_defines.h → ...pto_perf/include/user_ta_header_defines.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/* | ||
* Copyright (c) 2015, Linaro Limited | ||
* All rights reserved. | ||
*/ | ||
|
||
#ifndef USER_TA_HEADER_DEFINES_H | ||
#define USER_TA_HEADER_DEFINES_H | ||
|
||
#include "ta_hash_perf.h" | ||
|
||
#define TA_UUID TA_HASH_PERF_UUID | ||
|
||
#define TA_FLAGS (TA_FLAG_USER_MODE | TA_FLAG_EXEC_DDR) | ||
#define TA_STACK_SIZE (2 * 1024) | ||
#define TA_DATA_SIZE (32 * 1024) | ||
|
||
#endif | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/* | ||
* Copyright (c) 2015, Linaro Limited | ||
*/ | ||
|
||
#ifndef USER_TA_HEADER_DEFINES_H | ||
#define USER_TA_HEADER_DEFINES_H | ||
|
||
#include "ta_crypto_perf.h" | ||
|
||
#define TA_UUID TA_CRYPTO_PERF_UUID | ||
|
||
#define TA_FLAGS 0 | ||
|
||
#define TA_STACK_SIZE (2 * 1024) | ||
#define TA_DATA_SIZE (32 * 1024) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
global-incdirs-y += include | ||
srcs-y += ta_entry.c | ||
srcs-y += ta_aes_perf.c | ||
global-incdirs-y += include | ||
srcs-y += ta_entry.c | ||
srcs-y += ta_crypto_perf.c |
Oops, something went wrong.