17 #include "region_defs.h"
19 #define ECC_P256_PUBLIC_KEY_SIZE PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(256)
20 #define IOVEC_LEN(x) (sizeof(x)/sizeof(x[0]))
24 int32_t g_attest_caller_id;
30 uint8_t token_buff[PSA_INITIAL_ATTEST_TOKEN_MAX_SIZE];
31 uint32_t bytes_read = 0;
32 size_t challenge_size = msg->
in_size[0];
33 size_t token_size = msg->
out_size[0];
35 {challenge_buff, challenge_size}
38 {token_buff,
sizeof(token_buff)}
44 if (token_size <
sizeof(token_buff)) {
45 out_vec[0].
len = token_size;
51 challenge_buff, challenge_size);
52 if (bytes_read != challenge_size) {
68 size_t challenge_size;
70 size_t bytes_read = 0;
72 {&challenge_size, msg->
in_size[0]}
78 if (msg->
in_size[0] !=
sizeof(challenge_size)
79 || msg->
out_size[0] !=
sizeof(token_size)) {
87 &challenge_size, msg->
in_size[0]);
88 if (bytes_read != msg->
in_size[0]) {
109 {.
base = key_buf, .len =
sizeof(key_buf)},
110 {.base = &curve_type, .len =
sizeof(curve_type)},
111 {.base = &key_len, .len =
sizeof(key_len)}
142 static void tfm_abort(
void)
148 static void attest_signal_handle(
psa_signal_t signal, attest_func_t pfn)
153 status =
psa_get(signal, &msg);
184 attest_signal_handle(TFM_ATTEST_GET_TOKEN_SIGNAL,
185 psa_attest_get_token);
187 attest_signal_handle(TFM_ATTEST_GET_TOKEN_SIZE_SIGNAL,
188 psa_attest_get_token_size);
190 attest_signal_handle(TFM_ATTEST_GET_PUBLIC_KEY_SIGNAL,
191 tfm_attest_get_public_key);
psa_status_t initial_attest_get_token_size(const psa_invec *in_vec, uint32_t num_invec, psa_outvec *out_vec, uint32_t num_outvec)
Get the size of the initial attestation token.
#define TFM_ATTEST_GET_PUBLIC_KEY_SIGNAL
#define PSA_ERROR_BUFFER_TOO_SMALL
Platform Security Architecture cryptography module.
#define ECC_P256_PUBLIC_KEY_SIZE
psa_status_t initial_attest_get_public_key(const psa_invec *in_vec, uint32_t num_invec, psa_outvec *out_vec, uint32_t num_outvec)
Get the initial attestation public key.
size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx, void *buffer, size_t num_bytes)
Read a message parameter or part of a message parameter from a client input vector.
psa_status_t initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec, psa_outvec *out_vec, uint32_t num_outvec)
Get initial attestation token.
#define PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64
#define PSA_ERROR_GENERIC_ERROR
#define PSA_ERROR_INVALID_ARGUMENT
psa_status_t attest_partition_init(void)
#define PSA_IPC_DISCONNECT
size_t in_size[PSA_MAX_IOVEC]
void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx, const void *buffer, size_t num_bytes)
Write a message response to a client output vector.
void psa_reply(psa_handle_t msg_handle, psa_status_t status)
Complete handling of a specific message and unblock the client.
psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
Return the Secure Partition interrupt signals that have been asserted from a subset of signals provid...
#define TFM_ATTEST_GET_TOKEN_SIGNAL
#define TFM_ATTEST_GET_TOKEN_SIZE_SIGNAL
psa_status_t attest_init(void)
Initialise the initial attestation service during the TF-M boot up process.
size_t out_size[PSA_MAX_IOVEC]
psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg)
Retrieve the message which corresponds to a given RoT Service signal and remove the message from the ...
int32_t psa_status_t
Function return status.