@@ -33,46 +33,46 @@ import (
3333type CheckFlags int
3434
3535const (
36- // PlatformFirmwareProfileSupportRequired indicates that support for
36+ // PermitNoPlatformFirmwareProfileSupport indicates that support for
3737 // [secboot_efi.WithPlatformFirmwareProfile] to generate profiles for
38- // PCR 0 is not optional.
39- PlatformFirmwareProfileSupportRequired CheckFlags = 1 << iota
38+ // PCR 0 is optional.
39+ PermitNoPlatformFirmwareProfileSupport CheckFlags = 1 << iota
4040
41- // PlatformConfigProfileSupportRequired indicates that support for
41+ // PermitNoPlatformConfigProfileSupportd indicates that support for
4242 // generating profiles for PCR 1 is not optional.
4343 //
44- // Note that this currently is not supported by the
45- // [github.com/snapcore/secboot/efi] package.
46- PlatformConfigProfileSupportRequired
44+ // Note that this is currently mandatory because this profile is not
45+ // supported by the [github.com/snapcore/secboot/efi] package.
46+ PermitNoPlatformConfigProfileSupport
4747
48- // DriversAndAppsProfileSupportRequired indicates that support for
48+ // PermitNoDriversAndAppsProfileSupport indicates that support for
4949 // [secboot_efi.WithDriversAndAppsProfile] to generate profiles for
50- // PCR 2 is not optional.
51- DriversAndAppsProfileSupportRequired
50+ // PCR 2 is optional.
51+ PermitNoDriversAndAppsProfileSupport
5252
53- // DriversAndAppsConfigProfileSupportRequired indicates that support
54- // for generating profiles for PCR 3 is not optional.
53+ // PermitNoDriversAndAppsConfigProfileSupport indicates that support
54+ // for generating profiles for PCR 3 is optional.
5555 //
56- // Note that this currently is not supported by the
57- // [github.com/snapcore/secboot/efi] package.
58- DriversAndAppsConfigProfileSupportRequired
56+ // Note that this is currently mandatory because this profile is not
57+ // supported by the [github.com/snapcore/secboot/efi] package.
58+ PermitNoDriversAndAppsConfigProfileSupport
5959
60- // BootManagerCodeProfileSupportRequired indicates that support for
60+ // PermitNoBootManagerCodeProfileSupport indicates that support for
6161 // [secboot_efi.WithBootManagerCodeProfile] to generate profiles for
62- // PCR 4 is not optional.
63- BootManagerCodeProfileSupportRequired
62+ // PCR 4 is optional.
63+ PermitNoBootManagerCodeProfileSupport
6464
65- // BootManagerConfigProfileSupportRequired indicates that support
66- // for generating profiles for PCR 5 is not optional.
65+ // PermitNoBootManagerConfigProfileSupport indicates that support
66+ // for generating profiles for PCR 5 is optional.
6767 //
68- // Note that this currently is not supported by the
69- // [github.com/snapcore/secboot/efi] package.
70- BootManagerConfigProfileSupportRequired
68+ // Note that this is currently mandatory because this profile is not
69+ // supported by the [github.com/snapcore/secboot/efi] package.
70+ PermitNoBootManagerConfigProfileSupport
7171
72- // SecureBootPolicyProfileSupportRequired indicates that support for
72+ // PermitNoSecureBootPolicyProfileSupport indicates that support for
7373 // [secboot_efi.WithSecureBootPolicyProfile] to generate profiles for
74- // PCR 7 is not optional.
75- SecureBootPolicyProfileSupportRequired
74+ // PCR 7 is optional.
75+ PermitNoSecureBootPolicyProfileSupport
7676
7777 // PermitWeakPCRBanks permits selecting a weak PCR algorithm if
7878 // no other valid ones are available. This currently only includes
@@ -234,25 +234,25 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
234234 // checkFirmwareLogAndChoosePCRBank will return an error if any of these PCRs
235235 // are inconsistent with the reconstructed log.
236236 var mandatoryPcrs tpm2.HandleList
237- if flags & PlatformFirmwareProfileSupportRequired > 0 {
237+ if flags & PermitNoPlatformFirmwareProfileSupport == 0 {
238238 mandatoryPcrs = append (mandatoryPcrs , internal_efi .PlatformFirmwarePCR )
239239 }
240- if flags & PlatformConfigProfileSupportRequired > 0 {
240+ if flags & PermitNoPlatformConfigProfileSupport == 0 {
241241 mandatoryPcrs = append (mandatoryPcrs , internal_efi .PlatformConfigPCR )
242242 }
243- if flags & DriversAndAppsProfileSupportRequired > 0 {
243+ if flags & PermitNoDriversAndAppsProfileSupport == 0 {
244244 mandatoryPcrs = append (mandatoryPcrs , internal_efi .DriversAndAppsPCR )
245245 }
246- if flags & DriversAndAppsConfigProfileSupportRequired > 0 {
246+ if flags & PermitNoDriversAndAppsConfigProfileSupport == 0 {
247247 mandatoryPcrs = append (mandatoryPcrs , internal_efi .DriversAndAppsConfigPCR )
248248 }
249- if flags & BootManagerCodeProfileSupportRequired > 0 {
249+ if flags & PermitNoBootManagerCodeProfileSupport == 0 {
250250 mandatoryPcrs = append (mandatoryPcrs , internal_efi .BootManagerCodePCR )
251251 }
252- if flags & BootManagerConfigProfileSupportRequired > 0 {
252+ if flags & PermitNoBootManagerConfigProfileSupport == 0 {
253253 mandatoryPcrs = append (mandatoryPcrs , internal_efi .BootManagerConfigPCR )
254254 }
255- if flags & SecureBootPolicyProfileSupportRequired > 0 {
255+ if flags & PermitNoSecureBootPolicyProfileSupport == 0 {
256256 mandatoryPcrs = append (mandatoryPcrs , internal_efi .SecureBootPolicyPCR )
257257 }
258258
@@ -368,7 +368,7 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
368368 // PCR1 profiles are not supported yet.
369369 err := & PlatformConfigPCRError {errors .New ("generating profiles for PCR 1 is not supported yet" )}
370370 switch {
371- case flags & PlatformConfigProfileSupportRequired > 0 :
371+ case flags & PermitNoPlatformConfigProfileSupport == 0 :
372372 deferredErrs = append (deferredErrs , err )
373373 default :
374374 result .Flags |= NoPlatformConfigProfileSupport
@@ -392,7 +392,7 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
392392 // PCR3 profiles are not supported yet
393393 err := & DriversAndAppsConfigPCRError {errors .New ("generating profiles for PCR 3 is not supported yet" )}
394394 switch {
395- case flags & DriversAndAppsConfigProfileSupportRequired > 0 :
395+ case flags & PermitNoDriversAndAppsConfigProfileSupport == 0 :
396396 deferredErrs = append (deferredErrs , err )
397397 default :
398398 result .Flags |= NoDriversAndAppsConfigProfileSupport
@@ -405,7 +405,7 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
405405 // the reconstructed log value.
406406 pcr4Result , err := checkBootManagerCodeMeasurements (ctx , runChecksEnv , log , result .PCRAlg , loadedImages )
407407 switch {
408- case err != nil && flags & BootManagerCodeProfileSupportRequired > 0 :
408+ case err != nil && flags & PermitNoBootManagerCodeProfileSupport == 0 :
409409 deferredErrs = append (deferredErrs , & BootManagerCodePCRError {err })
410410 case err != nil :
411411 result .Flags |= NoBootManagerCodeProfileSupport
@@ -441,7 +441,7 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
441441 // PCR5 profiles are not supported yet
442442 err := & BootManagerConfigPCRError {errors .New ("generating profiles for PCR 5 is not supported yet" )}
443443 switch {
444- case flags & BootManagerConfigProfileSupportRequired > 0 :
444+ case flags & PermitNoBootManagerConfigProfileSupport == 0 :
445445 deferredErrs = append (deferredErrs , err )
446446 default :
447447 result .Flags |= NoBootManagerConfigProfileSupport
@@ -458,7 +458,7 @@ func RunChecks(ctx context.Context, flags CheckFlags, loadedImages []secboot_efi
458458 }
459459 pcr7Result , err := checkSecureBootPolicyMeasurementsAndObtainAuthorities (ctx , runChecksEnv , log , result .PCRAlg , iblImage )
460460 switch {
461- case err != nil && flags & SecureBootPolicyProfileSupportRequired > 0 :
461+ case err != nil && flags & PermitNoSecureBootPolicyProfileSupport == 0 :
462462 deferredErrs = append (deferredErrs , & SecureBootPolicyPCRError {err })
463463 case err != nil :
464464 result .Flags |= NoSecureBootPolicyProfileSupport
0 commit comments