|
| 1 | +/* user_settings/cascade.h |
| 2 | + * |
| 3 | + * Lift Make-side feature implications into preprocessor cascades so an |
| 4 | + * IDE/CMake-only build (which sets only the high-level WOLFBOOT_* flags) |
| 5 | + * sees the same derived flags that options.mk would set. |
| 6 | + * |
| 7 | + * Idempotent: every #define is #ifndef-guarded, so it's a no-op when |
| 8 | + * options.mk has already emitted the same -D flag. |
| 9 | + * |
| 10 | + * |
| 11 | + * Copyright (C) 2026 wolfSSL Inc. |
| 12 | + * |
| 13 | + * This file is part of wolfBoot. |
| 14 | + * |
| 15 | + * wolfBoot is free software; you can redistribute it and/or modify |
| 16 | + * it under the terms of the GNU General Public License as published by |
| 17 | + * the Free Software Foundation; either version 3 of the License, or |
| 18 | + * (at your option) any later version. |
| 19 | + * |
| 20 | + * wolfBoot is distributed in the hope that it will be useful, |
| 21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | + * GNU General Public License for more details. |
| 24 | + * |
| 25 | + * You should have received a copy of the GNU General Public License |
| 26 | + * along with this program; if not, write to the Free Software |
| 27 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
| 28 | + */ |
| 29 | +#ifndef _WOLFBOOT_USER_SETTINGS_CASCADE_H_ |
| 30 | +#define _WOLFBOOT_USER_SETTINGS_CASCADE_H_ |
| 31 | + |
| 32 | +/* Any feature that requires a hardware TPM 2.0 implies WOLFBOOT_TPM. |
| 33 | + * Mirrors options.mk:34-92 where the same Make variables force WOLFTPM:=1. */ |
| 34 | +#if defined(WOLFBOOT_TPM_VERIFY) || \ |
| 35 | + defined(WOLFBOOT_MEASURED_BOOT) || \ |
| 36 | + defined(WOLFBOOT_TPM_KEYSTORE) || \ |
| 37 | + defined(WOLFBOOT_TPM_SEAL) |
| 38 | +# ifndef WOLFBOOT_TPM |
| 39 | +# define WOLFBOOT_TPM |
| 40 | +# endif |
| 41 | +#endif |
| 42 | + |
| 43 | +/* WOLFBOOT_NEEDS_* declarations -- positive intent markers reconciled by |
| 44 | + * user_settings/finalize.h. Fragments may also set these from their own |
| 45 | + * headers; cascade.h handles the cases that today live as #undef blocks |
| 46 | + * scattered through user_settings.h. */ |
| 47 | + |
| 48 | +/* WOLFCRYPT_TZ_PSA and WOLFBOOT_TZ_FWTPM both keep CMAC and KDF enabled |
| 49 | + * (today by `#undef NO_CMAC` / `#undef NO_KDF` after the always-on block). |
| 50 | + * Lift those to positive intent so finalize.h can simply skip the |
| 51 | + * `#define NO_CMAC` / `#define NO_KDF`. */ |
| 52 | +#if defined(WOLFCRYPT_TZ_PSA) || defined(WOLFBOOT_TZ_FWTPM) |
| 53 | +# ifndef WOLFBOOT_NEEDS_CMAC |
| 54 | +# define WOLFBOOT_NEEDS_CMAC |
| 55 | +# endif |
| 56 | +# ifndef WOLFBOOT_NEEDS_KDF |
| 57 | +# define WOLFBOOT_NEEDS_KDF |
| 58 | +# endif |
| 59 | +#endif |
| 60 | + |
| 61 | +#endif /* _WOLFBOOT_USER_SETTINGS_CASCADE_H_ */ |
0 commit comments