@@ -113,7 +113,7 @@ STATIC EFI_STATUS ReadVariable(
113113)
114114{
115115 EFI_STATUS Status ;
116-
116+
117117 * DataSize = 0 ;
118118 * Data = NULL ;
119119 Status = gRT -> GetVariable (VariableName , VendorGuid , NULL , DataSize , NULL );
@@ -224,11 +224,6 @@ EFI_STATUS EFIAPI efi_main(
224224 BOOLEAN Append = FALSE, Reboot = FALSE, LogToFile = TRUE;
225225 EFI_STATUS Status ;
226226 EFI_TIME Time ;
227- #if defined(_M_X64 ) || defined(__x86_64__ )
228- EFI_SIGNATURE_LIST * Esl [8 ] = { 0 };
229- UINTN EslIndex , EslOffset ;
230- UINT8 * MergedEsl = NULL ;
231- #endif
232227 UINT8 Set = MOSBY_SET1 ;
233228 UINTN i , Size ;
234229 UINT16 * SystemSSPV = NULL ;
@@ -300,7 +295,7 @@ EFI_STATUS EFIAPI efi_main(
300295 ArgvCopy += 1 ;
301296 Argc -= 1 ;
302297 } else if (StrCmp (ArgvCopy [1 ], L"-v" ) == 0 ) {
303- Print (L"Mosby %s %a \n" , ARCH_EXT , VERSION_STRING );
298+ Print (L"Mosby %a %s \n" , VERSION_STRING , ARCH_EXT );
304299 goto exit ;
305300 } else if (StrCmp (ArgvCopy [1 ], L"-x" ) == 0 ) {
306301 Set = MOSBY_SET2 ;
@@ -328,6 +323,7 @@ EFI_STATUS EFIAPI efi_main(
328323 /* Initialize the file logger */
329324 if (LogToFile )
330325 OpenLogger (gBaseImageHandle , L"Mosby.log" );
326+ RecallPrint (L"Mosby %a %s\n" , VERSION_STRING , ARCH_EXT );
331327 PrintSystemInfo ();
332328 if (UpdateMode )
333329 goto process_binaries ;
@@ -455,7 +451,7 @@ EFI_STATUS EFIAPI efi_main(
455451 if (InstallSBatVer == 0 )
456452 Abort (EFI_NO_MAPPING , L"Internal error\n" );
457453 Status = ReadVariable (L"SbatLevel" , & gEfiShimLockGuid , & Size , (VOID * * )& SBat );
458- if (Status == EFI_SUCCESS )
454+ if (Status == EFI_SUCCESS )
459455 SystemSBatVer = GetSBatVersion (SBat , Size );
460456 if (TestMode )
461457 Print (L"Provided SBAT: %d, System SBAT: %d\n" , InstallSBatVer , SystemSBatVer );
@@ -555,7 +551,7 @@ EFI_STATUS EFIAPI efi_main(
555551 List .Size ++ ;
556552 }
557553
558- #if defined(_M_X64 ) || defined(__x86_64__ )
554+ #if defined(_M_X64 ) || defined(__x86_64__ ) || defined( _M_IX86 ) || defined( __i386__ )
559555 /*
560556 * There appears to be a whole sway of AMI UEFI firmwares with a rather unfortunate bug,
561557 * that prevents appending to an existing KEK store. Which means that, on the affected
@@ -567,7 +563,9 @@ EFI_STATUS EFIAPI efi_main(
567563 * single SetVariable() operation.
568564 * For more on this, see https://github.com/pbatard/Mosby/issues/14.
569565 */
570- EslIndex = 0 ;
566+ EFI_SIGNATURE_LIST * Esl [8 ] = { 0 };
567+ UINTN EslIndex = 0 , EslOffset = 0 ;
568+ UINT8 * MergedEsl = NULL ;
571569 for (i = 0 ; i < List .Size ; i ++ ) {
572570 /* Only process valid KEK entries for which we have a variable */
573571 if (List .Entry [i ].Type != KEK || List .Entry [i ].Variable .Data == NULL )
@@ -610,6 +608,7 @@ EFI_STATUS EFIAPI efi_main(
610608 if (EFI_ERROR (Status ))
611609 ReportErrorAndExit (L"Failed to create merged KEK variable - Aborting\n" );
612610 List .Size ++ ;
611+ FreePool (MergedEsl );
613612 }
614613#endif
615614
@@ -649,9 +648,6 @@ EFI_STATUS EFIAPI efi_main(
649648 for (i = 0 ; i < List .Size ; i ++ )
650649 FreePool (List .Entry [i ].Variable .Data );
651650 FreePool (Argv );
652- #if defined(_M_X64 ) || defined(__x86_64__ )
653- FreePool (MergedEsl );
654- #endif
655651 RecallPrintFree ();
656652 CloseLogger ();
657653 if (Reboot ) {
0 commit comments