1 /*
2 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #include <assert.h>
8 #include <errno.h>
9 #include <stdint.h>
10
11 #include <cca_attestation.h>
12 #include <common/debug.h>
13 #include <plat/common/common_def.h>
14 #include <psa/error.h>
15
plat_rmmd_get_cca_attest_token(uintptr_t buf,size_t * len,uintptr_t hash,size_t hash_size,size_t * remaining_len)16 int plat_rmmd_get_cca_attest_token(uintptr_t buf, size_t *len,
17 uintptr_t hash, size_t hash_size,
18 size_t *remaining_len)
19 {
20 psa_status_t ret;
21
22 assert(*len == SZ_4K);
23
24 ret = cca_attestation_get_plat_token(buf, len, hash, hash_size);
25 if (ret != PSA_SUCCESS) {
26 ERROR("Unable to fetch CCA attestation token\n");
27 return -1;
28 }
29
30 assert(*len <= SZ_4K);
31
32 *remaining_len = 0;
33
34 return 0;
35 }
36