diff options
author | Shawn Shan <Shawn.Shan@arm.com> | 2021-07-09 10:13:35 +0800 |
---|---|---|
committer | Shawn Shan <Shawn.Shan@arm.com> | 2021-08-16 10:18:49 +0800 |
commit | 40a0dce0a7885143f92eca534c3053d142faf37e (patch) | |
tree | a45e7932aa2c63af75a2428ccc0e16347f408e3f /interface | |
parent | 083d23e042dd498f69d0786a806af50c7fa0f28c (diff) | |
download | trusted-firmware-m-40a0dce0a7885143f92eca534c3053d142faf37e.tar.gz |
Attestation: Implement Attest services with static handle
Change Initial Attestation services to one stateless service.
Change-Id: Ie4578df8c4295e8c8e74c96c8caeb946bfc1e637
Signed-off-by: Shawn Shan <Shawn.Shan@arm.com>
Diffstat (limited to 'interface')
-rw-r--r-- | interface/include/tfm_attest_defs.h | 23 | ||||
-rw-r--r-- | interface/src/tfm_initial_attestation_ipc_api.c | 20 |
2 files changed, 26 insertions, 17 deletions
diff --git a/interface/include/tfm_attest_defs.h b/interface/include/tfm_attest_defs.h new file mode 100644 index 0000000000..dad7769353 --- /dev/null +++ b/interface/include/tfm_attest_defs.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef __TFM_ATTEST_DEFS_H__ +#define __TFM_ATTEST_DEFS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Initial Attestation message types that distinguish Attest services. */ +#define TFM_ATTEST_GET_TOKEN 1001 +#define TFM_ATTEST_GET_TOKEN_SIZE 1002 + +#ifdef __cplusplus +} +#endif + +#endif /* __TFM_ATTEST_DEFS_H__ */ diff --git a/interface/src/tfm_initial_attestation_ipc_api.c b/interface/src/tfm_initial_attestation_ipc_api.c index 43c9b0e479..81c1455ce0 100644 --- a/interface/src/tfm_initial_attestation_ipc_api.c +++ b/interface/src/tfm_initial_attestation_ipc_api.c @@ -10,6 +10,7 @@ #include "psa/client.h" #include "psa/crypto_types.h" #include "psa_manifest/sid.h" +#include "tfm_attest_defs.h" psa_status_t psa_initial_attest_get_token(const uint8_t *auth_challenge, @@ -18,7 +19,6 @@ psa_initial_attest_get_token(const uint8_t *auth_challenge, size_t token_buf_size, size_t *token_size) { - psa_handle_t handle = PSA_NULL_HANDLE; psa_status_t status; psa_invec in_vec[] = { @@ -28,16 +28,9 @@ psa_initial_attest_get_token(const uint8_t *auth_challenge, {token_buf, token_buf_size} }; - handle = psa_connect(TFM_ATTEST_GET_TOKEN_SID, - TFM_ATTEST_GET_TOKEN_VERSION); - if (!PSA_HANDLE_IS_VALID(handle)) { - return PSA_HANDLE_TO_ERROR(handle); - } - - status = psa_call(handle, PSA_IPC_CALL, + status = psa_call(TFM_ATTESTATION_SERVICE_HANDLE, TFM_ATTEST_GET_TOKEN, in_vec, IOVEC_LEN(in_vec), out_vec, IOVEC_LEN(out_vec)); - psa_close(handle); if (status == PSA_SUCCESS) { *token_size = out_vec[0].len; @@ -59,16 +52,9 @@ psa_initial_attest_get_token_size(size_t challenge_size, {token_size, sizeof(size_t)} }; - handle = psa_connect(TFM_ATTEST_GET_TOKEN_SIZE_SID, - TFM_ATTEST_GET_TOKEN_SIZE_VERSION); - if (!PSA_HANDLE_IS_VALID(handle)) { - return PSA_HANDLE_TO_ERROR(handle); - } - - status = psa_call(handle, PSA_IPC_CALL, + status = psa_call(TFM_ATTESTATION_SERVICE_HANDLE, TFM_ATTEST_GET_TOKEN_SIZE, in_vec, IOVEC_LEN(in_vec), out_vec, IOVEC_LEN(out_vec)); - psa_close(handle); return status; } |