@@ -359,18 +359,7 @@ static void wolfBoot_verify_signature_ecc(uint8_t key_slot,
359359 * WOLFBOOT_SIGN_SECONDARY_ECC521 */
360360
361361
362- #if defined(WOLFBOOT_SIGN_RSA2048 ) || \
363- defined(WOLFBOOT_SIGN_RSA3072 ) || \
364- defined(WOLFBOOT_SIGN_RSA4096 ) || \
365- defined(WOLFBOOT_SIGN_SECONDARY_RSA2048 ) || \
366- defined(WOLFBOOT_SIGN_SECONDARY_RSA3072 ) || \
367- defined(WOLFBOOT_SIGN_SECONDARY_RSA4096 ) || \
368- defined(WOLFBOOT_SIGN_RSAPSS2048 ) || \
369- defined(WOLFBOOT_SIGN_RSAPSS3072 ) || \
370- defined(WOLFBOOT_SIGN_RSAPSS4096 ) || \
371- defined(WOLFBOOT_SIGN_SECONDARY_RSAPSS2048 ) || \
372- defined(WOLFBOOT_SIGN_SECONDARY_RSAPSS3072 ) || \
373- defined(WOLFBOOT_SIGN_SECONDARY_RSAPSS4096 )
362+ #ifdef WOLFBOOT_SIGN_RSA_ANY
374363
375364#include <wolfssl/wolfcrypt/asn.h>
376365#include <wolfssl/wolfcrypt/rsa.h>
@@ -442,7 +431,7 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
442431 (void )inOutIdx ;
443432 (void )is_pss ;
444433
445- #ifdef WOLFBOOT_RSA_PSS
434+ #ifdef WOLFBOOT_SIGN_RSAPSS_ANY
446435 enum wc_HashType hash_type ;
447436 int mgf ;
448437#if defined(WOLFBOOT_HASH_SHA256 )
@@ -454,7 +443,7 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
454443#else
455444 #error "RSA-PSS requires SHA-256 or SHA-384"
456445#endif
457- #endif /* WOLFBOOT_RSA_PSS */
446+ #endif /* WOLFBOOT_SIGN_RSAPSS_ANY */
458447
459448#if (!defined(WOLFBOOT_ENABLE_WOLFHSM_CLIENT ) && \
460449 !defined(WOLFBOOT_ENABLE_WOLFHSM_SERVER )) || \
@@ -471,7 +460,10 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
471460#if defined(WOLFBOOT_RENESAS_SCEPROTECT ) || \
472461 defined(WOLFBOOT_RENESAS_TSIP ) || \
473462 defined(WOLFBOOT_RENESAS_RSIP )
474- /* Renesas crypto callback — RSA PKCS#1 v1.5 only */
463+ /* Renesas crypto callback supports RSA PKCS#1 v1.5 only */
464+ #ifdef WOLFBOOT_SIGN_RSAPSS_ANY
465+ #error "RSA-PSS is not yet supported with Renesas crypto callbacks"
466+ #endif
475467 ret = wc_InitRsaKey_ex (& rsa , NULL , RENESAS_DEVID );
476468 if (ret == 0 ) {
477469 XMEMCPY (output , sig , RSA_IMAGE_SIGNATURE_SIZE );
@@ -535,7 +527,7 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
535527 }
536528#endif /* !WOLFBOOT_USE_WOLFHSM_PUBKEY_ID */
537529 XMEMCPY (output , sig , RSA_IMAGE_SIGNATURE_SIZE );
538- #ifdef WOLFBOOT_RSA_PSS
530+ #ifdef WOLFBOOT_SIGN_RSAPSS_ANY
539531 if (is_pss ) {
540532 RSA_VERIFY_FN (ret , wc_RsaPSS_VerifyInline , output ,
541533 RSA_IMAGE_SIGNATURE_SIZE , & digest_out , hash_type , mgf ,
@@ -570,7 +562,7 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
570562 ret = wc_RsaPublicKeyDecode ((byte * )pubkey , & inOutIdx , & rsa , pubkey_sz );
571563 if (ret >= 0 ) {
572564 XMEMCPY (output , sig , RSA_IMAGE_SIGNATURE_SIZE );
573- #ifdef WOLFBOOT_RSA_PSS
565+ #ifdef WOLFBOOT_SIGN_RSAPSS_ANY
574566 if (is_pss ) {
575567 RSA_VERIFY_FN (ret ,
576568 wc_RsaPSS_VerifyInline , output , RSA_IMAGE_SIGNATURE_SIZE ,
@@ -587,7 +579,7 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
587579#endif /* SCE || TSIP */
588580 wc_FreeRsaKey (& rsa );
589581
590- #ifdef WOLFBOOT_RSA_PSS
582+ #ifdef WOLFBOOT_SIGN_RSAPSS_ANY
591583 if (is_pss ) {
592584 if (ret >= WOLFBOOT_SHA_DIGEST_SIZE && img && digest_out ) {
593585 RSA_PSS_VERIFY_HASH (img , digest_out , ret , hash_type );
@@ -607,12 +599,7 @@ static void wolfBoot_verify_signature_rsa_common(uint8_t key_slot,
607599 }
608600}
609601
610- #endif /* WOLFBOOT_SIGN_RSA2048 || WOLFBOOT_SIGN_RSA3072 || \
611- * WOLFBOOT_SIGN_RSA4096 || WOLFBOOT_SIGN_SECONDARY_RSA2048 ||
612- * WOLFBOOT_SIGN_SECONDARY_RSA3072 || WOLFBOOT_SIGN_SECONDARY_RSA4096 ||
613- * WOLFBOOT_SIGN_RSAPSS2048 || WOLFBOOT_SIGN_RSAPSS3072 ||
614- * WOLFBOOT_SIGN_RSAPSS4096 || WOLFBOOT_SIGN_SECONDARY_RSAPSS2048 ||
615- * WOLFBOOT_SIGN_SECONDARY_RSAPSS3072 || WOLFBOOT_SIGN_SECONDARY_RSAPSS4096 */
602+ #endif /* WOLFBOOT_SIGN_RSA_ANY */
616603
617604#ifdef WOLFBOOT_SIGN_LMS
618605#include <wolfssl/wolfcrypt/lms.h>
0 commit comments