@@ -2198,8 +2198,11 @@ static BOOL IsRevokedBySbat(uint8_t* buf, uint32_t len)
21982198 if (entry .version == 0 )
21992199 continue ;
22002200 for (j = 0 ; sbat_entries [j ].product != NULL ; j ++ ) {
2201- if (strcmp (entry .product , sbat_entries [j ].product ) == 0 && entry .version < sbat_entries [j ].version )
2201+ if (strcmp (entry .product , sbat_entries [j ].product ) == 0 && entry .version < sbat_entries [j ].version ) {
2202+ uprintf (" SBAT version for '%s' (%d) is lower than required minimum SBAT version (%d)!" ,
2203+ entry .product , entry .version , sbat_entries [j ].version );
22022204 return TRUE;
2205+ }
22032206 }
22042207 }
22052208
@@ -2306,8 +2309,11 @@ static BOOL IsRevokedBySvn(uint8_t* buf, uint32_t len)
23062309 svn_ver = (uint32_t * )RvaToPhysical (buf , rsrc_rva );
23072310 if (svn_ver != NULL ) {
23082311 uuprintf (" SVN version: %d.%d" , * svn_ver >> 16 , * svn_ver & 0xffff );
2309- if (* svn_ver < sbat_entries [i ].version )
2312+ if (* svn_ver < sbat_entries [i ].version ) {
2313+ uprintf (" SVN version %d.%d is lower than required minimum SVN version %d.%d!" ,
2314+ * svn_ver >> 16 , * svn_ver & 0xffff , sbat_entries [i ].version >> 16 , sbat_entries [i ].version & 0xffff );
23102315 return TRUE;
2316+ }
23112317 }
23122318 } else {
23132319 uprintf (" Warning: Unexpected Secure Version Number size" );
@@ -2394,42 +2400,43 @@ int IsBootloaderRevoked(uint8_t* buf, uint32_t len)
23942400 // Get the signer/issuer info
23952401 cert = GetPeSignatureData (buf );
23962402 r = GetIssuerCertificateInfo (cert , & info );
2397- if (r == 0 )
2403+ if (r == 0 ) {
23982404 uprintf (" (Unsigned Bootloader)" );
2399- else if (r > 0 )
2405+ } else if (r > 0 ) {
24002406 uprintf (" Signed by '%s'" , info .name );
2401-
2402- if (!PE256Buffer (buf , len , hash ))
2403- return -1 ;
2404- // Check for UEFI DBX revocation
2405- if (IsRevokedByDbx (hash , buf , len ))
2406- revoked = 1 ;
2407- // Check for Microsoft SSP revocation
2408- for (i = 0 ; revoked == 0 && i < pe256ssp_size * SHA256_HASHSIZE ; i += SHA256_HASHSIZE )
2409- if (memcmp (hash , & pe256ssp [i ], SHA256_HASHSIZE ) == 0 )
2410- revoked = 2 ;
2411- // Check for Linux SBAT revocation
2412- if (revoked == 0 && IsRevokedBySbat (buf , len ))
2413- revoked = 3 ;
2414- // Check for Microsoft SVN revocation
2415- if (revoked == 0 && IsRevokedBySvn (buf , len ))
2416- revoked = 4 ;
2417- // Check for UEFI DBX certificate revocation
2418- if (revoked == 0 && IsRevokedByCert (& info ))
2419- revoked = 5 ;
2420-
2421- // If signed and not revoked, print the various Secure Boot "gotchas"
2422- if (r > 0 && revoked == 0 ) {
2423- if (strcmp (info .name , "Microsoft Windows Production PCA 2011" ) == 0 ) {
2424- uprintf (" Note: This bootloader may fail Secure Boot validation on systems that" );
2425- uprintf (" have been updated to use the 'Windows UEFI CA 2023' certificate." );
2426- } else if (strcmp (info .name , "Windows UEFI CA 2023" ) == 0 ) {
2427- uprintf (" Note: This bootloader will fail Secure Boot validation on systems that" );
2428- uprintf (" have not been updated to use the latest Secure Boot certificates" );
2429- } else if (strcmp (info .name , "Microsoft Corporation UEFI CA 2011" ) == 0 ||
2430- strcmp (info .name , "Microsoft UEFI CA 2023" ) == 0 ) {
2431- uprintf (" Note: This bootloader may fail Secure Boot validation on *some* systems," );
2432- uprintf (" unless you enable \"Microsoft 3rd-party UEFI CA\" in your 'BIOS'." );
2407+ // Only perform revocation checks on signed bootloaders
2408+ if (!PE256Buffer (buf , len , hash ))
2409+ return -1 ;
2410+ // Check for UEFI DBX revocation
2411+ if (IsRevokedByDbx (hash , buf , len ))
2412+ revoked = 1 ;
2413+ // Check for Microsoft SSP revocation
2414+ for (i = 0 ; revoked == 0 && i < pe256ssp_size * SHA256_HASHSIZE ; i += SHA256_HASHSIZE )
2415+ if (memcmp (hash , & pe256ssp [i ], SHA256_HASHSIZE ) == 0 )
2416+ revoked = 2 ;
2417+ // Check for Linux SBAT revocation
2418+ if (revoked == 0 && IsRevokedBySbat (buf , len ))
2419+ revoked = 3 ;
2420+ // Check for Microsoft SVN revocation
2421+ if (revoked == 0 && IsRevokedBySvn (buf , len ))
2422+ revoked = 4 ;
2423+ // Check for UEFI DBX certificate revocation
2424+ if (revoked == 0 && IsRevokedByCert (& info ))
2425+ revoked = 5 ;
2426+
2427+ // If signed and not revoked, print the various Secure Boot "gotchas"
2428+ if (revoked == 0 ) {
2429+ if (strcmp (info .name , "Microsoft Windows Production PCA 2011" ) == 0 ) {
2430+ uprintf (" Note: This bootloader may fail Secure Boot validation on systems that" );
2431+ uprintf (" have been updated to use the 'Windows UEFI CA 2023' certificate." );
2432+ } else if (strcmp (info .name , "Windows UEFI CA 2023" ) == 0 ) {
2433+ uprintf (" Note: This bootloader will fail Secure Boot validation on systems that" );
2434+ uprintf (" have not been updated to use the latest Secure Boot certificates" );
2435+ } else if (strcmp (info .name , "Microsoft Corporation UEFI CA 2011" ) == 0 ||
2436+ strcmp (info .name , "Microsoft UEFI CA 2023" ) == 0 ) {
2437+ uprintf (" Note: This bootloader may fail Secure Boot validation on *some* systems," );
2438+ uprintf (" unless you enable \"Microsoft 3rd-party UEFI CA\" in your 'BIOS'." );
2439+ }
24332440 }
24342441 }
24352442
0 commit comments