Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config/examples/polarfire_mpfs250_m.config
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ CFLAGS_EXTRA+=-DSDHCI_FORCE_CARD_DETECT
#ENCRYPT_WITH_AES256=1
#OBJS_EXTRA=src/my_custom_encrypt_key.o

# Keep the golden image encrypted across a failover zeroize: its key lives in
# a second sNVM module that the zeroize never erases. Needs the encrypted build
# above plus SNVM_KEK=1 and DISK_GOLDEN_SLOT=1. SNVM_GOLDEN_ENCKEY_MODULE has no
# default: it must name a writable plaintext sNVM client in your Libero design
# (check one with MPFS_SNVM_DUMP first). Sign the golden image with that module's
# key and the A/B images with module 201.
#DISK_GOLDEN_ENCRYPT_KEY=1
#SNVM_GOLDEN_ENCKEY_MODULE=199

# Used by test-application/ELF wrapper
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000
WOLFBOOT_PARTITION_SIZE=0x4000000
Expand Down
10 changes: 9 additions & 1 deletion docs/PolarFire.md
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,13 @@ Image encryption (`EXT_ENCRYPTED`) needs `EXT_FLASH`, `MMU` or `CUSTOM_ENCRYPT_K

### Field-recoverable zeroize

`DISK_FAILOVER_ZEROIZE=1` (with `DISK_GOLDEN_SLOT=1`, `SNVM_KEK=1` and the `WOLFBOOT_SNVM_WRITE_APPROVED=1` gate every sNVM writer carries) turns a failover to the golden slot into a zeroize: when both operational slots are given up on, wolfBoot zeroes sNVM page `SNVM_ENCKEY_MODULE` (the PUF-wrapped image key, read back and checked; a page that already reads as zeros is not written again) and the head of both operational slots, then boots the golden image. The keystore page is never touched, so the golden image still verifies; it must be a plaintext signed image, since the key that decrypted the operational images is gone. Nothing derived from the PUF is lost: the MRAM log key is re-derived on every boot. Re-provisioning the image key afterwards is the `SNVM_ENCKEY_PROVISION` service flow; a brownout during the zeroize write can leave the page read-only, in which case the device cannot be re-keyed.
`DISK_FAILOVER_ZEROIZE=1` (with `DISK_GOLDEN_SLOT=1`, `SNVM_KEK=1` and the `WOLFBOOT_SNVM_WRITE_APPROVED=1` gate every sNVM writer carries) turns a failover to the golden slot into a zeroize: when both operational slots are given up on, wolfBoot zeroes sNVM page `SNVM_ENCKEY_MODULE` (the PUF-wrapped image key, read back and checked; a page that already reads as zeros is not written again) and the head of both operational slots, then boots the golden image. The keystore page is never touched, so the golden image still verifies; by default it must be a plaintext signed image, since the key that decrypted the operational images is gone. `DISK_GOLDEN_ENCRYPT_KEY=1` lifts that restriction - see below. Nothing derived from the PUF is lost: the MRAM log key is re-derived on every boot. Re-provisioning the image key afterwards is the `SNVM_ENCKEY_PROVISION` service flow; a brownout during the zeroize write can leave the page read-only, in which case the device cannot be re-keyed.

#### Keeping the golden image encrypted

`DISK_GOLDEN_ENCRYPT_KEY=1` (with `DISK_GOLDEN_SLOT=1` and `SNVM_KEK=1`) gives the golden image its own key in `SNVM_GOLDEN_ENCKEY_MODULE`, which the failover never erases. The zeroize still destroys the operational key in `SNVM_ENCKEY_MODULE`, so the operational images become undecryptable while the golden image stays encrypted at rest and bootable. Both keys are wrapped by the same device PUF KEK; the separation is which module gets erased. The platform picks the key with `wolfBoot_select_golden_encrypt_key()`, which has no default implementation on purpose: a target that cannot select a key fails to link rather than reading the golden image under the operational one.

`SNVM_ENCKEY_PROVISION=1` writes both modules. Sign and encrypt the golden image with the golden-module key and the A/B images with the module-201 key; swapping them leaves the golden slot unbootable. `SNVM_GOLDEN_ENCKEY_MODULE` has no default and must be set: it has to name a plaintext sNVM client the Libero design both configures and leaves writable. A page marked ROM cannot be written, and a page never configured as a client cannot even be read, so the provisioning writer's pre-read refuses it. Use `MPFS_SNVM_DUMP` to check a candidate page first. On the Video Kit's current design only the keystore and image-key pages qualify, so a second key there needs a design change. With `SNVM_ENCKEY_PROVISION_EXTERN` the integrator supplies `snvm_golden_enckey_prov_key[32]` and `snvm_golden_enckey_prov_nonce[16]` alongside the operational pair. A golden bitstream that carries sNVM clients should carry the golden key module only: carrying module 201 as well restores the operational key on reapply and so partially undoes the zeroize.

### Build flags summary

Expand All @@ -1381,6 +1387,8 @@ Image encryption (`EXT_ENCRYPTED`) needs `EXT_FLASH`, `MMU` or `CUSTOM_ENCRYPT_K
| `SNVM_KEYSTORE_REQUIRE_ROM` | Refuse to boot unless every keystore page is ROM-flagged (bitstream-provisioned keystore) |
| `MPFS_SCB_SMODE_DENY` | PMP-fence S-mode off the System Controller mailbox and disable its DTB nodes |
| `DISK_FAILOVER_ZEROIZE` | Zero the image-key page and the operational slots when falling back to the golden image |
| `DISK_GOLDEN_ENCRYPT_KEY` | Give the golden image its own key in `SNVM_GOLDEN_ENCKEY_MODULE`, so it stays encrypted across a zeroize |
| `SNVM_GOLDEN_ENCKEY_MODULE` | sNVM module holding the golden image key (no default, required; must differ from `SNVM_ENCKEY_MODULE`, lie outside the keystore range, and be a writable plaintext client in the Libero design) |
| `SNVM_ENCKEY_INSECURE_TEST_KEY` | Acknowledges provisioning the built-in public test key |
| `SNVM_ENCKEY_PROVISION_EXTERN` | Provision a production key instead: the integrator defines `snvm_enckey_prov_key[32]` and `snvm_enckey_prov_nonce[16]` in another object |

Expand Down
2 changes: 1 addition & 1 deletion docs/encrypted_partitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You can use the `CUSTOM_ENCRYPT_KEY` option to implement your own functions for:
`wolfBoot_get_encrypt_key`, `wolfBoot_set_encrypt_key` and
`wolfBoot_erase_encrypt_key`.

For an example that stores the AES key in non-volatile memory wrapped by a device-unique hardware PUF key (Microchip PolarFire SoC), see [PolarFire.md](PolarFire.md#hardware-root-of-trust-puf-kek-snvm-keystore-wrapped-image-key). Note that disk/`NO_PARTITIONS` boot can use `CUSTOM_ENCRYPT_KEY` for image encryption without `EXT_FLASH` or `MMU`.
For an example that stores the AES key in non-volatile memory wrapped by a device-unique hardware PUF key (Microchip PolarFire SoC), see [PolarFire.md](PolarFire.md#hardware-root-of-trust-puf-kek-snvm-keystore-wrapped-image-key). Note that disk/`NO_PARTITIONS` boot can use `CUSTOM_ENCRYPT_KEY` for image encryption without `EXT_FLASH` or `MMU`. A disk-boot target with a golden slot can give the recovery image a key of its own, so it stays encrypted after the operational key is destroyed: see [Keeping the golden image encrypted](PolarFire.md#keeping-the-golden-image-encrypted).

To enable:

Expand Down
9 changes: 8 additions & 1 deletion hal/mpfs250.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
#include "gpt.h"
#include "fdt.h"
#if defined(SNVM_KEYSTORE_PROVISION) || defined(SNVM_ENCKEY_PROVISION) || \
defined(MPFS_SBI_VENDOR) || defined(MPFS_SNVM_DUMP)
defined(SNVM_GOLDEN_ENCKEY_PROVISION) || defined(MPFS_SBI_VENDOR) || \
defined(MPFS_SNVM_DUMP)
#include "mpfs250_snvm.h"
#endif
#if defined(MPFS_SBI_VENDOR) && defined(WOLFBOOT_MMODE_SMODE_BOOT)
Expand Down Expand Up @@ -506,6 +507,12 @@ void hal_init(void)
wolfBoot_panic();
}
#endif
#ifdef SNVM_GOLDEN_ENCKEY_PROVISION
if (snvm_golden_enckey_provision() != 0) {
wolfBoot_printf("golden enckey provision: FAILED\n");
wolfBoot_panic();
}
#endif

#ifdef EXT_FLASH
if (qspi_init() != 0) {
Expand Down
86 changes: 76 additions & 10 deletions hal/mpfs250_snvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/memory.h> /* wc_ForceZero */

#if defined(SNVM_KEYSTORE_PROVISION) || defined(SNVM_ENCKEY_PROVISION)
#if defined(SNVM_KEYSTORE_PROVISION) || defined(SNVM_ENCKEY_PROVISION) || \
defined(SNVM_GOLDEN_ENCKEY_PROVISION)
/* Provisioning runs from hal_init() on every boot of a provisioning image,
* and the programmer reboots the board once on its own, so a page that
* already holds the content is left alone: sNVM pages have a write-cycle
Expand Down Expand Up @@ -420,6 +421,22 @@ int snvm_kek_unwrap(const uint8_t *in, uint32_t insz, uint8_t *key,
#error "SNVM PUF encrypt-key provider expects a 256-bit (AES-256) image key"
#endif

#ifdef DISK_GOLDEN_ENCRYPT_KEY
/* Which module wolfBoot_get_encrypt_key() reads. Defaults to the
* operational one, so the A/B version probe that runs before any slot is
* elected needs no selection. */
static uint8_t snvm_enckey_module = SNVM_ENCKEY_MODULE;

int wolfBoot_select_golden_encrypt_key(int golden)
{
snvm_enckey_module = golden ? SNVM_GOLDEN_ENCKEY_MODULE :
SNVM_ENCKEY_MODULE;
Comment thread
dgarske marked this conversation as resolved.
Resolved
return 0;
}
#else
#define snvm_enckey_module SNVM_ENCKEY_MODULE
#endif

/* Read the wrapped AES key + nonce from sNVM, unwrap the key with the PUF KEK
* and return both. Returns 0 on success. */
int wolfBoot_get_encrypt_key(uint8_t *key, uint8_t *nonce)
Expand All @@ -434,10 +451,11 @@ int wolfBoot_get_encrypt_key(uint8_t *key, uint8_t *nonce)
* or candidate key material in either output. */
wc_ForceZero(key, ENCRYPT_KEY_SIZE);
wc_ForceZero(nonce, ENCRYPT_NONCE_SIZE);
ret = mpfs_snvm_read(SNVM_ENCKEY_MODULE, NULL, NULL, page,
ret = mpfs_snvm_read(snvm_enckey_module, NULL, NULL, page,
MPFS_SNVM_PLAIN_DATA_LEN);
if (ret != 0) {
wolfBoot_printf("encrypt-key: sNVM read failed (%d)\n", ret);
wolfBoot_printf("encrypt-key: sNVM read[%u] failed (%d)\n",
(unsigned)snvm_enckey_module, ret);
return -1;
}
ret = snvm_kek_unwrap(page, SNVM_KEK_WRAPPED_LEN, key, ENCRYPT_KEY_SIZE);
Expand Down Expand Up @@ -507,12 +525,13 @@ int wolfBoot_erase_encrypt_key(void)
}
#endif

#ifdef SNVM_ENCKEY_PROVISION
#if defined(SNVM_ENCKEY_PROVISION) || defined(SNVM_GOLDEN_ENCKEY_PROVISION)
/* One-time: wrap the AES key with the device PUF KEK and store
* [wrapped key][nonce] in sNVM. It must match the sign tool's key file.
* The key comes from snvm_enckey_prov_key/nonce, defined by the integrator in
* another object (SNVM_ENCKEY_PROVISION_EXTERN), or from the built-in public
* test vector, which needs SNVM_ENCKEY_INSECURE_TEST_KEY as acknowledgement. */
#ifdef SNVM_ENCKEY_PROVISION
#if defined(SNVM_ENCKEY_PROVISION_EXTERN)
extern const uint8_t snvm_enckey_prov_key[SNVM_KEK_AESKEY_LEN];
extern const uint8_t snvm_enckey_prov_nonce[ENCRYPT_NONCE_SIZE];
Expand All @@ -536,30 +555,77 @@ static const uint8_t prov_aes_nonce[ENCRYPT_NONCE_SIZE] = {
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f
};
#endif
#endif /* SNVM_ENCKEY_PROVISION */

int snvm_enckey_provision(void)
#ifdef SNVM_GOLDEN_ENCKEY_PROVISION
#if defined(SNVM_ENCKEY_PROVISION_EXTERN)
extern const uint8_t snvm_golden_enckey_prov_key[SNVM_KEK_AESKEY_LEN];
extern const uint8_t snvm_golden_enckey_prov_nonce[ENCRYPT_NONCE_SIZE];
#define prov_golden_aes_key snvm_golden_enckey_prov_key
#define prov_golden_aes_nonce snvm_golden_enckey_prov_nonce
#elif !defined(SNVM_ENCKEY_INSECURE_TEST_KEY)
#error "SNVM_GOLDEN_ENCKEY_PROVISION writes a key into sNVM permanently. Define \
SNVM_ENCKEY_PROVISION_EXTERN and provide snvm_golden_enckey_prov_key/nonce, or define \
SNVM_ENCKEY_INSECURE_TEST_KEY to provision the built-in public test vector."
#else
/* Second publicly known test vector, distinct from the operational one so a
* test cannot pass by reading the wrong module. */
static const uint8_t prov_golden_aes_key[SNVM_KEK_AESKEY_LEN] = {
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
};
static const uint8_t prov_golden_aes_nonce[ENCRYPT_NONCE_SIZE] = {
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f
};
#endif
#endif

static int snvm_enckey_provision_module(uint8_t module, const uint8_t *key,
const uint8_t *nonce)
{
uint8_t page[MPFS_SNVM_PLAIN_DATA_LEN];
int ret, i;

for (i = 0; i < (int)sizeof(page); i++) {
page[i] = 0;
}
ret = snvm_kek_wrap(prov_aes_key, (uint32_t)sizeof(prov_aes_key), page,
ret = snvm_kek_wrap(key, (uint32_t)SNVM_KEK_AESKEY_LEN, page,
SNVM_KEK_WRAPPED_LEN);
if (ret != SNVM_KEK_WRAPPED_LEN) {
wolfBoot_printf("enckey provision: wrap failed (%d)\n", ret);
wc_ForceZero(page, sizeof(page));
return -1;
}
memcpy(page + SNVM_KEK_WRAPPED_LEN, prov_aes_nonce, ENCRYPT_NONCE_SIZE);
ret = snvm_page_write_if_changed(SNVM_ENCKEY_MODULE, page);
memcpy(page + SNVM_KEK_WRAPPED_LEN, nonce, ENCRYPT_NONCE_SIZE);
ret = snvm_page_write_if_changed(module, page);
wolfBoot_printf("enckey provision: sNVM write[%d] ret=%d\n",
SNVM_ENCKEY_MODULE, ret);
(int)module, ret);
wc_ForceZero(page, sizeof(page));
return ret;
}
#endif /* SNVM_ENCKEY_PROVISION */

#ifdef SNVM_ENCKEY_PROVISION
int snvm_enckey_provision(void)
{
return snvm_enckey_provision_module(SNVM_ENCKEY_MODULE, prov_aes_key,
prov_aes_nonce);
}
#endif

/* Separate from snvm_enckey_provision() because the zeroize that makes a
* second key worth having cannot be built alongside it, while the golden
* module it writes is one the zeroize never touches. */
#ifdef SNVM_GOLDEN_ENCKEY_PROVISION
int snvm_golden_enckey_provision(void)
{
return snvm_enckey_provision_module(SNVM_GOLDEN_ENCKEY_MODULE,
prov_golden_aes_key, prov_golden_aes_nonce);
}
#endif
#endif /* SNVM_ENCKEY_PROVISION || SNVM_GOLDEN_ENCKEY_PROVISION */

#endif /* CUSTOM_ENCRYPT_KEY && SNVM_KEK */

Expand Down
36 changes: 36 additions & 0 deletions hal/mpfs250_snvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,38 @@ int snvm_keystore_provision(void);
#endif
#endif

#if defined(DISK_GOLDEN_ENCRYPT_KEY) || defined(SNVM_GOLDEN_ENCKEY_PROVISION)
/* sNVM module holding the golden image's own wrapped key. The failover
* never erases it, which is what keeps the golden image encrypted after a
* zeroize of SNVM_ENCKEY_MODULE.
*
* There is deliberately no default: the page must be a plaintext sNVM client
* the Libero design actually configures AND leaves writable, and only the
* board's design says which that is. A page marked ROM cannot be written,
* and a page that was never configured as a client cannot even be read, so
* the provisioning writer's pre-read refuses it. Both failures are silent
* until a device is in hand, which is why this is a required setting rather
* than a guess. MPFS_SNVM_DUMP reports the state of a candidate page. */
#ifndef SNVM_GOLDEN_ENCKEY_MODULE
#error "Set SNVM_GOLDEN_ENCKEY_MODULE to a writable plaintext sNVM client \
configured by the Libero design; see MPFS_SNVM_DUMP to check a candidate page."
#endif
#if (SNVM_GOLDEN_ENCKEY_MODULE < 0) || \
(SNVM_GOLDEN_ENCKEY_MODULE >= MPFS_SNVM_MODULE_MAX)
#error "SNVM_GOLDEN_ENCKEY_MODULE is outside the sNVM module range 0..220"
#endif
#if (SNVM_GOLDEN_ENCKEY_MODULE == SNVM_ENCKEY_MODULE)
#error "SNVM_GOLDEN_ENCKEY_MODULE must differ from SNVM_ENCKEY_MODULE"
#endif
#if defined(SNVM_KEYSTORE) || defined(SNVM_KEYSTORE_PROVISION)
#if (SNVM_GOLDEN_ENCKEY_MODULE >= SNVM_KEYSTORE_MODULE) && \
(SNVM_GOLDEN_ENCKEY_MODULE < \
(SNVM_KEYSTORE_MODULE + SNVM_KEYSTORE_MAX_MODULES))
#error "SNVM_GOLDEN_ENCKEY_MODULE overlaps the sNVM keystore module range"
#endif
#endif
#endif /* DISK_GOLDEN_ENCRYPT_KEY || SNVM_GOLDEN_ENCKEY_PROVISION */

/* Derive the 256-bit device-unique KEK from the System Controller SRAM-PUF:
* KEK = SHA384(label || PUF(fixed-challenge))[0..31]. Returns 0 on success. */
int mpfs_puf_kek(uint8_t *kek);
Expand All @@ -135,6 +167,10 @@ int snvm_kek_unwrap(const uint8_t *in, uint32_t insz, uint8_t *key,
* the PUF KEK and store [wrapped key][nonce] in sNVM. */
int snvm_enckey_provision(void);
#endif
#ifdef SNVM_GOLDEN_ENCKEY_PROVISION
/* The same for the golden image's key, into SNVM_GOLDEN_ENCKEY_MODULE. */
int snvm_golden_enckey_provision(void);
#endif

#endif /* SNVM_KEK */

Expand Down
6 changes: 6 additions & 0 deletions include/wolfboot/wolfboot.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,12 @@ int wolfBoot_initialize_encryption(void);
int wolfBoot_set_encrypt_key(const uint8_t *key, const uint8_t *nonce);
int wolfBoot_get_encrypt_key(uint8_t *key, uint8_t *nonce);
int wolfBoot_erase_encrypt_key(void);
#ifdef DISK_GOLDEN_ENCRYPT_KEY
/* Select the golden image's key (golden != 0) or the operational one for the
* next wolfBoot_get_encrypt_key(). Implemented by the platform that holds
* both; wolfBoot_erase_encrypt_key() always erases the operational key. */
int wolfBoot_select_golden_encrypt_key(int golden);
#endif

#if !defined(__WOLFBOOT) && defined(TZEN)

Expand Down
38 changes: 37 additions & 1 deletion options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ endif
ifneq ($(SNVM_KEYSTORE_MAX_MODULES),)
CFLAGS+=-DSNVM_KEYSTORE_MAX_MODULES=$(SNVM_KEYSTORE_MAX_MODULES)
endif
ifneq ($(SNVM_GOLDEN_ENCKEY_MODULE),)
CFLAGS+=-DSNVM_GOLDEN_ENCKEY_MODULE=$(SNVM_GOLDEN_ENCKEY_MODULE)
endif
ifneq ($(SNVM_ENCKEY_MODULE),)
CFLAGS+=-DSNVM_ENCKEY_MODULE=$(SNVM_ENCKEY_MODULE)
endif
Expand Down Expand Up @@ -180,7 +183,8 @@ ifeq ($(MPFS_SBI_SC_FLASH),1)
endif

# Field recovery: before the golden slot boots, zero the sNVM image-key page and the head of both
# operational slots (hal_disk_failover). The golden image must be a plaintext signed image.
# operational slots (hal_disk_failover). The golden image must be a plaintext signed image, unless
# DISK_GOLDEN_ENCRYPT_KEY gives it a key of its own.
ifeq ($(DISK_FAILOVER_ZEROIZE),1)
ifneq ($(DISK_GOLDEN_SLOT)$(SNVM_KEK),11)
$(error DISK_FAILOVER_ZEROIZE=1 requires DISK_GOLDEN_SLOT=1 and SNVM_KEK=1)
Expand All @@ -194,6 +198,38 @@ ifeq ($(DISK_FAILOVER_ZEROIZE),1)
endif
CFLAGS+=-D"DISK_FAILOVER_ZEROIZE"
endif

# Keep the golden image encrypted across a zeroize by storing its image key in a second sNVM
# module (SNVM_GOLDEN_ENCKEY_MODULE), which the failover never erases. The platform must
# implement wolfBoot_select_golden_encrypt_key(); there is deliberately no default, so a build
# that cannot select a key fails to link rather than decrypting the golden image with the wrong one.
# One-time writer for the golden image's key. Deliberately independent of
# DISK_GOLDEN_ENCRYPT_KEY so a provisioning-only build can populate the second module:
# a provisioning run cannot be built together with DISK_FAILOVER_ZEROIZE, and the module
# written here is one the zeroize never touches. Provision first, then build the runtime
# image.
ifeq ($(SNVM_GOLDEN_ENCKEY_PROVISION),1)
ifneq ($(SNVM_KEK),1)
$(error SNVM_GOLDEN_ENCKEY_PROVISION=1 requires SNVM_KEK=1)
endif
ifneq ($(WOLFBOOT_SNVM_WRITE_APPROVED),1)
$(error SNVM_GOLDEN_ENCKEY_PROVISION $(SNVM_WRITE_GATE_MSG))
endif
CFLAGS+=-D"SNVM_GOLDEN_ENCKEY_PROVISION"
ifeq ($(SNVM_ENCKEY_INSECURE_TEST_KEY),1)
CFLAGS+=-D"SNVM_ENCKEY_INSECURE_TEST_KEY"
endif
ifeq ($(SNVM_ENCKEY_PROVISION_EXTERN),1)
CFLAGS+=-D"SNVM_ENCKEY_PROVISION_EXTERN"
endif
endif

ifeq ($(DISK_GOLDEN_ENCRYPT_KEY),1)
ifneq ($(DISK_GOLDEN_SLOT)$(SNVM_KEK),11)
$(error DISK_GOLDEN_ENCRYPT_KEY=1 requires DISK_GOLDEN_SLOT=1 and SNVM_KEK=1)
endif
CFLAGS+=-D"DISK_GOLDEN_ENCRYPT_KEY"
endif
# QSPI SCK divider: a QSPI_CLK_DIV_* name from hal/mpfs250.h, default QSPI_CLK_DIV_8.
ifneq ($(MPFS_QSPI_CLK_DIV),)
CFLAGS+=-DMPFS_QSPI_CLK_DIV=$(MPFS_QSPI_CLK_DIV)
Expand Down
Loading
Loading