Skip to content

Commit f61cad6

Browse files
committed
DasharoModulePkg/Application/SovereignBootWizard: Display launch reasons
Signed-off-by: Michał Żygowski <[email protected]>
1 parent a1f1312 commit f61cad6

File tree

3 files changed

+66
-12
lines changed

3 files changed

+66
-12
lines changed

DasharoModulePkg/Application/SovereignBootWizard/SovereignBootWizard.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ SovereignBootWizardInit (
457457
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
458458
CHAR16 *NewString;
459459
EFI_HANDLE AppHandle;
460+
EFI_FORM_ID FormId;
460461

461462
NewString = NULL;
462463
AppHandle = NULL;
@@ -630,9 +631,9 @@ SovereignBootWizardInit (
630631
ConfigData->AppLaunchCause = SV_BOOT_LAUNCH_BOOT_WITH_DEFAULT_SETTINGS;
631632
}
632633
} else {
633-
// If not provisioned, the launch cause can only be undefined or boot with defaults
634+
// If not provisioned, the launch cause can not be verification failure
634635
if (!SvConfig->SvBootProvisioned &&
635-
ConfigData->AppLaunchCause >= SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED)
636+
ConfigData->AppLaunchCause == SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED)
636637
{
637638
ConfigData->AppLaunchCause = SV_BOOT_LAUNCH_BOOT_WITH_DEFAULT_SETTINGS;
638639
}
@@ -643,6 +644,31 @@ SovereignBootWizardInit (
643644
ConfigData->AppLaunchCause = SV_BOOT_LAUNCH_BOOT_WITH_DEFAULT_SETTINGS;
644645
}
645646

647+
switch (ConfigData->AppLaunchCause) {
648+
case SV_BOOT_LAUNCH_BOOT_WITH_DEFAULT_SETTINGS:
649+
NewString = HiiGetString(HiiHandle, STRING_TOKEN (STR_LAUNCH_CAUSE_DEFAULT_SETTINGS), NULL);
650+
break;
651+
case SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED:
652+
// Override the "do not trust key" to avoid displaying "next bootloader"
653+
NewString = HiiGetString(HiiHandle, STRING_TOKEN (STR_DO_NOT_TRUST_KEY2), NULL);
654+
if (NewString != NULL) {
655+
HiiSetString(HiiHandle, STRING_TOKEN (STR_DO_NOT_TRUST_KEY), NewString, NULL);
656+
}
657+
658+
NewString = HiiGetString(HiiHandle, STRING_TOKEN (STR_LAUNCH_CAUSE_VERIFICATION_FAILED), NULL);
659+
break;
660+
case SV_BOOT_LAUNCH_VIA_SETUP:
661+
NewString = HiiGetString(HiiHandle, STRING_TOKEN (STR_LAUNCH_CAUSE_SETUP), NULL);
662+
break;
663+
default:
664+
NewString = NULL;
665+
break;
666+
}
667+
668+
if (NewString != NULL) {
669+
HiiSetString(HiiHandle, STRING_TOKEN (STR_LAUNCH_REASON), NewString, NULL);
670+
}
671+
646672
//
647673
// Override Hotkeys, F9 and F10 won't be needed by this application
648674
//
@@ -655,6 +681,16 @@ SovereignBootWizardInit (
655681
FormBrowserEx2->RegisterHotKey (&HotKey, 0, 0, NULL);
656682
}
657683

684+
if (SvConfig->SvBootProvisioned) {
685+
if (ConfigData->AppLaunchCause == SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED) {
686+
FormId = SOVEREIGN_BOOT_WIZARD_CONFIG_FORM_ID;
687+
} else {
688+
FormId = SOVEREIGN_BOOT_WIZARD_INTERACTIVE_MODE_FORM_ID;
689+
}
690+
} else {
691+
FormId = SOVEREIGN_BOOT_WIZARD_WELCOME_FORM_ID;
692+
}
693+
658694
//
659695
// turn off the watchdog timer
660696
//
@@ -666,9 +702,7 @@ SovereignBootWizardInit (
666702
&HiiHandle,
667703
1,
668704
&gSovereignBootWizardFormSetGuid,
669-
SvConfig->SvBootProvisioned ?
670-
SOVEREIGN_BOOT_WIZARD_INTERACTIVE_MODE_FORM_ID :
671-
SOVEREIGN_BOOT_WIZARD_WELCOME_FORM_ID,
705+
FormId,
672706
NULL,
673707
NULL
674708
);

DasharoModulePkg/Application/SovereignBootWizard/SovereignBootWizardVfr.vfr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ formset
4343
title = STRING_TOKEN(STR_FORM1_TITLE);
4444

4545
subtitle text = STRING_TOKEN(STR_WELCOME_SUBTITLE);
46+
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
47+
subtitle text = STRING_TOKEN(STR_LAUNCH_REASON);
48+
subtitle text = STRING_TOKEN(STR_WELCOME_PROMPT);
4649

4750
// Empty text field so that none of the options are
4851
// highlighted/selected by default.
@@ -92,8 +95,13 @@ formset
9295
form formid = SOVEREIGN_BOOT_WIZARD_CONFIG_FORM_ID,
9396
title = STRING_TOKEN(STR_FORM2_TITLE);
9497

98+
disableif ideqval SvBootData.AppLaunchCause == SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED;
9599
subtitle text = STRING_TOKEN(STR_CONFIG_SUBTITLE);
96100
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
101+
endif;
102+
disableif NOT ideqval SvBootData.AppLaunchCause == SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED;
103+
subtitle text = STRING_TOKEN(STR_LAUNCH_REASON);
104+
endif;
97105

98106
subtitle text = STRING_TOKEN(STR_BOOTOPT_DESCRIPTION);
99107
subtitle text = STRING_TOKEN(STR_HW_PATH);
@@ -118,11 +126,13 @@ formset
118126
flags = INTERACTIVE,
119127
key = TRUST_KEY_AND_BOOT_FORM2_QUESTION_ID;
120128

129+
disableif ideqval SvBootData.AppLaunchCause == SV_BOOT_LAUNCH_IMAGE_VERIFICATION_FAILED;
121130
text
122131
help = STRING_TOKEN(STR_EMPTY_STRING),
123132
text = STRING_TOKEN(STR_TRUST_KEY),
124133
flags = INTERACTIVE,
125134
key = TRUST_KEY_FORM2_QUESTION_ID;
135+
endif;
126136

127137
text
128138
help = STRING_TOKEN(STR_EMPTY_STRING),
@@ -153,8 +163,8 @@ formset
153163
title = STRING_TOKEN(STR_FORM9_TITLE);
154164

155165
subtitle text = STRING_TOKEN(STR_INTERACTIVE_MODE_SUBTITLE);
156-
157166
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
167+
subtitle text = STRING_TOKEN(STR_LAUNCH_REASON);
158168

159169
text
160170
help = STRING_TOKEN(STR_EMPTY_STRING),

DasharoModulePkg/Application/SovereignBootWizard/SovereignBootWizardVfrStrings.uni

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,19 @@
2828
#string FUNCTION_NINE_STRING #language en-US "F9=Reset to Defaults"
2929
#string FUNCTION_TEN_STRING #language en-US "F10=Save"
3030

31+
32+
// Application launch causes
33+
#string STR_LAUNCH_REASON #language en-US "\n"
34+
#string STR_LAUNCH_CAUSE_DEFAULT_SETTINGS #language en-US "You see this window because you are booting for the first time or restored default system settings.\n\n"
35+
#string STR_LAUNCH_CAUSE_SETUP #language en-US "You see this window because you have explicitly requested to launch the Wizard via system setup.\n"
36+
"If you ended up here by mistake, please exit the application to avoid making changes to your system configuration.\n\n"
37+
#string STR_LAUNCH_CAUSE_VERIFICATION_FAILED #language en-US "You see this window because the system attempted to boot an untrusted image.\n\n"
38+
3139
// Welcome page strings
3240
#string STR_FORM1_TITLE #language en-US "Sovereign Boot Provisioning Wizard"
33-
#string STR_WELCOME_SUBTITLE #language en-US "Welcome to Sovereign Boot Provisioning Wizard!\n\n"
34-
"Please select the UEFI Secure Boot scheme you would like to use:"
41+
#string STR_WELCOME_SUBTITLE #language en-US "Welcome to Sovereign Boot Provisioning Wizard!\n"
42+
#string STR_WELCOME_PROMPT #language en-US "The Wizard will assist in setting up the UEFI Secure Boot feature. "
43+
"Please select the UEFI Secure Boot scheme you would like to use:\n"
3544

3645
#string STR_SELECT_SOVEREIGN_BOOT #language en-US "Sovereign Boot"
3746
#string STR_SELECT_SOVEREIGN_BOOT_HELP #language en-US ""
@@ -42,12 +51,12 @@
4251
#string STR_SELECT_DEFAULT_SECURE_BOOT_HELP #language en-US ""
4352
#string STR_MS_SECURE_BOOT_FEATURES #language en-US "* Trust firmware's default certificates\n"
4453
"* Compatible with common operating systems\n"
45-
"* Does not modify current Secure Boot settings"
54+
"* Enrolls firmware's default Secure Boot keys"
4655

4756
// Configuration page strings
4857
#string STR_FORM2_TITLE #language en-US "Sovereign Boot Provisioning Wizard"
4958

50-
#string STR_CONFIG_SUBTITLE #language en-US "A new bootloader key has been detected."
59+
#string STR_CONFIG_SUBTITLE #language en-US "A new bootloader/key has been detected."
5160

5261
#string STR_BOOTOPT_DESCRIPTION #language en-US "Description: "
5362
#string STR_HW_PATH #language en-US "Hardware path: "
@@ -57,8 +66,9 @@
5766
#string STR_TRUST_QUESTION #language en-US "Do you want to trust this key/image and continue booting?"
5867

5968
#string STR_DO_NOT_TRUST_KEY #language en-US "[Do NOT trust, next key/bootloader]"
60-
#string STR_TRUST_KEY_AND_BOOT #language en-US "[Trust this key and boot]"
61-
#string STR_TRUST_KEY #language en-US "[Trust this key, next key/bootloader]"
69+
#string STR_DO_NOT_TRUST_KEY2 #language en-US "[Do NOT trust]"
70+
#string STR_TRUST_KEY_AND_BOOT #language en-US "[Trust this key/image and boot]"
71+
#string STR_TRUST_KEY #language en-US "[Trust this key/image, next key/bootloader]"
6272
#string STR_SHOW_KEY_DETAILS #language en-US "[Show key/certificate details]"
6373

6474
// Interactive mode strings

0 commit comments

Comments
 (0)