blob: cfd9d71ada18802da4575e293e648204426af1f1 [file] [log] [blame]
Tamas Bana00f2852019-01-23 21:46:29 +00001/*
David Hu981ecb62019-12-05 17:58:29 +08002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Tamas Bana00f2852019-01-23 21:46:29 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
Tamas Band09c38f2019-01-23 22:04:50 +00008#include <stdint.h>
David Hu981ecb62019-12-05 17:58:29 +08009#include "platform/include/tfm_attest_hal.h"
10#include "platform/include/tfm_plat_boot_seed.h"
11
12/*!
13 * \def BOOT_SEED
14 *
15 * \brief Fixed value for boot seed used for test.
16 */
17#define BOOT_SEED 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, \
18 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, \
19 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, \
20 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF
21
22static const uint8_t boot_seed[BOOT_SEED_SIZE] = {BOOT_SEED};
Tamas Band09c38f2019-01-23 22:04:50 +000023
24/* Example verification service URL for initial attestation token */
25static const char verification_service_url[] = "www.trustedfirmware.org";
26
27/* Example profile definition document for initial attestation token */
Tamas Ban12df1af2019-03-01 12:43:12 +000028static const char attestation_profile_definition[] = "PSA_IOT_PROFILE_1";
Tamas Bana00f2852019-01-23 21:46:29 +000029
30enum tfm_security_lifecycle_t tfm_attest_hal_get_security_lifecycle(void)
31{
32 return TFM_SLC_SECURED;
33}
Tamas Band09c38f2019-01-23 22:04:50 +000034
35const char *
36tfm_attest_hal_get_verification_service(uint32_t *size)
37{
38 *size = sizeof(verification_service_url) - 1;
39
40 return verification_service_url;
41}
42
43const char *
44tfm_attest_hal_get_profile_definition(uint32_t *size)
45{
46 *size = sizeof(attestation_profile_definition) - 1;
47
48 return attestation_profile_definition;
49}
David Hu981ecb62019-12-05 17:58:29 +080050
51enum tfm_plat_err_t tfm_plat_get_boot_seed(uint32_t size, uint8_t *buf)
52{
53 /* FixMe: - This getter function must be ported per target platform.
54 * - Platform service shall provide an API to further interact this
55 * getter function to retrieve the boot seed.
56 */
57
58 uint32_t i;
59 uint8_t *p_dst = buf;
60 const uint8_t *p_src = boot_seed;
61
62 if (size != BOOT_SEED_SIZE) {
63 return TFM_PLAT_ERR_SYSTEM_ERR;
64 }
65
66 for (i = size; i > 0; i--) {
67 *p_dst = *p_src;
68 p_src++;
69 p_dst++;
70 }
71
72 return TFM_PLAT_ERR_SUCCESS;
73}