Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Soon available commands : TA_INSTALL_KEYS, TA_HAS_KEYS, TA_DEL_KEYS, TA_SIGN_RSA
- Loading branch information
Showing
6 changed files
with
156 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <tee_internal_api.h> | ||
#include <tee_internal_api_extensions.h> | ||
#include <user_ta_header_defines.h> | ||
|
||
/* | ||
* Called when the instance of the TA is created. This is the first call in the | ||
* TA. | ||
*/ | ||
TEE_Result TA_CreateEntryPoint(void) { | ||
DMSG("has been called"); | ||
return TEE_SUCCESS; | ||
} | ||
|
||
/* | ||
* Called when the instance of the TA is destroyed if the TA has not | ||
* crashed or panicked. This is the last call in the TA. | ||
*/ | ||
void TA_DestroyEntryPoint(void) { DMSG("has been called"); } | ||
|
||
/* | ||
* Called when a new session is opened to the TA. *sess_ctx can be updated | ||
* with a value to be able to identify this session in subsequent calls to the | ||
* TA. In this function you will normally do the global initialization for the | ||
* TA. | ||
*/ | ||
TEE_Result TA_OpenSessionEntryPoint(uint32_t __unused param_types, | ||
TEE_Param __maybe_unused params[4], | ||
void __maybe_unused **sess_ctx) { | ||
DMSG("has been called"); | ||
return TEE_SUCCESS; | ||
} | ||
|
||
/* | ||
* Called when a session is closed, sess_ctx hold the value that was | ||
* assigned by TA_OpenSessionEntryPoint(). | ||
*/ | ||
void TA_CloseSessionEntryPoint(void __maybe_unused *sess_ctx) { | ||
DMSG("has been called"); | ||
} | ||
|
||
// Puts the key to the storage | ||
static TEE_Result install_key(uint32_t param_types, TEE_Param params[4]) { | ||
return TEE_SUCCESS; | ||
} | ||
|
||
// Checks if key exists in the storage | ||
static TEE_Result has_key(uint32_t param_types, TEE_Param params[4]) { | ||
return TEE_SUCCESS; | ||
} | ||
|
||
// Performs key deletion from the secure storage | ||
static TEE_Result del_key(uint32_t param_types, TEE_Param params[4]) { | ||
return TEE_SUCCESS; | ||
} | ||
|
||
// Performs RSA signing with a key from secure storage | ||
static TEE_Result sign_rsa(uint32_t param_types, TEE_Param params[4]) { | ||
return TEE_SUCCESS; | ||
} | ||
|
||
/* | ||
* Called when a TA is invoked. sess_ctx hold that value that was | ||
* assigned by TA_OpenSessionEntryPoint(). The rest of the paramters | ||
* comes from normal world. | ||
*/ | ||
TEE_Result TA_InvokeCommandEntryPoint(void __maybe_unused *sess_ctx, | ||
uint32_t cmd_id, uint32_t param_types, | ||
TEE_Param params[4]) { | ||
(void)&sess_ctx; /* Unused parameter */ | ||
switch (cmd_id) { | ||
case TA_INSTALL_KEYS: | ||
return install_key(param_types, params); | ||
case TA_HAS_KEYS: | ||
return has_key(param_types, params); | ||
case TA_DEL_KEYS: | ||
return del_key(param_types, params); | ||
case TA_SIGN_RSA: | ||
return sign_rsa(param_types, params); | ||
default: | ||
return TEE_ERROR_BAD_PARAMETERS; | ||
} | ||
} |
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,5 @@ | ||
# global-incdirs-y += include | ||
srcs-y += TLS_signature.c | ||
|
||
# To remove a certain compiler flag, add a line like this | ||
#cflags-template_ta.c-y += -Wno-strict-prototypes |
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,43 @@ | ||
/* | ||
* The name of this file must not be modified | ||
*/ | ||
|
||
#ifndef USER_TA_HEADER_DEFINES_H | ||
#define USER_TA_HEADER_DEFINES_H | ||
#include <stdint.h> | ||
|
||
/* TA UUID*/ | ||
#define TA_UUID \ | ||
{ \ | ||
0xa3a8cd17, 0x4156, 0x41f5, { \ | ||
0x8a, 0x66, 0xfe, 0x26, 0x43, 0xa1, 0xc9, 0x3e \ | ||
} \ | ||
} | ||
|
||
/* The function IDs implemented in this TA */ | ||
#define TA_INSTALL_KEYS 0 | ||
#define TA_HAS_KEYS 1 | ||
#define TA_DEL_KEYS 2 | ||
#define TA_SIGN_RSA 4 | ||
|
||
/* | ||
* TA properties: multi-instance TA, no specific attribute | ||
* TA_FLAG_EXEC_DDR is meaningless but mandated. | ||
*/ | ||
#define TA_FLAGS TA_FLAG_EXEC_DDR | ||
|
||
/* Provisioned stack size */ | ||
#define TA_STACK_SIZE (64 * 1024) | ||
|
||
/* Provisioned heap size for TEE_Malloc() and friends */ | ||
#define TA_DATA_SIZE (64 * 1024) | ||
|
||
/* Extra properties (give a version id and a string name) */ | ||
#define TA_CURRENT_TA_EXT_PROPERTIES \ | ||
{"gp.ta.description", USER_TA_PROP_TYPE_STRING, \ | ||
"TLS client private key signature"}, \ | ||
{ \ | ||
"gp.ta.version", USER_TA_PROP_TYPE_U32, &(const uint32_t) { 0x0010 } \ | ||
} | ||
|
||
#endif /* USER_TA_HEADER_DEFINES_H */ |