@@ -112,16 +112,16 @@ extern "C" {
112112
113113#ifndef IMAGE_HEADER_SIZE
114114/* Largest cases first */
115- # if defined(WOLFBOOT_SIGN_RSA4096 )
115+ # if defined(WOLFBOOT_SIGN_RSA4096 ) || defined( WOLFBOOT_SIGN_RSAPSS4096 )
116116# define IMAGE_HEADER_SIZE 1024
117117
118- /* RSA3072 + strong hash */
119- # elif (defined(WOLFBOOT_SIGN_RSA3072 ) && \
118+ /* RSA3072/RSAPSS3072 + strong hash */
119+ # elif (( defined(WOLFBOOT_SIGN_RSA3072 ) || defined( WOLFBOOT_SIGN_RSAPSS3072 ) ) && \
120120 (defined(WOLFBOOT_HASH_SHA384 ) || defined(WOLFBOOT_HASH_SHA3_384 )))
121121# define IMAGE_HEADER_SIZE 1024
122122
123- /* RSA2048 + SHA256 */
124- # elif defined(WOLFBOOT_SIGN_RSA2048 ) && defined(WOLFBOOT_HASH_SHA256 )
123+ /* RSA2048/RSAPSS2048 + SHA256 */
124+ # elif ( defined(WOLFBOOT_SIGN_RSA2048 ) || defined( WOLFBOOT_SIGN_RSAPSS2048 ) ) && defined(WOLFBOOT_HASH_SHA256 )
125125# define IMAGE_HEADER_SIZE 512
126126
127127 /* ECC384 requires 512 with SHA256 */
@@ -141,7 +141,7 @@ extern "C" {
141141# define IMAGE_HEADER_SIZE 256
142142
143143 /* Secondary 512-byte fallbacks */
144- # elif defined(WOLFBOOT_SIGN_RSA3072 ) || \
144+ # elif defined(WOLFBOOT_SIGN_RSA3072 ) || defined( WOLFBOOT_SIGN_RSAPSS3072 ) || \
145145 defined(WOLFBOOT_SIGN_ECC521 ) || \
146146 defined(WOLFBOOT_SIGN_ED448 ) || \
147147 defined(WOLFBOOT_HASH_SHA384 ) || \
@@ -225,9 +225,12 @@ extern "C" {
225225#define AUTH_KEY_ECC521 0x07
226226#define AUTH_KEY_RSA3072 0x08
227227#define AUTH_KEY_LMS 0x09
228- #define AUTH_KEY_XMSS 0x0A
229- #define AUTH_KEY_ML_DSA 0x0B
230- #define AUTH_KEY_NUM 0x0C
228+ #define AUTH_KEY_XMSS 0x0A
229+ #define AUTH_KEY_ML_DSA 0x0B
230+ #define AUTH_KEY_RSAPSS2048 0x0C
231+ #define AUTH_KEY_RSAPSS3072 0x0D
232+ #define AUTH_KEY_RSAPSS4096 0x0E
233+ #define AUTH_KEY_NUM 0x0F
231234
232235/*
233236 * 8 bits: auth type
@@ -248,6 +251,9 @@ extern "C" {
248251#define HDR_IMG_TYPE_AUTH_LMS (AUTH_KEY_LMS << 8)
249252#define HDR_IMG_TYPE_AUTH_XMSS (AUTH_KEY_XMSS << 8)
250253#define HDR_IMG_TYPE_AUTH_ML_DSA (AUTH_KEY_ML_DSA << 8)
254+ #define HDR_IMG_TYPE_AUTH_RSAPSS2048 (AUTH_KEY_RSAPSS2048 << 8)
255+ #define HDR_IMG_TYPE_AUTH_RSAPSS3072 (AUTH_KEY_RSAPSS3072 << 8)
256+ #define HDR_IMG_TYPE_AUTH_RSAPSS4096 (AUTH_KEY_RSAPSS4096 << 8)
251257
252258#define HDR_IMG_TYPE_DIFF 0x00D0
253259
@@ -266,6 +272,9 @@ extern "C" {
266272#define KEYSTORE_PUBKEY_SIZE_RSA2048 320
267273#define KEYSTORE_PUBKEY_SIZE_RSA3072 448
268274#define KEYSTORE_PUBKEY_SIZE_RSA4096 576
275+ #define KEYSTORE_PUBKEY_SIZE_RSAPSS2048 KEYSTORE_PUBKEY_SIZE_RSA2048
276+ #define KEYSTORE_PUBKEY_SIZE_RSAPSS3072 KEYSTORE_PUBKEY_SIZE_RSA3072
277+ #define KEYSTORE_PUBKEY_SIZE_RSAPSS4096 KEYSTORE_PUBKEY_SIZE_RSA4096
269278#define KEYSTORE_PUBKEY_SIZE_LMS 60
270279#define KEYSTORE_PUBKEY_SIZE_XMSS 68
271280
@@ -440,6 +449,21 @@ extern "C" {
440449 # ifndef WOLFBOOT_UNIVERSAL_KEYSTORE
441450 # define KEYSTORE_PUBKEY_SIZE KEYSTORE_PUBKEY_SIZE_RSA4096
442451 # endif
452+ #elif defined(WOLFBOOT_SIGN_RSAPSS2048 )
453+ # define HDR_IMG_TYPE_AUTH HDR_IMG_TYPE_AUTH_RSAPSS2048
454+ # ifndef WOLFBOOT_UNIVERSAL_KEYSTORE
455+ # define KEYSTORE_PUBKEY_SIZE KEYSTORE_PUBKEY_SIZE_RSA2048
456+ # endif
457+ #elif defined(WOLFBOOT_SIGN_RSAPSS3072 )
458+ # define HDR_IMG_TYPE_AUTH HDR_IMG_TYPE_AUTH_RSAPSS3072
459+ # ifndef WOLFBOOT_UNIVERSAL_KEYSTORE
460+ # define KEYSTORE_PUBKEY_SIZE KEYSTORE_PUBKEY_SIZE_RSA3072
461+ # endif
462+ #elif defined(WOLFBOOT_SIGN_RSAPSS4096 )
463+ # define HDR_IMG_TYPE_AUTH HDR_IMG_TYPE_AUTH_RSAPSS4096
464+ # ifndef WOLFBOOT_UNIVERSAL_KEYSTORE
465+ # define KEYSTORE_PUBKEY_SIZE KEYSTORE_PUBKEY_SIZE_RSA4096
466+ # endif
443467 #elif defined(WOLFBOOT_SIGN_LMS )
444468 # define HDR_IMG_TYPE_AUTH HDR_IMG_TYPE_AUTH_LMS
445469 # ifndef WOLFBOOT_UNIVERSAL_KEYSTORE
0 commit comments