Skip to content

Commit 7ef9533

Browse files
committed
platform: add nrf7120 target support
Add target device api for nrf7120. Signed-off-by: Travis Lam <[email protected]>
1 parent a155013 commit 7ef9533

File tree

8 files changed

+908
-1
lines changed

8 files changed

+908
-1
lines changed

api-tests/platform/drivers/watchdog/nrf/nrf_wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define NRF_WDT31_NS ((struct NRF_WDT_Type *)0x40109000)
3636
#define NRF_WDT0_NS ((struct NRF_WDT_Type *)0x40018000)
3737

38-
#ifdef NRF54L15_XXAA
38+
#if defined(NRF54L15_XXAA) || defined(NRF7120_ENGA_XXAA)
3939
#define PSA_TEST_WDT_INSTANCE NRF_WDT31_NS
4040
#else
4141
#define PSA_TEST_WDT_INSTANCE NRF_WDT0_NS
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/** @file
2+
* Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved.
3+
* SPDX-License-Identifier : Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
**/
17+
18+
#ifndef _PAL_ATTESTATION_CONFIG_H_
19+
#define _PAL_ATTESTATION_CONFIG_H_
20+
21+
#define COSE_ALGORITHM_ES256 -7
22+
#define COSE_ALG_SHA256_PROPRIETARY -72000
23+
24+
#define USEFUL_BUF_MAKE_STACK_UB UsefulBuf_MAKE_STACK_UB
25+
26+
#define COSE_SIG_CONTEXT_STRING_SIGNATURE1 "Signature1"
27+
28+
/* Private value. Intentionally not documented for Doxygen.
29+
* This is the size allocated for the encoded protected headers. It
30+
* needs to be big enough for make_protected_header() to succeed. It
31+
* currently sized for one header with an algorithm ID up to 32 bits
32+
* long -- one byte for the wrapping map, one byte for the label, 5
33+
* bytes for the ID. If this is made accidentially too small, QCBOR will
34+
* only return an error, and not overrun any buffers.
35+
*
36+
* 9 extra bytes are added, rounding it up to 16 total, in case some
37+
* other protected header is to be added.
38+
*/
39+
#define T_COSE_SIGN1_MAX_PROT_HEADER (1+1+5+9)
40+
41+
/**
42+
* This is the size of the first part of the CBOR encoded TBS
43+
* bytes. It is around 20 bytes. See create_tbs_hash().
44+
*/
45+
#define T_COSE_SIZE_OF_TBS ( \
46+
1 + /* For opening the array */ \
47+
sizeof(COSE_SIG_CONTEXT_STRING_SIGNATURE1) + /* "Signature1" */ \
48+
2 + /* Overhead for encoding string */ \
49+
T_COSE_SIGN1_MAX_PROT_HEADER + /* entire protected headers */ \
50+
3 * (/* 3 NULL bstrs for fields not used */ \
51+
1 /* size of a NULL bstr */ \
52+
) \
53+
)
54+
55+
#define NULL_USEFUL_BUF_C NULLUsefulBufC
56+
57+
#define ATTEST_PUBLIC_KEY_SLOT 4
58+
#define ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH (1 + 2 * PSA_BITS_TO_BYTES(256))
59+
60+
typedef struct {
61+
uint8_t *pubx_key;
62+
size_t pubx_key_size;
63+
uint8_t *puby_key;
64+
size_t puby_key_size;
65+
} ecc_key_t;
66+
67+
struct ecc_public_key_t {
68+
const uint8_t a;
69+
uint8_t public_key[]; /* X-coordinate || Y-coordinate */
70+
};
71+
72+
static const struct ecc_public_key_t attest_public_key = {
73+
/* Constant byte */
74+
0x04,
75+
/* X-coordinate */
76+
{0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
77+
0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
78+
0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
79+
0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F,
80+
/* Y-coordinate */
81+
0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
82+
0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
83+
0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
84+
0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64},
85+
};
86+
87+
static const uint8_t initial_attestation_public_x_key[] = {
88+
0x79, 0xEB, 0xA9, 0x0E, 0x8B, 0xF4, 0x50, 0xA6,
89+
0x75, 0x15, 0x76, 0xAD, 0x45, 0x99, 0xB0, 0x7A,
90+
0xDF, 0x93, 0x8D, 0xA3, 0xBB, 0x0B, 0xD1, 0x7D,
91+
0x00, 0x36, 0xED, 0x49, 0xA2, 0xD0, 0xFC, 0x3F
92+
};
93+
94+
static const uint8_t initial_attestation_public_y_key[] = {
95+
0xBF, 0xCD, 0xFA, 0x89, 0x56, 0xB5, 0x68, 0xBF,
96+
0xDB, 0x86, 0x73, 0xE6, 0x48, 0xD8, 0xB5, 0x8D,
97+
0x92, 0x99, 0x55, 0xB1, 0x4A, 0x26, 0xC3, 0x08,
98+
0x0F, 0x34, 0x11, 0x7D, 0x97, 0x1D, 0x68, 0x64
99+
};
100+
101+
/* Initialize the structure with given public key */
102+
static const ecc_key_t attest_key = {
103+
(uint8_t *)initial_attestation_public_x_key,
104+
sizeof(initial_attestation_public_x_key),
105+
(uint8_t *)initial_attestation_public_y_key,
106+
sizeof(initial_attestation_public_y_key)
107+
};
108+
109+
#endif /* _PAL_ATTESTATION_CONFIG_H_ */
110+
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/** @file
2+
* Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved.
3+
* SPDX-License-Identifier : Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
**/
17+
18+
#ifndef _PAL_CONFIG_H_
19+
#define _PAL_CONFIG_H_
20+
21+
#include "pal_crypto_config.h"
22+
#include "pal_attestation_config.h"
23+
#include "pal_storage_config.h"
24+
25+
26+
/* Define PSA test suite dependent macros for non-cmake build */
27+
#if !defined(PSA_CMAKE_BUILD)
28+
29+
/* Print verbosity = TEST */
30+
#define VERBOSE 3
31+
32+
/* NSPE or SPE VAL build? */
33+
#define VAL_NSPE_BUILD
34+
35+
/* NSPE or SPE TEST build? */
36+
#define NONSECURE_TEST_BUILD
37+
38+
/* If not defined, skip watchdog programming */
39+
#define WATCHDOG_AVAILABLE
40+
41+
/* Are Dynamic memory APIs available to secure partition? */
42+
#define SP_HEAP_MEM_SUPP
43+
44+
/* PSA Isolation level supported by platform */
45+
#define PLATFORM_PSA_ISOLATION_LEVEL 3
46+
#endif /* PSA_CMAKE_BUILD */
47+
48+
/* Version of crypto spec used in attestation */
49+
#define CRYPTO_VERSION_BETA3
50+
51+
/* Use hardcoded public key */
52+
#define PLATFORM_OVERRIDE_ATTEST_PK
53+
54+
/*
55+
* Include of PSA defined Header files
56+
*/
57+
#ifdef IPC
58+
/* psa/client.h: Contains the PSA Client API elements */
59+
#include "psa/client.h"
60+
61+
/*
62+
* psa_manifest/sid.h: Macro definitions derived from manifest files that map from RoT Service
63+
* names to Service IDs (SIDs). Partition manifest parse build tool must provide the implementation
64+
* of this file.
65+
*/
66+
#include "psa_manifest/sid.h"
67+
68+
/*
69+
* psa_manifest/pid.h: Secure Partition IDs
70+
* Macro definitions that map from Secure Partition names to Secure Partition IDs.
71+
* Partition manifest parse build tool must provide the implementation of this file.
72+
*/
73+
#include "psa_manifest/pid.h"
74+
#endif
75+
76+
#ifdef CRYPTO
77+
/* psa/crypto.h: Contains the PSA Crypto API elements */
78+
#include "psa/crypto.h"
79+
#endif
80+
81+
#if defined(INTERNAL_TRUSTED_STORAGE) || defined(STORAGE)
82+
/* psa/internal_trusted_storage.h: Contains the PSA ITS API elements */
83+
#include "psa/internal_trusted_storage.h"
84+
#endif
85+
86+
#if defined(PROTECTED_STORAGE) || defined(STORAGE)
87+
/* psa/protected_storage.h: Contains the PSA PS API elements */
88+
#include "psa/protected_storage.h"
89+
#endif
90+
91+
#ifdef INITIAL_ATTESTATION
92+
/* psa/initial_attestation.h: Contains the PSA Initial Attestation API elements */
93+
#include "psa/initial_attestation.h"
94+
#endif
95+
96+
extern int tfm_log_printf(const char *, ...);
97+
extern int32_t tfm_platform_system_reset(void);
98+
99+
/* Initialize the timer with the given number of ticks. */
100+
extern void pal_timer_init_ns(uint32_t ticks);
101+
102+
/* Start the timer. */
103+
extern void pal_timer_start_ns(void);
104+
105+
/* Stop and reset the timer. */
106+
extern void pal_timer_stop_ns(void);
107+
108+
/* Get the address of a free, word-aligned, 1K memory area. */
109+
extern uint32_t pal_nvmem_get_addr(void);
110+
111+
#endif /* _PAL_CONFIG_H_ */

0 commit comments

Comments
 (0)