Skip to content

Commit 72c0d71

Browse files
committed
rename rsa PSS macro to new scheme, fix to make aux algos truly "appendable"
1 parent 56b71a5 commit 72c0d71

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

include/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ extern int tolower(int c);
225225

226226
/* RSA. Size and padding mode are independent: the SIGN_RSA{N} /
227227
* SIGN_SECONDARY_RSA{N} / AUX_PK_RSA{N} macros select size; the
228-
* SIGN_RSA_PSS / SIGN_SECONDARY_RSA_PSS / AUX_RSA_PSS modifiers (gated
228+
* SIGN_RSA_PSS / SIGN_SECONDARY_RSA_PSS / AUX_PK_RSA_PSS modifiers (gated
229229
* separately below) add PSS padding support. */
230230
#if defined(WOLFBOOT_SIGN_RSA2048) || \
231231
defined(WOLFBOOT_SIGN_RSA3072) || \
@@ -244,7 +244,7 @@ extern int tolower(int c);
244244
# define WC_ASN_HASH_SHA256
245245
# if defined(WOLFBOOT_SIGN_RSA_PSS) || \
246246
defined(WOLFBOOT_SIGN_SECONDARY_RSA_PSS) || \
247-
defined(WOLFBOOT_AUX_RSA_PSS)
247+
defined(WOLFBOOT_AUX_PK_RSA_PSS)
248248
# define WC_RSA_PSS
249249
# endif
250250
# if !defined(WOLFBOOT_TPM) && !defined(WOLFCRYPT_SECURE_MODE) && \

options.mk

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,16 @@ ifneq ($(CERT_CHAIN_VERIFY),)
14551455
CERT_CHAIN_GEN_ALGO+=rsapss4096
14561456
endif
14571457

1458+
# If SIGN didn't match any of the cert-chain-supported algos above,
1459+
# fail loudly at make time instead of producing a malformed script
1460+
# invocation (empty --leaf-algo) that fails with a confusing error.
1461+
ifeq ($(strip $(CERT_CHAIN_GEN_ALGO)),)
1462+
$(error CERT_CHAIN_VERIFY=1 is not supported with SIGN=$(SIGN). \
1463+
The dummy cert chain generator supports SIGN values: ECC256, \
1464+
ECC384, RSA2048, RSA3072, RSA4096, RSAPSS2048, RSAPSS3072, \
1465+
RSAPSS4096. Set USER_CERT_CHAIN=<path> to supply a pre-built chain.)
1466+
endif
1467+
14581468
# Per-level overrides for the dummy chain generator. Defaults: CA chain
14591469
# uses the same algo as the leaf (SIGN-derived), SHA256 for cert sigs.
14601470
# The leaf algo is fixed by SIGN — the leaf cert wraps the wolfBoot
@@ -1475,9 +1485,12 @@ ifneq ($(CERT_CHAIN_VERIFY),)
14751485
# Auto-bridge: the verifier in the bootloader must support whatever
14761486
# algo and hash actually sign the dummy chain. Without this, a
14771487
# non-default GEN_CA_ALGO/GEN_CA_HASH builds successfully but fails at
1478-
# runtime when the matching wolfCrypt module is absent.
1479-
AUX_PK_ALGOS += $(CERT_CHAIN_GEN_CA_ALGO)
1480-
AUX_HASH_ALGOS += $(CERT_CHAIN_GEN_CA_HASH)
1488+
# runtime when the matching wolfCrypt module is absent. `override` is
1489+
# required so a user-supplied AUX_PK_ALGOS/AUX_HASH_ALGOS on the make
1490+
# command line (which would otherwise be read-only) doesn't silently
1491+
# defeat the auto-bridge.
1492+
override AUX_PK_ALGOS += $(CERT_CHAIN_GEN_CA_ALGO)
1493+
override AUX_HASH_ALGOS += $(CERT_CHAIN_GEN_CA_HASH)
14811494
endif
14821495
SIGN_OPTIONS += --cert-chain $(CERT_CHAIN_FILE)
14831496
endif
@@ -1533,7 +1546,7 @@ ifneq ($(strip $(AUX_PK_ALGOS)$(AUX_HASH_ALGOS)),)
15331546
endif
15341547
# PSS padding - any rsapss* token enables PSS for all selected RSA sizes
15351548
ifneq ($(filter rsapss2048 rsapss3072 rsapss4096,$(AUX_PK_ALGOS_LIST)),)
1536-
CFLAGS += -DWOLFBOOT_AUX_RSA_PSS
1549+
CFLAGS += -DWOLFBOOT_AUX_PK_RSA_PSS
15371550
endif
15381551
# Add RSA objects if any RSA (PKCS#1 v1.5 or PSS) aux PK is requested
15391552
ifneq ($(filter rsa2048 rsa3072 rsa4096 rsapss2048 rsapss3072 rsapss4096,$(AUX_PK_ALGOS_LIST)),)

0 commit comments

Comments
 (0)