diff --git a/AdvLoggerPkg/Application/DecodeUefiLog/UefiVariablesSupportLib.py b/AdvLoggerPkg/Application/DecodeUefiLog/UefiVariablesSupportLib.py index fdfa17a726..ba63fa458c 100644 --- a/AdvLoggerPkg/Application/DecodeUefiLog/UefiVariablesSupportLib.py +++ b/AdvLoggerPkg/Application/DecodeUefiLog/UefiVariablesSupportLib.py @@ -1,114 +1,114 @@ -# @file -# -# Python lib to support Reading and writing UEFI variables from windows -# -# Modified from original source to not produce error messages for Variable NOT FOUND -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -import os, sys -from ctypes import * -import logging -import pywintypes -import win32api, win32process, win32security, win32file -import winerror - -kernel32 = windll.kernel32 -EFI_VAR_MAX_BUFFER_SIZE = 1024*1024 - -class UefiVariable(object): - - def __init__(self): - # enable required SeSystemEnvironmentPrivilege privilege - privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) - token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) - win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) - win32api.CloseHandle( token ) - - # import firmware variable API - try: - self._GetFirmwareEnvironmentVariable = kernel32.GetFirmwareEnvironmentVariableW - self._GetFirmwareEnvironmentVariable.restype = c_int - self._GetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] - self._SetFirmwareEnvironmentVariable = kernel32.SetFirmwareEnvironmentVariableW - self._SetFirmwareEnvironmentVariable.restype = c_int - self._SetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] - self._SetFirmwareEnvironmentVariableEx = kernel32.SetFirmwareEnvironmentVariableExW - self._SetFirmwareEnvironmentVariableEx.restype = c_int - self._SetFirmwareEnvironmentVariableEx.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int, c_int] - except AttributeError as msg: - logging.warn( "G[S]etFirmwareEnvironmentVariableW function doesn't seem to exist" ) - pass - - # - # Helper function to create buffer for var read/write - # - def CreateBuffer(self, init, size=None): - """CreateBuffer(aString) -> character array - CreateBuffer(anInteger) -> character array - CreateBuffer(aString, anInteger) -> character array - """ - if isinstance(init, str): - if size is None: - size = len(init)+1 - buftype = c_char * size - buf = buftype() - buf.value = init - return buf - elif isinstance(init, int): - buftype = c_char * init - buf = buftype() - return buf - raise TypeError(init) - - # - #Function to get variable - # return a tuple of error code and variable data as string - # - def GetUefiVar(self, name, guid ): - err = 0 #success - efi_var = create_string_buffer( EFI_VAR_MAX_BUFFER_SIZE ) - if self._GetFirmwareEnvironmentVariable is not None: - logging.info("calling GetFirmwareEnvironmentVariable( name='%s', GUID='%s' ).." % (name, "{%s}" % guid) ) - length = self._GetFirmwareEnvironmentVariable( name, "{%s}" % guid, efi_var, EFI_VAR_MAX_BUFFER_SIZE ) - if (0 == length) or (efi_var is None): - err = kernel32.GetLastError() - # - # Don't produce an error message for NOT_FOUND - # - if err != 203: # 203 is NOT FOUND - logging.error( 'GetFirmwareEnvironmentVariable[Ex] failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, WinError(err)) - return (err, efi_var[:length], None) - # - #Function to set variable - # return a tuple of boolean status, errorcode, errorstring (None if not error) - # - def SetUefiVar(self, name, guid, var=None, attrs=None): - var_len = 0 - err = 0 - errorstring = None - if var is None: - var = bytes(0) - else: - var_len = len(var) - success = 0 # Fail - if(attrs == None): - if self._SetFirmwareEnvironmentVariable is not None: - logging.info("Calling SetFirmwareEnvironmentVariable (name='%s', Guid='%s')..." % (name, "{%s}" % guid, )) - success = self._SetFirmwareEnvironmentVariable(name, "{%s}" % guid, var, var_len) - else: - attrs = int(attrs) - if self._SetFirmwareEnvironmentVariableEx is not None: - logging.info(" calling SetFirmwareEnvironmentVariableEx( name='%s', GUID='%s', length=0x%X, attributes=0x%X ).." % (name, "{%s}" % guid, var_len, attrs) ) - success = self._SetFirmwareEnvironmentVariableEx( name, "{%s}" % guid, var, var_len, attrs ) - - if 0 == success: - err = kernel32.GetLastError() - logging.error('SetFirmwareEnvironmentVariable failed (GetLastError = 0x%x)' % err ) - logging.error(WinError()) - errorstring = WinError(err) - return (success,err, errorstring) - +# @file +# +# Python lib to support Reading and writing UEFI variables from windows +# +# Modified from original source to not produce error messages for Variable NOT FOUND +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +import os, sys +from ctypes import * +import logging +import pywintypes +import win32api, win32process, win32security, win32file +import winerror + +kernel32 = windll.kernel32 +EFI_VAR_MAX_BUFFER_SIZE = 1024*1024 + +class UefiVariable(object): + + def __init__(self): + # enable required SeSystemEnvironmentPrivilege privilege + privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) + token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) + win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) + win32api.CloseHandle( token ) + + # import firmware variable API + try: + self._GetFirmwareEnvironmentVariable = kernel32.GetFirmwareEnvironmentVariableW + self._GetFirmwareEnvironmentVariable.restype = c_int + self._GetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] + self._SetFirmwareEnvironmentVariable = kernel32.SetFirmwareEnvironmentVariableW + self._SetFirmwareEnvironmentVariable.restype = c_int + self._SetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] + self._SetFirmwareEnvironmentVariableEx = kernel32.SetFirmwareEnvironmentVariableExW + self._SetFirmwareEnvironmentVariableEx.restype = c_int + self._SetFirmwareEnvironmentVariableEx.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int, c_int] + except AttributeError as msg: + logging.warn( "G[S]etFirmwareEnvironmentVariableW function doesn't seem to exist" ) + pass + + # + # Helper function to create buffer for var read/write + # + def CreateBuffer(self, init, size=None): + """CreateBuffer(aString) -> character array + CreateBuffer(anInteger) -> character array + CreateBuffer(aString, anInteger) -> character array + """ + if isinstance(init, str): + if size is None: + size = len(init)+1 + buftype = c_char * size + buf = buftype() + buf.value = init + return buf + elif isinstance(init, int): + buftype = c_char * init + buf = buftype() + return buf + raise TypeError(init) + + # + #Function to get variable + # return a tuple of error code and variable data as string + # + def GetUefiVar(self, name, guid ): + err = 0 #success + efi_var = create_string_buffer( EFI_VAR_MAX_BUFFER_SIZE ) + if self._GetFirmwareEnvironmentVariable is not None: + logging.info("calling GetFirmwareEnvironmentVariable( name='%s', GUID='%s' ).." % (name, "{%s}" % guid) ) + length = self._GetFirmwareEnvironmentVariable( name, "{%s}" % guid, efi_var, EFI_VAR_MAX_BUFFER_SIZE ) + if (0 == length) or (efi_var is None): + err = kernel32.GetLastError() + # + # Don't produce an error message for NOT_FOUND + # + if err != 203: # 203 is NOT FOUND + logging.error( 'GetFirmwareEnvironmentVariable[Ex] failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, WinError(err)) + return (err, efi_var[:length], None) + # + #Function to set variable + # return a tuple of boolean status, errorcode, errorstring (None if not error) + # + def SetUefiVar(self, name, guid, var=None, attrs=None): + var_len = 0 + err = 0 + errorstring = None + if var is None: + var = bytes(0) + else: + var_len = len(var) + success = 0 # Fail + if(attrs == None): + if self._SetFirmwareEnvironmentVariable is not None: + logging.info("Calling SetFirmwareEnvironmentVariable (name='%s', Guid='%s')..." % (name, "{%s}" % guid, )) + success = self._SetFirmwareEnvironmentVariable(name, "{%s}" % guid, var, var_len) + else: + attrs = int(attrs) + if self._SetFirmwareEnvironmentVariableEx is not None: + logging.info(" calling SetFirmwareEnvironmentVariableEx( name='%s', GUID='%s', length=0x%X, attributes=0x%X ).." % (name, "{%s}" % guid, var_len, attrs) ) + success = self._SetFirmwareEnvironmentVariableEx( name, "{%s}" % guid, var, var_len, attrs ) + + if 0 == success: + err = kernel32.GetLastError() + logging.error('SetFirmwareEnvironmentVariable failed (GetLastError = 0x%x)' % err ) + logging.error(WinError()) + errorstring = WinError(err) + return (success,err, errorstring) + diff --git a/AdvLoggerPkg/Docs/ReadMe.md b/AdvLoggerPkg/Docs/ReadMe.md index d8a362b1c9..831fe471f6 100644 --- a/AdvLoggerPkg/Docs/ReadMe.md +++ b/AdvLoggerPkg/Docs/ReadMe.md @@ -1,265 +1,265 @@ -# AdvLoggerPkg - Advanced Logger Package - -## About - -The AdvancedLogger logs all debug messages into memory. -At certain points, the log may be flushed to disk. -The in memory log data is also available during runtime. - -## Configuration - -The following configurations are supported: - -| Phase | Usage | -| --- | --- | -| DXE Only | Uses DxeCore, DxeRuntime, and Dxe AdvancedLoggerLib libraries for logging from start of DXE CORE through Exit Boot Services. Accepts the PEI Advanced Logger Hob if one is generated. Produces the AdvancedLogger protocol. | -| DXE+SMM | Requires DXE modules above, and adds the Smm AdvancedLoggerLib library. Collects SMM generated messages in the in memory log. | -| PEI | Uses PeiCore and Pei AdvancedLoggerLib libraries. Creates the Advanced Logger Hob if PcdAdvancedLoggerPeiInRAM is set. | -| SEC | Uses the Sec Advanced Logger Library. SEC requires a fixed load address, so it piggy backs on the Temporary RAM PCD information. Produces a Fixed Address temporary RAM log. When memory is added, the Sec Advanced Logger library converts the Temporary RAM logging information to the PEI Advanced Logger Hob. | -| PEI64 | Uses Pei64 Advanced Logger Library. Requires the SEC fixed address temporary log information in order to log Pei64 bit DEBUG messages. | -| MM | Standalone MM - Loads during PEI phase. | -| MMARM | Standalone MM that loads prior to UEFI with a fixed memory block shared with UEFI. | - -PCD's used by Advanced Logger - -| PCD | Function of the PCD| -| --- | --- | -|PcdAdvancedLoggerForceEnable | The default operation is to check if a Logs directory is present in the root of the filesystem. If the UefiLogs directory is present, logging is enabled. When PcdAdvancedLoggerForceEnable is TRUE, and the device is not a USB device, a UefiLogs directory will be created and logging is enabled. When logging is enabled, the proper log files will be created if not already preset.| -|PcdAdvancedLoggerPeiInRAM | For systems that have memory at PeiCore entry. The full in memory log buffer if PcdAdvancedLoggerPages is allocated in the Pei Core constructor and PcdAdvancedLoggerPreMemPages is ignored.| -|PcdAdvancedLoggerFixedInRAM | For systems that have a fixed memory buffer prior to UEFI. The full in memory log buffer is assumed.| -|PcdAdvancedHdwLoggerDebugPrintErrorLevel | The standard debug flags filter which log messages are produced. This PCD allow a subset of log messages to be forwarded to the Hdw Port Lib.| -|PcdAdvancedHdwLoggerDisable | Specifies when to disable writing to the Hdw Port.| -|PcdAdvancedLoggerPreMemPages | Amount of temporary RAM used for the debug log.| -|PcdAdvancedLoggerPages | Amount of system RAM used for the debug log| -|PcdAdvancedLoggerLocator | When enabled, the AdvLogger creates a variable "AdvLoggerLocator" with the address of the LoggerInfo buffer| - -## Libraries - -The following libraries are used with AdvancedLogger: - -| Library | Function of the Library | -| --- | --- | -| AdvancedLoggerAccessLib | Used to access the memory log - used by FileLogger and Serial/Dxe/Logger | -| AdvancedLoggerLib | One per module type - used to provide access to the in memory log buffer | -| AdvLoggerSmmAccessLib | Used to intercept GetVariable in order to provide an OS utility the ability to read the log | -| BaseDebugLibAdvancedLogger | Basic Dxe etc DebugLib | -| DebugAgent | Used to intercept SEC initialization | -| PeiDebugLibAdvancedLogger | Basic Pei DebugLib | -| AdvancedLoggerHdwPortLib | Hook for a hardware port to capture debug messages as they are written to the log. | - -## Platform notes - -### IA32/X64 - -The SEC version of the Advanced Logger uses the temporary RAM block. This block is fixed in size -and location, and this temporary RAM block needs to be adjusted to make room for the Advanced -Logger buffer. -There may be cases where the processor cache size is too small to enable the Advanced Logger -during SEC. - -The PEI versions of Advanced Logger work together to save space. Rather than have the Debug Print -libraries linked in all the PEIM's, only PEI_CORE has the Debug Print libraries. -The PEI version of AdvancedLoggerLib uses the IDT to access a pointer to the PEI_CORE routines. - -The following changes are needed in the .dsc for IA32/X64. - -```inf -[LibraryClasses.common] - DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf - AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf - -[LibraryClasses.IA32.SEC] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Sec/AdvancedLoggerLib.inf - DebugAgentLib|AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.inf - -[LibraryClasses.IA32.PEI_CORE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/PeiCore/AdvancedLoggerLib.inf - -[LibraryClasses.IA32.PEIM] - DebugLib|AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf - -[LibraryClasses.X64.PEIM] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei64/AdvancedLoggerLib.inf - -[LibraryClasses.X64] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Dxe/AdvancedLoggerLib.inf - AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf - -[LibraryClasses.X64.DXE_CORE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.inf - -[LibraryClasses.X64.DXE_SMM_DRIVER] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Smm/AdvancedLoggerLib.inf - -[LibraryClasses.X64.SMM_CORE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Smm/AdvancedLoggerLib.inf - -[LibraryClasses.X64.DXE_RUNTIME_DRIVER] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Runtime/AdvancedLoggerLib.inf - -[PcdsFeatureFlag] -## Build Example if your build environment differentiates customer builds from internal test builds -!if $(SHIP_MODE) == FALSE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|TRUE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerLocator|TRUE -!else - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|FALSE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerLocator|TRUE -!endif -``` - -The following changes should be in the family .dsc where the processor specific changes are specified - -```inf -[PcdsFixedAtBuild.common] - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPreMemPages|24 - - #Advanced Logger configuration - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerBase | 0xFA000000 # Must be TemporaryRamBase - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerCarBase | 0xFA200000 # Address for CAR memory - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPreMemPages | 256 # Size is 1MB - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPages | 1024 # Size is 4MB - -``` - -### ARM with Security Processor - -#### UEFI - -In this configuration, the Advanced Logger memory buffer is preallocated and setup from the BL31 -(secure partition loader) at a known address. -This simplifies SEC and PEI as memory has already been configured. - -Due to the memory block being at a known address, the SEC, PEI_CORE, and PEI modules link to -the BaseArm version of AdvancedLoggerLib. -While the BaseArm version includes the Debug Print libraries, it is assumed that there are few -PEI components in the ARM with Security Processor configuration. - -```inf -################################################################ -# -# Advanced Logger Configurations -# -################################################################ -[LibraryClasses.common] - DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf - AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf - AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf - AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf - -[LibraryClasses.common.SEC] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/BaseArm/AdvancedLoggerLib.inf - AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf - -[LibraryClasses.common.PEI_CORE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/PeiCore/AdvancedLoggerLib.inf - -[LibraryClasses.common.PEIM] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei/AdvancedLoggerLib.inf - DebugLib|AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf - -[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Dxe/AdvancedLoggerLib.inf - -[LibraryClasses.common.DXE_CORE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.inf - -[LibraryClasses.common.DXE_RUNTIME_DRIVER] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Runtime/AdvancedLoggerLib.inf - -[PcdsFeatureFlag] - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|FALSE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerLocator|TRUE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerFixedInRAM|TRUE - - # Set AdvLogger to flush at ReadyToBoot (0x01) and at ExitBootServices (0x02). - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerFlush|0x03 -``` - -The following changes should be in the family .dsc where the processor specific changes are specified - -```inf -[PcdsFixedAtBuild.common] - #Advanced Logger configuration - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerBase | 0xFF622000 # Buffer address - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPages | 0x400 # Size is 4MB -``` - -#### MM Standalone Arm with security processor - -In this configuration, the MM code needs to initialize the common buffer that was allocated from -the BL31 (secure partition loader) in order to provide log messages prior to UEFI starting. - -```inf -[LibraryClasses.common] - DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf - AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf - AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf - -[LibraryClasses.common.MM_CORE_STANDALONE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/MmCoreArm/AdvancedLoggerLib.inf - -[LibraryClasses.common.MM_STANDALONE] - AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/BaseArm/AdvancedLoggerLib.inf - AdvLoggerAccessLib|AdvLoggerPkg/Library/AdvLoggerMmAccessLib/AdvLoggerMmAccessLib.inf - -[PcdsFeatureFlag] - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|FALSE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerLocator|TRUE - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerFixedInRAM|TRUE - # Set AdvLogger to flush at ReadyToBoot (0x01) and at ExitBootServices (0x02). - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerFlush|0x03 - -[PcdsFixedAtBuild.common] - #Advanced Logger configuration - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerBase | 0xFF622000 # Buffer address - gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPages | 0x400 # Size is 4MB -``` - -## Advanced File Logger - -The Advanced File Logger monitors for file systems mounted during boot. -When an eligible file system is detected, the log is flushed to the file system. -The log is flushed if the system is reset during POST, and at Exit Boot Services. - -An eligible file system is one with a UefiLogs directory in the root of the file system. -If no log files are present, the Advanced File Logger will create a log index file which -contains the index of the last log file written, and nine log files each PcdAdvancedLoggerPages -in size. -These files are pre allocated at one time to reduce interference with other users of the filesystem. - -To enable the Advanced File Logger, the following change is needed in the .dsc: - -```inf -[Components.] - AdvLoggerPkg/AdvancedFileLogger/AdvancedFileLogger.inf -``` - -and the follow change is needed in the .fdf: - -```inf -[Components.FV.] - INF AdvLoggerPkg/AdvancedFileLogger/AdvancedFileLogger.inf -``` - -## Hardware Logging Level - -The v3 data header supports a new field of hardware debugging level to support setting the serial print configurable -during boot time. - -The default value will be initialized to the value of `PcdAdvancedLoggerHdwPortDebugPrintErrorLevel` in the PEI core, -DXE core, or MM core, whichever comes first during the boot process. - -To override the initialized hardware print level, user needs to first get the advanced logger info region, this could -be done, depending on the boot phase of consumer, through the `PcdAdvancedLoggerBase` in SEC phase and/or if `PcdAdvancedLoggerFixedInRAM` -is set, or `gAdvancedLoggerHobGuid` HOB if setup in PEI phase. - -Note: This change will require all the firmware entities to update to v3 of advanced logger together. Torn state will -result in hardware printing not functional. - ---- - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# AdvLoggerPkg - Advanced Logger Package + +## About + +The AdvancedLogger logs all debug messages into memory. +At certain points, the log may be flushed to disk. +The in memory log data is also available during runtime. + +## Configuration + +The following configurations are supported: + +| Phase | Usage | +| --- | --- | +| DXE Only | Uses DxeCore, DxeRuntime, and Dxe AdvancedLoggerLib libraries for logging from start of DXE CORE through Exit Boot Services. Accepts the PEI Advanced Logger Hob if one is generated. Produces the AdvancedLogger protocol. | +| DXE+SMM | Requires DXE modules above, and adds the Smm AdvancedLoggerLib library. Collects SMM generated messages in the in memory log. | +| PEI | Uses PeiCore and Pei AdvancedLoggerLib libraries. Creates the Advanced Logger Hob if PcdAdvancedLoggerPeiInRAM is set. | +| SEC | Uses the Sec Advanced Logger Library. SEC requires a fixed load address, so it piggy backs on the Temporary RAM PCD information. Produces a Fixed Address temporary RAM log. When memory is added, the Sec Advanced Logger library converts the Temporary RAM logging information to the PEI Advanced Logger Hob. | +| PEI64 | Uses Pei64 Advanced Logger Library. Requires the SEC fixed address temporary log information in order to log Pei64 bit DEBUG messages. | +| MM | Standalone MM - Loads during PEI phase. | +| MMARM | Standalone MM that loads prior to UEFI with a fixed memory block shared with UEFI. | + +PCD's used by Advanced Logger + +| PCD | Function of the PCD| +| --- | --- | +|PcdAdvancedLoggerForceEnable | The default operation is to check if a Logs directory is present in the root of the filesystem. If the UefiLogs directory is present, logging is enabled. When PcdAdvancedLoggerForceEnable is TRUE, and the device is not a USB device, a UefiLogs directory will be created and logging is enabled. When logging is enabled, the proper log files will be created if not already preset.| +|PcdAdvancedLoggerPeiInRAM | For systems that have memory at PeiCore entry. The full in memory log buffer if PcdAdvancedLoggerPages is allocated in the Pei Core constructor and PcdAdvancedLoggerPreMemPages is ignored.| +|PcdAdvancedLoggerFixedInRAM | For systems that have a fixed memory buffer prior to UEFI. The full in memory log buffer is assumed.| +|PcdAdvancedHdwLoggerDebugPrintErrorLevel | The standard debug flags filter which log messages are produced. This PCD allow a subset of log messages to be forwarded to the Hdw Port Lib.| +|PcdAdvancedHdwLoggerDisable | Specifies when to disable writing to the Hdw Port.| +|PcdAdvancedLoggerPreMemPages | Amount of temporary RAM used for the debug log.| +|PcdAdvancedLoggerPages | Amount of system RAM used for the debug log| +|PcdAdvancedLoggerLocator | When enabled, the AdvLogger creates a variable "AdvLoggerLocator" with the address of the LoggerInfo buffer| + +## Libraries + +The following libraries are used with AdvancedLogger: + +| Library | Function of the Library | +| --- | --- | +| AdvancedLoggerAccessLib | Used to access the memory log - used by FileLogger and Serial/Dxe/Logger | +| AdvancedLoggerLib | One per module type - used to provide access to the in memory log buffer | +| AdvLoggerSmmAccessLib | Used to intercept GetVariable in order to provide an OS utility the ability to read the log | +| BaseDebugLibAdvancedLogger | Basic Dxe etc DebugLib | +| DebugAgent | Used to intercept SEC initialization | +| PeiDebugLibAdvancedLogger | Basic Pei DebugLib | +| AdvancedLoggerHdwPortLib | Hook for a hardware port to capture debug messages as they are written to the log. | + +## Platform notes + +### IA32/X64 + +The SEC version of the Advanced Logger uses the temporary RAM block. This block is fixed in size +and location, and this temporary RAM block needs to be adjusted to make room for the Advanced +Logger buffer. +There may be cases where the processor cache size is too small to enable the Advanced Logger +during SEC. + +The PEI versions of Advanced Logger work together to save space. Rather than have the Debug Print +libraries linked in all the PEIM's, only PEI_CORE has the Debug Print libraries. +The PEI version of AdvancedLoggerLib uses the IDT to access a pointer to the PEI_CORE routines. + +The following changes are needed in the .dsc for IA32/X64. + +```inf +[LibraryClasses.common] + DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf + AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf + +[LibraryClasses.IA32.SEC] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Sec/AdvancedLoggerLib.inf + DebugAgentLib|AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.inf + +[LibraryClasses.IA32.PEI_CORE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/PeiCore/AdvancedLoggerLib.inf + +[LibraryClasses.IA32.PEIM] + DebugLib|AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf + +[LibraryClasses.X64.PEIM] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei64/AdvancedLoggerLib.inf + +[LibraryClasses.X64] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Dxe/AdvancedLoggerLib.inf + AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf + +[LibraryClasses.X64.DXE_CORE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.inf + +[LibraryClasses.X64.DXE_SMM_DRIVER] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Smm/AdvancedLoggerLib.inf + +[LibraryClasses.X64.SMM_CORE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Smm/AdvancedLoggerLib.inf + +[LibraryClasses.X64.DXE_RUNTIME_DRIVER] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Runtime/AdvancedLoggerLib.inf + +[PcdsFeatureFlag] +## Build Example if your build environment differentiates customer builds from internal test builds +!if $(SHIP_MODE) == FALSE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|TRUE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerLocator|TRUE +!else + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|FALSE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerLocator|TRUE +!endif +``` + +The following changes should be in the family .dsc where the processor specific changes are specified + +```inf +[PcdsFixedAtBuild.common] + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPreMemPages|24 + + #Advanced Logger configuration + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerBase | 0xFA000000 # Must be TemporaryRamBase + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerCarBase | 0xFA200000 # Address for CAR memory + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPreMemPages | 256 # Size is 1MB + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPages | 1024 # Size is 4MB + +``` + +### ARM with Security Processor + +#### UEFI + +In this configuration, the Advanced Logger memory buffer is preallocated and setup from the BL31 +(secure partition loader) at a known address. +This simplifies SEC and PEI as memory has already been configured. + +Due to the memory block being at a known address, the SEC, PEI_CORE, and PEI modules link to +the BaseArm version of AdvancedLoggerLib. +While the BaseArm version includes the Debug Print libraries, it is assumed that there are few +PEI components in the ARM with Security Processor configuration. + +```inf +################################################################ +# +# Advanced Logger Configurations +# +################################################################ +[LibraryClasses.common] + DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf + AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf + AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf + AdvancedLoggerAccessLib|AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.inf + +[LibraryClasses.common.SEC] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/BaseArm/AdvancedLoggerLib.inf + AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf + +[LibraryClasses.common.PEI_CORE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/PeiCore/AdvancedLoggerLib.inf + +[LibraryClasses.common.PEIM] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Pei/AdvancedLoggerLib.inf + DebugLib|AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf + +[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Dxe/AdvancedLoggerLib.inf + +[LibraryClasses.common.DXE_CORE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/Runtime/AdvancedLoggerLib.inf + +[PcdsFeatureFlag] + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|FALSE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerLocator|TRUE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerFixedInRAM|TRUE + + # Set AdvLogger to flush at ReadyToBoot (0x01) and at ExitBootServices (0x02). + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerFlush|0x03 +``` + +The following changes should be in the family .dsc where the processor specific changes are specified + +```inf +[PcdsFixedAtBuild.common] + #Advanced Logger configuration + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerBase | 0xFF622000 # Buffer address + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPages | 0x400 # Size is 4MB +``` + +#### MM Standalone Arm with security processor + +In this configuration, the MM code needs to initialize the common buffer that was allocated from +the BL31 (secure partition loader) in order to provide log messages prior to UEFI starting. + +```inf +[LibraryClasses.common] + DebugLib|AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf + AssertLib|AdvLoggerPkg/Library/AssertLib/AssertLib.inf + AdvancedLoggerHdwPortLib|AdvLoggerPkg/Library/AdvancedLoggerHdwPortLib/AdvancedLoggerHdwPortLib.inf + +[LibraryClasses.common.MM_CORE_STANDALONE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/MmCoreArm/AdvancedLoggerLib.inf + +[LibraryClasses.common.MM_STANDALONE] + AdvancedLoggerLib|AdvLoggerPkg/Library/AdvancedLoggerLib/BaseArm/AdvancedLoggerLib.inf + AdvLoggerAccessLib|AdvLoggerPkg/Library/AdvLoggerMmAccessLib/AdvLoggerMmAccessLib.inf + +[PcdsFeatureFlag] + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerForceEnable|FALSE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerLocator|TRUE + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerFixedInRAM|TRUE + # Set AdvLogger to flush at ReadyToBoot (0x01) and at ExitBootServices (0x02). + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedFileLoggerFlush|0x03 + +[PcdsFixedAtBuild.common] + #Advanced Logger configuration + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerBase | 0xFF622000 # Buffer address + gAdvLoggerPkgTokenSpaceGuid.PcdAdvancedLoggerPages | 0x400 # Size is 4MB +``` + +## Advanced File Logger + +The Advanced File Logger monitors for file systems mounted during boot. +When an eligible file system is detected, the log is flushed to the file system. +The log is flushed if the system is reset during POST, and at Exit Boot Services. + +An eligible file system is one with a UefiLogs directory in the root of the file system. +If no log files are present, the Advanced File Logger will create a log index file which +contains the index of the last log file written, and nine log files each PcdAdvancedLoggerPages +in size. +These files are pre allocated at one time to reduce interference with other users of the filesystem. + +To enable the Advanced File Logger, the following change is needed in the .dsc: + +```inf +[Components.] + AdvLoggerPkg/AdvancedFileLogger/AdvancedFileLogger.inf +``` + +and the follow change is needed in the .fdf: + +```inf +[Components.FV.] + INF AdvLoggerPkg/AdvancedFileLogger/AdvancedFileLogger.inf +``` + +## Hardware Logging Level + +The v3 data header supports a new field of hardware debugging level to support setting the serial print configurable +during boot time. + +The default value will be initialized to the value of `PcdAdvancedLoggerHdwPortDebugPrintErrorLevel` in the PEI core, +DXE core, or MM core, whichever comes first during the boot process. + +To override the initialized hardware print level, user needs to first get the advanced logger info region, this could +be done, depending on the boot phase of consumer, through the `PcdAdvancedLoggerBase` in SEC phase and/or if `PcdAdvancedLoggerFixedInRAM` +is set, or `gAdvancedLoggerHobGuid` HOB if setup in PEI phase. + +Note: This change will require all the firmware entities to update to v3 of advanced logger together. Torn state will +result in hardware printing not functional. + +--- + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf b/AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf index 288cb65071..057cbf4376 100644 --- a/AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf +++ b/AdvLoggerPkg/Library/PeiDebugLibAdvancedLogger/PeiDebugLibAdvancedLogger.inf @@ -1,49 +1,49 @@ -### @file -# Debug Library to be used with DebugPortPEI library -# Routes all DebugPrint and DebugAssert calls through PPI -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -### - -[Defines] - INF_VERSION = 1.26 - BASE_NAME = PeiDebugLibAdvancedLogger - FILE_GUID = 903e8e24-c26e-4f8b-9710-f9e78a50bcbd - VERSION_STRING = 1.0 - MODULE_TYPE = PEIM - LIBRARY_CLASS = DebugLib|PEIM -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[LibraryClasses] - PcdLib - BaseLib - DebugPrintErrorLevelLib - PeiServicesLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - AdvLoggerPkg/AdvLoggerPkg.dec - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES - -[Sources] - DebugLib.c - -[Ppis] - gAdvancedLoggerPpiGuid ## SOMETIMES_CONSUMES - -[Depex] - TRUE - +### @file +# Debug Library to be used with DebugPortPEI library +# Routes all DebugPrint and DebugAssert calls through PPI +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION = 1.26 + BASE_NAME = PeiDebugLibAdvancedLogger + FILE_GUID = 903e8e24-c26e-4f8b-9710-f9e78a50bcbd + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + LIBRARY_CLASS = DebugLib|PEIM +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[LibraryClasses] + PcdLib + BaseLib + DebugPrintErrorLevelLib + PeiServicesLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + AdvLoggerPkg/AdvLoggerPkg.dec + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES + +[Sources] + DebugLib.c + +[Ppis] + gAdvancedLoggerPpiGuid ## SOMETIMES_CONSUMES + +[Depex] + TRUE + diff --git a/AdvLoggerPkg/UnitTests/LineParser/readme.md b/AdvLoggerPkg/UnitTests/LineParser/readme.md index c9280bcab3..0707480dbe 100644 --- a/AdvLoggerPkg/UnitTests/LineParser/readme.md +++ b/AdvLoggerPkg/UnitTests/LineParser/readme.md @@ -1,23 +1,23 @@ -# Verify Line Parser function for development - -This test is to model the Line Parser in the AdvancedFileLogger. - -The internal message log is in units of DEBUG(()). While most messages are a complete -and end with a '\n', there are some debug messages that are built with multiple DEBUG(()) -operations. - -The line parser builds a debug line by copying one or more DEBUG(()) segments into a line, -and prepends the time stamp. - -## About - -These tests verify that the LineParser is functional. - -## LineParserTestApp - ---- - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Verify Line Parser function for development + +This test is to model the Line Parser in the AdvancedFileLogger. + +The internal message log is in units of DEBUG(()). While most messages are a complete +and end with a '\n', there are some debug messages that are built with multiple DEBUG(()) +operations. + +The line parser builds a debug line by copying one or more DEBUG(()) segments into a line, +and prepends the time stamp. + +## About + +These tests verify that the LineParser is functional. + +## LineParserTestApp + +--- + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/DfciPkg/Application/DfciMenu/DfciMenuStrings.uni b/DfciPkg/Application/DfciMenu/DfciMenuStrings.uni index 7fa25d75e1..34a96989d7 100644 --- a/DfciPkg/Application/DfciMenu/DfciMenuStrings.uni +++ b/DfciPkg/Application/DfciMenu/DfciMenuStrings.uni @@ -1,126 +1,126 @@ -/** @file -DfciMenuStrings.uni - -This file maintains the text strings used by the Device Firmware Configuration Interface Menu. - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#langdef en-US " English " -#langdef en " Standard English " - -// Common Form strings - -#string STR_NULL_STRING #language en-US "" - -//*---------------------------------------------------------------------* -// Form 1 - Dfci Main form -// -//*---------------------------------------------------------------------* -#string STR_DFCI_MENU_TITLE #language en-US "Management" - -#string STR_DFCI_MANAGEMENT_HEADER #language en-US "\fh!48!Management" - -#string STR_DFCI_OPT_IN_CHANGED #language en-US "\fc!Red!The opt in state has been changed. Restart the system to apply the setting." - -#string STR_DFCI_ZUM_STATUS_READY #language en-US "Zero-touch UEFI Management: Ready" - -#string STR_DFCI_ZUM_OPT_OUT #language en-US "Opt Out" - -#string STR_DFCI_ZUM_STATUS_NOT_READY #language en-US "Zero-touch UEFI Management: Not Ready" - -#string STR_DFCI_ZUM_OPT_IN #language en-US "Opt In" - -#string STR_DFCI_USB_INSTALL #language en-US "If your settings manager has provided you with a configuration file on a USB drive, press Install from USB to apply the management file." - -#string STR_DFCI_USB_INSTALL_NOW #language en-US "Install from USB" - -#string STR_DFCI_MANAGED_BY #language en-US "Managed by:" - -#string STR_DFCI_MANAGED_BY_FIELD #language en-US "Managed by field missing" - -#string STR_DFCI_ON_BEHALF_OF #language en-US "On behalf of: " - -#string STR_DFCI_MDM_FRIENDLY_NAME #language en-US "MDM Friendly Name missing." - -#string STR_DFCI_MDM_TENANT_NAME #language en-US "MDM Tenant Name Missing" - -#string STR_DFCI_MENU_CONFIGURE #language en-US "Configure" - -#string STR_DETAILS #language en-US "\fh!36!Details" - -#string STR_DFCI_SUBJECT #language en-US "Subject:" - -#string STR_DFCI_THUMBPRINT #language en-US "Thumbprint:" - -#string STR_DFCI_USER2_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" - -#string STR_DFCI_USER2_THUMBPRINT_FIELD #language en-US "Thumbprint2 field missing from the certificate" - -#string STR_DFCI_USER1_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" - -#string STR_DFCI_USER1_THUMBPRINT_FIELD #language en-US "Thumbprint1 field missing from the certificate" - -#string STR_DFCI_USER_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" - -#string STR_DFCI_USER_THUMBPRINT_FIELD #language en-US "Thumbprint field missing from the certificate" - -#string STR_DFCI_OWNER_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" - -#string STR_DFCI_OWNER_THUMBPRINT_FIELD #language en-US "Thumbprint field missing from the certificate" - -#string STR_DFCI_ZTD_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" - -#string STR_DFCI_ZTD_THUMBPRINT_FIELD #language en-US "Thumbprint field missing from the certificate" - -//*---------------------------------------------------------------------* -// Form 2 - Dfci Configure form * -// * -//*---------------------------------------------------------------------* -#string STR_DFCI_CONFIGURATION_HEADER #language en-US "\fh!48!Management Configuration" - -#string STR_DFCI_HTTP_RECOVERY #language en-US "The settings manager has enabled network configuration. With a supported network adapter, pressing Refresh from Network will contact the settings provider to obtain the latest settings for this device." - -#string STR_DFCI_HTTP_UPDATE_NOW #language en-US "Refresh from Network" - -#string STR_DFCI_URL #language en-US "Server:" - -#string STR_DFCI_URL_FIELD #language en-US "Server field missing" - -#string STR_DFCI_USB_RECOVERY #language en-US "If your settings manager has provided you with a configuration file on a USB drive, press Refresh from USB to apply the management file." - -#string STR_DFCI_USB_UPDATE_NOW #language en-US "Refresh from USB" - -#string STR_DFCI_RESET_INFO #language en-US "The settings manager has enabled the Management Recovery feature of Management mode. To start the reset procedure, press Management Recovery." - -#string STR_DFCI_MENU_RECOVERY_NOW #language en-US "Management Recovery" - -#string STR_DFCI_RESET_PERMISSION_INFO #language en-US "The settings manager has not enabled the Management Recovery feature of Management mode on this system." - -//*---------------------------------------------------------------------* -// Form 3 - Dfci Recovery Info form * -// * -//*---------------------------------------------------------------------* -#string STR_DFCI_RECOVERY_INFO #language en-US "You should only access this menu under the direction of the management owner. The management owner will have to work with you using the following menus. Press Continue to start the management recovery process." - -#string STR_DFCI_MENU_CONTINUE_NOW #language en-US "Continue" - -//*---------------------------------------------------------------------* -// Internal dialog box messages -// -//*---------------------------------------------------------------------* -#string STR_DFCI_MB_TITLE #language en-US "Management refresh completed" - -#string STR_DFCI_MB_CAPTION #language en-US "Refresh settings request successful" - -#string STR_DFCI_MB_CAPTION_FAIL #language en-US "Refresh settings request failed" - -#string STR_DFCI_MB_NEW_SETTINGS #language en-US "Refresh settings requested new settings from\n%s" - -#string STR_DFCI_MB_NO_MEDIA #language en-US "Unable to detect network cable." - -#string STR_DFCI_MB_NOT_FOUND #language en-US "%s not found." - +/** @file +DfciMenuStrings.uni + +This file maintains the text strings used by the Device Firmware Configuration Interface Menu. + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#langdef en-US " English " +#langdef en " Standard English " + +// Common Form strings + +#string STR_NULL_STRING #language en-US "" + +//*---------------------------------------------------------------------* +// Form 1 - Dfci Main form +// +//*---------------------------------------------------------------------* +#string STR_DFCI_MENU_TITLE #language en-US "Management" + +#string STR_DFCI_MANAGEMENT_HEADER #language en-US "\fh!48!Management" + +#string STR_DFCI_OPT_IN_CHANGED #language en-US "\fc!Red!The opt in state has been changed. Restart the system to apply the setting." + +#string STR_DFCI_ZUM_STATUS_READY #language en-US "Zero-touch UEFI Management: Ready" + +#string STR_DFCI_ZUM_OPT_OUT #language en-US "Opt Out" + +#string STR_DFCI_ZUM_STATUS_NOT_READY #language en-US "Zero-touch UEFI Management: Not Ready" + +#string STR_DFCI_ZUM_OPT_IN #language en-US "Opt In" + +#string STR_DFCI_USB_INSTALL #language en-US "If your settings manager has provided you with a configuration file on a USB drive, press Install from USB to apply the management file." + +#string STR_DFCI_USB_INSTALL_NOW #language en-US "Install from USB" + +#string STR_DFCI_MANAGED_BY #language en-US "Managed by:" + +#string STR_DFCI_MANAGED_BY_FIELD #language en-US "Managed by field missing" + +#string STR_DFCI_ON_BEHALF_OF #language en-US "On behalf of: " + +#string STR_DFCI_MDM_FRIENDLY_NAME #language en-US "MDM Friendly Name missing." + +#string STR_DFCI_MDM_TENANT_NAME #language en-US "MDM Tenant Name Missing" + +#string STR_DFCI_MENU_CONFIGURE #language en-US "Configure" + +#string STR_DETAILS #language en-US "\fh!36!Details" + +#string STR_DFCI_SUBJECT #language en-US "Subject:" + +#string STR_DFCI_THUMBPRINT #language en-US "Thumbprint:" + +#string STR_DFCI_USER2_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" + +#string STR_DFCI_USER2_THUMBPRINT_FIELD #language en-US "Thumbprint2 field missing from the certificate" + +#string STR_DFCI_USER1_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" + +#string STR_DFCI_USER1_THUMBPRINT_FIELD #language en-US "Thumbprint1 field missing from the certificate" + +#string STR_DFCI_USER_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" + +#string STR_DFCI_USER_THUMBPRINT_FIELD #language en-US "Thumbprint field missing from the certificate" + +#string STR_DFCI_OWNER_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" + +#string STR_DFCI_OWNER_THUMBPRINT_FIELD #language en-US "Thumbprint field missing from the certificate" + +#string STR_DFCI_ZTD_SUBJECT_FIELD #language en-US "Subject field missing from the certificate" + +#string STR_DFCI_ZTD_THUMBPRINT_FIELD #language en-US "Thumbprint field missing from the certificate" + +//*---------------------------------------------------------------------* +// Form 2 - Dfci Configure form * +// * +//*---------------------------------------------------------------------* +#string STR_DFCI_CONFIGURATION_HEADER #language en-US "\fh!48!Management Configuration" + +#string STR_DFCI_HTTP_RECOVERY #language en-US "The settings manager has enabled network configuration. With a supported network adapter, pressing Refresh from Network will contact the settings provider to obtain the latest settings for this device." + +#string STR_DFCI_HTTP_UPDATE_NOW #language en-US "Refresh from Network" + +#string STR_DFCI_URL #language en-US "Server:" + +#string STR_DFCI_URL_FIELD #language en-US "Server field missing" + +#string STR_DFCI_USB_RECOVERY #language en-US "If your settings manager has provided you with a configuration file on a USB drive, press Refresh from USB to apply the management file." + +#string STR_DFCI_USB_UPDATE_NOW #language en-US "Refresh from USB" + +#string STR_DFCI_RESET_INFO #language en-US "The settings manager has enabled the Management Recovery feature of Management mode. To start the reset procedure, press Management Recovery." + +#string STR_DFCI_MENU_RECOVERY_NOW #language en-US "Management Recovery" + +#string STR_DFCI_RESET_PERMISSION_INFO #language en-US "The settings manager has not enabled the Management Recovery feature of Management mode on this system." + +//*---------------------------------------------------------------------* +// Form 3 - Dfci Recovery Info form * +// * +//*---------------------------------------------------------------------* +#string STR_DFCI_RECOVERY_INFO #language en-US "You should only access this menu under the direction of the management owner. The management owner will have to work with you using the following menus. Press Continue to start the management recovery process." + +#string STR_DFCI_MENU_CONTINUE_NOW #language en-US "Continue" + +//*---------------------------------------------------------------------* +// Internal dialog box messages +// +//*---------------------------------------------------------------------* +#string STR_DFCI_MB_TITLE #language en-US "Management refresh completed" + +#string STR_DFCI_MB_CAPTION #language en-US "Refresh settings request successful" + +#string STR_DFCI_MB_CAPTION_FAIL #language en-US "Refresh settings request failed" + +#string STR_DFCI_MB_NEW_SETTINGS #language en-US "Refresh settings requested new settings from\n%s" + +#string STR_DFCI_MB_NO_MEDIA #language en-US "Unable to detect network cable." + +#string STR_DFCI_MB_NOT_FOUND #language en-US "%s not found." + #string STR_DFCI_MB_OPT_CHANGE #language en-US "ZTD Opt In changed. Restart now to apply the change." \ No newline at end of file diff --git a/DfciPkg/Application/EnrollInDfci/EnrollInDfci.inf b/DfciPkg/Application/EnrollInDfci/EnrollInDfci.inf index ecc10a8f20..234697476b 100644 --- a/DfciPkg/Application/EnrollInDfci/EnrollInDfci.inf +++ b/DfciPkg/Application/EnrollInDfci/EnrollInDfci.inf @@ -1,54 +1,54 @@ - -## @file -# A simple UEFI Application to obtain new DFCI configuration data from server. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = EnrollInDfci - FILE_GUID = 48a294cd-540f-4240-9fbc-a8720095588c - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = EnrollInDfciEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - EnrollInDfci.c - Compress.h - Compress.c - -[Packages] - DfciPkg/DfciPkg.dec - ShellPkg/ShellPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - MemoryAllocationLib - ShellLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UefiLib - UefiRuntimeServicesTableLib - -[Protocols] - -[Guids] - gDfciSettingsGuid - gEfiCertX509Guid - -#[BuildOptions] -# DEBUG_*_*_CC_FLAGS = /Od + +## @file +# A simple UEFI Application to obtain new DFCI configuration data from server. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = EnrollInDfci + FILE_GUID = 48a294cd-540f-4240-9fbc-a8720095588c + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = EnrollInDfciEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + EnrollInDfci.c + Compress.h + Compress.c + +[Packages] + DfciPkg/DfciPkg.dec + ShellPkg/ShellPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + ShellLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + +[Guids] + gDfciSettingsGuid + gEfiCertX509Guid + +#[BuildOptions] +# DEBUG_*_*_CC_FLAGS = /Od diff --git a/DfciPkg/AuthManagerNull/AuthManagerNull.inf b/DfciPkg/AuthManagerNull/AuthManagerNull.inf index c162ae5789..2c2794e10f 100644 --- a/DfciPkg/AuthManagerNull/AuthManagerNull.inf +++ b/DfciPkg/AuthManagerNull/AuthManagerNull.inf @@ -1,37 +1,37 @@ -## @file -# AuthManagerNull.inf -# -# Always provides the same token. -# Don't use in production! -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = NullAuthManager - FILE_GUID = 1DD0D079-406A-4B5B-AF39-62D8F110F835 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = Init - -[Sources] - AuthManagerNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - UefiBootServicesTableLib - -[Protocols] - gDfciAuthenticationProtocolGuid #produces - -[Depex] +## @file +# AuthManagerNull.inf +# +# Always provides the same token. +# Don't use in production! +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = NullAuthManager + FILE_GUID = 1DD0D079-406A-4B5B-AF39-62D8F110F835 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = Init + +[Sources] + AuthManagerNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + UefiBootServicesTableLib + +[Protocols] + gDfciAuthenticationProtocolGuid #produces + +[Depex] TRUE \ No newline at end of file diff --git a/DfciPkg/AuthManagerNull/README.md b/DfciPkg/AuthManagerNull/README.md index a1efe6d8bb..b6e4c77f46 100644 --- a/DfciPkg/AuthManagerNull/README.md +++ b/DfciPkg/AuthManagerNull/README.md @@ -1,15 +1,15 @@ -# AuthManagerNull - -## Purposes - -Do not use in production! - -### FrontPage during device bringup - -This driver can be a stand in for IdentityAndAuthManager, which requires RngLib, to allow FrontPage development if -RngLib is not yet functional. - -### Unit Testing - -With further development, this "Null" driver could be an effective stub for IdentityAndAuthManager, allowing detailed -unit testing of DFCI. +# AuthManagerNull + +## Purposes + +Do not use in production! + +### FrontPage during device bringup + +This driver can be a stand in for IdentityAndAuthManager, which requires RngLib, to allow FrontPage development if +RngLib is not yet functional. + +### Unit Testing + +With further development, this "Null" driver could be an effective stub for IdentityAndAuthManager, allowing detailed +unit testing of DFCI. diff --git a/DfciPkg/IdentityAndAuthManager/IdentityAndAuthManagerDxe.inf b/DfciPkg/IdentityAndAuthManager/IdentityAndAuthManagerDxe.inf index e2e1c827c6..84d463adec 100644 --- a/DfciPkg/IdentityAndAuthManager/IdentityAndAuthManagerDxe.inf +++ b/DfciPkg/IdentityAndAuthManager/IdentityAndAuthManagerDxe.inf @@ -1,89 +1,89 @@ -## @file -# IdentityAndAuthManagerDxe.inf -# -# This module manages the Identity certificates, and processes the -# Dfci packets. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = IdentityAndAuthManagerDxe - FILE_GUID = F8126429-7B88-4AD2-98C4-402CBE26F9A8 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = Init - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - AuthManager.c - AuthManagerProvision.c - AuthManagerProvisionedData.c - IdentityAndAuthManager.h - IdentityAndAuthManagerDxe.c - IdentityManager.c - IdentityCurrentSettingsXml.c - RecoverySupport.c - CertSupport.c - UiSupport.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - CryptoPkg/CryptoPkg.dec - XmlSupportPkg/XmlSupportPkg.dec - DfciPkg/DfciPkg.dec - ZeroTouchPkg/ZeroTouchPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - BaseLib - UefiBootServicesTableLib - MemoryAllocationLib - BaseMemoryLib - PrintLib - UefiLib - BaseCryptLib - PasswordStoreLib - DfciDeviceIdSupportLib - DfciRecoveryLib - DfciUiSupportLib - DfciXmlIdentitySchemaSupportLib - ZeroTouchSettingsLib - PcdLib - -[Guids] - gEfiCertPkcs7Guid - gDfciAuthProvisionVarNamespace - gDfciInternalVariableGuid - -[Protocols] - gEfiRngProtocolGuid #SOMETIMES CONSUMES - gDfciApplyIdentityProtocolGuid - gDfciAuthenticationProtocolGuid #produces - gMuPKCS7ProtocolGuid #consumes - gDfciSettingPermissionsProtocolGuid #sometimes consumes - gDfciSettingAccessProtocolGuid #sometimes consumes - -[FeaturePcd] - gDfciPkgTokenSpaceGuid.PcdDfciEnabled - -[Pcd] - -[Depex] - gEfiVariableWriteArchProtocolGuid - AND gEfiVariableArchProtocolGuid - AND gEdkiiVariablePolicyProtocolGuid - AND gDfciSettingPermissionsProtocolGuid - AND gMuPKCS7ProtocolGuid - AND gEfiRngProtocolGuid +## @file +# IdentityAndAuthManagerDxe.inf +# +# This module manages the Identity certificates, and processes the +# Dfci packets. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = IdentityAndAuthManagerDxe + FILE_GUID = F8126429-7B88-4AD2-98C4-402CBE26F9A8 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = Init + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + AuthManager.c + AuthManagerProvision.c + AuthManagerProvisionedData.c + IdentityAndAuthManager.h + IdentityAndAuthManagerDxe.c + IdentityManager.c + IdentityCurrentSettingsXml.c + RecoverySupport.c + CertSupport.c + UiSupport.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + CryptoPkg/CryptoPkg.dec + XmlSupportPkg/XmlSupportPkg.dec + DfciPkg/DfciPkg.dec + ZeroTouchPkg/ZeroTouchPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + BaseLib + UefiBootServicesTableLib + MemoryAllocationLib + BaseMemoryLib + PrintLib + UefiLib + BaseCryptLib + PasswordStoreLib + DfciDeviceIdSupportLib + DfciRecoveryLib + DfciUiSupportLib + DfciXmlIdentitySchemaSupportLib + ZeroTouchSettingsLib + PcdLib + +[Guids] + gEfiCertPkcs7Guid + gDfciAuthProvisionVarNamespace + gDfciInternalVariableGuid + +[Protocols] + gEfiRngProtocolGuid #SOMETIMES CONSUMES + gDfciApplyIdentityProtocolGuid + gDfciAuthenticationProtocolGuid #produces + gMuPKCS7ProtocolGuid #consumes + gDfciSettingPermissionsProtocolGuid #sometimes consumes + gDfciSettingAccessProtocolGuid #sometimes consumes + +[FeaturePcd] + gDfciPkgTokenSpaceGuid.PcdDfciEnabled + +[Pcd] + +[Depex] + gEfiVariableWriteArchProtocolGuid + AND gEfiVariableArchProtocolGuid + AND gEdkiiVariablePolicyProtocolGuid + AND gDfciSettingPermissionsProtocolGuid + AND gMuPKCS7ProtocolGuid + AND gEfiRngProtocolGuid diff --git a/DfciPkg/Library/DfciDeviceIdSupportLibNull/DfciDeviceIdSupportLibNull.inf b/DfciPkg/Library/DfciDeviceIdSupportLibNull/DfciDeviceIdSupportLibNull.inf index 08f54c3f6e..7624a848c5 100644 --- a/DfciPkg/Library/DfciDeviceIdSupportLibNull/DfciDeviceIdSupportLibNull.inf +++ b/DfciPkg/Library/DfciDeviceIdSupportLibNull/DfciDeviceIdSupportLibNull.inf @@ -1,42 +1,42 @@ -## @file -# DfciDeviceIdSupportLibNull.inf -# -# NULL Library for DfciDeviceIdSupportLib. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciDeviceIdSupportLib - FILE_GUID = 191d0ad4-469a-4d62-b526-29abe84d6af2 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DfciDeviceIdSupportLib|DXE_DRIVER UEFI_APPLICATION - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciDeviceIdSupportLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - UefiLib - MemoryAllocationLib - -[Guids] - -[Depex] +## @file +# DfciDeviceIdSupportLibNull.inf +# +# NULL Library for DfciDeviceIdSupportLib. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciDeviceIdSupportLib + FILE_GUID = 191d0ad4-469a-4d62-b526-29abe84d6af2 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DfciDeviceIdSupportLib|DXE_DRIVER UEFI_APPLICATION + + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciDeviceIdSupportLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + UefiLib + MemoryAllocationLib + +[Guids] + +[Depex] diff --git a/DfciPkg/Library/DfciRecoveryLib/DfciRecoveryLib.inf b/DfciPkg/Library/DfciRecoveryLib/DfciRecoveryLib.inf index d1ee6b6229..b1f633bda3 100644 --- a/DfciPkg/Library/DfciRecoveryLib/DfciRecoveryLib.inf +++ b/DfciPkg/Library/DfciRecoveryLib/DfciRecoveryLib.inf @@ -1,54 +1,54 @@ -## @file -# DfciRecoveryLib.inf -# -# This library contains crypto support functions for the DFCI recovery feature. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = DfciRecoveryLib - FILE_GUID = E481DFFC-C539-45C0-ADFD-48C242F8A436 - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = DfciRecoveryLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - DfciRecoveryLib.c - - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - DfciPkg/DfciPkg.dec - - -[LibraryClasses] - DebugLib - BaseCryptLib ## Ultimately, try to remove this. - DfciDeviceIdSupportLib - - -[Protocols] - gEfiRngProtocolGuid - - -[Guids] - gEfiRngAlgorithmSp80090Ctr256Guid - gEfiRngAlgorithmSp80090Hmac256Guid - gEfiRngAlgorithmSp80090Hash256Guid - - -## Required for drivers. -#[Depex] -# TRUE ## JBB/Sean TODO: Should we depend on the RNG protocol, or just try to located it and fail otherwise? +## @file +# DfciRecoveryLib.inf +# +# This library contains crypto support functions for the DFCI recovery feature. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = DfciRecoveryLib + FILE_GUID = E481DFFC-C539-45C0-ADFD-48C242F8A436 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = DfciRecoveryLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + DfciRecoveryLib.c + + +[Packages] + MdePkg/MdePkg.dec + CryptoPkg/CryptoPkg.dec + DfciPkg/DfciPkg.dec + + +[LibraryClasses] + DebugLib + BaseCryptLib ## Ultimately, try to remove this. + DfciDeviceIdSupportLib + + +[Protocols] + gEfiRngProtocolGuid + + +[Guids] + gEfiRngAlgorithmSp80090Ctr256Guid + gEfiRngAlgorithmSp80090Hmac256Guid + gEfiRngAlgorithmSp80090Hash256Guid + + +## Required for drivers. +#[Depex] +# TRUE ## JBB/Sean TODO: Should we depend on the RNG protocol, or just try to located it and fail otherwise? diff --git a/DfciPkg/Library/DfciSampleProvider/readme.md b/DfciPkg/Library/DfciSampleProvider/readme.md index 2db15a04f1..52d416a0f7 100644 --- a/DfciPkg/Library/DfciSampleProvider/readme.md +++ b/DfciPkg/Library/DfciSampleProvider/readme.md @@ -1,13 +1,13 @@ -# Dfci Sample Provider - -This is a DXE driver that publishes the gDfciSettingsProviderSupportProtocolGuid protocol, which is a settings provider -for DFCI. - -This is **not to be used in production** but is provided as a sample for reference when creating your own provider. - -For more information, please refer to the DFCI documentation [here]( https://microsoft.github.io/mu/dyn/mu_plus/DfciPkg/Docs/PlatformIntegration/DfciSettingProviders/) - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Dfci Sample Provider + +This is a DXE driver that publishes the gDfciSettingsProviderSupportProtocolGuid protocol, which is a settings provider +for DFCI. + +This is **not to be used in production** but is provided as a sample for reference when creating your own provider. + +For more information, please refer to the DFCI documentation [here]( https://microsoft.github.io/mu/dyn/mu_plus/DfciPkg/Docs/PlatformIntegration/DfciSettingProviders/) + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/DfciPkg/Library/DfciSettingPermissionLib/DfciSettingPermissionLib.inf b/DfciPkg/Library/DfciSettingPermissionLib/DfciSettingPermissionLib.inf index da8cbcf47d..f0c3e64486 100644 --- a/DfciPkg/Library/DfciSettingPermissionLib/DfciSettingPermissionLib.inf +++ b/DfciPkg/Library/DfciSettingPermissionLib/DfciSettingPermissionLib.inf @@ -1,77 +1,77 @@ -## @file -# DfciSettingPermissionLib.inf -# -# This library provides all the logic for the SettingsManager to use for Permission Management. -# This library should not be linked in by other modules as it used only by the Settings Manager. -# If modules want to find out a permission value they should use the SettingAccessProtocol which will return -# flags indicating write access -# -# This library has a very small public interface but it has a lot of -# logic required to support Permissions, Provisioning Permissions from tool through variable interface, etc -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciSettingPermissionLib - FILE_GUID = 659801E4-4729-4461-86F6-19E0942CCA5C - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DfciSettingPermissionLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = DfciPermissionInit -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciSettingPermission.c - DfciSettingPermissionProvisioned.c #support loaded saved/already provisioned data into internal stores for usage - DfciSettingPermission.h - PermissionStoreSupport.c - DfciSettingPermissionProvisionXml.c #Support reading a Permission Packet in XML format and applying to Permission Store - DfciSettingPermissionCurrentPermissionXml.c #Support conversion of current permissions to XML format and - GroupSupport.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - XmlTreeLib - XmlTreeQueryLib - DfciXmlPermissionSchemaSupportLib - PrintLib - BaseLib - MemoryAllocationLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - UefiLib - BaseMemoryLib - DfciDeviceIdSupportLib - DfciUiSupportLib - DfciV1SupportLib - DfciGroupLib - DxeServicesLib - PcdLib - -[Protocols] - gDfciApplyPermissionsProtocolGuid - gDfciAuthenticationProtocolGuid - -[Guids] - gDfciPermissionManagerVarNamespace - gDfciInternalVariableGuid - -[Pcd] - gDfciPkgTokenSpaceGuid.PcdUnsignedListFormatAllow - gDfciPkgTokenSpaceGuid.PcdUnsignedPermissionsFile - -[Depex] - TRUE +## @file +# DfciSettingPermissionLib.inf +# +# This library provides all the logic for the SettingsManager to use for Permission Management. +# This library should not be linked in by other modules as it used only by the Settings Manager. +# If modules want to find out a permission value they should use the SettingAccessProtocol which will return +# flags indicating write access +# +# This library has a very small public interface but it has a lot of +# logic required to support Permissions, Provisioning Permissions from tool through variable interface, etc +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciSettingPermissionLib + FILE_GUID = 659801E4-4729-4461-86F6-19E0942CCA5C + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DfciSettingPermissionLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = DfciPermissionInit +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciSettingPermission.c + DfciSettingPermissionProvisioned.c #support loaded saved/already provisioned data into internal stores for usage + DfciSettingPermission.h + PermissionStoreSupport.c + DfciSettingPermissionProvisionXml.c #Support reading a Permission Packet in XML format and applying to Permission Store + DfciSettingPermissionCurrentPermissionXml.c #Support conversion of current permissions to XML format and + GroupSupport.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + XmlTreeLib + XmlTreeQueryLib + DfciXmlPermissionSchemaSupportLib + PrintLib + BaseLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiLib + BaseMemoryLib + DfciDeviceIdSupportLib + DfciUiSupportLib + DfciV1SupportLib + DfciGroupLib + DxeServicesLib + PcdLib + +[Protocols] + gDfciApplyPermissionsProtocolGuid + gDfciAuthenticationProtocolGuid + +[Guids] + gDfciPermissionManagerVarNamespace + gDfciInternalVariableGuid + +[Pcd] + gDfciPkgTokenSpaceGuid.PcdUnsignedListFormatAllow + gDfciPkgTokenSpaceGuid.PcdUnsignedPermissionsFile + +[Depex] + TRUE diff --git a/DfciPkg/Library/DfciSettingPermissionLib/PermissionsPacket_Example.xml b/DfciPkg/Library/DfciSettingPermissionLib/PermissionsPacket_Example.xml index 275a1bb2b3..8188b17dbd 100644 --- a/DfciPkg/Library/DfciSettingPermissionLib/PermissionsPacket_Example.xml +++ b/DfciPkg/Library/DfciSettingPermissionLib/PermissionsPacket_Example.xml @@ -1,18 +1,18 @@ - - - UserName - 2015-10-26 - 1 - 1 - - - 100 - 0xFF - - - 300 - 0x81 - - - - + + + UserName + 2015-10-26 + 1 + 1 + + + 100 + 0xFF + + + 300 + 0x81 + + + + diff --git a/DfciPkg/Library/DfciUiSupportLibNull/DfciUiSupportLibNull.inf b/DfciPkg/Library/DfciUiSupportLibNull/DfciUiSupportLibNull.inf index 6ead7bbe1a..386fe8659d 100644 --- a/DfciPkg/Library/DfciUiSupportLibNull/DfciUiSupportLibNull.inf +++ b/DfciPkg/Library/DfciUiSupportLibNull/DfciUiSupportLibNull.inf @@ -1,48 +1,48 @@ -## @file -# DfciUiSupportLibNull.inf -# -# This library contains NULL routines to support UI operations associated with DFCI. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = DfciUiSupportLibNull - FILE_GUID = 59260ec4-b841-4c02-abb6-1b20ef7451eb - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = DfciUiSupportLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - DfciUiSupportLibNull.c - - -[Packages] - MdePkg/MdePkg.dec - DfciPkg/DfciPkg.dec - - -[LibraryClasses] - DebugLib - - -[Protocols] - - -[Guids] - - -## Required for drivers. -#[Depex] -# TRUE - +## @file +# DfciUiSupportLibNull.inf +# +# This library contains NULL routines to support UI operations associated with DFCI. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = DfciUiSupportLibNull + FILE_GUID = 59260ec4-b841-4c02-abb6-1b20ef7451eb + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = DfciUiSupportLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + DfciUiSupportLibNull.c + + +[Packages] + MdePkg/MdePkg.dec + DfciPkg/DfciPkg.dec + + +[LibraryClasses] + DebugLib + + +[Protocols] + + +[Guids] + + +## Required for drivers. +#[Depex] +# TRUE + diff --git a/DfciPkg/Library/DfciXmlDeviceIdSchemaSupportLib/DfciXmlDeviceIdSchemaSupportLib.inf b/DfciPkg/Library/DfciXmlDeviceIdSchemaSupportLib/DfciXmlDeviceIdSchemaSupportLib.inf index 8cc99fa9a1..c053056c21 100644 --- a/DfciPkg/Library/DfciXmlDeviceIdSchemaSupportLib/DfciXmlDeviceIdSchemaSupportLib.inf +++ b/DfciPkg/Library/DfciXmlDeviceIdSchemaSupportLib/DfciXmlDeviceIdSchemaSupportLib.inf @@ -1,40 +1,40 @@ -## @file -# DfciXmlDeviceIdSchemaSupportLib.inf -# -# This library supports the schema used for the UEFI Device Id XML content. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciXmlDeviceIdSchemaSupportLib - FILE_GUID = 34ab461a-837e-48c3-8f66-b89e88abd570 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DfciXmlDeviceIdSchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER -# CONSTRUCTOR = NONE -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciXmlDeviceIdSchemaSupportLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - XmlTreeLib - XmlTreeQueryLib - PrintLib - BaseLib - +## @file +# DfciXmlDeviceIdSchemaSupportLib.inf +# +# This library supports the schema used for the UEFI Device Id XML content. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciXmlDeviceIdSchemaSupportLib + FILE_GUID = 34ab461a-837e-48c3-8f66-b89e88abd570 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DfciXmlDeviceIdSchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER +# CONSTRUCTOR = NONE +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciXmlDeviceIdSchemaSupportLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + XmlTreeLib + XmlTreeQueryLib + PrintLib + BaseLib + diff --git a/DfciPkg/Library/DfciXmlIdentitySchemaSupportLib/DfciXmlIdentitySchemaSupportLib.inf b/DfciPkg/Library/DfciXmlIdentitySchemaSupportLib/DfciXmlIdentitySchemaSupportLib.inf index 53db0cbe0c..db23e3add3 100644 --- a/DfciPkg/Library/DfciXmlIdentitySchemaSupportLib/DfciXmlIdentitySchemaSupportLib.inf +++ b/DfciPkg/Library/DfciXmlIdentitySchemaSupportLib/DfciXmlIdentitySchemaSupportLib.inf @@ -1,40 +1,40 @@ -## @file -# DfciXmlIdentitySchemaSupportLib.inf -# -# This library supports the schema used for the UEFI Identity XML content. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciXmlIdentitySchemaSupportLib - FILE_GUID = f2c88f77-4f5e-4667-9dc2-bc1eedbc2a8f - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DfciXmlIdentitySchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER -# CONSTRUCTOR = NONE -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciXmlIdentitySchemaSupportLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - XmlTreeLib - XmlTreeQueryLib - PrintLib - BaseLib - +## @file +# DfciXmlIdentitySchemaSupportLib.inf +# +# This library supports the schema used for the UEFI Identity XML content. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciXmlIdentitySchemaSupportLib + FILE_GUID = f2c88f77-4f5e-4667-9dc2-bc1eedbc2a8f + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DfciXmlIdentitySchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER +# CONSTRUCTOR = NONE +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciXmlIdentitySchemaSupportLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + XmlTreeLib + XmlTreeQueryLib + PrintLib + BaseLib + diff --git a/DfciPkg/Library/DfciXmlPermissionSchemaSupportLib/DfciXmlPermissionSchemaSupportLib.inf b/DfciPkg/Library/DfciXmlPermissionSchemaSupportLib/DfciXmlPermissionSchemaSupportLib.inf index 17f96d57ed..5f61fde6a7 100644 --- a/DfciPkg/Library/DfciXmlPermissionSchemaSupportLib/DfciXmlPermissionSchemaSupportLib.inf +++ b/DfciPkg/Library/DfciXmlPermissionSchemaSupportLib/DfciXmlPermissionSchemaSupportLib.inf @@ -1,41 +1,41 @@ -## @file -# DfciXmlPermissionSchemaSupportLib.inf -# -# This library supports the schema used for the Permission Input XML files. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciXmlPermissionSchemaSupportLib - FILE_GUID = 82EF6134-3BF2-4CAF-BFC5-79CFAC5768C7 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DfciXmlPermissionSchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER -# CONSTRUCTOR = NONE -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciXmlPermissionSchemaSupport.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - XmlTreeLib - XmlTreeQueryLib - PrintLib - BaseLib - DfciV1SupportLib - +## @file +# DfciXmlPermissionSchemaSupportLib.inf +# +# This library supports the schema used for the Permission Input XML files. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciXmlPermissionSchemaSupportLib + FILE_GUID = 82EF6134-3BF2-4CAF-BFC5-79CFAC5768C7 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DfciXmlPermissionSchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER +# CONSTRUCTOR = NONE +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciXmlPermissionSchemaSupport.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + XmlTreeLib + XmlTreeQueryLib + PrintLib + BaseLib + DfciV1SupportLib + diff --git a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/AllSettings.xml b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/AllSettings.xml index 1fe6d376c0..fa2cd8717c 100644 --- a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/AllSettings.xml +++ b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/AllSettings.xml @@ -1,84 +1,84 @@ - - - - 1 - 2015-10-06 - - - 100 - Asset Tag - Holds a IT/Admin defined asset tag value - - - 200 - Secure Boot Keys - Controls the state of UEFI Secure Boot and which keys to use. Changing this can cause your system to fail to boot - - - 300 - Trusted Platform Module (TPM) - TPM device enabled or disabled - - - 301 - Docking Usb Port - Docking USB Port enabled or disabled - - - 302 - Front Camera - Front Camera enabled or disabled - - - 303 - Bluetooth - Bluetooth radio enabled or disabled - - - - - - - - - - + + + + 1 + 2015-10-06 + + + 100 + Asset Tag + Holds a IT/Admin defined asset tag value + + + 200 + Secure Boot Keys + Controls the state of UEFI Secure Boot and which keys to use. Changing this can cause your system to fail to boot + + + 300 + Trusted Platform Module (TPM) + TPM device enabled or disabled + + + 301 + Docking Usb Port + Docking USB Port enabled or disabled + + + 302 + Front Camera + Front Camera enabled or disabled + + + 303 + Bluetooth + Bluetooth radio enabled or disabled + + + + + + + + + + diff --git a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/DfciXmlSettingSchemaSupportLib.inf b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/DfciXmlSettingSchemaSupportLib.inf index 8569c094c9..1eac29b44c 100644 --- a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/DfciXmlSettingSchemaSupportLib.inf +++ b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/DfciXmlSettingSchemaSupportLib.inf @@ -1,41 +1,41 @@ -## @file -# DfciXmlSettingSchemaSupportLib.inf -# -# This library supports the schema used for the Settings Input and Result XML files. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciXmlSettingSchemaSupportV1Lib - FILE_GUID = D7B69EDA-E1A4-4333-A9DD-0EB4FD04F17A - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DfciXmlSettingSchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER -# CONSTRUCTOR = NONE -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciXmlSettingSchemaSupport.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - XmlTreeLib - XmlTreeQueryLib - PrintLib - BaseLib - DfciV1SupportLib - +## @file +# DfciXmlSettingSchemaSupportLib.inf +# +# This library supports the schema used for the Settings Input and Result XML files. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciXmlSettingSchemaSupportV1Lib + FILE_GUID = D7B69EDA-E1A4-4333-A9DD-0EB4FD04F17A + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DfciXmlSettingSchemaSupportLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER +# CONSTRUCTOR = NONE +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciXmlSettingSchemaSupport.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + XmlTreeLib + XmlTreeQueryLib + PrintLib + BaseLib + DfciV1SupportLib + diff --git a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/ResultsPacket_Example.xml b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/ResultsPacket_Example.xml index a9b717f9dd..a01cea9ffb 100644 --- a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/ResultsPacket_Example.xml +++ b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/ResultsPacket_Example.xml @@ -1,17 +1,17 @@ - - - %Date% - - - - 100 - 0x8000000000000001 - - - - 300 - 0x0000000000000001 - 0x0 - - + + + %Date% + + + + 100 + 0x8000000000000001 + + + + 300 + 0x0000000000000001 + 0x0 + + \ No newline at end of file diff --git a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/SettingsPacket_Example.xml b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/SettingsPacket_Example.xml index b89547388f..4b5d4f2d0e 100644 --- a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/SettingsPacket_Example.xml +++ b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/SettingsPacket_Example.xml @@ -1,30 +1,30 @@ - - - UserName - 2015-10-26 - 1 - 1 - - - - 100 - 7897897890 - - - - 200 - MsOnly - - - - 300 - Enabled - - - - 301 - Enabled - - - - + + + UserName + 2015-10-26 + 1 + 1 + + + + 100 + 7897897890 + + + + 200 + MsOnly + + + + 300 + Enabled + + + + 301 + Enabled + + + + diff --git a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/UefiSettings.xsd b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/UefiSettings.xsd index e5ed991f47..221c16d3b9 100644 --- a/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/UefiSettings.xsd +++ b/DfciPkg/Library/DfciXmlSettingSchemaSupportLib/UefiSettings.xsd @@ -1,134 +1,134 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DfciPkg/SettingsManager/SettingsManagerDxe.inf b/DfciPkg/SettingsManager/SettingsManagerDxe.inf index 23d96d9ffc..51e95dc5d4 100644 --- a/DfciPkg/SettingsManager/SettingsManagerDxe.inf +++ b/DfciPkg/SettingsManager/SettingsManagerDxe.inf @@ -1,77 +1,77 @@ -## @file -# SettingsManagerDxe.inf -# -# This is the Dfci Settings Manager - this application has all of the settings -# providers attached as NULL Libraries. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SettingsManagerDxe - FILE_GUID = 0CCF27CF-E68D-4279-96B0-8A4E1CDFF10C - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = Init - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SettingsManagerProvider.c - SettingsManager.c - SettingsManager.h - SettingsManagerTransportXml.c - SettingsManagerDxe.c - SettingsManagerCurrentSettingXml.c - SettingsManagerProvisionedData.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DfciPkg/DfciPkg.dec - MsCorePkg/MsCorePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - BaseLib - DfciSettingChangedNotificationLib - DfciXmlDeviceIdSchemaSupportLib - DfciXmlSettingSchemaSupportLib - DfciSettingPermissionLib - DfciV1SupportLib - PerformanceLib - XmlTreeLib - XmlTreeQueryLib - -[Guids] - gDfciStartOfBdsNotifyGuid - gDfciSettingsManagerVarNamespace - gDfciDeviceIdVarNamespace - gDfciInternalVariableGuid - gEfiEventReadyToBootGuid - -[Protocols] - gDfciApplySettingsProtocolGuid - gDfciSettingsProviderSupportProtocolGuid #produces - gDfciSettingAccessProtocolGuid #produces - gDfciSettingPermissionsProtocolGuid #produces - gDfciAuthenticationProtocolGuid #sometimes consumes - -[FeaturePcd] - gDfciPkgTokenSpaceGuid.PcdDfciEnabled - -[Pcd] - -[Depex] - gEfiVariableWriteArchProtocolGuid - AND gEfiVariableArchProtocolGuid - AND gEdkiiVariablePolicyProtocolGuid +## @file +# SettingsManagerDxe.inf +# +# This is the Dfci Settings Manager - this application has all of the settings +# providers attached as NULL Libraries. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SettingsManagerDxe + FILE_GUID = 0CCF27CF-E68D-4279-96B0-8A4E1CDFF10C + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = Init + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + SettingsManagerProvider.c + SettingsManager.c + SettingsManager.h + SettingsManagerTransportXml.c + SettingsManagerDxe.c + SettingsManagerCurrentSettingXml.c + SettingsManagerProvisionedData.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + DfciPkg/DfciPkg.dec + MsCorePkg/MsCorePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + BaseLib + DfciSettingChangedNotificationLib + DfciXmlDeviceIdSchemaSupportLib + DfciXmlSettingSchemaSupportLib + DfciSettingPermissionLib + DfciV1SupportLib + PerformanceLib + XmlTreeLib + XmlTreeQueryLib + +[Guids] + gDfciStartOfBdsNotifyGuid + gDfciSettingsManagerVarNamespace + gDfciDeviceIdVarNamespace + gDfciInternalVariableGuid + gEfiEventReadyToBootGuid + +[Protocols] + gDfciApplySettingsProtocolGuid + gDfciSettingsProviderSupportProtocolGuid #produces + gDfciSettingAccessProtocolGuid #produces + gDfciSettingPermissionsProtocolGuid #produces + gDfciAuthenticationProtocolGuid #sometimes consumes + +[FeaturePcd] + gDfciPkgTokenSpaceGuid.PcdDfciEnabled + +[Pcd] + +[Depex] + gEfiVariableWriteArchProtocolGuid + AND gEfiVariableArchProtocolGuid + AND gEdkiiVariablePolicyProtocolGuid diff --git a/DfciPkg/UnitTests/DeviceIdTest/readme.md b/DfciPkg/UnitTests/DeviceIdTest/readme.md index eb92ea9931..7d829e4806 100644 --- a/DfciPkg/UnitTests/DeviceIdTest/readme.md +++ b/DfciPkg/UnitTests/DeviceIdTest/readme.md @@ -1,25 +1,25 @@ -# Verify DfciDeviceIdLib library functionality - -The library DfciDeviceIdLib provided Dfci with platform information that Dfci needs. This include the manufacturer -name, product name, and serial number. Dfci has limit on the characters supported, and the length of the strings returned. - -Device Id Library rules: - -1. The following five characters are not allowed: `" ' < > &` -2. The maximum string length is 64 characters plus a terminating '\0' -3. '\0' is a required terminator. The interfaces return - the string and the size of the string (including the '\0'). -4. The string is a valid UTF-8 string (ie, no 8-bit ASCII) - -## About - -These tests verify that the DeviceIdLib Library functions properly. - -## DeviceIdIdTestApp - -This application consumes the DfciDeviceIdLib executed test cases for the verification of the Device Id Strings. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Verify DfciDeviceIdLib library functionality + +The library DfciDeviceIdLib provided Dfci with platform information that Dfci needs. This include the manufacturer +name, product name, and serial number. Dfci has limit on the characters supported, and the length of the strings returned. + +Device Id Library rules: + +1. The following five characters are not allowed: `" ' < > &` +2. The maximum string length is 64 characters plus a terminating '\0' +3. '\0' is a required terminator. The interfaces return + the string and the size of the string (including the '\0'). +4. The string is a valid UTF-8 string (ie, no 8-bit ASCII) + +## About + +These tests verify that the DeviceIdLib Library functions properly. + +## DeviceIdIdTestApp + +This application consumes the DfciDeviceIdLib executed test cases for the verification of the Device Id Strings. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/DfciPkg/UnitTests/DfciTests/Certs/MakeChainingCerts.bat b/DfciPkg/UnitTests/DfciTests/Certs/MakeChainingCerts.bat index b1003d73ea..511c507981 100644 --- a/DfciPkg/UnitTests/DfciTests/Certs/MakeChainingCerts.bat +++ b/DfciPkg/UnitTests/DfciTests/Certs/MakeChainingCerts.bat @@ -1,70 +1,70 @@ -@echo off -rem @file -rem -rem Script to create the full test certificate set for DFCI testing. -rem -rem Copyright (c), Microsoft Corporation -rem SPDX-License-Identifier: BSD-2-Clause-Patent -rem - -pushd . -cd %~dp0 - -REM Creating Certs requires the Win10 WDK. If you don't have the MakeCert tool you can try the 8.1 kit (just change the KIT=10 to KIT=8.1, and VER=bin) - -set KIT=10 -set VER=bin\10.0.17763.0 - -rem Certs for ZTD - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 120 -a sha256 -sv ZTD_Root.pvk -pe -ss my -n "CN=ZTD_Root, O=Palindrome, C=US" ZTD_Root.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk ZTD_Root.pvk -spc ZTD_Root.cer -pfx ZTD_Root.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 61 -a sha256 -ic ZTD_Root.cer -iv ZTD_Root.pvk -sv ZTD_CA.pvk -pe -ss my -n "CN=ZTD_CA, O=Palindrome, C=US" ZTD_CA.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk ZTD_CA.pvk -spc ZTD_CA.cer -pfx ZTD_CA.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 4096 -m 60 -a sha256 -ic ZTD_CA.cer -iv ZTD_CA.pvk -sv ZTD_Leaf.pvk -pe -ss my -sky exchange -n "CN=ZTD_Leaf, O=Palindrome, C=US" ZTD_Leaf.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk ZTD_Leaf.pvk -spc ZTD_Leaf.cer -pfx ZTD_Leaf.pfx - -rem Certs for DDS - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 120 -a sha256 -sv DDS_Root.pvk -pe -ss my -n "CN=DDS.OnMicrosoft.com Device Guard Root, O=OnMicrosoft.com, C=US" DDS_Root.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_Root.pvk -spc DDS_Root.cer -pfx DDS_Root.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 61 -a sha256 -ic DDS_Root.cer -iv DDS_Root.pvk -sv DDS_CA.pvk -pe -ss my -n "CN=DDS.OnMicrosoft.com CA, O=OnMicrosoft.com, C=US" DDS_CA.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_CA.pvk -spc DDS_CA.cer -pfx DDS_CA.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic DDS_CA.cer -iv DDS_CA.pvk -sv DDS_Leaf.pvk -pe -ss my -n "CN=DDS.OnMicrosoft.com, O=OnMicrosoft.com, C=US" DDS_Leaf.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_Leaf.pvk -spc DDS_Leaf.cer -pfx DDS_Leaf.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 61 -a sha256 -ic DDS_Root.cer -iv DDS_Root.pvk -sv DDS_CA2.pvk -pe -ss my -n "CN=DDS2.OnMicrosoft.com CA, O=OnMicrosoft.com, C=US" DDS_CA2.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_CA2.pvk -spc DDS_CA2.cer -pfx DDS_CA2.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic DDS_CA2.cer -iv DDS_CA2.pvk -sv DDS_Leaf2.pvk -pe -ss my -n "CN=DDS2.OnMicrosoft.com, O=OnMicrosoft.com, C=US" DDS_Leaf2.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_Leaf2.pvk -spc DDS_Leaf2.cer -pfx DDS_Leaf2.pfx - -rem Certs for MDM - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 120 -a sha256 -sv MDM_Root.pvk -pe -ss my -n "CN=Sample_MDM_Root, O=Corportaion, C=US" MDM_Root.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_Root.pvk -spc MDM_Root.cer -pfx MDM_Root.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 2048 -m 61 -a sha256 -ic MDM_Root.cer -iv MDM_Root.pvk -sv MDM_CA.pvk -pe -ss my -n "CN=Sample_MDM_CA, O=Corportaion, C=US" MDM_CA.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_CA.pvk -spc MDM_CA.cer -pfx MDM_CA.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic MDM_CA.cer -iv MDM_CA.pvk -sv MDM_Leaf.pvk -pe -ss my -n "CN=Sample_MDM_Leaf, O=Corportaion, C=US" MDM_Leaf.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_Leaf.pvk -spc MDM_Leaf.cer -pfx MDM_Leaf.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 2048 -m 61 -a sha256 -ic MDM_Root.cer -iv MDM_Root.pvk -sv MDM_CA2.pvk -pe -ss my -n "CN=Sample_MDM_CA2, O=Corporation, C=US" MDM_CA2.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_CA2.pvk -spc MDM_CA2.cer -pfx MDM_CA2.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic MDM_CA2.cer -iv MDM_CA2.pvk -sv MDM_Leaf2.pvk -pe -ss my -n "CN=Sample_MDM_Leaf2, O=Corporation, C=US" MDM_Leaf2.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_Leaf2.pvk -spc MDM_Leaf2.cer -pfx MDM_Leaf2.pfx - -rem Cert for HTTPS - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -eku 1.3.6.1.5.5.7.3.1 /n "CN=mikeytbds3.eastus.cloudapp.azure.com, O=Dfci Testing, C=US" /r /h 0 -sky signature /sv DFCI_HTTPS.pvk DFCI_HTTPS.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" /pvk DFCI_HTTPS.pvk /spc DFCI_HTTPS.cer /pfx DFCI_HTTPS.pfx - -:end - popd - +@echo off +rem @file +rem +rem Script to create the full test certificate set for DFCI testing. +rem +rem Copyright (c), Microsoft Corporation +rem SPDX-License-Identifier: BSD-2-Clause-Patent +rem + +pushd . +cd %~dp0 + +REM Creating Certs requires the Win10 WDK. If you don't have the MakeCert tool you can try the 8.1 kit (just change the KIT=10 to KIT=8.1, and VER=bin) + +set KIT=10 +set VER=bin\10.0.17763.0 + +rem Certs for ZTD + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 120 -a sha256 -sv ZTD_Root.pvk -pe -ss my -n "CN=ZTD_Root, O=Palindrome, C=US" ZTD_Root.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk ZTD_Root.pvk -spc ZTD_Root.cer -pfx ZTD_Root.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 61 -a sha256 -ic ZTD_Root.cer -iv ZTD_Root.pvk -sv ZTD_CA.pvk -pe -ss my -n "CN=ZTD_CA, O=Palindrome, C=US" ZTD_CA.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk ZTD_CA.pvk -spc ZTD_CA.cer -pfx ZTD_CA.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 4096 -m 60 -a sha256 -ic ZTD_CA.cer -iv ZTD_CA.pvk -sv ZTD_Leaf.pvk -pe -ss my -sky exchange -n "CN=ZTD_Leaf, O=Palindrome, C=US" ZTD_Leaf.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk ZTD_Leaf.pvk -spc ZTD_Leaf.cer -pfx ZTD_Leaf.pfx + +rem Certs for DDS + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 120 -a sha256 -sv DDS_Root.pvk -pe -ss my -n "CN=DDS.OnMicrosoft.com Device Guard Root, O=OnMicrosoft.com, C=US" DDS_Root.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_Root.pvk -spc DDS_Root.cer -pfx DDS_Root.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 61 -a sha256 -ic DDS_Root.cer -iv DDS_Root.pvk -sv DDS_CA.pvk -pe -ss my -n "CN=DDS.OnMicrosoft.com CA, O=OnMicrosoft.com, C=US" DDS_CA.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_CA.pvk -spc DDS_CA.cer -pfx DDS_CA.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic DDS_CA.cer -iv DDS_CA.pvk -sv DDS_Leaf.pvk -pe -ss my -n "CN=DDS.OnMicrosoft.com, O=OnMicrosoft.com, C=US" DDS_Leaf.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_Leaf.pvk -spc DDS_Leaf.cer -pfx DDS_Leaf.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 61 -a sha256 -ic DDS_Root.cer -iv DDS_Root.pvk -sv DDS_CA2.pvk -pe -ss my -n "CN=DDS2.OnMicrosoft.com CA, O=OnMicrosoft.com, C=US" DDS_CA2.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_CA2.pvk -spc DDS_CA2.cer -pfx DDS_CA2.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic DDS_CA2.cer -iv DDS_CA2.pvk -sv DDS_Leaf2.pvk -pe -ss my -n "CN=DDS2.OnMicrosoft.com, O=OnMicrosoft.com, C=US" DDS_Leaf2.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk DDS_Leaf2.pvk -spc DDS_Leaf2.cer -pfx DDS_Leaf2.pfx + +rem Certs for MDM + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 120 -a sha256 -sv MDM_Root.pvk -pe -ss my -n "CN=Sample_MDM_Root, O=Corportaion, C=US" MDM_Root.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_Root.pvk -spc MDM_Root.cer -pfx MDM_Root.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 2048 -m 61 -a sha256 -ic MDM_Root.cer -iv MDM_Root.pvk -sv MDM_CA.pvk -pe -ss my -n "CN=Sample_MDM_CA, O=Corportaion, C=US" MDM_CA.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_CA.pvk -spc MDM_CA.cer -pfx MDM_CA.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic MDM_CA.cer -iv MDM_CA.pvk -sv MDM_Leaf.pvk -pe -ss my -n "CN=Sample_MDM_Leaf, O=Corportaion, C=US" MDM_Leaf.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_Leaf.pvk -spc MDM_Leaf.cer -pfx MDM_Leaf.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 2048 -m 61 -a sha256 -ic MDM_Root.cer -iv MDM_Root.pvk -sv MDM_CA2.pvk -pe -ss my -n "CN=Sample_MDM_CA2, O=Corporation, C=US" MDM_CA2.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_CA2.pvk -spc MDM_CA2.cer -pfx MDM_CA2.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 2048 -m 60 -a sha256 -ic MDM_CA2.cer -iv MDM_CA2.pvk -sv MDM_Leaf2.pvk -pe -ss my -n "CN=Sample_MDM_Leaf2, O=Corporation, C=US" MDM_Leaf2.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk MDM_Leaf2.pvk -spc MDM_Leaf2.cer -pfx MDM_Leaf2.pfx + +rem Cert for HTTPS + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -eku 1.3.6.1.5.5.7.3.1 /n "CN=mikeytbds3.eastus.cloudapp.azure.com, O=Dfci Testing, C=US" /r /h 0 -sky signature /sv DFCI_HTTPS.pvk DFCI_HTTPS.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" /pvk DFCI_HTTPS.pvk /spc DFCI_HTTPS.cer /pfx DFCI_HTTPS.pfx + +:end + popd + diff --git a/DfciPkg/UnitTests/DfciTests/DeviceUnderTest/PyRobotServer.xml b/DfciPkg/UnitTests/DfciTests/DeviceUnderTest/PyRobotServer.xml index 2649c527d3..edd6b4928f 100644 Binary files a/DfciPkg/UnitTests/DfciTests/DeviceUnderTest/PyRobotServer.xml and b/DfciPkg/UnitTests/DfciTests/DeviceUnderTest/PyRobotServer.xml differ diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/CertSupportLib.py b/DfciPkg/UnitTests/DfciTests/Support/Python/CertSupportLib.py index 43c174e0f3..70307a55b2 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/CertSupportLib.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/CertSupportLib.py @@ -1,80 +1,80 @@ -# @file -# -# Cert Supoport functions -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -## -## Obtain the SHA1 value from a .pfx file -## - -import os, sys -import traceback -import argparse -import base64 -import datetime -import logging -import shutil -import threading -import subprocess -import tempfile - -from DFCI_SupportLib import DFCI_SupportLib -from edk2toollib.utility_functions import RunCmd - -CertMgrPath = None - -class CertSupportLib(object): - - def get_thumbprint_from_pfx(self, pfxfilename=None): - global CertMgrPath - - if pfxfilename == None: - raise Exception ("Pfx File Name is required") - fp = tempfile.NamedTemporaryFile (delete=False); - - tfile = fp.name - fp.close() - - try: - # - # Cert Manager is used for deleting the cert when add/removing certs - # - - #1 - use Certmgr to get the PFX sha1 thumbprint - if CertMgrPath is None: - CertMgrPath = DFCI_SupportLib().get_certmgr_path() - - parameters = " /c " + pfxfilename - ret = RunCmd (CertMgrPath, parameters, outfile=tfile) - if(ret != 0): - logging.critical("Failed to get cert info from Pfx file using CertMgr.exe") - return ret - f = open(tfile, "r") - - pfxdetails = f.readlines() - f.close() - os.remove(tfile) - #2 Parse the pfxdetails for the sha1 thumbprint - thumbprint = "" - found = False - for a in pfxdetails: - a = a.strip() - if(len(a)): - if(found): - thumbprint = ''.join(a.split()) - break - else: - if(a == "SHA1 Thumbprint::"): - found = True - - if(len(thumbprint) != 40) or (found == False): - return 'No thumbprint' - - except Exception as exp: - traceback.print_exc() - return "Unable to read certificate" - - return thumbprint +# @file +# +# Cert Supoport functions +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +## +## Obtain the SHA1 value from a .pfx file +## + +import os, sys +import traceback +import argparse +import base64 +import datetime +import logging +import shutil +import threading +import subprocess +import tempfile + +from DFCI_SupportLib import DFCI_SupportLib +from edk2toollib.utility_functions import RunCmd + +CertMgrPath = None + +class CertSupportLib(object): + + def get_thumbprint_from_pfx(self, pfxfilename=None): + global CertMgrPath + + if pfxfilename == None: + raise Exception ("Pfx File Name is required") + fp = tempfile.NamedTemporaryFile (delete=False); + + tfile = fp.name + fp.close() + + try: + # + # Cert Manager is used for deleting the cert when add/removing certs + # + + #1 - use Certmgr to get the PFX sha1 thumbprint + if CertMgrPath is None: + CertMgrPath = DFCI_SupportLib().get_certmgr_path() + + parameters = " /c " + pfxfilename + ret = RunCmd (CertMgrPath, parameters, outfile=tfile) + if(ret != 0): + logging.critical("Failed to get cert info from Pfx file using CertMgr.exe") + return ret + f = open(tfile, "r") + + pfxdetails = f.readlines() + f.close() + os.remove(tfile) + #2 Parse the pfxdetails for the sha1 thumbprint + thumbprint = "" + found = False + for a in pfxdetails: + a = a.strip() + if(len(a)): + if(found): + thumbprint = ''.join(a.split()) + break + else: + if(a == "SHA1 Thumbprint::"): + found = True + + if(len(thumbprint) != 40) or (found == False): + return 'No thumbprint' + + except Exception as exp: + traceback.print_exc() + return "Unable to read certificate" + + return thumbprint diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/DFCI_SupportLib.py b/DfciPkg/UnitTests/DfciTests/Support/Python/DFCI_SupportLib.py index ced6922cb1..ef45659829 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/DFCI_SupportLib.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/DFCI_SupportLib.py @@ -1,685 +1,685 @@ -# @file -# -# DFCI_SupportLib- DFCI basic functions -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -# -# DFCI_SupportLib -# -import os, sys -import xml.etree.ElementTree as ET -import binascii -import traceback -import xml.dom.minidom -import subprocess - -try: - from StringIO import StringIO -except ImportError: - from io import StringIO, BytesIO - -from builtins import int - -from edk2toollib.uefi.status_codes import UefiStatusCode -from edk2toollib.windows.locate_tools import FindToolInWinSdk - -from Data.CertProvisioningVariable import CertProvisioningApplyVariable -from Data.CertProvisioningVariable import CertProvisioningResultVariable -from Data.PermissionPacketVariable import PermissionApplyVariable -from Data.PermissionPacketVariable import PermissionResultVariable -from Data.SecureSettingVariable import SecureSettingsApplyVariable -from Data.SecureSettingVariable import SecureSettingsResultVariable - -SignToolPath = None -CertMgrPath = None - -class DFCI_SupportLib(object): - - def _ReturnSessionIdValue(self, InputString): - #Session Id: 0xF08A4 - return int(InputString.partition(":")[2].strip(), base=0) - - - def compare_session_id_match(self, resultfile, applyfile): - resultsid = 0 - applysid = 1 - - r = open(resultfile, "r") - for l in r.readlines(): - if("SessionId:" in l): - resultsid = self._ReturnSessionIdValue(l) - break - r.close() - - a = open(applyfile, "r") - for l in a.readlines(): - if("SessionId:" in l): - applysid = self._ReturnSessionIdValue(l) - break - a.close() - - print ("Apply Session Id: 0x%x" % applysid) - print ("Result Session Id: 0x%x" % resultsid) - return resultsid == applysid - - - def check_status(self, resultfile, code): - t = -1 - a = open(resultfile, "r") - for l in a.readlines(): - if("Status:" in l): - b = l.partition(":")[2] - b = b.partition("(")[2] - b = b.strip() - b = b.rstrip(')') - t = int(b, base=0) - break - a.close() - print ("Result Status: %s" % l) - return t == int(code, base=0) - - - def check_setting_status(self, resultfile, id, statuscode): - t = -1 - xmlstring = "" - found = False - a = open(resultfile, "r") - - #find the start of the xml string and then copy all lines to xmlstring variable - for l in a.readlines(): - if(found): - xmlstring += l - else: - if l.lstrip().startswith(" Version") - - if ((self.MfgOffset >= self.ProductOffset) or - (self.ProductOffset >= self.SerialOffset) or - (self.SerialOffset >= self.TrustedCertOffset)): - raise Exception("Invalid Offset Structure") - - Temp = fs.tell() - if Temp != self.MfgOffset: - raise Exception("Invalid Mfg Offset") - self.Manufacturer = fs.read(self.ProductOffset - self.MfgOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in Mfg") - - Temp = fs.tell() - if Temp != self.ProductOffset: - raise Exception("Invalid Product Offset") - self.ProductName = fs.read(self.SerialOffset - self.ProductOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in ProductName") - - Temp = fs.tell() - if Temp != self.SerialOffset: - raise Exception("Invalid SerialOffset Offset") - self.SerialNumber = fs.read(self.TrustedCertOffset - self.SerialOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in SerialNumber") - - if self.TrustedCertSize != 0: - Temp = fs.tell() - if Temp != self.TrustedCertOffset: - raise Exception("Invalid TrustedCertOffset Offset") - else: - raise Exception("Invalid header version") - - if((end - fs.tell()) < self.TrustedCertSize): - raise Exception("Invalid file stream size (Trusted Cert Size)") - - if(self.TrustedCertSize > 0): - self.TrustedCert = memoryview(fs.read(self.TrustedCertSize)) - - if((end - fs.tell()) > 0): - if(self.TrustedCertSize > 0): - self.TestSignature = WinCert.Factory(fs) - - if((end - fs.tell()) > 0): - self.Signature = WinCert.Factory(fs) - - # - # Method to Print CertProvisioningApplyVariable to stdout - # - def Print(self): - print ("CertProvisioningVariable") - print (" HeaderSignature: %s" % self.HeaderSignature) - print (" HeaderVersion: 0x%X" % self.HeaderVersion) - print (" Identity: 0x%X (%s)" % (self.Identity, self.IDENTITY_MAP[self.Identity])) - print (" SessionId: 0x%X" % self.SessionId) - if (self.HeaderVersion == self.VERSION_V1): - print (" SN Target: %d" % self.SNTarget) - elif (self.HeaderVersion == self.VERSION_V2): - print (" Version: %s" % self.Version) - print (" Lsv: %s" % self.Lsv) - print (" Manufacturer: %s" % self.Manufacturer) - print (" Product Name: %s" % self.ProductName) - print (" SerialNumber: %s" % self.SerialNumber) - else: - raise Exception("Invalid header version") - - print (" TrustedCertSize: 0x%X" % self.TrustedCertSize) - print (" TrustedCert: ") - if(self.TrustedCert != None): - ndbl = self.TrustedCert.tolist() - PrintByteList(ndbl) - - if(self.TrustedCertSize > 0) and (self.TestSignature != None): - print (" TestSignature: ") - self.TestSignature.Print() - - if(self.Signature != None): - print (" Signature: ") - self.Signature.Print() - - - def Write(self, fs): - fs.write(self.HeaderSignature.encode('utf-8')) - fs.write(struct.pack("=B", self.HeaderVersion)) - fs.write(struct.pack("=B", self.Identity)) - if (self.HeaderVersion == self.VERSION_V1): - fs.write(struct.pack("=Q", self.SNTarget)) - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=H", self.TrustedCertSize)) - elif (self.HeaderVersion == self.VERSION_V2): - fs.write(struct.pack("=B", 0)) - fs.write(struct.pack("=B", 0)) - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=H", self.MfgOffset)) - self.ProductOffset = self.MfgOffset + len(self.Manufacturer) + 1 - self.SerialOffset = self.ProductOffset + len(self.ProductName) + 1 - self.TrustedCertOffset = self.SerialOffset + len(self.SerialNumber) + 1 - fs.write(struct.pack("=H", self.ProductOffset)) - fs.write(struct.pack("=H", self.SerialOffset)) - fs.write(struct.pack("=H", self.TrustedCertSize)) - fs.write(struct.pack("=H", self.TrustedCertOffset)) - fs.write(struct.pack("=H", 0)) # Alignment UINT16 - fs.write(struct.pack("=I", self.Version)) - fs.write(struct.pack("=I", self.Lsv)) - fs.write(self.Manufacturer.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - fs.write(self.ProductName.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - fs.write(self.SerialNumber.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - - else: - raise Exception("Invalid header version") - - if(self.TrustedCertSize != 0): - fs.write(self.TrustedCert) - if(self.TestSignature != None): - self.TestSignature.Write(fs) - if(self.Signature != None): - self.Signature.Write(fs) - - - def VerifyComplete(self): - if(self.TrustedCertSize > 0): - if(not self.TestSignature): - return False - if(not self.Signature): - return False - - return True - - def GetCertType(self): - return self.IDENTITY_MAP[self.Identity] - - def WriteCert(self, fs): - if(self.TrustedCertSize != 0): - fs.write(self.TrustedCert) - -## -## SEM Cert Provision Result Variable Data -## -class CertProvisioningResultVariable(object): - STATIC_STRUCT_SIZE=18 - HEADER_SIG_VALUE = "MSPR" - VERSION = 1 - - def __init__(self, filestream=None): - if(filestream == None): - self.HeaderSignature = self.HEADER_SIG_VALUE - self.HeaderVersion = self.VERSION - self.Status = 0 - self.Identity = 0 - self.SessionId = 0 - else: - self.PopulateFromFileStream(filestream) - # - # Method to un-serialize from a filestream - # - def PopulateFromFileStream(self, fs): - if(fs == None): - raise Exception("Invalid File stream") - - #only populate from file stream those parts that are complete in the file stream - offset = fs.tell() - fs.seek(0,2) - end = fs.tell() - fs.seek(offset) - - if((end - offset) < self.STATIC_STRUCT_SIZE): #size of the static header data - raise Exception("Invalid file stream size") - - self.HeaderSignature = fs.read(4).decode() - if self.HeaderSignature != self.HEADER_SIG_VALUE: - raise Exception("Incorrect Header Signature") - self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] - if (self.HeaderVersion != self.VERSION): - raise Exception("Incorrect Header Version") - self.Identity = struct.unpack("=B", fs.read(1))[0] - self.SessionId = struct.unpack("=I", fs.read(4))[0] - self.Status = struct.unpack("=Q", fs.read(8))[0] - - # - # Method to Print SEM var to stdout - # - def Print(self): - print ("CertProvisioningResultVariable") - print (" HeaderSignature: %s" % self.HeaderSignature) - print (" HeaderVersion: 0x%X" % self.HeaderVersion) - print (" Identity: 0x%X (%s)" % (self.Identity, CertProvisioningApplyVariable.IDENTITY_MAP[self.Identity])) - print (" SessionId: 0x%X" % self.SessionId) - print (" Status: %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status)) - - - def Write(self, fs): - fs.write(self.HeaderSignature.encode('utf-8')) - fs.write(struct.pack("=B", self.HeaderVersion)) - fs.write(struct.pack("=B", self.Identity)) - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=Q", self.Status)) - +# @file +# +# Script to support the binary structure of a provisioning variable. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +## +## Data Structure support for Cert Provisioning Variable +## +## + +import sys +import struct +from edk2toollib.uefi.wincert import * +from edk2toollib.uefi.status_codes import UefiStatusCode +from edk2toollib.utility_functions import PrintByteList + +## +## SEM Cert Provisioning Apply Variable Data +## +class CertProvisioningApplyVariable(object): + STATIC_STRUCT_SIZE_V1=20 + STATIC_STRUCT_SIZE_V2=32 + HEADER_SIG_VALUE = "MSPA" + VERSION_V1 = 1 + VERSION_V2 = 2 + IDENTITY_MAP = ["NONE", "OWNER CERT", "USER CERT", "USER1 CERT", "USER2 CERT", "ZTC CERT"] + + def __init__(self, filestream=None, HdrVersion=1): + if (HdrVersion != self.VERSION_V1 and + HdrVersion != self.VERSION_V2): + raise Exception("Invalid version specified") + + self.TestSignature = None + self.Signature = None + self.TrustedCertSize = 0 + self.TrustedCert = None + self.HeaderSignature = self.HEADER_SIG_VALUE + self.HeaderVersion = HdrVersion + self.Identity = 0 + self.SessionId = 0 + + # V1 unique members + self.SNTarget = 0 + + # V2 unique members + self.Version = 0 + self.Lsv = 0 + self.Manufacturer = None + self.ProductName = None + self.SerialNumber = None + self.MfgOffset = self.STATIC_STRUCT_SIZE_V2 + self.ProductOffset = 0 + self.SerialOffset = 0 + self.TrustedCertOffset = 0 + + if(filestream != None): + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < self.STATIC_STRUCT_SIZE_V1): #size of the static header data + raise Exception("Invalid file stream size") + + self.HeaderSignature = fs.read(4).decode() + if self.HeaderSignature != self.HEADER_SIG_VALUE: + raise Exception("Incorrect Header Signature") + self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] + + if (self.HeaderVersion == self.VERSION_V1): + self.Identity = struct.unpack("=B", fs.read(1))[0] + self.SNTarget = struct.unpack("=Q", fs.read(8))[0] + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.TrustedCertSize = struct.unpack("=H", fs.read(2))[0] + self.TrustedCert = None + elif (self.HeaderVersion == self.VERSION_V2): + self.Identity = struct.unpack("=B", fs.read(1))[0] + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid Reserved Field 1") + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid Reserved Field 2") + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.MfgOffset = struct.unpack("=H", fs.read(2))[0] + self.ProductOffset = struct.unpack("=H", fs.read(2))[0] + self.SerialOffset = struct.unpack("=H", fs.read(2))[0] + self.TrustedCertSize = struct.unpack("=H", fs.read(2))[0] + self.TrustedCertOffset = struct.unpack("=H", fs.read(2))[0] + self.TrustedCert = None + + Temp = struct.unpack("=H", fs.read(2))[0] + if Temp != 0: + raise Exception("Invalid Reserved Field 1") + self.Version = struct.unpack("=I", fs.read(4))[0] + self.Lsv = struct.unpack("=I", fs.read(4))[0] + + if self.Version < self.Lsv: + raise Exception("Invalid Lsv - must not be > Version") + + if ((self.MfgOffset >= self.ProductOffset) or + (self.ProductOffset >= self.SerialOffset) or + (self.SerialOffset >= self.TrustedCertOffset)): + raise Exception("Invalid Offset Structure") + + Temp = fs.tell() + if Temp != self.MfgOffset: + raise Exception("Invalid Mfg Offset") + self.Manufacturer = fs.read(self.ProductOffset - self.MfgOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in Mfg") + + Temp = fs.tell() + if Temp != self.ProductOffset: + raise Exception("Invalid Product Offset") + self.ProductName = fs.read(self.SerialOffset - self.ProductOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in ProductName") + + Temp = fs.tell() + if Temp != self.SerialOffset: + raise Exception("Invalid SerialOffset Offset") + self.SerialNumber = fs.read(self.TrustedCertOffset - self.SerialOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in SerialNumber") + + if self.TrustedCertSize != 0: + Temp = fs.tell() + if Temp != self.TrustedCertOffset: + raise Exception("Invalid TrustedCertOffset Offset") + else: + raise Exception("Invalid header version") + + if((end - fs.tell()) < self.TrustedCertSize): + raise Exception("Invalid file stream size (Trusted Cert Size)") + + if(self.TrustedCertSize > 0): + self.TrustedCert = memoryview(fs.read(self.TrustedCertSize)) + + if((end - fs.tell()) > 0): + if(self.TrustedCertSize > 0): + self.TestSignature = WinCert.Factory(fs) + + if((end - fs.tell()) > 0): + self.Signature = WinCert.Factory(fs) + + # + # Method to Print CertProvisioningApplyVariable to stdout + # + def Print(self): + print ("CertProvisioningVariable") + print (" HeaderSignature: %s" % self.HeaderSignature) + print (" HeaderVersion: 0x%X" % self.HeaderVersion) + print (" Identity: 0x%X (%s)" % (self.Identity, self.IDENTITY_MAP[self.Identity])) + print (" SessionId: 0x%X" % self.SessionId) + if (self.HeaderVersion == self.VERSION_V1): + print (" SN Target: %d" % self.SNTarget) + elif (self.HeaderVersion == self.VERSION_V2): + print (" Version: %s" % self.Version) + print (" Lsv: %s" % self.Lsv) + print (" Manufacturer: %s" % self.Manufacturer) + print (" Product Name: %s" % self.ProductName) + print (" SerialNumber: %s" % self.SerialNumber) + else: + raise Exception("Invalid header version") + + print (" TrustedCertSize: 0x%X" % self.TrustedCertSize) + print (" TrustedCert: ") + if(self.TrustedCert != None): + ndbl = self.TrustedCert.tolist() + PrintByteList(ndbl) + + if(self.TrustedCertSize > 0) and (self.TestSignature != None): + print (" TestSignature: ") + self.TestSignature.Print() + + if(self.Signature != None): + print (" Signature: ") + self.Signature.Print() + + + def Write(self, fs): + fs.write(self.HeaderSignature.encode('utf-8')) + fs.write(struct.pack("=B", self.HeaderVersion)) + fs.write(struct.pack("=B", self.Identity)) + if (self.HeaderVersion == self.VERSION_V1): + fs.write(struct.pack("=Q", self.SNTarget)) + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=H", self.TrustedCertSize)) + elif (self.HeaderVersion == self.VERSION_V2): + fs.write(struct.pack("=B", 0)) + fs.write(struct.pack("=B", 0)) + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=H", self.MfgOffset)) + self.ProductOffset = self.MfgOffset + len(self.Manufacturer) + 1 + self.SerialOffset = self.ProductOffset + len(self.ProductName) + 1 + self.TrustedCertOffset = self.SerialOffset + len(self.SerialNumber) + 1 + fs.write(struct.pack("=H", self.ProductOffset)) + fs.write(struct.pack("=H", self.SerialOffset)) + fs.write(struct.pack("=H", self.TrustedCertSize)) + fs.write(struct.pack("=H", self.TrustedCertOffset)) + fs.write(struct.pack("=H", 0)) # Alignment UINT16 + fs.write(struct.pack("=I", self.Version)) + fs.write(struct.pack("=I", self.Lsv)) + fs.write(self.Manufacturer.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + fs.write(self.ProductName.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + fs.write(self.SerialNumber.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + + else: + raise Exception("Invalid header version") + + if(self.TrustedCertSize != 0): + fs.write(self.TrustedCert) + if(self.TestSignature != None): + self.TestSignature.Write(fs) + if(self.Signature != None): + self.Signature.Write(fs) + + + def VerifyComplete(self): + if(self.TrustedCertSize > 0): + if(not self.TestSignature): + return False + if(not self.Signature): + return False + + return True + + def GetCertType(self): + return self.IDENTITY_MAP[self.Identity] + + def WriteCert(self, fs): + if(self.TrustedCertSize != 0): + fs.write(self.TrustedCert) + +## +## SEM Cert Provision Result Variable Data +## +class CertProvisioningResultVariable(object): + STATIC_STRUCT_SIZE=18 + HEADER_SIG_VALUE = "MSPR" + VERSION = 1 + + def __init__(self, filestream=None): + if(filestream == None): + self.HeaderSignature = self.HEADER_SIG_VALUE + self.HeaderVersion = self.VERSION + self.Status = 0 + self.Identity = 0 + self.SessionId = 0 + else: + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < self.STATIC_STRUCT_SIZE): #size of the static header data + raise Exception("Invalid file stream size") + + self.HeaderSignature = fs.read(4).decode() + if self.HeaderSignature != self.HEADER_SIG_VALUE: + raise Exception("Incorrect Header Signature") + self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] + if (self.HeaderVersion != self.VERSION): + raise Exception("Incorrect Header Version") + self.Identity = struct.unpack("=B", fs.read(1))[0] + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.Status = struct.unpack("=Q", fs.read(8))[0] + + # + # Method to Print SEM var to stdout + # + def Print(self): + print ("CertProvisioningResultVariable") + print (" HeaderSignature: %s" % self.HeaderSignature) + print (" HeaderVersion: 0x%X" % self.HeaderVersion) + print (" Identity: 0x%X (%s)" % (self.Identity, CertProvisioningApplyVariable.IDENTITY_MAP[self.Identity])) + print (" SessionId: 0x%X" % self.SessionId) + print (" Status: %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status)) + + + def Write(self, fs): + fs.write(self.HeaderSignature.encode('utf-8')) + fs.write(struct.pack("=B", self.HeaderVersion)) + fs.write(struct.pack("=B", self.Identity)) + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=Q", self.Status)) + diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/Data/PermissionPacketVariable.py b/DfciPkg/UnitTests/DfciTests/Support/Python/Data/PermissionPacketVariable.py index c86d92b03c..b113908e70 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/Data/PermissionPacketVariable.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/Data/PermissionPacketVariable.py @@ -1,333 +1,333 @@ -# @file -# -# Script to support the binary format of a Permission variable -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -## -## Data Structure support for Permission Packet Provisioning Variable -## -## - -import struct -import xml.dom.minidom -from edk2toollib.uefi.wincert import WinCert -from edk2toollib.uefi.status_codes import UefiStatusCode -from edk2toollib.utility_functions import PrintByteList - - -## -## SEM Permission Apply Variable Data -## -class PermissionApplyVariable(object): - STATIC_STRUCT_SIZE_V1=22 - STATIC_STRUCT_SIZE_V2=22 - HEADER_SIG_VALUE = "MPPA" - VERSION_V1 = 1 - VERSION_V2 = 2 - - def __init__(self, filestream=None, HdrVersion=1): - if (HdrVersion != self.VERSION_V1 and - HdrVersion != self.VERSION_V2): - raise Exception("Invalid version specified") - - # Common members - self.HeaderSignature = None - self.HeaderVersion = 0 - self.Payload = None - self._XmlTree = None #private XML structure - self.Signature = None - self.SessionId = 0 - self.PayloadSize = 0 - self.Rsvd1 = 0 - self.Rsvd2 = 0 - self.Rsvd3 = 0 - - # V1 unique members - self.SNTarget = 0 - - # V2 unique members - self.Manufacturer = None - self.ProductName = None - self.SerialNumber = None - self.MfgOffset = self.STATIC_STRUCT_SIZE_V2 - self.ProductOffset = 0 - self.SerialOffset = 0 - self.PayloadOffset = 0 - - if(filestream == None): - self.HeaderSignature = self.HEADER_SIG_VALUE - self.HeaderVersion = HdrVersion - else: - self.PopulateFromFileStream(filestream) - # - # Method to un-serialize from a filestream - # - def PopulateFromFileStream(self, fs): - if(fs == None): - raise Exception("Invalid File stream") - - #only populate from file stream those parts that are complete in the file stream - offset = fs.tell() - fs.seek(0,2) - end = fs.tell() - fs.seek(offset) - - if((end - offset) < self.STATIC_STRUCT_SIZE_V1): # minimum size of the static header data - raise Exception("Invalid file stream size") - - self.HeaderSignature = fs.read(4).decode() - if self.HeaderSignature != self.HEADER_SIG_VALUE: - print (" HeaderSignature: %s" % self.HeaderSignature) - raise Exception("Incorrect Header Signature") - self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] - self.Rsvd1 = struct.unpack("=B", fs.read(1))[0] - self.Rsvd2 = struct.unpack("=B", fs.read(1))[0] - self.Rsvd3 = struct.unpack("=B", fs.read(1))[0] - if ((self.Rsvd1 != 0) or - (self.Rsvd2 != 0) or - (self.Rsvd3 != 0)): - raise Exception("Reserved bytes must be zero") - - self.Payload = None - - if (self.HeaderVersion == self.VERSION_V1): - self.SNTarget = struct.unpack("=Q", fs.read(8))[0] - self.SessionId = struct.unpack("=I", fs.read(4))[0] - self.PayloadSize = struct.unpack("=H", fs.read(2))[0] - - elif (self.HeaderVersion == self.VERSION_V2): - if((end - offset) < self.STATIC_STRUCT_SIZE_V2): # minimum size of the static header data - raise Exception("Invalid V2 file stream size") - self.SessionId = struct.unpack("=I", fs.read(4))[0] - self.MfgOffset = struct.unpack("=H", fs.read(2))[0] - self.ProductOffset = struct.unpack("=H", fs.read(2))[0] - self.SerialOffset = struct.unpack("=H", fs.read(2))[0] - self.PayloadSize = struct.unpack("=H", fs.read(2))[0] - self.PayloadOffset = struct.unpack("=H", fs.read(2))[0] - - if ((self.MfgOffset >= self.ProductOffset) or - (self.ProductOffset >= self.SerialOffset) or - (self.SerialOffset >= self.PayloadOffset)): - raise Exception("Invalid Offset Structure") - - if (end - fs.tell() < self.PayloadOffset): - raise Exception("Packet too small for SmBiosString") - - Temp = fs.tell() - if Temp != self.MfgOffset: - raise Exception("Invalid Mfg Offset") - self.Manufacturer = fs.read(self.ProductOffset - self.MfgOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in Mfg") - - Temp = fs.tell() - if Temp != self.ProductOffset: - raise Exception("Invalid Product Offset") - self.ProductName = fs.read(self.SerialOffset - self.ProductOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in ProductName") - - Temp = fs.tell() - if Temp != self.SerialOffset: - raise Exception("Invalid SerialOffset Offset") - self.SerialNumber = fs.read(self.PayloadOffset - self.SerialOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in ProductName") - else: - raise Exception("Invalid header version") - - if((end - fs.tell()) < self.PayloadSize): - raise Exception("Invalid file stream size (PayloadSize)") - - self.Payload = fs.read(self.PayloadSize).decode() - self._XmlTree = xml.dom.minidom.parseString(self.Payload) - - - if((end - fs.tell()) > 0): - self.Signature = WinCert.Factory(fs) - - - def AddXmlPayload(self, xmlstring): - if(self.Payload): - raise Exception("Can't Add an XML payload to an object already containing payload") - - self.Payload = xmlstring - self._XmlTree = xml.dom.minidom.parseString(self.Payload) - self.PayloadSize = len(xmlstring) - # - # Method to Print PermissionApplyVariable to stdout - # - def Print(self, ShowRawXmlAsBytes=False): - print ("PermissionApplyVariable") - print (" HeaderSignature: %s" % self.HeaderSignature) - print (" HeaderVersion: 0x%X" % self.HeaderVersion) - print (" SessionId: 0x%X" % self.SessionId) - print (" PayloadSize: 0x%X" % self.PayloadSize) - if (self.HeaderVersion == self.VERSION_V1): - print (" SN Target: %d" % self.SNTarget) - elif (self.HeaderVersion == self.VERSION_V2): - print (" Manufacturer: %s" % self.Manufacturer) - print (" Product Name: %s" % self.ProductName) - print (" SerialNumber: %s" % self.SerialNumber) - else: - raise Exception("Invalid header version") - - if(self._XmlTree is not None): - print ("%s" % self._XmlTree.toprettyxml()) - else: - print ("XML TREE DOESN'T EXIST") - - if(ShowRawXmlAsBytes and (self.Payload != None)): - print (" Payload Bytes: ") - ndbl = list(bytearray(self.Payload.encode())) - print(type(ndbl ) ) - PrintByteList(ndbl) - - if(self.Signature != None): - self.Signature.Print() - - - def Write(self, fs): - fs.write(self.HeaderSignature.encode('utf-8')) - fs.write(struct.pack("=B", self.HeaderVersion)) - fs.write(struct.pack("=B", self.Rsvd1)) - fs.write(struct.pack("=B", self.Rsvd2)) - fs.write(struct.pack("=B", self.Rsvd3)) - - if (self.HeaderVersion == self.VERSION_V1): - fs.write(struct.pack("=Q", self.SNTarget)) - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=H", self.PayloadSize)) - elif (self.HeaderVersion == self.VERSION_V2): - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=H", self.MfgOffset)) - self.ProductOffset = self.MfgOffset + len(self.Manufacturer) + 1 - self.SerialOffset = self.ProductOffset + len(self.ProductName) + 1 - self.PayloadOffset = self.SerialOffset + len(self.SerialNumber) + 1 - fs.write(struct.pack("=H", self.ProductOffset)) - fs.write(struct.pack("=H", self.SerialOffset)) - fs.write(struct.pack("=H", self.PayloadSize)) - fs.write(struct.pack("=H", self.PayloadOffset)) - fs.write(self.Manufacturer.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - fs.write(self.ProductName.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - fs.write(self.SerialNumber.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - else: - raise Exception("Invalid header version") - - fs.write(self.Payload.encode('utf-8')) - if(self.Signature != None): - self.Signature.Write(fs) - - -## -## SEM Permission Result Variable Data -## -class PermissionResultVariable(object): - STATIC_STRUCT_SIZE=20 - STATIC_STRUCT_SIZE_V2=22 - HEADER_SIG_VALUE = "MPPR" - VERSION_V1 = 1 - VERSION_V2 = 2 - - def __init__(self, filestream=None, HdrVersion=1): - if (HdrVersion != PermissionResultVariable.VERSION_V1 and - HdrVersion != PermissionResultVariable.VERSION_V2): - raise Exception("Invalid version specified") - - self.Payload = None - self.PayloadSize = 0 - self._XmlTree = None #private xml structure - - if(filestream == None): - self.HeaderSignature = PermissionResultVariable.HEADER_SIG_VALUE - self.HeaderVersion = HdrVersion - self.Status = 0 - self.SessionId = 0 - else: - self.PopulateFromFileStream(filestream) - # - # Method to un-serialize from a filestream - # - def PopulateFromFileStream(self, fs): - if(fs == None): - raise Exception("Invalid File stream") - - #only populate from file stream those parts that are complete in the file stream - offset = fs.tell() - fs.seek(0,2) - end = fs.tell() - fs.seek(offset) - - if((end - offset) < PermissionResultVariable.STATIC_STRUCT_SIZE): #size of the static header data - raise Exception("Invalid file stream size") - - self.HeaderSignature = fs.read(4).decode() - if self.HeaderSignature != PermissionResultVariable.HEADER_SIG_VALUE: - print (" HeaderSignature: %s" % self.HeaderSignature) - raise Exception("Incorrect Header Signature") - self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] - if (self.HeaderVersion != PermissionResultVariable.VERSION_V1 and - self.HeaderVersion != PermissionResultVariable.VERSION_V2): - raise Exception("Incorrect Header Version") - fs.seek(3,1) #skip three bytes ahead to avoid the rsvd bytes - self.Status = struct.unpack("=Q", fs.read(8))[0] - self.SessionId = struct.unpack("=I", fs.read(4))[0] - if self.HeaderVersion == PermissionResultVariable.VERSION_V2: - if((end - offset) < PermissionResultVariable.STATIC_STRUCT_SIZE_V2): #size of the static header data - raise Exception("Invalid file stream size") - self.PayloadSize = struct.unpack("=H", fs.read(2))[0] - self.Payload = None - self._XmlTree = None - - if((end - fs.tell()) < self.PayloadSize): - raise Exception("Invalid file stream size (Payload). %d" % self.PayloadSize) - - #is it possible to have 0 sized - if(self.PayloadSize > 0): - self.Payload = fs.read(self.PayloadSize) - self.Payload = self.Payload.decode("utf-8") - self.Payload = self.Payload.rstrip('\x00') #remove ending NULL if there. this only happens in some cases - self._XmlTree = xml.dom.minidom.parseString(self.Payload) - - # - # Method to Print SEM var to stdout - # - def Print(self, ShowRawXmlAsBytes=False): - print ("PermissionResultVariable") - print (" HeaderSignature: %s" % self.HeaderSignature) - print (" HeaderVersion: 0x%X" % self.HeaderVersion) - print (" Status: %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status)) - print (" SessionId: 0x%X" % self.SessionId) - - if self.HeaderVersion == PermissionResultVariable.VERSION_V2: - print (" Payload Size: 0x%X" % self.PayloadSize) - if(self._XmlTree is not None): - print ("%s" % self._XmlTree.toprettyxml() ) - else: - print ("XML TREE DOESN'T EXIST" ) - - if(ShowRawXmlAsBytes and (self.Payload != None)): - print (" Payload Bytes: " ) - ndbl = memoryview(self.Payload).tolist() - PrintByteList(ndbl) - - - def Write(self, fs): - raise Exception("Unsupported/Unnecessary function") - - '''fs.write(self.HeaderSignature.encode('utf-8') - fs.write(struct.pack("=B", self.HeaderVersion)) - fs.write(struct.pack("=B", self.Identity)) - fs.write(struct.pack("=H", self.NewDataSize)) - fs.write(self.NewDataBuffer) - if(self.Signature != None): - self.Signature.Write(fs) - ''' +# @file +# +# Script to support the binary format of a Permission variable +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +## +## Data Structure support for Permission Packet Provisioning Variable +## +## + +import struct +import xml.dom.minidom +from edk2toollib.uefi.wincert import WinCert +from edk2toollib.uefi.status_codes import UefiStatusCode +from edk2toollib.utility_functions import PrintByteList + + +## +## SEM Permission Apply Variable Data +## +class PermissionApplyVariable(object): + STATIC_STRUCT_SIZE_V1=22 + STATIC_STRUCT_SIZE_V2=22 + HEADER_SIG_VALUE = "MPPA" + VERSION_V1 = 1 + VERSION_V2 = 2 + + def __init__(self, filestream=None, HdrVersion=1): + if (HdrVersion != self.VERSION_V1 and + HdrVersion != self.VERSION_V2): + raise Exception("Invalid version specified") + + # Common members + self.HeaderSignature = None + self.HeaderVersion = 0 + self.Payload = None + self._XmlTree = None #private XML structure + self.Signature = None + self.SessionId = 0 + self.PayloadSize = 0 + self.Rsvd1 = 0 + self.Rsvd2 = 0 + self.Rsvd3 = 0 + + # V1 unique members + self.SNTarget = 0 + + # V2 unique members + self.Manufacturer = None + self.ProductName = None + self.SerialNumber = None + self.MfgOffset = self.STATIC_STRUCT_SIZE_V2 + self.ProductOffset = 0 + self.SerialOffset = 0 + self.PayloadOffset = 0 + + if(filestream == None): + self.HeaderSignature = self.HEADER_SIG_VALUE + self.HeaderVersion = HdrVersion + else: + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < self.STATIC_STRUCT_SIZE_V1): # minimum size of the static header data + raise Exception("Invalid file stream size") + + self.HeaderSignature = fs.read(4).decode() + if self.HeaderSignature != self.HEADER_SIG_VALUE: + print (" HeaderSignature: %s" % self.HeaderSignature) + raise Exception("Incorrect Header Signature") + self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] + self.Rsvd1 = struct.unpack("=B", fs.read(1))[0] + self.Rsvd2 = struct.unpack("=B", fs.read(1))[0] + self.Rsvd3 = struct.unpack("=B", fs.read(1))[0] + if ((self.Rsvd1 != 0) or + (self.Rsvd2 != 0) or + (self.Rsvd3 != 0)): + raise Exception("Reserved bytes must be zero") + + self.Payload = None + + if (self.HeaderVersion == self.VERSION_V1): + self.SNTarget = struct.unpack("=Q", fs.read(8))[0] + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.PayloadSize = struct.unpack("=H", fs.read(2))[0] + + elif (self.HeaderVersion == self.VERSION_V2): + if((end - offset) < self.STATIC_STRUCT_SIZE_V2): # minimum size of the static header data + raise Exception("Invalid V2 file stream size") + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.MfgOffset = struct.unpack("=H", fs.read(2))[0] + self.ProductOffset = struct.unpack("=H", fs.read(2))[0] + self.SerialOffset = struct.unpack("=H", fs.read(2))[0] + self.PayloadSize = struct.unpack("=H", fs.read(2))[0] + self.PayloadOffset = struct.unpack("=H", fs.read(2))[0] + + if ((self.MfgOffset >= self.ProductOffset) or + (self.ProductOffset >= self.SerialOffset) or + (self.SerialOffset >= self.PayloadOffset)): + raise Exception("Invalid Offset Structure") + + if (end - fs.tell() < self.PayloadOffset): + raise Exception("Packet too small for SmBiosString") + + Temp = fs.tell() + if Temp != self.MfgOffset: + raise Exception("Invalid Mfg Offset") + self.Manufacturer = fs.read(self.ProductOffset - self.MfgOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in Mfg") + + Temp = fs.tell() + if Temp != self.ProductOffset: + raise Exception("Invalid Product Offset") + self.ProductName = fs.read(self.SerialOffset - self.ProductOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in ProductName") + + Temp = fs.tell() + if Temp != self.SerialOffset: + raise Exception("Invalid SerialOffset Offset") + self.SerialNumber = fs.read(self.PayloadOffset - self.SerialOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in ProductName") + else: + raise Exception("Invalid header version") + + if((end - fs.tell()) < self.PayloadSize): + raise Exception("Invalid file stream size (PayloadSize)") + + self.Payload = fs.read(self.PayloadSize).decode() + self._XmlTree = xml.dom.minidom.parseString(self.Payload) + + + if((end - fs.tell()) > 0): + self.Signature = WinCert.Factory(fs) + + + def AddXmlPayload(self, xmlstring): + if(self.Payload): + raise Exception("Can't Add an XML payload to an object already containing payload") + + self.Payload = xmlstring + self._XmlTree = xml.dom.minidom.parseString(self.Payload) + self.PayloadSize = len(xmlstring) + # + # Method to Print PermissionApplyVariable to stdout + # + def Print(self, ShowRawXmlAsBytes=False): + print ("PermissionApplyVariable") + print (" HeaderSignature: %s" % self.HeaderSignature) + print (" HeaderVersion: 0x%X" % self.HeaderVersion) + print (" SessionId: 0x%X" % self.SessionId) + print (" PayloadSize: 0x%X" % self.PayloadSize) + if (self.HeaderVersion == self.VERSION_V1): + print (" SN Target: %d" % self.SNTarget) + elif (self.HeaderVersion == self.VERSION_V2): + print (" Manufacturer: %s" % self.Manufacturer) + print (" Product Name: %s" % self.ProductName) + print (" SerialNumber: %s" % self.SerialNumber) + else: + raise Exception("Invalid header version") + + if(self._XmlTree is not None): + print ("%s" % self._XmlTree.toprettyxml()) + else: + print ("XML TREE DOESN'T EXIST") + + if(ShowRawXmlAsBytes and (self.Payload != None)): + print (" Payload Bytes: ") + ndbl = list(bytearray(self.Payload.encode())) + print(type(ndbl ) ) + PrintByteList(ndbl) + + if(self.Signature != None): + self.Signature.Print() + + + def Write(self, fs): + fs.write(self.HeaderSignature.encode('utf-8')) + fs.write(struct.pack("=B", self.HeaderVersion)) + fs.write(struct.pack("=B", self.Rsvd1)) + fs.write(struct.pack("=B", self.Rsvd2)) + fs.write(struct.pack("=B", self.Rsvd3)) + + if (self.HeaderVersion == self.VERSION_V1): + fs.write(struct.pack("=Q", self.SNTarget)) + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=H", self.PayloadSize)) + elif (self.HeaderVersion == self.VERSION_V2): + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=H", self.MfgOffset)) + self.ProductOffset = self.MfgOffset + len(self.Manufacturer) + 1 + self.SerialOffset = self.ProductOffset + len(self.ProductName) + 1 + self.PayloadOffset = self.SerialOffset + len(self.SerialNumber) + 1 + fs.write(struct.pack("=H", self.ProductOffset)) + fs.write(struct.pack("=H", self.SerialOffset)) + fs.write(struct.pack("=H", self.PayloadSize)) + fs.write(struct.pack("=H", self.PayloadOffset)) + fs.write(self.Manufacturer.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + fs.write(self.ProductName.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + fs.write(self.SerialNumber.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + else: + raise Exception("Invalid header version") + + fs.write(self.Payload.encode('utf-8')) + if(self.Signature != None): + self.Signature.Write(fs) + + +## +## SEM Permission Result Variable Data +## +class PermissionResultVariable(object): + STATIC_STRUCT_SIZE=20 + STATIC_STRUCT_SIZE_V2=22 + HEADER_SIG_VALUE = "MPPR" + VERSION_V1 = 1 + VERSION_V2 = 2 + + def __init__(self, filestream=None, HdrVersion=1): + if (HdrVersion != PermissionResultVariable.VERSION_V1 and + HdrVersion != PermissionResultVariable.VERSION_V2): + raise Exception("Invalid version specified") + + self.Payload = None + self.PayloadSize = 0 + self._XmlTree = None #private xml structure + + if(filestream == None): + self.HeaderSignature = PermissionResultVariable.HEADER_SIG_VALUE + self.HeaderVersion = HdrVersion + self.Status = 0 + self.SessionId = 0 + else: + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < PermissionResultVariable.STATIC_STRUCT_SIZE): #size of the static header data + raise Exception("Invalid file stream size") + + self.HeaderSignature = fs.read(4).decode() + if self.HeaderSignature != PermissionResultVariable.HEADER_SIG_VALUE: + print (" HeaderSignature: %s" % self.HeaderSignature) + raise Exception("Incorrect Header Signature") + self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] + if (self.HeaderVersion != PermissionResultVariable.VERSION_V1 and + self.HeaderVersion != PermissionResultVariable.VERSION_V2): + raise Exception("Incorrect Header Version") + fs.seek(3,1) #skip three bytes ahead to avoid the rsvd bytes + self.Status = struct.unpack("=Q", fs.read(8))[0] + self.SessionId = struct.unpack("=I", fs.read(4))[0] + if self.HeaderVersion == PermissionResultVariable.VERSION_V2: + if((end - offset) < PermissionResultVariable.STATIC_STRUCT_SIZE_V2): #size of the static header data + raise Exception("Invalid file stream size") + self.PayloadSize = struct.unpack("=H", fs.read(2))[0] + self.Payload = None + self._XmlTree = None + + if((end - fs.tell()) < self.PayloadSize): + raise Exception("Invalid file stream size (Payload). %d" % self.PayloadSize) + + #is it possible to have 0 sized + if(self.PayloadSize > 0): + self.Payload = fs.read(self.PayloadSize) + self.Payload = self.Payload.decode("utf-8") + self.Payload = self.Payload.rstrip('\x00') #remove ending NULL if there. this only happens in some cases + self._XmlTree = xml.dom.minidom.parseString(self.Payload) + + # + # Method to Print SEM var to stdout + # + def Print(self, ShowRawXmlAsBytes=False): + print ("PermissionResultVariable") + print (" HeaderSignature: %s" % self.HeaderSignature) + print (" HeaderVersion: 0x%X" % self.HeaderVersion) + print (" Status: %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status)) + print (" SessionId: 0x%X" % self.SessionId) + + if self.HeaderVersion == PermissionResultVariable.VERSION_V2: + print (" Payload Size: 0x%X" % self.PayloadSize) + if(self._XmlTree is not None): + print ("%s" % self._XmlTree.toprettyxml() ) + else: + print ("XML TREE DOESN'T EXIST" ) + + if(ShowRawXmlAsBytes and (self.Payload != None)): + print (" Payload Bytes: " ) + ndbl = memoryview(self.Payload).tolist() + PrintByteList(ndbl) + + + def Write(self, fs): + raise Exception("Unsupported/Unnecessary function") + + '''fs.write(self.HeaderSignature.encode('utf-8') + fs.write(struct.pack("=B", self.HeaderVersion)) + fs.write(struct.pack("=B", self.Identity)) + fs.write(struct.pack("=H", self.NewDataSize)) + fs.write(self.NewDataBuffer) + if(self.Signature != None): + self.Signature.Write(fs) + ''' diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/Data/SecureSettingVariable.py b/DfciPkg/UnitTests/DfciTests/Support/Python/Data/SecureSettingVariable.py index 03fd355f87..67396c4eab 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/Data/SecureSettingVariable.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/Data/SecureSettingVariable.py @@ -1,364 +1,364 @@ -# @file -# -# Script to support the binary form of the setting variable -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -## -## Data Structure support for SEM Setting Apply/Result Variable -## -## - -import struct -import xml.dom.minidom -from edk2toollib.uefi.wincert import WinCert -from edk2toollib.uefi.status_codes import UefiStatusCode -from edk2toollib.utility_functions import DetachedSignWithSignTool -from edk2toollib.utility_functions import PrintByteList - - -## -## SEM Secure Settings Apply Variable Data -## -class SecureSettingsApplyVariable(object): - STATIC_STRUCT_SIZE_V1=22 - STATIC_STRUCT_SIZE_V2=22 - HEADER_SIG_VALUE = "MSSA" - VERSION_V1 = 1 - VERSION_V2 = 2 - - def __init__(self, filestream=None, HdrVersion=1): - if (HdrVersion != self.VERSION_V1 and - HdrVersion != self.VERSION_V2): - raise Exception("Invalid version specified") - - print ("Processing Version %s" % HdrVersion) - # Common members - self.HeaderSignature = None - self.HeaderVersion = 0 - self.Rsvd1 = 0 - self.Rsvd2 = 0 - self.Rsvd3 = 0 - self.SessionId = 0 - self.PayloadSize = 0 - self.Payload = None - self._XmlTree = None #private XML structure - self.Signature = None - - # V1 unique members - self.SNTarget = 0 - - # V2 unique members - self.Manufacturer = None - self.ProductName = None - self.SerialNumber = None - self.MfgOffset = self.STATIC_STRUCT_SIZE_V2 - self.ProductOffset = 0 - self.SerialOffset = 0 - self.PayloadOffset = 0 - - if(filestream == None): - self.HeaderSignature = self.HEADER_SIG_VALUE - self.HeaderVersion = HdrVersion - else: - self.PopulateFromFileStream(filestream) - # - # Method to un-serialize from a filestream - # - def PopulateFromFileStream(self, fs): - if(fs == None): - raise Exception("Invalid File stream") - - #only populate from file stream those parts that are complete in the file stream - offset = fs.tell() - fs.seek(0,2) - end = fs.tell() - fs.seek(offset) - - if((end - offset) < self.STATIC_STRUCT_SIZE_V1): # minimum size of the static header data - raise Exception("Invalid file stream size") - - self.HeaderSignature = fs.read(4).decode() - if self.HeaderSignature != self.HEADER_SIG_VALUE: - raise Exception("Incorrect Header Signature") - self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] - self.rsvd1 = struct.unpack("=B", fs.read(1))[0] - self.rsvd2 = struct.unpack("=B", fs.read(1))[0] - self.rsvd3 = struct.unpack("=B", fs.read(1))[0] - - if (self.HeaderVersion == self.VERSION_V1): - self.SNTarget = struct.unpack("=Q", fs.read(8))[0] - self.SessionId = struct.unpack("=I", fs.read(4))[0] - self.PayloadSize = struct.unpack("=H", fs.read(2))[0] - - elif (self.HeaderVersion == self.VERSION_V2): - if((end - offset) < self.STATIC_STRUCT_SIZE_V2): # minimum size for v2 data - raise Exception("Invalid V2 file stream size") - self.SessionId = struct.unpack("=I", fs.read(4))[0] - self.MfgOffset = struct.unpack("=H", fs.read(2))[0] - self.ProductOffset = struct.unpack("=H", fs.read(2))[0] - self.SerialOffset = struct.unpack("=H", fs.read(2))[0] - self.PayloadSize = struct.unpack("=H", fs.read(2))[0] - self.PayloadOffset = struct.unpack("=H", fs.read(2))[0] - - if (end - fs.tell() < self.PayloadOffset): - raise Exception("Packet too small for SmBiosString") - - if ((self.MfgOffset >= self.ProductOffset) or - (self.ProductOffset >= self.SerialOffset) or - (self.SerialOffset >= self.PayloadOffset)): - raise Exception("Invalid Offset Structure") - - Temp = fs.tell() - if Temp != self.MfgOffset: - raise Exception("Invalid Mfg Offset") - self.Manufacturer = fs.read(self.ProductOffset - self.MfgOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in Mfg") - - Temp = fs.tell() - if Temp != self.ProductOffset: - raise Exception("Invalid Product Offset") - self.ProductName = fs.read(self.SerialOffset - self.ProductOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in ProductName") - - Temp = fs.tell() - if Temp != self.SerialOffset: - raise Exception("Invalid SerialOffset Offset") - self.SerialNumber = fs.read(self.PayloadOffset - self.SerialOffset - 1).decode() - Temp = struct.unpack("=B", fs.read(1))[0] - if Temp != 0: - raise Exception("Invalid NULL in SerialNumber") - else: - raise Exception("Invalid header version") - - self.Payload = None - self._PayloadXml = None - self.Signature = None - - if((end - fs.tell()) < self.PayloadSize): - raise Exception("Invalid file stream size (payload size incorrect)") - - self.Payload = fs.read(self.PayloadSize).decode('utf-8') - prep = self.Payload - prep = prep.rstrip('\x00') - self._PayloadXml = xml.dom.minidom.parseString(prep) - - if((end - fs.tell()) > 0): - self.Signature = WinCert.Factory(fs) - - - def AddXmlPayload(self, xmlstring): - if(self.Payload): - raise Exception("Can't Add an XML payload to an object already containing payload") - xmlclean = ' '.join(xmlstring.split()) #get rid of extra whitespace and new line chars. This changes newline to blank which i don't like but better than before. If replace with '' then xml attributes are messed up - self.Payload = xmlclean; - self._PayloadXml = xml.dom.minidom.parseString(xmlclean) - self.PayloadSize = len(xmlclean) - - # - # Method to Print SecureSettingsApplyVariable to stdout - # - def Print(self, ShowRawXmlAsBytes=False): - print ("SecureSettingsApplyVariable") - print (" HeaderSignature: %s" % self.HeaderSignature) - print (" HeaderVersion: 0x%X" % self.HeaderVersion) - print (" SessionId: 0x%X" % self.SessionId) - print (" Payload Size: 0x%X" % self.PayloadSize) - if (self.HeaderVersion == self.VERSION_V1): - print (" SN Target: %d" % self.SNTarget) - elif (self.HeaderVersion == self.VERSION_V2): - print (" Manufacturer: %s" % self.Manufacturer) - print (" Product Name: %s" % self.ProductName) - print (" SerialNumber: %s" % self.SerialNumber) - else: - raise Exception("Invalid header version") - - if(self._PayloadXml is not None): - print ("%s" % self._PayloadXml.toprettyxml()) - else: - print ("XML TREE DOESN'T EXIST") - - if(ShowRawXmlAsBytes and (self.Payload is not None)): - print (" Payload Bytes: ") - ndbl = list(bytearray(self.Payload.encode())) - print(type(ndbl)) - PrintByteList(ndbl) - - if(self.Signature != None): - self.Signature.Print() - - - def Write(self, fs): - fs.write(self.HeaderSignature.encode('utf-8')) - fs.write(struct.pack("=B", self.HeaderVersion)) - fs.write(struct.pack("=B", self.Rsvd1)) - fs.write(struct.pack("=B", self.Rsvd2)) - fs.write(struct.pack("=B", self.Rsvd3)) - - if (self.HeaderVersion == self.VERSION_V1): - fs.write(struct.pack("=Q", self.SNTarget)) - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=H", self.PayloadSize)) - elif (self.HeaderVersion == self.VERSION_V2): - fs.write(struct.pack("=I", self.SessionId)) - fs.write(struct.pack("=H", self.MfgOffset)) - self.ProductOffset = self.MfgOffset + len(self.Manufacturer) + 1 - self.SerialOffset = self.ProductOffset + len(self.ProductName) + 1 - self.PayloadOffset = self.SerialOffset + len(self.SerialNumber) + 1 - fs.write(struct.pack("=H", self.ProductOffset)) - fs.write(struct.pack("=H", self.SerialOffset)) - fs.write(struct.pack("=H", self.PayloadSize)) - fs.write(struct.pack("=H", self.PayloadOffset)) - fs.write(self.Manufacturer.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - fs.write(self.ProductName.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - fs.write(self.SerialNumber.encode('utf-8')) - fs.write(struct.pack("=B", 0)) # NULL Terminator - else: - raise Exception("Invalid header version") - - fs.write(self.Payload.encode('utf-8')) - if(self.Signature != None): - self.Signature.Write(fs) - -## -## SEM Secure Settings Result Variable Data -## -class SecureSettingsResultVariable(object): - STATIC_STRUCT_SIZE=22 - HEADER_SIG_VALUE = "MSSR" - VERSION = 1 - - def __init__(self, filestream=None): - if(filestream == None): - self.HeaderSignature = SecureSettingsResultVariable.HEADER_SIG_VALUE - self.HeaderVersion = SecureSettingsResultVariable.VERSION - self.Status = 0 - self.SessionId = 0 - self.PayloadSize = 0 - self.Payload = None - self._XmlTree = None #private xml structure - else: - self._XmlTree = None - self.PopulateFromFileStream(filestream) - # - # Method to un-serialize from a filestream - # - def PopulateFromFileStream(self, fs): - if(fs == None): - raise Exception("Invalid File stream") - - #only populate from file stream those parts that are complete in the file stream - offset = fs.tell() - fs.seek(0,2) - end = fs.tell() - fs.seek(offset) - - if((end - offset) < SecureSettingsResultVariable.STATIC_STRUCT_SIZE): #size of the static header data - raise Exception("Invalid file stream size") - - self.HeaderSignature = str(fs.read(4)) - self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] - fs.seek(3,1) #skip three bytes ahead to avoid the rsvd bytes - self.Status = struct.unpack("=Q", fs.read(8))[0] - self.SessionId = struct.unpack("=I", fs.read(4))[0] - self.PayloadSize = struct.unpack("=H", fs.read(2))[0] - self.Payload = None - self._XmlTree = None - - if((end - fs.tell()) < self.PayloadSize): - raise Exception("Invalid file stream size (Payload). %d" % self.PayloadSize) - - #is it possible to have 0 sized - if(self.PayloadSize > 0): - self.Payload = fs.read(self.PayloadSize) - self.Payload = self.Payload.decode("utf-8") - self.Payload = self.Payload.rstrip('\x00') #remove ending NULL if there. this only happens in some cases - self._XmlTree = xml.dom.minidom.parseString(self.Payload) - - # - # Method to Print SEM var results to stdout - # - def Print(self, ShowRawXmlAsBytes=False): - print ("SecureSettingResultVariable") - print (" HeaderSignature: %s" % self.HeaderSignature) - print (" HeaderVersion: 0x%X" % self.HeaderVersion) - print (" SessionId: 0x%X" % (self.SessionId)) - print (" Status: %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status)) - print (" Payload Size: 0x%X" % self.PayloadSize) - if(self._XmlTree is not None): - print ("%s" % self._XmlTree.toprettyxml() ) - else: - print ("XML TREE DOESN'T EXIST" ) - - if(ShowRawXmlAsBytes and (self.Payload is not None)): - print (" Payload Bytes: " ) - ndbl = list(bytearray(self.Payload.encode())) - print(type(ndbl)) - PrintByteList(ndbl) - - - def Write(self, fs): - raise Exception("Unsupported/Unnecessary function") - - '''fs.write(self.HeaderSignature.encode('utf-8')) - fs.write(struct.pack("=B", self.HeaderVersion)) - fs.write(struct.pack("=B", self.Identity)) - fs.write(struct.pack("=H", self.NewDataSize)) - fs.write(self.NewDataBuffer) - if(self.Signature != None): - self.Signature.Write(fs) - ''' - - -## -## SEM Secure Settings Current Variable Data -## -class SecureSettingsCurrentVariable(object): - STATIC_STRUCT_SIZE=0 - - def __init__(self, filestream=None): - self._Payload = None - self._XmlTree = None #private xml structure - if(filestream != None): - self.PopulateFromFileStream(filestream) - # - # Method to un-serialize from a filestream - # - def PopulateFromFileStream(self, fs): - if(fs == None): - raise Exception("Invalid File stream") - - #only populate from file stream those parts that are complete in the file stream - offset = fs.tell() - fs.seek(0,2) - end = fs.tell() - fs.seek(offset) - - if((end - offset) < 1): # no data - raise Exception("Invalid file stream size. No data") - self._Payload = fs.read() - self._Payload = self._Payload.rstrip('\x00') - self._XmlTree = xml.dom.minidom.parseString(self._Payload) - - # - # Method to Print SEM var to stdout - # - def Print(self): - print ("Current Settings XML") - if(self._XmlTree is not None): - print ("%s" % self._XmlTree.toprettyxml()) - else: - print ("XML TREE DOESN'T EXIST") - - - def Write(self, fs): - if(self._Payload == None): - raise Exception("No payload to write") - fs.write(self._Payload) +# @file +# +# Script to support the binary form of the setting variable +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +## +## Data Structure support for SEM Setting Apply/Result Variable +## +## + +import struct +import xml.dom.minidom +from edk2toollib.uefi.wincert import WinCert +from edk2toollib.uefi.status_codes import UefiStatusCode +from edk2toollib.utility_functions import DetachedSignWithSignTool +from edk2toollib.utility_functions import PrintByteList + + +## +## SEM Secure Settings Apply Variable Data +## +class SecureSettingsApplyVariable(object): + STATIC_STRUCT_SIZE_V1=22 + STATIC_STRUCT_SIZE_V2=22 + HEADER_SIG_VALUE = "MSSA" + VERSION_V1 = 1 + VERSION_V2 = 2 + + def __init__(self, filestream=None, HdrVersion=1): + if (HdrVersion != self.VERSION_V1 and + HdrVersion != self.VERSION_V2): + raise Exception("Invalid version specified") + + print ("Processing Version %s" % HdrVersion) + # Common members + self.HeaderSignature = None + self.HeaderVersion = 0 + self.Rsvd1 = 0 + self.Rsvd2 = 0 + self.Rsvd3 = 0 + self.SessionId = 0 + self.PayloadSize = 0 + self.Payload = None + self._XmlTree = None #private XML structure + self.Signature = None + + # V1 unique members + self.SNTarget = 0 + + # V2 unique members + self.Manufacturer = None + self.ProductName = None + self.SerialNumber = None + self.MfgOffset = self.STATIC_STRUCT_SIZE_V2 + self.ProductOffset = 0 + self.SerialOffset = 0 + self.PayloadOffset = 0 + + if(filestream == None): + self.HeaderSignature = self.HEADER_SIG_VALUE + self.HeaderVersion = HdrVersion + else: + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < self.STATIC_STRUCT_SIZE_V1): # minimum size of the static header data + raise Exception("Invalid file stream size") + + self.HeaderSignature = fs.read(4).decode() + if self.HeaderSignature != self.HEADER_SIG_VALUE: + raise Exception("Incorrect Header Signature") + self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] + self.rsvd1 = struct.unpack("=B", fs.read(1))[0] + self.rsvd2 = struct.unpack("=B", fs.read(1))[0] + self.rsvd3 = struct.unpack("=B", fs.read(1))[0] + + if (self.HeaderVersion == self.VERSION_V1): + self.SNTarget = struct.unpack("=Q", fs.read(8))[0] + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.PayloadSize = struct.unpack("=H", fs.read(2))[0] + + elif (self.HeaderVersion == self.VERSION_V2): + if((end - offset) < self.STATIC_STRUCT_SIZE_V2): # minimum size for v2 data + raise Exception("Invalid V2 file stream size") + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.MfgOffset = struct.unpack("=H", fs.read(2))[0] + self.ProductOffset = struct.unpack("=H", fs.read(2))[0] + self.SerialOffset = struct.unpack("=H", fs.read(2))[0] + self.PayloadSize = struct.unpack("=H", fs.read(2))[0] + self.PayloadOffset = struct.unpack("=H", fs.read(2))[0] + + if (end - fs.tell() < self.PayloadOffset): + raise Exception("Packet too small for SmBiosString") + + if ((self.MfgOffset >= self.ProductOffset) or + (self.ProductOffset >= self.SerialOffset) or + (self.SerialOffset >= self.PayloadOffset)): + raise Exception("Invalid Offset Structure") + + Temp = fs.tell() + if Temp != self.MfgOffset: + raise Exception("Invalid Mfg Offset") + self.Manufacturer = fs.read(self.ProductOffset - self.MfgOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in Mfg") + + Temp = fs.tell() + if Temp != self.ProductOffset: + raise Exception("Invalid Product Offset") + self.ProductName = fs.read(self.SerialOffset - self.ProductOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in ProductName") + + Temp = fs.tell() + if Temp != self.SerialOffset: + raise Exception("Invalid SerialOffset Offset") + self.SerialNumber = fs.read(self.PayloadOffset - self.SerialOffset - 1).decode() + Temp = struct.unpack("=B", fs.read(1))[0] + if Temp != 0: + raise Exception("Invalid NULL in SerialNumber") + else: + raise Exception("Invalid header version") + + self.Payload = None + self._PayloadXml = None + self.Signature = None + + if((end - fs.tell()) < self.PayloadSize): + raise Exception("Invalid file stream size (payload size incorrect)") + + self.Payload = fs.read(self.PayloadSize).decode('utf-8') + prep = self.Payload + prep = prep.rstrip('\x00') + self._PayloadXml = xml.dom.minidom.parseString(prep) + + if((end - fs.tell()) > 0): + self.Signature = WinCert.Factory(fs) + + + def AddXmlPayload(self, xmlstring): + if(self.Payload): + raise Exception("Can't Add an XML payload to an object already containing payload") + xmlclean = ' '.join(xmlstring.split()) #get rid of extra whitespace and new line chars. This changes newline to blank which i don't like but better than before. If replace with '' then xml attributes are messed up + self.Payload = xmlclean; + self._PayloadXml = xml.dom.minidom.parseString(xmlclean) + self.PayloadSize = len(xmlclean) + + # + # Method to Print SecureSettingsApplyVariable to stdout + # + def Print(self, ShowRawXmlAsBytes=False): + print ("SecureSettingsApplyVariable") + print (" HeaderSignature: %s" % self.HeaderSignature) + print (" HeaderVersion: 0x%X" % self.HeaderVersion) + print (" SessionId: 0x%X" % self.SessionId) + print (" Payload Size: 0x%X" % self.PayloadSize) + if (self.HeaderVersion == self.VERSION_V1): + print (" SN Target: %d" % self.SNTarget) + elif (self.HeaderVersion == self.VERSION_V2): + print (" Manufacturer: %s" % self.Manufacturer) + print (" Product Name: %s" % self.ProductName) + print (" SerialNumber: %s" % self.SerialNumber) + else: + raise Exception("Invalid header version") + + if(self._PayloadXml is not None): + print ("%s" % self._PayloadXml.toprettyxml()) + else: + print ("XML TREE DOESN'T EXIST") + + if(ShowRawXmlAsBytes and (self.Payload is not None)): + print (" Payload Bytes: ") + ndbl = list(bytearray(self.Payload.encode())) + print(type(ndbl)) + PrintByteList(ndbl) + + if(self.Signature != None): + self.Signature.Print() + + + def Write(self, fs): + fs.write(self.HeaderSignature.encode('utf-8')) + fs.write(struct.pack("=B", self.HeaderVersion)) + fs.write(struct.pack("=B", self.Rsvd1)) + fs.write(struct.pack("=B", self.Rsvd2)) + fs.write(struct.pack("=B", self.Rsvd3)) + + if (self.HeaderVersion == self.VERSION_V1): + fs.write(struct.pack("=Q", self.SNTarget)) + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=H", self.PayloadSize)) + elif (self.HeaderVersion == self.VERSION_V2): + fs.write(struct.pack("=I", self.SessionId)) + fs.write(struct.pack("=H", self.MfgOffset)) + self.ProductOffset = self.MfgOffset + len(self.Manufacturer) + 1 + self.SerialOffset = self.ProductOffset + len(self.ProductName) + 1 + self.PayloadOffset = self.SerialOffset + len(self.SerialNumber) + 1 + fs.write(struct.pack("=H", self.ProductOffset)) + fs.write(struct.pack("=H", self.SerialOffset)) + fs.write(struct.pack("=H", self.PayloadSize)) + fs.write(struct.pack("=H", self.PayloadOffset)) + fs.write(self.Manufacturer.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + fs.write(self.ProductName.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + fs.write(self.SerialNumber.encode('utf-8')) + fs.write(struct.pack("=B", 0)) # NULL Terminator + else: + raise Exception("Invalid header version") + + fs.write(self.Payload.encode('utf-8')) + if(self.Signature != None): + self.Signature.Write(fs) + +## +## SEM Secure Settings Result Variable Data +## +class SecureSettingsResultVariable(object): + STATIC_STRUCT_SIZE=22 + HEADER_SIG_VALUE = "MSSR" + VERSION = 1 + + def __init__(self, filestream=None): + if(filestream == None): + self.HeaderSignature = SecureSettingsResultVariable.HEADER_SIG_VALUE + self.HeaderVersion = SecureSettingsResultVariable.VERSION + self.Status = 0 + self.SessionId = 0 + self.PayloadSize = 0 + self.Payload = None + self._XmlTree = None #private xml structure + else: + self._XmlTree = None + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < SecureSettingsResultVariable.STATIC_STRUCT_SIZE): #size of the static header data + raise Exception("Invalid file stream size") + + self.HeaderSignature = str(fs.read(4)) + self.HeaderVersion = struct.unpack("=B", fs.read(1))[0] + fs.seek(3,1) #skip three bytes ahead to avoid the rsvd bytes + self.Status = struct.unpack("=Q", fs.read(8))[0] + self.SessionId = struct.unpack("=I", fs.read(4))[0] + self.PayloadSize = struct.unpack("=H", fs.read(2))[0] + self.Payload = None + self._XmlTree = None + + if((end - fs.tell()) < self.PayloadSize): + raise Exception("Invalid file stream size (Payload). %d" % self.PayloadSize) + + #is it possible to have 0 sized + if(self.PayloadSize > 0): + self.Payload = fs.read(self.PayloadSize) + self.Payload = self.Payload.decode("utf-8") + self.Payload = self.Payload.rstrip('\x00') #remove ending NULL if there. this only happens in some cases + self._XmlTree = xml.dom.minidom.parseString(self.Payload) + + # + # Method to Print SEM var results to stdout + # + def Print(self, ShowRawXmlAsBytes=False): + print ("SecureSettingResultVariable") + print (" HeaderSignature: %s" % self.HeaderSignature) + print (" HeaderVersion: 0x%X" % self.HeaderVersion) + print (" SessionId: 0x%X" % (self.SessionId)) + print (" Status: %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status)) + print (" Payload Size: 0x%X" % self.PayloadSize) + if(self._XmlTree is not None): + print ("%s" % self._XmlTree.toprettyxml() ) + else: + print ("XML TREE DOESN'T EXIST" ) + + if(ShowRawXmlAsBytes and (self.Payload is not None)): + print (" Payload Bytes: " ) + ndbl = list(bytearray(self.Payload.encode())) + print(type(ndbl)) + PrintByteList(ndbl) + + + def Write(self, fs): + raise Exception("Unsupported/Unnecessary function") + + '''fs.write(self.HeaderSignature.encode('utf-8')) + fs.write(struct.pack("=B", self.HeaderVersion)) + fs.write(struct.pack("=B", self.Identity)) + fs.write(struct.pack("=H", self.NewDataSize)) + fs.write(self.NewDataBuffer) + if(self.Signature != None): + self.Signature.Write(fs) + ''' + + +## +## SEM Secure Settings Current Variable Data +## +class SecureSettingsCurrentVariable(object): + STATIC_STRUCT_SIZE=0 + + def __init__(self, filestream=None): + self._Payload = None + self._XmlTree = None #private xml structure + if(filestream != None): + self.PopulateFromFileStream(filestream) + # + # Method to un-serialize from a filestream + # + def PopulateFromFileStream(self, fs): + if(fs == None): + raise Exception("Invalid File stream") + + #only populate from file stream those parts that are complete in the file stream + offset = fs.tell() + fs.seek(0,2) + end = fs.tell() + fs.seek(offset) + + if((end - offset) < 1): # no data + raise Exception("Invalid file stream size. No data") + self._Payload = fs.read() + self._Payload = self._Payload.rstrip('\x00') + self._XmlTree = xml.dom.minidom.parseString(self._Payload) + + # + # Method to Print SEM var to stdout + # + def Print(self): + print ("Current Settings XML") + if(self._XmlTree is not None): + print ("%s" % self._XmlTree.toprettyxml()) + else: + print ("XML TREE DOESN'T EXIST") + + + def Write(self, fs): + if(self._Payload == None): + raise Exception("No payload to write") + fs.write(self._Payload) diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/DependencyLib.py b/DfciPkg/UnitTests/DfciTests/Support/Python/DependencyLib.py index 9d0c2ee60a..8d35530eef 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/DependencyLib.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/DependencyLib.py @@ -1,31 +1,31 @@ -# @file -# -# Dependency Lib - Limited functionality to for a robot testcase to depende on a successful -# completion of a previous testcase. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -from robot.libraries.BuiltIn import BuiltIn - -class DependencyLib(object): - ROBOT_LISTENER_API_VERSION = 2 - ROBOT_LIBRARY_SCOPE = "GLOBAL" - - def __init__(self): - self.ROBOT_LIBRARY_LISTENER = self - self.test_status = {} - - def require_test_case(self, name): - key = name.lower() - if (key not in self.test_status): - BuiltIn().fail("required test case can't be found: '%s'" % name) - - if (self.test_status[key] != "PASS"): - BuiltIn().fail("required test case failed: '%s'" % name) - - return True - - def _end_test(self, name, attrs): - self.test_status[name.lower()] = attrs["status"] +# @file +# +# Dependency Lib - Limited functionality to for a robot testcase to depende on a successful +# completion of a previous testcase. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +from robot.libraries.BuiltIn import BuiltIn + +class DependencyLib(object): + ROBOT_LISTENER_API_VERSION = 2 + ROBOT_LIBRARY_SCOPE = "GLOBAL" + + def __init__(self): + self.ROBOT_LIBRARY_LISTENER = self + self.test_status = {} + + def require_test_case(self, name): + key = name.lower() + if (key not in self.test_status): + BuiltIn().fail("required test case can't be found: '%s'" % name) + + if (self.test_status[key] != "PASS"): + BuiltIn().fail("required test case failed: '%s'" % name) + + return True + + def _end_test(self, name, attrs): + self.test_status[name.lower()] = attrs["status"] diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateCertProvisionData.py b/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateCertProvisionData.py index f24e0d67e7..c070393da4 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateCertProvisionData.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateCertProvisionData.py @@ -1,510 +1,510 @@ -# @file -# -# Script to Generate a Device Firmware Configuration Interface Provisiong Blob -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -## -## Script to Generate a Device Firmware Configuration Interface Provisiong Blob -## This tool takes in a CER file in binary encoding, packages it in a -## DFCI_SIGNER_PROVISION_APPLY_VAR structure, signs it with the -## requested key, and then attaches the signature data in WIN_CERTIFICATE_UEFI_GUID format. -## -## This binary file can then be written to variable store: -## GUID: gDfciAuthProvisionVarNamespace -## NAME: DFCI_IDENTITY_APPLY_VAR_NAME L"DfciIdentityApply" -## -## THIS IS FOR UNIT TEST -## -## General process: -## Phase 1: Create payload file by combining relevant info -## Phase 2: Sign it using signtool -## Phase 3: Parse signature into WIN_CERT and package to create final output -## - -import os, sys -import argparse -import logging -import datetime -import struct -import shutil -import time -import random -import hashlib - -#get script path -sp = os.path.dirname(os.path.realpath(sys.argv[0])) - -#setup python path for build modules -sys.path.append(sp) - -from DFCI_SupportLib import DFCI_SupportLib - -from Data.CertProvisioningVariable import CertProvisioningApplyVariable -from Data.CertProvisioningVariable import CertProvisioningResultVariable -from edk2toollib.uefi.wincert import * -from edk2toollib.windows.locate_tools import FindToolInWinSdk -from edk2toollib.utility_functions import DetachedSignWithSignTool - -#PKCS7 Signed Data OID -gOid = "1.2.840.113549.1.7.2" -gPath2SignTool = None - -def PrintSEM(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = CertProvisioningApplyVariable(s) - s.close() - - #now print it out. - SEM.Print() - -def ExtractCert(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = CertProvisioningApplyVariable(s) - s.close() - - #now write the certificate out. - (certtype, a, b) = SEM.GetCertType().partition(' ') - - certfilename = os.path.basename(filepath) + "_" + certtype + ".cer" - s = open(certfilename, "wb") - SEM.WriteCert(s) - s.close() - s = open(certfilename, "rb") - m = hashlib.new("sha1",s.read()) - s.close() - - # return the sha1 (Thumbprint) of the certificate. - return m.digest().hex() - -def PrintSEMCurrent(filepath): - if(filepath and os.path.isfile(filepath)): - outfilename = os.path.basename(filepath) + "_Current" + ".xml" - a = DFCI_SupportLib () - a.extract_payload_from_current(filepath, outfilename) - -def PrintSEMResults(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = CertProvisioningResultVariable(s) - s.close() - - #now print it out. - SEM.Print() - -def SignSEMProvisionData(options): - global gPath2SignTool - if gPath2SignTool == None: - a = DFCI_SupportLib () - gPath2SignTool = a.get_signtool_path () - - logging.critical("Signing Started") - logging.critical(options.SigningInputFile) - logging.critical(options.SigningOutputFile) - logging.critical(options.SigningPfxFile) - - return DetachedSignWithSignTool (gPath2SignTool, options.SigningInputFile, options.SigningOutputFile, options.SigningPfxFile, options.SigningPfxPw, gOid) - -def TestSignSemTrustedCert(options): - global gPath2SignTool - if gPath2SignTool == None: - a = DFCI_SupportLib () - gPath2SignTool = a.get_signtool_path () - - logging.critical("Signing Started") - logging.critical(gPath2SignTool) - logging.critical(options.CertFilePath) - logging.critical(options.Signing2AOutputFile) - logging.critical(options.Signing2APfxFile) - - return DetachedSignWithSignTool (gPath2SignTool, options.CertFilePath, options.Signing2AOutputFile, options.Signing2APfxFile, options.Signing2APfxPw, gOid) - -def is_32bit_number(s): - try: - float(s) - if s < 4294967296: - return True - else: - return False - except ValueError: - return False - - -# -#main script function -# -def main(): - parser = argparse.ArgumentParser(description='Create SEM Provisioning Cert') - - #Output debug log - parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) - parser.add_argument("-p", dest="PrintFile", help="Print File as Provisioning Blob", default= None) - parser.add_argument("-pr", dest="PrintResultsFile", help="Print Result File as Identity Blob", default= None) - parser.add_argument("-pc", dest="PrintCurrentFile", help="Print Current File as {basename}_Current.xml", default= None) - parser.add_argument("-xc", dest="ExtractCertFile", help="Extract the certificate to {basename}_{certtype}.cer", default=None) - parser.add_argument("--dirty", action="store_true", dest="dirty", help="Leave around the temp files after finished", default=False) - - Step1Group = parser.add_argument_group(title="Step1", description="Signed Data Prep. Build data structure.") - Step1Group.add_argument("--Step1Enable", dest="Step1Enable", help="Do Step 1 - Signed Data Prep", default=False, action="store_true") - Step1Group.add_argument("--Identity", dest="Identity", help="Identity (Owner=1, User=2, User1=3, User2=4, Ztc=5). Default is Owner", default=1) - Step1Group.add_argument("--SnTarget", dest="SnTarget", help="Target to only a device with given Serial Number in decimal. Zero means all devices", default=0) - Step1Group.add_argument("--CertFilePath", dest="CertFilePath", help="Path to binary DER Cert", default=None) - Step1Group.add_argument("--PrepResultFile", dest="PrepResultFile", help="Optional File for output from Step1. Required if not doing step2 or step2A", default=None) - Step1Group.add_argument("--HdrVersion", dest="HdrVersion", help="Specify packet version", default=CertProvisioningApplyVariable.VERSION_V1) - Step1Group.add_argument("--SMBIOSMfg", dest="SMBIOSMfg", help="Specify SMBIOS Manufacturer", default=None) - Step1Group.add_argument("--SMBIOSProd", dest="SMBIOSProd", help="Specify SMBIOS Product Name", default=None) - Step1Group.add_argument("--SMBIOSSerial", dest="SMBIOSSerial", help="Specify SMBIOS Serial Number", default=None) - Step1Group.add_argument("--Version", dest="Version", help="Specify Identity version", default=0) - Step1Group.add_argument("--Lsv", dest="Lsv", help="Specify the lowest supported version", default=0) - - Step2AGroup = parser.add_argument_group(title="Step2A", description="Test Signature Generation Step.") - Step2AGroup.add_argument("--Step2AEnable", dest="Step2AEnable", help="Do Step 2A - Local Signing for Test Signature", default=False, action="store_true") - #need to add arguments here for signing. - Step2AGroup.add_argument("--Signing2AResultFile", dest="Signing2AResultFile", help="Optional File for output from Step2A. Required if not doing step2B", default=None) - Step2AGroup.add_argument("--Signing2APfxFile", dest="Signing2APfxFile", help="Path to PFX file for signing Test Signature ", default=None) - Step2AGroup.add_argument("--Signing2APfxPw", dest="Signing2APfxPw", help="Optional Password for PFX file for signing Test Signature", default=None) - - Step2BGroup = parser.add_argument_group(title="Step2B", description="Package Cert Provision With Test Signature.") - Step2BGroup.add_argument("--Step2BEnable", dest="Step2BEnable", help="Do Step 2B - Package Test Signature with Cert Provision Data", default=False, action="store_true") - Step2BGroup.add_argument("--TestSignatureInputFile", dest="TestSignatureInputFile", help="Detached Signature file for Test Signature", default=None) - Step2BGroup.add_argument("--CertProvisionBlobInputFile", dest="CertProvisionBlobAfterStep1File", help="Step1 Output File to use as Input to combine with Test Signature", default=None) - Step2BGroup.add_argument("--Prep2BResultFile", dest="Prep2BResultFile", help="Optional File for output from Step2B. Required if not doing step2", default=None) - - - Step2Group = parser.add_argument_group(title="Step2", description="Signature Generation Step.") - Step2Group.add_argument("--Step2Enable", dest="Step2Enable", help="Do Step 2 - Local Signing", default=False, action="store_true") - #need to add arguments here for signing. - Step2Group.add_argument("--SigningInputFile", dest="SigningInputFile", help="Optional File for intput for Step2. Required if not doing step1", default=None) - Step2Group.add_argument("--SigningResultFile", dest="SigningResultFile", help="Optional File for output from Step2. Required if not doing step3", default=None) - Step2Group.add_argument("--SigningPfxFile", dest="SigningPfxFile", help="Path to PFX file for signing", default=None) - Step2Group.add_argument("--SigningPfxPw", dest="SigningPfxPw", help="Optional Password for PFX file for signing", default=None) - - Step3Group = parser.add_argument_group(title="Step3", description="Final Provisioning Var Construction.") - Step3Group.add_argument("--Step3Enable", dest="Step3Enable", help="Do Step 3 - Final Provisioning Var Construction", default=False, action="store_true") - Step3Group.add_argument("--FinalizeInputFile", dest="FinalizeInputFile", help="Optional if doing Step2. Generally Step1 Output or Step2 input. ", default=None) - Step3Group.add_argument("--FinalizeInputDetachedSignatureFile", dest="FinalizeInputDetachedSignatureFile", help="Signtool Detached Signature File. Optional if doing Step2", default=None) - Step3Group.add_argument("--FinalizeResultFile", dest="FinalizeResultFile", help="File for output from Step3. Complete SEM Provisioning Var File.", default=None) - - - #Turn on debug level logging - parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) - options = parser.parse_args() - - #setup file based logging if outputReport specified - if(options.OutputLog): - if(len(options.OutputLog) < 2): - logging.critical("the output log file parameter is invalid") - return -2 - else: - #setup file based logging - filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') - if(options.debug): - filelogger.setLevel(logging.DEBUG) - else: - filelogger.setLevel(logging.INFO) - - filelogger.setFormatter(formatter) - logging.getLogger('').addHandler(filelogger) - - logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) - - #Step 1 Prep - if(options.Step1Enable): - logging.debug("Step 1 Enabled") - if(not options.CertFilePath) or (not os.path.isfile(options.CertFilePath)): - logging.critical("Not CertFilePath. That means we are un-enrolling") - - if(not options.Step2Enable) and (not options.Step2AEnable): - #must have output file - if(not options.PrepResultFile): - logging.critical("Since Step2A/2 is not enabled there must be a PrepResultFile for the result") - return -3 - - if(options.PrepResultFile): - logging.debug("Step 1 Result will be written to: " + options.PrepResultFile) - - if(options.SigningInputFile): - logging.critical("Since Step1 is enabled an Input File for Step2 is not allowed") - return -11 - - #Step 2A Test Signature Generation - if(options.Step2AEnable): - logging.debug("Step 2A Enabled") - if(not options.CertFilePath) or (not os.path.isfile(options.CertFilePath)): - logging.debug("Not CertFilePath. That means we are un-enrolling") - logging.critical("Step 2A should not be enabled if un-enrolling") - return -847 - - if(not options.Signing2APfxFile): - logging.critical("Since Step2A is enabled you must supply a path to a PFX file for test signing") - return -848 - - if(not options.Step2BEnable): - #must have output file - if(not options.Signing2AResultFile): - logging.critical("Since Step2B is not enabled there must be a Signing2AResultFile for the result") - return -5 - - if(options.Signing2AResultFile): - logging.debug("Step2A Result will be written to: " + options.Signing2AResultFile) - - #Step2B Combine Step1 and Step2A into Single File in prep for Step2 - if(options.Step2BEnable): - logging.debug("Step 2B Enabled") - if(not options.Step2AEnable): - #must have Test Signature Input File - if(not options.TestSignatureInputFile) or (not os.path.isfile(options.TestSignatureInputFile)): - logging.critical("Step2B Must have an Test Signature Input File when 2A is not enabled") - return -8487 - else: - #Step 2A enabled - if(options.TestSignatureInputFile): - logging.critical("Step2B can not have a Test Signature Input File when 2A is enabled") - return -8489 - - if(not options.Step1Enable): - #must have Step1s data file - if(not options.CertProvisionBlobAfterStep1File) or (not os.path.isfile(options.CertProvisionBlobAfterStep1File)): - logging.critical("Step2B must have a Cert Priovision Blob when Step 1 is not enabled") - return -8490 - - if(not options.Step2Enable): - #must have an output file - if(not options.Prep2BResultFile): - logging.critical("Step2B must have an output file (Prep2BResultFile) when Step2 is not enabled") - return -8491 - - - #Step 2 signing - if(options.Step2Enable): - logging.debug("Step 2 Enabled") - if(not options.SigningPfxFile): - logging.critical("Since Step2 is enabled you must supply a path to a PFX file for signing") - return -10 - - if(not options.Step1Enable) and ((not options.SigningInputFile) or (not os.path.isfile(options.SigningInputFile))): - logging.critical("For Step2 you must do Step1 or have a valid SigningInputFile") - return -4 - - if(not options.Step3Enable): - #must have output file - if(not options.SigningResultFile): - logging.critical("Since Step3 is not enabled there must be a SigningResultFile for the result") - return -5 - if(options.SigningResultFile): - logging.debug("Step2 Result will be written to: " + options.SigningResultFile) - - if(options.FinalizeInputDetachedSignatureFile): - logging.critical("Since Step2 is enabled an Input Detached signature file for Step3 is not allowed") - return -13 - - if(options.FinalizeInputFile): - logging.critical("Since Step2 is enabled an Input file for Step3 is not allowed") - return -14 - - #Step 3 Finalize - if(options.Step3Enable): - logging.debug("Step 3 Enabled") - - if(not options.Step2Enable) and (options.Step1Enable): - logging.critical("Can't have only Step1 and 3 Enabled") - return -12 - - if(not options.Step2Enable) and ((not options.FinalizeInputFile) or (not os.path.isfile(options.FinalizeInputFile)) or (not options.FinalizeInputDetachedSignatureFile) or (not os.path.isfile(options.FinalizeInputDetachedSignatureFile))): - logging.critical("For Step3 you must do Step2 or have a valid FinalizeInputFile and FinalizeInputDetachedSignatureFile") - return -6 - - #must have an output file - if(not options.FinalizeResultFile): - logging.critical("For Step3 you must have a FinalizeResultFile") - return -7 - else: - logging.debug("Step3 Result will be written to: " + options.FinalizeResultFile) - - tempdir = "_temp_" + str(time.time()) - logging.critical("Temp directory is: " + os.path.join(os.getcwd(), tempdir)) - os.makedirs(tempdir) - - #STEP 1 - Prep Var - if(options.Step1Enable): - logging.critical("Step1 Started") - Step1OutFile = os.path.join(tempdir, "Step1Out.bin") - SEM = CertProvisioningApplyVariable(None, int(options.HdrVersion)) - SEM.Identity = int(options.Identity); - - if (int(options.HdrVersion) == CertProvisioningApplyVariable.VERSION_V1): - SEM.SNTarget = int(options.SnTarget); - elif (int(options.HdrVersion) == CertProvisioningApplyVariable.VERSION_V2): - if options.SMBIOSMfg == None: - SEM.Manufacturer = "OEMSH" - else: - SEM.Manufacturer = options.SMBIOSMfg - - if options.SMBIOSProd == None: - SEM.ProductName = "OEMSH Product" - else: - SEM.ProductName = options.SMBIOSProd - - if options.SMBIOSSerial == None: - SEM.SerialNumber = "789789789" - else: - SEM.SerialNumber = options.SMBIOSSerial - - if is_32bit_number (options.Version ): - SEM.Version = options.Version - - if is_32bit_number (options.Lsv): - SEM.Lsv = options.Lsv - else: - logging.critical("Invalid Header Version specified") - return -31 - - if(options.CertFilePath != None): - a = open(options.CertFilePath, "rb") - SEM.TrustedCert = a.read() - a.close() - SEM.TrustedCertSize = os.path.getsize(options.CertFilePath) - - of = open(Step1OutFile, "wb") - SEM.Write(of) - of.close() - - #if user requested a step1 output file copy the temp file - if(options.PrepResultFile): - shutil.copy(Step1OutFile, options.PrepResultFile) - - #setup input for Step2 - options.SigningInputFile = Step1OutFile - #setup input for Step2B - options.CertProvisionBlobAfterStep1File = Step1OutFile - - #STEP 2A - Local Test Signature of Cert - if(options.Step2AEnable): - logging.critical("Step2A Started") - Step2AFileToSign = os.path.join(tempdir, "Step2AIn.bin") - Step2AOutFile = os.path.join(tempdir, "Step2AOut.bin") - shutil.copy(options.CertFilePath, Step2AFileToSign) - options.Signing2AOutputFile = Step2AOutFile - ret = TestSignSemTrustedCert(options) - if(ret != 0): - logging.critical("TestSignSemTrustedCert (Step2A) Failed: " + str(ret)) - return ret - - if(options.Signing2AResultFile): - shutil.copy(Step2AOutFile, options.Signing2AResultFile) - - #setup for step 2B - options.TestSignatureInputFile = Step2AOutFile - - #STEP 2B - Combine Cert Provision blob with Test signature - if(options.Step2BEnable): - logging.critical("Step2B Started") - Step2BOutFile = os.path.join(tempdir, "Step2BOut.bin") - fi = open(options.CertProvisionBlobAfterStep1File, "rb") - SEM = CertProvisioningApplyVariable(fi) - fi.close() - SEM.TestSignature = WinCertUefiGuid() - TestDetached = open(options.TestSignatureInputFile, "rb") - SEM.TestSignature.AddCertData(TestDetached) - TestDetached.close() - SemOut = open(Step2BOutFile, "wb") - SEM.Write(SemOut) - SemOut.close() - - if(options.Prep2BResultFile): - shutil.copy(Step2BOutFile, options.Prep2BResultFile) - - #Setup for Step2 - options.SigningInputFile = Step2BOutFile - - #STEP 2 - Local sign - if(options.Step2Enable): - logging.critical("Step2 Started") - #copy signinginputfile into temp dir - FileToSign = os.path.join(tempdir, "Step2In.bin") - shutil.copy(options.SigningInputFile, FileToSign) - options.SigningInputFile = FileToSign - options.SigningOutputFile = os.path.join(tempdir, "Step2Signature.bin") - - #do local signature - ret = SignSEMProvisionData(options) - if(ret != 0): - logging.critical("SignSEMProvisionData (Step2) Failed: " + str(ret)) - return ret - - if(options.SigningResultFile): - shutil.copy(options.SigningOutputFile, options.SigningResultFile) - - #setup input for Step3 - options.FinalizeInputFile = options.SigningInputFile - options.FinalizeInputDetachedSignatureFile = options.SigningOutputFile - - - #STEP 3 - Write Signature Structure and complete the KeyManifiest - if(options.Step3Enable): - logging.critical("Step3 Started") - sstep1file = open(options.FinalizeInputFile, "rb") - SEM = CertProvisioningApplyVariable(sstep1file) - sstep1file.close() - SEM.SessionId = random.randint(0, 4294967295) #generate a random session id - SEM.Signature = WinCertUefiGuid() - detached = open(options.FinalizeInputDetachedSignatureFile, "rb") - SEM.Signature.AddCertData(detached) - detached.close() - - if(not options.FinalizeResultFile): - options.FinalizeResultFile = os.path.join(tempdir, "Step3Out.bin") - - of = open(options.FinalizeResultFile, "wb") - SEM.Write(of) - of.close() - - if(not SEM.VerifyComplete()): - logging.critical("SEM Package Not complete") - return -84 - - # - # Function to print SEM - # - if(options.PrintFile) and (os.path.isfile(options.PrintFile)): - PrintSEM(options.PrintFile) - - if(options.PrintResultsFile) and (os.path.isfile(options.PrintResultsFile)): - PrintSEMResults(options.PrintResultsFile) - - if(options.PrintCurrentFile) and (os.path.isfile(options.PrintCurrentFile)): - PrintSEMCurrent(options.PrintCurrentFile) - - if(options.ExtractCertFile) and (os.path.isfile(options.ExtractCertFile)): - Thumbprint = ExtractCert(options.ExtractCertFile) - logging.critical(f"Extracted cert with thumbprint {Thumbprint}") - - #clean up if user didn't request to leave around - if(not options.dirty): - shutil.rmtree(tempdir) - - return 0 - - -if __name__ == '__main__': - #setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - #call main worker function - retcode = main() - - if retcode != 0: - logging.critical("Failed. Return Code: %i" % retcode) - #end logging - logging.shutdown() - sys.exit(retcode) +# @file +# +# Script to Generate a Device Firmware Configuration Interface Provisiong Blob +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +## +## Script to Generate a Device Firmware Configuration Interface Provisiong Blob +## This tool takes in a CER file in binary encoding, packages it in a +## DFCI_SIGNER_PROVISION_APPLY_VAR structure, signs it with the +## requested key, and then attaches the signature data in WIN_CERTIFICATE_UEFI_GUID format. +## +## This binary file can then be written to variable store: +## GUID: gDfciAuthProvisionVarNamespace +## NAME: DFCI_IDENTITY_APPLY_VAR_NAME L"DfciIdentityApply" +## +## THIS IS FOR UNIT TEST +## +## General process: +## Phase 1: Create payload file by combining relevant info +## Phase 2: Sign it using signtool +## Phase 3: Parse signature into WIN_CERT and package to create final output +## + +import os, sys +import argparse +import logging +import datetime +import struct +import shutil +import time +import random +import hashlib + +#get script path +sp = os.path.dirname(os.path.realpath(sys.argv[0])) + +#setup python path for build modules +sys.path.append(sp) + +from DFCI_SupportLib import DFCI_SupportLib + +from Data.CertProvisioningVariable import CertProvisioningApplyVariable +from Data.CertProvisioningVariable import CertProvisioningResultVariable +from edk2toollib.uefi.wincert import * +from edk2toollib.windows.locate_tools import FindToolInWinSdk +from edk2toollib.utility_functions import DetachedSignWithSignTool + +#PKCS7 Signed Data OID +gOid = "1.2.840.113549.1.7.2" +gPath2SignTool = None + +def PrintSEM(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = CertProvisioningApplyVariable(s) + s.close() + + #now print it out. + SEM.Print() + +def ExtractCert(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = CertProvisioningApplyVariable(s) + s.close() + + #now write the certificate out. + (certtype, a, b) = SEM.GetCertType().partition(' ') + + certfilename = os.path.basename(filepath) + "_" + certtype + ".cer" + s = open(certfilename, "wb") + SEM.WriteCert(s) + s.close() + s = open(certfilename, "rb") + m = hashlib.new("sha1",s.read()) + s.close() + + # return the sha1 (Thumbprint) of the certificate. + return m.digest().hex() + +def PrintSEMCurrent(filepath): + if(filepath and os.path.isfile(filepath)): + outfilename = os.path.basename(filepath) + "_Current" + ".xml" + a = DFCI_SupportLib () + a.extract_payload_from_current(filepath, outfilename) + +def PrintSEMResults(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = CertProvisioningResultVariable(s) + s.close() + + #now print it out. + SEM.Print() + +def SignSEMProvisionData(options): + global gPath2SignTool + if gPath2SignTool == None: + a = DFCI_SupportLib () + gPath2SignTool = a.get_signtool_path () + + logging.critical("Signing Started") + logging.critical(options.SigningInputFile) + logging.critical(options.SigningOutputFile) + logging.critical(options.SigningPfxFile) + + return DetachedSignWithSignTool (gPath2SignTool, options.SigningInputFile, options.SigningOutputFile, options.SigningPfxFile, options.SigningPfxPw, gOid) + +def TestSignSemTrustedCert(options): + global gPath2SignTool + if gPath2SignTool == None: + a = DFCI_SupportLib () + gPath2SignTool = a.get_signtool_path () + + logging.critical("Signing Started") + logging.critical(gPath2SignTool) + logging.critical(options.CertFilePath) + logging.critical(options.Signing2AOutputFile) + logging.critical(options.Signing2APfxFile) + + return DetachedSignWithSignTool (gPath2SignTool, options.CertFilePath, options.Signing2AOutputFile, options.Signing2APfxFile, options.Signing2APfxPw, gOid) + +def is_32bit_number(s): + try: + float(s) + if s < 4294967296: + return True + else: + return False + except ValueError: + return False + + +# +#main script function +# +def main(): + parser = argparse.ArgumentParser(description='Create SEM Provisioning Cert') + + #Output debug log + parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) + parser.add_argument("-p", dest="PrintFile", help="Print File as Provisioning Blob", default= None) + parser.add_argument("-pr", dest="PrintResultsFile", help="Print Result File as Identity Blob", default= None) + parser.add_argument("-pc", dest="PrintCurrentFile", help="Print Current File as {basename}_Current.xml", default= None) + parser.add_argument("-xc", dest="ExtractCertFile", help="Extract the certificate to {basename}_{certtype}.cer", default=None) + parser.add_argument("--dirty", action="store_true", dest="dirty", help="Leave around the temp files after finished", default=False) + + Step1Group = parser.add_argument_group(title="Step1", description="Signed Data Prep. Build data structure.") + Step1Group.add_argument("--Step1Enable", dest="Step1Enable", help="Do Step 1 - Signed Data Prep", default=False, action="store_true") + Step1Group.add_argument("--Identity", dest="Identity", help="Identity (Owner=1, User=2, User1=3, User2=4, Ztc=5). Default is Owner", default=1) + Step1Group.add_argument("--SnTarget", dest="SnTarget", help="Target to only a device with given Serial Number in decimal. Zero means all devices", default=0) + Step1Group.add_argument("--CertFilePath", dest="CertFilePath", help="Path to binary DER Cert", default=None) + Step1Group.add_argument("--PrepResultFile", dest="PrepResultFile", help="Optional File for output from Step1. Required if not doing step2 or step2A", default=None) + Step1Group.add_argument("--HdrVersion", dest="HdrVersion", help="Specify packet version", default=CertProvisioningApplyVariable.VERSION_V1) + Step1Group.add_argument("--SMBIOSMfg", dest="SMBIOSMfg", help="Specify SMBIOS Manufacturer", default=None) + Step1Group.add_argument("--SMBIOSProd", dest="SMBIOSProd", help="Specify SMBIOS Product Name", default=None) + Step1Group.add_argument("--SMBIOSSerial", dest="SMBIOSSerial", help="Specify SMBIOS Serial Number", default=None) + Step1Group.add_argument("--Version", dest="Version", help="Specify Identity version", default=0) + Step1Group.add_argument("--Lsv", dest="Lsv", help="Specify the lowest supported version", default=0) + + Step2AGroup = parser.add_argument_group(title="Step2A", description="Test Signature Generation Step.") + Step2AGroup.add_argument("--Step2AEnable", dest="Step2AEnable", help="Do Step 2A - Local Signing for Test Signature", default=False, action="store_true") + #need to add arguments here for signing. + Step2AGroup.add_argument("--Signing2AResultFile", dest="Signing2AResultFile", help="Optional File for output from Step2A. Required if not doing step2B", default=None) + Step2AGroup.add_argument("--Signing2APfxFile", dest="Signing2APfxFile", help="Path to PFX file for signing Test Signature ", default=None) + Step2AGroup.add_argument("--Signing2APfxPw", dest="Signing2APfxPw", help="Optional Password for PFX file for signing Test Signature", default=None) + + Step2BGroup = parser.add_argument_group(title="Step2B", description="Package Cert Provision With Test Signature.") + Step2BGroup.add_argument("--Step2BEnable", dest="Step2BEnable", help="Do Step 2B - Package Test Signature with Cert Provision Data", default=False, action="store_true") + Step2BGroup.add_argument("--TestSignatureInputFile", dest="TestSignatureInputFile", help="Detached Signature file for Test Signature", default=None) + Step2BGroup.add_argument("--CertProvisionBlobInputFile", dest="CertProvisionBlobAfterStep1File", help="Step1 Output File to use as Input to combine with Test Signature", default=None) + Step2BGroup.add_argument("--Prep2BResultFile", dest="Prep2BResultFile", help="Optional File for output from Step2B. Required if not doing step2", default=None) + + + Step2Group = parser.add_argument_group(title="Step2", description="Signature Generation Step.") + Step2Group.add_argument("--Step2Enable", dest="Step2Enable", help="Do Step 2 - Local Signing", default=False, action="store_true") + #need to add arguments here for signing. + Step2Group.add_argument("--SigningInputFile", dest="SigningInputFile", help="Optional File for intput for Step2. Required if not doing step1", default=None) + Step2Group.add_argument("--SigningResultFile", dest="SigningResultFile", help="Optional File for output from Step2. Required if not doing step3", default=None) + Step2Group.add_argument("--SigningPfxFile", dest="SigningPfxFile", help="Path to PFX file for signing", default=None) + Step2Group.add_argument("--SigningPfxPw", dest="SigningPfxPw", help="Optional Password for PFX file for signing", default=None) + + Step3Group = parser.add_argument_group(title="Step3", description="Final Provisioning Var Construction.") + Step3Group.add_argument("--Step3Enable", dest="Step3Enable", help="Do Step 3 - Final Provisioning Var Construction", default=False, action="store_true") + Step3Group.add_argument("--FinalizeInputFile", dest="FinalizeInputFile", help="Optional if doing Step2. Generally Step1 Output or Step2 input. ", default=None) + Step3Group.add_argument("--FinalizeInputDetachedSignatureFile", dest="FinalizeInputDetachedSignatureFile", help="Signtool Detached Signature File. Optional if doing Step2", default=None) + Step3Group.add_argument("--FinalizeResultFile", dest="FinalizeResultFile", help="File for output from Step3. Complete SEM Provisioning Var File.", default=None) + + + #Turn on debug level logging + parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) + options = parser.parse_args() + + #setup file based logging if outputReport specified + if(options.OutputLog): + if(len(options.OutputLog) < 2): + logging.critical("the output log file parameter is invalid") + return -2 + else: + #setup file based logging + filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') + if(options.debug): + filelogger.setLevel(logging.DEBUG) + else: + filelogger.setLevel(logging.INFO) + + filelogger.setFormatter(formatter) + logging.getLogger('').addHandler(filelogger) + + logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) + + #Step 1 Prep + if(options.Step1Enable): + logging.debug("Step 1 Enabled") + if(not options.CertFilePath) or (not os.path.isfile(options.CertFilePath)): + logging.critical("Not CertFilePath. That means we are un-enrolling") + + if(not options.Step2Enable) and (not options.Step2AEnable): + #must have output file + if(not options.PrepResultFile): + logging.critical("Since Step2A/2 is not enabled there must be a PrepResultFile for the result") + return -3 + + if(options.PrepResultFile): + logging.debug("Step 1 Result will be written to: " + options.PrepResultFile) + + if(options.SigningInputFile): + logging.critical("Since Step1 is enabled an Input File for Step2 is not allowed") + return -11 + + #Step 2A Test Signature Generation + if(options.Step2AEnable): + logging.debug("Step 2A Enabled") + if(not options.CertFilePath) or (not os.path.isfile(options.CertFilePath)): + logging.debug("Not CertFilePath. That means we are un-enrolling") + logging.critical("Step 2A should not be enabled if un-enrolling") + return -847 + + if(not options.Signing2APfxFile): + logging.critical("Since Step2A is enabled you must supply a path to a PFX file for test signing") + return -848 + + if(not options.Step2BEnable): + #must have output file + if(not options.Signing2AResultFile): + logging.critical("Since Step2B is not enabled there must be a Signing2AResultFile for the result") + return -5 + + if(options.Signing2AResultFile): + logging.debug("Step2A Result will be written to: " + options.Signing2AResultFile) + + #Step2B Combine Step1 and Step2A into Single File in prep for Step2 + if(options.Step2BEnable): + logging.debug("Step 2B Enabled") + if(not options.Step2AEnable): + #must have Test Signature Input File + if(not options.TestSignatureInputFile) or (not os.path.isfile(options.TestSignatureInputFile)): + logging.critical("Step2B Must have an Test Signature Input File when 2A is not enabled") + return -8487 + else: + #Step 2A enabled + if(options.TestSignatureInputFile): + logging.critical("Step2B can not have a Test Signature Input File when 2A is enabled") + return -8489 + + if(not options.Step1Enable): + #must have Step1s data file + if(not options.CertProvisionBlobAfterStep1File) or (not os.path.isfile(options.CertProvisionBlobAfterStep1File)): + logging.critical("Step2B must have a Cert Priovision Blob when Step 1 is not enabled") + return -8490 + + if(not options.Step2Enable): + #must have an output file + if(not options.Prep2BResultFile): + logging.critical("Step2B must have an output file (Prep2BResultFile) when Step2 is not enabled") + return -8491 + + + #Step 2 signing + if(options.Step2Enable): + logging.debug("Step 2 Enabled") + if(not options.SigningPfxFile): + logging.critical("Since Step2 is enabled you must supply a path to a PFX file for signing") + return -10 + + if(not options.Step1Enable) and ((not options.SigningInputFile) or (not os.path.isfile(options.SigningInputFile))): + logging.critical("For Step2 you must do Step1 or have a valid SigningInputFile") + return -4 + + if(not options.Step3Enable): + #must have output file + if(not options.SigningResultFile): + logging.critical("Since Step3 is not enabled there must be a SigningResultFile for the result") + return -5 + if(options.SigningResultFile): + logging.debug("Step2 Result will be written to: " + options.SigningResultFile) + + if(options.FinalizeInputDetachedSignatureFile): + logging.critical("Since Step2 is enabled an Input Detached signature file for Step3 is not allowed") + return -13 + + if(options.FinalizeInputFile): + logging.critical("Since Step2 is enabled an Input file for Step3 is not allowed") + return -14 + + #Step 3 Finalize + if(options.Step3Enable): + logging.debug("Step 3 Enabled") + + if(not options.Step2Enable) and (options.Step1Enable): + logging.critical("Can't have only Step1 and 3 Enabled") + return -12 + + if(not options.Step2Enable) and ((not options.FinalizeInputFile) or (not os.path.isfile(options.FinalizeInputFile)) or (not options.FinalizeInputDetachedSignatureFile) or (not os.path.isfile(options.FinalizeInputDetachedSignatureFile))): + logging.critical("For Step3 you must do Step2 or have a valid FinalizeInputFile and FinalizeInputDetachedSignatureFile") + return -6 + + #must have an output file + if(not options.FinalizeResultFile): + logging.critical("For Step3 you must have a FinalizeResultFile") + return -7 + else: + logging.debug("Step3 Result will be written to: " + options.FinalizeResultFile) + + tempdir = "_temp_" + str(time.time()) + logging.critical("Temp directory is: " + os.path.join(os.getcwd(), tempdir)) + os.makedirs(tempdir) + + #STEP 1 - Prep Var + if(options.Step1Enable): + logging.critical("Step1 Started") + Step1OutFile = os.path.join(tempdir, "Step1Out.bin") + SEM = CertProvisioningApplyVariable(None, int(options.HdrVersion)) + SEM.Identity = int(options.Identity); + + if (int(options.HdrVersion) == CertProvisioningApplyVariable.VERSION_V1): + SEM.SNTarget = int(options.SnTarget); + elif (int(options.HdrVersion) == CertProvisioningApplyVariable.VERSION_V2): + if options.SMBIOSMfg == None: + SEM.Manufacturer = "OEMSH" + else: + SEM.Manufacturer = options.SMBIOSMfg + + if options.SMBIOSProd == None: + SEM.ProductName = "OEMSH Product" + else: + SEM.ProductName = options.SMBIOSProd + + if options.SMBIOSSerial == None: + SEM.SerialNumber = "789789789" + else: + SEM.SerialNumber = options.SMBIOSSerial + + if is_32bit_number (options.Version ): + SEM.Version = options.Version + + if is_32bit_number (options.Lsv): + SEM.Lsv = options.Lsv + else: + logging.critical("Invalid Header Version specified") + return -31 + + if(options.CertFilePath != None): + a = open(options.CertFilePath, "rb") + SEM.TrustedCert = a.read() + a.close() + SEM.TrustedCertSize = os.path.getsize(options.CertFilePath) + + of = open(Step1OutFile, "wb") + SEM.Write(of) + of.close() + + #if user requested a step1 output file copy the temp file + if(options.PrepResultFile): + shutil.copy(Step1OutFile, options.PrepResultFile) + + #setup input for Step2 + options.SigningInputFile = Step1OutFile + #setup input for Step2B + options.CertProvisionBlobAfterStep1File = Step1OutFile + + #STEP 2A - Local Test Signature of Cert + if(options.Step2AEnable): + logging.critical("Step2A Started") + Step2AFileToSign = os.path.join(tempdir, "Step2AIn.bin") + Step2AOutFile = os.path.join(tempdir, "Step2AOut.bin") + shutil.copy(options.CertFilePath, Step2AFileToSign) + options.Signing2AOutputFile = Step2AOutFile + ret = TestSignSemTrustedCert(options) + if(ret != 0): + logging.critical("TestSignSemTrustedCert (Step2A) Failed: " + str(ret)) + return ret + + if(options.Signing2AResultFile): + shutil.copy(Step2AOutFile, options.Signing2AResultFile) + + #setup for step 2B + options.TestSignatureInputFile = Step2AOutFile + + #STEP 2B - Combine Cert Provision blob with Test signature + if(options.Step2BEnable): + logging.critical("Step2B Started") + Step2BOutFile = os.path.join(tempdir, "Step2BOut.bin") + fi = open(options.CertProvisionBlobAfterStep1File, "rb") + SEM = CertProvisioningApplyVariable(fi) + fi.close() + SEM.TestSignature = WinCertUefiGuid() + TestDetached = open(options.TestSignatureInputFile, "rb") + SEM.TestSignature.AddCertData(TestDetached) + TestDetached.close() + SemOut = open(Step2BOutFile, "wb") + SEM.Write(SemOut) + SemOut.close() + + if(options.Prep2BResultFile): + shutil.copy(Step2BOutFile, options.Prep2BResultFile) + + #Setup for Step2 + options.SigningInputFile = Step2BOutFile + + #STEP 2 - Local sign + if(options.Step2Enable): + logging.critical("Step2 Started") + #copy signinginputfile into temp dir + FileToSign = os.path.join(tempdir, "Step2In.bin") + shutil.copy(options.SigningInputFile, FileToSign) + options.SigningInputFile = FileToSign + options.SigningOutputFile = os.path.join(tempdir, "Step2Signature.bin") + + #do local signature + ret = SignSEMProvisionData(options) + if(ret != 0): + logging.critical("SignSEMProvisionData (Step2) Failed: " + str(ret)) + return ret + + if(options.SigningResultFile): + shutil.copy(options.SigningOutputFile, options.SigningResultFile) + + #setup input for Step3 + options.FinalizeInputFile = options.SigningInputFile + options.FinalizeInputDetachedSignatureFile = options.SigningOutputFile + + + #STEP 3 - Write Signature Structure and complete the KeyManifiest + if(options.Step3Enable): + logging.critical("Step3 Started") + sstep1file = open(options.FinalizeInputFile, "rb") + SEM = CertProvisioningApplyVariable(sstep1file) + sstep1file.close() + SEM.SessionId = random.randint(0, 4294967295) #generate a random session id + SEM.Signature = WinCertUefiGuid() + detached = open(options.FinalizeInputDetachedSignatureFile, "rb") + SEM.Signature.AddCertData(detached) + detached.close() + + if(not options.FinalizeResultFile): + options.FinalizeResultFile = os.path.join(tempdir, "Step3Out.bin") + + of = open(options.FinalizeResultFile, "wb") + SEM.Write(of) + of.close() + + if(not SEM.VerifyComplete()): + logging.critical("SEM Package Not complete") + return -84 + + # + # Function to print SEM + # + if(options.PrintFile) and (os.path.isfile(options.PrintFile)): + PrintSEM(options.PrintFile) + + if(options.PrintResultsFile) and (os.path.isfile(options.PrintResultsFile)): + PrintSEMResults(options.PrintResultsFile) + + if(options.PrintCurrentFile) and (os.path.isfile(options.PrintCurrentFile)): + PrintSEMCurrent(options.PrintCurrentFile) + + if(options.ExtractCertFile) and (os.path.isfile(options.ExtractCertFile)): + Thumbprint = ExtractCert(options.ExtractCertFile) + logging.critical(f"Extracted cert with thumbprint {Thumbprint}") + + #clean up if user didn't request to leave around + if(not options.dirty): + shutil.rmtree(tempdir) + + return 0 + + +if __name__ == '__main__': + #setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + #call main worker function + retcode = main() + + if retcode != 0: + logging.critical("Failed. Return Code: %i" % retcode) + #end logging + logging.shutdown() + sys.exit(retcode) diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/GeneratePermissionPacketData.py b/DfciPkg/UnitTests/DfciTests/Support/Python/GeneratePermissionPacketData.py index 1225949dbd..5b09af016e 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/GeneratePermissionPacketData.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/GeneratePermissionPacketData.py @@ -1,339 +1,339 @@ -# @file -# -# Script to Generate a Device Firmware Configuration Interface Permission Provisiong Blob -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -## -## Script to Generate a Device Firmware Configuration Interface Permission Provisiong Blob -## This tool takes in a XML file in PermissionPacket format, packages it in a -## DFCI_PERMISSION_POLICY_APPLY_VAR structure, signs it with the -## requested key, and then attaches the signature data in WIN_CERTIFICATE_UEFI_GUID format. -## -## This binary file can then be written to variable store: -## GUID: gDfciPermissionManagerVarNamespace -## NAME: DFCI_PERMISSION_POLICY_APPLY_VAR_NAME L"DfciPermissionApply" -## -## THIS IS FOR UNIT TEST -## -## General process: -## Phase 1: Create payload file by combining relevant info -## Phase 2: Sign it using signtool -## Phase 3: Parse signature into WIN_CERT and package to create final output -## - -import os, sys -import argparse -import logging -import datetime -import struct -import shutil -import time -import random - -#get script path -sp = os.path.dirname(os.path.realpath(sys.argv[0])) - -#setup python path for build modules -sys.path.append(sp) - -from DFCI_SupportLib import DFCI_SupportLib - -from edk2toollib.uefi.wincert import * -from edk2toollib.utility_functions import DetachedSignWithSignTool -from edk2toollib.windows.locate_tools import FindToolInWinSdk -from Data.PermissionPacketVariable import PermissionApplyVariable -from Data.PermissionPacketVariable import PermissionResultVariable - - -#PKCS7 Signed Data OID -gOid = "1.2.840.113549.1.7.2" -gPath2SignTool = None - - -def PrintSEM(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = PermissionApplyVariable(s) - s.close() - - #now print it out. - SEM.Print() - -def PrintSEMResults(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = PermissionResultVariable(s) - s.close() - - #now print it out. - SEM.Print() - -def PrintSEMCurrent(filepath): - if(filepath and os.path.isfile(filepath)): - outfilename = os.path.basename(filepath) + "_Current" + ".xml" - a = DFCI_SupportLib () - a.extract_payload_from_current(filepath, outfilename) - -def SignSEMData(options): - global gPath2SignTool - if gPath2SignTool == None: - a = DFCI_SupportLib () - gPath2SignTool = a.get_signtool_path () - - return DetachedSignWithSignTool (gPath2SignTool, options.SigningInputFile, options.SigningOutputFile, options.SigningPfxFile, options.SigningPfxPw, gOid) - -# -#main script function -# -def main(): - parser = argparse.ArgumentParser(description='Create SEM Permission Packet Variable') - - #Output debug log - parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) - parser.add_argument("-p", dest="PrintFile", help="Print File as Permission Blob", default= None) - parser.add_argument("-pr", dest="PrintResultsFile", help="Print Result File as Permission Blob", default= None) - parser.add_argument("-pc", dest="PrintCurrentFile", help="Print Current File to {basename}_Current.xml", default= None) - parser.add_argument("--dirty", action="store_true", dest="dirty", help="Leave around the temp files after finished", default=False) - - Step1Group = parser.add_argument_group(title="Step1", description="Signed Data Prep. Build data structure.") - Step1Group.add_argument("--Step1Enable", dest="Step1Enable", help="Do Step 1 - Signed Data Prep", default=False, action="store_true") - Step1Group.add_argument("--SnTarget", dest="SnTarget", help="Target to only a device with given Serial Number in decimal. Zero means all devices", default=0) - Step1Group.add_argument("--XmlFilePath", dest="XmlFilePath", help="Path to Xml Permission Packet File", default=None) - Step1Group.add_argument("--PrepResultFile", dest="PrepResultFile", help="Optional File for output from Step1. Required if not doing step2", default=None) - Step1Group.add_argument("--HdrVersion", dest="HdrVersion", help="Specify packet version", default= PermissionApplyVariable.VERSION_V1) - Step1Group.add_argument("--SMBIOSMfg", dest="SMBIOSMfg", help="Specify SMBIOS Manufacturer", default=None) - Step1Group.add_argument("--SMBIOSProd", dest="SMBIOSProd", help="Specify SMBIOS Product Name", default=None) - Step1Group.add_argument("--SMBIOSSerial", dest="SMBIOSSerial", help="Specify SMBIOS Serial Number", default=None) - - Step2Group = parser.add_argument_group(title="Step2", description="Signature Generation Step.") - Step2Group.add_argument("--Step2Enable", dest="Step2Enable", help="Do Step 2 - Local Signing", default=False, action="store_true") - #need to add arguments here for signing. signtool path and parameters - Step2Group.add_argument("--SigningInputFile", dest="SigningInputFile", help="Optional File for intput for Step2. Required if not doing step1", default=None) - Step2Group.add_argument("--SigningResultFile", dest="SigningResultFile", help="Optional File for output from Step2. Required if not doing step3", default=None) - Step2Group.add_argument("--SigningPfxFile", dest="SigningPfxFile", help="Path to PFX file for signing", default=None) - Step2Group.add_argument("--SigningPfxPw", dest="SigningPfxPw", help="Optional Password for PFX file for signing", default=None) - - Step3Group = parser.add_argument_group(title="Step3", description="Final Var Construction.") - Step3Group.add_argument("--Step3Enable", dest="Step3Enable", help="Do Step 3 - Final Provisioning Var Construction", default=False, action="store_true") - Step3Group.add_argument("--FinalizeInputFile", dest="FinalizeInputFile", help="Optional if doing Step2. Generally Step1 Output or Step2 input. ", default=None) - Step3Group.add_argument("--FinalizeInputDetachedSignatureFile", dest="FinalizeInputDetachedSignatureFile", help="Signtool Detached Signature File. Optional if doing Step2", default=None) - Step3Group.add_argument("--FinalizeResultFile", dest="FinalizeResultFile", help="File for output from Step3. Complete SEM Provisioning Var File.", default=None) - - #Turn on debug level logging - parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) - options = parser.parse_args() - - #setup file based logging if outputReport specified - if(options.OutputLog): - if(len(options.OutputLog) < 2): - logging.critical("the output log file parameter is invalid") - return -2 - else: - #setup file based logging - filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') - if(options.debug): - filelogger.setLevel(logging.DEBUG) - else: - filelogger.setLevel(logging.INFO) - - filelogger.setFormatter(formatter) - logging.getLogger('').addHandler(filelogger) - - logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) - - #Step 1 Prep - if(options.Step1Enable): - logging.debug("Step 1 Enabled") - if(not options.XmlFilePath) or (not os.path.isfile(options.XmlFilePath)): - logging.critical("For Step1 there must be a valid XML Permission file") - return -2 - - if(not options.Step2Enable): - #must have output file - if(not options.PrepResultFile): - logging.critical("Since Step2 is not enabled there must be a PrepResultFile for the result") - return -3 - - if(options.PrepResultFile): - logging.debug("Step 1 Result will be written to: " + options.PrepResultFile) - - if(options.SigningInputFile): - logging.critical("Since Step1 is enabled an Input File for Step2 is not allowed") - return -11 - - #Step 2 signing - if(options.Step2Enable): - logging.debug("Step 2 Enabled") - if(not options.SigningPfxFile): - logging.critical("Since Step2 is enabled you must supply a path to a PFX file for signing") - return -10 - - if(not options.Step1Enable) and ((not options.SigningInputFile) or (not os.path.isfile(options.SigningInputFile))): - logging.critical("For Step2 you must do Step1 or have a valid SigningInputFile") - return -4 - - if(not options.Step3Enable): - #must have output file - if(not options.SigningResultFile): - logging.critical("Since Step3 is not enabled there must be a SigningResultFile for the result") - return -5 - if(options.SigningResultFile): - logging.debug("Step2 Result will be written to: " + options.SigningResultFile) - - if(options.FinalizeInputDetachedSignatureFile): - logging.critical("Since Step2 is enabled an Input Detached signature file for Step3 is not allowed") - return -13 - - if(options.FinalizeInputFile): - logging.critical("Since Step2 is enabled an Input file for Step3 is not allowed") - return -14 - - #Step 3 Finalize - if(options.Step3Enable): - logging.debug("Step 3 Enabled") - - if(not options.Step2Enable) and (options.Step1Enable): - logging.critical("Can't have only Step1 and 3 Enabled") - return -12 - - if(not options.Step2Enable) and ((not options.FinalizeInputFile) or (not os.path.isfile(options.FinalizeInputFile)) or (not options.FinalizeInputDetachedSignatureFile) or (not os.path.isfile(options.FinalizeInputDetachedSignatureFile))): - logging.critical("For Step3 you must do Step2 or have a valid FinalizeInputFile and FinalizeInputDetachedSignatureFile") - return -6 - - #must have an output file - if(not options.FinalizeResultFile): - logging.critical("For Step3 you must have a FinalizeResultFile") - return -7 - else: - logging.debug("Step3 Result will be written to: " + options.FinalizeResultFile) - - - tempdir = "_temp_" + str(time.time()) - logging.critical("Temp directory is: " + os.path.join(os.getcwd(), tempdir)) - os.makedirs(tempdir) - - #STEP 1 - Prep Var - if(options.Step1Enable): - logging.critical("Step1 Started") - Step1OutFile = os.path.join(tempdir, "Step1Out.bin") - SEM = PermissionApplyVariable(None, int(options.HdrVersion)) - - if (int(options.HdrVersion) == PermissionApplyVariable.VERSION_V1): - SEM.SNTarget = int(options.SnTarget); - elif (int(options.HdrVersion) == PermissionApplyVariable.VERSION_V2): - if options.SMBIOSMfg == None: - SEM.Manufacturer = "OEMSH" - else: - SEM.Manufacturer = options.SMBIOSMfg - - if options.SMBIOSProd == None: - SEM.ProductName = "OEMSH Product" - else: - SEM.ProductName = options.SMBIOSProd - - if options.SMBIOSSerial == None: - SEM.SerialNumber = "789789789" - else: - SEM.SerialNumber = options.SMBIOSSerial - else: - logging.critical("Invalid header version specified") - return -31 - - a = open(options.XmlFilePath, "r") - SEM.AddXmlPayload(a.read()) - a.close() - - of = open(Step1OutFile, "wb") - SEM.Write(of) - of.close() - - #if user requested a step1 output file copy the temp file - if(options.PrepResultFile): - shutil.copy(Step1OutFile, options.PrepResultFile) - - #setup input for Step2 - options.SigningInputFile = Step1OutFile - - - #STEP 2 - Local sign - if(options.Step2Enable): - logging.critical("Step2 Started") - #copy signinginputfile into temp dir - FileToSign = os.path.join(tempdir, "Step2In.bin") - shutil.copy(options.SigningInputFile, FileToSign) - options.SigningInputFile = FileToSign - options.SigningOutputFile = os.path.join(tempdir, "Step2Signature.bin") - - #do local signature - ret = SignSEMData(options) - if(ret != 0): - logging.critical("SignSEMData (Step2) Failed: " + str(ret)) - return ret - - if(options.SigningResultFile): - shutil.copy(options.SigningOutputFile, options.SigningResultFile) - - #setup input for Step3 - options.FinalizeInputFile = options.SigningInputFile - options.FinalizeInputDetachedSignatureFile = options.SigningOutputFile - - - #STEP 3 - Write Signature Structure and complete file - if(options.Step3Enable): - logging.critical("Step3 Started") - sstep1file = open(options.FinalizeInputFile, "rb") - SEM = PermissionApplyVariable(sstep1file) - sstep1file.close() - SEM.Signature = WinCertUefiGuid() - detached = open(options.FinalizeInputDetachedSignatureFile, "rb") - SEM.Signature.AddCertData(detached) - detached.close() - SEM.SessionId = random.randint(0, 4294967295) #generate a random session id - - if(not options.FinalizeResultFile): - options.FinalizeResultFile = os.path.join(tempdir, "Step3Out.bin") - - of = open(options.FinalizeResultFile, "wb") - SEM.Write(of) - of.close() - - # - # Function to print SEM - # - if(options.PrintFile) and (os.path.isfile(options.PrintFile)): - PrintSEM(options.PrintFile) - - if(options.PrintResultsFile) and (os.path.isfile(options.PrintResultsFile)): - PrintSEMResults(options.PrintResultsFile) - - if(options.PrintCurrentFile) and (os.path.isfile(options.PrintCurrentFile)): - PrintSEMCurrent(options.PrintCurrentFile) - - #clean up if user didn't request to leave around - if(not options.dirty): - shutil.rmtree(tempdir) - - return 0 - - -if __name__ == '__main__': - #setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - #call main worker function - retcode = main() - - if retcode != 0: - logging.critical("Failed. Return Code: %i" % retcode) - #end logging - logging.shutdown() - sys.exit(retcode) +# @file +# +# Script to Generate a Device Firmware Configuration Interface Permission Provisiong Blob +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +## +## Script to Generate a Device Firmware Configuration Interface Permission Provisiong Blob +## This tool takes in a XML file in PermissionPacket format, packages it in a +## DFCI_PERMISSION_POLICY_APPLY_VAR structure, signs it with the +## requested key, and then attaches the signature data in WIN_CERTIFICATE_UEFI_GUID format. +## +## This binary file can then be written to variable store: +## GUID: gDfciPermissionManagerVarNamespace +## NAME: DFCI_PERMISSION_POLICY_APPLY_VAR_NAME L"DfciPermissionApply" +## +## THIS IS FOR UNIT TEST +## +## General process: +## Phase 1: Create payload file by combining relevant info +## Phase 2: Sign it using signtool +## Phase 3: Parse signature into WIN_CERT and package to create final output +## + +import os, sys +import argparse +import logging +import datetime +import struct +import shutil +import time +import random + +#get script path +sp = os.path.dirname(os.path.realpath(sys.argv[0])) + +#setup python path for build modules +sys.path.append(sp) + +from DFCI_SupportLib import DFCI_SupportLib + +from edk2toollib.uefi.wincert import * +from edk2toollib.utility_functions import DetachedSignWithSignTool +from edk2toollib.windows.locate_tools import FindToolInWinSdk +from Data.PermissionPacketVariable import PermissionApplyVariable +from Data.PermissionPacketVariable import PermissionResultVariable + + +#PKCS7 Signed Data OID +gOid = "1.2.840.113549.1.7.2" +gPath2SignTool = None + + +def PrintSEM(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = PermissionApplyVariable(s) + s.close() + + #now print it out. + SEM.Print() + +def PrintSEMResults(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = PermissionResultVariable(s) + s.close() + + #now print it out. + SEM.Print() + +def PrintSEMCurrent(filepath): + if(filepath and os.path.isfile(filepath)): + outfilename = os.path.basename(filepath) + "_Current" + ".xml" + a = DFCI_SupportLib () + a.extract_payload_from_current(filepath, outfilename) + +def SignSEMData(options): + global gPath2SignTool + if gPath2SignTool == None: + a = DFCI_SupportLib () + gPath2SignTool = a.get_signtool_path () + + return DetachedSignWithSignTool (gPath2SignTool, options.SigningInputFile, options.SigningOutputFile, options.SigningPfxFile, options.SigningPfxPw, gOid) + +# +#main script function +# +def main(): + parser = argparse.ArgumentParser(description='Create SEM Permission Packet Variable') + + #Output debug log + parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) + parser.add_argument("-p", dest="PrintFile", help="Print File as Permission Blob", default= None) + parser.add_argument("-pr", dest="PrintResultsFile", help="Print Result File as Permission Blob", default= None) + parser.add_argument("-pc", dest="PrintCurrentFile", help="Print Current File to {basename}_Current.xml", default= None) + parser.add_argument("--dirty", action="store_true", dest="dirty", help="Leave around the temp files after finished", default=False) + + Step1Group = parser.add_argument_group(title="Step1", description="Signed Data Prep. Build data structure.") + Step1Group.add_argument("--Step1Enable", dest="Step1Enable", help="Do Step 1 - Signed Data Prep", default=False, action="store_true") + Step1Group.add_argument("--SnTarget", dest="SnTarget", help="Target to only a device with given Serial Number in decimal. Zero means all devices", default=0) + Step1Group.add_argument("--XmlFilePath", dest="XmlFilePath", help="Path to Xml Permission Packet File", default=None) + Step1Group.add_argument("--PrepResultFile", dest="PrepResultFile", help="Optional File for output from Step1. Required if not doing step2", default=None) + Step1Group.add_argument("--HdrVersion", dest="HdrVersion", help="Specify packet version", default= PermissionApplyVariable.VERSION_V1) + Step1Group.add_argument("--SMBIOSMfg", dest="SMBIOSMfg", help="Specify SMBIOS Manufacturer", default=None) + Step1Group.add_argument("--SMBIOSProd", dest="SMBIOSProd", help="Specify SMBIOS Product Name", default=None) + Step1Group.add_argument("--SMBIOSSerial", dest="SMBIOSSerial", help="Specify SMBIOS Serial Number", default=None) + + Step2Group = parser.add_argument_group(title="Step2", description="Signature Generation Step.") + Step2Group.add_argument("--Step2Enable", dest="Step2Enable", help="Do Step 2 - Local Signing", default=False, action="store_true") + #need to add arguments here for signing. signtool path and parameters + Step2Group.add_argument("--SigningInputFile", dest="SigningInputFile", help="Optional File for intput for Step2. Required if not doing step1", default=None) + Step2Group.add_argument("--SigningResultFile", dest="SigningResultFile", help="Optional File for output from Step2. Required if not doing step3", default=None) + Step2Group.add_argument("--SigningPfxFile", dest="SigningPfxFile", help="Path to PFX file for signing", default=None) + Step2Group.add_argument("--SigningPfxPw", dest="SigningPfxPw", help="Optional Password for PFX file for signing", default=None) + + Step3Group = parser.add_argument_group(title="Step3", description="Final Var Construction.") + Step3Group.add_argument("--Step3Enable", dest="Step3Enable", help="Do Step 3 - Final Provisioning Var Construction", default=False, action="store_true") + Step3Group.add_argument("--FinalizeInputFile", dest="FinalizeInputFile", help="Optional if doing Step2. Generally Step1 Output or Step2 input. ", default=None) + Step3Group.add_argument("--FinalizeInputDetachedSignatureFile", dest="FinalizeInputDetachedSignatureFile", help="Signtool Detached Signature File. Optional if doing Step2", default=None) + Step3Group.add_argument("--FinalizeResultFile", dest="FinalizeResultFile", help="File for output from Step3. Complete SEM Provisioning Var File.", default=None) + + #Turn on debug level logging + parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) + options = parser.parse_args() + + #setup file based logging if outputReport specified + if(options.OutputLog): + if(len(options.OutputLog) < 2): + logging.critical("the output log file parameter is invalid") + return -2 + else: + #setup file based logging + filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') + if(options.debug): + filelogger.setLevel(logging.DEBUG) + else: + filelogger.setLevel(logging.INFO) + + filelogger.setFormatter(formatter) + logging.getLogger('').addHandler(filelogger) + + logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) + + #Step 1 Prep + if(options.Step1Enable): + logging.debug("Step 1 Enabled") + if(not options.XmlFilePath) or (not os.path.isfile(options.XmlFilePath)): + logging.critical("For Step1 there must be a valid XML Permission file") + return -2 + + if(not options.Step2Enable): + #must have output file + if(not options.PrepResultFile): + logging.critical("Since Step2 is not enabled there must be a PrepResultFile for the result") + return -3 + + if(options.PrepResultFile): + logging.debug("Step 1 Result will be written to: " + options.PrepResultFile) + + if(options.SigningInputFile): + logging.critical("Since Step1 is enabled an Input File for Step2 is not allowed") + return -11 + + #Step 2 signing + if(options.Step2Enable): + logging.debug("Step 2 Enabled") + if(not options.SigningPfxFile): + logging.critical("Since Step2 is enabled you must supply a path to a PFX file for signing") + return -10 + + if(not options.Step1Enable) and ((not options.SigningInputFile) or (not os.path.isfile(options.SigningInputFile))): + logging.critical("For Step2 you must do Step1 or have a valid SigningInputFile") + return -4 + + if(not options.Step3Enable): + #must have output file + if(not options.SigningResultFile): + logging.critical("Since Step3 is not enabled there must be a SigningResultFile for the result") + return -5 + if(options.SigningResultFile): + logging.debug("Step2 Result will be written to: " + options.SigningResultFile) + + if(options.FinalizeInputDetachedSignatureFile): + logging.critical("Since Step2 is enabled an Input Detached signature file for Step3 is not allowed") + return -13 + + if(options.FinalizeInputFile): + logging.critical("Since Step2 is enabled an Input file for Step3 is not allowed") + return -14 + + #Step 3 Finalize + if(options.Step3Enable): + logging.debug("Step 3 Enabled") + + if(not options.Step2Enable) and (options.Step1Enable): + logging.critical("Can't have only Step1 and 3 Enabled") + return -12 + + if(not options.Step2Enable) and ((not options.FinalizeInputFile) or (not os.path.isfile(options.FinalizeInputFile)) or (not options.FinalizeInputDetachedSignatureFile) or (not os.path.isfile(options.FinalizeInputDetachedSignatureFile))): + logging.critical("For Step3 you must do Step2 or have a valid FinalizeInputFile and FinalizeInputDetachedSignatureFile") + return -6 + + #must have an output file + if(not options.FinalizeResultFile): + logging.critical("For Step3 you must have a FinalizeResultFile") + return -7 + else: + logging.debug("Step3 Result will be written to: " + options.FinalizeResultFile) + + + tempdir = "_temp_" + str(time.time()) + logging.critical("Temp directory is: " + os.path.join(os.getcwd(), tempdir)) + os.makedirs(tempdir) + + #STEP 1 - Prep Var + if(options.Step1Enable): + logging.critical("Step1 Started") + Step1OutFile = os.path.join(tempdir, "Step1Out.bin") + SEM = PermissionApplyVariable(None, int(options.HdrVersion)) + + if (int(options.HdrVersion) == PermissionApplyVariable.VERSION_V1): + SEM.SNTarget = int(options.SnTarget); + elif (int(options.HdrVersion) == PermissionApplyVariable.VERSION_V2): + if options.SMBIOSMfg == None: + SEM.Manufacturer = "OEMSH" + else: + SEM.Manufacturer = options.SMBIOSMfg + + if options.SMBIOSProd == None: + SEM.ProductName = "OEMSH Product" + else: + SEM.ProductName = options.SMBIOSProd + + if options.SMBIOSSerial == None: + SEM.SerialNumber = "789789789" + else: + SEM.SerialNumber = options.SMBIOSSerial + else: + logging.critical("Invalid header version specified") + return -31 + + a = open(options.XmlFilePath, "r") + SEM.AddXmlPayload(a.read()) + a.close() + + of = open(Step1OutFile, "wb") + SEM.Write(of) + of.close() + + #if user requested a step1 output file copy the temp file + if(options.PrepResultFile): + shutil.copy(Step1OutFile, options.PrepResultFile) + + #setup input for Step2 + options.SigningInputFile = Step1OutFile + + + #STEP 2 - Local sign + if(options.Step2Enable): + logging.critical("Step2 Started") + #copy signinginputfile into temp dir + FileToSign = os.path.join(tempdir, "Step2In.bin") + shutil.copy(options.SigningInputFile, FileToSign) + options.SigningInputFile = FileToSign + options.SigningOutputFile = os.path.join(tempdir, "Step2Signature.bin") + + #do local signature + ret = SignSEMData(options) + if(ret != 0): + logging.critical("SignSEMData (Step2) Failed: " + str(ret)) + return ret + + if(options.SigningResultFile): + shutil.copy(options.SigningOutputFile, options.SigningResultFile) + + #setup input for Step3 + options.FinalizeInputFile = options.SigningInputFile + options.FinalizeInputDetachedSignatureFile = options.SigningOutputFile + + + #STEP 3 - Write Signature Structure and complete file + if(options.Step3Enable): + logging.critical("Step3 Started") + sstep1file = open(options.FinalizeInputFile, "rb") + SEM = PermissionApplyVariable(sstep1file) + sstep1file.close() + SEM.Signature = WinCertUefiGuid() + detached = open(options.FinalizeInputDetachedSignatureFile, "rb") + SEM.Signature.AddCertData(detached) + detached.close() + SEM.SessionId = random.randint(0, 4294967295) #generate a random session id + + if(not options.FinalizeResultFile): + options.FinalizeResultFile = os.path.join(tempdir, "Step3Out.bin") + + of = open(options.FinalizeResultFile, "wb") + SEM.Write(of) + of.close() + + # + # Function to print SEM + # + if(options.PrintFile) and (os.path.isfile(options.PrintFile)): + PrintSEM(options.PrintFile) + + if(options.PrintResultsFile) and (os.path.isfile(options.PrintResultsFile)): + PrintSEMResults(options.PrintResultsFile) + + if(options.PrintCurrentFile) and (os.path.isfile(options.PrintCurrentFile)): + PrintSEMCurrent(options.PrintCurrentFile) + + #clean up if user didn't request to leave around + if(not options.dirty): + shutil.rmtree(tempdir) + + return 0 + + +if __name__ == '__main__': + #setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + #call main worker function + retcode = main() + + if retcode != 0: + logging.critical("Failed. Return Code: %i" % retcode) + #end logging + logging.shutdown() + sys.exit(retcode) diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateSettingsPacketData.py b/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateSettingsPacketData.py index f1a053fc89..312e433d0d 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateSettingsPacketData.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/GenerateSettingsPacketData.py @@ -1,340 +1,340 @@ -# @file -# -# Script to Generate a Device Firmware Configuration Interface Settings Blob -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -## -## Script to Generate a Device Firmware Configuration Interface Settings Blob -## This tool takes in a XML file in SettingsPacket format, packages it in a -## DFCI_SECURED_SETTINGS_APPLY_VAR structure, signs it with the -## requested key, and then attaches the signature data in WIN_CERTIFICATE_UEFI_GUID format. -## -## This binary file can then be written to variable store: -## GUID: gDfciSettingsManagerVarNamespace -## NAME: DFCI_SETTINGS_APPLY_INPUT_VAR_NAME L"DfciSettingsRequest" -## -## THIS IS FOR UNIT TEST -## -## General process: -## Phase 1: Create payload file by combining relevant info -## Phase 2: Sign it using signtool.exe -## Phase 3: Parse signature into WIN_CERT and package to create final output -## - -import os, sys -import argparse -import logging -import datetime -import struct -import shutil -import time -import random - -#get script path -sp = os.path.dirname(os.path.realpath(sys.argv[0])) - -#setup python path for build modules -sys.path.append(sp) - -from DFCI_SupportLib import DFCI_SupportLib - -from edk2toollib.uefi.wincert import * -from edk2toollib.utility_functions import DetachedSignWithSignTool -from edk2toollib.windows.locate_tools import FindToolInWinSdk -from Data.SecureSettingVariable import SecureSettingsApplyVariable -from Data.SecureSettingVariable import SecureSettingsResultVariable - - -#PKCS7 Signed Data OID -gOid = "1.2.840.113549.1.7.2" -gPath2SignTool = None - - -def PrintSEM(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = SecureSettingsApplyVariable(s) - s.close() - - #now print it out. - SEM.Print(True) - -def PrintSEMCurrent(filepath): - if(filepath and os.path.isfile(filepath)): - outfilename = os.path.basename(filepath) + "_Current" + ".xml" - a = DFCI_SupportLib () - a.extract_payload_from_current(filepath, outfilename) - -def PrintSEMResults(filepath): - if(filepath and os.path.isfile(filepath)): - s = open(filepath, "rb") - SEM = SecureSettingsResultVariable(s) - s.close() - - #now print it out. - SEM.Print(True) - -def SignSEMData(options): - global gPath2SignTool - if gPath2SignTool == None: - a = DFCI_SupportLib () - gPath2SignTool = a.get_signtool_path () - - return DetachedSignWithSignTool (gPath2SignTool, options.SigningInputFile, options.SigningOutputFile, options.SigningPfxFile, options.SigningPfxPw, gOid) - - -# -#main script function -# -def main(): - parser = argparse.ArgumentParser(description='Create SEM Settings Packet Variable') - - #Output debug log - parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) - parser.add_argument("-p", dest="PrintFile", help="Print File as Settings Blob", default= None) - parser.add_argument("-pr", dest="PrintResultsFile", help="Print Results File as Settings Blob", default= None) - parser.add_argument("-pc", dest="PrintCurrentFile", help="Print Current File as {basename}_Current.xml", default= None) - parser.add_argument("--dirty", action="store_true", dest="dirty", help="Leave around the temp files after finished", default=False) - - Step1Group = parser.add_argument_group(title="Step1", description="Signed Data Prep. Build data structure.") - Step1Group.add_argument("--Step1Enable", dest="Step1Enable", help="Do Step 1 - Signed Data Prep", default=False, action="store_true") - Step1Group.add_argument("--SnTarget", dest="SnTarget", help="Target to only a device with given Serial Number in decimal. Zero means all devices", default=0) - Step1Group.add_argument("--XmlFilePath", dest="XmlFilePath", help="Path to Xml Permission Packet File", default=None) - Step1Group.add_argument("--PrepResultFile", dest="PrepResultFile", help="Optional File for output from Step1. Required if not doing step2", default=None) - Step1Group.add_argument("--HdrVersion", dest="HdrVersion", help="Specify packet version", default= SecureSettingsApplyVariable.VERSION_V1) - Step1Group.add_argument("--SMBIOSMfg", dest="SMBIOSMfg", help="Specify SMBIOS Manufacturer", default=None) - Step1Group.add_argument("--SMBIOSProd", dest="SMBIOSProd", help="Specify SMBIOS Product Name", default=None) - Step1Group.add_argument("--SMBIOSSerial", dest="SMBIOSSerial", help="Specify SMBIOS Serial Number", default=None) - - Step2Group = parser.add_argument_group(title="Step2", description="Signature Generation Step.") - Step2Group.add_argument("--Step2Enable", dest="Step2Enable", help="Do Step 2 - Local Signing", default=False, action="store_true") - #need to add arguments here for signing. signtool path and parameters - Step2Group.add_argument("--SigningInputFile", dest="SigningInputFile", help="Optional File for intput for Step2. Required if not doing step1", default=None) - Step2Group.add_argument("--SigningResultFile", dest="SigningResultFile", help="Optional File for output from Step2. Required if not doing step3", default=None) - Step2Group.add_argument("--SigningPfxFile", dest="SigningPfxFile", help="Path to PFX file for signing", default=None) - Step2Group.add_argument("--SigningPfxPw", dest="SigningPfxPw", help="Optional Password for PFX file for signing", default=None) - - Step3Group = parser.add_argument_group(title="Step3", description="Final Var Construction.") - Step3Group.add_argument("--Step3Enable", dest="Step3Enable", help="Do Step 3 - Final Provisioning Var Construction", default=False, action="store_true") - Step3Group.add_argument("--FinalizeInputFile", dest="FinalizeInputFile", help="Optional if doing Step2. Generally Step1 Output or Step2 input. ", default=None) - Step3Group.add_argument("--FinalizeInputDetachedSignatureFile", dest="FinalizeInputDetachedSignatureFile", help="Signtool Detached Signature File. Optional if doing Step2", default=None) - Step3Group.add_argument("--FinalizeResultFile", dest="FinalizeResultFile", help="File for output from Step3. Complete SEM Provisioning Var File.", default=None) - - #Turn on debug level logging - parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) - options = parser.parse_args() - - #setup file based logging if outputReport specified - if(options.OutputLog): - if(len(options.OutputLog) < 2): - logging.critical("the output log file parameter is invalid") - return -27 - else: - #setup file based logging - filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') - if(options.debug): - filelogger.setLevel(logging.DEBUG) - else: - filelogger.setLevel(logging.INFO) - - filelogger.setFormatter(formatter) - logging.getLogger('').addHandler(filelogger) - - logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) - - #Step 1 Prep - if(options.Step1Enable): - logging.debug("Step 1 Enabled") - if(not options.XmlFilePath) or (not os.path.isfile(options.XmlFilePath)): - logging.critical("For Step1 there must be a valid XML Settings file") - return -2 - - if(not options.Step2Enable): - #must have output file - if(not options.PrepResultFile): - logging.critical("Since Step2 is not enabled there must be a PrepResultFile for the result") - return -3 - - if(options.PrepResultFile): - logging.debug("Step 1 Result will be written to: " + options.PrepResultFile) - - if(options.SigningInputFile): - logging.critical("Since Step1 is enabled an Input File for Step2 is not allowed") - return -11 - - #Step 2 signing - if(options.Step2Enable): - logging.debug("Step 2 Enabled") - if(not options.SigningPfxFile): - logging.critical("Since Step2 is enabled you must supply a path to a PFX file for signing") - return -10 - - if(not options.Step1Enable) and ((not options.SigningInputFile) or (not os.path.isfile(options.SigningInputFile))): - logging.critical("For Step2 you must do Step1 or have a valid SigningInputFile") - return -4 - - if(not options.Step3Enable): - #must have output file - if(not options.SigningResultFile): - logging.critical("Since Step3 is not enabled there must be a SigningResultFile for the result") - return -5 - if(options.SigningResultFile): - logging.debug("Step2 Result will be written to: " + options.SigningResultFile) - - if(options.FinalizeInputDetachedSignatureFile): - logging.critical("Since Step2 is enabled an Input Detached signature file for Step3 is not allowed") - return -13 - - if(options.FinalizeInputFile): - logging.critical("Since Step2 is enabled an Input file for Step3 is not allowed") - return -14 - - #Step 3 Finalize - if(options.Step3Enable): - logging.debug("Step 3 Enabled") - - if(not options.Step2Enable) and (options.Step1Enable): - logging.critical("Can't have only Step1 and 3 Enabled") - return -12 - - if(not options.Step2Enable) and ((not options.FinalizeInputFile) or (not os.path.isfile(options.FinalizeInputFile)) or (not options.FinalizeInputDetachedSignatureFile) or (not os.path.isfile(options.FinalizeInputDetachedSignatureFile))): - logging.critical("For Step3 you must do Step2 or have a valid FinalizeInputFile and FinalizeInputDetachedSignatureFile") - return -6 - - #must have an output file - if(not options.FinalizeResultFile): - logging.critical("For Step3 you must have a FinalizeResultFile") - return -7 - else: - logging.debug("Step3 Result will be written to: " + options.FinalizeResultFile) - - tempdir = "_temp_" + str(time.time()) - logging.critical("Temp directory is: " + os.path.join(os.getcwd(), tempdir)) - os.makedirs(tempdir) - - #STEP 1 - Prep Var - if(options.Step1Enable): - logging.critical("Step1 Started") - Step1OutFile = os.path.join(tempdir, "Step1Out.bin") - SEM = SecureSettingsApplyVariable(None, int(options.HdrVersion)) - - if (int(options.HdrVersion) == SecureSettingsApplyVariable.VERSION_V1): - SEM.SNTarget = int(options.SnTarget); - elif (int(options.HdrVersion) == SecureSettingsApplyVariable.VERSION_V2): - if options.SMBIOSMfg == None: - SEM.Manufacturer = "OEMSH" - else: - SEM.Manufacturer = options.SMBIOSMfg - - if options.SMBIOSProd == None: - SEM.ProductName = "OEMSH Product" - else: - SEM.ProductName = options.SMBIOSProd - - if options.SMBIOSSerial == None: - SEM.SerialNumber = "789789789" - else: - SEM.SerialNumber = options.SMBIOSSerial - - else: - logging.critical("Invalid header version specified") - return -31 - - a = open(options.XmlFilePath, "r") - SEM.AddXmlPayload(a.read()) - a.close() - - of = open(Step1OutFile, "wb") - SEM.Write(of) - of.close() - - #if user requested a step1 output file copy the temp file - if(options.PrepResultFile): - shutil.copy(Step1OutFile, options.PrepResultFile) - - #setup input for Step2 - options.SigningInputFile = Step1OutFile - - - #STEP 2 - Local sign - if(options.Step2Enable): - logging.critical("Step2 Started") - #copy signinginputfile into temp dir - FileToSign = os.path.join(tempdir, "Step2In.bin") - shutil.copy(options.SigningInputFile, FileToSign) - options.SigningInputFile = FileToSign - options.SigningOutputFile = os.path.join(tempdir, "Step2Signature.bin") - - #do local signature - ret = SignSEMData(options) - if(ret != 0): - logging.critical("SignSEMData (Step2) Failed: " + str(ret)) - return ret - - if(options.SigningResultFile): - shutil.copy(options.SigningOutputFile, options.SigningResultFile) - - #setup input for Step3 - options.FinalizeInputFile = options.SigningInputFile - options.FinalizeInputDetachedSignatureFile = options.SigningOutputFile - - - #STEP 3 - Write Signature Structure and complete file - if(options.Step3Enable): - logging.critical("Step3 Started") - sstep1file = open(options.FinalizeInputFile, "rb") - SEM = SecureSettingsApplyVariable(sstep1file) - sstep1file.close() - SEM.Signature = WinCertUefiGuid() - detached = open(options.FinalizeInputDetachedSignatureFile, "rb") - SEM.Signature.AddCertData(detached) - detached.close() - SEM.SessionId = random.randint(0, 4294967295) #generate a random session id - - if(not options.FinalizeResultFile): - options.FinalizeResultFile = os.path.join(tempdir, "Step3Out.bin") - - of = open(options.FinalizeResultFile, "wb") - SEM.Write(of) - of.close() - - # - # Function to print SEM - # - if(options.PrintFile) and (os.path.isfile(options.PrintFile)): - PrintSEM(options.PrintFile) - - if(options.PrintResultsFile) and (os.path.isfile(options.PrintResultsFile)): - PrintSEMResults(options.PrintResultsFile) - - if(options.PrintCurrentFile) and (os.path.isfile(options.PrintCurrentFile)): - PrintSEMCurrent(options.PrintCurrentFile) - - #clean up if user didn't request to leave around - if(not options.dirty): - shutil.rmtree(tempdir) - - return 0 - - -if __name__ == '__main__': - #setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - #call main worker function - retcode = main() - - if retcode != 0: - logging.critical("Failed. Return Code: %i" % retcode) - #end logging - logging.shutdown() - sys.exit(retcode) +# @file +# +# Script to Generate a Device Firmware Configuration Interface Settings Blob +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +## +## Script to Generate a Device Firmware Configuration Interface Settings Blob +## This tool takes in a XML file in SettingsPacket format, packages it in a +## DFCI_SECURED_SETTINGS_APPLY_VAR structure, signs it with the +## requested key, and then attaches the signature data in WIN_CERTIFICATE_UEFI_GUID format. +## +## This binary file can then be written to variable store: +## GUID: gDfciSettingsManagerVarNamespace +## NAME: DFCI_SETTINGS_APPLY_INPUT_VAR_NAME L"DfciSettingsRequest" +## +## THIS IS FOR UNIT TEST +## +## General process: +## Phase 1: Create payload file by combining relevant info +## Phase 2: Sign it using signtool.exe +## Phase 3: Parse signature into WIN_CERT and package to create final output +## + +import os, sys +import argparse +import logging +import datetime +import struct +import shutil +import time +import random + +#get script path +sp = os.path.dirname(os.path.realpath(sys.argv[0])) + +#setup python path for build modules +sys.path.append(sp) + +from DFCI_SupportLib import DFCI_SupportLib + +from edk2toollib.uefi.wincert import * +from edk2toollib.utility_functions import DetachedSignWithSignTool +from edk2toollib.windows.locate_tools import FindToolInWinSdk +from Data.SecureSettingVariable import SecureSettingsApplyVariable +from Data.SecureSettingVariable import SecureSettingsResultVariable + + +#PKCS7 Signed Data OID +gOid = "1.2.840.113549.1.7.2" +gPath2SignTool = None + + +def PrintSEM(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = SecureSettingsApplyVariable(s) + s.close() + + #now print it out. + SEM.Print(True) + +def PrintSEMCurrent(filepath): + if(filepath and os.path.isfile(filepath)): + outfilename = os.path.basename(filepath) + "_Current" + ".xml" + a = DFCI_SupportLib () + a.extract_payload_from_current(filepath, outfilename) + +def PrintSEMResults(filepath): + if(filepath and os.path.isfile(filepath)): + s = open(filepath, "rb") + SEM = SecureSettingsResultVariable(s) + s.close() + + #now print it out. + SEM.Print(True) + +def SignSEMData(options): + global gPath2SignTool + if gPath2SignTool == None: + a = DFCI_SupportLib () + gPath2SignTool = a.get_signtool_path () + + return DetachedSignWithSignTool (gPath2SignTool, options.SigningInputFile, options.SigningOutputFile, options.SigningPfxFile, options.SigningPfxPw, gOid) + + +# +#main script function +# +def main(): + parser = argparse.ArgumentParser(description='Create SEM Settings Packet Variable') + + #Output debug log + parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) + parser.add_argument("-p", dest="PrintFile", help="Print File as Settings Blob", default= None) + parser.add_argument("-pr", dest="PrintResultsFile", help="Print Results File as Settings Blob", default= None) + parser.add_argument("-pc", dest="PrintCurrentFile", help="Print Current File as {basename}_Current.xml", default= None) + parser.add_argument("--dirty", action="store_true", dest="dirty", help="Leave around the temp files after finished", default=False) + + Step1Group = parser.add_argument_group(title="Step1", description="Signed Data Prep. Build data structure.") + Step1Group.add_argument("--Step1Enable", dest="Step1Enable", help="Do Step 1 - Signed Data Prep", default=False, action="store_true") + Step1Group.add_argument("--SnTarget", dest="SnTarget", help="Target to only a device with given Serial Number in decimal. Zero means all devices", default=0) + Step1Group.add_argument("--XmlFilePath", dest="XmlFilePath", help="Path to Xml Permission Packet File", default=None) + Step1Group.add_argument("--PrepResultFile", dest="PrepResultFile", help="Optional File for output from Step1. Required if not doing step2", default=None) + Step1Group.add_argument("--HdrVersion", dest="HdrVersion", help="Specify packet version", default= SecureSettingsApplyVariable.VERSION_V1) + Step1Group.add_argument("--SMBIOSMfg", dest="SMBIOSMfg", help="Specify SMBIOS Manufacturer", default=None) + Step1Group.add_argument("--SMBIOSProd", dest="SMBIOSProd", help="Specify SMBIOS Product Name", default=None) + Step1Group.add_argument("--SMBIOSSerial", dest="SMBIOSSerial", help="Specify SMBIOS Serial Number", default=None) + + Step2Group = parser.add_argument_group(title="Step2", description="Signature Generation Step.") + Step2Group.add_argument("--Step2Enable", dest="Step2Enable", help="Do Step 2 - Local Signing", default=False, action="store_true") + #need to add arguments here for signing. signtool path and parameters + Step2Group.add_argument("--SigningInputFile", dest="SigningInputFile", help="Optional File for intput for Step2. Required if not doing step1", default=None) + Step2Group.add_argument("--SigningResultFile", dest="SigningResultFile", help="Optional File for output from Step2. Required if not doing step3", default=None) + Step2Group.add_argument("--SigningPfxFile", dest="SigningPfxFile", help="Path to PFX file for signing", default=None) + Step2Group.add_argument("--SigningPfxPw", dest="SigningPfxPw", help="Optional Password for PFX file for signing", default=None) + + Step3Group = parser.add_argument_group(title="Step3", description="Final Var Construction.") + Step3Group.add_argument("--Step3Enable", dest="Step3Enable", help="Do Step 3 - Final Provisioning Var Construction", default=False, action="store_true") + Step3Group.add_argument("--FinalizeInputFile", dest="FinalizeInputFile", help="Optional if doing Step2. Generally Step1 Output or Step2 input. ", default=None) + Step3Group.add_argument("--FinalizeInputDetachedSignatureFile", dest="FinalizeInputDetachedSignatureFile", help="Signtool Detached Signature File. Optional if doing Step2", default=None) + Step3Group.add_argument("--FinalizeResultFile", dest="FinalizeResultFile", help="File for output from Step3. Complete SEM Provisioning Var File.", default=None) + + #Turn on debug level logging + parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) + options = parser.parse_args() + + #setup file based logging if outputReport specified + if(options.OutputLog): + if(len(options.OutputLog) < 2): + logging.critical("the output log file parameter is invalid") + return -27 + else: + #setup file based logging + filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') + if(options.debug): + filelogger.setLevel(logging.DEBUG) + else: + filelogger.setLevel(logging.INFO) + + filelogger.setFormatter(formatter) + logging.getLogger('').addHandler(filelogger) + + logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) + + #Step 1 Prep + if(options.Step1Enable): + logging.debug("Step 1 Enabled") + if(not options.XmlFilePath) or (not os.path.isfile(options.XmlFilePath)): + logging.critical("For Step1 there must be a valid XML Settings file") + return -2 + + if(not options.Step2Enable): + #must have output file + if(not options.PrepResultFile): + logging.critical("Since Step2 is not enabled there must be a PrepResultFile for the result") + return -3 + + if(options.PrepResultFile): + logging.debug("Step 1 Result will be written to: " + options.PrepResultFile) + + if(options.SigningInputFile): + logging.critical("Since Step1 is enabled an Input File for Step2 is not allowed") + return -11 + + #Step 2 signing + if(options.Step2Enable): + logging.debug("Step 2 Enabled") + if(not options.SigningPfxFile): + logging.critical("Since Step2 is enabled you must supply a path to a PFX file for signing") + return -10 + + if(not options.Step1Enable) and ((not options.SigningInputFile) or (not os.path.isfile(options.SigningInputFile))): + logging.critical("For Step2 you must do Step1 or have a valid SigningInputFile") + return -4 + + if(not options.Step3Enable): + #must have output file + if(not options.SigningResultFile): + logging.critical("Since Step3 is not enabled there must be a SigningResultFile for the result") + return -5 + if(options.SigningResultFile): + logging.debug("Step2 Result will be written to: " + options.SigningResultFile) + + if(options.FinalizeInputDetachedSignatureFile): + logging.critical("Since Step2 is enabled an Input Detached signature file for Step3 is not allowed") + return -13 + + if(options.FinalizeInputFile): + logging.critical("Since Step2 is enabled an Input file for Step3 is not allowed") + return -14 + + #Step 3 Finalize + if(options.Step3Enable): + logging.debug("Step 3 Enabled") + + if(not options.Step2Enable) and (options.Step1Enable): + logging.critical("Can't have only Step1 and 3 Enabled") + return -12 + + if(not options.Step2Enable) and ((not options.FinalizeInputFile) or (not os.path.isfile(options.FinalizeInputFile)) or (not options.FinalizeInputDetachedSignatureFile) or (not os.path.isfile(options.FinalizeInputDetachedSignatureFile))): + logging.critical("For Step3 you must do Step2 or have a valid FinalizeInputFile and FinalizeInputDetachedSignatureFile") + return -6 + + #must have an output file + if(not options.FinalizeResultFile): + logging.critical("For Step3 you must have a FinalizeResultFile") + return -7 + else: + logging.debug("Step3 Result will be written to: " + options.FinalizeResultFile) + + tempdir = "_temp_" + str(time.time()) + logging.critical("Temp directory is: " + os.path.join(os.getcwd(), tempdir)) + os.makedirs(tempdir) + + #STEP 1 - Prep Var + if(options.Step1Enable): + logging.critical("Step1 Started") + Step1OutFile = os.path.join(tempdir, "Step1Out.bin") + SEM = SecureSettingsApplyVariable(None, int(options.HdrVersion)) + + if (int(options.HdrVersion) == SecureSettingsApplyVariable.VERSION_V1): + SEM.SNTarget = int(options.SnTarget); + elif (int(options.HdrVersion) == SecureSettingsApplyVariable.VERSION_V2): + if options.SMBIOSMfg == None: + SEM.Manufacturer = "OEMSH" + else: + SEM.Manufacturer = options.SMBIOSMfg + + if options.SMBIOSProd == None: + SEM.ProductName = "OEMSH Product" + else: + SEM.ProductName = options.SMBIOSProd + + if options.SMBIOSSerial == None: + SEM.SerialNumber = "789789789" + else: + SEM.SerialNumber = options.SMBIOSSerial + + else: + logging.critical("Invalid header version specified") + return -31 + + a = open(options.XmlFilePath, "r") + SEM.AddXmlPayload(a.read()) + a.close() + + of = open(Step1OutFile, "wb") + SEM.Write(of) + of.close() + + #if user requested a step1 output file copy the temp file + if(options.PrepResultFile): + shutil.copy(Step1OutFile, options.PrepResultFile) + + #setup input for Step2 + options.SigningInputFile = Step1OutFile + + + #STEP 2 - Local sign + if(options.Step2Enable): + logging.critical("Step2 Started") + #copy signinginputfile into temp dir + FileToSign = os.path.join(tempdir, "Step2In.bin") + shutil.copy(options.SigningInputFile, FileToSign) + options.SigningInputFile = FileToSign + options.SigningOutputFile = os.path.join(tempdir, "Step2Signature.bin") + + #do local signature + ret = SignSEMData(options) + if(ret != 0): + logging.critical("SignSEMData (Step2) Failed: " + str(ret)) + return ret + + if(options.SigningResultFile): + shutil.copy(options.SigningOutputFile, options.SigningResultFile) + + #setup input for Step3 + options.FinalizeInputFile = options.SigningInputFile + options.FinalizeInputDetachedSignatureFile = options.SigningOutputFile + + + #STEP 3 - Write Signature Structure and complete file + if(options.Step3Enable): + logging.critical("Step3 Started") + sstep1file = open(options.FinalizeInputFile, "rb") + SEM = SecureSettingsApplyVariable(sstep1file) + sstep1file.close() + SEM.Signature = WinCertUefiGuid() + detached = open(options.FinalizeInputDetachedSignatureFile, "rb") + SEM.Signature.AddCertData(detached) + detached.close() + SEM.SessionId = random.randint(0, 4294967295) #generate a random session id + + if(not options.FinalizeResultFile): + options.FinalizeResultFile = os.path.join(tempdir, "Step3Out.bin") + + of = open(options.FinalizeResultFile, "wb") + SEM.Write(of) + of.close() + + # + # Function to print SEM + # + if(options.PrintFile) and (os.path.isfile(options.PrintFile)): + PrintSEM(options.PrintFile) + + if(options.PrintResultsFile) and (os.path.isfile(options.PrintResultsFile)): + PrintSEMResults(options.PrintResultsFile) + + if(options.PrintCurrentFile) and (os.path.isfile(options.PrintCurrentFile)): + PrintSEMCurrent(options.PrintCurrentFile) + + #clean up if user didn't request to leave around + if(not options.dirty): + shutil.rmtree(tempdir) + + return 0 + + +if __name__ == '__main__': + #setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + #call main worker function + retcode = main() + + if retcode != 0: + logging.critical("Failed. Return Code: %i" % retcode) + #end logging + logging.shutdown() + sys.exit(retcode) diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/InsertCertIntoXML.py b/DfciPkg/UnitTests/DfciTests/Support/Python/InsertCertIntoXML.py index a242eca09d..2aac009cd1 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/InsertCertIntoXML.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/InsertCertIntoXML.py @@ -1,71 +1,71 @@ -# @file -# -# Convert Bin cert file to base 64 string, and replace the XYZZY string with the -# base 64 string. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -import os, sys - -import argparse -import logging -import binascii - - -# -#main script function -# -def main(): - parser = argparse.ArgumentParser(description='Create SEM Provisioning Cert CSP XML') - - parser.add_argument("--BinFilePath", dest="BinFilePath", help="Path to binary packet", default=None) - parser.add_argument("--OutputFilePath", dest="OutputFilePath", help="Path to output file", default=None) - parser.add_argument("--PatternFilePath", dest="PatternFilePath", help="Path to Xml pattern", default=None) - - options = parser.parse_args() - - with open(options.BinFilePath, "rb") as binfile: - bindata = binfile.read() - - if bindata == None: - raise Exception ("Invalid binary data") - - b64data = binascii.b2a_base64(bindata).decode("utf-8") - - FoundXYZZY = False - with open(options.OutputFilePath, "w") as outfile: - with open(options.PatternFilePath, "r") as patternfile: - for pl in patternfile: - if pl.strip() == "XYZZY": - FoundXYZZY = True - outfile.write(b64data) - else: - outfile.write(pl) - if not FoundXYZZY: - raise Exception ("Invalid pattern data") - logging.critical("Successfully created XML pkt") - return 0 - - - -if __name__ == '__main__': - #setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - #call main worker function - retcode = main() - - if retcode != 0: - logging.critical("Failed. Return Code: %i" % retcode) - #end logging - logging.shutdown() - sys.exit(retcode) - +# @file +# +# Convert Bin cert file to base 64 string, and replace the XYZZY string with the +# base 64 string. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +import os, sys + +import argparse +import logging +import binascii + + +# +#main script function +# +def main(): + parser = argparse.ArgumentParser(description='Create SEM Provisioning Cert CSP XML') + + parser.add_argument("--BinFilePath", dest="BinFilePath", help="Path to binary packet", default=None) + parser.add_argument("--OutputFilePath", dest="OutputFilePath", help="Path to output file", default=None) + parser.add_argument("--PatternFilePath", dest="PatternFilePath", help="Path to Xml pattern", default=None) + + options = parser.parse_args() + + with open(options.BinFilePath, "rb") as binfile: + bindata = binfile.read() + + if bindata == None: + raise Exception ("Invalid binary data") + + b64data = binascii.b2a_base64(bindata).decode("utf-8") + + FoundXYZZY = False + with open(options.OutputFilePath, "w") as outfile: + with open(options.PatternFilePath, "r") as patternfile: + for pl in patternfile: + if pl.strip() == "XYZZY": + FoundXYZZY = True + outfile.write(b64data) + else: + outfile.write(pl) + if not FoundXYZZY: + raise Exception ("Invalid pattern data") + logging.critical("Successfully created XML pkt") + return 0 + + + +if __name__ == '__main__': + #setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + #call main worker function + retcode = main() + + if retcode != 0: + logging.critical("Failed. Return Code: %i" % retcode) + #end logging + logging.shutdown() + sys.exit(retcode) + diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/PermissionsXMLLib.py b/DfciPkg/UnitTests/DfciTests/Support/Python/PermissionsXMLLib.py index b0d553399e..d11c4aeb3a 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/PermissionsXMLLib.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/PermissionsXMLLib.py @@ -1,112 +1,112 @@ -# @file -# -# Script to Generate a a Permissions XML payload. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -import os, sys -import traceback -import argparse -import datetime -from DFCI_SupportLib import DFCI_SupportLib - -class PermissionsXMLLib(object): - - # - # Create Permissions XML - # - # Given a list of permissions, PMASK, and DMASK, create an XML permissions payload - # - def create_permissions_xml(self, filename, version, lsv, def_pmask, def_dmask, permissionslist): - - f = open(filename, "w") - f.write('\n') - f.write('\n') - f.write(' Dfci Testcase Libraries\n') - f.write(' ') - - print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), end='', file=f) - - f.write('\n') - f.write(' ') - print (version, end='', file=f) - f.write('\n') - f.write(' 2\n') - f.write(' ') - - # - # The permissions list is a list of a list. The lowest level list is really a tuple of - # permission id, PMASK, and DMASK. DMASK may be None. - # - for permission in permissionslist: - f.write(' \n') - f.write(' ') - print (permission[0], end='', file=f) - f.write('\n') - f.write(' ') - print (permission[1], end='', file=f) - f.write('\n') - if (permission[2] is not None): - f.write(' ') - print (permission[2], end='', file=f) - f.write('\n') - f.write(' \n') - - f.write(' \n') - f.write('\n') - - f.close - - return True - - # - # Validate Current Permissions - # - # Input is the current permissions and a list of permission/PMASK/DMASK tuples (list of lists) - # - # Ensure the settings in the checklist have the proper value - # - def validate_current_permissions(self, testname, currentPermissionsXmlFile, checklist): - - for item in checklist: - a = DFCI_SupportLib() - PMask, DMask = a.get_current_permission_value(currentPermissionsXmlFile, item[0]) - - if (PMask != item[1]): - print ('PMask Mismatch for %s, was=%s, Should be=%s' % (item[0], PMask, item[1])) - return False - - if (PMask is not None): - if (DMask != item[2]): - print ('DMask Mismatch for %s, was=%s, Should be=%s' % (item[0], DMask, item[2])) - return False; - - return True - - # - # Validate Current Permission Defaults - # - # Input is the current permissions and the default PMASK and DMASK - # - # Ensure the settings in the checklist have the proper value - # - def validate_current_permission_defaults(self, testname, currentPermissionsXmlFile, CheckDefault, CheckDelegated): - - a = DFCI_SupportLib() - Default, Delegated = a.get_current_permission_defaults(currentPermissionsXmlFile) - - if (Default != CheckDefault): - print ('PMask Mismatch was %s should be %s' % (Default, CheckDefault)) - return False - - if (Delegated != CheckDelegated): - print ('DMask Mismatch was %s should be %s' % (Delegated, CheckDelegated)) - return False; - - return True +# @file +# +# Script to Generate a a Permissions XML payload. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +import os, sys +import traceback +import argparse +import datetime +from DFCI_SupportLib import DFCI_SupportLib + +class PermissionsXMLLib(object): + + # + # Create Permissions XML + # + # Given a list of permissions, PMASK, and DMASK, create an XML permissions payload + # + def create_permissions_xml(self, filename, version, lsv, def_pmask, def_dmask, permissionslist): + + f = open(filename, "w") + f.write('\n') + f.write('\n') + f.write(' Dfci Testcase Libraries\n') + f.write(' ') + + print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), end='', file=f) + + f.write('\n') + f.write(' ') + print (version, end='', file=f) + f.write('\n') + f.write(' 2\n') + f.write(' ') + + # + # The permissions list is a list of a list. The lowest level list is really a tuple of + # permission id, PMASK, and DMASK. DMASK may be None. + # + for permission in permissionslist: + f.write(' \n') + f.write(' ') + print (permission[0], end='', file=f) + f.write('\n') + f.write(' ') + print (permission[1], end='', file=f) + f.write('\n') + if (permission[2] is not None): + f.write(' ') + print (permission[2], end='', file=f) + f.write('\n') + f.write(' \n') + + f.write(' \n') + f.write('\n') + + f.close + + return True + + # + # Validate Current Permissions + # + # Input is the current permissions and a list of permission/PMASK/DMASK tuples (list of lists) + # + # Ensure the settings in the checklist have the proper value + # + def validate_current_permissions(self, testname, currentPermissionsXmlFile, checklist): + + for item in checklist: + a = DFCI_SupportLib() + PMask, DMask = a.get_current_permission_value(currentPermissionsXmlFile, item[0]) + + if (PMask != item[1]): + print ('PMask Mismatch for %s, was=%s, Should be=%s' % (item[0], PMask, item[1])) + return False + + if (PMask is not None): + if (DMask != item[2]): + print ('DMask Mismatch for %s, was=%s, Should be=%s' % (item[0], DMask, item[2])) + return False; + + return True + + # + # Validate Current Permission Defaults + # + # Input is the current permissions and the default PMASK and DMASK + # + # Ensure the settings in the checklist have the proper value + # + def validate_current_permission_defaults(self, testname, currentPermissionsXmlFile, CheckDefault, CheckDelegated): + + a = DFCI_SupportLib() + Default, Delegated = a.get_current_permission_defaults(currentPermissionsXmlFile) + + if (Default != CheckDefault): + print ('PMask Mismatch was %s should be %s' % (Default, CheckDefault)) + return False + + if (Delegated != CheckDelegated): + print ('DMask Mismatch was %s should be %s' % (Delegated, CheckDelegated)) + return False; + + return True diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/PyRobotRemote.py b/DfciPkg/UnitTests/DfciTests/Support/Python/PyRobotRemote.py index f541321b4b..281ec6b0e1 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/PyRobotRemote.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/PyRobotRemote.py @@ -1,103 +1,103 @@ -# @file -# -# PyRobotRemote - Runs on the System Under Test (DUT) providing -# functionality needed for DFCI testing -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -import os -import sys -import subprocess -import logging -import shlex -import win32api -import win32con -import win32security -import winnt - -from Lib.UefiVariablesSupportLib import UefiVariable - - -# update this whenever you make a change -RobotRemoteChangeDate = "2021-12-14 11:00" -RobotRemoteVersion = 1.06 - - -class UefiRemoteTesting(object): - """Library to be used with Robot Framework's remote server. - - This supports Robot Framework Remote Interface. This lets a remote test system perform local operations using - remote framework and built in remote "Keywords" - """ - def __init__(self): - self.filepath = None - self.lines = [] - - def Run_PowerShell_And_Return_Output(self, cmdline): - completed = subprocess.run(["powershell", "-Command", cmdline], capture_output=True) - - if completed.returncode != 0: - return "Error" - else: - return completed.stdout.decode('utf-8').strip() - - # - # String variables are designed to have a NULL. This does - # confuse Python, so get rid of the NULL when it is expected - # - def GetUefiVariable(self, name, guid, trim): - UefiVar = UefiVariable() - logging.info("Calling GetUefiVar(name='%s', GUID='%s')" % (name, "{%s}" % guid)) - (rc, var, errorstring) = UefiVar.GetUefiVar(name, guid) - var2 = var - if (var is not None) and (trim == 'trim'): - varlen = len(var) - if varlen > 1: - var2 = var[0:varlen-1] - return (rc, var2, errorstring) - - def SetUefiVariable(self, name, guid, attrs=None, contents=None): - UefiVar = UefiVariable() - (rc, err, errorstring) = UefiVar.SetUefiVar(name, guid, contents, attrs) - return rc - - def remote_ack(self): - return True - - def remote_get_version(self): - return RobotRemoteVersion - - def remote_warm_reboot(self): - os.system("shutdown -r -t 1") - - def remote_reboot_to_firmware(self): - TokenHandle = win32security.OpenProcessToken(win32api.GetCurrentProcess(), - win32con.TOKEN_ADJUST_PRIVILEGES | win32con.TOKEN_QUERY) - NewPrivilege = [(win32security.LookupPrivilegeValue(None, winnt.SE_SHUTDOWN_NAME), - winnt.SE_PRIVILEGE_ENABLED)] - win32security.AdjustTokenPrivileges(TokenHandle, False, NewPrivilege) - os.system("shutdown -r -fw -t 0") - - -if __name__ == '__main__': - from robotremoteserver import RobotRemoteServer - print("Version %s - %s" % (str(RobotRemoteVersion), RobotRemoteChangeDate)) - - # setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - # Display IP address for convenience of tester - os.system('ipconfig | findstr IPv4') - - RobotRemoteServer(UefiRemoteTesting(), host='0.0.0.0', port=8270) - - logging.shutdown() - sys.exit(0) +# @file +# +# PyRobotRemote - Runs on the System Under Test (DUT) providing +# functionality needed for DFCI testing +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +import os +import sys +import subprocess +import logging +import shlex +import win32api +import win32con +import win32security +import winnt + +from Lib.UefiVariablesSupportLib import UefiVariable + + +# update this whenever you make a change +RobotRemoteChangeDate = "2021-12-14 11:00" +RobotRemoteVersion = 1.06 + + +class UefiRemoteTesting(object): + """Library to be used with Robot Framework's remote server. + + This supports Robot Framework Remote Interface. This lets a remote test system perform local operations using + remote framework and built in remote "Keywords" + """ + def __init__(self): + self.filepath = None + self.lines = [] + + def Run_PowerShell_And_Return_Output(self, cmdline): + completed = subprocess.run(["powershell", "-Command", cmdline], capture_output=True) + + if completed.returncode != 0: + return "Error" + else: + return completed.stdout.decode('utf-8').strip() + + # + # String variables are designed to have a NULL. This does + # confuse Python, so get rid of the NULL when it is expected + # + def GetUefiVariable(self, name, guid, trim): + UefiVar = UefiVariable() + logging.info("Calling GetUefiVar(name='%s', GUID='%s')" % (name, "{%s}" % guid)) + (rc, var, errorstring) = UefiVar.GetUefiVar(name, guid) + var2 = var + if (var is not None) and (trim == 'trim'): + varlen = len(var) + if varlen > 1: + var2 = var[0:varlen-1] + return (rc, var2, errorstring) + + def SetUefiVariable(self, name, guid, attrs=None, contents=None): + UefiVar = UefiVariable() + (rc, err, errorstring) = UefiVar.SetUefiVar(name, guid, contents, attrs) + return rc + + def remote_ack(self): + return True + + def remote_get_version(self): + return RobotRemoteVersion + + def remote_warm_reboot(self): + os.system("shutdown -r -t 1") + + def remote_reboot_to_firmware(self): + TokenHandle = win32security.OpenProcessToken(win32api.GetCurrentProcess(), + win32con.TOKEN_ADJUST_PRIVILEGES | win32con.TOKEN_QUERY) + NewPrivilege = [(win32security.LookupPrivilegeValue(None, winnt.SE_SHUTDOWN_NAME), + winnt.SE_PRIVILEGE_ENABLED)] + win32security.AdjustTokenPrivileges(TokenHandle, False, NewPrivilege) + os.system("shutdown -r -fw -t 0") + + +if __name__ == '__main__': + from robotremoteserver import RobotRemoteServer + print("Version %s - %s" % (str(RobotRemoteVersion), RobotRemoteChangeDate)) + + # setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + # Display IP address for convenience of tester + os.system('ipconfig | findstr IPv4') + + RobotRemoteServer(UefiRemoteTesting(), host='0.0.0.0', port=8270) + + logging.shutdown() + sys.exit(0) diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/SettingsXMLLib.py b/DfciPkg/UnitTests/DfciTests/Support/Python/SettingsXMLLib.py index 9c109b60e3..d917b51586 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/SettingsXMLLib.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/SettingsXMLLib.py @@ -1,74 +1,74 @@ -# @file -# -# Script to Generate a Settings XML payload. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -import os, sys -import traceback -import argparse -import datetime -from DFCI_SupportLib import DFCI_SupportLib - -class SettingsXMLLib(object): - - # - # Create Settings XML - # - # Given a list of settings and values, create an XML settings payload - # - def create_settings_xml(self, filename, version, lsv, settingslist): - - f = open(filename, "w") - f.write('\n') - f.write('\n') - f.write(' Dfci Testcase Libraries\n') - f.write(' ') - - print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), end='', file=f) - - f.write('\n') - f.write(' ') - print (version, end='', file=f) - f.write('\n') - f.write(' 2\n') - f.write(' \n') - - # - # The settings list is a list of a list. The lowest level list is really a tuple of - # setting id and value - # - for setting in settingslist: - f.write(' \n') - f.write(' ') - print (setting[0], end='', file=f) - f.write('\n') - f.write(' ') - print (setting[1], end='', file=f) - f.write('\n') - f.write(' \n') - - f.write(' \n') - f.write('\n') - - f.close - - return True - - # - # Validate Current Settings - # - # Input is the current settings and a list of setting/value pairs (list of lists) - # - # Ensure the settings in the checklist have the proper value - # - def validate_current_settings(self, testname, currentSettingXmlFile, checklist): - - for item in checklist: - a = DFCI_SupportLib() - rc = a.check_current_setting_value(currentSettingXmlFile, item[0], item[1]) - if not rc: - return rc - - return True +# @file +# +# Script to Generate a Settings XML payload. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +import os, sys +import traceback +import argparse +import datetime +from DFCI_SupportLib import DFCI_SupportLib + +class SettingsXMLLib(object): + + # + # Create Settings XML + # + # Given a list of settings and values, create an XML settings payload + # + def create_settings_xml(self, filename, version, lsv, settingslist): + + f = open(filename, "w") + f.write('\n') + f.write('\n') + f.write(' Dfci Testcase Libraries\n') + f.write(' ') + + print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), end='', file=f) + + f.write('\n') + f.write(' ') + print (version, end='', file=f) + f.write('\n') + f.write(' 2\n') + f.write(' \n') + + # + # The settings list is a list of a list. The lowest level list is really a tuple of + # setting id and value + # + for setting in settingslist: + f.write(' \n') + f.write(' ') + print (setting[0], end='', file=f) + f.write('\n') + f.write(' ') + print (setting[1], end='', file=f) + f.write('\n') + f.write(' \n') + + f.write(' \n') + f.write('\n') + + f.close + + return True + + # + # Validate Current Settings + # + # Input is the current settings and a list of setting/value pairs (list of lists) + # + # Ensure the settings in the checklist have the proper value + # + def validate_current_settings(self, testname, currentSettingXmlFile, checklist): + + for item in checklist: + a = DFCI_SupportLib() + rc = a.check_current_setting_value(currentSettingXmlFile, item[0], item[1]) + if not rc: + return rc + + return True diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/UefiVariablesSupportLib.py b/DfciPkg/UnitTests/DfciTests/Support/Python/UefiVariablesSupportLib.py index a401d8c8ff..f7037d2044 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/UefiVariablesSupportLib.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/UefiVariablesSupportLib.py @@ -1,108 +1,108 @@ -# @file -# -# Python lib to support Reading and writing UEFI variables from windows -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -import os, sys -from ctypes import * -import logging -import pywintypes -import win32api, win32process, win32security, win32file -import winerror - -kernel32 = windll.kernel32 -EFI_VAR_MAX_BUFFER_SIZE = 1024*1024 - -class UefiVariable(object): - - def __init__(self): - # enable required SeSystemEnvironmentPrivilege privilege - privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) - token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) - win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) - win32api.CloseHandle( token ) - - # import firmware variable API - try: - self._GetFirmwareEnvironmentVariable = kernel32.GetFirmwareEnvironmentVariableW - self._GetFirmwareEnvironmentVariable.restype = c_int - self._GetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] - self._SetFirmwareEnvironmentVariable = kernel32.SetFirmwareEnvironmentVariableW - self._SetFirmwareEnvironmentVariable.restype = c_int - self._SetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] - self._SetFirmwareEnvironmentVariableEx = kernel32.SetFirmwareEnvironmentVariableExW - self._SetFirmwareEnvironmentVariableEx.restype = c_int - self._SetFirmwareEnvironmentVariableEx.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int, c_int] - except AttributeError as msg: - logging.warn( "G[S]etFirmwareEnvironmentVariableW function doesn't seem to exist" ) - pass - - # - # Helper function to create buffer for var read/write - # - def CreateBuffer(self, init, size=None): - """CreateBuffer(aString) -> character array - CreateBuffer(anInteger) -> character array - CreateBuffer(aString, anInteger) -> character array - """ - if isinstance(init, str): - if size is None: - size = len(init)+1 - buftype = c_char * size - buf = buftype() - buf.value = init - return buf - elif isinstance(init, int): - buftype = c_char * init - buf = buftype() - return buf - raise TypeError(init) - - # - #Function to get variable - # return a tuple of error code and variable data as string - # - def GetUefiVar(self, name, guid ): - err = 0 #success - efi_var = create_string_buffer( EFI_VAR_MAX_BUFFER_SIZE ) - if self._GetFirmwareEnvironmentVariable is not None: - logging.info("calling GetFirmwareEnvironmentVariable( name='%s', GUID='%s' ).." % (name, "{%s}" % guid) ) - length = self._GetFirmwareEnvironmentVariable( name, "{%s}" % guid, efi_var, EFI_VAR_MAX_BUFFER_SIZE ) - if (0 == length) or (efi_var is None): - err = kernel32.GetLastError() - logging.error( 'GetFirmwareEnvironmentVariable[Ex] failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, WinError(err)) - return (err, efi_var[:length], None) - # - #Function to set variable - # return a tuple of boolean status, errorcode, errorstring (None if not error) - # - def SetUefiVar(self, name, guid, var=None, attrs=None): - var_len = 0 - err = 0 - errorstring = None - if var is None: - var = bytes(0) - else: - var_len = len(var) - success = 0 # Fail - if(attrs == None): - if self._SetFirmwareEnvironmentVariable is not None: - logging.info("Calling SetFirmwareEnvironmentVariable (name='%s', Guid='%s')..." % (name, "{%s}" % guid, )) - success = self._SetFirmwareEnvironmentVariable(name, "{%s}" % guid, var, var_len) - else: - attrs = int(attrs) - if self._SetFirmwareEnvironmentVariableEx is not None: - logging.info(" calling SetFirmwareEnvironmentVariableEx( name='%s', GUID='%s', length=0x%X, attributes=0x%X ).." % (name, "{%s}" % guid, var_len, attrs) ) - success = self._SetFirmwareEnvironmentVariableEx( name, "{%s}" % guid, var, var_len, attrs ) - - if 0 == success: - err = kernel32.GetLastError() - logging.error('SetFirmwareEnvironmentVariable failed (GetLastError = 0x%x)' % err ) - logging.error(WinError()) - errorstring = WinError(err) - return (success,err, errorstring) - +# @file +# +# Python lib to support Reading and writing UEFI variables from windows +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +import os, sys +from ctypes import * +import logging +import pywintypes +import win32api, win32process, win32security, win32file +import winerror + +kernel32 = windll.kernel32 +EFI_VAR_MAX_BUFFER_SIZE = 1024*1024 + +class UefiVariable(object): + + def __init__(self): + # enable required SeSystemEnvironmentPrivilege privilege + privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) + token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) + win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) + win32api.CloseHandle( token ) + + # import firmware variable API + try: + self._GetFirmwareEnvironmentVariable = kernel32.GetFirmwareEnvironmentVariableW + self._GetFirmwareEnvironmentVariable.restype = c_int + self._GetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] + self._SetFirmwareEnvironmentVariable = kernel32.SetFirmwareEnvironmentVariableW + self._SetFirmwareEnvironmentVariable.restype = c_int + self._SetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] + self._SetFirmwareEnvironmentVariableEx = kernel32.SetFirmwareEnvironmentVariableExW + self._SetFirmwareEnvironmentVariableEx.restype = c_int + self._SetFirmwareEnvironmentVariableEx.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int, c_int] + except AttributeError as msg: + logging.warn( "G[S]etFirmwareEnvironmentVariableW function doesn't seem to exist" ) + pass + + # + # Helper function to create buffer for var read/write + # + def CreateBuffer(self, init, size=None): + """CreateBuffer(aString) -> character array + CreateBuffer(anInteger) -> character array + CreateBuffer(aString, anInteger) -> character array + """ + if isinstance(init, str): + if size is None: + size = len(init)+1 + buftype = c_char * size + buf = buftype() + buf.value = init + return buf + elif isinstance(init, int): + buftype = c_char * init + buf = buftype() + return buf + raise TypeError(init) + + # + #Function to get variable + # return a tuple of error code and variable data as string + # + def GetUefiVar(self, name, guid ): + err = 0 #success + efi_var = create_string_buffer( EFI_VAR_MAX_BUFFER_SIZE ) + if self._GetFirmwareEnvironmentVariable is not None: + logging.info("calling GetFirmwareEnvironmentVariable( name='%s', GUID='%s' ).." % (name, "{%s}" % guid) ) + length = self._GetFirmwareEnvironmentVariable( name, "{%s}" % guid, efi_var, EFI_VAR_MAX_BUFFER_SIZE ) + if (0 == length) or (efi_var is None): + err = kernel32.GetLastError() + logging.error( 'GetFirmwareEnvironmentVariable[Ex] failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, WinError(err)) + return (err, efi_var[:length], None) + # + #Function to set variable + # return a tuple of boolean status, errorcode, errorstring (None if not error) + # + def SetUefiVar(self, name, guid, var=None, attrs=None): + var_len = 0 + err = 0 + errorstring = None + if var is None: + var = bytes(0) + else: + var_len = len(var) + success = 0 # Fail + if(attrs == None): + if self._SetFirmwareEnvironmentVariable is not None: + logging.info("Calling SetFirmwareEnvironmentVariable (name='%s', Guid='%s')..." % (name, "{%s}" % guid, )) + success = self._SetFirmwareEnvironmentVariable(name, "{%s}" % guid, var, var_len) + else: + attrs = int(attrs) + if self._SetFirmwareEnvironmentVariableEx is not None: + logging.info(" calling SetFirmwareEnvironmentVariableEx( name='%s', GUID='%s', length=0x%X, attributes=0x%X ).." % (name, "{%s}" % guid, var_len, attrs) ) + success = self._SetFirmwareEnvironmentVariableEx( name, "{%s}" % guid, var, var_len, attrs ) + + if 0 == success: + err = kernel32.GetLastError() + logging.error('SetFirmwareEnvironmentVariable failed (GetLastError = 0x%x)' % err ) + logging.error(WinError()) + errorstring = WinError(err) + return (success,err, errorstring) + diff --git a/DfciPkg/UnitTests/DfciTests/Support/Python/UtilityFunctions.py b/DfciPkg/UnitTests/DfciTests/Support/Python/UtilityFunctions.py index febfcf9659..eae5782c0c 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Python/UtilityFunctions.py +++ b/DfciPkg/UnitTests/DfciTests/Support/Python/UtilityFunctions.py @@ -1,175 +1,175 @@ -# @file -# -# Utility Functions to support re-use in python scripts. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -## -## Utility Functions to support re-use in python scripts. -## -## Includes functions for running external commands, etc -## -from __future__ import print_function #support Python3 and 2 for print -import os -import sys -import logging -import datetime -import shutil -import threading -import subprocess - -# -#set signtool path -- -# Requires the windows 8.1 kit. -# only works on 64bit systems but all dev machines should be 64bit by now. -gSignToolPath = os.path.join(os.getenv("ProgramFiles(x86)"), "Windows Kits", "10", "bin", "10.0.18362.0", "x64", "signtool.exe") - -# -# Cert Manager is used for deleting the cert when add/removing certs -# -gCertMgrPath = os.path.join(os.getenv("ProgramFiles(x86)"), "Windows Kits", "10", "bin", "10.0.18363.0", "x64", "certmgr.exe") - -# -# Cert Util is used to import PFX into cert store -# -gCertUtilPath = "CertUtil.exe" - -# -#check Windows Kit files and try using 8.1 if not in 10 -# -#check the tool path and update it -if not os.path.exists(gCertMgrPath): - gCertMgrPath = gCertMgrPath.replace('10', '8.1') - -#check the tool path and update it -if not os.path.exists(gSignToolPath): - gSignToolPath = gSignToolPath.replace('10', '8.1') - - -# -# process output stream and write to log. -# part of the threading pattern. -# -# http://stackoverflow.com/questions/19423008/logged-subprocess-communicate -# -def reader(stream): - while True: - s = stream.readline() - if not s: - break - logging.info(s.rstrip()) - stream.close() - -def filereader(filepath, stream): - f = open(filepath, "w") - while True: - s = stream.readline() - if not s: - break - f.write(s) - stream.close() - f.close() - -# -# Run a shell commmand and print the output to the log file -# -def RunCmd(cmd, capture=True, outfile=None): - starttime = datetime.datetime.now() - logging.debug("Cmd to run is: " + cmd) - logging.info("------------------------------------------------") - logging.info("--------------Cmd Output Starting---------------") - logging.info("------------------------------------------------") - c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - if(capture): - if(outfile): - outr = threading.Thread(target=filereader, args=(outfile, c.stdout,)) - else: - outr = threading.Thread(target=reader, args=(c.stdout,)) - outr.start() - c.wait() - outr.join() - else: - c.wait() - - #replaced communicate method with modified threading solution found here - # http://stackoverflow.com/questions/19423008/logged-subprocess-communicate - # - - endtime = datetime.datetime.now() - delta = endtime - starttime - logging.info("------------------------------------------------") - logging.info("--------------Cmd Output Finished---------------") - logging.info("--------- Running Time (mm:ss): {0[0]:02}:{0[1]:02} ----------".format(divmod(delta.seconds, 60))) - logging.info("------------------------------------------------") - return c.returncode - - -def SignWithSignTool(ToSignFilePath, DetachedSignatureOutputFilePath, PfxFile, PfxPass, Oid): - OutputDir = os.path.dirname(DetachedSignatureOutputFilePath) - cmd = gSignToolPath + ' sign /p7ce DetachedSignedData /fd sha256 /p7co ' + Oid + ' /p7 "' + OutputDir + '" /f "' + PfxFile + '"' - if PfxPass: - #add password if set - cmd = cmd + ' /p ' + PfxPass - cmd = cmd + ' /debug /v "' + ToSignFilePath + '" ' - logging.critical("Command is: %s" % cmd) - ret = RunCmd(cmd) - if(ret != 0): - raise Exception("Signtool error %d" % ret) - signedfile = os.path.join(OutputDir, os.path.basename(ToSignFilePath) + ".p7") - if(not os.path.isfile(signedfile)): - raise Exception("Output file doesn't eixst %s" % signedfile) - - shutil.move(signedfile, DetachedSignatureOutputFilePath) - return ret - -### -# Function to print a byte list as hex and optionally output ascii as well as -# offset within the buffer -### -def PrintByteList(ByteList, IncludeAscii=True, IncludeOffset=True, IncludeHexSep=True, OffsetStart=0): - Ascii = "" - for index in range(len(ByteList)): - #Start of New Line - if(index % 16 == 0): - if(IncludeOffset): - print("0x%04X -" % (index + OffsetStart), end='') - - #Midpoint of a Line - if(index % 16 == 8): - if(IncludeHexSep): - print(" -", end='') - - #Print As Hex Byte - print(" 0x%02X" % ByteList[index], end='') - - #Prepare to Print As Ascii - if(ByteList[index] < 0x20) or (ByteList[index] > 0x7E): - Ascii += "." - else: - Ascii += ("%c" % ByteList[index]) - - #End of Line - if(index % 16 == 15): - if(IncludeAscii): - print(" %s" % Ascii, end='') - Ascii = "" - print("") - - #Done - Lets check if we have partial - if(index % 16 != 15): - #Lets print any partial line of ascii - if(IncludeAscii) and (Ascii != ""): - #Pad out to the correct spot - - while(index % 16 != 15): - print(" ", end='') - if(index % 16 == 7): #acount for the - symbol in the hex dump - if(IncludeOffset): - print(" ", end='') - index += 1 - #print the ascii partial line - print(" %s" % Ascii, end='') - #print a single newline so that next print will be on new line - print("") - +# @file +# +# Utility Functions to support re-use in python scripts. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +## +## Utility Functions to support re-use in python scripts. +## +## Includes functions for running external commands, etc +## +from __future__ import print_function #support Python3 and 2 for print +import os +import sys +import logging +import datetime +import shutil +import threading +import subprocess + +# +#set signtool path -- +# Requires the windows 8.1 kit. +# only works on 64bit systems but all dev machines should be 64bit by now. +gSignToolPath = os.path.join(os.getenv("ProgramFiles(x86)"), "Windows Kits", "10", "bin", "10.0.18362.0", "x64", "signtool.exe") + +# +# Cert Manager is used for deleting the cert when add/removing certs +# +gCertMgrPath = os.path.join(os.getenv("ProgramFiles(x86)"), "Windows Kits", "10", "bin", "10.0.18363.0", "x64", "certmgr.exe") + +# +# Cert Util is used to import PFX into cert store +# +gCertUtilPath = "CertUtil.exe" + +# +#check Windows Kit files and try using 8.1 if not in 10 +# +#check the tool path and update it +if not os.path.exists(gCertMgrPath): + gCertMgrPath = gCertMgrPath.replace('10', '8.1') + +#check the tool path and update it +if not os.path.exists(gSignToolPath): + gSignToolPath = gSignToolPath.replace('10', '8.1') + + +# +# process output stream and write to log. +# part of the threading pattern. +# +# http://stackoverflow.com/questions/19423008/logged-subprocess-communicate +# +def reader(stream): + while True: + s = stream.readline() + if not s: + break + logging.info(s.rstrip()) + stream.close() + +def filereader(filepath, stream): + f = open(filepath, "w") + while True: + s = stream.readline() + if not s: + break + f.write(s) + stream.close() + f.close() + +# +# Run a shell commmand and print the output to the log file +# +def RunCmd(cmd, capture=True, outfile=None): + starttime = datetime.datetime.now() + logging.debug("Cmd to run is: " + cmd) + logging.info("------------------------------------------------") + logging.info("--------------Cmd Output Starting---------------") + logging.info("------------------------------------------------") + c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if(capture): + if(outfile): + outr = threading.Thread(target=filereader, args=(outfile, c.stdout,)) + else: + outr = threading.Thread(target=reader, args=(c.stdout,)) + outr.start() + c.wait() + outr.join() + else: + c.wait() + + #replaced communicate method with modified threading solution found here + # http://stackoverflow.com/questions/19423008/logged-subprocess-communicate + # + + endtime = datetime.datetime.now() + delta = endtime - starttime + logging.info("------------------------------------------------") + logging.info("--------------Cmd Output Finished---------------") + logging.info("--------- Running Time (mm:ss): {0[0]:02}:{0[1]:02} ----------".format(divmod(delta.seconds, 60))) + logging.info("------------------------------------------------") + return c.returncode + + +def SignWithSignTool(ToSignFilePath, DetachedSignatureOutputFilePath, PfxFile, PfxPass, Oid): + OutputDir = os.path.dirname(DetachedSignatureOutputFilePath) + cmd = gSignToolPath + ' sign /p7ce DetachedSignedData /fd sha256 /p7co ' + Oid + ' /p7 "' + OutputDir + '" /f "' + PfxFile + '"' + if PfxPass: + #add password if set + cmd = cmd + ' /p ' + PfxPass + cmd = cmd + ' /debug /v "' + ToSignFilePath + '" ' + logging.critical("Command is: %s" % cmd) + ret = RunCmd(cmd) + if(ret != 0): + raise Exception("Signtool error %d" % ret) + signedfile = os.path.join(OutputDir, os.path.basename(ToSignFilePath) + ".p7") + if(not os.path.isfile(signedfile)): + raise Exception("Output file doesn't eixst %s" % signedfile) + + shutil.move(signedfile, DetachedSignatureOutputFilePath) + return ret + +### +# Function to print a byte list as hex and optionally output ascii as well as +# offset within the buffer +### +def PrintByteList(ByteList, IncludeAscii=True, IncludeOffset=True, IncludeHexSep=True, OffsetStart=0): + Ascii = "" + for index in range(len(ByteList)): + #Start of New Line + if(index % 16 == 0): + if(IncludeOffset): + print("0x%04X -" % (index + OffsetStart), end='') + + #Midpoint of a Line + if(index % 16 == 8): + if(IncludeHexSep): + print(" -", end='') + + #Print As Hex Byte + print(" 0x%02X" % ByteList[index], end='') + + #Prepare to Print As Ascii + if(ByteList[index] < 0x20) or (ByteList[index] > 0x7E): + Ascii += "." + else: + Ascii += ("%c" % ByteList[index]) + + #End of Line + if(index % 16 == 15): + if(IncludeAscii): + print(" %s" % Ascii, end='') + Ascii = "" + print("") + + #Done - Lets check if we have partial + if(index % 16 != 15): + #Lets print any partial line of ascii + if(IncludeAscii) and (Ascii != ""): + #Pad out to the correct spot + + while(index % 16 != 15): + print(" ", end='') + if(index % 16 == 7): #acount for the - symbol in the hex dump + if(IncludeOffset): + print(" ", end='') + index += 1 + #print the ascii partial line + print(" %s" % Ascii, end='') + #print a single newline so that next print will be on new line + print("") + diff --git a/DfciPkg/UnitTests/DfciTests/Support/Robot/CertSupport.robot b/DfciPkg/UnitTests/DfciTests/Support/Robot/CertSupport.robot index df665e7e70..33d2fdbe85 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Robot/CertSupport.robot +++ b/DfciPkg/UnitTests/DfciTests/Support/Robot/CertSupport.robot @@ -1,68 +1,68 @@ -*** Settings *** -# @file -# -Documentation DFCI Certificate Support -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process -Library ${CURDIR}${/}..${/}Python${/}CertSupportLib.py - -*** Keywords *** - -Set DDS CA cert - Set Global Variable ${NEW_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA.cer - Set Global Variable ${NEW_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf.pfx - Set Global Variable ${OLD_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf2.pfx - Set Global Variable ${OLD_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA2.cer - - -Set DDS CA2 cert - Set Global Variable ${NEW_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA2.cer - Set Global Variable ${NEW_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf2.pfx - Set Global Variable ${OLD_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf.pfx - Set Global Variable ${OLD_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA.cer - - -Set MDM CA cert - Set Global Variable ${NEW_USER_CERT} ${CERTS_DIR}${/}MDM_CA.cer - Set Global Variable ${NEW_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf.pfx - Set Global Variable ${OLD_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf2.pfx - Set Global Variable ${OLD_USER_CERT} ${CERTS_DIR}${/}MDM_CA2.cer - - -Set MDM CA2 cert - Set Global Variable ${NEW_USER_CERT} ${CERTS_DIR}${/}MDM_CA2.cer - Set Global Variable ${NEW_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf2.pfx - Set Global Variable ${OLD_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf.pfx - Set Global Variable ${OLD_USER_CERT} ${CERTS_DIR}${/}MDM_CA.cer - - -Initialize Thumbprints - [Arguments] ${OwnerThumbprint} ${UserThumbprint} - - ${DdsCA}= Set Variable ${CERTS_DIR}${/}DDS_CA.pfx - ${MdmCA}= Set Variable ${CERTS_DIR}${/}MDM_CA.pfx - ${ZtdLeaf}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.pfx - ${ZtdCert}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.cer - - ${DdsThumbprint}= Get Thumbprint From Pfx ${DdsCA} - ${MdmThumbprint}= Get Thumbprint From Pfx ${MdmCA} - ${ZtdThumbprint}= Get Thumbprint From Pfx ${ZtdLeaf} - - Run Keyword If ${OwnerThumbprint} == '${DdsThumbprint}' - ... Set DDS CA2 cert - ... ELSE - ... Set DDS CA cert - Run Keyword If ${UserThumbprint} == '${MdmThumbprint}' - ... Set MDM CA2 cert - ... ELSE - ... Set MDM CA cert - - Set Global Variable ${ZTD_LEAF_PFX} ${ZtdLeaf} - Set Global Variable ${ZTD_LEAF_CERT} ${ZtdCert} - Set Global Variable ${DDS_CA_THUMBPRINT} '${DdsThumbprint}' - Set Global Variable ${MDM_CA_THUMBPRINT} '${MdmThumbprint}' - Set Global Variable ${ZTD_LEAF_THUMBPRINT} '${ZtdThumbprint}' +*** Settings *** +# @file +# +Documentation DFCI Certificate Support +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process +Library ${CURDIR}${/}..${/}Python${/}CertSupportLib.py + +*** Keywords *** + +Set DDS CA cert + Set Global Variable ${NEW_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA.cer + Set Global Variable ${NEW_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf.pfx + Set Global Variable ${OLD_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf2.pfx + Set Global Variable ${OLD_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA2.cer + + +Set DDS CA2 cert + Set Global Variable ${NEW_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA2.cer + Set Global Variable ${NEW_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf2.pfx + Set Global Variable ${OLD_OWNER_PFX} ${CERTS_DIR}${/}DDS_Leaf.pfx + Set Global Variable ${OLD_OWNER_CERT} ${CERTS_DIR}${/}DDS_CA.cer + + +Set MDM CA cert + Set Global Variable ${NEW_USER_CERT} ${CERTS_DIR}${/}MDM_CA.cer + Set Global Variable ${NEW_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf.pfx + Set Global Variable ${OLD_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf2.pfx + Set Global Variable ${OLD_USER_CERT} ${CERTS_DIR}${/}MDM_CA2.cer + + +Set MDM CA2 cert + Set Global Variable ${NEW_USER_CERT} ${CERTS_DIR}${/}MDM_CA2.cer + Set Global Variable ${NEW_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf2.pfx + Set Global Variable ${OLD_USER_PFX} ${CERTS_DIR}${/}MDM_Leaf.pfx + Set Global Variable ${OLD_USER_CERT} ${CERTS_DIR}${/}MDM_CA.cer + + +Initialize Thumbprints + [Arguments] ${OwnerThumbprint} ${UserThumbprint} + + ${DdsCA}= Set Variable ${CERTS_DIR}${/}DDS_CA.pfx + ${MdmCA}= Set Variable ${CERTS_DIR}${/}MDM_CA.pfx + ${ZtdLeaf}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.pfx + ${ZtdCert}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.cer + + ${DdsThumbprint}= Get Thumbprint From Pfx ${DdsCA} + ${MdmThumbprint}= Get Thumbprint From Pfx ${MdmCA} + ${ZtdThumbprint}= Get Thumbprint From Pfx ${ZtdLeaf} + + Run Keyword If ${OwnerThumbprint} == '${DdsThumbprint}' + ... Set DDS CA2 cert + ... ELSE + ... Set DDS CA cert + Run Keyword If ${UserThumbprint} == '${MdmThumbprint}' + ... Set MDM CA2 cert + ... ELSE + ... Set MDM CA cert + + Set Global Variable ${ZTD_LEAF_PFX} ${ZtdLeaf} + Set Global Variable ${ZTD_LEAF_CERT} ${ZtdCert} + Set Global Variable ${DDS_CA_THUMBPRINT} '${DdsThumbprint}' + Set Global Variable ${MDM_CA_THUMBPRINT} '${MdmThumbprint}' + Set Global Variable ${ZTD_LEAF_THUMBPRINT} '${ZtdThumbprint}' diff --git a/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Keywords.robot b/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Keywords.robot index 3d66dc5553..d37ae80ca5 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Keywords.robot +++ b/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Keywords.robot @@ -1,479 +1,479 @@ -*** Settings *** -# @file -# -Documentation DFCI Shared Keywords -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process -Library Remote http://${IP_OF_DUT}:${RF_PORT} -Library Support${/}Python${/}DFCI_SupportLib.py - - -*** Variables *** -${CMD_MFG} Get-CimInstance -ClassName Win32_ComputerSystem -Property Manufacturer | Select-Object -ExpandProperty Manufacturer -${CMD_MODEL} Get-CimInstance -ClassName Win32_ComputerSystem -Property Model | Select-Object -ExpandProperty Model -${CMD_SERIALNUMBER} Get-CimInstance -ClassName Win32_systemenclosure -Property SerialNumber | Select-Object -ExpandProperty SerialNumber -${CMD_UUID} Get-CimInstance -ClassName Win32_computersystemproduct -Property uuid | Select-Object -ExpandProperty uuid - - -*** Keywords *** -Make Dfci Output - Create Directory ${TEST_OUTPUT} - Create Directory ${TOOL_DATA_OUT_DIR} - Create Directory ${TOOL_STD_OUT_DIR} - Create Directory ${BOOT_LOG_OUT_DIR} - Empty Directory ${TOOL_DATA_OUT_DIR} - Empty Directory ${TOOL_STD_OUT_DIR} - Empty Directory ${BOOT_LOG_OUT_DIR} - -Compare Files - [Arguments] ${CompareFile1} ${CompareFile2} ${ExpectedRC} - - ${result}= Run Process fc.exe /b ${CompareFile1} ${CompareFile2} - Log all stdout: ${result.stdout} - Log all stderr: ${result.stderr} - Should Be Equal As Integers ${result.rc} ${ExpectedRC} - - -############################################################ -# Get system under test Information # -############################################################ - -Get System Under Test SerialNumber - ${Value}= Run PowerShell And Return Output ${CMD_SERIALNUMBER} - Should Be True '${Value}' != 'Error' - Should Be True '${Value}' != '' - [Return] ${Value} - - -Get System Under Test Manufacturer - ${Value}= Run PowerShell And Return Output ${CMD_MFG} - Should Be True '${Value}' != 'Error' - Should Be True '${Value}' != '' - [Return] ${Value} - - -Get System Under Test ProductName - ${Value}= Run PowerShell And Return Output ${CMD_MODEL} - Should Be True '${Value}' != 'Error' - Should Be True '${Value}' != '' - [Return] ${Value} - - -############################################################ -# Print Routines for each Package # -############################################################ -Print Provisioning Package - [Arguments] ${binfile} ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GenerateCertProvisionData.py -p ${binfile} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - -Print Permission Package - [Arguments] ${binfile} ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GeneratePermissionPacketData.py -p ${binfile} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - -Print Settings Package - [Arguments] ${binfile} ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GenerateSettingsPacketData.py -p ${binfile} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - - -############################################################ -# Get results of each Package # -############################################################ -Get Provisioning Result Package - [Arguments] ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --Provisioning --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - - -Get Permission Result Package - [Arguments] ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --Permissions --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - - -Get Settings Result Package - [Arguments] ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --Settings --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - - -############################################################ -# Get Current Settings Value in XML # -############################################################ -Get Current Settings Package - [Arguments] ${stdoutfile} - ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --CurrentSettings --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} - Log File ${stdoutfile} - Should Be Equal As Integers ${result.rc} 0 - - -Verify Provision Response - [Arguments] ${pktfile} ${ResponseFile} ${ExpectedRc} - @{rc2}= get status and sessionid from identity results ${ResponseFile} - ${id2}= get sessionid from identity packet ${pktfile} - ${rc2zstring}= get uefistatus string ${rc2}[0] - ${ExpectedString}= get uefistatus string ${ExpectedRc} - Should Be Equal As Integers ${rc2}[1] ${id2} - Should Be Equal As strings ${rc2zstring} ${ExpectedString} - - -Verify Permission Response - [Arguments] ${pktfile} ${ResponseFile} ${ExpectedRc} - @{rc2}= get status and sessionid from permission results ${ResponseFile} - ${id2}= get sessionid from permission packet ${pktfile} - ${rc2zstring}= get uefistatus string ${rc2}[0] - ${ExpectedString}= get uefistatus string ${ExpectedRc} - Should Be Equal As Integers ${rc2}[1] ${id2} - Should Be Equal As strings ${rc2zstring} ${ExpectedString} - - -Verify Settings Response - [Arguments] ${pktfile} ${ResponseFile} ${ExpectedRc} ${checktype} - @{rc2}= get status and sessionid from settings results ${ResponseFile} ${checktype} - ${id2}= get sessionid from settings packet ${pktfile} - ${rc2zstring}= get uefistatus string ${rc2}[0] - ${ExpectedString}= get uefistatus string ${ExpectedRc} - Should Be Equal As Integers ${rc2}[1] ${id2} - Should Be Equal As strings ${rc2zstring} ${ExpectedString} - - -Verify Identity Current - [Arguments] ${xmlfile} ${Mfg} ${ProdName} ${SerialNumber} - ${rc}= Verify Device Id ${xmlfile} ${Mfg} ${ProdName} ${SerialNumber} - Should Be Equal As Integers ${rc} 0 - ${rc}= Verify Dfci Version ${xmlfile} 2 - Should Be True ${rc} - - -Get and Print Current Identities - [Arguments] ${currentxmlFile} - - Get Current Identities ${currentxmlFile} - Print Xml Payload ${currentxmlFile} - - -Get and Print Current Permissions - [Arguments] ${currentxmlFile} - - Get Current Permissions ${currentxmlFile} - Print Xml Payload ${currentxmlFile} - - -Get and Print Current Settings - [Arguments] ${currentxmlFile} - - Get Current Settings ${currentxmlFile} - Print Xml Payload ${currentxmlFile} - - -Get and Print Device Identifier - [Arguments] ${currentxmlFile} - - Get Device Identifier ${currentxmlFile} - Print Xml Payload ${currentxmlFile} - - -############################################################ -# Resetting system and wait for reboot complete # -############################################################ - -Wait For System Online - [Arguments] ${retries} - FOR ${index} IN RANGE ${retries} - ${result} = Is Device Online ${IP_OF_DUT} - Exit For Loop If '${result}' == 'True' - Sleep 5sec "Waiting for system to come back Online" - END - Should Be True ${result} System failed to come online: pinging ${IP_OF_DUT} failed ${retries} times - -Wait For System Offline - [Arguments] ${retries} - FOR ${index} IN RANGE ${retries} - ${result} = Is Device Online ${IP_OF_DUT} - Exit For Loop If '${result}' == 'False' - Sleep 5sec "Waiting for system to go offline" - END - Should Not Be True ${result} System failed to go offline: pinged ${IP_OF_DUT} ${retries} times - -Wait For Remote Robot - [Arguments] ${timeinseconds} - FOR ${retries} IN RANGE ${timeinseconds} - Log To Console Waiting for Robot To Ack ${retries} - ${status} ${message} Run Keyword And Ignore Error Remote Ack - Return From Keyword If '${status}' == 'PASS' ${message} - Sleep 1 - END - Return From Keyword ${False} - -Reboot System And Wait For System Online - remote_warm_reboot - Wait For System Offline 60 - Wait For System Online 60 - Wait For Remote Robot 15 - -Reboot System To Firmware And Wait For System Online - remote_reboot_to_firmware - Wait For System Offline 60 - Wait For System Online 120 - Wait For Remote Robot 15 - - -############################################################ -# Verify NO APPLY variables present # -############################################################ - -Verify No Mailboxes Have Data - - @{rcid}= GetUefiVariable ${IDENTITY_APPLY} ${IDENTITY_GUID} ${None} - Run Keyword If ${rcid}[0] != ${STATUS_VARIABLE_NOT_FOUND} - ... SetUefiVariable ${IDENTITY_APPLY} ${IDENTITY_GUID} - - @{rcid2}= GetUefiVariable ${IDENTITY2_APPLY} ${IDENTITY_GUID} ${None} - Run Keyword If ${rcid2}[0] != ${STATUS_VARIABLE_NOT_FOUND} - ... SetUefiVariable ${IDENTITY2_APPLY} ${IDENTITY_GUID} - - @{rcperm}= GetUefiVariable ${PERMISSION_APPLY} ${PERMISSION_GUID} ${None} - Run Keyword If ${rcperm}[0] != ${STATUS_VARIABLE_NOT_FOUND} - ... SetUefiVariable ${PERMISSION_APPLY} ${IDENTITY_GUID} - - @{rcperm2}= GetUefiVariable ${PERMISSION2_APPLY} ${PERMISSION_GUID} ${None} - Run Keyword If ${rcperm2}[0] != ${STATUS_VARIABLE_NOT_FOUND} - ... SetUefiVariable ${PERMISSION2_APPLY} ${IDENTITY_GUID} - - @{rcset}= GetUefiVariable ${SETTINGS_APPLY} ${SETTINGS_GUID} ${None} - Run Keyword If ${rcset}[0] != ${STATUS_VARIABLE_NOT_FOUND} - ... SetUefiVariable ${SETTINGS_APPLY} ${IDENTITY_GUID} - - @{rcset2}= GetUefiVariable ${SETTINGS2_APPLY} ${SETTINGS_GUID} ${None} - Run Keyword If ${rcset2}[0] != ${STATUS_VARIABLE_NOT_FOUND} - ... SetUefiVariable ${SETTINGS2_APPLY} ${IDENTITY_GUID} - - Should Be True ${rcid}[0] == ${STATUS_VARIABLE_NOT_FOUND} - Should Be True ${rcperm}[0] == ${STATUS_VARIABLE_NOT_FOUND} - Should Be True ${rcperm2}[0] == ${STATUS_VARIABLE_NOT_FOUND} - Should Be True ${rcset}[0] == ${STATUS_VARIABLE_NOT_FOUND} - Should Be True ${rcset2}[0] == ${STATUS_VARIABLE_NOT_FOUND} - - -# Create an Unenroll Identity Package File -# - -# binFile = Output binary package to send to DUT -# signPfx = Pfx file to sign the package -# testSignPfx = Pfx file to verify signing with cert file -# certFile = Cert used to verify incoming pkts -# KEY_INDEX = Which key to unenroll -# TargetParms = list with version and target information -# -Create Dfci Provisioning Package - [Arguments] ${binfile} ${signPfx} ${testSignPfx} ${certFile} ${KEY_INDEX} @{TargetParms} - - File Should Exist ${signPfx} - File Should Exist ${testSignPfx} - File Should Exist ${certFile} - - ${Result}= Run Process python.exe ${GEN_IDENTITY} --CertFilePath ${certFile} --Step2AEnable --Signing2APfxFile ${testSignPfx} --Step2BEnable --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --Step1Enable --Identity ${KEY_INDEX} @{TargetParms} - - Log all stdout: ${result.stdout} - Log all stderr: ${result.stderr} - - Should Be Equal As Integers ${result.rc} 0 - File Should Exist ${binfile} - - -# Create an Unenroll Identity Package File -# -# binFile = Output binary package to send to DUT -# signPfx = Pfx file to sign the package -# KEY_INDEX = Which key to unenroll -# TargetParms = list with version and target information -# -Create Dfci UnEnroll Package - [Arguments] ${binfile} ${signPfx} ${KEY_INDEX} @{TargetParms} - - File Should Exist ${signPfx} - - ${Result}= Run Process python.exe ${GEN_IDENTITY} --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --Step1Enable --Identity ${KEY_INDEX} @{TargetParms} - - Log all stdout: ${result.stdout} - Log all stderr: ${result.stderr} - - Should Be Equal As Integers ${result.rc} 0 - File Should Exist ${binfile} - - -# Create a Permissions Package File -# -# binFile = Output binary package to send to DUT -# signPfx = Pfx file to sign the package -# xmlFile = The permissions XML file to apply -# TargetParms = list with version and target information -# -Create Dfci Permission Package - [Arguments] ${binfile} ${signPfx} ${xmlFile} @{TargetParms} - - File Should Exist ${signPfx} - File Should Exist ${xmlFile} - - ${Result}= Run Process python.exe ${GEN_PERMISSIONS} --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --Step1Enable --XmlFilePath ${xmlFile} @{TargetParms} - - Log all stdout: ${result.stdout} - Log all stderr: ${result.stderr} - - Should Be Equal As Integers ${result.rc} 0 - File Should Exist ${binfile} - - -# Create a Settings Package File -# -# binFile = Output binary package to send to DUT -# signPfx = Pfx file to sign the package -# xmlFile = The settings XML file to apply -# TargetParms = list with version and target information -# -Create Dfci Settings Package - [Arguments] ${binfile} ${signPfx} ${xmlFile} @{TargetParms} - File Should Exist ${xmlFile} - - IF '${signPfx}' == 'UNSIGNED' - ${Result}= Run Process python.exe ${GEN_SETTINGS} --HdrVersion 2 --Step1Enable --PrepResultFile ${binfile} --XmlFilePath ${xmlFile} @{TargetParms} - ELSE - File Should Exist ${signPfx} - ${Result}= Run Process python.exe ${GEN_SETTINGS} --HdrVersion 2 --Step1Enable --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --XmlFilePath ${xmlFile} @{TargetParms} - END - - Log all stdout: ${result.stdout} - Log all stderr: ${result.stderr} - - Should Be Equal As Integers ${result.rc} 0 - File Should Exist ${binfile} - - -######################################################################## -# Apply a Provision (Identity) Package, and check the results # -######################################################################## -Process Provision Packet - [Arguments] ${TestName} ${mailbox} ${signPfxFile} ${testsignPfxFile} ${ownerCertFile} ${KEY_INDEX} @{TargetParms} - ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_Provision_apply.log - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Provision_apply.bin - - #Create and deploy an identity packet - - Create Dfci Provisioning Package ${binPackageFile} ${signPfxFile} ${testsignPfxFile} ${ownerCertFile} ${KEY_INDEX} @{TargetParms} - Print Provisioning Package ${binPackageFile} ${applyPackageFile} - - Apply Identity ${mailbox} ${binPackageFile} - - -Validate Provision Status - [Arguments] ${TestName} ${mailbox} ${expectedStatus} - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Provision_apply.bin - ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Provision_result.bin - - Get Identity Results ${mailbox} ${binResultFile} - - Verify Provision Response ${binPackageFile} ${binResultFile} ${expectedStatus} - - -############################################################## -# Apply a Permission Package, and check the results # -############################################################## -Process Permission Packet - [Arguments] ${TestName} ${mailbox} ${ownerPfxFile} ${PayloadFile} @{TargetParms} - ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_Permission_apply.log - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_apply.bin - - - #Create and deploy a permissions packet - - Create Dfci Permission Package ${binPackageFile} ${ownerPfxFile} ${PayloadFile} @{TargetParms} - Print Permission Package ${binPackageFile} ${applyPackageFile} - - Apply Permission ${mailbox} ${binPackageFile} - - -Validate Permission Status - [Arguments] ${TestName} ${mailbox} ${expectedStatus} - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_apply.bin - ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_result.bin - ${xmlResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_result.xml - - Get Permission Results ${mailbox} ${binResultFile} - - Verify Permission Response ${binPackageFile} ${binResultFile} ${expectedStatus} - - # V1 doesn't have permission payload - Return From Keyword If '${TARGET_VERSION}' == 'V1' - - Get Payload From Permissions Results ${binResultFile} ${xmlResultFile} - File Should Exist ${xmlResultFile} - [return] ${xmlResultFile} - - -############################################################ -# Apply a Settings Package, and check the results # -############################################################ -Process Settings Packet - [Arguments] ${TestName} ${mailbox} ${ownerPfxFile} ${PayloadFile} @{TargetParms} - ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_Settings_apply.log - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_apply.bin - - #Create and deploy a settings packet - - Create Dfci Settings Package ${binPackageFile} ${ownerPfxFile} ${PayloadFile} @{TargetParms} - Print Settings Package ${binPackageFile} ${applyPackageFile} - - Apply Settings ${mailbox} ${binPackageFile} - - -Validate Settings Status - [Arguments] ${TestName} ${mailbox} ${expectedStatus} ${full} - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_apply.bin - ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_result.bin - ${xmlResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_result.xml - - Get Settings Results ${mailbox} ${binResultFile} - - Verify Settings Response ${binPackageFile} ${binResultFile} ${expectedStatus} ${full} - - Get Payload From Settings Results ${binResultFile} ${xmlResultFile} - Run Keyword If '${expectedStatus}' == ${STATUS_SUCCESS} File Should Exist ${xmlResultFile} - [return] ${xmlResultFile} - - -######################################################################## -# Process Unenroll Package # -######################################################################## -Process UnEnroll Packet - [Arguments] ${TestName} ${mailbox} ${signPfxFile} ${KEY_INDEX} @{TargetParms} - ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_UnEnroll_apply.log - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_UnEnroll_apply.bin - - #Create and deploy an identity packet - - Create Dfci Unenroll Package ${binPackageFile} ${signPfxFile} ${KEY_INDEX} @{TargetParms} - Print Provisioning Package ${binPackageFile} ${applyPackageFile} - - Apply Identity ${mailbox} ${binPackageFile} - - -Validate UnEnroll Status - [Arguments] ${TestName} ${mailbox} ${expectedStatus} - ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_UnEnroll_apply.bin - ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_UnEnroll_result.bin - - Get Identity Results ${mailbox} ${binResultFile} - - Verify Provision Response ${binPackageFile} ${binResultFile} ${expectedStatus} +*** Settings *** +# @file +# +Documentation DFCI Shared Keywords +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process +Library Remote http://${IP_OF_DUT}:${RF_PORT} +Library Support${/}Python${/}DFCI_SupportLib.py + + +*** Variables *** +${CMD_MFG} Get-CimInstance -ClassName Win32_ComputerSystem -Property Manufacturer | Select-Object -ExpandProperty Manufacturer +${CMD_MODEL} Get-CimInstance -ClassName Win32_ComputerSystem -Property Model | Select-Object -ExpandProperty Model +${CMD_SERIALNUMBER} Get-CimInstance -ClassName Win32_systemenclosure -Property SerialNumber | Select-Object -ExpandProperty SerialNumber +${CMD_UUID} Get-CimInstance -ClassName Win32_computersystemproduct -Property uuid | Select-Object -ExpandProperty uuid + + +*** Keywords *** +Make Dfci Output + Create Directory ${TEST_OUTPUT} + Create Directory ${TOOL_DATA_OUT_DIR} + Create Directory ${TOOL_STD_OUT_DIR} + Create Directory ${BOOT_LOG_OUT_DIR} + Empty Directory ${TOOL_DATA_OUT_DIR} + Empty Directory ${TOOL_STD_OUT_DIR} + Empty Directory ${BOOT_LOG_OUT_DIR} + +Compare Files + [Arguments] ${CompareFile1} ${CompareFile2} ${ExpectedRC} + + ${result}= Run Process fc.exe /b ${CompareFile1} ${CompareFile2} + Log all stdout: ${result.stdout} + Log all stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} ${ExpectedRC} + + +############################################################ +# Get system under test Information # +############################################################ + +Get System Under Test SerialNumber + ${Value}= Run PowerShell And Return Output ${CMD_SERIALNUMBER} + Should Be True '${Value}' != 'Error' + Should Be True '${Value}' != '' + [Return] ${Value} + + +Get System Under Test Manufacturer + ${Value}= Run PowerShell And Return Output ${CMD_MFG} + Should Be True '${Value}' != 'Error' + Should Be True '${Value}' != '' + [Return] ${Value} + + +Get System Under Test ProductName + ${Value}= Run PowerShell And Return Output ${CMD_MODEL} + Should Be True '${Value}' != 'Error' + Should Be True '${Value}' != '' + [Return] ${Value} + + +############################################################ +# Print Routines for each Package # +############################################################ +Print Provisioning Package + [Arguments] ${binfile} ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GenerateCertProvisionData.py -p ${binfile} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + +Print Permission Package + [Arguments] ${binfile} ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GeneratePermissionPacketData.py -p ${binfile} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + +Print Settings Package + [Arguments] ${binfile} ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GenerateSettingsPacketData.py -p ${binfile} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + + +############################################################ +# Get results of each Package # +############################################################ +Get Provisioning Result Package + [Arguments] ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --Provisioning --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + + +Get Permission Result Package + [Arguments] ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --Permissions --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + + +Get Settings Result Package + [Arguments] ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --Settings --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + + +############################################################ +# Get Current Settings Value in XML # +############################################################ +Get Current Settings Package + [Arguments] ${stdoutfile} + ${result} = Run Process ${DFCI_PY_PATH}${/}GetSEMResultData.py --CurrentSettings --IpAddress ${IP_OF_DUT} shell=Yes timeout=10sec stdout=${stdoutfile} + Log File ${stdoutfile} + Should Be Equal As Integers ${result.rc} 0 + + +Verify Provision Response + [Arguments] ${pktfile} ${ResponseFile} ${ExpectedRc} + @{rc2}= get status and sessionid from identity results ${ResponseFile} + ${id2}= get sessionid from identity packet ${pktfile} + ${rc2zstring}= get uefistatus string ${rc2}[0] + ${ExpectedString}= get uefistatus string ${ExpectedRc} + Should Be Equal As Integers ${rc2}[1] ${id2} + Should Be Equal As strings ${rc2zstring} ${ExpectedString} + + +Verify Permission Response + [Arguments] ${pktfile} ${ResponseFile} ${ExpectedRc} + @{rc2}= get status and sessionid from permission results ${ResponseFile} + ${id2}= get sessionid from permission packet ${pktfile} + ${rc2zstring}= get uefistatus string ${rc2}[0] + ${ExpectedString}= get uefistatus string ${ExpectedRc} + Should Be Equal As Integers ${rc2}[1] ${id2} + Should Be Equal As strings ${rc2zstring} ${ExpectedString} + + +Verify Settings Response + [Arguments] ${pktfile} ${ResponseFile} ${ExpectedRc} ${checktype} + @{rc2}= get status and sessionid from settings results ${ResponseFile} ${checktype} + ${id2}= get sessionid from settings packet ${pktfile} + ${rc2zstring}= get uefistatus string ${rc2}[0] + ${ExpectedString}= get uefistatus string ${ExpectedRc} + Should Be Equal As Integers ${rc2}[1] ${id2} + Should Be Equal As strings ${rc2zstring} ${ExpectedString} + + +Verify Identity Current + [Arguments] ${xmlfile} ${Mfg} ${ProdName} ${SerialNumber} + ${rc}= Verify Device Id ${xmlfile} ${Mfg} ${ProdName} ${SerialNumber} + Should Be Equal As Integers ${rc} 0 + ${rc}= Verify Dfci Version ${xmlfile} 2 + Should Be True ${rc} + + +Get and Print Current Identities + [Arguments] ${currentxmlFile} + + Get Current Identities ${currentxmlFile} + Print Xml Payload ${currentxmlFile} + + +Get and Print Current Permissions + [Arguments] ${currentxmlFile} + + Get Current Permissions ${currentxmlFile} + Print Xml Payload ${currentxmlFile} + + +Get and Print Current Settings + [Arguments] ${currentxmlFile} + + Get Current Settings ${currentxmlFile} + Print Xml Payload ${currentxmlFile} + + +Get and Print Device Identifier + [Arguments] ${currentxmlFile} + + Get Device Identifier ${currentxmlFile} + Print Xml Payload ${currentxmlFile} + + +############################################################ +# Resetting system and wait for reboot complete # +############################################################ + +Wait For System Online + [Arguments] ${retries} + FOR ${index} IN RANGE ${retries} + ${result} = Is Device Online ${IP_OF_DUT} + Exit For Loop If '${result}' == 'True' + Sleep 5sec "Waiting for system to come back Online" + END + Should Be True ${result} System failed to come online: pinging ${IP_OF_DUT} failed ${retries} times + +Wait For System Offline + [Arguments] ${retries} + FOR ${index} IN RANGE ${retries} + ${result} = Is Device Online ${IP_OF_DUT} + Exit For Loop If '${result}' == 'False' + Sleep 5sec "Waiting for system to go offline" + END + Should Not Be True ${result} System failed to go offline: pinged ${IP_OF_DUT} ${retries} times + +Wait For Remote Robot + [Arguments] ${timeinseconds} + FOR ${retries} IN RANGE ${timeinseconds} + Log To Console Waiting for Robot To Ack ${retries} + ${status} ${message} Run Keyword And Ignore Error Remote Ack + Return From Keyword If '${status}' == 'PASS' ${message} + Sleep 1 + END + Return From Keyword ${False} + +Reboot System And Wait For System Online + remote_warm_reboot + Wait For System Offline 60 + Wait For System Online 60 + Wait For Remote Robot 15 + +Reboot System To Firmware And Wait For System Online + remote_reboot_to_firmware + Wait For System Offline 60 + Wait For System Online 120 + Wait For Remote Robot 15 + + +############################################################ +# Verify NO APPLY variables present # +############################################################ + +Verify No Mailboxes Have Data + + @{rcid}= GetUefiVariable ${IDENTITY_APPLY} ${IDENTITY_GUID} ${None} + Run Keyword If ${rcid}[0] != ${STATUS_VARIABLE_NOT_FOUND} + ... SetUefiVariable ${IDENTITY_APPLY} ${IDENTITY_GUID} + + @{rcid2}= GetUefiVariable ${IDENTITY2_APPLY} ${IDENTITY_GUID} ${None} + Run Keyword If ${rcid2}[0] != ${STATUS_VARIABLE_NOT_FOUND} + ... SetUefiVariable ${IDENTITY2_APPLY} ${IDENTITY_GUID} + + @{rcperm}= GetUefiVariable ${PERMISSION_APPLY} ${PERMISSION_GUID} ${None} + Run Keyword If ${rcperm}[0] != ${STATUS_VARIABLE_NOT_FOUND} + ... SetUefiVariable ${PERMISSION_APPLY} ${IDENTITY_GUID} + + @{rcperm2}= GetUefiVariable ${PERMISSION2_APPLY} ${PERMISSION_GUID} ${None} + Run Keyword If ${rcperm2}[0] != ${STATUS_VARIABLE_NOT_FOUND} + ... SetUefiVariable ${PERMISSION2_APPLY} ${IDENTITY_GUID} + + @{rcset}= GetUefiVariable ${SETTINGS_APPLY} ${SETTINGS_GUID} ${None} + Run Keyword If ${rcset}[0] != ${STATUS_VARIABLE_NOT_FOUND} + ... SetUefiVariable ${SETTINGS_APPLY} ${IDENTITY_GUID} + + @{rcset2}= GetUefiVariable ${SETTINGS2_APPLY} ${SETTINGS_GUID} ${None} + Run Keyword If ${rcset2}[0] != ${STATUS_VARIABLE_NOT_FOUND} + ... SetUefiVariable ${SETTINGS2_APPLY} ${IDENTITY_GUID} + + Should Be True ${rcid}[0] == ${STATUS_VARIABLE_NOT_FOUND} + Should Be True ${rcperm}[0] == ${STATUS_VARIABLE_NOT_FOUND} + Should Be True ${rcperm2}[0] == ${STATUS_VARIABLE_NOT_FOUND} + Should Be True ${rcset}[0] == ${STATUS_VARIABLE_NOT_FOUND} + Should Be True ${rcset2}[0] == ${STATUS_VARIABLE_NOT_FOUND} + + +# Create an Unenroll Identity Package File +# + +# binFile = Output binary package to send to DUT +# signPfx = Pfx file to sign the package +# testSignPfx = Pfx file to verify signing with cert file +# certFile = Cert used to verify incoming pkts +# KEY_INDEX = Which key to unenroll +# TargetParms = list with version and target information +# +Create Dfci Provisioning Package + [Arguments] ${binfile} ${signPfx} ${testSignPfx} ${certFile} ${KEY_INDEX} @{TargetParms} + + File Should Exist ${signPfx} + File Should Exist ${testSignPfx} + File Should Exist ${certFile} + + ${Result}= Run Process python.exe ${GEN_IDENTITY} --CertFilePath ${certFile} --Step2AEnable --Signing2APfxFile ${testSignPfx} --Step2BEnable --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --Step1Enable --Identity ${KEY_INDEX} @{TargetParms} + + Log all stdout: ${result.stdout} + Log all stderr: ${result.stderr} + + Should Be Equal As Integers ${result.rc} 0 + File Should Exist ${binfile} + + +# Create an Unenroll Identity Package File +# +# binFile = Output binary package to send to DUT +# signPfx = Pfx file to sign the package +# KEY_INDEX = Which key to unenroll +# TargetParms = list with version and target information +# +Create Dfci UnEnroll Package + [Arguments] ${binfile} ${signPfx} ${KEY_INDEX} @{TargetParms} + + File Should Exist ${signPfx} + + ${Result}= Run Process python.exe ${GEN_IDENTITY} --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --Step1Enable --Identity ${KEY_INDEX} @{TargetParms} + + Log all stdout: ${result.stdout} + Log all stderr: ${result.stderr} + + Should Be Equal As Integers ${result.rc} 0 + File Should Exist ${binfile} + + +# Create a Permissions Package File +# +# binFile = Output binary package to send to DUT +# signPfx = Pfx file to sign the package +# xmlFile = The permissions XML file to apply +# TargetParms = list with version and target information +# +Create Dfci Permission Package + [Arguments] ${binfile} ${signPfx} ${xmlFile} @{TargetParms} + + File Should Exist ${signPfx} + File Should Exist ${xmlFile} + + ${Result}= Run Process python.exe ${GEN_PERMISSIONS} --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --Step1Enable --XmlFilePath ${xmlFile} @{TargetParms} + + Log all stdout: ${result.stdout} + Log all stderr: ${result.stderr} + + Should Be Equal As Integers ${result.rc} 0 + File Should Exist ${binfile} + + +# Create a Settings Package File +# +# binFile = Output binary package to send to DUT +# signPfx = Pfx file to sign the package +# xmlFile = The settings XML file to apply +# TargetParms = list with version and target information +# +Create Dfci Settings Package + [Arguments] ${binfile} ${signPfx} ${xmlFile} @{TargetParms} + File Should Exist ${xmlFile} + + IF '${signPfx}' == 'UNSIGNED' + ${Result}= Run Process python.exe ${GEN_SETTINGS} --HdrVersion 2 --Step1Enable --PrepResultFile ${binfile} --XmlFilePath ${xmlFile} @{TargetParms} + ELSE + File Should Exist ${signPfx} + ${Result}= Run Process python.exe ${GEN_SETTINGS} --HdrVersion 2 --Step1Enable --Step2Enable --SigningPfxFile ${signPfx} --Step3Enable --FinalizeResultFile ${binfile} --XmlFilePath ${xmlFile} @{TargetParms} + END + + Log all stdout: ${result.stdout} + Log all stderr: ${result.stderr} + + Should Be Equal As Integers ${result.rc} 0 + File Should Exist ${binfile} + + +######################################################################## +# Apply a Provision (Identity) Package, and check the results # +######################################################################## +Process Provision Packet + [Arguments] ${TestName} ${mailbox} ${signPfxFile} ${testsignPfxFile} ${ownerCertFile} ${KEY_INDEX} @{TargetParms} + ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_Provision_apply.log + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Provision_apply.bin + + #Create and deploy an identity packet + + Create Dfci Provisioning Package ${binPackageFile} ${signPfxFile} ${testsignPfxFile} ${ownerCertFile} ${KEY_INDEX} @{TargetParms} + Print Provisioning Package ${binPackageFile} ${applyPackageFile} + + Apply Identity ${mailbox} ${binPackageFile} + + +Validate Provision Status + [Arguments] ${TestName} ${mailbox} ${expectedStatus} + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Provision_apply.bin + ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Provision_result.bin + + Get Identity Results ${mailbox} ${binResultFile} + + Verify Provision Response ${binPackageFile} ${binResultFile} ${expectedStatus} + + +############################################################## +# Apply a Permission Package, and check the results # +############################################################## +Process Permission Packet + [Arguments] ${TestName} ${mailbox} ${ownerPfxFile} ${PayloadFile} @{TargetParms} + ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_Permission_apply.log + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_apply.bin + + + #Create and deploy a permissions packet + + Create Dfci Permission Package ${binPackageFile} ${ownerPfxFile} ${PayloadFile} @{TargetParms} + Print Permission Package ${binPackageFile} ${applyPackageFile} + + Apply Permission ${mailbox} ${binPackageFile} + + +Validate Permission Status + [Arguments] ${TestName} ${mailbox} ${expectedStatus} + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_apply.bin + ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_result.bin + ${xmlResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Permission_result.xml + + Get Permission Results ${mailbox} ${binResultFile} + + Verify Permission Response ${binPackageFile} ${binResultFile} ${expectedStatus} + + # V1 doesn't have permission payload + Return From Keyword If '${TARGET_VERSION}' == 'V1' + + Get Payload From Permissions Results ${binResultFile} ${xmlResultFile} + File Should Exist ${xmlResultFile} + [return] ${xmlResultFile} + + +############################################################ +# Apply a Settings Package, and check the results # +############################################################ +Process Settings Packet + [Arguments] ${TestName} ${mailbox} ${ownerPfxFile} ${PayloadFile} @{TargetParms} + ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_Settings_apply.log + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_apply.bin + + #Create and deploy a settings packet + + Create Dfci Settings Package ${binPackageFile} ${ownerPfxFile} ${PayloadFile} @{TargetParms} + Print Settings Package ${binPackageFile} ${applyPackageFile} + + Apply Settings ${mailbox} ${binPackageFile} + + +Validate Settings Status + [Arguments] ${TestName} ${mailbox} ${expectedStatus} ${full} + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_apply.bin + ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_result.bin + ${xmlResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_Settings_result.xml + + Get Settings Results ${mailbox} ${binResultFile} + + Verify Settings Response ${binPackageFile} ${binResultFile} ${expectedStatus} ${full} + + Get Payload From Settings Results ${binResultFile} ${xmlResultFile} + Run Keyword If '${expectedStatus}' == ${STATUS_SUCCESS} File Should Exist ${xmlResultFile} + [return] ${xmlResultFile} + + +######################################################################## +# Process Unenroll Package # +######################################################################## +Process UnEnroll Packet + [Arguments] ${TestName} ${mailbox} ${signPfxFile} ${KEY_INDEX} @{TargetParms} + ${applyPackageFile}= Set Variable ${TOOL_STD_OUT_DIR}${/}${TestName}_UnEnroll_apply.log + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_UnEnroll_apply.bin + + #Create and deploy an identity packet + + Create Dfci Unenroll Package ${binPackageFile} ${signPfxFile} ${KEY_INDEX} @{TargetParms} + Print Provisioning Package ${binPackageFile} ${applyPackageFile} + + Apply Identity ${mailbox} ${binPackageFile} + + +Validate UnEnroll Status + [Arguments] ${TestName} ${mailbox} ${expectedStatus} + ${binPackageFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_UnEnroll_apply.bin + ${binResultFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${TestName}_UnEnroll_result.bin + + Get Identity Results ${mailbox} ${binResultFile} + + Verify Provision Response ${binPackageFile} ${binResultFile} ${expectedStatus} diff --git a/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Paths.robot b/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Paths.robot index c6473e7dba..17ac6bf9af 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Paths.robot +++ b/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_Shared_Paths.robot @@ -1,80 +1,80 @@ -*** Settings *** -# @file -# -Documentation This test suite tests the standard DFCI feature set for regressions. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -*** Variables *** -#DFCI python scripts -${DFCI_PY_PATH} Support${/}Python -# Tools used -${GEN_IDENTITY} ${DFCI_PY_PATH}${/}GenerateCertProvisionData.py -${GEN_PERMISSIONS} ${DFCI_PY_PATH}${/}GeneratePermissionPacketData.py -${GEN_SETTINGS} ${DFCI_PY_PATH}${/}GenerateSettingsPacketData.py - - -${OWNER_KEY_INDEX} 1 -${USER_KEY_INDEX} 2 -${USER_KEY1_INDEX} 3 -${USER_KEY2_INDEX} 4 -${ZTD_KEY_INDEX} 5 - - -${STATUS_SUCCESS} 0 -${STATUS_VARIABLE_NOT_FOUND} 203 -${STATUS_LOAD_ERROR} 0x8000000000000001 -${STATUS_INVALID_PARAMETER} 0x8000000000000002 -${STATUS_UNSUPPORTED} 0x8000000000000003 -${STATUS_BAD_BUFFER_SIZE} 0x8000000000000004 -${STATUS_BUFFER_TO_SMALL} 0x8000000000000005 -${STATUS_NOT_READY} 0x8000000000000006 -${STATUS_DEVICE_ERROR} 0x8000000000000007 -${STATUS_NOT_FOUND} 0x800000000000000E -${STATUS_ACCESS_DENIED} 0x800000000000000F -${STATUS_NO_MAPPING} 0x8000000000000011 -${STATUS_ABORTED} 0x8000000000000015 -${STATUS_SECURITY_VIOLATION} 0x800000000000001A - -# -# Device Identifier Variables -# -${DEVICE_ID_GUID} 4123a1a9-6f50-4b58-9c3d-56fc24c6c89e - -${DEVICE_ID_CURRENT} DfciDeviceIdentifier - -# -# Identity Variables -# -${DFCI_ATTRIBUTES} 7 - -${IDENTITY_GUID} DE6A8726-05DF-43CE-B600-92BD5D286CFD - -${IDENTITY_CURRENT} DfciIdentityCurrent -${IDENTITY_APPLY} DfciIdentityApply -${IDENTITY_RESULT} DfciIdentityResult -${IDENTITY2_APPLY} DfciIdentity2Apply -${IDENTITY2_RESULT} DfciIdentity2Result - -# -# Permission Variables -# -${PERMISSION_GUID} 3a9777ea-0d9f-4b65-9ef3-7caa7c41994b - -${PERMISSION_CURRENT} DfciPermissionCurrent -${PERMISSION_APPLY} DfciPermissionApply -${PERMISSION_RESULT} DfciPermissionResult -${PERMISSION2_APPLY} DfciPermission2Apply -${PERMISSION2_RESULT} DfciPermission2Result - -# -# Settings Variables -# -${SETTINGS_GUID} D41C8C24-3F5E-4EF4-8FDD-073E1866CD01 - -${SETTINGS_CURRENT} DfciSettingsCurrent -${SETTINGS_APPLY} DfciSettingsRequest -${SETTINGS_RESULT} DfciSettingsResult -${SETTINGS2_APPLY} DfciSettings2Request -${SETTINGS2_RESULT} DfciSettings2Result +*** Settings *** +# @file +# +Documentation This test suite tests the standard DFCI feature set for regressions. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +*** Variables *** +#DFCI python scripts +${DFCI_PY_PATH} Support${/}Python +# Tools used +${GEN_IDENTITY} ${DFCI_PY_PATH}${/}GenerateCertProvisionData.py +${GEN_PERMISSIONS} ${DFCI_PY_PATH}${/}GeneratePermissionPacketData.py +${GEN_SETTINGS} ${DFCI_PY_PATH}${/}GenerateSettingsPacketData.py + + +${OWNER_KEY_INDEX} 1 +${USER_KEY_INDEX} 2 +${USER_KEY1_INDEX} 3 +${USER_KEY2_INDEX} 4 +${ZTD_KEY_INDEX} 5 + + +${STATUS_SUCCESS} 0 +${STATUS_VARIABLE_NOT_FOUND} 203 +${STATUS_LOAD_ERROR} 0x8000000000000001 +${STATUS_INVALID_PARAMETER} 0x8000000000000002 +${STATUS_UNSUPPORTED} 0x8000000000000003 +${STATUS_BAD_BUFFER_SIZE} 0x8000000000000004 +${STATUS_BUFFER_TO_SMALL} 0x8000000000000005 +${STATUS_NOT_READY} 0x8000000000000006 +${STATUS_DEVICE_ERROR} 0x8000000000000007 +${STATUS_NOT_FOUND} 0x800000000000000E +${STATUS_ACCESS_DENIED} 0x800000000000000F +${STATUS_NO_MAPPING} 0x8000000000000011 +${STATUS_ABORTED} 0x8000000000000015 +${STATUS_SECURITY_VIOLATION} 0x800000000000001A + +# +# Device Identifier Variables +# +${DEVICE_ID_GUID} 4123a1a9-6f50-4b58-9c3d-56fc24c6c89e + +${DEVICE_ID_CURRENT} DfciDeviceIdentifier + +# +# Identity Variables +# +${DFCI_ATTRIBUTES} 7 + +${IDENTITY_GUID} DE6A8726-05DF-43CE-B600-92BD5D286CFD + +${IDENTITY_CURRENT} DfciIdentityCurrent +${IDENTITY_APPLY} DfciIdentityApply +${IDENTITY_RESULT} DfciIdentityResult +${IDENTITY2_APPLY} DfciIdentity2Apply +${IDENTITY2_RESULT} DfciIdentity2Result + +# +# Permission Variables +# +${PERMISSION_GUID} 3a9777ea-0d9f-4b65-9ef3-7caa7c41994b + +${PERMISSION_CURRENT} DfciPermissionCurrent +${PERMISSION_APPLY} DfciPermissionApply +${PERMISSION_RESULT} DfciPermissionResult +${PERMISSION2_APPLY} DfciPermission2Apply +${PERMISSION2_RESULT} DfciPermission2Result + +# +# Settings Variables +# +${SETTINGS_GUID} D41C8C24-3F5E-4EF4-8FDD-073E1866CD01 + +${SETTINGS_CURRENT} DfciSettingsCurrent +${SETTINGS_APPLY} DfciSettingsRequest +${SETTINGS_RESULT} DfciSettingsResult +${SETTINGS2_APPLY} DfciSettings2Request +${SETTINGS2_RESULT} DfciSettings2Result diff --git a/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_VariableTransport.robot b/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_VariableTransport.robot index 0c660bbd22..9cbb2cac95 100644 --- a/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_VariableTransport.robot +++ b/DfciPkg/UnitTests/DfciTests/Support/Robot/DFCI_VariableTransport.robot @@ -1,105 +1,105 @@ -*** Settings *** -# @file -# -Documentation DFCI Variable Transport Keywords -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process -Library Remote http://${IP_OF_DUT}:${RF_PORT} -Library Support${/}Python${/}DFCI_SupportLib.py - - -*** Keywords *** - - -Generic Get With Variables - [Arguments] ${Variable} ${VariableGuid} ${outputXmlFile} ${Trim} - @{rc}= GetUefiVariable ${Variable} ${VariableGuid} ${Trim} - Should Be True ${rc}[0] == 0 - Create Binary File ${outputXmlFile} ${rc}[1] - File Should Exist ${outputXmlFile} - - -Generic Set With Variables - [Arguments] ${Variable} ${VariableGuid} ${VariableFile} - File Should Exist ${VariableFile} - ${FileContents}= Get Binary File ${VariableFile} - ${rc}= SetUefiVariable ${Variable} ${VariableGuid} ${DFCI_ATTRIBUTES} ${FileContents} - Should Be True ${rc} == 1 - - -# -# Device Identifier operations -# -Get Device Identifier - [Arguments] ${outputXmlFile} - Generic Get With Variables ${DEVICE_ID_CURRENT} ${DEVICE_ID_GUID} ${outputXmlFile} trim - - -# -# Identity operations -# -Get Current Identities - [Arguments] ${outputXmlFile} - Generic Get With Variables ${IDENTITY_CURRENT} ${IDENTITY_GUID} ${outputXmlFile} trim - - -Apply Identity - [Arguments] ${mailbox} ${binPkgFile} - ${identityApply}= Set Variable If '${mailbox}' == '1' ${IDENTITY_APPLY} ${IDENTITY2_APPLY} - - Generic Set With Variables ${identityApply} ${IDENTITY_GUID} ${binPkgFile} - - -Get Identity Results - [Arguments] ${mailbox} ${binResultPkgFile} - ${identityResult}= Set Variable If '${mailbox}' == '1' ${IDENTITY_RESULT} ${IDENTITY2_RESULT} - - Generic Get With Variables ${identityResult} ${IDENTITY_GUID} ${binResultPkgFIle} ${None} - - -# -# Permissionoperations -# -Get Current Permissions - [Arguments] ${outputXmlFile} - Generic Get With Variables ${PERMISSION_CURRENT} ${PERMISSION_GUID} ${outputXmlFile} trim - - -Apply Permission - [Arguments] ${mailbox} ${binPkgFile} - ${permissionApply}= Set Variable If '${mailbox}' == '1' ${PERMISSION_APPLY} ${PERMISSION2_APPLY} - - Generic Set With Variables ${permissionApply} ${PERMISSION_GUID} ${binPkgFile} - - -Get Permission Results - [Arguments] ${mailbox} ${binResultPkgFile} - ${permissionResult}= Set Variable If '${mailbox}' == '1' ${PERMISSION_RESULT} ${PERMISSION2_RESULT} - - Generic Get With Variables ${permissionResult} ${PERMISSION_GUID} ${binResultPkgFIle} ${None} - - -# -# Settings Operations -# -Get Current Settings - [Arguments] ${outputXmlFile} - Generic Get With Variables ${SETTINGS_CURRENT} ${SETTINGS_GUID} ${outputXmlFile} trim - - -Apply Settings - [Arguments] ${mailbox} ${binPkgFile} - ${settingsApply}= Set Variable If '${mailbox}' == '1' ${SETTINGS_APPLY} ${SETTINGS2_APPLY} - - Generic Set With Variables ${settingsApply} ${SETTINGS_GUID} ${binPkgFile} - - -Get Settings Results - [Arguments] ${mailbox} ${binResultPkgFile} - ${settingsResult}= Set Variable If '${mailbox}' == '1' ${SETTINGS_RESULT} ${SETTINGS2_RESULT} - +*** Settings *** +# @file +# +Documentation DFCI Variable Transport Keywords +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process +Library Remote http://${IP_OF_DUT}:${RF_PORT} +Library Support${/}Python${/}DFCI_SupportLib.py + + +*** Keywords *** + + +Generic Get With Variables + [Arguments] ${Variable} ${VariableGuid} ${outputXmlFile} ${Trim} + @{rc}= GetUefiVariable ${Variable} ${VariableGuid} ${Trim} + Should Be True ${rc}[0] == 0 + Create Binary File ${outputXmlFile} ${rc}[1] + File Should Exist ${outputXmlFile} + + +Generic Set With Variables + [Arguments] ${Variable} ${VariableGuid} ${VariableFile} + File Should Exist ${VariableFile} + ${FileContents}= Get Binary File ${VariableFile} + ${rc}= SetUefiVariable ${Variable} ${VariableGuid} ${DFCI_ATTRIBUTES} ${FileContents} + Should Be True ${rc} == 1 + + +# +# Device Identifier operations +# +Get Device Identifier + [Arguments] ${outputXmlFile} + Generic Get With Variables ${DEVICE_ID_CURRENT} ${DEVICE_ID_GUID} ${outputXmlFile} trim + + +# +# Identity operations +# +Get Current Identities + [Arguments] ${outputXmlFile} + Generic Get With Variables ${IDENTITY_CURRENT} ${IDENTITY_GUID} ${outputXmlFile} trim + + +Apply Identity + [Arguments] ${mailbox} ${binPkgFile} + ${identityApply}= Set Variable If '${mailbox}' == '1' ${IDENTITY_APPLY} ${IDENTITY2_APPLY} + + Generic Set With Variables ${identityApply} ${IDENTITY_GUID} ${binPkgFile} + + +Get Identity Results + [Arguments] ${mailbox} ${binResultPkgFile} + ${identityResult}= Set Variable If '${mailbox}' == '1' ${IDENTITY_RESULT} ${IDENTITY2_RESULT} + + Generic Get With Variables ${identityResult} ${IDENTITY_GUID} ${binResultPkgFIle} ${None} + + +# +# Permissionoperations +# +Get Current Permissions + [Arguments] ${outputXmlFile} + Generic Get With Variables ${PERMISSION_CURRENT} ${PERMISSION_GUID} ${outputXmlFile} trim + + +Apply Permission + [Arguments] ${mailbox} ${binPkgFile} + ${permissionApply}= Set Variable If '${mailbox}' == '1' ${PERMISSION_APPLY} ${PERMISSION2_APPLY} + + Generic Set With Variables ${permissionApply} ${PERMISSION_GUID} ${binPkgFile} + + +Get Permission Results + [Arguments] ${mailbox} ${binResultPkgFile} + ${permissionResult}= Set Variable If '${mailbox}' == '1' ${PERMISSION_RESULT} ${PERMISSION2_RESULT} + + Generic Get With Variables ${permissionResult} ${PERMISSION_GUID} ${binResultPkgFIle} ${None} + + +# +# Settings Operations +# +Get Current Settings + [Arguments] ${outputXmlFile} + Generic Get With Variables ${SETTINGS_CURRENT} ${SETTINGS_GUID} ${outputXmlFile} trim + + +Apply Settings + [Arguments] ${mailbox} ${binPkgFile} + ${settingsApply}= Set Variable If '${mailbox}' == '1' ${SETTINGS_APPLY} ${SETTINGS2_APPLY} + + Generic Set With Variables ${settingsApply} ${SETTINGS_GUID} ${binPkgFile} + + +Get Settings Results + [Arguments] ${mailbox} ${binResultPkgFile} + ${settingsResult}= Set Variable If '${mailbox}' == '1' ${SETTINGS_RESULT} ${SETTINGS2_RESULT} + Generic Get With Variables ${settingsResult} ${SETTINGS_GUID} ${binResultPkgFIle} ${None} \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/DfciPermission.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/DfciPermission.xml index 1c64543d7e..eb428d3a3a 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/DfciPermission.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/DfciPermission.xml @@ -1,60 +1,60 @@ - - - - DFCI Tester - 2018-03-28 - 1 - 1 - - - - Dfci.OwnerKey.Enum - 136 - 128 - - - - Dfci.UserKey.Enum - 192 - 128 - - - Dfci.User1Key.Enum - 192 - 192 - - - Dfci.User2Key.Enum - 192 - 192 - - - Dfci.RecoveryUrl.String - 128 - 128 - - + + + + DFCI Tester + 2018-03-28 + 1 + 1 + + + + Dfci.OwnerKey.Enum + 136 + 128 + + + + Dfci.UserKey.Enum + 192 + 128 + + + Dfci.User1Key.Enum + 192 + 192 + + + Dfci.User2Key.Enum + 192 + 192 + + + Dfci.RecoveryUrl.String + 128 + 128 + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/run.robot index b66a0819f5..2b8f26f19c 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_CertChainingTest/run.robot @@ -1,272 +1,272 @@ -*** Settings *** -# @file -# -Documentation This test suite uses verifies that the ZTD leaf cert will verify against a packet signed by the ZTD_CA.pfx. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot -Resource Support${/}Robot${/}CertSupport.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Test Teardown Terminate All Processes - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_CertChainingTest - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - -*** Keywords *** - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -*** Test Cases *** - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - - ${nameofTest}= Set Variable DisplaySettingsAtStart - ${ZtdLeafPfxFile}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.pfx - ${ZTD_LEAF_THUMBPRINT}= Get Thumbprint From Pfx ${ZtdLeafPfxFile} - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - ${ZtdThumbprint}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - Should Be True '${OwnerThumbprint}' == 'Cert not installed' - Should Be True '${UserThumbprint}' == 'Cert not installed' - - Log To Console . - Log To Console The following test insures that the test ZTD_Leaf.cer - Log To Console is the cert installed. If not, this test cannot be run. - Should Be True '${ZtdThumbprint}' == ${ZTD_LEAF_THUMBPRINT} - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Attempt Enroll DDS CA cert Signed by ZTD_CA to System Being Enrolled - [Setup] Require test case Obtain Target Parameters From Target - - ${nameofTest}= Set Variable DDSwithBadKey - ${ownerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_CA.pfx - ${ownerCertFile}= Set Variable ${CERTS_DIR}${/}DDS_CA.cer - ${signerPfxFile}= Set Variable ${CERTS_DIR}${/}ZTD_CA.pfx - ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}DDSwithBadKey.log - - Process Provision Packet ${nameofTest} 1 ${signerPfxFile} ${ownerPfxFile} ${ownerCertFile} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} - - ${OwnerCertThumbprint}= Get Thumbprint From Pfx ${ownerPfxFile} - Log To Console . - Log To Console ${OwnerCertThumbprint} - Log To Console Should be prompted, CANCEL THE PROMPT - - Reboot System And Wait For System Online - - Validate Provision Status ${nameofTest} 1 ${STATUS_ABORTED} - Get and Print Current Identities ${currentIdxmlFile} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - Should Be True '${rc}' != 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == 'Cert not installed' - - -Enroll DDS CA cert Signed by ZTD_Leaf to System Being Enrolled - [Setup] Require test case Attempt Enroll DDS CA cert Signed by ZTD_CA to System Being Enrolled - - ${nameofTest}= Set Variable DDSwithGoodKey - ${ownerCertFile}= Set Variable ${CERTS_DIR}${/}DDS_CA.cer - ${ZTDsignerPfxFile}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.pfx - ${DDSsignerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_Leaf.pfx - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciPermission.xml - ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - - # The DDS Owner Enroll is signed by the ZTD_Leaf in order to have zero touch enroll - Process Provision Packet ${nameofTest} 1 ${ZTDsignerPfxFile} ${DDSsignerPfxFile} ${ownerCertFile} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} - - # Must grant permissions to enroll the MDM. These permissions need to be signed - # by the owner key, in this case DDS_Leaf - Process Permission Packet ${nameofTest} 1 ${DDSsignerPfxFile} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}DDSwithGoodKey.log - - Reboot System And Wait For System Online - - Get and Print Current Identities ${currentIdxmlFile} - Get and Print Current Permissions ${currentPermxmlFile} - - Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} - Validate Permission Status ${nameofTest} 1 ${STATUS_SUCCESS} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - Should Be True '${rc}' != 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' != 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == 'Cert not installed' - - -Enroll MDM CA cert Signed by DDS_Leaf to System Being Enrolled - [Setup] Require test case Enroll DDS CA cert Signed by ZTD_Leaf to System Being Enrolled - - ${nameofTest}= Set Variable MDMwithGoodKey - ${ownerPfxFile}= Set Variable ${CERTS_DIR}${/}MDM_CA.pfx - ${ownerCertFile}= Set Variable ${CERTS_DIR}${/}MDM_CA.cer - ${signerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_Leaf.pfx - ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - - Process Provision Packet ${nameofTest} 1 ${signerPfxFile} ${ownerPfxFile} ${ownerCertFile} ${USER_KEY_INDEX} @{TARGET_PARAMETERS} - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}MDMwithGoodKey.log - - Reboot System And Wait For System Online - - Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} - Get and Print Current Identities ${currentIdxmlFile} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - Should Be True '${rc}' != 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' != 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' != 'Cert not installed' - - -Send DDS Unenroll signed by DDS_Leaf to complete UnEnroll - [Setup] Require test case Enroll MDM CA cert Signed by DDS_Leaf to System Being Enrolled - - ${nameofTest}= Set Variable UnEnrollDDS - ${ownerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_Leaf.pfx - ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - - Process UnEnroll Packet ${nameofTest} 1 ${ownerPfxFile} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}UnEnrollDDS.log - - Reboot System And Wait For System Online - - Validate UnEnroll Status ${nameofTest} 1 ${STATUS_SUCCESS} - Get and Print Current Identities ${currentIdxmlFile} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - Should Be True '${rc}' != 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == 'Cert not installed' - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - Should Be True '${rc}' == ${ZTD_LEAF_THUMBPRINT} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == 'Cert not installed' +*** Settings *** +# @file +# +Documentation This test suite uses verifies that the ZTD leaf cert will verify against a packet signed by the ZTD_CA.pfx. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot +Resource Support${/}Robot${/}CertSupport.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Test Teardown Terminate All Processes + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_CertChainingTest + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + +*** Keywords *** + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +*** Test Cases *** + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + + ${nameofTest}= Set Variable DisplaySettingsAtStart + ${ZtdLeafPfxFile}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.pfx + ${ZTD_LEAF_THUMBPRINT}= Get Thumbprint From Pfx ${ZtdLeafPfxFile} + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + ${ZtdThumbprint}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + Should Be True '${OwnerThumbprint}' == 'Cert not installed' + Should Be True '${UserThumbprint}' == 'Cert not installed' + + Log To Console . + Log To Console The following test insures that the test ZTD_Leaf.cer + Log To Console is the cert installed. If not, this test cannot be run. + Should Be True '${ZtdThumbprint}' == ${ZTD_LEAF_THUMBPRINT} + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Attempt Enroll DDS CA cert Signed by ZTD_CA to System Being Enrolled + [Setup] Require test case Obtain Target Parameters From Target + + ${nameofTest}= Set Variable DDSwithBadKey + ${ownerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_CA.pfx + ${ownerCertFile}= Set Variable ${CERTS_DIR}${/}DDS_CA.cer + ${signerPfxFile}= Set Variable ${CERTS_DIR}${/}ZTD_CA.pfx + ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}DDSwithBadKey.log + + Process Provision Packet ${nameofTest} 1 ${signerPfxFile} ${ownerPfxFile} ${ownerCertFile} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} + + ${OwnerCertThumbprint}= Get Thumbprint From Pfx ${ownerPfxFile} + Log To Console . + Log To Console ${OwnerCertThumbprint} + Log To Console Should be prompted, CANCEL THE PROMPT + + Reboot System And Wait For System Online + + Validate Provision Status ${nameofTest} 1 ${STATUS_ABORTED} + Get and Print Current Identities ${currentIdxmlFile} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + Should Be True '${rc}' != 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == 'Cert not installed' + + +Enroll DDS CA cert Signed by ZTD_Leaf to System Being Enrolled + [Setup] Require test case Attempt Enroll DDS CA cert Signed by ZTD_CA to System Being Enrolled + + ${nameofTest}= Set Variable DDSwithGoodKey + ${ownerCertFile}= Set Variable ${CERTS_DIR}${/}DDS_CA.cer + ${ZTDsignerPfxFile}= Set Variable ${CERTS_DIR}${/}ZTD_Leaf.pfx + ${DDSsignerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_Leaf.pfx + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciPermission.xml + ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + + # The DDS Owner Enroll is signed by the ZTD_Leaf in order to have zero touch enroll + Process Provision Packet ${nameofTest} 1 ${ZTDsignerPfxFile} ${DDSsignerPfxFile} ${ownerCertFile} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} + + # Must grant permissions to enroll the MDM. These permissions need to be signed + # by the owner key, in this case DDS_Leaf + Process Permission Packet ${nameofTest} 1 ${DDSsignerPfxFile} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}DDSwithGoodKey.log + + Reboot System And Wait For System Online + + Get and Print Current Identities ${currentIdxmlFile} + Get and Print Current Permissions ${currentPermxmlFile} + + Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} + Validate Permission Status ${nameofTest} 1 ${STATUS_SUCCESS} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + Should Be True '${rc}' != 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' != 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == 'Cert not installed' + + +Enroll MDM CA cert Signed by DDS_Leaf to System Being Enrolled + [Setup] Require test case Enroll DDS CA cert Signed by ZTD_Leaf to System Being Enrolled + + ${nameofTest}= Set Variable MDMwithGoodKey + ${ownerPfxFile}= Set Variable ${CERTS_DIR}${/}MDM_CA.pfx + ${ownerCertFile}= Set Variable ${CERTS_DIR}${/}MDM_CA.cer + ${signerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_Leaf.pfx + ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + + Process Provision Packet ${nameofTest} 1 ${signerPfxFile} ${ownerPfxFile} ${ownerCertFile} ${USER_KEY_INDEX} @{TARGET_PARAMETERS} + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}MDMwithGoodKey.log + + Reboot System And Wait For System Online + + Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} + Get and Print Current Identities ${currentIdxmlFile} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + Should Be True '${rc}' != 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' != 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' != 'Cert not installed' + + +Send DDS Unenroll signed by DDS_Leaf to complete UnEnroll + [Setup] Require test case Enroll MDM CA cert Signed by DDS_Leaf to System Being Enrolled + + ${nameofTest}= Set Variable UnEnrollDDS + ${ownerPfxFile}= Set Variable ${CERTS_DIR}${/}DDS_Leaf.pfx + ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + + Process UnEnroll Packet ${nameofTest} 1 ${ownerPfxFile} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}UnEnrollDDS.log + + Reboot System And Wait For System Online + + Validate UnEnroll Status ${nameofTest} 1 ${STATUS_SUCCESS} + Get and Print Current Identities ${currentIdxmlFile} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + Should Be True '${rc}' != 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == 'Cert not installed' + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + ${currentIdxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsxmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + Should Be True '${rc}' == ${ZTD_LEAF_THUMBPRINT} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == 'Cert not installed' diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/DfciSettings2.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/DfciSettings2.xml index b7bef5cc41..fe3f2e48c3 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/DfciSettings2.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/DfciSettings2.xml @@ -1,39 +1,39 @@ - - - - DFCI Tester - 2018-03-29 12:37:00 - 2 - 2 - - - MDM.FriendlyName.String - The DFCI Test Lab - - - MDM.TenantName.String - The DFCI Test Lab Tenant - - - Dfci.OnboardCameras.Enable - Disabled - - - Dfci.OnboardAudio.Enable - Disabled - - - Dfci.BootOnboardNetwork.Enable - Disabled - - + + + + DFCI Tester + 2018-03-29 12:37:00 + 2 + 2 + + + MDM.FriendlyName.String + The DFCI Test Lab + + + MDM.TenantName.String + The DFCI Test Lab Tenant + + + Dfci.OnboardCameras.Enable + Disabled + + + Dfci.OnboardAudio.Enable + Disabled + + + Dfci.BootOnboardNetwork.Enable + Disabled + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/run.robot index 5b1c9448de..687794af3b 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneBadUpdate/run.robot @@ -1,156 +1,156 @@ -*** Settings *** -# @file -# -Documentation This test attempts to change the owner cert signed with the wrong cert. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Test Teardown Terminate All Processes kill=True - - -*** Variables *** -##default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneBadUpdate - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -*** Test Cases *** - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - Should Be True '${OwnerThumbprint}' != 'Cert not installed' - Should Be True '${UserThumbprint}' != 'Cert not installed' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Send User Settings Packet Signed with wrong cert to Enrolled System - [Setup] Require test case Obtain Target Parameters From Target - - ${nameofTest}= Set Variable UserSettings - ${signerPfxFile}= Set Variable ${NEW_USER_PFX} - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings2.xml - - Process Settings Packet ${nameofTest} 2 ${signerPfxFile} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - -Restart System to Apply Bad Settings - [Setup] Require test case Send User Settings Packet Signed with wrong cert to Enrolled System - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}ApplyBadSettings.log - - Log To Console Restart - - Reboot System And Wait For System Online - -Verify User Update System Settings Results - ${nameofTest}= Set Variable UserSettings - - Validate Settings Status ${nameofTest} 2 ${STATUS_SECURITY_VIOLATION} FULL - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint} Get Thumbprint From Pfx ${OLD_OWNER_CERT} - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == '${OwnerThumbprint}' - - ${UserThumbprint} Get Thumbprint From Pfx ${OLD_USER_CERT} - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == '${UserThumbprint}' - - -Clean Up Mailboxes +*** Settings *** +# @file +# +Documentation This test attempts to change the owner cert signed with the wrong cert. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Test Teardown Terminate All Processes kill=True + + +*** Variables *** +##default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneBadUpdate + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +*** Test Cases *** + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + Should Be True '${OwnerThumbprint}' != 'Cert not installed' + Should Be True '${UserThumbprint}' != 'Cert not installed' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Send User Settings Packet Signed with wrong cert to Enrolled System + [Setup] Require test case Obtain Target Parameters From Target + + ${nameofTest}= Set Variable UserSettings + ${signerPfxFile}= Set Variable ${NEW_USER_PFX} + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings2.xml + + Process Settings Packet ${nameofTest} 2 ${signerPfxFile} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + +Restart System to Apply Bad Settings + [Setup] Require test case Send User Settings Packet Signed with wrong cert to Enrolled System + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}ApplyBadSettings.log + + Log To Console Restart + + Reboot System And Wait For System Online + +Verify User Update System Settings Results + ${nameofTest}= Set Variable UserSettings + + Validate Settings Status ${nameofTest} 2 ${STATUS_SECURITY_VIOLATION} FULL + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint} Get Thumbprint From Pfx ${OLD_OWNER_CERT} + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == '${OwnerThumbprint}' + + ${UserThumbprint} Get Thumbprint From Pfx ${OLD_USER_CERT} + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == '${UserThumbprint}' + + +Clean Up Mailboxes Verify No Mailboxes Have Data \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/BuildSettings.bat b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/BuildSettings.bat index 746eaf3dc8..ea3ca2ee02 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/BuildSettings.bat +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/BuildSettings.bat @@ -1,10 +1,10 @@ -@echo off -rem @file -rem -rem Script to insert a cert into an XML settings packet -rem -rem Copyright (c), Microsoft Corporation -rem SPDX-License-Identifier: BSD-2-Clause-Patent -rem - -..\..\Support\Python\InsertCertIntoXML.py --BinFilePath ..\..\certs\DFCI_HTTPS.cer --OutputFilePath DfciSettings.xml --PatternFilePath DfciSettingsPattern.xml +@echo off +rem @file +rem +rem Script to insert a cert into an XML settings packet +rem +rem Copyright (c), Microsoft Corporation +rem SPDX-License-Identifier: BSD-2-Clause-Patent +rem + +..\..\Support\Python\InsertCertIntoXML.py --BinFilePath ..\..\certs\DFCI_HTTPS.cer --OutputFilePath DfciSettings.xml --PatternFilePath DfciSettingsPattern.xml diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission.xml index 172acc5921..750daf46e9 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission.xml @@ -1,77 +1,77 @@ - - - - DFCI Tester - 2020-03-27 10:22:00 - 1 - 1 - - - - Dfci.OwnerKey.Enum - 128 - 128 - - - - Dfci.UserKey.Enum - 192 - 128 - - - Dfci.RecoveryBootstrapUrl.String - 128 - 128 - - - Dfci.RecoveryUrl.String - 128 - 128 - - - Dfci.HttpsCert.Binary - 128 - 128 - - - Dfci.RegistrationId.String - 128 - 128 - - - Dfci.TenantId.String - 128 - 128 - - - Dfci3.AssetTag.String - 192 - 64 - - - + + + + DFCI Tester + 2020-03-27 10:22:00 + 1 + 1 + + + + Dfci.OwnerKey.Enum + 128 + 128 + + + + Dfci.UserKey.Enum + 192 + 128 + + + Dfci.RecoveryBootstrapUrl.String + 128 + 128 + + + Dfci.RecoveryUrl.String + 128 + 128 + + + Dfci.HttpsCert.Binary + 128 + 128 + + + Dfci.RegistrationId.String + 128 + 128 + + + Dfci.TenantId.String + 128 + 128 + + + Dfci3.AssetTag.String + 192 + 64 + + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission2.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission2.xml index d00a7db55b..929b5bb3a2 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission2.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciPermission2.xml @@ -1,52 +1,52 @@ - - - - DFCI Tester - 2020-03-27 10:22:00 - 1 - 1 - - - - Dfci.OnboardCameras.Enable - 64 - - - Dfci.OnboardRadios.Enable - 64 - - - Dfci.BootExternalMedia.Enable - 64 - - - MDM.FriendlyName.String - 64 - - - MDM.TenantName.String - 64 - - - Dfci3.AssetTag.String - 64 - - + + + + DFCI Tester + 2020-03-27 10:22:00 + 1 + 1 + + + + Dfci.OnboardCameras.Enable + 64 + + + Dfci.OnboardRadios.Enable + 64 + + + Dfci.BootExternalMedia.Enable + 64 + + + MDM.FriendlyName.String + 64 + + + MDM.TenantName.String + 64 + + + Dfci3.AssetTag.String + 64 + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettings2.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettings2.xml index 91e2c308a1..a818757372 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettings2.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettings2.xml @@ -1,51 +1,51 @@ - - - - DFCI Tester - 2020-03-27 10:22:00 - 2 - 2 - - - MDM.FriendlyName.String - The DFCI Test Lab - - - MDM.TenantName.String - The DFCI Test Lab Tenant - - - Dfci.OnboardCameras.Enable - Disabled - - - Dfci.OnboardRadios.Enable - Disabled - - - Dfci.BootExternalMedia.Enable - Disabled - - - Dfci3.OnboardWpbt.Enable - Disabled - - - Dfci3.ProcessorSMT.Enable - Disabled - - - Dfci3.AssetTag.String - DFCI.LAB.001234 - - + + + + DFCI Tester + 2020-03-27 10:22:00 + 2 + 2 + + + MDM.FriendlyName.String + The DFCI Test Lab + + + MDM.TenantName.String + The DFCI Test Lab Tenant + + + Dfci.OnboardCameras.Enable + Disabled + + + Dfci.OnboardRadios.Enable + Disabled + + + Dfci.BootExternalMedia.Enable + Disabled + + + Dfci3.OnboardWpbt.Enable + Disabled + + + Dfci3.ProcessorSMT.Enable + Disabled + + + Dfci3.AssetTag.String + DFCI.LAB.001234 + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettingsPattern.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettingsPattern.xml index 59b3c56448..e95d3f4d35 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettingsPattern.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/DfciSettingsPattern.xml @@ -1,73 +1,73 @@ - - - - DFCI Tester - 2019-09-20 14:30:00 - 2 - - 2 - - - Dfci.RecoveryBootstrapUrl.String - http://mikeytbds3.eastus.cloudapp.azure.com/ztd/noauth/dfci/recovery-bootstrap/ - - - Dfci.RecoveryUrl.String - https://mikeytbds3.eastus.cloudapp.azure.com/ztd/unauth/dfci/recovery-packets/ - - - Dfci.HttpsCert.Binary - - - XYZZY - - - - Dfci.RegistrationId.String - - 12345678-1234-5678-1234-012345674321 - - - - Dfci.TenantId.String - - 98765432-1234-5678-1234-012345674321 - - - - Device.SecureBootKeys.Enum - - None - - - Device.BootOrderLock.Enable - Disabled - - + + + + DFCI Tester + 2019-09-20 14:30:00 + 2 + + 2 + + + Dfci.RecoveryBootstrapUrl.String + http://mikeytbds3.eastus.cloudapp.azure.com/ztd/noauth/dfci/recovery-bootstrap/ + + + Dfci.RecoveryUrl.String + https://mikeytbds3.eastus.cloudapp.azure.com/ztd/unauth/dfci/recovery-packets/ + + + Dfci.HttpsCert.Binary + + + XYZZY + + + + Dfci.RegistrationId.String + + 12345678-1234-5678-1234-012345674321 + + + + Dfci.TenantId.String + + 98765432-1234-5678-1234-012345674321 + + + + Device.SecureBootKeys.Enum + + None + + + Device.BootOrderLock.Enable + Disabled + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/run.robot index 0ba019ed78..a9bb7d29cd 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneEnroll/run.robot @@ -1,261 +1,261 @@ -*** Settings *** -# @file -# -Documentation This test suite enrolls an owner and user into DFCI. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - - -Library OperatingSystem -Library Process - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Test Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneEnroll - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -*** Test Cases *** - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - Should Be True '${OwnerThumbprint}' == 'Cert not installed' - Should Be True '${UserThumbprint}' == 'Cert not installed' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - -Send Owner Enroll Packet to System Being Enrolled - [Setup] Require test case Obtain Target Parameters From Target - - ${nameofTest}= Set Variable OwnerEnroll - - Process Provision Packet ${nameofTest} 1 ${ZTD_LEAF_PFX} ${NEW_OWNER_PFX} ${NEW_OWNER_CERT} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} - - -Send Owner Permission Packet to Enrolled System - [Setup] Require test case Send Owner Enroll Packet to System Being Enrolled - ${nameofTest}= Set Variable OwnerPermissions - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciPermission.xml - - Process Permission Packet ${nameofTest} 1 ${NEW_OWNER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - -Send User Enroll to System Being Enrolled - [Setup] Require test case Send Owner Permission Packet to Enrolled System - - # This adds the User key, packet signed by ownerkey - - ${nameofTest}= Set Variable UserEnroll - - Process Provision Packet ${nameofTest} 2 ${NEW_OWNER_PFX} ${NEW_USER_PFX} ${NEW_USER_CERT} ${USER_KEY_INDEX} @{TARGET_PARAMETERS} - - -Send User Permission Packet to Enrolled System - [Setup] Require test case Send User Enroll to System Being Enrolled - #Files for the Permission package - ${nameofTest}= Set Variable UserPermissions - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciPermission2.xml - - Process Permission Packet ${nameofTest} 2 ${NEW_USER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - -Send Owner Settings Packet to Enrolled System - [Setup] Require test case Send User Permission Packet to Enrolled System - #Initial settings for Enrolled System - ${nameofTest}= Set Variable OwnerSettings - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings.xml - - Process Settings Packet ${nameofTest} 1 ${NEW_OWNER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - -Send User Settings Packet to Enrolled System - [Setup] Require test case Send Owner Settings Packet to Enrolled System - #Initial settings for Enrolled System - ${nameofTest}= Set Variable UserSettings - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings2.xml - - Process Settings Packet ${nameofTest} 2 ${NEW_USER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - -Restart System to Apply Enrollment -# Start serial log to capture UEFI log during the restart - [Setup] Require test case Send User Settings Packet to Enrolled System - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}ApplyEnrollment.log - - Log To Console Restart - Log To Console If test Ztd cert is not installed, you will be prompted - Log To Console for the last two characters of the following thumbprint: - Log To Console Enrolling with ${DDS_CA_THUMBPRINT} - - Reboot System And Wait For System Online - - -Verify Owner Enrolled System Identity Results - ${nameofTest}= Set Variable OwnerEnroll - - Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} - - -Verify Owner Enrolled System Permission Results - ${nameofTest}= Set Variable OwnerPermissions - - ${xmlPermissionsRslt}= Validate Permission Status ${nameofTest} 1 ${STATUS_SUCCESS} - ${rc} Check All Permission Status ${xmlPermissionsRslt} ${STATUS_SUCCESS} - Should Be True ${rc} - - -Verify User Enrolled System Identity Results - ${nameofTest}= Set Variable UserEnroll - - Validate Provision Status ${nameofTest} 2 ${STATUS_SUCCESS} - - -Verify User Enrolled System Permission Results - ${nameofTest}= Set Variable UserPermissions - - ${xmlPermissionsRslt}= Validate Permission Status ${nameofTest} 2 ${STATUS_SUCCESS} - ${rc} Check All Permission Status ${xmlPermissionsRslt} ${STATUS_SUCCESS} - Should Be True ${rc} - - -Verify Owner Enrolled System Settings Results - ${nameofTest}= Set Variable OwnerSettings - - ${xmlOwnerSettingsRslt}= Validate Settings Status ${nameofTest} 1 ${STATUS_SUCCESS} FULL - ${rc} Check All Setting Status ${xmlOwnerSettingsRslt} ${STATUS_SUCCESS} - Should Be True ${rc} - -Verify User Enrolled System Settings Results - ${nameofTest}= Set Variable UserSettings - - ${xmlUserSettingsRslt}= Validate Settings Status ${nameofTest} 2 ${STATUS_SUCCESS} FULL - ${rc} Check All Setting Status ${xmlUserSettingsRslt} ${STATUS_SUCCESS} - Should Be True ${rc} - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint} Get Thumbprint From Pfx ${NEW_OWNER_CERT} - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == '${OwnerThumbprint}' - - ${UserThumbprint} Get Thumbprint From Pfx ${NEW_USER_CERT} - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == '${UserThumbprint}' - - -Clean Up Mailboxes - Verify No Mailboxes Have Data - -# -# Temporarily remove this last step as the OS doesn't always restart the system with -fw -# -##Restart System to Verify Device Setting -## Start serial log to capture UEFI log during the restart -# [Setup] Require test case Restart System to Apply Enrollment -# -# Start SerialLog ${BOOT_LOG_OUT_DIR}${/}VerifyDeviceSettings.log -# -# Log To Console Restarting to firmware -# Log To Console Check the device settings to insure that all -# Log To Console of the camera devices, and radio devices, are -# Log To Console off and grayed out. Other devices should be -# Log To Console available for the user to control. -# -# Reboot System To Firmware And Wait For System Online +*** Settings *** +# @file +# +Documentation This test suite enrolls an owner and user into DFCI. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + + +Library OperatingSystem +Library Process + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Test Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneEnroll + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +*** Test Cases *** + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + Should Be True '${OwnerThumbprint}' == 'Cert not installed' + Should Be True '${UserThumbprint}' == 'Cert not installed' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + +Send Owner Enroll Packet to System Being Enrolled + [Setup] Require test case Obtain Target Parameters From Target + + ${nameofTest}= Set Variable OwnerEnroll + + Process Provision Packet ${nameofTest} 1 ${ZTD_LEAF_PFX} ${NEW_OWNER_PFX} ${NEW_OWNER_CERT} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} + + +Send Owner Permission Packet to Enrolled System + [Setup] Require test case Send Owner Enroll Packet to System Being Enrolled + ${nameofTest}= Set Variable OwnerPermissions + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciPermission.xml + + Process Permission Packet ${nameofTest} 1 ${NEW_OWNER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + +Send User Enroll to System Being Enrolled + [Setup] Require test case Send Owner Permission Packet to Enrolled System + + # This adds the User key, packet signed by ownerkey + + ${nameofTest}= Set Variable UserEnroll + + Process Provision Packet ${nameofTest} 2 ${NEW_OWNER_PFX} ${NEW_USER_PFX} ${NEW_USER_CERT} ${USER_KEY_INDEX} @{TARGET_PARAMETERS} + + +Send User Permission Packet to Enrolled System + [Setup] Require test case Send User Enroll to System Being Enrolled + #Files for the Permission package + ${nameofTest}= Set Variable UserPermissions + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciPermission2.xml + + Process Permission Packet ${nameofTest} 2 ${NEW_USER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + +Send Owner Settings Packet to Enrolled System + [Setup] Require test case Send User Permission Packet to Enrolled System + #Initial settings for Enrolled System + ${nameofTest}= Set Variable OwnerSettings + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings.xml + + Process Settings Packet ${nameofTest} 1 ${NEW_OWNER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + +Send User Settings Packet to Enrolled System + [Setup] Require test case Send Owner Settings Packet to Enrolled System + #Initial settings for Enrolled System + ${nameofTest}= Set Variable UserSettings + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings2.xml + + Process Settings Packet ${nameofTest} 2 ${NEW_USER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + +Restart System to Apply Enrollment +# Start serial log to capture UEFI log during the restart + [Setup] Require test case Send User Settings Packet to Enrolled System + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}ApplyEnrollment.log + + Log To Console Restart + Log To Console If test Ztd cert is not installed, you will be prompted + Log To Console for the last two characters of the following thumbprint: + Log To Console Enrolling with ${DDS_CA_THUMBPRINT} + + Reboot System And Wait For System Online + + +Verify Owner Enrolled System Identity Results + ${nameofTest}= Set Variable OwnerEnroll + + Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} + + +Verify Owner Enrolled System Permission Results + ${nameofTest}= Set Variable OwnerPermissions + + ${xmlPermissionsRslt}= Validate Permission Status ${nameofTest} 1 ${STATUS_SUCCESS} + ${rc} Check All Permission Status ${xmlPermissionsRslt} ${STATUS_SUCCESS} + Should Be True ${rc} + + +Verify User Enrolled System Identity Results + ${nameofTest}= Set Variable UserEnroll + + Validate Provision Status ${nameofTest} 2 ${STATUS_SUCCESS} + + +Verify User Enrolled System Permission Results + ${nameofTest}= Set Variable UserPermissions + + ${xmlPermissionsRslt}= Validate Permission Status ${nameofTest} 2 ${STATUS_SUCCESS} + ${rc} Check All Permission Status ${xmlPermissionsRslt} ${STATUS_SUCCESS} + Should Be True ${rc} + + +Verify Owner Enrolled System Settings Results + ${nameofTest}= Set Variable OwnerSettings + + ${xmlOwnerSettingsRslt}= Validate Settings Status ${nameofTest} 1 ${STATUS_SUCCESS} FULL + ${rc} Check All Setting Status ${xmlOwnerSettingsRslt} ${STATUS_SUCCESS} + Should Be True ${rc} + +Verify User Enrolled System Settings Results + ${nameofTest}= Set Variable UserSettings + + ${xmlUserSettingsRslt}= Validate Settings Status ${nameofTest} 2 ${STATUS_SUCCESS} FULL + ${rc} Check All Setting Status ${xmlUserSettingsRslt} ${STATUS_SUCCESS} + Should Be True ${rc} + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint} Get Thumbprint From Pfx ${NEW_OWNER_CERT} + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == '${OwnerThumbprint}' + + ${UserThumbprint} Get Thumbprint From Pfx ${NEW_USER_CERT} + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == '${UserThumbprint}' + + +Clean Up Mailboxes + Verify No Mailboxes Have Data + +# +# Temporarily remove this last step as the OS doesn't always restart the system with -fw +# +##Restart System to Verify Device Setting +## Start serial log to capture UEFI log during the restart +# [Setup] Require test case Restart System to Apply Enrollment +# +# Start SerialLog ${BOOT_LOG_OUT_DIR}${/}VerifyDeviceSettings.log +# +# Log To Console Restarting to firmware +# Log To Console Check the device settings to insure that all +# Log To Console of the camera devices, and radio devices, are +# Log To Console off and grayed out. Other devices should be +# Log To Console available for the user to control. +# +# Reboot System To Firmware And Wait For System Online diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTunePermissions/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTunePermissions/run.robot index 9ab8e0e220..0399d9e4d4 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTunePermissions/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTunePermissions/run.robot @@ -1,263 +1,263 @@ -*** Settings *** -# @file -# -Documentation -... DFCI InTune Permissions test -... This test suite checks the action of setting a permission and the various -... PMASK and DMASK combinations. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -MetaData -... - Build a permissions packet -... - Send it to the system under test -... - Reboot the system under test to apply the permissions -... - Get the new "Current Permissions" -... - Verify the permissions are currect - -Library OperatingSystem -Library Process -Library Collections - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Support${/}Python${/}PermissionsXMLLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTunePermissions - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - -Initialize lists of tests -#[Documentation] -#... Each permission/PMask/DMask tuple is a list of three elements - the permission, PMask, and the DMask. -#... Establish a list of the permission tuples for the permissions to be set, and another -#... list for the permissions to be checked after the reboot. - - @{VTEST_01_SET1}= Create List Dfci.OnboardCameras.Enable 64 64 - @{VTEST_01_SET2}= Create List Dfci.OnboardAudio.Enable 64 64 - @{VTEST_01_CHECK1}= Create List Dfci.OnboardCameras.Enable 64 64 - @{VTEST_01_CHECK2}= Create List Dfci.OnboardAudio.Enable 64 64 - @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} ${VTEST_01_SET2} - @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} - - # Testcase 2 - @{VTEST_02_SET1}= Create List Dfci.OnboardRadios.Enable 64 64 - @{VTEST_02_CHECK1}= Create List Dfci.OnboardRadios.Enable 64 64 - @{VTEST_02_CHECK2}= Create List Dfci.OnboardCameras.Enable ${None} - @{VTEST_02_CHECK3}= Create List Dfci.OnboardAudio.Enable ${None} - @{VTEST_02_SETS}= Create List ${VTEST_02_SET1} - @{VTEST_02_CHECKS}= Create List ${VTEST_02_CHECK1} ${VTEST_02_CHECK2} ${VTEST_02_CHECK3} - - # Other tests here - - @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} 192 192 192 192 - @{VTEST_02}= Create List Test2 ${VTEST_02_SETS} ${VTEST_02_CHECKS} 193 193 193 193 - - # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists - Variables - # to be set before a reboot, and a set of variables to be checked after a reboot. For two tests, that means: - # 1. Test 1 Sets - # 2. reboot - # 3. Test 1 Checks - # 4. Test 2 Sets - # 5. reboot - # 6. Test 2 Checks - # - @{MASTER_TEST}= Create List ${VTEST_01} ${VTEST_02} - Set suite variable ${MASTER_TEST} - -# -# Use the following to ensure the lists are built correctly -# -# Log To Console . -# Log To Console ${VTEST_01_SET1} -# Log To Console ${VTEST_01_SET2} -# Log To Console ${VTEST_01_SETS} -# Log To Console ${VTEST_01_CHECKS} -# Log To Console ${VTEST_01} - - - -# -# -# -Process TestCases - [Arguments] @{ATest} - -# -# This function iterates over each of the test cases. For each test case, -# create a permissions payload, package it, send it to the system under test, -# restart the system to apply the permissions, and then validate that the -# permissions in the checklist are correct. -# - FOR ${Testname} ${Sets} ${Checks} ${PMask} ${DMask} ${CheckPMask} ${CheckDMask} IN @{ATest} - ${newPermissionsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewPermissions.xml - ${currentPermissionsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentPermissions.xml - # - # - Log To Console . - Log To Console Starting test ${Testname} - # - # Create the permissions packet - # - Create Permissions XML ${newPermissionsXmlFile} 2 2 ${PMask} ${DMask} ${Sets} - File should Exist ${newPermissionsXmlFile} - # - #Enable the serial log if the platform supports it - # - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplyPermissions.log - # - # Send the user(2) permissions packet to the system under test - # - Process Permission Packet ${Testname} 2 ${OLD_USER_PFX} ${newPermissionsXmlFile} @{TARGET_PARAMETERS} - # - # Restart the system to apply the permissions - # - Log To Console Restarting the system under test - Reboot System And Wait For System Online - # - # - Get and Print Current Permissions ${currentPermissionsXmlFile} - # - # Ensure all of the permissions set, were applied correctly - # - ${xmlPermissionsRslt}= Validate Permission Status ${Testname} 2 ${STATUS_SUCCESS} - # - # Validate the individual settings after the reboot - # - ${rc}= Validate Current Permission Defaults ${Testname} ${currentPermissionsXmlFile} ${CheckPMask} ${CheckDMask} - Should Be True ${rc} - # - ${rc}= Validate Current Permissions ${Testname} ${currentPermissionsXmlFile} ${Checks} - Should Be True ${rc} - # - ${rc} Check All Permission Status ${xmlPermissionsRslt} ${STATUS_SUCCESS} - Should Be True ${rc} - END - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -#------------------------------------------------------------------* -# Test Cases * -#------------------------------------------------------------------* -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - Should Be True '${OwnerThumbprint}' != 'Cert not installed' - Should Be True '${UserThumbprint}' != 'Cert not installed' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Process Complete Testcase List - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Running test - - FOR ${ATest} IN @{MASTER_TEST} - Process TestCases @{ATest} - END - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - -Clean Up Mailboxes - Verify No Mailboxes Have Data +*** Settings *** +# @file +# +Documentation +... DFCI InTune Permissions test +... This test suite checks the action of setting a permission and the various +... PMASK and DMASK combinations. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +MetaData +... - Build a permissions packet +... - Send it to the system under test +... - Reboot the system under test to apply the permissions +... - Get the new "Current Permissions" +... - Verify the permissions are currect + +Library OperatingSystem +Library Process +Library Collections + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Support${/}Python${/}PermissionsXMLLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTunePermissions + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + +Initialize lists of tests +#[Documentation] +#... Each permission/PMask/DMask tuple is a list of three elements - the permission, PMask, and the DMask. +#... Establish a list of the permission tuples for the permissions to be set, and another +#... list for the permissions to be checked after the reboot. + + @{VTEST_01_SET1}= Create List Dfci.OnboardCameras.Enable 64 64 + @{VTEST_01_SET2}= Create List Dfci.OnboardAudio.Enable 64 64 + @{VTEST_01_CHECK1}= Create List Dfci.OnboardCameras.Enable 64 64 + @{VTEST_01_CHECK2}= Create List Dfci.OnboardAudio.Enable 64 64 + @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} ${VTEST_01_SET2} + @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} + + # Testcase 2 + @{VTEST_02_SET1}= Create List Dfci.OnboardRadios.Enable 64 64 + @{VTEST_02_CHECK1}= Create List Dfci.OnboardRadios.Enable 64 64 + @{VTEST_02_CHECK2}= Create List Dfci.OnboardCameras.Enable ${None} + @{VTEST_02_CHECK3}= Create List Dfci.OnboardAudio.Enable ${None} + @{VTEST_02_SETS}= Create List ${VTEST_02_SET1} + @{VTEST_02_CHECKS}= Create List ${VTEST_02_CHECK1} ${VTEST_02_CHECK2} ${VTEST_02_CHECK3} + + # Other tests here + + @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} 192 192 192 192 + @{VTEST_02}= Create List Test2 ${VTEST_02_SETS} ${VTEST_02_CHECKS} 193 193 193 193 + + # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists - Variables + # to be set before a reboot, and a set of variables to be checked after a reboot. For two tests, that means: + # 1. Test 1 Sets + # 2. reboot + # 3. Test 1 Checks + # 4. Test 2 Sets + # 5. reboot + # 6. Test 2 Checks + # + @{MASTER_TEST}= Create List ${VTEST_01} ${VTEST_02} + Set suite variable ${MASTER_TEST} + +# +# Use the following to ensure the lists are built correctly +# +# Log To Console . +# Log To Console ${VTEST_01_SET1} +# Log To Console ${VTEST_01_SET2} +# Log To Console ${VTEST_01_SETS} +# Log To Console ${VTEST_01_CHECKS} +# Log To Console ${VTEST_01} + + + +# +# +# +Process TestCases + [Arguments] @{ATest} + +# +# This function iterates over each of the test cases. For each test case, +# create a permissions payload, package it, send it to the system under test, +# restart the system to apply the permissions, and then validate that the +# permissions in the checklist are correct. +# + FOR ${Testname} ${Sets} ${Checks} ${PMask} ${DMask} ${CheckPMask} ${CheckDMask} IN @{ATest} + ${newPermissionsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewPermissions.xml + ${currentPermissionsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentPermissions.xml + # + # + Log To Console . + Log To Console Starting test ${Testname} + # + # Create the permissions packet + # + Create Permissions XML ${newPermissionsXmlFile} 2 2 ${PMask} ${DMask} ${Sets} + File should Exist ${newPermissionsXmlFile} + # + #Enable the serial log if the platform supports it + # + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplyPermissions.log + # + # Send the user(2) permissions packet to the system under test + # + Process Permission Packet ${Testname} 2 ${OLD_USER_PFX} ${newPermissionsXmlFile} @{TARGET_PARAMETERS} + # + # Restart the system to apply the permissions + # + Log To Console Restarting the system under test + Reboot System And Wait For System Online + # + # + Get and Print Current Permissions ${currentPermissionsXmlFile} + # + # Ensure all of the permissions set, were applied correctly + # + ${xmlPermissionsRslt}= Validate Permission Status ${Testname} 2 ${STATUS_SUCCESS} + # + # Validate the individual settings after the reboot + # + ${rc}= Validate Current Permission Defaults ${Testname} ${currentPermissionsXmlFile} ${CheckPMask} ${CheckDMask} + Should Be True ${rc} + # + ${rc}= Validate Current Permissions ${Testname} ${currentPermissionsXmlFile} ${Checks} + Should Be True ${rc} + # + ${rc} Check All Permission Status ${xmlPermissionsRslt} ${STATUS_SUCCESS} + Should Be True ${rc} + END + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +#------------------------------------------------------------------* +# Test Cases * +#------------------------------------------------------------------* +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + Should Be True '${OwnerThumbprint}' != 'Cert not installed' + Should Be True '${UserThumbprint}' != 'Cert not installed' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Process Complete Testcase List + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Running test + + FOR ${ATest} IN @{MASTER_TEST} + Process TestCases @{ATest} + END + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + +Clean Up Mailboxes + Verify No Mailboxes Have Data diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneRollCerts/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneRollCerts/run.robot index 00f5c3e59c..b878239899 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneRollCerts/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneRollCerts/run.robot @@ -1,171 +1,171 @@ -*** Settings *** -# @file -# -Documentation This test suite rolls the certificates used for owner and user. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneRollCerts - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - -Get the starting DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${OwnerThumbprint}' != 'Cert not installed' - Should Be True '${UserThumbprint}' != 'Cert not installed' - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Send Owner Roll Certificate Packet to System Being Transitioned - [Setup] Require test case Obtain Target Parameters From Target - - # This replaces the owner key, packet signed by previous owner leaf - - ${nameofTest}= Set Variable OwnerEnroll - - Process Provision Packet ${nameofTest} 1 ${OLD_OWNER_PFX} ${NEW_OWNER_PFX} ${NEW_OWNER_CERT} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} - - -Send User Roll Certificate to System Being Transitioned - [Setup] Require test case Send Owner Roll Certificate Packet to System Being Transitioned - - # This replaces the User key, packet signed by previous owner leaf - - ${nameofTest}= Set Variable UserEnroll - - Process Provision Packet ${nameofTest} 2 ${OLD_USER_PFX} ${NEW_USER_PFX} ${NEW_USER_CERT} ${USER_KEY_INDEX} @{TARGET_PARAMETERS} - - -Restart System to Apply Enrollment -# Start serial log to capture UEFI log during the restart - [Setup] Require test case Send User Roll Certificate to System Being Transitioned - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}ApplyEnrollment.log - - Reboot System And Wait For System Online - - -Verify Owner Roll Ceritificate Identity Results - ${nameofTest}= Set Variable OwnerEnroll - - Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} - - -Verify User Roll ceritificate Identity Results - ${nameofTest}= Set Variable UserEnroll - - Validate Provision Status ${nameofTest} 2 ${STATUS_SUCCESS} - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint From Pfx ${NEW_OWNER_CERT} - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == '${OwnerThumbprint}' - - ${UserThumbprint}= Get Thumbprint From Pfx ${NEW_USER_CERT} - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == '${UserThumbprint}' - - -Clean Up Mailboxes - Verify No Mailboxes Have Data +*** Settings *** +# @file +# +Documentation This test suite rolls the certificates used for owner and user. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneRollCerts + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + +Get the starting DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${OwnerThumbprint}' != 'Cert not installed' + Should Be True '${UserThumbprint}' != 'Cert not installed' + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Send Owner Roll Certificate Packet to System Being Transitioned + [Setup] Require test case Obtain Target Parameters From Target + + # This replaces the owner key, packet signed by previous owner leaf + + ${nameofTest}= Set Variable OwnerEnroll + + Process Provision Packet ${nameofTest} 1 ${OLD_OWNER_PFX} ${NEW_OWNER_PFX} ${NEW_OWNER_CERT} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} + + +Send User Roll Certificate to System Being Transitioned + [Setup] Require test case Send Owner Roll Certificate Packet to System Being Transitioned + + # This replaces the User key, packet signed by previous owner leaf + + ${nameofTest}= Set Variable UserEnroll + + Process Provision Packet ${nameofTest} 2 ${OLD_USER_PFX} ${NEW_USER_PFX} ${NEW_USER_CERT} ${USER_KEY_INDEX} @{TARGET_PARAMETERS} + + +Restart System to Apply Enrollment +# Start serial log to capture UEFI log during the restart + [Setup] Require test case Send User Roll Certificate to System Being Transitioned + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}ApplyEnrollment.log + + Reboot System And Wait For System Online + + +Verify Owner Roll Ceritificate Identity Results + ${nameofTest}= Set Variable OwnerEnroll + + Validate Provision Status ${nameofTest} 1 ${STATUS_SUCCESS} + + +Verify User Roll ceritificate Identity Results + ${nameofTest}= Set Variable UserEnroll + + Validate Provision Status ${nameofTest} 2 ${STATUS_SUCCESS} + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint From Pfx ${NEW_OWNER_CERT} + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == '${OwnerThumbprint}' + + ${UserThumbprint}= Get Thumbprint From Pfx ${NEW_USER_CERT} + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == '${UserThumbprint}' + + +Clean Up Mailboxes + Verify No Mailboxes Have Data diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneSettings/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneSettings/run.robot index 6c4186e733..a8a4d339db 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneSettings/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneSettings/run.robot @@ -1,385 +1,385 @@ -*** Settings *** -# @file -# -Documentation -... DFCI InTune Settings test -... This test suite checks the action of setting a setting, and the settings -... of group settings. -... -... NOTE: -... -... The ASSET TAG test are dependent upon the DFCI PCD's being set to these values: -... -... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagChars|"0123456789-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"|VOID*|0x40000017 -... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagLen | 36 | UINT16 | 0x40000018 -... -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -MetaData -... - Build a settings packet -... - Send it to the system under test -... - Reboot the system under test to apply the settings -... - Get the new "Current Settings" -... - Verify the settings that were changed - -Library OperatingSystem -Library Process -Library Collections - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Support${/}Python${/}SettingsXMLLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneSettings - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - -Initialize lists of tests -#[Documentation] -#... Each setting/value pair is a list of two elements - the setting, and the value. -#... Establish a list of the settings pairs for the settings to be set, and another -#... list for the settings to be checked after the reboot. - - @{VTEST_01_SET1}= Create List Dfci.OnboardCameras.Enable Enabled - @{VTEST_01_SET2}= Create List Device.IRCamera.Enable Enabled - @{VTEST_01_SET3}= Create List Dfci.OnboardAudio.Enable Enabled - - @{VTEST_01_CHECK1}= Create List Device.FrontCamera.Enable Enabled - @{VTEST_01_CHECK2}= Create List Device.IRCamera.Enable Enabled - @{VTEST_01_CHECK3}= Create List Device.RearCamera.Enable Enabled - @{VTEST_01_CHECK4}= Create List Dfci.OnboardCameras.Enable Enabled - @{VTEST_01_CHECK5}= Create List Dfci.OnboardAudio.Enable Enabled - - ${VTEST_01_RESULTS}= Create Dictionary Dfci.OnboardCameras.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_01_RESULTS} Device.IRCamera.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_01_RESULTS} Dfci.OnboardAudio.Enable ${STATUS_SUCCESS} - - @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} ${VTEST_01_SET2} ${VTEST_01_SET3} - @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} ${VTEST_01_CHECK3} ${VTEST_01_CHECK4} ${VTEST_01_CHECK5} - - - # Testcase 2 - @{VTEST_02_SET1}= Create List Dfci.OnboardCameras.Enable Disabled - @{VTEST_02_SET2}= Create List Device.IRCamera.Enable Enabled - @{VTEST_02_SET3}= Create List Dfci.OnboardAudio.Enable Disabled - - @{VTEST_02_CHECK1}= Create List Device.FrontCamera.Enable Disabled - @{VTEST_02_CHECK2}= Create List Device.IRCamera.Enable Enabled - @{VTEST_02_CHECK3}= Create List Device.RearCamera.Enable Disabled - @{VTEST_02_CHECK4}= Create List Dfci.OnboardCameras.Enable Inconsistent - @{VTEST_02_CHECK5}= Create List Dfci.OnboardAudio.Enable Disabled - - ${VTEST_02_RESULTS}= Create Dictionary Dfci.OnboardCameras.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_02_RESULTS} Device.IRCamera.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_02_RESULTS} Dfci.OnboardAudio.Enable ${STATUS_SUCCESS} - - @{VTEST_02_SETS}= Create List ${VTEST_02_SET1} ${VTEST_02_SET2} ${VTEST_02_SET3} - @{VTEST_02_CHECKS}= Create List ${VTEST_02_CHECK1} ${VTEST_02_CHECK2} ${VTEST_02_CHECK3} ${VTEST_02_CHECK4} ${VTEST_02_CHECK5} - - - # Testcase 3 V3 Set variables - @{VTEST_03_SET1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 - @{VTEST_03_SET2}= Create List Dfci3.OnboardWpbt.Enable Enabled - @{VTEST_03_SET3}= Create List Dfci3.ProcessorSMT.Enable Enabled - - @{VTEST_03_CHECK1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 - @{VTEST_03_CHECK2}= Create List Dfci3.OnboardWpbt.Enable Enabled - @{VTEST_03_CHECK3}= Create List Dfci3.ProcessorSMT.Enable Enabled - - ${VTEST_03_RESULTS} Create Dictionary Dfci3.AssetTag.String ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_03_RESULTS} Dfci3.OnboardWpbt.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_03_RESULTS} Dfci3.ProcessorSMT.Enable ${STATUS_SUCCESS} - - @{VTEST_03_SETS}= Create List ${VTEST_03_SET1} ${VTEST_03_SET2} ${VTEST_03_SET3} - @{VTEST_03_CHECKS}= Create List ${VTEST_03_CHECK1} ${VTEST_03_CHECK3} ${VTEST_03_CHECK3} - - - # Testcase 4 V3 Check Variables - @{VTEST_04_SET1}= Create List Dfci3.AssetTag.String ${EMPTY} - @{VTEST_04_CHECK1}= Create List Dfci3.AssetTag.String ${EMPTY} - - ${VTEST_04_RESULTS} Create Dictionary Dfci3.AssetTag.String ${STATUS_SUCCESS} - - @{VTEST_04_SETS}= Create List ${VTEST_04_SET1} - @{VTEST_04_CHECKS}= Create List ${VTEST_04_CHECK1} - - - # Testcase 5 V3 Asset tag too long - @{VTEST_05_SET1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890 - @{VTEST_05_CHECK1}= Create List Dfci3.AssetTag.String ${EMPTY} - - ${VTEST_05_RESULTS}= Create Dictionary Dfci3.AssetTag.String ${STATUS_INVALID_PARAMETER} - - @{VTEST_05_SETS}= Create List ${VTEST_05_SET1} - @{VTEST_05_CHECKS}= Create List ${VTEST_05_CHECK1} - - - # Testcase 6 V3 Asset tag invalid characters - @{VTEST_06_SET1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789% - @{VTEST_06_CHECK1}= Create List Dfci3.AssetTag.String ${EMPTY} - - ${VTEST_06_RESULTS}= Create Dictionary Dfci3.AssetTag.String ${STATUS_INVALID_PARAMETER} - - @{VTEST_06_SETS}= Create List ${VTEST_06_SET1} - @{VTEST_06_CHECKS}= Create List ${VTEST_06_CHECK1} - - - # The full tests are here - - @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} ${VTEST_01_RESULTS} - @{VTEST_02}= Create List Test2 ${VTEST_02_SETS} ${VTEST_02_CHECKS} ${VTEST_02_RESULTS} - @{VTEST_03}= Create List Test3 ${VTEST_03_SETS} ${VTEST_03_CHECKS} ${VTEST_03_RESULTS} - @{VTEST_04}= Create List Test4 ${VTEST_04_SETS} ${VTEST_04_CHECKS} ${VTEST_04_RESULTS} - @{VTEST_05}= Create List Test5 ${VTEST_05_SETS} ${VTEST_05_CHECKS} ${VTEST_05_RESULTS} - @{VTEST_06}= Create List Test6 ${VTEST_06_SETS} ${VTEST_06_CHECKS} ${VTEST_06_RESULTS} - - # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists and a dictionary of results. - # Variables to be set before a reboot, and a set of variables to be checked after a reboot, and a dictionary of expected results - # for each setting. For two tests, that means: - # 1. Test 1 Sets - # 2. reboot - # 3. Test 1 Checks with return codes - # 4. Test 2 Sets - # 5. reboot - # 6. Test 2 Checks with return codes - # - @{MASTER_TEST_V2}= Create List ${VTEST_01} ${VTEST_02} - @{MASTER_TEST_V3}= Create List ${VTEST_03} ${VTEST_04} ${VTEST_05} ${VTEST_06} - - @{RESTORE_SETTINGS_V2}= Create List ${VTEST_01} - @{RESTORE_SETTINGS_V3}= Create List ${VTEST_03} - - # Default to all the tests - Set suite variable ${MASTER_TEST_V2} - Set suite variable ${MASTER_TEST_V3} - Set suite variable ${RESTORE_SETTINGS_V2} - Set suite variable ${RESTORE_SETTINGS_V3} - - -# -# Use the following to ensure the lists are built correctly -# -# Log To Console . -# Log To Console ${VTEST_01_SET1} -# Log To Console ${VTEST_01_SET2} -# Log To Console ${VTEST_01_SETS} -# Log To Console ${VTEST_01_CHECKS} -# Log To Console ${VTEST_01} - -# -# -# -Process TestCases - [Arguments] @{ATest} - -# -# This function iterates over each of the test cases. For each test case, -# create a settings payload, package it, send it to the system under test, -# restart the system to apply the settings, nd then validate that the -# settings in the checklist are correct. -# - FOR ${Testname} ${Sets} ${Checks} ${Results} IN @{ATest} - ${newSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewSettings.xml - ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml - # - # - Log To Console . - Log To Console Starting test ${Testname} - # - # Create the settings packet - # - Create Settings XML ${newSettingsXmlFile} 2 2 ${Sets} - File should Exist ${newSettingsXmlFile} - # - #Enable the serial log if the platform supports it - # - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplySettings.log - # - # Send the user(2) settings packet to the system under test - # - Process Settings Packet ${Testname} 2 ${OLD_USER_PFX} ${newSettingsXmlFile} @{TARGET_PARAMETERS} - # - # Restart the system to apply the settings - # - Log To Console Restarting the system under test - Reboot System And Wait For System Online - # - # - Get and Print Current Settings ${currentSettingXmlFile} - # - # Ensure all of the setting set, were applied correctly - # - ${xmlSettingsRslt}= Validate Settings Status ${Testname} 2 ${STATUS_SUCCESS} BASIC - # - # Validate the individual settings after the reboot - # - ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${Checks} - Should Be True ${rc} - # - ${rc}= Check Setting Status By Dictionary ${xmlSettingsRslt} ${Results} - Should Be True ${rc} - END - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -#------------------------------------------------------------------* -# Test Cases * -#------------------------------------------------------------------* -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - Should Be True '${OwnerThumbprint}' != 'Cert not installed' - Should Be True '${UserThumbprint}' != 'Cert not installed' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Process Complete Testcase List V2 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Running test V2 - - FOR ${ATest} IN @{MASTER_TEST_V2} - Process TestCases @{ATest} - END - - -Process Complete Testcase List V3 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Running test V3 - - FOR ${ATest} IN @{MASTER_TEST_V3} - Process TestCases @{ATest} - END - - -Restore Settings V2 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Restoring settings V2 - - FOR ${ATest} IN @{RESTORE_SETTINGS_V2} - Process TestCases @{ATest} - END - - -Restore Settings V3 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Restoring settings V3 - - FOR ${ATest} IN @{RESTORE_SETTINGS_V3} - Process TestCases @{ATest} - END - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - -Clean Up Mailboxes - Verify No Mailboxes Have Data +*** Settings *** +# @file +# +Documentation +... DFCI InTune Settings test +... This test suite checks the action of setting a setting, and the settings +... of group settings. +... +... NOTE: +... +... The ASSET TAG test are dependent upon the DFCI PCD's being set to these values: +... +... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagChars|"0123456789-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"|VOID*|0x40000017 +... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagLen | 36 | UINT16 | 0x40000018 +... +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +MetaData +... - Build a settings packet +... - Send it to the system under test +... - Reboot the system under test to apply the settings +... - Get the new "Current Settings" +... - Verify the settings that were changed + +Library OperatingSystem +Library Process +Library Collections + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Support${/}Python${/}SettingsXMLLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneSettings + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + +Initialize lists of tests +#[Documentation] +#... Each setting/value pair is a list of two elements - the setting, and the value. +#... Establish a list of the settings pairs for the settings to be set, and another +#... list for the settings to be checked after the reboot. + + @{VTEST_01_SET1}= Create List Dfci.OnboardCameras.Enable Enabled + @{VTEST_01_SET2}= Create List Device.IRCamera.Enable Enabled + @{VTEST_01_SET3}= Create List Dfci.OnboardAudio.Enable Enabled + + @{VTEST_01_CHECK1}= Create List Device.FrontCamera.Enable Enabled + @{VTEST_01_CHECK2}= Create List Device.IRCamera.Enable Enabled + @{VTEST_01_CHECK3}= Create List Device.RearCamera.Enable Enabled + @{VTEST_01_CHECK4}= Create List Dfci.OnboardCameras.Enable Enabled + @{VTEST_01_CHECK5}= Create List Dfci.OnboardAudio.Enable Enabled + + ${VTEST_01_RESULTS}= Create Dictionary Dfci.OnboardCameras.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_01_RESULTS} Device.IRCamera.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_01_RESULTS} Dfci.OnboardAudio.Enable ${STATUS_SUCCESS} + + @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} ${VTEST_01_SET2} ${VTEST_01_SET3} + @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} ${VTEST_01_CHECK3} ${VTEST_01_CHECK4} ${VTEST_01_CHECK5} + + + # Testcase 2 + @{VTEST_02_SET1}= Create List Dfci.OnboardCameras.Enable Disabled + @{VTEST_02_SET2}= Create List Device.IRCamera.Enable Enabled + @{VTEST_02_SET3}= Create List Dfci.OnboardAudio.Enable Disabled + + @{VTEST_02_CHECK1}= Create List Device.FrontCamera.Enable Disabled + @{VTEST_02_CHECK2}= Create List Device.IRCamera.Enable Enabled + @{VTEST_02_CHECK3}= Create List Device.RearCamera.Enable Disabled + @{VTEST_02_CHECK4}= Create List Dfci.OnboardCameras.Enable Inconsistent + @{VTEST_02_CHECK5}= Create List Dfci.OnboardAudio.Enable Disabled + + ${VTEST_02_RESULTS}= Create Dictionary Dfci.OnboardCameras.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_02_RESULTS} Device.IRCamera.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_02_RESULTS} Dfci.OnboardAudio.Enable ${STATUS_SUCCESS} + + @{VTEST_02_SETS}= Create List ${VTEST_02_SET1} ${VTEST_02_SET2} ${VTEST_02_SET3} + @{VTEST_02_CHECKS}= Create List ${VTEST_02_CHECK1} ${VTEST_02_CHECK2} ${VTEST_02_CHECK3} ${VTEST_02_CHECK4} ${VTEST_02_CHECK5} + + + # Testcase 3 V3 Set variables + @{VTEST_03_SET1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 + @{VTEST_03_SET2}= Create List Dfci3.OnboardWpbt.Enable Enabled + @{VTEST_03_SET3}= Create List Dfci3.ProcessorSMT.Enable Enabled + + @{VTEST_03_CHECK1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 + @{VTEST_03_CHECK2}= Create List Dfci3.OnboardWpbt.Enable Enabled + @{VTEST_03_CHECK3}= Create List Dfci3.ProcessorSMT.Enable Enabled + + ${VTEST_03_RESULTS} Create Dictionary Dfci3.AssetTag.String ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_03_RESULTS} Dfci3.OnboardWpbt.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_03_RESULTS} Dfci3.ProcessorSMT.Enable ${STATUS_SUCCESS} + + @{VTEST_03_SETS}= Create List ${VTEST_03_SET1} ${VTEST_03_SET2} ${VTEST_03_SET3} + @{VTEST_03_CHECKS}= Create List ${VTEST_03_CHECK1} ${VTEST_03_CHECK3} ${VTEST_03_CHECK3} + + + # Testcase 4 V3 Check Variables + @{VTEST_04_SET1}= Create List Dfci3.AssetTag.String ${EMPTY} + @{VTEST_04_CHECK1}= Create List Dfci3.AssetTag.String ${EMPTY} + + ${VTEST_04_RESULTS} Create Dictionary Dfci3.AssetTag.String ${STATUS_SUCCESS} + + @{VTEST_04_SETS}= Create List ${VTEST_04_SET1} + @{VTEST_04_CHECKS}= Create List ${VTEST_04_CHECK1} + + + # Testcase 5 V3 Asset tag too long + @{VTEST_05_SET1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890 + @{VTEST_05_CHECK1}= Create List Dfci3.AssetTag.String ${EMPTY} + + ${VTEST_05_RESULTS}= Create Dictionary Dfci3.AssetTag.String ${STATUS_INVALID_PARAMETER} + + @{VTEST_05_SETS}= Create List ${VTEST_05_SET1} + @{VTEST_05_CHECKS}= Create List ${VTEST_05_CHECK1} + + + # Testcase 6 V3 Asset tag invalid characters + @{VTEST_06_SET1}= Create List Dfci3.AssetTag.String ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789% + @{VTEST_06_CHECK1}= Create List Dfci3.AssetTag.String ${EMPTY} + + ${VTEST_06_RESULTS}= Create Dictionary Dfci3.AssetTag.String ${STATUS_INVALID_PARAMETER} + + @{VTEST_06_SETS}= Create List ${VTEST_06_SET1} + @{VTEST_06_CHECKS}= Create List ${VTEST_06_CHECK1} + + + # The full tests are here + + @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} ${VTEST_01_RESULTS} + @{VTEST_02}= Create List Test2 ${VTEST_02_SETS} ${VTEST_02_CHECKS} ${VTEST_02_RESULTS} + @{VTEST_03}= Create List Test3 ${VTEST_03_SETS} ${VTEST_03_CHECKS} ${VTEST_03_RESULTS} + @{VTEST_04}= Create List Test4 ${VTEST_04_SETS} ${VTEST_04_CHECKS} ${VTEST_04_RESULTS} + @{VTEST_05}= Create List Test5 ${VTEST_05_SETS} ${VTEST_05_CHECKS} ${VTEST_05_RESULTS} + @{VTEST_06}= Create List Test6 ${VTEST_06_SETS} ${VTEST_06_CHECKS} ${VTEST_06_RESULTS} + + # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists and a dictionary of results. + # Variables to be set before a reboot, and a set of variables to be checked after a reboot, and a dictionary of expected results + # for each setting. For two tests, that means: + # 1. Test 1 Sets + # 2. reboot + # 3. Test 1 Checks with return codes + # 4. Test 2 Sets + # 5. reboot + # 6. Test 2 Checks with return codes + # + @{MASTER_TEST_V2}= Create List ${VTEST_01} ${VTEST_02} + @{MASTER_TEST_V3}= Create List ${VTEST_03} ${VTEST_04} ${VTEST_05} ${VTEST_06} + + @{RESTORE_SETTINGS_V2}= Create List ${VTEST_01} + @{RESTORE_SETTINGS_V3}= Create List ${VTEST_03} + + # Default to all the tests + Set suite variable ${MASTER_TEST_V2} + Set suite variable ${MASTER_TEST_V3} + Set suite variable ${RESTORE_SETTINGS_V2} + Set suite variable ${RESTORE_SETTINGS_V3} + + +# +# Use the following to ensure the lists are built correctly +# +# Log To Console . +# Log To Console ${VTEST_01_SET1} +# Log To Console ${VTEST_01_SET2} +# Log To Console ${VTEST_01_SETS} +# Log To Console ${VTEST_01_CHECKS} +# Log To Console ${VTEST_01} + +# +# +# +Process TestCases + [Arguments] @{ATest} + +# +# This function iterates over each of the test cases. For each test case, +# create a settings payload, package it, send it to the system under test, +# restart the system to apply the settings, nd then validate that the +# settings in the checklist are correct. +# + FOR ${Testname} ${Sets} ${Checks} ${Results} IN @{ATest} + ${newSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewSettings.xml + ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml + # + # + Log To Console . + Log To Console Starting test ${Testname} + # + # Create the settings packet + # + Create Settings XML ${newSettingsXmlFile} 2 2 ${Sets} + File should Exist ${newSettingsXmlFile} + # + #Enable the serial log if the platform supports it + # + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplySettings.log + # + # Send the user(2) settings packet to the system under test + # + Process Settings Packet ${Testname} 2 ${OLD_USER_PFX} ${newSettingsXmlFile} @{TARGET_PARAMETERS} + # + # Restart the system to apply the settings + # + Log To Console Restarting the system under test + Reboot System And Wait For System Online + # + # + Get and Print Current Settings ${currentSettingXmlFile} + # + # Ensure all of the setting set, were applied correctly + # + ${xmlSettingsRslt}= Validate Settings Status ${Testname} 2 ${STATUS_SUCCESS} BASIC + # + # Validate the individual settings after the reboot + # + ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${Checks} + Should Be True ${rc} + # + ${rc}= Check Setting Status By Dictionary ${xmlSettingsRslt} ${Results} + Should Be True ${rc} + END + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +#------------------------------------------------------------------* +# Test Cases * +#------------------------------------------------------------------* +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + Should Be True '${OwnerThumbprint}' != 'Cert not installed' + Should Be True '${UserThumbprint}' != 'Cert not installed' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Process Complete Testcase List V2 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Running test V2 + + FOR ${ATest} IN @{MASTER_TEST_V2} + Process TestCases @{ATest} + END + + +Process Complete Testcase List V3 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Running test V3 + + FOR ${ATest} IN @{MASTER_TEST_V3} + Process TestCases @{ATest} + END + + +Restore Settings V2 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Restoring settings V2 + + FOR ${ATest} IN @{RESTORE_SETTINGS_V2} + Process TestCases @{ATest} + END + + +Restore Settings V3 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Restoring settings V3 + + FOR ${ATest} IN @{RESTORE_SETTINGS_V3} + Process TestCases @{ATest} + END + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + +Clean Up Mailboxes + Verify No Mailboxes Have Data diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/DfciSettings2.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/DfciSettings2.xml index 88cea9e3a3..4f02828d55 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/DfciSettings2.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/DfciSettings2.xml @@ -1,43 +1,43 @@ - - - - DFCI Tester - 2020-03-27 10:22:00 - 2 - 2 - - - Dfci.OnboardCameras.Enable - Enabled - - - Dfci.OnboardRadios.Enable - Enabled - - - Dfci.BootExternalMedia.Enable - Enabled - - - Dfci3.OnboardWpbt.Enable - Enabled - - - Dfci3.ProcessorSMT.Enable - Enabled - - - Dfci3.AssetTag.String - - - + + + + DFCI Tester + 2020-03-27 10:22:00 + 2 + 2 + + + Dfci.OnboardCameras.Enable + Enabled + + + Dfci.OnboardRadios.Enable + Enabled + + + Dfci.BootExternalMedia.Enable + Enabled + + + Dfci3.OnboardWpbt.Enable + Enabled + + + Dfci3.ProcessorSMT.Enable + Enabled + + + Dfci3.AssetTag.String + + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/run.robot index ce812f8acc..91418e87a9 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InTuneUnenroll/run.robot @@ -1,217 +1,217 @@ -*** Settings *** -# @file -# -Documentation This test suite unenrolls the system after being enrolled with InTuneEnroll. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -Library OperatingSystem -Library Process - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Support${/}Python${/}SettingsXMLLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 - -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneUnenroll - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the current DFCI Settings Before Unenroll - ${nameofTest}= Set Variable BeforeUnenroll - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${OwnerThumbprint}' != 'Cert not installed' - Should Be True '${UserThumbprint}' != 'Cert not installed' - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the current DFCI Settings Before UnEnroll - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Send User Settings Packet to Enrolled System - [Setup] Require test case Obtain Target Parameters From Target - #Initial settings for Enrolled System - ${nameofTest}= Set Variable UserSettings - ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings2.xml - - - Process Settings Packet ${nameofTest} 2 ${OLD_USER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} - - -Send Owner Unenroll to System - [Setup] Require test case Send User Settings Packet to Enrolled System - ${nameofTest}= Set Variable Unenroll - - Process UnEnroll Packet ${nameofTest} 1 ${OLD_OWNER_PFX} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} - - -Restart System to UnEnroll -#Documentation Only run the restart test if all the previous setup operations passed - [Setup] Require test case Send Owner Unenroll to System - - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}InTuneUnenroll.log - - Reboot System And Wait For System Online - - -Verify User Enrolled System Settings Results - ${nameofTest}= Set Variable UserSettings - - ${xmlUserSettingsRslt}= Validate Settings Status ${nameofTest} 2 ${STATUS_SUCCESS} FULL - ${rc} Check All Setting Status ${xmlUserSettingsRslt} ${STATUS_SUCCESS} - Should Be True ${rc} - - -Verify Owner UnEnroll Results - ${nameofTest}= Set Variable Unenroll - - Validate UnEnroll Status ${nameofTest} 1 ${STATUS_SUCCESS} - - -Get the current DFCI Settings after Unenroll - ${nameofTest}= Set Variable AfterUnenroll - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner - Should Be True '${rc}' == 'Cert not installed' - - ${rc}= Get Thumbprint Element ${currentIdxmlFile} User - Should Be True '${rc}' == 'Cert not installed' - - -Verify Settings Returned To Defaults - ${nameofTest}= Set Variable VerifyDefaults - ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml - - -#Documentation Verify the no preboot UI settings are back to default - @{RTD_CHECK01}= Create List Dfci.HttpsCert.Binary ${EMPTY} - @{RTD_CHECK02}= Create List Dfci.RecoveryBootstrapUrl.String ${EMPTY} - @{RTD_CHECK03}= Create List Dfci.RecoveryUrl.String ${EMPTY} - @{RTD_CHECK04}= Create List Dfci.RegistrationId.String ${EMPTY} - @{RTD_CHECK05}= Create List Dfci.TenantId.String ${EMPTY} - @{RTD_CHECK06}= Create List Dfci3.AssetTag.String ${EMPTY} - @{RTD_CHECK07}= Create List Dfci3.OnboardWpbt.Enable Enabled - @{RTD_CHECK08}= Create List MDM.FriendlyName.String ${EMPTY} - @{RTD_CHECK09}= Create List MDM.TenantName.String ${EMPTY} - -#Documentation Verify the settings that require explicit reset reset to default - @{RTD_CHECK10}= Create List Dfci.OnboardCameras.Enable Enabled - @{RTD_CHECK11}= Create List Dfci.OnboardRadios.Enable Enabled - @{RTD_CHECK12}= Create List Dfci.BootExternalMedia.Enable Enabled - @{RTD_CHECK13}= Create List Dfci3.ProcessorSMT.Enable Enabled - @{RTD_CHECK14}= Create List Dfci3.AssetTag.String ${EMPTY} - - @{RTD_CHECKS}= Create List ${RTD_CHECK01} -... ${RTD_CHECK02} -... ${RTD_CHECK03} -... ${RTD_CHECK04} -... ${RTD_CHECK05} -... ${RTD_CHECK06} -... ${RTD_CHECK07} -... ${RTD_CHECK08} -... ${RTD_CHECK09} -... ${RTD_CHECK10} -... ${RTD_CHECK11} -... ${RTD_CHECK12} -... ${RTD_CHECK13} -... ${RTD_CHECK14} - - Get and Print Current Settings ${currentSettingXmlFile} - - ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${RTD_CHECKS} - Should Be True ${rc} - - -Clean Up Mailboxes - Verify No Mailboxes Have Data +*** Settings *** +# @file +# +Documentation This test suite unenrolls the system after being enrolled with InTuneEnroll. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library OperatingSystem +Library Process + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Support${/}Python${/}SettingsXMLLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 + +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_InTuneUnenroll + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the current DFCI Settings Before Unenroll + ${nameofTest}= Set Variable BeforeUnenroll + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${OwnerThumbprint}' != 'Cert not installed' + Should Be True '${UserThumbprint}' != 'Cert not installed' + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the current DFCI Settings Before UnEnroll + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Send User Settings Packet to Enrolled System + [Setup] Require test case Obtain Target Parameters From Target + #Initial settings for Enrolled System + ${nameofTest}= Set Variable UserSettings + ${xmlPayloadFile}= Set Variable ${TEST_CASE_DIR}${/}DfciSettings2.xml + + + Process Settings Packet ${nameofTest} 2 ${OLD_USER_PFX} ${xmlPayloadFile} @{TARGET_PARAMETERS} + + +Send Owner Unenroll to System + [Setup] Require test case Send User Settings Packet to Enrolled System + ${nameofTest}= Set Variable Unenroll + + Process UnEnroll Packet ${nameofTest} 1 ${OLD_OWNER_PFX} ${OWNER_KEY_INDEX} @{TARGET_PARAMETERS} + + +Restart System to UnEnroll +#Documentation Only run the restart test if all the previous setup operations passed + [Setup] Require test case Send Owner Unenroll to System + + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}InTuneUnenroll.log + + Reboot System And Wait For System Online + + +Verify User Enrolled System Settings Results + ${nameofTest}= Set Variable UserSettings + + ${xmlUserSettingsRslt}= Validate Settings Status ${nameofTest} 2 ${STATUS_SUCCESS} FULL + ${rc} Check All Setting Status ${xmlUserSettingsRslt} ${STATUS_SUCCESS} + Should Be True ${rc} + + +Verify Owner UnEnroll Results + ${nameofTest}= Set Variable Unenroll + + Validate UnEnroll Status ${nameofTest} 1 ${STATUS_SUCCESS} + + +Get the current DFCI Settings after Unenroll + ${nameofTest}= Set Variable AfterUnenroll + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} Owner + Should Be True '${rc}' == 'Cert not installed' + + ${rc}= Get Thumbprint Element ${currentIdxmlFile} User + Should Be True '${rc}' == 'Cert not installed' + + +Verify Settings Returned To Defaults + ${nameofTest}= Set Variable VerifyDefaults + ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml + + +#Documentation Verify the no preboot UI settings are back to default + @{RTD_CHECK01}= Create List Dfci.HttpsCert.Binary ${EMPTY} + @{RTD_CHECK02}= Create List Dfci.RecoveryBootstrapUrl.String ${EMPTY} + @{RTD_CHECK03}= Create List Dfci.RecoveryUrl.String ${EMPTY} + @{RTD_CHECK04}= Create List Dfci.RegistrationId.String ${EMPTY} + @{RTD_CHECK05}= Create List Dfci.TenantId.String ${EMPTY} + @{RTD_CHECK06}= Create List Dfci3.AssetTag.String ${EMPTY} + @{RTD_CHECK07}= Create List Dfci3.OnboardWpbt.Enable Enabled + @{RTD_CHECK08}= Create List MDM.FriendlyName.String ${EMPTY} + @{RTD_CHECK09}= Create List MDM.TenantName.String ${EMPTY} + +#Documentation Verify the settings that require explicit reset reset to default + @{RTD_CHECK10}= Create List Dfci.OnboardCameras.Enable Enabled + @{RTD_CHECK11}= Create List Dfci.OnboardRadios.Enable Enabled + @{RTD_CHECK12}= Create List Dfci.BootExternalMedia.Enable Enabled + @{RTD_CHECK13}= Create List Dfci3.ProcessorSMT.Enable Enabled + @{RTD_CHECK14}= Create List Dfci3.AssetTag.String ${EMPTY} + + @{RTD_CHECKS}= Create List ${RTD_CHECK01} +... ${RTD_CHECK02} +... ${RTD_CHECK03} +... ${RTD_CHECK04} +... ${RTD_CHECK05} +... ${RTD_CHECK06} +... ${RTD_CHECK07} +... ${RTD_CHECK08} +... ${RTD_CHECK09} +... ${RTD_CHECK10} +... ${RTD_CHECK11} +... ${RTD_CHECK12} +... ${RTD_CHECK13} +... ${RTD_CHECK14} + + Get and Print Current Settings ${currentSettingXmlFile} + + ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${RTD_CHECKS} + Should Be True ${rc} + + +Clean Up Mailboxes + Verify No Mailboxes Have Data diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InitialState/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InitialState/run.robot index bb8370a6a6..3f4dd6e195 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InitialState/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_InitialState/run.robot @@ -1,177 +1,177 @@ -*** Settings *** -# @file -# -Documentation -... DFCI Initial State test - Verifies that there are no enrolled identities, -... that the proper thumbprint is installed for the ZTD key, and verifies the -... initial state of the permission store. -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -MetaData -... - Build a permissions packet -... - Send it to the system under test -... - Reboot the system under test to apply the permissions -... - Get the new "Current Permissions" -... - Verify the permissions are currect - -Library OperatingSystem -Library Process -Library Collections - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Support${/}Python${/}PermissionsXMLLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource UefiSerial_Keywords.robot - -#Import the DFCI Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -# -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} ${TEST_ROOT_DIR}${/}certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - -Initialize lists of tests -#[Documentation] -#... Each permission/PMask/DMask tuple is a list of three elements - the permission, PMask, and the DMask. -#... Establish a list of the permission tuples for the permissions to be set, and another -#... list for the permissions to be checked after the reboot. - - @{VTEST_01_CHECK1}= Create List Dfci.OwnerKey.Enum 9 128 - @{VTEST_01_CHECK2}= Create List Dfci.ZtdKey.Enum 1 ${None} - @{VTEST_01_CHECK3}= Create List Dfci.ZtdUnenroll.Enable 0 ${None} - @{VTEST_01_CHECK4}= Create List Dfci.Ztd.Recovery.Enable 0 ${None} - @{INITIAL_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} ${VTEST_01_CHECK3} ${VTEST_01_CHECK4} - - Set suite variable ${INITIAL_CHECKS} -# -# -# -Process Initial Permission Check - [Arguments] ${Testname} - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}Testcase_currentPermission.xml - - Get and Print Current Permissions ${currentPermXmlFile} - # - ${rc}= Validate Current Permissions ${Testname} ${currentPermXmlFile} ${INITIAL_CHECKS} - Should Be True ${rc} - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}Testcase_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -#------------------------------------------------------------------* -# Test Cases * -#------------------------------------------------------------------* -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - ${User1Thumbprint}= Get Thumbprint Element ${currentIdxmlFile} User1 - ${User2Thumbprint}= Get Thumbprint Element ${currentIdxmlFile} User2 - ${ZtdThumbprint}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch - - Should Be True '${OwnerThumbprint}' == 'Cert not installed' - Should Be True '${UserThumbprint}' == 'Cert not installed' - Should Be True '${User1Thumbprint}' == 'Cert not installed' - Should Be True '${User2Thumbprint}' == 'Cert not installed' - Log To Console . - Log To Console Verifying the system under test is Opted In for InTune - Should Be True '${ZtdThumbprint}' != 'Cert not installed' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Process Complete Testcase List - [Setup] Require test case Obtain Target Parameters From Target - - ${nameofTest}= Set Variable ProcessInitialTest - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Running test - - Process Initial Permission Check ${nameofTest} +*** Settings *** +# @file +# +Documentation +... DFCI Initial State test - Verifies that there are no enrolled identities, +... that the proper thumbprint is installed for the ZTD key, and verifies the +... initial state of the permission store. +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +MetaData +... - Build a permissions packet +... - Send it to the system under test +... - Reboot the system under test to apply the permissions +... - Get the new "Current Permissions" +... - Verify the permissions are currect + +Library OperatingSystem +Library Process +Library Collections + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Support${/}Python${/}PermissionsXMLLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource UefiSerial_Keywords.robot + +#Import the DFCI Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +# +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} ${TEST_ROOT_DIR}${/}certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + +Initialize lists of tests +#[Documentation] +#... Each permission/PMask/DMask tuple is a list of three elements - the permission, PMask, and the DMask. +#... Establish a list of the permission tuples for the permissions to be set, and another +#... list for the permissions to be checked after the reboot. + + @{VTEST_01_CHECK1}= Create List Dfci.OwnerKey.Enum 9 128 + @{VTEST_01_CHECK2}= Create List Dfci.ZtdKey.Enum 1 ${None} + @{VTEST_01_CHECK3}= Create List Dfci.ZtdUnenroll.Enable 0 ${None} + @{VTEST_01_CHECK4}= Create List Dfci.Ztd.Recovery.Enable 0 ${None} + @{INITIAL_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} ${VTEST_01_CHECK3} ${VTEST_01_CHECK4} + + Set suite variable ${INITIAL_CHECKS} +# +# +# +Process Initial Permission Check + [Arguments] ${Testname} + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}Testcase_currentPermission.xml + + Get and Print Current Permissions ${currentPermXmlFile} + # + ${rc}= Validate Current Permissions ${Testname} ${currentPermXmlFile} ${INITIAL_CHECKS} + Should Be True ${rc} + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}Testcase_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +#------------------------------------------------------------------* +# Test Cases * +#------------------------------------------------------------------* +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + ${User1Thumbprint}= Get Thumbprint Element ${currentIdxmlFile} User1 + ${User2Thumbprint}= Get Thumbprint Element ${currentIdxmlFile} User2 + ${ZtdThumbprint}= Get Thumbprint Element ${currentIdxmlFile} ZeroTouch + + Should Be True '${OwnerThumbprint}' == 'Cert not installed' + Should Be True '${UserThumbprint}' == 'Cert not installed' + Should Be True '${User1Thumbprint}' == 'Cert not installed' + Should Be True '${User2Thumbprint}' == 'Cert not installed' + Log To Console . + Log To Console Verifying the system under test is Opted In for InTune + Should Be True '${ZtdThumbprint}' != 'Cert not installed' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Process Complete Testcase List + [Setup] Require test case Obtain Target Parameters From Target + + ${nameofTest}= Set Variable ProcessInitialTest + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Running test + + Process Initial Permission Check ${nameofTest} diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_TPM_DisableEnable/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_TPM_DisableEnable/run.robot index f997b115b2..b25108d80e 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_TPM_DisableEnable/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_TPM_DisableEnable/run.robot @@ -1,288 +1,288 @@ -*** Settings *** -# @file -# -Documentation -... DFCI InTune Settings test -... This test suite checks the action of setting a setting, and the settings -... of group settings. -... -... NOTE: -... -... The ASSET TAG test are dependent upon the DFCI PCD's being set to these values: -... -... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagChars|"0123456789-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"|VOID*|0x40000017 -... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagLen | 36 | UINT16 | 0x40000018 -... -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -MetaData -... - Build a settings packet -... - Send it to the system under test -... - Reboot the system under test to apply the settings -... - Get the new "Current Settings" -... - Verify the settings that were changed - -Library OperatingSystem -Library Process -Library Collections - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Support${/}Python${/}SettingsXMLLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_EnableTPM - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' -${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' -${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' - - -*** Keywords *** - -Initialize lists of tests -#[Documentation] -#... Each setting/value pair is a list of two elements - the setting, and the value. -#... Establish a list of the settings pairs for the settings to be set, and another -#... list for the settings to be checked after the reboot. - - @{VTEST_01_SET1}= Create List Device.Tpm.Enable Disabled - - @{VTEST_01_CHECK1}= Create List Device.Tpm.Enable Disabled - - ${VTEST_01_RESULTS}= Create Dictionary Device.Tpm.Enable ${STATUS_SUCCESS} - - @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} - @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} - - @{VTEST_02_SET1}= Create List Device.Tpm.Enable Enabled - - @{VTEST_02_CHECK1}= Create List Device.Tpm.Enable Enabled - - ${VTEST_02_RESULTS}= Create Dictionary Device.Tpm.Enable ${STATUS_SUCCESS} - - @{VTEST_02_SETS}= Create List ${VTEST_01_SET1} - @{VTEST_02_CHECKS}= Create List ${VTEST_01_CHECK1} - - # The full tests are here - - @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} ${VTEST_01_RESULTS} - @{VTEST_02}= Create List Test1 ${VTEST_02_SETS} ${VTEST_02_CHECKS} ${VTEST_02_RESULTS} - - # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists and a dictionary of results. - # Variables to be set before a reboot, and a set of variables to be checked after a reboot, and a dictionary of expected results - # for each setting. For two tests, that means: - # 1. Test 1 Sets - # 2. reboot - # 3. Test 1 Checks with return codes - # 4. Test 2 Sets - # 5. reboot - # 6. Test 2 Checks with return codes - # - @{MASTER_TEST_V1}= Create List ${VTEST_01} - - @{MASTER_TEST_V2}= Create List ${VTEST_02} - - - # Default to all the tests - Set suite variable ${MASTER_TEST_V1} - - Set suite variable ${MASTER_TEST_V2} - -# -# Use the following to ensure the lists are built correctly -# -# Log To Console . -# Log To Console ${VTEST_01_SET1} -# Log To Console ${VTEST_01_SET2} -# Log To Console ${VTEST_01_SETS} -# Log To Console ${VTEST_01_CHECKS} -# Log To Console ${VTEST_01} - -# -# -# -Process TestCases - [Arguments] @{ATest} - -# -# This function iterates over each of the test cases. For each test case, -# create a settings payload, package it, send it to the system under test, -# restart the system to apply the settings, nd then validate that the -# settings in the checklist are correct. -# - FOR ${Testname} ${Sets} ${Checks} ${Results} IN @{ATest} - ${newSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewSettings.xml - ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml - # - # - Log To Console . - Log To Console Starting test ${Testname} - # - # Create the settings packet - # - Create Settings XML ${newSettingsXmlFile} 2 2 ${Sets} - File should Exist ${newSettingsXmlFile} - # - #Enable the serial log if the platform supports it - # - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplySettings.log - # - # Send the user(2) settings packet to the system under test - # - Process Settings Packet ${Testname} 2 ${OLD_USER_PFX} ${newSettingsXmlFile} @{TARGET_PARAMETERS} - # - # Restart the system to apply the settings - # - Log To Console Restarting the system under test - Reboot System And Wait For System Online - # - # - Get and Print Current Settings ${currentSettingXmlFile} - # - # Ensure all of the setting set, were applied correctly - # - ${xmlSettingsRslt}= Validate Settings Status ${Testname} 2 ${STATUS_SUCCESS} BASIC - # - # Validate the individual settings after the reboot - # - ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${Checks} - Should Be True ${rc} - # - ${rc}= Check Setting Status By Dictionary ${xmlSettingsRslt} ${Results} - Should Be True ${rc} - END - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -#------------------------------------------------------------------* -# Test Cases * -#------------------------------------------------------------------* -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner - ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User - - Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' - - Should Be True '${OwnerThumbprint}' != 'Cert not installed' - Should Be True '${UserThumbprint}' != 'Cert not installed' - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Process Complete Testcase List V1 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Running test V1, Disable TPM - - FOR ${ATest} IN @{MASTER_TEST_V1} - Process TestCases @{ATest} - END - - -Process Complete Testcase List V2 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Runnint test V2, Enable TPM - - FOR ${ATest} IN @{MASTER_TEST_V2} - Process TestCases @{ATest} - END - - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - -Clean Up Mailboxes - Verify No Mailboxes Have Data +*** Settings *** +# @file +# +Documentation +... DFCI InTune Settings test +... This test suite checks the action of setting a setting, and the settings +... of group settings. +... +... NOTE: +... +... The ASSET TAG test are dependent upon the DFCI PCD's being set to these values: +... +... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagChars|"0123456789-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"|VOID*|0x40000017 +... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagLen | 36 | UINT16 | 0x40000018 +... +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +MetaData +... - Build a settings packet +... - Send it to the system under test +... - Reboot the system under test to apply the settings +... - Get the new "Current Settings" +... - Verify the settings that were changed + +Library OperatingSystem +Library Process +Library Collections + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Support${/}Python${/}SettingsXMLLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_EnableTPM + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +${DDS_CA_THUMBPRINT} 'Thumbprint Not Set' +${MDM_CA_THUMBPRINT} 'Thumbprint Not Set' +${ZTD_LEAF_THUMBPRINT} 'Thumbprint Not Set' + + +*** Keywords *** + +Initialize lists of tests +#[Documentation] +#... Each setting/value pair is a list of two elements - the setting, and the value. +#... Establish a list of the settings pairs for the settings to be set, and another +#... list for the settings to be checked after the reboot. + + @{VTEST_01_SET1}= Create List Device.Tpm.Enable Disabled + + @{VTEST_01_CHECK1}= Create List Device.Tpm.Enable Disabled + + ${VTEST_01_RESULTS}= Create Dictionary Device.Tpm.Enable ${STATUS_SUCCESS} + + @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} + @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} + + @{VTEST_02_SET1}= Create List Device.Tpm.Enable Enabled + + @{VTEST_02_CHECK1}= Create List Device.Tpm.Enable Enabled + + ${VTEST_02_RESULTS}= Create Dictionary Device.Tpm.Enable ${STATUS_SUCCESS} + + @{VTEST_02_SETS}= Create List ${VTEST_01_SET1} + @{VTEST_02_CHECKS}= Create List ${VTEST_01_CHECK1} + + # The full tests are here + + @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} ${VTEST_01_RESULTS} + @{VTEST_02}= Create List Test1 ${VTEST_02_SETS} ${VTEST_02_CHECKS} ${VTEST_02_RESULTS} + + # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists and a dictionary of results. + # Variables to be set before a reboot, and a set of variables to be checked after a reboot, and a dictionary of expected results + # for each setting. For two tests, that means: + # 1. Test 1 Sets + # 2. reboot + # 3. Test 1 Checks with return codes + # 4. Test 2 Sets + # 5. reboot + # 6. Test 2 Checks with return codes + # + @{MASTER_TEST_V1}= Create List ${VTEST_01} + + @{MASTER_TEST_V2}= Create List ${VTEST_02} + + + # Default to all the tests + Set suite variable ${MASTER_TEST_V1} + + Set suite variable ${MASTER_TEST_V2} + +# +# Use the following to ensure the lists are built correctly +# +# Log To Console . +# Log To Console ${VTEST_01_SET1} +# Log To Console ${VTEST_01_SET2} +# Log To Console ${VTEST_01_SETS} +# Log To Console ${VTEST_01_CHECKS} +# Log To Console ${VTEST_01} + +# +# +# +Process TestCases + [Arguments] @{ATest} + +# +# This function iterates over each of the test cases. For each test case, +# create a settings payload, package it, send it to the system under test, +# restart the system to apply the settings, nd then validate that the +# settings in the checklist are correct. +# + FOR ${Testname} ${Sets} ${Checks} ${Results} IN @{ATest} + ${newSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewSettings.xml + ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml + # + # + Log To Console . + Log To Console Starting test ${Testname} + # + # Create the settings packet + # + Create Settings XML ${newSettingsXmlFile} 2 2 ${Sets} + File should Exist ${newSettingsXmlFile} + # + #Enable the serial log if the platform supports it + # + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplySettings.log + # + # Send the user(2) settings packet to the system under test + # + Process Settings Packet ${Testname} 2 ${OLD_USER_PFX} ${newSettingsXmlFile} @{TARGET_PARAMETERS} + # + # Restart the system to apply the settings + # + Log To Console Restarting the system under test + Reboot System And Wait For System Online + # + # + Get and Print Current Settings ${currentSettingXmlFile} + # + # Ensure all of the setting set, were applied correctly + # + ${xmlSettingsRslt}= Validate Settings Status ${Testname} 2 ${STATUS_SUCCESS} BASIC + # + # Validate the individual settings after the reboot + # + ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${Checks} + Should Be True ${rc} + # + ${rc}= Check Setting Status By Dictionary ${xmlSettingsRslt} ${Results} + Should Be True ${rc} + END + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +#------------------------------------------------------------------* +# Test Cases * +#------------------------------------------------------------------* +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + ${OwnerThumbprint}= Get Thumbprint Element ${currentIdxmlFile} Owner + ${UserThumbprint}= Get Thumbprint Element ${currentIdxmlFile} User + + Initialize Thumbprints '${OwnerThumbprint}' '${UserThumbprint}' + + Should Be True '${OwnerThumbprint}' != 'Cert not installed' + Should Be True '${UserThumbprint}' != 'Cert not installed' + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Process Complete Testcase List V1 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Running test V1, Disable TPM + + FOR ${ATest} IN @{MASTER_TEST_V1} + Process TestCases @{ATest} + END + + +Process Complete Testcase List V2 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Runnint test V2, Enable TPM + + FOR ${ATest} IN @{MASTER_TEST_V2} + Process TestCases @{ATest} + END + + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + +Clean Up Mailboxes + Verify No Mailboxes Have Data diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/SampleUnsignedPermissions.xml b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/SampleUnsignedPermissions.xml index 28b56b4e03..45ba481614 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/SampleUnsignedPermissions.xml +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/SampleUnsignedPermissions.xml @@ -1,74 +1,74 @@ - - - - - - Device.PlatformSetting1.Enable - 243 - 0 - - - Device.PlatformSetting2.Enable - 243 - 0 - - - Device.PlatformSetting3.Enable - 243 - 0 - - - Device.PlatformSetting4.Enable - 243 - 0 - - - Device.PlatformSetting5.Enable - 243 - 0 - - - Device.PlatformSetting6.Enable - 243 - 0 - - - Device.PlatformSetting7.Enable - 243 - 0 - - - Device.PlatformSetting8.Enable - 243 - 0 - - - Device.PlatformSetting9.Enable - 243 - 0 - - - Surface.PlatformSetting10.Scenario - 243 - 0 - - + + + + + + Device.PlatformSetting1.Enable + 243 + 0 + + + Device.PlatformSetting2.Enable + 243 + 0 + + + Device.PlatformSetting3.Enable + 243 + 0 + + + Device.PlatformSetting4.Enable + 243 + 0 + + + Device.PlatformSetting5.Enable + 243 + 0 + + + Device.PlatformSetting6.Enable + 243 + 0 + + + Device.PlatformSetting7.Enable + 243 + 0 + + + Device.PlatformSetting8.Enable + 243 + 0 + + + Device.PlatformSetting9.Enable + 243 + 0 + + + Surface.PlatformSetting10.Scenario + 243 + 0 + + \ No newline at end of file diff --git a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/run.robot b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/run.robot index 2b33517e8e..220a907bbf 100644 --- a/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/run.robot +++ b/DfciPkg/UnitTests/DfciTests/TestCases/DFCI_UnsignedSettings/run.robot @@ -1,308 +1,308 @@ -*** Settings *** -# @file -# -Documentation -... DFCI Unsigned SSettings Test -... This test suite checks the action of setting a setting, and the settings -... of group settings. -... -... NOTE: -... -... The ASSET TAG test are dependent upon the DFCI PCD's being set to these values: -... -... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagChars|"0123456789-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"|VOID*|0x40000017 -... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagLen | 36 | UINT16 | 0x40000018 -... -# -# Copyright (c), Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent - -MetaData -... - Build a settings packet -... - Send it to the system under test -... - Reboot the system under test to apply the settings -... - Get the new "Current Settings" -... - Verify the settings that were changed - -Library OperatingSystem -Library Process -Library Collections - -Library Support${/}Python${/}DFCI_SupportLib.py -Library Support${/}Python${/}DependencyLib.py -Library Support${/}Python${/}SettingsXMLLib.py -Library Remote http://${IP_OF_DUT}:${RF_PORT} - -#Import the Generic Shared keywords -Resource Support${/}Robot${/}DFCI_Shared_Paths.robot -Resource Support${/}Robot${/}CertSupport.robot -Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot - -#Import the platform specific log support -Resource UefiSerial_Keywords.robot - -# Use the following line for Python remote write to the UEFI Variables -Resource Support${/}Robot${/}DFCI_VariableTransport.robot - -Suite setup Make Dfci Output -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -#default var but should be changed on the command line -${IP_OF_DUT} 127.0.0.1 -${RF_PORT} 8270 -#test output dir for data from this test run. -${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT - -#Test output location -${TEST_OUTPUT} ${TEST_OUTPUT_BASE} - -#Test Root Dir -${TEST_ROOT_DIR} TestCases -${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_UnsignedSettings - -${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata -${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout -${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs - -${CERTS_DIR} Certs - -${TARGET_VERSION} V2 - -*** Keywords *** - -Initialize lists of tests -#[Documentation] -#... Each setting/value pair is a list of two elements - the setting, and the value. -#... Establish a list of the settings pairs for the settings to be set, and another -#... list for the settings to be checked after the reboot. - - @{VTEST_01_SET1}= Create List Device.WakeOnPower.Enable Enabled - @{VTEST_01_SET2}= Create List Device.LANBoot.Enable Disabled - @{VTEST_01_SET3}= Create List Device.IPv6Pxe.Enable Enabled - - @{VTEST_01_CHECK1}= Create List Device.WakeOnPower.Enable Enabled - @{VTEST_01_CHECK2}= Create List Device.LANBoot.Enable Disabled - @{VTEST_01_CHECK3}= Create List Device.IPv6Pxe.Enable Enabled - - ${VTEST_01_RESULTS}= Create Dictionary Device.WakeOnPower.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_01_RESULTS} Device.LANBoot.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_01_RESULTS} Device.IPv6Pxe.Enable ${STATUS_SUCCESS} - - @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} ${VTEST_01_SET2} ${VTEST_01_SET3} - @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} ${VTEST_01_CHECK3} - - - # Testcase 2 - @{VTEST_02_SET1}= Create List Device.WakeOnPower.Enable Disabled - @{VTEST_02_SET2}= Create List Device.LANBoot.Enable Enabled - @{VTEST_02_SET3}= Create List Device.IPv6Pxe.Enable Disabled - - @{VTEST_02_CHECK1}= Create List Device.WakeOnPower.Enable Disabled - @{VTEST_02_CHECK2}= Create List Device.LANBoot.Enable Enabled - @{VTEST_02_CHECK3}= Create List Device.IPv6Pxe.Enable Disabled - - ${VTEST_02_RESULTS}= Create Dictionary Device.WakeOnPower.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_02_RESULTS} Device.LANBoot.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_02_RESULTS} Device.IPv6Pxe.Enable ${STATUS_SUCCESS} - - @{VTEST_02_SETS}= Create List ${VTEST_02_SET1} ${VTEST_02_SET2} ${VTEST_02_SET3} - @{VTEST_02_CHECKS}= Create List ${VTEST_02_CHECK1} ${VTEST_02_CHECK2} ${VTEST_02_CHECK3} - - - # Testcase 3 - @{VTEST_03_SET1}= Create List Device.WakeOnPower.Enable Enabled - @{VTEST_03_SET2}= Create List Device.LANBoot.Enable Enabled - @{VTEST_03_SET3}= Create List Device.IPv6Pxe.Enable Enabled - - @{VTEST_03_CHECK1}= Create List Device.WakeOnPower.Enable Enabled - @{VTEST_03_CHECK2}= Create List Device.LANBoot.Enable Enabled - @{VTEST_03_CHECK3}= Create List Device.IPv6Pxe.Enable Enabled - - ${VTEST_03_RESULTS}= Create Dictionary Device.WakeOnPower.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_03_RESULTS} Device.LANBoot.Enable ${STATUS_SUCCESS} - Set To Dictionary ${VTEST_03_RESULTS} Device.IPv6Pxe.Enable ${STATUS_SUCCESS} - - @{VTEST_03_SETS}= Create List ${VTEST_03_SET1} ${VTEST_03_SET2} ${VTEST_03_SET3} - @{VTEST_03_CHECKS}= Create List ${VTEST_03_CHECK1} ${VTEST_03_CHECK2} ${VTEST_03_CHECK3} - - - # The full tests are here - - @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} ${VTEST_01_RESULTS} - @{VTEST_02}= Create List Test2 ${VTEST_02_SETS} ${VTEST_02_CHECKS} ${VTEST_02_RESULTS} - @{VTEST_03}= Create List Test3 ${VTEST_03_SETS} ${VTEST_03_CHECKS} ${VTEST_03_RESULTS} - - - # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists and a dictionary of results. - # Variables to be set before a reboot, and a set of variables to be checked after a reboot, and a dictionary of expected results - # for each setting. For two tests, that means: - # 1. Test 1 Sets - # 2. reboot - # 3. Test 1 Checks with return codes - # 4. Test 2 Sets - # 5. reboot - # 6. Test 2 Checks with return codes - # etc for Test 3 - # - @{MASTER_TEST}= Create List ${VTEST_01} ${VTEST_02} - - @{RESTORE_SETTINGS}= Create List ${VTEST_03} - - # Default to all the tests - Set suite variable ${MASTER_TEST} - Set suite variable ${RESTORE_SETTINGS} - - -# -# Use the following to ensure the lists are built correctly -# - Log To Console . - Log To Console ${VTEST_01_SET1} - Log To Console ${VTEST_01_SET2} - Log To Console ${VTEST_01_SET3} - Log To Console ${VTEST_01_CHECKS} - Log To Console ${VTEST_01} - -# -# -# -Process TestCases - [Arguments] @{ATest} - -# -# This function iterates over each of the test cases. For each test case, -# create a settings payload, package it, send it to the system under test, -# restart the system to apply the settings, nd then validate that the -# settings in the checklist are correct. -# - FOR ${Testname} ${Sets} ${Checks} ${Results} IN @{ATest} - ${newSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewSettings.xml - ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml - # - # - Log To Console . - Log To Console Starting test ${Testname} - # - # Create the settings packet - # - Create Settings XML ${newSettingsXmlFile} 2 2 ${Sets} - File should Exist ${newSettingsXmlFile} - # - #Enable the serial log if the platform supports it - # - Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplySettings.log - # - # Send the user(2) settings packet to the system under test - # - Process Settings Packet ${Testname} 1 UNSIGNED ${newSettingsXmlFile} @{TARGET_PARAMETERS} - # - # Restart the system to apply the settings - # - Log To Console Restarting the system under test - Reboot System And Wait For System Online - # - # - Get and Print Current Settings ${currentSettingXmlFile} - # - # Ensure all of the setting set, were applied correctly - # - ${xmlSettingsRslt}= Validate Settings Status ${Testname} 1 ${STATUS_SUCCESS} BASIC - # - # Validate the individual settings after the reboot - # - ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${Checks} - Should Be True ${rc} - # - ${rc}= Check Setting Status By Dictionary ${xmlSettingsRslt} ${Results} - Should Be True ${rc} - END - - -Get The DFCI Settings - [Arguments] ${nameOfTest} - ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml - ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml - ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml - ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml - - Get and Print Device Identifier ${deviceIdXmlFile} - - Get and Print Current Identities ${currentIdxmlFile} - - Get and Print Current Permissions ${currentPermxmlFile} - - Get and Print Current Settings ${currentSettingsxmlFile} - - [return] ${currentIdxmlFile} - - -#------------------------------------------------------------------* -# Test Cases * -#------------------------------------------------------------------* -*** Test Cases *** - - -Ensure Mailboxes Are Clean -#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. - Verify No Mailboxes Have Data - - Log To Console . - Log To Console ${SUITE SOURCE} - - -Get the starting DFCI Settings - [Setup] Require test case Ensure Mailboxes Are Clean - ${nameofTest}= Set Variable DisplaySettingsAtStart - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - -Obtain Target Parameters From Target - [Setup] Require test case Get the starting DFCI Settings - - ${nameofTest}= Set Variable GetParameters - ${SerialNumber}= Get System Under Test SerialNumber - ${Manufacturer}= Get System Under Test Manufacturer - ${Model}= Get System Under Test ProductName - @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} - Set Suite Variable @{TARGET_PARAMETERS} - - ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml - - Get Device Identifier ${currentXmlFile} - Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} - - -Process Complete Testcase List - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Running test - - FOR ${ATest} IN @{MASTER_TEST} - Process TestCases @{ATest} - END - - -Restore Settings V2 - - Log To Console Initializing testcases - Initialize lists of tests - - Log To Console Restoring settings - - FOR ${ATest} IN @{RESTORE_SETTINGS} - Process TestCases @{ATest} - END - -Get the ending DFCI Settings - ${nameofTest}= Set Variable DisplaySettingsAtExit - - ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} - - -Clean Up Mailboxes - Verify No Mailboxes Have Data +*** Settings *** +# @file +# +Documentation +... DFCI Unsigned SSettings Test +... This test suite checks the action of setting a setting, and the settings +... of group settings. +... +... NOTE: +... +... The ASSET TAG test are dependent upon the DFCI PCD's being set to these values: +... +... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagChars|"0123456789-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"|VOID*|0x40000017 +... gDfciPkgTokenSpaceGuid.PcdDfciAssetTagLen | 36 | UINT16 | 0x40000018 +... +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +MetaData +... - Build a settings packet +... - Send it to the system under test +... - Reboot the system under test to apply the settings +... - Get the new "Current Settings" +... - Verify the settings that were changed + +Library OperatingSystem +Library Process +Library Collections + +Library Support${/}Python${/}DFCI_SupportLib.py +Library Support${/}Python${/}DependencyLib.py +Library Support${/}Python${/}SettingsXMLLib.py +Library Remote http://${IP_OF_DUT}:${RF_PORT} + +#Import the Generic Shared keywords +Resource Support${/}Robot${/}DFCI_Shared_Paths.robot +Resource Support${/}Robot${/}CertSupport.robot +Resource Support${/}Robot${/}DFCI_Shared_Keywords.robot + +#Import the platform specific log support +Resource UefiSerial_Keywords.robot + +# Use the following line for Python remote write to the UEFI Variables +Resource Support${/}Robot${/}DFCI_VariableTransport.robot + +Suite setup Make Dfci Output +Suite Teardown Terminate All Processes kill=True + + +*** Variables *** +#default var but should be changed on the command line +${IP_OF_DUT} 127.0.0.1 +${RF_PORT} 8270 +#test output dir for data from this test run. +${TEST_OUTPUT_BASE} ..${/}TEST_OUTPUT + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +#Test Root Dir +${TEST_ROOT_DIR} TestCases +${TEST_CASE_DIR} ${TEST_ROOT_DIR}${/}DFCI_UnsignedSettings + +${TOOL_DATA_OUT_DIR} ${TEST_OUTPUT}${/}bindata +${TOOL_STD_OUT_DIR} ${TEST_OUTPUT}${/}stdout +${BOOT_LOG_OUT_DIR} ${TEST_OUTPUT}${/}uefilogs + +${CERTS_DIR} Certs + +${TARGET_VERSION} V2 + +*** Keywords *** + +Initialize lists of tests +#[Documentation] +#... Each setting/value pair is a list of two elements - the setting, and the value. +#... Establish a list of the settings pairs for the settings to be set, and another +#... list for the settings to be checked after the reboot. + + @{VTEST_01_SET1}= Create List Device.WakeOnPower.Enable Enabled + @{VTEST_01_SET2}= Create List Device.LANBoot.Enable Disabled + @{VTEST_01_SET3}= Create List Device.IPv6Pxe.Enable Enabled + + @{VTEST_01_CHECK1}= Create List Device.WakeOnPower.Enable Enabled + @{VTEST_01_CHECK2}= Create List Device.LANBoot.Enable Disabled + @{VTEST_01_CHECK3}= Create List Device.IPv6Pxe.Enable Enabled + + ${VTEST_01_RESULTS}= Create Dictionary Device.WakeOnPower.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_01_RESULTS} Device.LANBoot.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_01_RESULTS} Device.IPv6Pxe.Enable ${STATUS_SUCCESS} + + @{VTEST_01_SETS}= Create List ${VTEST_01_SET1} ${VTEST_01_SET2} ${VTEST_01_SET3} + @{VTEST_01_CHECKS}= Create List ${VTEST_01_CHECK1} ${VTEST_01_CHECK2} ${VTEST_01_CHECK3} + + + # Testcase 2 + @{VTEST_02_SET1}= Create List Device.WakeOnPower.Enable Disabled + @{VTEST_02_SET2}= Create List Device.LANBoot.Enable Enabled + @{VTEST_02_SET3}= Create List Device.IPv6Pxe.Enable Disabled + + @{VTEST_02_CHECK1}= Create List Device.WakeOnPower.Enable Disabled + @{VTEST_02_CHECK2}= Create List Device.LANBoot.Enable Enabled + @{VTEST_02_CHECK3}= Create List Device.IPv6Pxe.Enable Disabled + + ${VTEST_02_RESULTS}= Create Dictionary Device.WakeOnPower.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_02_RESULTS} Device.LANBoot.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_02_RESULTS} Device.IPv6Pxe.Enable ${STATUS_SUCCESS} + + @{VTEST_02_SETS}= Create List ${VTEST_02_SET1} ${VTEST_02_SET2} ${VTEST_02_SET3} + @{VTEST_02_CHECKS}= Create List ${VTEST_02_CHECK1} ${VTEST_02_CHECK2} ${VTEST_02_CHECK3} + + + # Testcase 3 + @{VTEST_03_SET1}= Create List Device.WakeOnPower.Enable Enabled + @{VTEST_03_SET2}= Create List Device.LANBoot.Enable Enabled + @{VTEST_03_SET3}= Create List Device.IPv6Pxe.Enable Enabled + + @{VTEST_03_CHECK1}= Create List Device.WakeOnPower.Enable Enabled + @{VTEST_03_CHECK2}= Create List Device.LANBoot.Enable Enabled + @{VTEST_03_CHECK3}= Create List Device.IPv6Pxe.Enable Enabled + + ${VTEST_03_RESULTS}= Create Dictionary Device.WakeOnPower.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_03_RESULTS} Device.LANBoot.Enable ${STATUS_SUCCESS} + Set To Dictionary ${VTEST_03_RESULTS} Device.IPv6Pxe.Enable ${STATUS_SUCCESS} + + @{VTEST_03_SETS}= Create List ${VTEST_03_SET1} ${VTEST_03_SET2} ${VTEST_03_SET3} + @{VTEST_03_CHECKS}= Create List ${VTEST_03_CHECK1} ${VTEST_03_CHECK2} ${VTEST_03_CHECK3} + + + # The full tests are here + + @{VTEST_01}= Create List Test1 ${VTEST_01_SETS} ${VTEST_01_CHECKS} ${VTEST_01_RESULTS} + @{VTEST_02}= Create List Test2 ${VTEST_02_SETS} ${VTEST_02_CHECKS} ${VTEST_02_RESULTS} + @{VTEST_03}= Create List Test3 ${VTEST_03_SETS} ${VTEST_03_CHECKS} ${VTEST_03_RESULTS} + + + # Export one master test variable. Each entry in the MASTER TEST variable is a set of two lists and a dictionary of results. + # Variables to be set before a reboot, and a set of variables to be checked after a reboot, and a dictionary of expected results + # for each setting. For two tests, that means: + # 1. Test 1 Sets + # 2. reboot + # 3. Test 1 Checks with return codes + # 4. Test 2 Sets + # 5. reboot + # 6. Test 2 Checks with return codes + # etc for Test 3 + # + @{MASTER_TEST}= Create List ${VTEST_01} ${VTEST_02} + + @{RESTORE_SETTINGS}= Create List ${VTEST_03} + + # Default to all the tests + Set suite variable ${MASTER_TEST} + Set suite variable ${RESTORE_SETTINGS} + + +# +# Use the following to ensure the lists are built correctly +# + Log To Console . + Log To Console ${VTEST_01_SET1} + Log To Console ${VTEST_01_SET2} + Log To Console ${VTEST_01_SET3} + Log To Console ${VTEST_01_CHECKS} + Log To Console ${VTEST_01} + +# +# +# +Process TestCases + [Arguments] @{ATest} + +# +# This function iterates over each of the test cases. For each test case, +# create a settings payload, package it, send it to the system under test, +# restart the system to apply the settings, nd then validate that the +# settings in the checklist are correct. +# + FOR ${Testname} ${Sets} ${Checks} ${Results} IN @{ATest} + ${newSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_NewSettings.xml + ${currentSettingXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${Testname}_CurrentSettings.xml + # + # + Log To Console . + Log To Console Starting test ${Testname} + # + # Create the settings packet + # + Create Settings XML ${newSettingsXmlFile} 2 2 ${Sets} + File should Exist ${newSettingsXmlFile} + # + #Enable the serial log if the platform supports it + # + Start SerialLog ${BOOT_LOG_OUT_DIR}${/}${Testname}_ApplySettings.log + # + # Send the user(2) settings packet to the system under test + # + Process Settings Packet ${Testname} 1 UNSIGNED ${newSettingsXmlFile} @{TARGET_PARAMETERS} + # + # Restart the system to apply the settings + # + Log To Console Restarting the system under test + Reboot System And Wait For System Online + # + # + Get and Print Current Settings ${currentSettingXmlFile} + # + # Ensure all of the setting set, were applied correctly + # + ${xmlSettingsRslt}= Validate Settings Status ${Testname} 1 ${STATUS_SUCCESS} BASIC + # + # Validate the individual settings after the reboot + # + ${rc}= Validate Current Settings ${Testname} ${currentSettingXmlFile} ${Checks} + Should Be True ${rc} + # + ${rc}= Check Setting Status By Dictionary ${xmlSettingsRslt} ${Results} + Should Be True ${rc} + END + + +Get The DFCI Settings + [Arguments] ${nameOfTest} + ${deviceIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_deviceIdentifier.xml + ${currentIdXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentIdentities.xml + ${currentPermXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentPermission.xml + ${currentSettingsXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_currentSettings.xml + + Get and Print Device Identifier ${deviceIdXmlFile} + + Get and Print Current Identities ${currentIdxmlFile} + + Get and Print Current Permissions ${currentPermxmlFile} + + Get and Print Current Settings ${currentSettingsxmlFile} + + [return] ${currentIdxmlFile} + + +#------------------------------------------------------------------* +# Test Cases * +#------------------------------------------------------------------* +*** Test Cases *** + + +Ensure Mailboxes Are Clean +#Documentation Ensure all mailboxes are clear at the beginning of a test. If there are any mailboxes that have an element, a previous test failed. + Verify No Mailboxes Have Data + + Log To Console . + Log To Console ${SUITE SOURCE} + + +Get the starting DFCI Settings + [Setup] Require test case Ensure Mailboxes Are Clean + ${nameofTest}= Set Variable DisplaySettingsAtStart + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + +Obtain Target Parameters From Target + [Setup] Require test case Get the starting DFCI Settings + + ${nameofTest}= Set Variable GetParameters + ${SerialNumber}= Get System Under Test SerialNumber + ${Manufacturer}= Get System Under Test Manufacturer + ${Model}= Get System Under Test ProductName + @{TARGET_PARAMETERS}= Build Target Parameters ${TARGET_VERSION} ${SerialNumber} ${Manufacturer} ${Model} + Set Suite Variable @{TARGET_PARAMETERS} + + ${currentXmlFile}= Set Variable ${TOOL_DATA_OUT_DIR}${/}${nameofTest}_UefiDeviceId.xml + + Get Device Identifier ${currentXmlFile} + Verify Identity Current ${currentXmlFile} ${Manufacturer} ${Model} ${SerialNumber} + + +Process Complete Testcase List + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Running test + + FOR ${ATest} IN @{MASTER_TEST} + Process TestCases @{ATest} + END + + +Restore Settings V2 + + Log To Console Initializing testcases + Initialize lists of tests + + Log To Console Restoring settings + + FOR ${ATest} IN @{RESTORE_SETTINGS} + Process TestCases @{ATest} + END + +Get the ending DFCI Settings + ${nameofTest}= Set Variable DisplaySettingsAtExit + + ${currentIdXmlFile}= Get The DFCI Settings ${nameOfTest} + + +Clean Up Mailboxes + Verify No Mailboxes Have Data diff --git a/DfciPkg/UnitTests/DfciVarLockAudit/UEFI/DfciVarLockAuditTestApp.inf b/DfciPkg/UnitTests/DfciVarLockAudit/UEFI/DfciVarLockAuditTestApp.inf index c9680472b9..5dfaf44f3c 100644 --- a/DfciPkg/UnitTests/DfciVarLockAudit/UEFI/DfciVarLockAuditTestApp.inf +++ b/DfciPkg/UnitTests/DfciVarLockAudit/UEFI/DfciVarLockAuditTestApp.inf @@ -1,64 +1,64 @@ - -## @file -# A UEFI Audit test app that enumerates all DFCI variables in NV ram -# collects the attribute information and then attempts to make changes -# to the variable in order to gather variable protection information. -# -# If the variable is successfully deleted it will be recreated with the -# same data value. -# -# The result data is output in XML -# -# Copyright (C) Microsoft Corporation. All rights reserved. -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DfciVarLockAuditTestApp - FILE_GUID = 1a92094b-5650-4161-8868-c3b4968a8416 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = DfciLockTestEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - DfciLockTest.c - DfciLockTestXml.h - DfciLockTestXml.c - InternalFunctions.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - DfciPkg/DfciPkg.dec - XmlSupportPkg/XmlSupportPkg.dec - ShellPkg/ShellPkg.dec - ZeroTouchPkg/ZeroTouchPkg.dec - - -[LibraryClasses] - UefiApplicationEntryPoint - UefiLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - DebugLib - BaseLib - BaseMemoryLib - ShellLib - PrintLib - XmlTreeLib - XmlTreeQueryLib - -[Guids] - gDfciDeviceIdVarNamespace - gDfciInternalVariableGuid - gDfciAuthProvisionVarNamespace - gDfciPermissionManagerVarNamespace - gDfciSettingsGuid - gDfciSettingsManagerVarNamespace + +## @file +# A UEFI Audit test app that enumerates all DFCI variables in NV ram +# collects the attribute information and then attempts to make changes +# to the variable in order to gather variable protection information. +# +# If the variable is successfully deleted it will be recreated with the +# same data value. +# +# The result data is output in XML +# +# Copyright (C) Microsoft Corporation. All rights reserved. +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DfciVarLockAuditTestApp + FILE_GUID = 1a92094b-5650-4161-8868-c3b4968a8416 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = DfciLockTestEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + DfciLockTest.c + DfciLockTestXml.h + DfciLockTestXml.c + InternalFunctions.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + DfciPkg/DfciPkg.dec + XmlSupportPkg/XmlSupportPkg.dec + ShellPkg/ShellPkg.dec + ZeroTouchPkg/ZeroTouchPkg.dec + + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + DebugLib + BaseLib + BaseMemoryLib + ShellLib + PrintLib + XmlTreeLib + XmlTreeQueryLib + +[Guids] + gDfciDeviceIdVarNamespace + gDfciInternalVariableGuid + gDfciAuthProvisionVarNamespace + gDfciPermissionManagerVarNamespace + gDfciSettingsGuid + gDfciSettingsManagerVarNamespace gZeroTouchVariableGuid \ No newline at end of file diff --git a/HidPkg/Docs/Readme.md b/HidPkg/Docs/Readme.md index 3532e8e6b8..c71c7fb1cc 100644 --- a/HidPkg/Docs/Readme.md +++ b/HidPkg/Docs/Readme.md @@ -1,75 +1,75 @@ -# HID support package - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -## About - -The purpose of this package is to provide a generic Boot HID layer that can be -used so that devices that implement the Boot Mouse and Boot Keyboard HID -interfaces defined in the USB 1.1 spec can share a common HID processing layer. - -This avoids duplication of the HID parsing/processing code and provides a -natural interface layer where various HID-supporting hardware can plug into -the UEFI input stack. - -![HidPkg Architectural Diagram](hid_pkg_mu.png) - -Adding support for new hardware that wants to plug into HID Keyboard or Mouse -simply requires implementing HidKeyboardProtocol or HidMouseProtocol and -installing instances of those protocols on the controller handle for the -hardware. - -This greatly simplifies the process of supporting hardware that is already -designed to support Boot Mouse or Boot Keyboard HID spec, since such hardware -is already producing reports in the same format that the HidKeyboardProtocol or -HidMouseProtocol expects. - -## Integration Guide - -To use the HidPkg, include the following drivers in your build: - -FDF: - -```text -#HID Support -INF HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf -INF HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf -``` - -DSC: - -```text -#HID Support - HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf - HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf -``` - -Then, include low-level drivers that produce the HID protocols. This package -includes two sample drivers for USB keyboard and Mouse that can be used in place -of the standard USB keyboard and Mouse drivers. A platform may add additional -drivers to support proprietary hardware such as keyboards/track pads/ -touchscreens that support the HID protocol definitions in this package. - -To include the sample USB HID drivers, remove the MdeModulePkg versions and -replace them with the sample drivers from this package. - -FDF: - -```diff --INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf --INF MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf -+INF HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf -+INF HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf -``` - -DSC: - -```diff -- MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf -- MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf -+ HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf -+ HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf -``` +# HID support package + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +## About + +The purpose of this package is to provide a generic Boot HID layer that can be +used so that devices that implement the Boot Mouse and Boot Keyboard HID +interfaces defined in the USB 1.1 spec can share a common HID processing layer. + +This avoids duplication of the HID parsing/processing code and provides a +natural interface layer where various HID-supporting hardware can plug into +the UEFI input stack. + +![HidPkg Architectural Diagram](hid_pkg_mu.png) + +Adding support for new hardware that wants to plug into HID Keyboard or Mouse +simply requires implementing HidKeyboardProtocol or HidMouseProtocol and +installing instances of those protocols on the controller handle for the +hardware. + +This greatly simplifies the process of supporting hardware that is already +designed to support Boot Mouse or Boot Keyboard HID spec, since such hardware +is already producing reports in the same format that the HidKeyboardProtocol or +HidMouseProtocol expects. + +## Integration Guide + +To use the HidPkg, include the following drivers in your build: + +FDF: + +```text +#HID Support +INF HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf +INF HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf +``` + +DSC: + +```text +#HID Support + HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf + HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf +``` + +Then, include low-level drivers that produce the HID protocols. This package +includes two sample drivers for USB keyboard and Mouse that can be used in place +of the standard USB keyboard and Mouse drivers. A platform may add additional +drivers to support proprietary hardware such as keyboards/track pads/ +touchscreens that support the HID protocol definitions in this package. + +To include the sample USB HID drivers, remove the MdeModulePkg versions and +replace them with the sample drivers from this package. + +FDF: + +```diff +-INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf +-INF MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf ++INF HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf ++INF HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf +``` + +DSC: + +```diff +- MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf +- MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf ++ HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf ++ HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf +``` diff --git a/HidPkg/HidKeyboardDxe/HidKbDxe.uni b/HidPkg/HidKeyboardDxe/HidKbDxe.uni index 0a5bff08b6..852a2c9a2b 100644 --- a/HidPkg/HidKeyboardDxe/HidKbDxe.uni +++ b/HidPkg/HidKeyboardDxe/HidKbDxe.uni @@ -1,26 +1,26 @@ -// /** @file HidKbDxe.uni -// HID Keyboard Driver that manages HID keyboard and produces Simple Text Input(Ex) Protocol. -// -// HID Keyboard Driver consumes HID Keyboard Protocol, and produces -// Simple Text Input Protocol and Simple Text Input Ex Protocol on HID keyboard devices. -// It initializes the keyboard layout according to info retrieved from HII database. -// If HII cannot provide the info, this module uses its carried default one if PCD allows. -// It manages the HID keyboard device via the HID Keyboard protocol, -// and parses the data according to HID spec Boot Keyboard report definition. -// This module refers to following specifications: -// 1. Universal Serial Bus HID Firmware Specification, ver 1.11 -// 2. UEFI Specification, v2.1 -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// Portions derived from UsbKbDxe: -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Manages HID keyboard and produces Simple Text Input(Ex) Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "HID Keyboard Driver consumes HID Keyboard Protocol, and produces Simple Text Input Protocol." - +// /** @file HidKbDxe.uni +// HID Keyboard Driver that manages HID keyboard and produces Simple Text Input(Ex) Protocol. +// +// HID Keyboard Driver consumes HID Keyboard Protocol, and produces +// Simple Text Input Protocol and Simple Text Input Ex Protocol on HID keyboard devices. +// It initializes the keyboard layout according to info retrieved from HII database. +// If HII cannot provide the info, this module uses its carried default one if PCD allows. +// It manages the HID keyboard device via the HID Keyboard protocol, +// and parses the data according to HID spec Boot Keyboard report definition. +// This module refers to following specifications: +// 1. Universal Serial Bus HID Firmware Specification, ver 1.11 +// 2. UEFI Specification, v2.1 +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// Portions derived from UsbKbDxe: +// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Manages HID keyboard and produces Simple Text Input(Ex) Protocol" + +#string STR_MODULE_DESCRIPTION #language en-US "HID Keyboard Driver consumes HID Keyboard Protocol, and produces Simple Text Input Protocol." + diff --git a/HidPkg/HidKeyboardDxe/HidKbDxeExtra.uni b/HidPkg/HidKeyboardDxe/HidKbDxeExtra.uni index e7d497ffb3..51d067cfa6 100644 --- a/HidPkg/HidKeyboardDxe/HidKbDxeExtra.uni +++ b/HidPkg/HidKeyboardDxe/HidKbDxeExtra.uni @@ -1,16 +1,16 @@ -// /** @file HidKbDxeExtra.uni -// HidKeyboard Localized Strings and Content -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// Portions Derived from UsbKbDxe: -// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - -#string STR_PROPERTIES_MODULE_NAME -#language en-US -"HID Keyboard DXE Driver" - - +// /** @file HidKbDxeExtra.uni +// HidKeyboard Localized Strings and Content +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// Portions Derived from UsbKbDxe: +// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"HID Keyboard DXE Driver" + + diff --git a/HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf b/HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf index a08874c78f..006785d0f8 100644 --- a/HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf +++ b/HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf @@ -1,65 +1,65 @@ -## @file -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# This is the component INF for the HID Keyboard Dxe Driver -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = HidKeyboardDxe - MODULE_UNI_FILE = HidKbDxe.uni - FILE_GUID = B5FD279E-779D-4831-ADEE-41CC49FAF652 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = HIDKeyboardDriverEntryPoint - -[Sources] - HidKbDxe.c - HidKbDxe.h - HidKeyboard.c - ComponentName.c - HidKeyboard.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - HidPkg/HidPkg.dec - -[LibraryClasses] - MemoryAllocationLib - UefiLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiRuntimeServicesTableLib - BaseMemoryLib - DebugLib - PcdLib - HiiLib - -[Guids] - # - # Event registered to EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group, - # which will be triggered by EFI_HII_DATABASE_PROTOCOL.SetKeyboardLayout(). - # - gEfiHiiKeyBoardLayoutGuid - gHidKeyboardLayoutPackageGuid - gHidKeyboardLayoutKeyGuid - -[Protocols] - gHidKeyboardProtocolGuid - gEfiSimpleTextInProtocolGuid - gEfiSimpleTextInputExProtocolGuid - - # - # If HII Database Protocol exists, then keyboard layout from HII database is used. - # Otherwise, USB keyboard module tries to use its carried default layout. - # - gEfiHiiDatabaseProtocolGuid - -[FeaturePcd] - gHidPkgTokenSpaceGuid.PcdDisableDefaultKeyboardLayoutInHidKbDriver - -[UserExtensions.TianoCore."ExtraFiles"] - HidKbDxeExtra.uni +## @file +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# This is the component INF for the HID Keyboard Dxe Driver +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = HidKeyboardDxe + MODULE_UNI_FILE = HidKbDxe.uni + FILE_GUID = B5FD279E-779D-4831-ADEE-41CC49FAF652 + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = HIDKeyboardDriverEntryPoint + +[Sources] + HidKbDxe.c + HidKbDxe.h + HidKeyboard.c + ComponentName.c + HidKeyboard.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + HidPkg/HidPkg.dec + +[LibraryClasses] + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + BaseMemoryLib + DebugLib + PcdLib + HiiLib + +[Guids] + # + # Event registered to EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group, + # which will be triggered by EFI_HII_DATABASE_PROTOCOL.SetKeyboardLayout(). + # + gEfiHiiKeyBoardLayoutGuid + gHidKeyboardLayoutPackageGuid + gHidKeyboardLayoutKeyGuid + +[Protocols] + gHidKeyboardProtocolGuid + gEfiSimpleTextInProtocolGuid + gEfiSimpleTextInputExProtocolGuid + + # + # If HII Database Protocol exists, then keyboard layout from HII database is used. + # Otherwise, USB keyboard module tries to use its carried default layout. + # + gEfiHiiDatabaseProtocolGuid + +[FeaturePcd] + gHidPkgTokenSpaceGuid.PcdDisableDefaultKeyboardLayoutInHidKbDriver + +[UserExtensions.TianoCore."ExtraFiles"] + HidKbDxeExtra.uni diff --git a/HidPkg/HidKeyboardDxe/HidKeyboardDxe.md b/HidPkg/HidKeyboardDxe/HidKeyboardDxe.md index 6c343589b7..c7b1ae4da7 100644 --- a/HidPkg/HidKeyboardDxe/HidKeyboardDxe.md +++ b/HidPkg/HidKeyboardDxe/HidKeyboardDxe.md @@ -1,19 +1,19 @@ - -# Description - -This driver produces an instances of SIMPLE_TEXT_INPUT/SIMPLE_TEXT_INPUT_EX for keyboard support in UEFI - -It registers a callback with devices exposing the HID_KEYBOARD_PROTOCOL to receive Keyboard HID reports, -which are used to satisfy the contract of SIMPLE_TEXT_INPUT/SIMPLE_TEXT_INPUT_EX. - -# Provides - -SIMPLE_TEXT_INPUT/SIMPLE_TEXT_INPUT_EX instance for consumption by UEFI console. - -# Dependencies - -HID_KEYBOARD_PROTOCOL to register for and receive HID Keyboard Reports. - -# Application - -Used to enable PreBoot Keyboard Support. + +# Description + +This driver produces an instances of SIMPLE_TEXT_INPUT/SIMPLE_TEXT_INPUT_EX for keyboard support in UEFI + +It registers a callback with devices exposing the HID_KEYBOARD_PROTOCOL to receive Keyboard HID reports, +which are used to satisfy the contract of SIMPLE_TEXT_INPUT/SIMPLE_TEXT_INPUT_EX. + +# Provides + +SIMPLE_TEXT_INPUT/SIMPLE_TEXT_INPUT_EX instance for consumption by UEFI console. + +# Dependencies + +HID_KEYBOARD_PROTOCOL to register for and receive HID Keyboard Reports. + +# Application + +Used to enable PreBoot Keyboard Support. diff --git a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf index df68cfe379..2743aa83e8 100644 --- a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf +++ b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf @@ -1,54 +1,54 @@ -## @file -# HID Mouse Driver that manages HID Mouse device and produces Absolute Pointer Protocol. -# -# This Mouse Driver consumes the HID Mouse Protocol, and produces -# Absolute Pointer Protocol on HID Mouse mouse devices. -# -# It manages the HID mouse device via the HID mouse protocol abstraction, -# and parses the data according to USB HID Specification. -# This module refers to following specifications: -# 1. Universal Serial Bus HID Firmware Specification, ver 1.11 -# 2. UEFI Specification, v2.1 -# -# Copyright (c) Microsoft Corporation. -# -# Most of this driver derived from USB Mouse driver in UDK, which is: -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = HidMouseAbsolutePointerDxe - MODULE_UNI_FILE = HidMouseAbsolutePointerDxe.uni - FILE_GUID = 99710012-4230-4842-9712-B9785B723812 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = HidMouseAbsolutePointerDriverBindingEntryPoint - -[Sources] - ComponentName.c - HidMouseAbsolutePointer.c - HidMouseAbsolutePointer.h - -[Packages] - MdePkg/MdePkg.dec - HidPkg/HidPkg.dec - -[LibraryClasses] - MemoryAllocationLib - UefiLib - UefiBootServicesTableLib - UefiDriverEntryPoint - BaseMemoryLib - ReportStatusCodeLib - -[Protocols] - gHidPointerProtocolGuid - gEfiAbsolutePointerProtocolGuid - -[UserExtensions.TianoCore."ExtraFiles"] - HidMouseAbsolutePointerDxeExtra.uni +## @file +# HID Mouse Driver that manages HID Mouse device and produces Absolute Pointer Protocol. +# +# This Mouse Driver consumes the HID Mouse Protocol, and produces +# Absolute Pointer Protocol on HID Mouse mouse devices. +# +# It manages the HID mouse device via the HID mouse protocol abstraction, +# and parses the data according to USB HID Specification. +# This module refers to following specifications: +# 1. Universal Serial Bus HID Firmware Specification, ver 1.11 +# 2. UEFI Specification, v2.1 +# +# Copyright (c) Microsoft Corporation. +# +# Most of this driver derived from USB Mouse driver in UDK, which is: +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = HidMouseAbsolutePointerDxe + MODULE_UNI_FILE = HidMouseAbsolutePointerDxe.uni + FILE_GUID = 99710012-4230-4842-9712-B9785B723812 + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = HidMouseAbsolutePointerDriverBindingEntryPoint + +[Sources] + ComponentName.c + HidMouseAbsolutePointer.c + HidMouseAbsolutePointer.h + +[Packages] + MdePkg/MdePkg.dec + HidPkg/HidPkg.dec + +[LibraryClasses] + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + BaseMemoryLib + ReportStatusCodeLib + +[Protocols] + gHidPointerProtocolGuid + gEfiAbsolutePointerProtocolGuid + +[UserExtensions.TianoCore."ExtraFiles"] + HidMouseAbsolutePointerDxeExtra.uni diff --git a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.md b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.md index 29a9201083..e45aefdb2f 100644 --- a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.md +++ b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.md @@ -1,20 +1,20 @@ -# HID Mouse Absolute Pointer DXE - -## Description - -This driver produces an instance of EFI_ABSOLUTE_POINTER_PROTOCOL for mouse support in UEFI - -It registers a callback with the devices exposing HID_POINTER_PROTOCOL to receive Mouse HID reports, -which are used to satisfy the contract of EFI_ABSOLUTE_POINTER_PROTOCOL. - -## Provides - -EFI_ABSOLUTE_POINTER_PROTOCOL instance for consumption by UEFI console. - -## Dependencies - -HID_POINTER_PROTOCOL to register for and receive HID Mouse Reports. - -## Application - -Used to enable PreBoot Mouse Support. +# HID Mouse Absolute Pointer DXE + +## Description + +This driver produces an instance of EFI_ABSOLUTE_POINTER_PROTOCOL for mouse support in UEFI + +It registers a callback with the devices exposing HID_POINTER_PROTOCOL to receive Mouse HID reports, +which are used to satisfy the contract of EFI_ABSOLUTE_POINTER_PROTOCOL. + +## Provides + +EFI_ABSOLUTE_POINTER_PROTOCOL instance for consumption by UEFI console. + +## Dependencies + +HID_POINTER_PROTOCOL to register for and receive HID Mouse Reports. + +## Application + +Used to enable PreBoot Mouse Support. diff --git a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.uni b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.uni index e1862a4b40..78e9f73f32 100644 --- a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.uni +++ b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.uni @@ -1,28 +1,28 @@ -/* @file HidMouseAbsolutePointer.c - HID Mouse Driver that manages HID Mouse device and produces Absolute Pointer Protocol. - - This Mouse Driver consumes the HID Mouse Protocol, and produces - Absolute Pointer Protocol on HID Mouse mouse devices. - - It manages the HID mouse device via the HID mouse protocol abstraction, - and parses the data according to USB HID Specification. - This module refers to following specifications: - 1. Universal Serial Bus HID Firmware Specification, ver 1.11 - 2. UEFI Specification, v2.1 - - Copyright (c) Microsoft Corporation. - - Most of this driver derived from USB Mouse driver in UDK, which is: -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -*/ - -#string STR_MODULE_ABSTRACT #language en-US "Manages HID mouse and produces Absolute Pointer Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "HID Mouse Driver consumes HID Mouse Protocol and Device Path Protocol, and produces Absolute Pointer Protocol on HID mouse devices.\n" - "This module refers to following specifications:
\n" - "1. Universal Serial Bus HID Firmware Specification, ver 1.11
\n" - "2. UEFI Specification, v2.1
" - +/* @file HidMouseAbsolutePointer.c + HID Mouse Driver that manages HID Mouse device and produces Absolute Pointer Protocol. + + This Mouse Driver consumes the HID Mouse Protocol, and produces + Absolute Pointer Protocol on HID Mouse mouse devices. + + It manages the HID mouse device via the HID mouse protocol abstraction, + and parses the data according to USB HID Specification. + This module refers to following specifications: + 1. Universal Serial Bus HID Firmware Specification, ver 1.11 + 2. UEFI Specification, v2.1 + + Copyright (c) Microsoft Corporation. + + Most of this driver derived from USB Mouse driver in UDK, which is: +// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +*/ + +#string STR_MODULE_ABSTRACT #language en-US "Manages HID mouse and produces Absolute Pointer Protocol" + +#string STR_MODULE_DESCRIPTION #language en-US "HID Mouse Driver consumes HID Mouse Protocol and Device Path Protocol, and produces Absolute Pointer Protocol on HID mouse devices.\n" + "This module refers to following specifications:
\n" + "1. Universal Serial Bus HID Firmware Specification, ver 1.11
\n" + "2. UEFI Specification, v2.1
" + diff --git a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxeExtra.uni b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxeExtra.uni index 6d61358036..b6a32accd5 100644 --- a/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxeExtra.uni +++ b/HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxeExtra.uni @@ -1,24 +1,24 @@ -// @file -// HID Mouse Driver that manages HID mouse and produces Absolute Pointer Protocol. -// -// HID Mouse Driver consumes HID mouse Protocol and produces -// Absolute Pointer Protocol on HID Mouse mouse devices. -// -// It manages the HID mouse device via the HID mouse protocol abstraction, -// and parses the data according to USB HID Specification. -// This module refers to following specifications: -// 1. Universal Serial Bus HID Firmware Specification, ver 1.11 -// 2. UEFI Specification, v2.1 -// -// Copyright (c) Microsoft Corporation. -// -// Most of this driver derived from USB Mouse driver in UDK, which is: -// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// - -#string STR_PROPERTIES_MODULE_NAME -#language en-US -"HID Mouse Pointer DXE Driver" +// @file +// HID Mouse Driver that manages HID mouse and produces Absolute Pointer Protocol. +// +// HID Mouse Driver consumes HID mouse Protocol and produces +// Absolute Pointer Protocol on HID Mouse mouse devices. +// +// It manages the HID mouse device via the HID mouse protocol abstraction, +// and parses the data according to USB HID Specification. +// This module refers to following specifications: +// 1. Universal Serial Bus HID Firmware Specification, ver 1.11 +// 2. UEFI Specification, v2.1 +// +// Copyright (c) Microsoft Corporation. +// +// Most of this driver derived from USB Mouse driver in UDK, which is: +// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"HID Mouse Pointer DXE Driver" diff --git a/HidPkg/HidPkg.ci.yaml b/HidPkg/HidPkg.ci.yaml index 5d49ba23e7..a3588e2ebe 100644 --- a/HidPkg/HidPkg.ci.yaml +++ b/HidPkg/HidPkg.ci.yaml @@ -1,73 +1,73 @@ -## -# CI configuration for HidPkg -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -{ - ## options defined ci/Plugin/CompilerPlugin - "CompilerPlugin": { - "DscPath": "HidPkg.dsc" - }, - - ## options defined ci/Plugin/CharEncodingCheck - "CharEncodingCheck": { - "IgnoreFiles": [] - }, - - ## options defined ci/Plugin/DependencyCheck - "DependencyCheck": { - "AcceptableDependencies": [ - "MdePkg/MdePkg.dec", - "MdeModulePkg/MdeModulePkg.dec", - "HidPkg/HidPkg.dec" - ], - "AcceptableDependencies-HOST_APPLICATION":[ # for host based unit tests - "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" - ], - "IgnoreInf": [] - }, - - ## options defined ci/Plugin/DscCompleteCheck - "DscCompleteCheck": { - "IgnoreInf": [], - "DscPath": "HidPkg.dsc" - }, - ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin - "HostUnitTestCompilerPlugin": { - "DscPath": "UnitTests/HidPkgHostTest.dsc" - }, - - ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck - "HostUnitTestDscCompleteCheck": { - "IgnoreInf": [], - "DscPath": "UnitTests/HidPkgHostTest.dsc" - }, - - ## options defined ci/Plugin/GuidCheck - "GuidCheck": { - "IgnoreGuidName": [], - "IgnoreGuidValue": [], - "IgnoreFoldersAndFiles": [], - "IgnoreDuplicates": [] - }, - - ## options defined ci/Plugin/LibraryClassCheck - "LibraryClassCheck": { - "IgnoreLibraryClass": [], - "IgnoreHeaderFile": [] - }, - - ## options defined ci/Plugin/SpellCheck - "SpellCheck": { - # Fails test but run in AuditOnly mode to collect log - "AuditOnly": false, - "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore - ], - "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files - ], - "ExtendWords": [ # words to extend to the dictionary for this package - ], - "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) - } +## +# CI configuration for HidPkg +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + ## options defined ci/Plugin/CompilerPlugin + "CompilerPlugin": { + "DscPath": "HidPkg.dsc" + }, + + ## options defined ci/Plugin/CharEncodingCheck + "CharEncodingCheck": { + "IgnoreFiles": [] + }, + + ## options defined ci/Plugin/DependencyCheck + "DependencyCheck": { + "AcceptableDependencies": [ + "MdePkg/MdePkg.dec", + "MdeModulePkg/MdeModulePkg.dec", + "HidPkg/HidPkg.dec" + ], + "AcceptableDependencies-HOST_APPLICATION":[ # for host based unit tests + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" + ], + "IgnoreInf": [] + }, + + ## options defined ci/Plugin/DscCompleteCheck + "DscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "HidPkg.dsc" + }, + ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin + "HostUnitTestCompilerPlugin": { + "DscPath": "UnitTests/HidPkgHostTest.dsc" + }, + + ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck + "HostUnitTestDscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "UnitTests/HidPkgHostTest.dsc" + }, + + ## options defined ci/Plugin/GuidCheck + "GuidCheck": { + "IgnoreGuidName": [], + "IgnoreGuidValue": [], + "IgnoreFoldersAndFiles": [], + "IgnoreDuplicates": [] + }, + + ## options defined ci/Plugin/LibraryClassCheck + "LibraryClassCheck": { + "IgnoreLibraryClass": [], + "IgnoreHeaderFile": [] + }, + + ## options defined ci/Plugin/SpellCheck + "SpellCheck": { + # Fails test but run in AuditOnly mode to collect log + "AuditOnly": false, + "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore + ], + "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files + ], + "ExtendWords": [ # words to extend to the dictionary for this package + ], + "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) + } } \ No newline at end of file diff --git a/HidPkg/HidPkg.dec b/HidPkg/HidPkg.dec index 27232e47b6..0f0f5705f3 100644 --- a/HidPkg/HidPkg.dec +++ b/HidPkg/HidPkg.dec @@ -1,41 +1,41 @@ -## @file HidPkg.dec -# -# This package provides HID related drivers and interface definitions. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -## - -[Defines] - DEC_SPECIFICATION = 1.27 - PACKAGE_NAME = HidPkg - PACKAGE_GUID = 0DFB0FF4-C523-4B5C-8224-22B46736CE78 - PACKAGE_VERSION = 1.00 - -[Includes] - Include - -[Protocols] - ## HidKeyboard Protocol - Interface between keyboard hardware and keyboard HID processing layer. - # - gHidKeyboardProtocolGuid = { 0x540937ca, 0xcac9, 0x4d5c, { 0x83, 0xa9, 0xa8, 0x08, 0x45, 0x79, 0x40, 0xaf }} - - ## HidPointer Protocol - Interface between pointer hardware and pointer HID processing layer. - # - gHidPointerProtocolGuid = { 0x80b5ee6e, 0xcbd8, 0x43ae, { 0xb6, 0xac, 0x10, 0x91, 0x7b, 0x25, 0x35, 0xb7 }} - -[Guids] - gHidPkgTokenSpaceGuid = {0x347d3cd6, 0xdf7d, 0x4397, {0xa3, 0x7a, 0x4c, 0x0f, 0x46, 0xdb, 0xdb, 0xff}} - - ## Include/Guid/HidKeyBoardLayout.h - gHidKeyboardLayoutPackageGuid = {0x57adcfa9, 0xc08a, 0x40b9, {0x86, 0x87, 0x65, 0xe2, 0xec, 0xe0, 0xe5, 0xe1}} - gHidKeyboardLayoutKeyGuid = {0xdcafaba8, 0xcde5, 0x40a1, {0x9a, 0xd3, 0x48, 0x76, 0x44, 0x71, 0x7e, 0x47}} - -[PcdsFeatureFlag] - ## Indicates if HID KeyBoard Driver disables the default keyboard layout. - # The default keyboard layout serves as the backup when no keyboard layout can be retrieved - # from HII database.

- # TRUE - HID KeyBoard Driver will disable the default keyboard layout.
- # FALSE - HID KeyBoard Driver will not disable the default keyboard layout.
- # @Prompt Disable default keyboard layout in HID KeyBoard Driver. - gHidPkgTokenSpaceGuid.PcdDisableDefaultKeyboardLayoutInHidKbDriver|FALSE|BOOLEAN|0x00010200 +## @file HidPkg.dec +# +# This package provides HID related drivers and interface definitions. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +## + +[Defines] + DEC_SPECIFICATION = 1.27 + PACKAGE_NAME = HidPkg + PACKAGE_GUID = 0DFB0FF4-C523-4B5C-8224-22B46736CE78 + PACKAGE_VERSION = 1.00 + +[Includes] + Include + +[Protocols] + ## HidKeyboard Protocol - Interface between keyboard hardware and keyboard HID processing layer. + # + gHidKeyboardProtocolGuid = { 0x540937ca, 0xcac9, 0x4d5c, { 0x83, 0xa9, 0xa8, 0x08, 0x45, 0x79, 0x40, 0xaf }} + + ## HidPointer Protocol - Interface between pointer hardware and pointer HID processing layer. + # + gHidPointerProtocolGuid = { 0x80b5ee6e, 0xcbd8, 0x43ae, { 0xb6, 0xac, 0x10, 0x91, 0x7b, 0x25, 0x35, 0xb7 }} + +[Guids] + gHidPkgTokenSpaceGuid = {0x347d3cd6, 0xdf7d, 0x4397, {0xa3, 0x7a, 0x4c, 0x0f, 0x46, 0xdb, 0xdb, 0xff}} + + ## Include/Guid/HidKeyBoardLayout.h + gHidKeyboardLayoutPackageGuid = {0x57adcfa9, 0xc08a, 0x40b9, {0x86, 0x87, 0x65, 0xe2, 0xec, 0xe0, 0xe5, 0xe1}} + gHidKeyboardLayoutKeyGuid = {0xdcafaba8, 0xcde5, 0x40a1, {0x9a, 0xd3, 0x48, 0x76, 0x44, 0x71, 0x7e, 0x47}} + +[PcdsFeatureFlag] + ## Indicates if HID KeyBoard Driver disables the default keyboard layout. + # The default keyboard layout serves as the backup when no keyboard layout can be retrieved + # from HII database.

+ # TRUE - HID KeyBoard Driver will disable the default keyboard layout.
+ # FALSE - HID KeyBoard Driver will not disable the default keyboard layout.
+ # @Prompt Disable default keyboard layout in HID KeyBoard Driver. + gHidPkgTokenSpaceGuid.PcdDisableDefaultKeyboardLayoutInHidKbDriver|FALSE|BOOLEAN|0x00010200 diff --git a/HidPkg/HidPkg.dsc b/HidPkg/HidPkg.dsc index 80019946e3..5eceb74514 100644 --- a/HidPkg/HidPkg.dsc +++ b/HidPkg/HidPkg.dsc @@ -1,50 +1,50 @@ -## @file HidPkg.dsc -# HidPkg DSC file -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - PLATFORM_NAME = HidPkg - PLATFORM_GUID = D0C06044-28C7-4525-AA59-A6CE9001F571 - PLATFORM_VERSION = 1.0 - DSC_SPECIFICATION = 1.28 - OUTPUT_DIRECTORY = Build/HidPkg - SUPPORTED_ARCHITECTURES = IA32|X64|AARCH64 - BUILD_TARGETS = DEBUG|RELEASE - SKUID_IDENTIFIER = DEFAULT - -[PcdsFeatureFlag] - -[PcdsFixedAtBuild] - -!include MdePkg/MdeLibs.dsc.inc - -[LibraryClasses.common] - BaseLib |MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib |MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - DebugLib |MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf - DevicePathLib |MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - MemoryAllocationLib |MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf - PcdLib |MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - PrintLib |MdePkg/Library/BasePrintLib/BasePrintLib.inf - ReportStatusCodeLib |MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf - UefiBootServicesTableLib |MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - UefiDriverEntryPoint |MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf - UefiLib |MdePkg/Library/UefiLib/UefiLib.inf - UefiRuntimeServicesTableLib |MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf - UefiUsbLib |MdePkg/Library/UefiUsbLib/UefiUsbLib.inf - - HiiLib |MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf - UefiHiiServicesLib |MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf - -[Components.X64] - HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf - HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf - HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf - HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf - -[BuildOptions] -#force deprecated interfaces off - *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES +## @file HidPkg.dsc +# HidPkg DSC file +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + PLATFORM_NAME = HidPkg + PLATFORM_GUID = D0C06044-28C7-4525-AA59-A6CE9001F571 + PLATFORM_VERSION = 1.0 + DSC_SPECIFICATION = 1.28 + OUTPUT_DIRECTORY = Build/HidPkg + SUPPORTED_ARCHITECTURES = IA32|X64|AARCH64 + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild] + +!include MdePkg/MdeLibs.dsc.inc + +[LibraryClasses.common] + BaseLib |MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib |MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + DebugLib |MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + DevicePathLib |MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + MemoryAllocationLib |MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + PcdLib |MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PrintLib |MdePkg/Library/BasePrintLib/BasePrintLib.inf + ReportStatusCodeLib |MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf + UefiBootServicesTableLib |MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiDriverEntryPoint |MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiLib |MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeServicesTableLib |MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + UefiUsbLib |MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + + HiiLib |MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib |MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + +[Components.X64] + HidPkg/HidKeyboardDxe/HidKeyboardDxe.inf + HidPkg/HidMouseAbsolutePointerDxe/HidMouseAbsolutePointerDxe.inf + HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf + HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf + +[BuildOptions] +#force deprecated interfaces off + *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf b/HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf index 688c5ec36c..fbc64e7983 100644 --- a/HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf +++ b/HidPkg/UsbKbHidDxe/UsbKbHidDxe.inf @@ -1,55 +1,55 @@ -## @file -# USB HID Keyboard Driver that manages USB keyboard and produces HID Keyboard Protocol. -# -# USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces -# HID Keyboard Protocol on USB keyboard devices. -# This module refers to following specifications: -# 1. Universal Serial Bus HID Firmware Specification, ver 1.11 -# 2. Universal Serial Bus HID Usage Tables, ver 1.12 -# 3. UEFI Specification, v2.1 -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# Portions derived from MdeModulePkg\Bus\Usb\UsbKbDxe which is: -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = UsbKbHidDxe - MODULE_UNI_FILE = UsbKbHidDxe.uni - FILE_GUID = 60291E5A-334E-4181-B506-8280BA6696F2 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = UsbKbHidDriverBindingEntryPoint - -[Sources] - UsbKbHidDxe.c - UsbKbHidDxe.h - ComponentName.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - HidPkg/HidPkg.dec - -[LibraryClasses] - BaseMemoryLib - DebugLib - MemoryAllocationLib - PcdLib - ReportStatusCodeLib - UefiLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiUsbLib - -[Protocols] - gEfiUsbIoProtocolGuid - gEfiDevicePathProtocolGuid - gHidKeyboardProtocolGuid - -[UserExtensions.TianoCore."ExtraFiles"] - UsbHidKbDxeExtra.uni +## @file +# USB HID Keyboard Driver that manages USB keyboard and produces HID Keyboard Protocol. +# +# USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces +# HID Keyboard Protocol on USB keyboard devices. +# This module refers to following specifications: +# 1. Universal Serial Bus HID Firmware Specification, ver 1.11 +# 2. Universal Serial Bus HID Usage Tables, ver 1.12 +# 3. UEFI Specification, v2.1 +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# Portions derived from MdeModulePkg\Bus\Usb\UsbKbDxe which is: +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = UsbKbHidDxe + MODULE_UNI_FILE = UsbKbHidDxe.uni + FILE_GUID = 60291E5A-334E-4181-B506-8280BA6696F2 + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = UsbKbHidDriverBindingEntryPoint + +[Sources] + UsbKbHidDxe.c + UsbKbHidDxe.h + ComponentName.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + HidPkg/HidPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MemoryAllocationLib + PcdLib + ReportStatusCodeLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiUsbLib + +[Protocols] + gEfiUsbIoProtocolGuid + gEfiDevicePathProtocolGuid + gHidKeyboardProtocolGuid + +[UserExtensions.TianoCore."ExtraFiles"] + UsbHidKbDxeExtra.uni diff --git a/HidPkg/UsbKbHidDxe/UsbKbHidDxe.uni b/HidPkg/UsbKbHidDxe/UsbKbHidDxe.uni index f4c25801a2..5bd2715320 100644 --- a/HidPkg/UsbKbHidDxe/UsbKbHidDxe.uni +++ b/HidPkg/UsbKbHidDxe/UsbKbHidDxe.uni @@ -1,25 +1,25 @@ -/* @file UsbKbHidDxe.uni - * USB HID Keyboard Driver that manages USB keyboard and produces HID Keyboard Protocol. - * - * USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces - * HID Keyboard Protocol on USB keyboard devices. - * This module refers to following specifications: - * 1. Universal Serial Bus HID Firmware Specification, ver 1.11 - * 2. Universal Serial Bus HID Usage Tables, ver 1.12 - * 3. UEFI Specification, v2.1 - * - * Copyright (C) Microsoft Corporation. All rights reserved. - * Portions derived from MdeModulePkg\Bus\Usb\UsbKbDxe which is: - * Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- * - * SPDX-License-Identifier: BSD-2-Clause-Patent - */ - -#string STR_MODULE_ABSTRACT #language en-US "Manages USB keyboard and produces HID Keyboard Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces HID Keyboard Protocol on USB keyboard devices.\n" - "This module refers to following specifications:
\n" - "1. Universal Serial Bus HID Firmware Specification, ver 1.11
\n" - "2. Universal Serial Bus HID Usage Tables, ver 1.12
\n" - "3. UEFI Specification, v2.1
" - +/* @file UsbKbHidDxe.uni + * USB HID Keyboard Driver that manages USB keyboard and produces HID Keyboard Protocol. + * + * USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces + * HID Keyboard Protocol on USB keyboard devices. + * This module refers to following specifications: + * 1. Universal Serial Bus HID Firmware Specification, ver 1.11 + * 2. Universal Serial Bus HID Usage Tables, ver 1.12 + * 3. UEFI Specification, v2.1 + * + * Copyright (C) Microsoft Corporation. All rights reserved. + * Portions derived from MdeModulePkg\Bus\Usb\UsbKbDxe which is: + * Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ * + * SPDX-License-Identifier: BSD-2-Clause-Patent + */ + +#string STR_MODULE_ABSTRACT #language en-US "Manages USB keyboard and produces HID Keyboard Protocol" + +#string STR_MODULE_DESCRIPTION #language en-US "USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces HID Keyboard Protocol on USB keyboard devices.\n" + "This module refers to following specifications:
\n" + "1. Universal Serial Bus HID Firmware Specification, ver 1.11
\n" + "2. Universal Serial Bus HID Usage Tables, ver 1.12
\n" + "3. UEFI Specification, v2.1
" + diff --git a/HidPkg/UsbKbHidDxe/UsbKbHidDxeExtra.uni b/HidPkg/UsbKbHidDxe/UsbKbHidDxeExtra.uni index aeb68a5040..1d942de3d4 100644 --- a/HidPkg/UsbKbHidDxe/UsbKbHidDxeExtra.uni +++ b/HidPkg/UsbKbHidDxe/UsbKbHidDxeExtra.uni @@ -1,22 +1,22 @@ -/* @file UsbKbHidDxeExtra.uni - * USB HID Keyboard Driver that manages USB keyboard and produces HID Keyboard Protocol. - * - * USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces - * HID Keyboard Protocol on USB keyboard devices. - * This module refers to following specifications: - * 1. Universal Serial Bus HID Firmware Specification, ver 1.11 - * 2. Universal Serial Bus HID Usage Tables, ver 1.12 - * 3. UEFI Specification, v2.1 - * - * Copyright (C) Microsoft Corporation. All rights reserved. - * Portions derived from MdeModulePkg\Bus\Usb\UsbKbDxe which is: - * Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- * - * SPDX-License-Identifier: BSD-2-Clause-Patent - */ - -#string STR_PROPERTIES_MODULE_NAME -#language en-US -"USB HID Keyboard DXE Driver" - - +/* @file UsbKbHidDxeExtra.uni + * USB HID Keyboard Driver that manages USB keyboard and produces HID Keyboard Protocol. + * + * USB Keyboard Driver consumes USB I/O Protocol and Device Path Protocol, and produces + * HID Keyboard Protocol on USB keyboard devices. + * This module refers to following specifications: + * 1. Universal Serial Bus HID Firmware Specification, ver 1.11 + * 2. Universal Serial Bus HID Usage Tables, ver 1.12 + * 3. UEFI Specification, v2.1 + * + * Copyright (C) Microsoft Corporation. All rights reserved. + * Portions derived from MdeModulePkg\Bus\Usb\UsbKbDxe which is: + * Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ * + * SPDX-License-Identifier: BSD-2-Clause-Patent + */ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"USB HID Keyboard DXE Driver" + + diff --git a/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf b/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf index cdaf492972..469103f227 100644 --- a/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf +++ b/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.inf @@ -1,53 +1,53 @@ -## @file UsbMouseHidDxe.inf -# USB Mouse Driver that manages USB mouse and produces HID Mouse Protocol. -# -# USB Mouse Driver consumes USB I/O Protocol and Device Path Protocol, and produces -# HID Mouse Protocol on USB mouse devices. -# It manages the USB mouse device via Asynchronous Interrupt Transfer of USB I/O Protocol, -# and parses the data according to USB HID Specification. -# This module refers to following specifications: -# 1. Universal Serial Bus HID Firmware Specification, ver 1.11 -# 2. UEFI Specification, v2.1 -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# Derived from MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe, which is: -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = UsbMouseHidDxe - MODULE_UNI_FILE = UsbMouseHidDxe.uni - FILE_GUID = 7E45AA7D-05B5-4C25-B623-7E3EE049DEBB - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = UsbMouseHidDriverBindingEntryPoint - -[Sources] - ComponentName.c - UsbMouseHid.c - UsbMouseHid.h - -[Packages] - MdePkg/MdePkg.dec - HidPkg/HidPkg.dec - -[LibraryClasses] - MemoryAllocationLib - UefiLib - UefiBootServicesTableLib - UefiDriverEntryPoint - BaseMemoryLib - ReportStatusCodeLib - UefiUsbLib - -[Protocols] - gEfiUsbIoProtocolGuid - gEfiDevicePathProtocolGuid - gHidPointerProtocolGuid - -[UserExtensions.TianoCore."ExtraFiles"] - UsbMouseHidDxeExtra.uni +## @file UsbMouseHidDxe.inf +# USB Mouse Driver that manages USB mouse and produces HID Mouse Protocol. +# +# USB Mouse Driver consumes USB I/O Protocol and Device Path Protocol, and produces +# HID Mouse Protocol on USB mouse devices. +# It manages the USB mouse device via Asynchronous Interrupt Transfer of USB I/O Protocol, +# and parses the data according to USB HID Specification. +# This module refers to following specifications: +# 1. Universal Serial Bus HID Firmware Specification, ver 1.11 +# 2. UEFI Specification, v2.1 +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# Derived from MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe, which is: +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = UsbMouseHidDxe + MODULE_UNI_FILE = UsbMouseHidDxe.uni + FILE_GUID = 7E45AA7D-05B5-4C25-B623-7E3EE049DEBB + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = UsbMouseHidDriverBindingEntryPoint + +[Sources] + ComponentName.c + UsbMouseHid.c + UsbMouseHid.h + +[Packages] + MdePkg/MdePkg.dec + HidPkg/HidPkg.dec + +[LibraryClasses] + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + BaseMemoryLib + ReportStatusCodeLib + UefiUsbLib + +[Protocols] + gEfiUsbIoProtocolGuid + gEfiDevicePathProtocolGuid + gHidPointerProtocolGuid + +[UserExtensions.TianoCore."ExtraFiles"] + UsbMouseHidDxeExtra.uni diff --git a/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.uni b/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.uni index 79ffa07e6c..df69f11f88 100644 --- a/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.uni +++ b/HidPkg/UsbMouseHidDxe/UsbMouseHidDxe.uni @@ -1,26 +1,26 @@ -// @file ComponentName.c -// USB Mouse Driver that manages USB mouse and produces HID Mouse Protocol. -// -// USB Mouse Driver consumes USB I/O Protocol and Device Path Protocol, and produces -// HID Mouse Protocol on USB mouse devices. -// It manages the USB mouse device via Asynchronous Interrupt Transfer of USB I/O Protocol, -// and parses the data according to USB HID Specification. -// This module refers to following specifications: -// 1. Universal Serial Bus HID Firmware Specification, ver 1.11 -// 2. UEFI Specification, v2.1 -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// Derived from MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe, which is: -// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// - - -#string STR_MODULE_ABSTRACT #language en-US "Manages USB mouse and produces HID Pointer Protocol" - -#string STR_MODULE_DESCRIPTION #language en-US "USB Mouse Driver consumes USB I/O Protocol and Device Path Protocol, and produces HID Mouse Protocol on USB mouse devices.
\n" - "This module refers to following specifications:
\n" - "1. Universal Serial Bus HID Firmware Specification, ver 1.11
\n" - "2. UEFI Specification, v2.1
" - +// @file ComponentName.c +// USB Mouse Driver that manages USB mouse and produces HID Mouse Protocol. +// +// USB Mouse Driver consumes USB I/O Protocol and Device Path Protocol, and produces +// HID Mouse Protocol on USB mouse devices. +// It manages the USB mouse device via Asynchronous Interrupt Transfer of USB I/O Protocol, +// and parses the data according to USB HID Specification. +// This module refers to following specifications: +// 1. Universal Serial Bus HID Firmware Specification, ver 1.11 +// 2. UEFI Specification, v2.1 +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// Derived from MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe, which is: +// Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + + +#string STR_MODULE_ABSTRACT #language en-US "Manages USB mouse and produces HID Pointer Protocol" + +#string STR_MODULE_DESCRIPTION #language en-US "USB Mouse Driver consumes USB I/O Protocol and Device Path Protocol, and produces HID Mouse Protocol on USB mouse devices.
\n" + "This module refers to following specifications:
\n" + "1. Universal Serial Bus HID Firmware Specification, ver 1.11
\n" + "2. UEFI Specification, v2.1
" + diff --git a/HidPkg/UsbMouseHidDxe/UsbMouseHidDxeExtra.uni b/HidPkg/UsbMouseHidDxe/UsbMouseHidDxeExtra.uni index 67ee7021aa..2a55422783 100644 --- a/HidPkg/UsbMouseHidDxe/UsbMouseHidDxeExtra.uni +++ b/HidPkg/UsbMouseHidDxe/UsbMouseHidDxeExtra.uni @@ -1,16 +1,16 @@ -// /** @file UsbMouseHidDxeExtra.uni -// UsbMouseHidDxe Localized Strings and Content -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// Derived from MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe -// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - -#string STR_PROPERTIES_MODULE_NAME -#language en-US -"USB HID Pointer DXE Driver" - - +// /** @file UsbMouseHidDxeExtra.uni +// UsbMouseHidDxe Localized Strings and Content +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// Derived from MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe +// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"USB HID Pointer DXE Driver" + + diff --git a/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.inf b/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.inf index 8c49c46456..75ca4fac5c 100644 --- a/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.inf +++ b/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.inf @@ -1,42 +1,42 @@ -## @file -# MfciDeviceIdSupportLibNull.inf -# -# NULL Library for MfciDeviceIdSupportLib. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciDeviceIdSupportLibNull - FILE_GUID = acbd64dc-e9e0-424a-85a6-1ca642b89e61 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MfciDeviceIdSupportLib|DXE_DRIVER UEFI_APPLICATION - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = ANY -# - -[Sources] - MfciDeviceIdSupportLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - UefiLib - MemoryAllocationLib - -[Guids] - -[Depex] +## @file +# MfciDeviceIdSupportLibNull.inf +# +# NULL Library for MfciDeviceIdSupportLib. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciDeviceIdSupportLibNull + FILE_GUID = acbd64dc-e9e0-424a-85a6-1ca642b89e61 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MfciDeviceIdSupportLib|DXE_DRIVER UEFI_APPLICATION + + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ANY +# + +[Sources] + MfciDeviceIdSupportLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + UefiLib + MemoryAllocationLib + +[Guids] + +[Depex] diff --git a/MfciPkg/Library/MfciDeviceIdSupportLibNull/ReadMe.md b/MfciPkg/Library/MfciDeviceIdSupportLibNull/ReadMe.md index b8db9450ab..f8adde0221 100644 --- a/MfciPkg/Library/MfciDeviceIdSupportLibNull/ReadMe.md +++ b/MfciPkg/Library/MfciDeviceIdSupportLibNull/ReadMe.md @@ -1,14 +1,14 @@ -# MFCI Device ID Support Library: NULL interface - -## About - -Platforms MUST publish MFCI targeting information prior to EndOfDxe. They may do so by either setting all of the Per-Device -Targeting Variables declared in `MfciVariables.h`. Alternatively, then can implement this library. -MfciDxe will invoke this library if it cannot find variables just before EndOfDxe. - -Refer to `MfciPkg/Include/MfciVariables.h`, "Targeting Variable Names" for additional details on the strings to return. - -## Copyright - -Copyright (c) Microsoft Corporation -SPDX-License-Identifier: BSD-2-Clause-Patent +# MFCI Device ID Support Library: NULL interface + +## About + +Platforms MUST publish MFCI targeting information prior to EndOfDxe. They may do so by either setting all of the Per-Device +Targeting Variables declared in `MfciVariables.h`. Alternatively, then can implement this library. +MfciDxe will invoke this library if it cannot find variables just before EndOfDxe. + +Refer to `MfciPkg/Include/MfciVariables.h`, "Targeting Variable Names" for additional details on the strings to return. + +## Copyright + +Copyright (c) Microsoft Corporation +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.inf b/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.inf index eb901ec7ca..ada4fd0ee1 100644 --- a/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.inf +++ b/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.inf @@ -1,49 +1,49 @@ -## @file -# Implementation sample for MfciDeviceIdSupportLib -# Returns device IDs read from SMBIOS -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MfciDeviceIdSupportLibSmbios - FILE_GUID = 45500855-C967-4BEB-A9D1-C604B08AB303 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MfciDeviceIdSupportLib|DXE_DRIVER UEFI_APPLICATION - CONSTRUCTOR = MfciIdSupportConstructor - - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = ANY -# - -[Sources] - MfciDeviceIdSupportLibSmbios.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - UefiLib - MemoryAllocationLib - UefiBootServicesTableLib - BaseMemoryLib - -[Protocols] - gEfiSmbiosProtocolGuid ## CONSUMES - -[Guids] - -[Pcd] - -[Depex] +## @file +# Implementation sample for MfciDeviceIdSupportLib +# Returns device IDs read from SMBIOS +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MfciDeviceIdSupportLibSmbios + FILE_GUID = 45500855-C967-4BEB-A9D1-C604B08AB303 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MfciDeviceIdSupportLib|DXE_DRIVER UEFI_APPLICATION + CONSTRUCTOR = MfciIdSupportConstructor + + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ANY +# + +[Sources] + MfciDeviceIdSupportLibSmbios.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + UefiLib + MemoryAllocationLib + UefiBootServicesTableLib + BaseMemoryLib + +[Protocols] + gEfiSmbiosProtocolGuid ## CONSUMES + +[Guids] + +[Pcd] + +[Depex] gEfiSmbiosProtocolGuid \ No newline at end of file diff --git a/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/ReadMe.md b/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/ReadMe.md index f2517637ea..3ed8904318 100644 --- a/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/ReadMe.md +++ b/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/ReadMe.md @@ -1,29 +1,29 @@ -# MFCI Device ID Support Library: SMBIOS instance example - -## Background - -MFCI-compatible platforms MUST publish MFCI targeting information prior to EndOfDxe. They may do so by either setting -all of the Per-Device Targeting Variables declared in `MfciVariables.h`. Alternatively, then can implement an instance -of MFCI Device ID Support Library. - -Refer to ```MfciDeviceIdSupportLib.h``` for this library's interface. - -## About - -This example instance of MfciDeviceIdSupportLib leverages ```EFI_SMBIOS_PROTOCOL``` to implement the library interface. -This library is invoked by MfciDxe in an event that triggers immediately prior to EndOfDxe, and expects all SMBIOS -values leveraged to be populated with correct MFCI targeting values at that time. A platform might accomplish this -by populating SMBIOS values in another driver's entry point, constructor, or in an event upon arrival of -```EFI_SMBIOS_PROTOCOL```. - -To leverage this library, add the following to your platform DSC: - -```ini -[LibraryClasses] -MfciDeviceIdSupportLib|MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.inf -``` - -## Copyright - -Copyright (c) Microsoft Corporation -SPDX-License-Identifier: BSD-2-Clause-Patent +# MFCI Device ID Support Library: SMBIOS instance example + +## Background + +MFCI-compatible platforms MUST publish MFCI targeting information prior to EndOfDxe. They may do so by either setting +all of the Per-Device Targeting Variables declared in `MfciVariables.h`. Alternatively, then can implement an instance +of MFCI Device ID Support Library. + +Refer to ```MfciDeviceIdSupportLib.h``` for this library's interface. + +## About + +This example instance of MfciDeviceIdSupportLib leverages ```EFI_SMBIOS_PROTOCOL``` to implement the library interface. +This library is invoked by MfciDxe in an event that triggers immediately prior to EndOfDxe, and expects all SMBIOS +values leveraged to be populated with correct MFCI targeting values at that time. A platform might accomplish this +by populating SMBIOS values in another driver's entry point, constructor, or in an event upon arrival of +```EFI_SMBIOS_PROTOCOL```. + +To leverage this library, add the following to your platform DSC: + +```ini +[LibraryClasses] +MfciDeviceIdSupportLib|MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.inf +``` + +## Copyright + +Copyright (c) Microsoft Corporation +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MfciPkg/Library/MfciRetrievePolicyLibNull/MfciRetrievePolicyLibNull.inf b/MfciPkg/Library/MfciRetrievePolicyLibNull/MfciRetrievePolicyLibNull.inf index 24dc7d6db6..3503d92fdd 100644 --- a/MfciPkg/Library/MfciRetrievePolicyLibNull/MfciRetrievePolicyLibNull.inf +++ b/MfciPkg/Library/MfciRetrievePolicyLibNull/MfciRetrievePolicyLibNull.inf @@ -1,36 +1,36 @@ -## @file -# NULL library that abstracts retrieving the MFCI policy from the PEI phase -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciRetrievePolicyLibNull - FILE_GUID = 5429aa91-e9ec-4c6e-ad82-97e5f83e3fb7 - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = MfciRetrievePolicyLib | DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - - -[Sources] - MfciRetrievePolicyLibNull.c - - - -[Packages] - MdePkg/MdePkg.dec - MfciPkg/MfciPkg.dec - - -[LibraryClasses] - -[Depex] +## @file +# NULL library that abstracts retrieving the MFCI policy from the PEI phase +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciRetrievePolicyLibNull + FILE_GUID = 5429aa91-e9ec-4c6e-ad82-97e5f83e3fb7 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = MfciRetrievePolicyLib | DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + + +[Sources] + MfciRetrievePolicyLibNull.c + + + +[Packages] + MdePkg/MdePkg.dec + MfciPkg/MfciPkg.dec + + +[LibraryClasses] + +[Depex] diff --git a/MfciPkg/Library/MfciRetrievePolicyLibNull/ReadMe.md b/MfciPkg/Library/MfciRetrievePolicyLibNull/ReadMe.md index 4e6dca3a2a..0e085ea1f4 100644 --- a/MfciPkg/Library/MfciRetrievePolicyLibNull/ReadMe.md +++ b/MfciPkg/Library/MfciRetrievePolicyLibNull/ReadMe.md @@ -1,14 +1,14 @@ -# MfciRetrievePolicyLib: NULL edition - -## About - -Platforms are not generally expected to implement this library, as MFCI carries known implementations, -thus it's header is under MfciPkg/Private/... -This library abstracts where MfciDxe retrieves the cached, current policy. -On platforms with a PEI phase, it may retrieve the policy from a HOB. -On platforms that lack a PEI phase, it may retrieve the policy from a UEFI variable. - -## Copyright - -Copyright (c) Microsoft Corporation -SPDX-License-Identifier: BSD-2-Clause-Patent +# MfciRetrievePolicyLib: NULL edition + +## About + +Platforms are not generally expected to implement this library, as MFCI carries known implementations, +thus it's header is under MfciPkg/Private/... +This library abstracts where MfciDxe retrieves the cached, current policy. +On platforms with a PEI phase, it may retrieve the policy from a HOB. +On platforms that lack a PEI phase, it may retrieve the policy from a UEFI variable. + +## Copyright + +Copyright (c) Microsoft Corporation +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MfciPkg/Library/MfciRetrievePolicyLibViaHob/MfciRetrievePolicyLibViaHob.inf b/MfciPkg/Library/MfciRetrievePolicyLibViaHob/MfciRetrievePolicyLibViaHob.inf index 25f3b6a279..ac1e4c8ffe 100644 --- a/MfciPkg/Library/MfciRetrievePolicyLibViaHob/MfciRetrievePolicyLibViaHob.inf +++ b/MfciPkg/Library/MfciRetrievePolicyLibViaHob/MfciRetrievePolicyLibViaHob.inf @@ -1,40 +1,40 @@ -## @file -# Library that receives the MFCI policy from the PEI phase via HOB -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciRetrievePolicyLibViaHob - FILE_GUID = ea3d551b-4352-4931-b4f0-d42d4425f84c - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = MfciRetrievePolicyLib | DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - - -[Sources] - MfciRetrievePolicyLibViaHob.c - - -[Packages] - MdePkg/MdePkg.dec - MfciPkg/MfciPkg.dec - - -[LibraryClasses] - DebugLib - HobLib - -[Guids] - gMfciHobGuid ## CONSUMES - -[Depex] +## @file +# Library that receives the MFCI policy from the PEI phase via HOB +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciRetrievePolicyLibViaHob + FILE_GUID = ea3d551b-4352-4931-b4f0-d42d4425f84c + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = MfciRetrievePolicyLib | DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + + +[Sources] + MfciRetrievePolicyLibViaHob.c + + +[Packages] + MdePkg/MdePkg.dec + MfciPkg/MfciPkg.dec + + +[LibraryClasses] + DebugLib + HobLib + +[Guids] + gMfciHobGuid ## CONSUMES + +[Depex] diff --git a/MfciPkg/Library/MfciRetrievePolicyLibViaHob/ReadMe.md b/MfciPkg/Library/MfciRetrievePolicyLibViaHob/ReadMe.md index 9598724395..5b470c7452 100644 --- a/MfciPkg/Library/MfciRetrievePolicyLibViaHob/ReadMe.md +++ b/MfciPkg/Library/MfciRetrievePolicyLibViaHob/ReadMe.md @@ -1,10 +1,10 @@ -# MfciRetrievePolicyLib: HOB edition - -## About - -This library implements retrieving the current, cached policy from a HOB. - -## Copyright - -Copyright (c) Microsoft Corporation -SPDX-License-Identifier: BSD-2-Clause-Patent +# MfciRetrievePolicyLib: HOB edition + +## About + +This library implements retrieving the current, cached policy from a HOB. + +## Copyright + +Copyright (c) Microsoft Corporation +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/MfciRetrievePolicyLibViaVariable.inf b/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/MfciRetrievePolicyLibViaVariable.inf index 0e39d4d61f..34e93fe466 100644 --- a/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/MfciRetrievePolicyLibViaVariable.inf +++ b/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/MfciRetrievePolicyLibViaVariable.inf @@ -1,42 +1,42 @@ -## @file -# Library that receives the MFCI policy from the variable store. -# Intended for use on PEI-less, HOB-less systems -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciRetrievePolicyLibViaVariable - FILE_GUID = 3a65ffff-fa4f-4267-87a8-4035ada74395 - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = MfciRetrievePolicyLib | DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - - -[Sources] - MfciRetrievePolicyLibViaVariable.c - - -[Packages] - MdePkg/MdePkg.dec - MfciPkg/MfciPkg.dec - - -[LibraryClasses] - DebugLib - UefiRuntimeServicesTableLib - -[Guids] - gMfciVendorGuid ## CONSUMES - -[Depex] +## @file +# Library that receives the MFCI policy from the variable store. +# Intended for use on PEI-less, HOB-less systems +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciRetrievePolicyLibViaVariable + FILE_GUID = 3a65ffff-fa4f-4267-87a8-4035ada74395 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = MfciRetrievePolicyLib | DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + + +[Sources] + MfciRetrievePolicyLibViaVariable.c + + +[Packages] + MdePkg/MdePkg.dec + MfciPkg/MfciPkg.dec + + +[LibraryClasses] + DebugLib + UefiRuntimeServicesTableLib + +[Guids] + gMfciVendorGuid ## CONSUMES + +[Depex] gEfiVariableArchProtocolGuid \ No newline at end of file diff --git a/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/ReadMe.md b/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/ReadMe.md index b5ead9eed1..7dd6fe96fa 100644 --- a/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/ReadMe.md +++ b/MfciPkg/Library/MfciRetrievePolicyLibViaVariable/ReadMe.md @@ -1,10 +1,10 @@ -# MfciRetrievePolicyLib: UEFI variable edition - -## About - -This library implements retrieving the current, cached policy from a UEFI variable. - -## Copyright - -Copyright (c) Microsoft Corporation -SPDX-License-Identifier: BSD-2-Clause-Patent +# MfciRetrievePolicyLib: UEFI variable edition + +## About + +This library implements retrieving the current, cached policy from a UEFI variable. + +## Copyright + +Copyright (c) Microsoft Corporation +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MfciPkg/Library/MfciRetrieveTargetPolicyLibPcd/MfciRetrieveTargetPolicyLibPcd.inf b/MfciPkg/Library/MfciRetrieveTargetPolicyLibPcd/MfciRetrieveTargetPolicyLibPcd.inf index 72daae981f..783c5e7c8b 100644 --- a/MfciPkg/Library/MfciRetrieveTargetPolicyLibPcd/MfciRetrieveTargetPolicyLibPcd.inf +++ b/MfciPkg/Library/MfciRetrieveTargetPolicyLibPcd/MfciRetrieveTargetPolicyLibPcd.inf @@ -1,35 +1,35 @@ -## @file -# PCD based instance to supply the target policy consumed -# by MFCI policy modules. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MfciRetrieveTargetPolicyLibPcd - FILE_GUID = 77AC6C18-A803-410D-BC55-626050BD253D - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MfciRetrieveTargetPolicyLib -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64 -# - -[Sources] - MfciRetrieveTargetPolicyLibPcd.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - -[LibraryClasses] - DebugLib - PcdLib - -[Pcd] - gMfciPkgTokenSpaceGuid.SystemCapabilities ## CONSUMES +## @file +# PCD based instance to supply the target policy consumed +# by MFCI policy modules. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MfciRetrieveTargetPolicyLibPcd + FILE_GUID = 77AC6C18-A803-410D-BC55-626050BD253D + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MfciRetrieveTargetPolicyLib +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64 +# + +[Sources] + MfciRetrieveTargetPolicyLibPcd.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + +[LibraryClasses] + DebugLib + PcdLib + +[Pcd] + gMfciPkgTokenSpaceGuid.SystemCapabilities ## CONSUMES diff --git a/MfciPkg/MfciDxe/MfciDxe.inf b/MfciPkg/MfciDxe/MfciDxe.inf index a9da13f95c..f3bc91654e 100644 --- a/MfciPkg/MfciDxe/MfciDxe.inf +++ b/MfciPkg/MfciDxe/MfciDxe.inf @@ -1,78 +1,78 @@ -## @file -# DXE Driver for determining the MFCI Policy in-effect and changes -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciDxe - FILE_GUID = D4ABC208-E91F-4A5C-880B-7063A0393E4C - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MfciDxeEntry - - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciDxe.c - MfciPublicInterface.c - MfciDxe.h - MfciTargeting.c - SecureBootClear.c - TpmClear.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - PcBdsPkg/PcBdsPkg.dec - MfciPkg/MfciPkg.dec - SecurityPkg/SecurityPkg.dec - - -[LibraryClasses] - DebugLib - BaseLib - UefiDriverEntryPoint - ResetUtilityLib - BaseMemoryLib - MemoryAllocationLib - MfciPolicyParsingLib - VariablePolicyHelperLib - RngLib - Tpm2CommandLib - SecureBootVariableLib - MfciRetrievePolicyLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - MfciDeviceIdSupportLib - - -[Protocols] - gMfciProtocolGuid ## CONSUMES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - -[Protocols.common.Private] - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Pcd] - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdEnforceWindowsPcr11PrivacyPolicy ## CONSUMES - -[Guids] - gMfciVendorGuid ## CONSUMES - gMsStartOfBdsNotifyGuid ## CONSUMES - gEfiEndOfDxeEventGroupGuid ## CONSUMES - gMuVarPolicyDxePhaseGuid ## CONSUMES - gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace - gMfciPolicyChangeResetGuid ## CONSUMES - -[Depex] - gEdkiiVariablePolicyProtocolGuid +## @file +# DXE Driver for determining the MFCI Policy in-effect and changes +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciDxe + FILE_GUID = D4ABC208-E91F-4A5C-880B-7063A0393E4C + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MfciDxeEntry + + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciDxe.c + MfciPublicInterface.c + MfciDxe.h + MfciTargeting.c + SecureBootClear.c + TpmClear.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + PcBdsPkg/PcBdsPkg.dec + MfciPkg/MfciPkg.dec + SecurityPkg/SecurityPkg.dec + + +[LibraryClasses] + DebugLib + BaseLib + UefiDriverEntryPoint + ResetUtilityLib + BaseMemoryLib + MemoryAllocationLib + MfciPolicyParsingLib + VariablePolicyHelperLib + RngLib + Tpm2CommandLib + SecureBootVariableLib + MfciRetrievePolicyLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + MfciDeviceIdSupportLib + + +[Protocols] + gMfciProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + +[Protocols.common.Private] + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Pcd] + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdEnforceWindowsPcr11PrivacyPolicy ## CONSUMES + +[Guids] + gMfciVendorGuid ## CONSUMES + gMsStartOfBdsNotifyGuid ## CONSUMES + gEfiEndOfDxeEventGroupGuid ## CONSUMES + gMuVarPolicyDxePhaseGuid ## CONSUMES + gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace + gMfciPolicyChangeResetGuid ## CONSUMES + +[Depex] + gEdkiiVariablePolicyProtocolGuid diff --git a/MfciPkg/MfciDxe/MfciDxeRoT.inf b/MfciPkg/MfciDxe/MfciDxeRoT.inf index 49c28371f7..b6d51c45e2 100644 --- a/MfciPkg/MfciDxe/MfciDxeRoT.inf +++ b/MfciPkg/MfciDxe/MfciDxeRoT.inf @@ -1,65 +1,65 @@ -## @file -# DXE Driver for determining the MFCI Policy in-effect and changes based on -# Target policy indicated by system Root of Trust. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciDxeRootOfTrust - FILE_GUID = 90C72774-85AA-4AD9-B689-03328B4E11ED - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MfciDxeRootOfTrustEntry - - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciDxeRoT.c - MfciDxe.h - MfciPublicInterface.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - PcBdsPkg/PcBdsPkg.dec - MfciPkg/MfciPkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - HobLib - UefiDriverEntryPoint - ResetUtilityLib - BaseMemoryLib - MemoryAllocationLib - VariablePolicyHelperLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - MfciRetrievePolicyLib - MfciRetrieveTargetPolicyLib - MuTelemetryHelperLib - -[Protocols] - gMfciProtocolGuid ## PRODUCES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Guids] - gMfciHobGuid ## CONSUMES - gMfciVendorGuid ## CONSUMES - gMsStartOfBdsNotifyGuid ## CONSUMES - gEfiEndOfDxeEventGroupGuid ## CONSUMES - gMuVarPolicyDxePhaseGuid ## CONSUMES - gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace - gMfciPolicyChangeResetGuid ## CONSUMES - -[Depex] - gEdkiiVariablePolicyProtocolGuid +## @file +# DXE Driver for determining the MFCI Policy in-effect and changes based on +# Target policy indicated by system Root of Trust. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciDxeRootOfTrust + FILE_GUID = 90C72774-85AA-4AD9-B689-03328B4E11ED + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MfciDxeRootOfTrustEntry + + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciDxeRoT.c + MfciDxe.h + MfciPublicInterface.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + PcBdsPkg/PcBdsPkg.dec + MfciPkg/MfciPkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + HobLib + UefiDriverEntryPoint + ResetUtilityLib + BaseMemoryLib + MemoryAllocationLib + VariablePolicyHelperLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + MfciRetrievePolicyLib + MfciRetrieveTargetPolicyLib + MuTelemetryHelperLib + +[Protocols] + gMfciProtocolGuid ## PRODUCES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Guids] + gMfciHobGuid ## CONSUMES + gMfciVendorGuid ## CONSUMES + gMsStartOfBdsNotifyGuid ## CONSUMES + gEfiEndOfDxeEventGroupGuid ## CONSUMES + gMuVarPolicyDxePhaseGuid ## CONSUMES + gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace + gMfciPolicyChangeResetGuid ## CONSUMES + +[Depex] + gEdkiiVariablePolicyProtocolGuid diff --git a/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf b/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf index 9f63b9002c..b76095aa1d 100644 --- a/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf +++ b/MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf @@ -1,59 +1,59 @@ -## @file -# This module tests MFCI XDR formatted certificate extraction -# logic for MfciDxe driver. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciMultipleCertsHostTest - FILE_GUID = 80779F41-7A31-48C7-9E20-7967469316DE - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciMultipleCertsHostTest.c - ../MfciDxe.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - CryptoPkg/CryptoPkg.dec - MsCorePkg/MsCorePkg.dec - PcBdsPkg/PcBdsPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - BaseMemoryLib - MemoryAllocationLib - VariablePolicyHelperLib - MfciRetrievePolicyLib - MfciDeviceIdSupportLib - -[Protocols] - gMfciProtocolGuid ## CONSUMES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - -[Protocols.common.Private] - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Pcd] - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES - -[Guids] - gMfciVendorGuid ## CONSUMES - gMsStartOfBdsNotifyGuid ## CONSUMES - gEfiEndOfDxeEventGroupGuid ## CONSUMES - gMuVarPolicyDxePhaseGuid ## CONSUMES - gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES - gMfciPolicyChangeResetGuid ## CONSUMES +## @file +# This module tests MFCI XDR formatted certificate extraction +# logic for MfciDxe driver. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciMultipleCertsHostTest + FILE_GUID = 80779F41-7A31-48C7-9E20-7967469316DE + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciMultipleCertsHostTest.c + ../MfciDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + CryptoPkg/CryptoPkg.dec + MsCorePkg/MsCorePkg.dec + PcBdsPkg/PcBdsPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + VariablePolicyHelperLib + MfciRetrievePolicyLib + MfciDeviceIdSupportLib + +[Protocols] + gMfciProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + +[Protocols.common.Private] + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Pcd] + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES + +[Guids] + gMfciVendorGuid ## CONSUMES + gMsStartOfBdsNotifyGuid ## CONSUMES + gEfiEndOfDxeEventGroupGuid ## CONSUMES + gMuVarPolicyDxePhaseGuid ## CONSUMES + gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES + gMfciPolicyChangeResetGuid ## CONSUMES diff --git a/MfciPkg/MfciDxe/Test/MfciPublicInterfaceHostTest.inf b/MfciPkg/MfciDxe/Test/MfciPublicInterfaceHostTest.inf index cf61f376c2..b34bb92b47 100644 --- a/MfciPkg/MfciDxe/Test/MfciPublicInterfaceHostTest.inf +++ b/MfciPkg/MfciDxe/Test/MfciPublicInterfaceHostTest.inf @@ -1,45 +1,45 @@ -## @file -# This module tests public interface for the MfciDxe driver. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciPublicInterfaceHostTest - FILE_GUID = D59E2D34-C5D7-45C4-ADCA-ACCEB4ACAC35 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciPublicInterfaceHostTest.c - ../MfciPublicInterface.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - MsCorePkg/MsCorePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - BaseMemoryLib - MemoryAllocationLib - UefiRuntimeServicesTableLib - -[Protocols] - gMfciProtocolGuid ## CONSUMES - -[Protocols.common.Private] - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Guids] - gEfiEndOfDxeEventGroupGuid ## CONSUMES - gMuVarPolicyDxePhaseGuid ## CONSUMES +## @file +# This module tests public interface for the MfciDxe driver. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciPublicInterfaceHostTest + FILE_GUID = D59E2D34-C5D7-45C4-ADCA-ACCEB4ACAC35 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciPublicInterfaceHostTest.c + ../MfciPublicInterface.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + MsCorePkg/MsCorePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + UefiRuntimeServicesTableLib + +[Protocols] + gMfciProtocolGuid ## CONSUMES + +[Protocols.common.Private] + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Guids] + gEfiEndOfDxeEventGroupGuid ## CONSUMES + gMuVarPolicyDxePhaseGuid ## CONSUMES diff --git a/MfciPkg/MfciDxe/Test/MfciTargetingHostTest.inf b/MfciPkg/MfciDxe/Test/MfciTargetingHostTest.inf index b4b66698a1..722b900db2 100644 --- a/MfciPkg/MfciDxe/Test/MfciTargetingHostTest.inf +++ b/MfciPkg/MfciDxe/Test/MfciTargetingHostTest.inf @@ -1,52 +1,52 @@ -## @file -# This module tests targeting logic of MfciDxe driver. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciTargetingHostTest - FILE_GUID = D14C304F-A759-4714-BB2E-E24FE4AC873A - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciTargetingHostTest.c - ../MfciTargeting.c - ../../Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - CryptoPkg/CryptoPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - BaseMemoryLib - MemoryAllocationLib - VariablePolicyHelperLib - MfciRetrievePolicyLib - UefiRuntimeServicesTableLib - -[Protocols] - gMfciProtocolGuid ## CONSUMES - -[Protocols.common.Private] - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Pcd] - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdEnforceWindowsPcr11PrivacyPolicy ## CONSUMES - -[Guids] - gMfciVendorGuid ## CONSUMES +## @file +# This module tests targeting logic of MfciDxe driver. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciTargetingHostTest + FILE_GUID = D14C304F-A759-4714-BB2E-E24FE4AC873A + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciTargetingHostTest.c + ../MfciTargeting.c + ../../Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + CryptoPkg/CryptoPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + VariablePolicyHelperLib + MfciRetrievePolicyLib + UefiRuntimeServicesTableLib + +[Protocols] + gMfciProtocolGuid ## CONSUMES + +[Protocols.common.Private] + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Pcd] + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdEnforceWindowsPcr11PrivacyPolicy ## CONSUMES + +[Guids] + gMfciVendorGuid ## CONSUMES diff --git a/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeHostTest.inf b/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeHostTest.inf index ef80a64a9a..ca6502e68c 100644 --- a/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeHostTest.inf +++ b/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeHostTest.inf @@ -1,65 +1,65 @@ -## @file -# This module tests MFCI blob verification and apply -# logic for MfciDxe driver. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciVerifyPolicyAndChangeHostTest - FILE_GUID = FF16EB46-648E-4865-8307-0E9E2B13B2AC - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciVerifyPolicyAndChangeHostTest.c - ../MfciDxe.c - ../MfciTargeting.c - ../../Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - CryptoPkg/CryptoPkg.dec - MsCorePkg/MsCorePkg.dec - PcBdsPkg/PcBdsPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - BaseMemoryLib - MemoryAllocationLib - VariablePolicyHelperLib - MfciRetrievePolicyLib - MfciDeviceIdSupportLib - ResetUtilityLib - BaseCryptLib - UefiRuntimeServicesTableLib - -[Protocols] - gMfciProtocolGuid ## CONSUMES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - -[Protocols.common.Private] - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Pcd] - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES - gMfciPkgTokenSpaceGuid.PcdEnforceWindowsPcr11PrivacyPolicy ## CONSUMES - -[Guids] - gMfciVendorGuid ## CONSUMES - gMsStartOfBdsNotifyGuid ## CONSUMES gMuVarPolicyDxePhaseGuid ## CONSUMES - gEfiEndOfDxeEventGroupGuid ## CONSUMES - gMuVarPolicyDxePhaseGuid ## CONSUMES - gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace - gMfciPolicyChangeResetGuid ## CONSUMES +## @file +# This module tests MFCI blob verification and apply +# logic for MfciDxe driver. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciVerifyPolicyAndChangeHostTest + FILE_GUID = FF16EB46-648E-4865-8307-0E9E2B13B2AC + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciVerifyPolicyAndChangeHostTest.c + ../MfciDxe.c + ../MfciTargeting.c + ../../Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + CryptoPkg/CryptoPkg.dec + MsCorePkg/MsCorePkg.dec + PcBdsPkg/PcBdsPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + VariablePolicyHelperLib + MfciRetrievePolicyLib + MfciDeviceIdSupportLib + ResetUtilityLib + BaseCryptLib + UefiRuntimeServicesTableLib + +[Protocols] + gMfciProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + +[Protocols.common.Private] + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Pcd] + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7CertBufferXdr ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES + gMfciPkgTokenSpaceGuid.PcdEnforceWindowsPcr11PrivacyPolicy ## CONSUMES + +[Guids] + gMfciVendorGuid ## CONSUMES + gMsStartOfBdsNotifyGuid ## CONSUMES gMuVarPolicyDxePhaseGuid ## CONSUMES + gEfiEndOfDxeEventGroupGuid ## CONSUMES + gMuVarPolicyDxePhaseGuid ## CONSUMES + gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace + gMfciPolicyChangeResetGuid ## CONSUMES diff --git a/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeRoTHostTest.inf b/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeRoTHostTest.inf index 04077abb18..5bccfe715a 100644 --- a/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeRoTHostTest.inf +++ b/MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeRoTHostTest.inf @@ -1,60 +1,60 @@ -## @file -# This module tests MFCI policy verification and apply -# logic for root of trust based MfciDxe driver. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciVerifyPolicyAndChangeRoTHostTest - FILE_GUID = 7DF718CC-4648-4D24-9B14-75E1D4DD309E - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciVerifyPolicyAndChangeRoTHostTest.c - ../MfciDxeRoT.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - MsCorePkg/MsCorePkg.dec - PcBdsPkg/PcBdsPkg.dec - MsWheaPkg/MsWheaPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - BaseMemoryLib - MemoryAllocationLib - VariablePolicyHelperLib - MfciRetrievePolicyLib - MfciRetrieveTargetPolicyLib - ResetUtilityLib - UefiRuntimeServicesTableLib - MuTelemetryHelperLib - -[Protocols] - gMfciProtocolGuid ## CONSUMES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES - -[Pcd] - - -[Guids] - gMfciVendorGuid ## CONSUMES - gMsStartOfBdsNotifyGuid ## CONSUMES - gEfiEndOfDxeEventGroupGuid ## CONSUMES - gMuVarPolicyDxePhaseGuid ## CONSUMES - gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace - gMfciPolicyChangeResetGuid ## CONSUMES - gMfciHobGuid ## CONSUMES +## @file +# This module tests MFCI policy verification and apply +# logic for root of trust based MfciDxe driver. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciVerifyPolicyAndChangeRoTHostTest + FILE_GUID = 7DF718CC-4648-4D24-9B14-75E1D4DD309E + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciVerifyPolicyAndChangeRoTHostTest.c + ../MfciDxeRoT.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + MsCorePkg/MsCorePkg.dec + PcBdsPkg/PcBdsPkg.dec + MsWheaPkg/MsWheaPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + VariablePolicyHelperLib + MfciRetrievePolicyLib + MfciRetrieveTargetPolicyLib + ResetUtilityLib + UefiRuntimeServicesTableLib + MuTelemetryHelperLib + +[Protocols] + gMfciProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + gMfciPolicyChangeNotifyProtocolGuid ## CONSUMES + +[Pcd] + + +[Guids] + gMfciVendorGuid ## CONSUMES + gMsStartOfBdsNotifyGuid ## CONSUMES + gEfiEndOfDxeEventGroupGuid ## CONSUMES + gMuVarPolicyDxePhaseGuid ## CONSUMES + gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace + gMfciPolicyChangeResetGuid ## CONSUMES + gMfciHobGuid ## CONSUMES diff --git a/MfciPkg/MfciPei/MfciPei.inf b/MfciPkg/MfciPei/MfciPei.inf index 33e217741b..ca2f1e6068 100644 --- a/MfciPkg/MfciPei/MfciPei.inf +++ b/MfciPkg/MfciPei/MfciPei.inf @@ -1,53 +1,53 @@ -## @file -# PEI Driver for determining the MFCI Policy in-effect -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciPei - FILE_GUID = 6076A6DB-3CE5-4D08-ACA3-740A679E1A5C - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - ENTRY_POINT = MfciPeiEntry - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MfciPei.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - HobLib - PcdLib - PeimEntryPoint - PeiServicesLib - -[Protocols] - -[Pcd] - -[Ppis] - gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES - gMfciPpiGuid ## PRODUCES - -[Guids] - gMfciHobGuid ## PRODUCES - gMfciVendorGuid ## CONSUMES - -[Depex] - gEfiPeiReadOnlyVariable2PpiGuid +## @file +# PEI Driver for determining the MFCI Policy in-effect +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciPei + FILE_GUID = 6076A6DB-3CE5-4D08-ACA3-740A679E1A5C + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = MfciPeiEntry + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MfciPei.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HobLib + PcdLib + PeimEntryPoint + PeiServicesLib + +[Protocols] + +[Pcd] + +[Ppis] + gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES + gMfciPpiGuid ## PRODUCES + +[Guids] + gMfciHobGuid ## PRODUCES + gMfciVendorGuid ## CONSUMES + +[Depex] + gEfiPeiReadOnlyVariable2PpiGuid diff --git a/MfciPkg/Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.inf b/MfciPkg/Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.inf index cb2c98891c..4c63b75ba5 100644 --- a/MfciPkg/Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.inf +++ b/MfciPkg/Private/Library/MfciPolicyParsingLib/MfciPolicyParsingLib.inf @@ -1,40 +1,40 @@ -## @file -# Implements the MFCI Policy Parser Library -# Parses a signed, binary policy blob returning logical values -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciPolicyParsingLib - FILE_GUID = D8E5BB86-8F2E-48F5-8213-F53643F5F16A - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = MfciPolicyParsingLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - - -[Sources] - MfciPolicyParsingLibInternal.h - MfciPolicyParsingLib.c - - -[Packages] - MdePkg/MdePkg.dec - MfciPkg/MfciPkg.dec - CryptoPkg/CryptoPkg.dec - - -[LibraryClasses] - BaseCryptLib - BaseMemoryLib - DebugLib +## @file +# Implements the MFCI Policy Parser Library +# Parses a signed, binary policy blob returning logical values +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciPolicyParsingLib + FILE_GUID = D8E5BB86-8F2E-48F5-8213-F53643F5F16A + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = MfciPolicyParsingLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + + +[Sources] + MfciPolicyParsingLibInternal.h + MfciPolicyParsingLib.c + + +[Packages] + MdePkg/MdePkg.dec + MfciPkg/MfciPkg.dec + CryptoPkg/CryptoPkg.dec + + +[LibraryClasses] + BaseCryptLib + BaseMemoryLib + DebugLib MemoryAllocationLib \ No newline at end of file diff --git a/MfciPkg/Private/Library/MfciPolicyParsingLibNull/MfciPolicyParsingLibNull.inf b/MfciPkg/Private/Library/MfciPolicyParsingLibNull/MfciPolicyParsingLibNull.inf index 88cbf86890..a34a7791be 100644 --- a/MfciPkg/Private/Library/MfciPolicyParsingLibNull/MfciPolicyParsingLibNull.inf +++ b/MfciPkg/Private/Library/MfciPolicyParsingLibNull/MfciPolicyParsingLibNull.inf @@ -1,33 +1,33 @@ -## @file -# NULL library for the MFCI Policy parser -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MfciPolicyParsingLibNull - FILE_GUID = BCCB4D0D-B5B8-45D4-8F4E-961E9161F32E - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = MfciPolicyParsingLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - - -[Sources] - MfciPolicyParsingLibNull.c - - -[Packages] - MdePkg/MdePkg.dec - MfciPkg/MfciPkg.dec - - -[LibraryClasses] +## @file +# NULL library for the MFCI Policy parser +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MfciPolicyParsingLibNull + FILE_GUID = BCCB4D0D-B5B8-45D4-8F4E-961E9161F32E + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = MfciPolicyParsingLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + + +[Sources] + MfciPolicyParsingLibNull.c + + +[Packages] + MdePkg/MdePkg.dec + MfciPkg/MfciPkg.dec + + +[LibraryClasses] diff --git a/MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf b/MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf index 85d5b8acc9..196cf9dd86 100644 --- a/MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf +++ b/MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf @@ -1,45 +1,45 @@ -## @file -# Cryptographic Library instance for host based unit test in MFCI. -# -# This library is designed to work with unit tests for MFCI -# framework logic without OpenSSL dependency. -# -# This mocked version library provides interfaces based on cmocka -# implementation to inspect input arguments and return the corresponding -# outputs instead of truly performing the cryptographic computation -# steps. -# -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MockBaseCryptLib - FILE_GUID = 4A5CEF5C-5F41-44B9-AB5B-4DEE093C9DAC - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseCryptLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - MockCryptPkcs7.c - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - MfciPkg/MfciPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - MemoryAllocationLib - -[Pcd] - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES +## @file +# Cryptographic Library instance for host based unit test in MFCI. +# +# This library is designed to work with unit tests for MFCI +# framework logic without OpenSSL dependency. +# +# This mocked version library provides interfaces based on cmocka +# implementation to inspect input arguments and return the corresponding +# outputs instead of truly performing the cryptographic computation +# steps. +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MockBaseCryptLib + FILE_GUID = 4A5CEF5C-5F41-44B9-AB5B-4DEE093C9DAC + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = BaseCryptLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + MockCryptPkcs7.c + +[Packages] + MdePkg/MdePkg.dec + CryptoPkg/CryptoPkg.dec + MfciPkg/MfciPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + MemoryAllocationLib + +[Pcd] + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU ## CONSUMES diff --git a/MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf b/MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf index 0475237db8..4b7e4f681d 100644 --- a/MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf +++ b/MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf @@ -1,32 +1,32 @@ -## @file -# Mocked instance of MfciRetrieveTargetPolicyLib. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MockMfciRetrieveTargetPolicyLib - FILE_GUID = 5F677143-5987-4D3B-8F58-902636B446C3 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = MfciRetrieveTargetPolicyLib -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64 -# - -[Sources] - MockMfciRetrieveTargetPolicyLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MfciPkg/MfciPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - UnitTestLib +## @file +# Mocked instance of MfciRetrieveTargetPolicyLib. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MockMfciRetrieveTargetPolicyLib + FILE_GUID = 5F677143-5987-4D3B-8F58-902636B446C3 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = MfciRetrieveTargetPolicyLib +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64 +# + +[Sources] + MockMfciRetrieveTargetPolicyLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MfciPkg/MfciPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + UnitTestLib diff --git a/MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf b/MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf index eee8e7bf0e..b6a32d6131 100644 --- a/MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf +++ b/MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf @@ -1,54 +1,54 @@ -## @file -# Unit tests of the DxeResetSystemLib instance of the ResetSystemLib class -# -# This mocked version library provides interfaces based on cmocka -# implementation to inspect input arguments and perform "mocked" -# reset operations through long jump. -# -# For unit tests regarding routines that expects the target system -# to reset when the logic is fully fulfilled, this library instance -# can be used for host based test to return the tested routine early. -# -# To consume this library from host based unit tests, the unit test -# caller need to setup long jump buffer prior to test routine. -# -# i.e.: -# ``` -# expect_value (ResetSystemWithSubtype, ResetType, EfiResetCold); -# expect_value (ResetSystemWithSubtype, ResetSubtype, &gMfciPolicyChangeResetGuid); -# will_return (ResetSystemWithSubtype, &JumpBuf); -# -# if (!SetJump (&JumpBuf)) { -# TestRoutine (); -# } -# ``` -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = MockResetUtilityLib - FILE_GUID = 65247AFF-7E4F-4321-B12F-115E179F5841 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = ResetUtilityLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MockResetUtilityLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[LibraryClasses] - DebugLib - UnitTestLib +## @file +# Unit tests of the DxeResetSystemLib instance of the ResetSystemLib class +# +# This mocked version library provides interfaces based on cmocka +# implementation to inspect input arguments and perform "mocked" +# reset operations through long jump. +# +# For unit tests regarding routines that expects the target system +# to reset when the logic is fully fulfilled, this library instance +# can be used for host based test to return the tested routine early. +# +# To consume this library from host based unit tests, the unit test +# caller need to setup long jump buffer prior to test routine. +# +# i.e.: +# ``` +# expect_value (ResetSystemWithSubtype, ResetType, EfiResetCold); +# expect_value (ResetSystemWithSubtype, ResetSubtype, &gMfciPolicyChangeResetGuid); +# will_return (ResetSystemWithSubtype, &JumpBuf); +# +# if (!SetJump (&JumpBuf)) { +# TestRoutine (); +# } +# ``` +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = MockResetUtilityLib + FILE_GUID = 65247AFF-7E4F-4321-B12F-115E179F5841 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = ResetUtilityLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MockResetUtilityLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + DebugLib + UnitTestLib diff --git a/MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf b/MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf index 076d44fc53..e17aef4798 100644 --- a/MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf +++ b/MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf @@ -1,34 +1,34 @@ -## @file -# Mock implementation of the UEFI Runtime Services Table Library. -# -# This mocked version library provides a shim layer that links the -# gRT symbol to test specific runtime services table implementations. -# -# For unit tests needing to access runtime services, such as getting -# and setting variables, would implement their own runtime services -# table and the needed functionality under the name of `mMockRuntime`. -# The unit test should link to this instance of UefiRuntimeServicesTableLib -# from the corresponding host test dsc file. -# -# Copyright (c) 2020, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MockUefiRuntimeServicesTableLib - FILE_GUID = 89FEB63B-0C9A-465C-B6DF-0428986768EF - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - LIBRARY_CLASS = UefiRuntimeServicesTableLib - -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - MockUefiRuntimeServicesTableLib.c - -[Packages] - MdePkg/MdePkg.dec +## @file +# Mock implementation of the UEFI Runtime Services Table Library. +# +# This mocked version library provides a shim layer that links the +# gRT symbol to test specific runtime services table implementations. +# +# For unit tests needing to access runtime services, such as getting +# and setting variables, would implement their own runtime services +# table and the needed functionality under the name of `mMockRuntime`. +# The unit test should link to this instance of UefiRuntimeServicesTableLib +# from the corresponding host test dsc file. +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MockUefiRuntimeServicesTableLib + FILE_GUID = 89FEB63B-0C9A-465C-B6DF-0428986768EF + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + LIBRARY_CLASS = UefiRuntimeServicesTableLib + +# +# VALID_ARCHITECTURES = IA32 X64 EBC +# + +[Sources] + MockUefiRuntimeServicesTableLib.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MfciPkg/UnitTests/MfciPkgHostTest.dsc b/MfciPkg/UnitTests/MfciPkgHostTest.dsc index c3dbe15a0b..cb0d813a94 100644 --- a/MfciPkg/UnitTests/MfciPkgHostTest.dsc +++ b/MfciPkg/UnitTests/MfciPkgHostTest.dsc @@ -1,94 +1,94 @@ -## @file -# Host Test DSC for the Manufacturer Firmware Configuration Interface (MFCI) Package -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -################################################################################ -[Defines] - PLATFORM_NAME = MfciPkg - PLATFORM_GUID = 24621B71-FD5A-4724-87D2-AE9044FB6BC2 - PLATFORM_VERSION = 0.1 - DSC_SPECIFICATION = 0x00010005 - OUTPUT_DIRECTORY = Build/MfciPkg - SUPPORTED_ARCHITECTURES = IA32|X64 - SKUID_IDENTIFIER = DEFAULT - BUILD_TARGETS = NOOPT - - DEFINE MFCI_POLICY_EKU_TEST = "1.3.6.1.4.1.311.45.255.255" - -!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc - -[PcdsFixedAtBuild] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x3f - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80080246 - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel|0x80080246 - - # the unit test uses the test certificate that will also be used for testing end-to-end scenarios - !include MfciPkg/Private/Certs/CA-test.dsc.inc - gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU |$(MFCI_POLICY_EKU_TEST) # use the test version - -################################################################################ -# -# Library Class section - list of all Library Classes needed by this Platform. -# -################################################################################ -!include MdePkg/MdeLibs.dsc.inc - -[LibraryClasses.X64] - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf - Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf - Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf - Tpm2DebugLib|SecurityPkg/Library/Tpm2DebugLib/Tpm2DebugLibNull.inf - MfciRetrievePolicyLib|MfciPkg/Library/MfciRetrievePolicyLibNull/MfciRetrievePolicyLibNull.inf - -[LibraryClasses] - MfciPolicyParsingLib|MfciPkg/Private/Library/MfciPolicyParsingLibNull/MfciPolicyParsingLibNull.inf - MfciDeviceIdSupportLib|MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.inf - VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf - UefiLib|MdePkg/Library/UefiLib/UefiLib.inf - UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf - UefiRuntimeServicesTableLib|MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf - DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf - DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf - OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf - SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf - FltUsedLib|MdePkg/Library/FltUsedLib/FltUsedLib.inf - MuTelemetryHelperLib|MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf - -################################################################################ -# -# Components section - list of all Components needed by this Platform. -# -################################################################################ -[Components] - MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf - MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf - MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf - MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf - - MfciPkg/MfciDxe/Test/MfciTargetingHostTest.inf - - MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeHostTest.inf { - - ResetUtilityLib|MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf - BaseCryptLib|MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf - } - - MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeRoTHostTest.inf { - - ResetUtilityLib|MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf - MfciRetrieveTargetPolicyLib|MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf - } - - MfciPkg/MfciDxe/Test/MfciPublicInterfaceHostTest.inf - - MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf - -[BuildOptions] - *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES +## @file +# Host Test DSC for the Manufacturer Firmware Configuration Interface (MFCI) Package +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +################################################################################ +[Defines] + PLATFORM_NAME = MfciPkg + PLATFORM_GUID = 24621B71-FD5A-4724-87D2-AE9044FB6BC2 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/MfciPkg + SUPPORTED_ARCHITECTURES = IA32|X64 + SKUID_IDENTIFIER = DEFAULT + BUILD_TARGETS = NOOPT + + DEFINE MFCI_POLICY_EKU_TEST = "1.3.6.1.4.1.311.45.255.255" + +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc + +[PcdsFixedAtBuild] + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x3f + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80080246 + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel|0x80080246 + + # the unit test uses the test certificate that will also be used for testing end-to-end scenarios + !include MfciPkg/Private/Certs/CA-test.dsc.inc + gMfciPkgTokenSpaceGuid.PcdMfciPkcs7RequiredLeafEKU |$(MFCI_POLICY_EKU_TEST) # use the test version + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this Platform. +# +################################################################################ +!include MdePkg/MdeLibs.dsc.inc + +[LibraryClasses.X64] + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf + Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf + Tpm2DebugLib|SecurityPkg/Library/Tpm2DebugLib/Tpm2DebugLibNull.inf + MfciRetrievePolicyLib|MfciPkg/Library/MfciRetrievePolicyLibNull/MfciRetrievePolicyLibNull.inf + +[LibraryClasses] + MfciPolicyParsingLib|MfciPkg/Private/Library/MfciPolicyParsingLibNull/MfciPolicyParsingLibNull.inf + MfciDeviceIdSupportLib|MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiRuntimeServicesTableLib|MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + FltUsedLib|MdePkg/Library/FltUsedLib/FltUsedLib.inf + MuTelemetryHelperLib|MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf + +################################################################################ +# +# Components section - list of all Components needed by this Platform. +# +################################################################################ +[Components] + MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf + MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf + MfciPkg/UnitTests/Library/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf + MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf + + MfciPkg/MfciDxe/Test/MfciTargetingHostTest.inf + + MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeHostTest.inf { + + ResetUtilityLib|MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf + BaseCryptLib|MfciPkg/UnitTests/Library/MockBaseCryptLib/MockBaseCryptLib.inf + } + + MfciPkg/MfciDxe/Test/MfciVerifyPolicyAndChangeRoTHostTest.inf { + + ResetUtilityLib|MfciPkg/UnitTests/Library/MockResetUtilityLib/MockResetUtilityLib.inf + MfciRetrieveTargetPolicyLib|MfciPkg/UnitTests/Library/MockMfciRetrieveTargetPolicyLib/MockMfciRetrieveTargetPolicyLib.inf + } + + MfciPkg/MfciDxe/Test/MfciPublicInterfaceHostTest.inf + + MfciPkg/MfciDxe/Test/MfciMultipleCertsHostTest.inf + +[BuildOptions] + *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/Bin2Header.py b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/Bin2Header.py index 196b31b56c..f2cf7f18e0 100644 --- a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/Bin2Header.py +++ b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/Bin2Header.py @@ -1,53 +1,53 @@ -## @file -# Converts binaries to EFI-style C structs -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -import argparse - - -def Bin2Header(BinFilePath, HeaderFilePath, ArrayName): - inFile = open(BinFilePath, "rb") - outFile = open(HeaderFilePath, "w") - - outFile.write(' CONST UINT8 ') - outFile.write(ArrayName) - outFile.write('[] = {') - - binData = inFile.read() - inFile.close() - binDataSize = len(binData) - for i in range(0, binDataSize): - if i != 0: - outFile.write(',') - if (i % 16) == 0: - outFile.write('\n ') - else: - outFile.write(' ') - outFile.write("".join("0x{:02x}".format(binData[i]))) - - outFile.write("};\n") - outFile.close() - - -def main(): - parser = argparse.ArgumentParser( - description='Create Header file from Binary file') - - parser.add_argument("-b", "--BinaryFile", dest="BinaryFilePath", - help="Path to Binary File", default=None) - parser.add_argument("-q", "--HeaderFile", dest="HeaderFilePath", - help="Path to created header file", default=None) - parser.add_argument("-a", "--ArrayName", dest="ArrayName", - help="Name for the binary array", default=None) - - options = parser.parse_args() - - Bin2Header(options.BinaryFilePath, options.HeaderFilePath, options.ArrayName) - - -if __name__ == '__main__': - main() +## @file +# Converts binaries to EFI-style C structs +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +import argparse + + +def Bin2Header(BinFilePath, HeaderFilePath, ArrayName): + inFile = open(BinFilePath, "rb") + outFile = open(HeaderFilePath, "w") + + outFile.write(' CONST UINT8 ') + outFile.write(ArrayName) + outFile.write('[] = {') + + binData = inFile.read() + inFile.close() + binDataSize = len(binData) + for i in range(0, binDataSize): + if i != 0: + outFile.write(',') + if (i % 16) == 0: + outFile.write('\n ') + else: + outFile.write(' ') + outFile.write("".join("0x{:02x}".format(binData[i]))) + + outFile.write("};\n") + outFile.close() + + +def main(): + parser = argparse.ArgumentParser( + description='Create Header file from Binary file') + + parser.add_argument("-b", "--BinaryFile", dest="BinaryFilePath", + help="Path to Binary File", default=None) + parser.add_argument("-q", "--HeaderFile", dest="HeaderFilePath", + help="Path to created header file", default=None) + parser.add_argument("-a", "--ArrayName", dest="ArrayName", + help="Name for the binary array", default=None) + + options = parser.parse_args() + + Bin2Header(options.BinaryFilePath, options.HeaderFilePath, options.ArrayName) + + +if __name__ == '__main__': + main() diff --git a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/ConvertBins2Headers.py b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/ConvertBins2Headers.py index a18188d4da..bb91d32ea4 100644 --- a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/ConvertBins2Headers.py +++ b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/ConvertBins2Headers.py @@ -1,42 +1,42 @@ -## @file -# Converts all .cer files in a supplied directory -# into C-struct header files -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -import argparse -import os - -from Bin2Header import Bin2Header - - -def main(): - parser = argparse.ArgumentParser( - description='Create Header files from Binary files') - - parser.add_argument("-p", "--BlobsPath", dest="BlobsPath", - help="Path to Binary File", default=None) - options = parser.parse_args() - with os.scandir(options.BlobsPath) as it: - for entry in it: - if entry.is_file(): - - ext2var = { - '.cer' : 'mCert_', - '.bin' : 'mBin_', - '.p7' : 'mSigned_' - } - - ext = os.path.splitext(entry)[1] - if ext not in ext2var: - continue - arrayName = ext2var[ext] + entry.name[:entry.name.find('.')] - headerFilename = entry.name + ".h" - #print(entry.name, headerFilename, arrayName) - Bin2Header(entry.name, headerFilename, arrayName) - - -if __name__ == '__main__': - main() +## @file +# Converts all .cer files in a supplied directory +# into C-struct header files +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +import argparse +import os + +from Bin2Header import Bin2Header + + +def main(): + parser = argparse.ArgumentParser( + description='Create Header files from Binary files') + + parser.add_argument("-p", "--BlobsPath", dest="BlobsPath", + help="Path to Binary File", default=None) + options = parser.parse_args() + with os.scandir(options.BlobsPath) as it: + for entry in it: + if entry.is_file(): + + ext2var = { + '.cer' : 'mCert_', + '.bin' : 'mBin_', + '.p7' : 'mSigned_' + } + + ext = os.path.splitext(entry)[1] + if ext not in ext2var: + continue + arrayName = ext2var[ext] + entry.name[:entry.name.find('.')] + headerFilename = entry.name + ".h" + #print(entry.name, headerFilename, arrayName) + Bin2Header(entry.name, headerFilename, arrayName) + + +if __name__ == '__main__': + main() diff --git a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/MakeChainingCerts.bat b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/MakeChainingCerts.bat index 308f8f2886..de09a39fd6 100644 --- a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/MakeChainingCerts.bat +++ b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/certs/MakeChainingCerts.bat @@ -1,31 +1,31 @@ -rem exit /B -@echo off - -pushd . -cd %~dp0 - -REM Creating Certs requires the Win10 WDK. If you don't have the MakeCert tool you can try the 8.1 kit (just change the KIT=10 to KIT=8.1, and VER=bin) - -set KIT=10 -set VER=bin\10.0.18362.0 -set EKU_TEST=1.3.6.1.4.1.311.45.255.255,1.3.6.1.5.5.7.3.3 -set EKU_INVALID=1.3.6.1.4.1.311.255.0.0,1.3.6.1.5.5.7.3.3 - -rem FwPolicy's Test Root, CAs, & Leaves - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 300 -a sha256 -sv Root.pvk -pe -ss my -n "CN=A Test Root, O=Contoso" Root.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk Root.pvk -spc Root.cer -pfx Root.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 150 -a sha256 -ic Root.cer -iv Root.pvk -sv CA.pvk -pe -ss my -n "CN=A UEFI Test CA, O=Contoso" CA.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk CA.pvk -spc CA.cer -pfx CA.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 150 -a sha256 -ic Root.cer -iv Root.pvk -sv CA-NotTrusted.pvk -pe -ss my -n "CN=NotTrusted UEFI Test CA, O=Contoso" CA-NotTrusted.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk CA-NotTrusted.pvk -spc CA-NotTrusted.cer -pfx CA-NotTrusted.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 3072 -m 30 -a sha256 -ic CA.cer -iv CA.pvk -sv Leaf-test.pvk -pe -ss my -sky exchange -n "CN=FwPolicy Test Leaf, O=Contoso" -eku %EKU_TEST% Leaf-test.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk Leaf-test.pvk -spc Leaf-test.cer -pfx Leaf-test.pfx - -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 3072 -m 30 -a sha256 -ic CA.cer -iv CA.pvk -sv Leaf-NoEku.pvk -pe -ss my -sky exchange -n "CN=Another Test Leaf Without an EKU, O=Contoso" Leaf-NoEku.cer -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk Leaf-NoEku.pvk -spc Leaf-NoEku.cer -pfx Leaf-NoEku.pfx - -ConvertCerts2Headers.py -p . +rem exit /B +@echo off + +pushd . +cd %~dp0 + +REM Creating Certs requires the Win10 WDK. If you don't have the MakeCert tool you can try the 8.1 kit (just change the KIT=10 to KIT=8.1, and VER=bin) + +set KIT=10 +set VER=bin\10.0.18362.0 +set EKU_TEST=1.3.6.1.4.1.311.45.255.255,1.3.6.1.5.5.7.3.3 +set EKU_INVALID=1.3.6.1.4.1.311.255.0.0,1.3.6.1.5.5.7.3.3 + +rem FwPolicy's Test Root, CAs, & Leaves + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -r -cy authority -len 4096 -m 300 -a sha256 -sv Root.pvk -pe -ss my -n "CN=A Test Root, O=Contoso" Root.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk Root.pvk -spc Root.cer -pfx Root.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 150 -a sha256 -ic Root.cer -iv Root.pvk -sv CA.pvk -pe -ss my -n "CN=A UEFI Test CA, O=Contoso" CA.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk CA.pvk -spc CA.cer -pfx CA.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -cy authority -len 4096 -m 150 -a sha256 -ic Root.cer -iv Root.pvk -sv CA-NotTrusted.pvk -pe -ss my -n "CN=NotTrusted UEFI Test CA, O=Contoso" CA-NotTrusted.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk CA-NotTrusted.pvk -spc CA-NotTrusted.cer -pfx CA-NotTrusted.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 3072 -m 30 -a sha256 -ic CA.cer -iv CA.pvk -sv Leaf-test.pvk -pe -ss my -sky exchange -n "CN=FwPolicy Test Leaf, O=Contoso" -eku %EKU_TEST% Leaf-test.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk Leaf-test.pvk -spc Leaf-test.cer -pfx Leaf-test.pfx + +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\MakeCert.exe" -len 3072 -m 30 -a sha256 -ic CA.cer -iv CA.pvk -sv Leaf-NoEku.pvk -pe -ss my -sky exchange -n "CN=Another Test Leaf Without an EKU, O=Contoso" Leaf-NoEku.cer +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\Pvk2Pfx.exe" -pvk Leaf-NoEku.pvk -spc Leaf-NoEku.cer -pfx Leaf-NoEku.pfx + +ConvertCerts2Headers.py -p . diff --git a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/GenPacket.py b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/GenPacket.py index 3b55895633..745b8450ac 100644 --- a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/GenPacket.py +++ b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/GenPacket.py @@ -1,33 +1,33 @@ -# @file -# Generate the test MFCI policy blob for -# the MFCI Policy Parsing Library Unit Test -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -from edk2toollib.windows.policy.firmware_policy import FirmwarePolicy - - -policyManuf = FirmwarePolicy() -nonce = 0x0123456789abcdef -TargetInfo = {# EV Certificate Subject CN="" - # Recommend also matches SmbiosSystemManufacturer, SMBIOS Table 1, offset 04h (System Manufacturer) - 'Manufacturer': 'Contoso Computers, LLC', - # SmbiosSystemProductName, SMBIOS Table 1, offset 05h (System Product Name) - 'Product': 'Laptop Foo', - # SmbiosSystemSerialNumber, SMBIOS System Information (Type 1 Table) -> Serial NumberP - 'SerialNumber': 'F0013-000243546-X02', - # Yours to define, or not use (NULL string), ODM name is suggested - 'OEM_01': 'ODM Foo', - 'OEM_02': '', # Yours to define, or not use (NULL string) - 'Nonce': nonce} -policyManuf.SetDeviceTarget(TargetInfo) - -policy = FirmwarePolicy.FW_POLICY_VALUE_ACTION_SECUREBOOT_CLEAR + FirmwarePolicy.FW_POLICY_VALUE_ACTION_TPM_CLEAR -policyManuf.SetDevicePolicy(policy=policy) - -fsout = open('.\\policy_good_manufacturing.bin','wb') -policyManuf.SerializeToStream(stream=fsout) -fsout.close() -policyManuf.Print() +# @file +# Generate the test MFCI policy blob for +# the MFCI Policy Parsing Library Unit Test +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +from edk2toollib.windows.policy.firmware_policy import FirmwarePolicy + + +policyManuf = FirmwarePolicy() +nonce = 0x0123456789abcdef +TargetInfo = {# EV Certificate Subject CN="" + # Recommend also matches SmbiosSystemManufacturer, SMBIOS Table 1, offset 04h (System Manufacturer) + 'Manufacturer': 'Contoso Computers, LLC', + # SmbiosSystemProductName, SMBIOS Table 1, offset 05h (System Product Name) + 'Product': 'Laptop Foo', + # SmbiosSystemSerialNumber, SMBIOS System Information (Type 1 Table) -> Serial NumberP + 'SerialNumber': 'F0013-000243546-X02', + # Yours to define, or not use (NULL string), ODM name is suggested + 'OEM_01': 'ODM Foo', + 'OEM_02': '', # Yours to define, or not use (NULL string) + 'Nonce': nonce} +policyManuf.SetDeviceTarget(TargetInfo) + +policy = FirmwarePolicy.FW_POLICY_VALUE_ACTION_SECUREBOOT_CLEAR + FirmwarePolicy.FW_POLICY_VALUE_ACTION_TPM_CLEAR +policyManuf.SetDevicePolicy(policy=policy) + +fsout = open('.\\policy_good_manufacturing.bin','wb') +policyManuf.SerializeToStream(stream=fsout) +fsout.close() +policyManuf.Print() diff --git a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/SignPacket.cmd b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/SignPacket.cmd index 7276473ea4..bc39ed1777 100644 --- a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/SignPacket.cmd +++ b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/data/packets/SignPacket.cmd @@ -1,20 +1,20 @@ -@echo off -REM @file -REM -REM Copyright (c) Microsoft Corporation -REM SPDX-License-Identifier: BSD-2-Clause-Patent -REM -REM Helps sign MFCI policies using signtool.exe - -pushd . -cd %~dp0 -REM Signing using the Win10 WDK -echo "USAGE: sign.bat " - -set KIT=10 -set VER=bin\10.0.18362.0 -REM set OID=1.3.6.1.4.1.311.79.1 -set OID=1.2.840.113549.1.7.1 -set EKU_TEST=1.3.6.1.4.1.311.45.255.255 -set EKU_INVALID=1.3.6.1.4.1.311.255.0.0 -"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\"signtool sign /fd SHA256 /p7 . /p7ce Embedded /p7co %OID% /f %2 %1 +@echo off +REM @file +REM +REM Copyright (c) Microsoft Corporation +REM SPDX-License-Identifier: BSD-2-Clause-Patent +REM +REM Helps sign MFCI policies using signtool.exe + +pushd . +cd %~dp0 +REM Signing using the Win10 WDK +echo "USAGE: sign.bat " + +set KIT=10 +set VER=bin\10.0.18362.0 +REM set OID=1.3.6.1.4.1.311.79.1 +set OID=1.2.840.113549.1.7.1 +set EKU_TEST=1.3.6.1.4.1.311.45.255.255 +set EKU_INVALID=1.3.6.1.4.1.311.255.0.0 +"C:\Program Files (x86)\Windows Kits\%KIT%\%VER%\x64\"signtool sign /fd SHA256 /p7 . /p7ce Embedded /p7co %OID% /f %2 %1 diff --git a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/tools/createSignedPolicy.py b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/tools/createSignedPolicy.py index 82626e2ba0..8613690c8c 100644 --- a/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/tools/createSignedPolicy.py +++ b/MfciPkg/UnitTests/MfciPolicyParsingUnitTest/tools/createSignedPolicy.py @@ -1,100 +1,100 @@ -# @file -# Create MFCI Policy for the current device -# -# Copyright (c) Microsoft Corporation -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -from edk2toollib.windows.policy.firmware_policy import FirmwarePolicy -from edk2toolext.capsule import signing_helper -import struct -import logging -import os - -SIGNER = 'signtool' -# SIGNER = 'openssl' -PFX = "..\\data\\certs\\Leaf-test.pfx" -OID = '1.2.840.113549.1.7.1' - - -def CreatePolicyFromParameters(manufacturer: str, product: str, - sn: str, nonce: int, oem1: str, oem2: str, - devicePolicy: int) -> bytes: - """ - Populates a MFCI Policy object with provided parameters & returns its serialization as a bytearray - """ - policy = FirmwarePolicy() - TargetInfo = {'Manufacturer': manufacturer, - 'Product': product, - 'SerialNumber': sn, - 'OEM_01': oem1, - 'OEM_02': oem2, - 'Nonce': nonce} - policy.SetDeviceTarget(TargetInfo) - policy.SetDevicePolicy(devicePolicy) - ba = bytearray() - policy.Serialize(ba) - return bytes(ba) - - -def createSignedPolicy(filename: str, signer_type: str, pkcs12_test: bool = False) -> None: - manf = bytes.decode(open('Manufacturer.bin', 'rb').read(), encoding='utf_16_le') - prod = bytes.decode(open('Product.bin', 'rb').read(), encoding='utf_16_le') - sn = bytes.decode(open('SerialNumber.bin', 'rb').read(), encoding='utf_16_le') - oem1 = bytes.decode(open('OEM_01.bin', 'rb').read(), encoding='utf_16_le') - oem2 = bytes.decode(open('OEM_02.bin', 'rb').read(), encoding='utf_16_le') - nonceInt = struct.unpack(' bytes: + """ + Populates a MFCI Policy object with provided parameters & returns its serialization as a bytearray + """ + policy = FirmwarePolicy() + TargetInfo = {'Manufacturer': manufacturer, + 'Product': product, + 'SerialNumber': sn, + 'OEM_01': oem1, + 'OEM_02': oem2, + 'Nonce': nonce} + policy.SetDeviceTarget(TargetInfo) + policy.SetDevicePolicy(devicePolicy) + ba = bytearray() + policy.Serialize(ba) + return bytes(ba) + + +def createSignedPolicy(filename: str, signer_type: str, pkcs12_test: bool = False) -> None: + manf = bytes.decode(open('Manufacturer.bin', 'rb').read(), encoding='utf_16_le') + prod = bytes.decode(open('Product.bin', 'rb').read(), encoding='utf_16_le') + sn = bytes.decode(open('SerialNumber.bin', 'rb').read(), encoding='utf_16_le') + oem1 = bytes.decode(open('OEM_01.bin', 'rb').read(), encoding='utf_16_le') + oem2 = bytes.decode(open('OEM_02.bin', 'rb').read(), encoding='utf_16_le') + nonceInt = struct.unpack(' -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = GuidedSectionExtract - MODULE_UNI_FILE = GuidedSectionExtract.uni - FILE_GUID = 10D70125-BAA3-4296-A62F-602BEBBB9010 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - - ENTRY_POINT = PeimInitializeGuidedSectionExtract - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only) AARCH64 -# - -[Sources] - GuidedSectionExtract.h - GuidedSectionExtract.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - PcdLib - ExtractGuidedSectionLib - UefiDecompressLib - ReportStatusCodeLib - PeiServicesLib - HobLib - BaseLib - PeimEntryPoint - DebugLib - DebugAgentLib - PerformanceLib - -[Ppis] - gEfiPeiDecompressPpiGuid ## PRODUCES - -[FeaturePcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress ## CONSUMES - -[Depex] - gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiLoadFilePpiGuid AND gEfiPeiMasterBootModePpiGuid - -[UserExtensions.TianoCore."ExtraFiles"] - DxeIplExtra.uni +## @file +# +// This module produces a PPI that extracts GUIDed flash sections. +# +# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = GuidedSectionExtract + MODULE_UNI_FILE = GuidedSectionExtract.uni + FILE_GUID = 10D70125-BAA3-4296-A62F-602BEBBB9010 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + + ENTRY_POINT = PeimInitializeGuidedSectionExtract + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only) AARCH64 +# + +[Sources] + GuidedSectionExtract.h + GuidedSectionExtract.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + PcdLib + ExtractGuidedSectionLib + UefiDecompressLib + ReportStatusCodeLib + PeiServicesLib + HobLib + BaseLib + PeimEntryPoint + DebugLib + DebugAgentLib + PerformanceLib + +[Ppis] + gEfiPeiDecompressPpiGuid ## PRODUCES + +[FeaturePcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress ## CONSUMES + +[Depex] + gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiLoadFilePpiGuid AND gEfiPeiMasterBootModePpiGuid + +[UserExtensions.TianoCore."ExtraFiles"] + DxeIplExtra.uni diff --git a/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtract.uni b/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtract.uni index 681c0b8b55..6ef648c956 100644 --- a/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtract.uni +++ b/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtract.uni @@ -1,14 +1,14 @@ -// /** @file -// -// This module produces a PPI that extracts GUIDed flash sections. -// -// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
-// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "GUIDed Section Extraction PEIM" - -#string STR_MODULE_DESCRIPTION #language en-US "GUIDed Section Extraction PEIM" - +// /** @file +// +// This module produces a PPI that extracts GUIDed flash sections. +// +// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "GUIDed Section Extraction PEIM" + +#string STR_MODULE_DESCRIPTION #language en-US "GUIDed Section Extraction PEIM" + diff --git a/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtractExtra.uni b/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtractExtra.uni index b6350381fe..fa465c5cf4 100644 --- a/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtractExtra.uni +++ b/MsCorePkg/Core/GuidedSectionExtractPeim/GuidedSectionExtractExtra.uni @@ -1,9 +1,9 @@ -// /** @file -// JasTst Localized Strings and Content -// **/ - -#string STR_PROPERTIES_MODULE_NAME -#language en-US -"Core DXE Services GUIDed Section Extraction PEIM" - - +// /** @file +// JasTst Localized Strings and Content +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Core DXE Services GUIDed Section Extraction PEIM" + + diff --git a/MsCorePkg/Library/BaseCapsulePersistenceLibNull/BaseCapsulePersistenceLibNull.inf b/MsCorePkg/Library/BaseCapsulePersistenceLibNull/BaseCapsulePersistenceLibNull.inf index 0e201281d3..7677d24066 100644 --- a/MsCorePkg/Library/BaseCapsulePersistenceLibNull/BaseCapsulePersistenceLibNull.inf +++ b/MsCorePkg/Library/BaseCapsulePersistenceLibNull/BaseCapsulePersistenceLibNull.inf @@ -1,33 +1,33 @@ -## @file -# NULL implementation of the Secured Core Capsule Persistence library. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = BaseCapsulePersistenceLibNull - FILE_GUID = 713EB1D6-9300-42A8-A692-86EFE54C9274 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = CapsulePersistenceLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - BaseCapsulePersistenceLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - DebugLib - BaseLib +## @file +# NULL implementation of the Secured Core Capsule Persistence library. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = BaseCapsulePersistenceLibNull + FILE_GUID = 713EB1D6-9300-42A8-A692-86EFE54C9274 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = CapsulePersistenceLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + BaseCapsulePersistenceLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + DebugLib + BaseLib diff --git a/MsCorePkg/Library/BaseIsCapsuleSupportedLibNull/BaseIsCapsuleSupportedLibNull.inf b/MsCorePkg/Library/BaseIsCapsuleSupportedLibNull/BaseIsCapsuleSupportedLibNull.inf index 4a29318281..8f867ac244 100644 --- a/MsCorePkg/Library/BaseIsCapsuleSupportedLibNull/BaseIsCapsuleSupportedLibNull.inf +++ b/MsCorePkg/Library/BaseIsCapsuleSupportedLibNull/BaseIsCapsuleSupportedLibNull.inf @@ -1,32 +1,32 @@ -## @file -# Null implementation of the IsCapsuleSupported library. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseIsCapsuleSupportedLibNull - FILE_GUID = 7099B3B9-FBD2-44B7-AF09-794CEEEE8442 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = IsCapsuleSupportedLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - BaseIsCapsuleSupportedLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - DebugLib - BaseLib +## @file +# Null implementation of the IsCapsuleSupported library. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BaseIsCapsuleSupportedLibNull + FILE_GUID = 7099B3B9-FBD2-44B7-AF09-794CEEEE8442 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = IsCapsuleSupportedLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + BaseIsCapsuleSupportedLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DebugLib + BaseLib diff --git a/MsCorePkg/Library/BaseQueueLibNull/BaseQueueLibNull.inf b/MsCorePkg/Library/BaseQueueLibNull/BaseQueueLibNull.inf index 7218d6b59e..8e9c55577b 100644 --- a/MsCorePkg/Library/BaseQueueLibNull/BaseQueueLibNull.inf +++ b/MsCorePkg/Library/BaseQueueLibNull/BaseQueueLibNull.inf @@ -1,32 +1,32 @@ -## @file -# Null implementation of the queue library. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = BaseQueueLibNull - FILE_GUID = 402C29C0-E87D-4A6D-A49E-C982CB2D2F7C - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = QueueLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - BaseQueueLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - DebugLib - BaseLib +## @file +# Null implementation of the queue library. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = BaseQueueLibNull + FILE_GUID = 402C29C0-E87D-4A6D-A49E-C982CB2D2F7C + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = QueueLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + BaseQueueLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DebugLib + BaseLib diff --git a/MsCorePkg/Library/DebugPortPei/DebugPortPei.inf b/MsCorePkg/Library/DebugPortPei/DebugPortPei.inf index c8cafb9b8f..e6063a4d90 100644 --- a/MsCorePkg/Library/DebugPortPei/DebugPortPei.inf +++ b/MsCorePkg/Library/DebugPortPei/DebugPortPei.inf @@ -1,45 +1,45 @@ -## @file -# This library has no API or Library function callers. In the entry point it will publish -# the DebugPortPpi using the containing module's DebugLib instance functions. This allows all -# other modules within PEI to use a thin shim DebugLib that leverages the functions in the PPI. -# This can provide a significant flash size savings for PEIMs which often have limited space. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = DebugPortPei - FILE_GUID = 07410b62-2e70-4a46-ba88-8511abb907f3 - VERSION_STRING = 1.0 - MODULE_TYPE = PEIM - LIBRARY_CLASS = NULL|PEIM - CONSTRUCTOR = DebugPortInitialize -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[LibraryClasses] - BaseMemoryLib - PeiServicesLib - PeimEntryPoint - DebugLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[Sources] - DebugPortPei.c - -[Ppis] - gDebugPortPpiGuid ## PRODUCES - -[Depex] - TRUE - +## @file +# This library has no API or Library function callers. In the entry point it will publish +# the DebugPortPpi using the containing module's DebugLib instance functions. This allows all +# other modules within PEI to use a thin shim DebugLib that leverages the functions in the PPI. +# This can provide a significant flash size savings for PEIMs which often have limited space. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = DebugPortPei + FILE_GUID = 07410b62-2e70-4a46-ba88-8511abb907f3 + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + LIBRARY_CLASS = NULL|PEIM + CONSTRUCTOR = DebugPortInitialize +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[LibraryClasses] + BaseMemoryLib + PeiServicesLib + PeimEntryPoint + DebugLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[Sources] + DebugPortPei.c + +[Ppis] + gDebugPortPpiGuid ## PRODUCES + +[Depex] + TRUE + diff --git a/MsCorePkg/Library/DebugPortProtocolInstallLib/DebugPortProtocolInstallLib.inf b/MsCorePkg/Library/DebugPortProtocolInstallLib/DebugPortProtocolInstallLib.inf index 70bfeedd9b..0b659a5fc5 100644 --- a/MsCorePkg/Library/DebugPortProtocolInstallLib/DebugPortProtocolInstallLib.inf +++ b/MsCorePkg/Library/DebugPortProtocolInstallLib/DebugPortProtocolInstallLib.inf @@ -1,39 +1,39 @@ -## @file -# Library used to install debug port protocol -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DebugPortProtocolInstallLib - FILE_GUID = b7dc3fdb-9937-41ef-bfc1-6050903925ee - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugPortProtocolInstallLib|DXE_CORE - CONSTRUCTOR = InstallDebugPortProtocol - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 ARM -# - -[Sources] - DebugPortProtocolInstallLib.c - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseMemoryLib - BaseLib - DebugLib - -[Protocols] - gEfiDebugPortProtocolGuid ## PRODUCES - -[Depex] - TRUE +## @file +# Library used to install debug port protocol +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DebugPortProtocolInstallLib + FILE_GUID = b7dc3fdb-9937-41ef-bfc1-6050903925ee + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DebugPortProtocolInstallLib|DXE_CORE + CONSTRUCTOR = InstallDebugPortProtocol + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 ARM +# + +[Sources] + DebugPortProtocolInstallLib.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseMemoryLib + BaseLib + DebugLib + +[Protocols] + gEfiDebugPortProtocolGuid ## PRODUCES + +[Depex] + TRUE diff --git a/MsCorePkg/Library/DeviceBootManagerLibNull/DeviceBootManagerLibNull.inf b/MsCorePkg/Library/DeviceBootManagerLibNull/DeviceBootManagerLibNull.inf index b7c30173d2..4829336f17 100644 --- a/MsCorePkg/Library/DeviceBootManagerLibNull/DeviceBootManagerLibNull.inf +++ b/MsCorePkg/Library/DeviceBootManagerLibNull/DeviceBootManagerLibNull.inf @@ -1,47 +1,47 @@ -## @file -## Device specific actions in support of PlatformBootManagerLib -## -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] -EDK_RELEASE_VERSION = 0x00020000 -INF_VERSION = 0x00010017 -BASE_NAME = DeviceBootManagerLib -FILE_GUID = f3f98f57-f4b5-43ab-82d7-8931c68b55cc -VERSION_STRING = 1.0 -MODULE_TYPE = DXE_DRIVER -UEFI_SPECIFICATION_VERSION = 2.7 -LIBRARY_CLASS = DeviceBootManagerLib|DXE_DRIVER -CONSTRUCTOR = DeviceBootManagerConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - DeviceBootManagerLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - -[Protocols] - -[Guids] - -[FeaturePcd] - -[Pcd] - -[Depex] -TRUE - -#[BuildOptions] -# MSFT:*_*_*_CC_FLAGS = /FAcs +## @file +## Device specific actions in support of PlatformBootManagerLib +## +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] +EDK_RELEASE_VERSION = 0x00020000 +INF_VERSION = 0x00010017 +BASE_NAME = DeviceBootManagerLib +FILE_GUID = f3f98f57-f4b5-43ab-82d7-8931c68b55cc +VERSION_STRING = 1.0 +MODULE_TYPE = DXE_DRIVER +UEFI_SPECIFICATION_VERSION = 2.7 +LIBRARY_CLASS = DeviceBootManagerLib|DXE_DRIVER +CONSTRUCTOR = DeviceBootManagerConstructor + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 EBC +# + +[Sources] + DeviceBootManagerLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + +[Protocols] + +[Guids] + +[FeaturePcd] + +[Pcd] + +[Depex] +TRUE + +#[BuildOptions] +# MSFT:*_*_*_CC_FLAGS = /FAcs diff --git a/MsCorePkg/Library/DeviceSpecificBusInfoLibNull/DeviceSpecificBusInfoLibNull.inf b/MsCorePkg/Library/DeviceSpecificBusInfoLibNull/DeviceSpecificBusInfoLibNull.inf index 0ce2bf84a2..e6bad3f9bb 100644 --- a/MsCorePkg/Library/DeviceSpecificBusInfoLibNull/DeviceSpecificBusInfoLibNull.inf +++ b/MsCorePkg/Library/DeviceSpecificBusInfoLibNull/DeviceSpecificBusInfoLibNull.inf @@ -1,25 +1,25 @@ -## @file -# DeviceSpecificBusInfo.inf -# -# Implements the DeviceSpecificBusInfoLib.h header to provide the CheckHardwareConnected.c file with -# the pci bus info for pci devices which the user wants to verify are connected at boot -# -## -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = DeviceSpecificBusInfoLibNull - FILE_GUID = 2284258C-0E2C-42B1-B8FF-B2EC1D7F139A - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = DeviceSpecificBusInfoLib - -[Sources] - DeviceSpecificBusInfoLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MsCorePkg/MsCorePkg.dec +## @file +# DeviceSpecificBusInfo.inf +# +# Implements the DeviceSpecificBusInfoLib.h header to provide the CheckHardwareConnected.c file with +# the pci bus info for pci devices which the user wants to verify are connected at boot +# +## +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = DeviceSpecificBusInfoLibNull + FILE_GUID = 2284258C-0E2C-42B1-B8FF-B2EC1D7F139A + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = DeviceSpecificBusInfoLib + +[Sources] + DeviceSpecificBusInfoLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MsCorePkg/MsCorePkg.dec diff --git a/MsCorePkg/Library/DxeCapsulePersistenceLib/DxeCapsulePersistenceLib.inf b/MsCorePkg/Library/DxeCapsulePersistenceLib/DxeCapsulePersistenceLib.inf index cd1dae2d09..a7f59b9c76 100644 --- a/MsCorePkg/Library/DxeCapsulePersistenceLib/DxeCapsulePersistenceLib.inf +++ b/MsCorePkg/Library/DxeCapsulePersistenceLib/DxeCapsulePersistenceLib.inf @@ -1,51 +1,51 @@ -## @file -# Library responsible for queuing and persisting capsule for the system -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = DxeCapsulePersistenceLib - FILE_GUID = 5DF18111-58AD-4273-B816-F2C8526140B6 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = CapsulePersistenceLib|DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - CapsulePersistence.h - CapsulePersistence.c - DxeCapsulePersistenceLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - CryptoPkg/CryptoPkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - PcdLib - DebugLib - BaseLib - PrintLib - BaseMemoryLib - MemoryAllocationLib - DevicePathLib - BaseCryptLib - -[Guids] - gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## GUID - gEfiFileSystemInfoGuid ## SOMETIMES_CONSUMES ## GUID - gEfiPartTypeSystemPartGuid ## SOMETIMES_CONSUMES ## GUID - -[Protocols] - gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES +## @file +# Library responsible for queuing and persisting capsule for the system +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = DxeCapsulePersistenceLib + FILE_GUID = 5DF18111-58AD-4273-B816-F2C8526140B6 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = CapsulePersistenceLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + CapsulePersistence.h + CapsulePersistence.c + DxeCapsulePersistenceLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + CryptoPkg/CryptoPkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + PcdLib + DebugLib + BaseLib + PrintLib + BaseMemoryLib + MemoryAllocationLib + DevicePathLib + BaseCryptLib + +[Guids] + gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## GUID + gEfiFileSystemInfoGuid ## SOMETIMES_CONSUMES ## GUID + gEfiPartTypeSystemPartGuid ## SOMETIMES_CONSUMES ## GUID + +[Protocols] + gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES diff --git a/MsCorePkg/Library/DxeCapsulePersistenceLib/ReadMe.md b/MsCorePkg/Library/DxeCapsulePersistenceLib/ReadMe.md index 352caf7f19..453a2ba6e5 100644 --- a/MsCorePkg/Library/DxeCapsulePersistenceLib/ReadMe.md +++ b/MsCorePkg/Library/DxeCapsulePersistenceLib/ReadMe.md @@ -1,13 +1,13 @@ -# Capsule Persistence Lib for PEI and DXE - -This is an implementation of CapsulePersistenceLib which is used to persist capsules using the EFI partition. - -It provides methods for: - -- Persisting a capsule across reset -- Retrieving all currently persisted capsules and deleting them -- Retrieving a specific persisted capsule -- Deleting a specific persisted capsule - -This library can be used without any sort of queue, by using a retrieve all method but, ideally, it -should be paired with `QueueLib`. +# Capsule Persistence Lib for PEI and DXE + +This is an implementation of CapsulePersistenceLib which is used to persist capsules using the EFI partition. + +It provides methods for: + +- Persisting a capsule across reset +- Retrieving all currently persisted capsules and deleting them +- Retrieving a specific persisted capsule +- Deleting a specific persisted capsule + +This library can be used without any sort of queue, by using a retrieve all method but, ideally, it +should be paired with `QueueLib`. diff --git a/MsCorePkg/Library/DxeDebugLibRouter/DxeDebugLibRouter.inf b/MsCorePkg/Library/DxeDebugLibRouter/DxeDebugLibRouter.inf index df5e8e6945..3749d591bb 100644 --- a/MsCorePkg/Library/DxeDebugLibRouter/DxeDebugLibRouter.inf +++ b/MsCorePkg/Library/DxeDebugLibRouter/DxeDebugLibRouter.inf @@ -1,56 +1,56 @@ -## @file -# Instance of Debug Library based on Serial Port Library. -# It uses Print Library to produce formatted output strings to serial port device. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeDebugLibRouter - MODULE_UNI_FILE = DxeDebugLibRouter.uni - FILE_GUID = 010e0da7-385b-4e82-a68d-5fd5eee4c577 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = DxeDebugLibConstructor - DESTRUCTOR = DxeDebugLibDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 ARM -# - -[Sources] - DxeDebugLibRouter.c - Serial/SerialDebugLib.c - ReportStatusCode/ReportStatusCodeDebugLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - SerialPortLib - ReportStatusCodeLib - BaseMemoryLib - PcdLib - PrintLib - BaseLib - DebugPrintErrorLevelLib - -[Protocols] - gMsSerialStatusCodeHandlerDxeProtocolGuid ## CONSUMES - -[Guids] - gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES ## GUID - gEfiEventExitBootServicesGuid ## CONSUMES ## GUID - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES - +## @file +# Instance of Debug Library based on Serial Port Library. +# It uses Print Library to produce formatted output strings to serial port device. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DxeDebugLibRouter + MODULE_UNI_FILE = DxeDebugLibRouter.uni + FILE_GUID = 010e0da7-385b-4e82-a68d-5fd5eee4c577 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = DxeDebugLibConstructor + DESTRUCTOR = DxeDebugLibDestructor + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 ARM +# + +[Sources] + DxeDebugLibRouter.c + Serial/SerialDebugLib.c + ReportStatusCode/ReportStatusCodeDebugLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + SerialPortLib + ReportStatusCodeLib + BaseMemoryLib + PcdLib + PrintLib + BaseLib + DebugPrintErrorLevelLib + +[Protocols] + gMsSerialStatusCodeHandlerDxeProtocolGuid ## CONSUMES + +[Guids] + gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES ## GUID + gEfiEventExitBootServicesGuid ## CONSUMES ## GUID + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES + diff --git a/MsCorePkg/Library/DxeDebugLibRouter/Feature_DebugRouting_Readme.md b/MsCorePkg/Library/DxeDebugLibRouter/Feature_DebugRouting_Readme.md index 8b884f8909..e7bca7ae03 100644 --- a/MsCorePkg/Library/DxeDebugLibRouter/Feature_DebugRouting_Readme.md +++ b/MsCorePkg/Library/DxeDebugLibRouter/Feature_DebugRouting_Readme.md @@ -1,80 +1,80 @@ -# Debugging with DxeDebugLibRouter - -## About - -### DxeDebugLibRouter - -The DxeDebugLibRouter is an implementation of DebugLib that routes the DebugPrint and -DebugAssert messages depending on what the platform is capable of and what has been set-up. - -In the example below we show how to use DxeDebugLibRouter to route debug messages through either -the serial interface or the report status code interface, depending on what protocols and -libraries are being used. - -### StatusCodeHandler - -If you wish to make use of the Report Status Code debugging feature you will need to set up a -status code handler and install the gMsSerialStatusCodeHandlerDxeProtocolGuid tag GUID. -The MsCorePkg version of StatusCodeHandler is setup to do this. - -### DebugPortProtocolInstallLib - -The DebugPortProtocolInstallLib is a shim library whose only purpose is to install a protocol -that points to the currently linked DebugLib being used by the module. -You can see how this is used in the DSC example shown below. - -### ReportStatusCodeRouter - -This library handles the routing of ReportStatusCode if the DxeDebugLibRouter is set-up to use -the ReportStatusCode debug path. -We have only implemented the serial output for report status code, but there are many ways you -can implement a RSC observer including - -* Serial Port Listener -* Save Debug To File System -* Save Debug To Memory -* ... - ---- - -## How To Use - -To make full use of the DxeDebugLibRouter each Dxe Driver will need to use the DebugPort -implementation of DebugLib to route their messages through the DxeDebugLibRouter. -The Flowchart below shows how this would work. - -To set up DxeCore to work as the router you will need to set up the DSC as below: - -```inf -[LibraryClasses.X64] -DebugLib|MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf - -[Components.X64] -MdeModulePkg/Core/Dxe/DxeMain.inf { - - NULL|MsCorePkg/Library/DebugPortProtocolInstallLib/DebugPortProtocolInstallLib.inf - DebugLib|MsCorePkg/Library/DxeDebugLibRouter/DxeDebugLibRouter.inf - } -``` - -## Debug Flow - -1. The NULL library responsible for publishing the DebugPort protocol is linked against DxeMain. - This allows the DebugLib used by Dxe drivers to locate the DebugLib used by Dxe Main - -2. Dxe Driver makes a DebugPrint which is routed to the DebugLib linked to DxeMain - -3. DebugLib routes the DebugPrint through either Serial or Report Status Code depending on what - is installed at the time - -4. This step can happen at any time. When the StatusCodeHandler is dispatched it installs a tag - GUID letting the DebugLib know that Report Status Code is now available - -![Debug Overview](DebugOverview_mu.png) - ---- - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Debugging with DxeDebugLibRouter + +## About + +### DxeDebugLibRouter + +The DxeDebugLibRouter is an implementation of DebugLib that routes the DebugPrint and +DebugAssert messages depending on what the platform is capable of and what has been set-up. + +In the example below we show how to use DxeDebugLibRouter to route debug messages through either +the serial interface or the report status code interface, depending on what protocols and +libraries are being used. + +### StatusCodeHandler + +If you wish to make use of the Report Status Code debugging feature you will need to set up a +status code handler and install the gMsSerialStatusCodeHandlerDxeProtocolGuid tag GUID. +The MsCorePkg version of StatusCodeHandler is setup to do this. + +### DebugPortProtocolInstallLib + +The DebugPortProtocolInstallLib is a shim library whose only purpose is to install a protocol +that points to the currently linked DebugLib being used by the module. +You can see how this is used in the DSC example shown below. + +### ReportStatusCodeRouter + +This library handles the routing of ReportStatusCode if the DxeDebugLibRouter is set-up to use +the ReportStatusCode debug path. +We have only implemented the serial output for report status code, but there are many ways you +can implement a RSC observer including + +* Serial Port Listener +* Save Debug To File System +* Save Debug To Memory +* ... + +--- + +## How To Use + +To make full use of the DxeDebugLibRouter each Dxe Driver will need to use the DebugPort +implementation of DebugLib to route their messages through the DxeDebugLibRouter. +The Flowchart below shows how this would work. + +To set up DxeCore to work as the router you will need to set up the DSC as below: + +```inf +[LibraryClasses.X64] +DebugLib|MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf + +[Components.X64] +MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MsCorePkg/Library/DebugPortProtocolInstallLib/DebugPortProtocolInstallLib.inf + DebugLib|MsCorePkg/Library/DxeDebugLibRouter/DxeDebugLibRouter.inf + } +``` + +## Debug Flow + +1. The NULL library responsible for publishing the DebugPort protocol is linked against DxeMain. + This allows the DebugLib used by Dxe drivers to locate the DebugLib used by Dxe Main + +2. Dxe Driver makes a DebugPrint which is routed to the DebugLib linked to DxeMain + +3. DebugLib routes the DebugPrint through either Serial or Report Status Code depending on what + is installed at the time + +4. This step can happen at any time. When the StatusCodeHandler is dispatched it installs a tag + GUID letting the DebugLib know that Report Status Code is now available + +![Debug Overview](DebugOverview_mu.png) + +--- + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsCorePkg/Library/DxeIsCapsuleSupportedLib/DxeIsCapsuleSupportedLib.inf b/MsCorePkg/Library/DxeIsCapsuleSupportedLib/DxeIsCapsuleSupportedLib.inf index 4a78050a70..a917b58250 100644 --- a/MsCorePkg/Library/DxeIsCapsuleSupportedLib/DxeIsCapsuleSupportedLib.inf +++ b/MsCorePkg/Library/DxeIsCapsuleSupportedLib/DxeIsCapsuleSupportedLib.inf @@ -1,50 +1,50 @@ -## @file -# Library for checking if Capsules are supported by the current firmware -# This includes some light validation and verification of the capsule -# structure. -# -# While this library says it is a RuntimeDriver, it will not work past the -# memory change. For its use case it assumes the capsule interface will lock -# at ExitBootServices. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeIsCapsuleSupportedLib - FILE_GUID = 12A8DFE6-F6EA-4746-8F71-2652D97210BC - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = IsCapsuleSupportedLib|DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - CapsuleSupported.c - CapsuleEsrtTableLayer.c - CapsuleEsrtTableLayer.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - FmpDevicePkg/FmpDevicePkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - BaseLib - BaseMemoryLib - UefiLib - -[Guids] - ## SOMETIMES_PRODUCES ## Variable:L"CapsuleXXXX.bin" # (Process across reset capsule image) for capsule updated data - gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID # FMP capsule GUID - gWindowsUxCapsuleGuid ## SOMETIMES_CONSUMES ## GUID +## @file +# Library for checking if Capsules are supported by the current firmware +# This includes some light validation and verification of the capsule +# structure. +# +# While this library says it is a RuntimeDriver, it will not work past the +# memory change. For its use case it assumes the capsule interface will lock +# at ExitBootServices. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DxeIsCapsuleSupportedLib + FILE_GUID = 12A8DFE6-F6EA-4746-8F71-2652D97210BC + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = IsCapsuleSupportedLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + CapsuleSupported.c + CapsuleEsrtTableLayer.c + CapsuleEsrtTableLayer.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + FmpDevicePkg/FmpDevicePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + DebugLib + BaseLib + BaseMemoryLib + UefiLib + +[Guids] + ## SOMETIMES_PRODUCES ## Variable:L"CapsuleXXXX.bin" # (Process across reset capsule image) for capsule updated data + gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID # FMP capsule GUID + gWindowsUxCapsuleGuid ## SOMETIMES_CONSUMES ## GUID diff --git a/MsCorePkg/Library/DxeIsCapsuleSupportedLib/ReadMe.md b/MsCorePkg/Library/DxeIsCapsuleSupportedLib/ReadMe.md index 9799bf622e..1d6d0ed7ba 100644 --- a/MsCorePkg/Library/DxeIsCapsuleSupportedLib/ReadMe.md +++ b/MsCorePkg/Library/DxeIsCapsuleSupportedLib/ReadMe.md @@ -1,12 +1,12 @@ -# DXE Is Capsule Supported Lib - -This library performs a sanity check to determine if a capsule is supported by the UEFI firmware. -It *does not* perform any sort of signature or hash. -In the case of nested capsules, there is stubbed out functionality to check if the ESRT table contains an entry -related to the nested capsule. - -## Why DXE_DRIVER Only - -This is called from the DXE_RUNTIME_DRIVER indirectly via the `CapsuleServiceProtocol`. -Because this is a DXE protocol and the Capsule Runtime service doesn't call the protocol after ExitBootServices, -this is safe. +# DXE Is Capsule Supported Lib + +This library performs a sanity check to determine if a capsule is supported by the UEFI firmware. +It *does not* perform any sort of signature or hash. +In the case of nested capsules, there is stubbed out functionality to check if the ESRT table contains an entry +related to the nested capsule. + +## Why DXE_DRIVER Only + +This is called from the DXE_RUNTIME_DRIVER indirectly via the `CapsuleServiceProtocol`. +Because this is a DXE protocol and the Capsule Runtime service doesn't call the protocol after ExitBootServices, +this is safe. diff --git a/MsCorePkg/Library/DxeQueueUefiVariableLib/DxeQueueUefiVariableLib.inf b/MsCorePkg/Library/DxeQueueUefiVariableLib/DxeQueueUefiVariableLib.inf index 624b1317d8..0f665f0899 100644 --- a/MsCorePkg/Library/DxeQueueUefiVariableLib/DxeQueueUefiVariableLib.inf +++ b/MsCorePkg/Library/DxeQueueUefiVariableLib/DxeQueueUefiVariableLib.inf @@ -1,43 +1,43 @@ -## @file -# Library responsible for managing a queue stored in the variable store -# Since each entry in the queue is backed by the store, every write/modification -# to the queue could potentially be quite expensive in terms of flash space. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = DxeQueueUefiVariableLib - FILE_GUID = DBF71409-0585-4A22-BCF6-636FEECC6300 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = QueueLib|DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 -# - -[Sources] - DxeQueueUefiVariableLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - PcdLib - DebugLib - UefiRuntimeServicesTableLib - BaseLib - PrintLib - BaseMemoryLib - MemoryAllocationLib - -[Depex] - gEfiVariableWriteArchProtocolGuid # Depends on variable write functionality to produce capsule data variable +## @file +# Library responsible for managing a queue stored in the variable store +# Since each entry in the queue is backed by the store, every write/modification +# to the queue could potentially be quite expensive in terms of flash space. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = DxeQueueUefiVariableLib + FILE_GUID = DBF71409-0585-4A22-BCF6-636FEECC6300 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = QueueLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + DxeQueueUefiVariableLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + PcdLib + DebugLib + UefiRuntimeServicesTableLib + BaseLib + PrintLib + BaseMemoryLib + MemoryAllocationLib + +[Depex] + gEfiVariableWriteArchProtocolGuid # Depends on variable write functionality to produce capsule data variable diff --git a/MsCorePkg/Library/DxeQueueUefiVariableLib/ReadMe.md b/MsCorePkg/Library/DxeQueueUefiVariableLib/ReadMe.md index bfd8d2d6fa..fbd86bddde 100644 --- a/MsCorePkg/Library/DxeQueueUefiVariableLib/ReadMe.md +++ b/MsCorePkg/Library/DxeQueueUefiVariableLib/ReadMe.md @@ -1,6 +1,6 @@ -# DXE Queue UEFI Variable Lib - -This is an implementation of QueueLib backed by the UEFI variable store. - -Because the queue has manipulation functions, this does not support PEI as the variable -services in PEI are usually read only. +# DXE Queue UEFI Variable Lib + +This is an implementation of QueueLib backed by the UEFI variable store. + +Because the queue has manipulation functions, this does not support PEI as the variable +services in PEI are usually read only. diff --git a/MsCorePkg/Library/ExceptionPersistenceLibCmos/ExceptionPersistenceLibCmos.inf b/MsCorePkg/Library/ExceptionPersistenceLibCmos/ExceptionPersistenceLibCmos.inf index bbcc3055dc..8a3f7e8cf7 100644 --- a/MsCorePkg/Library/ExceptionPersistenceLibCmos/ExceptionPersistenceLibCmos.inf +++ b/MsCorePkg/Library/ExceptionPersistenceLibCmos/ExceptionPersistenceLibCmos.inf @@ -1,32 +1,32 @@ -## @file ExceptionPersistenceLibCmos.inf -# -# CMOS Implementation of ExceptionPersistenceLib -# -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ExceptionPersistenceLibCmos - FILE_GUID = 8e991a09-1d4d-4747-bf6a-4dc22d11978d - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ExceptionPersistenceLib - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - ExceptionPersistenceLibCmos.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - -[LibraryClasses] - IoLib - BaseLib +## @file ExceptionPersistenceLibCmos.inf +# +# CMOS Implementation of ExceptionPersistenceLib +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ExceptionPersistenceLibCmos + FILE_GUID = 8e991a09-1d4d-4747-bf6a-4dc22d11978d + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ExceptionPersistenceLib + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + ExceptionPersistenceLibCmos.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + IoLib + BaseLib diff --git a/MsCorePkg/Library/ExceptionPersistenceLibCmos/Readme.md b/MsCorePkg/Library/ExceptionPersistenceLibCmos/Readme.md index 28da16f116..97c735e6e6 100644 --- a/MsCorePkg/Library/ExceptionPersistenceLibCmos/Readme.md +++ b/MsCorePkg/Library/ExceptionPersistenceLibCmos/Readme.md @@ -1,19 +1,19 @@ -# ExceptionPersistenceLib - -## About - -ExceptionPersistenceLib implements functionality for getting, setting, and clearing exception info to/from -platform-specific early store. All functions return an EFI_ERROR if the function was -unsuccessful. The validity of the data stored in CMOS is verified through the use of a two-byte checksum. -Sets/Gets/Clears will first evaluate the checksum and return an EFI_ERROR if it is invalid. Sets/Gets/Clears will -also write and read a test value to CMOS to make sure the library is working as expected which also should catch -instances where the library was linked improperly. - -## Usage - -ExceptionPersistenceLib is a BASE library and can be included under [LibraryClasses]. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# ExceptionPersistenceLib + +## About + +ExceptionPersistenceLib implements functionality for getting, setting, and clearing exception info to/from +platform-specific early store. All functions return an EFI_ERROR if the function was +unsuccessful. The validity of the data stored in CMOS is verified through the use of a two-byte checksum. +Sets/Gets/Clears will first evaluate the checksum and return an EFI_ERROR if it is invalid. Sets/Gets/Clears will +also write and read a test value to CMOS to make sure the library is working as expected which also should catch +instances where the library was linked improperly. + +## Usage + +ExceptionPersistenceLib is a BASE library and can be included under [LibraryClasses]. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsCorePkg/Library/MathLib/MathLib.inf b/MsCorePkg/Library/MathLib/MathLib.inf index 09d691ab62..2185a20532 100644 --- a/MsCorePkg/Library/MathLib/MathLib.inf +++ b/MsCorePkg/Library/MathLib/MathLib.inf @@ -1,38 +1,38 @@ -# @file -# MathLib - -#This library supports math operations such as Square Root, Cosine, and Sine - -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent - - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MathLib - FILE_GUID = 485F46E6-7E5D-4E05-BDBE-CBBAE5E7EFB7 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MathLib - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MathLib.c - -[Packages] - MsCorePkg/MsCorePkg.dec - MdePkg/MdePkg.dec - -[LibraryClasses] - FltUsedLib - -[Protocols] - -[Guids] - -[BuildOptions] -# Need to use floats in this library. Got rid of -mgeneral-regs-only to do so. +# @file +# MathLib + +#This library supports math operations such as Square Root, Cosine, and Sine + +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent + + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MathLib + FILE_GUID = 485F46E6-7E5D-4E05-BDBE-CBBAE5E7EFB7 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MathLib + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MathLib.c + +[Packages] + MsCorePkg/MsCorePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + FltUsedLib + +[Protocols] + +[Guids] + +[BuildOptions] +# Need to use floats in this library. Got rid of -mgeneral-regs-only to do so. GCC:*_*_AARCH64_CC_XIPFLAGS == -mstrict-align \ No newline at end of file diff --git a/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf b/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf index 44d48b3124..b17aec94a1 100644 --- a/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf +++ b/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf @@ -1,53 +1,53 @@ -## @file -# Library registers an interrupt handler which catches exceptions related to memory -# protections and turns them off for the next boot. -# -# -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MemoryProtectionExceptionHandlerLib - FILE_GUID = 079cc3b7-a618-4024-8cc5-a36480df9261 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL - CONSTRUCTOR = MemoryProtectionExceptionHandlerConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemoryProtectionExceptionHandlerLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - CpuExceptionHandlerLib - DebugLib - UefiBootServicesTableLib - DxeMemoryProtectionHobLib - ExceptionPersistenceLib - HwResetSystemLib - MsWheaEarlyStorageLib - PeCoffGetEntryPointLib - -[Guids] - gMemoryProtectionExceptionHandlerGuid ## PRODUCES - -[Protocols] - gMemoryProtectionNonstopModeProtocolGuid ## CONSUMES - -[Guids] - gMemoryProtectionExceptionHandlerGuid - -[DEPEX] - TRUE +## @file +# Library registers an interrupt handler which catches exceptions related to memory +# protections and turns them off for the next boot. +# +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MemoryProtectionExceptionHandlerLib + FILE_GUID = 079cc3b7-a618-4024-8cc5-a36480df9261 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NULL + CONSTRUCTOR = MemoryProtectionExceptionHandlerConstructor + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MemoryProtectionExceptionHandlerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + CpuExceptionHandlerLib + DebugLib + UefiBootServicesTableLib + DxeMemoryProtectionHobLib + ExceptionPersistenceLib + HwResetSystemLib + MsWheaEarlyStorageLib + PeCoffGetEntryPointLib + +[Guids] + gMemoryProtectionExceptionHandlerGuid ## PRODUCES + +[Protocols] + gMemoryProtectionNonstopModeProtocolGuid ## CONSUMES + +[Guids] + gMemoryProtectionExceptionHandlerGuid + +[DEPEX] + TRUE diff --git a/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/Readme.md b/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/Readme.md index aa4b618402..004027ccec 100644 --- a/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/Readme.md +++ b/MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/Readme.md @@ -1,21 +1,21 @@ -# MemoryProtectionExceptionHandlerLib - -## About - -If memory protections are on, MemoryProtectionExceptionHandlerLib registers an exception handler which -uses platform early store to log the page fault. - -## Usage - -To use this library, make MemoryProtectionExceptionHandlerLib a null library for a -module such as CpuDxe: - -```C -UefiCpuPkg\CpuDxe\CpuDxe.inf { - -NULL|MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf -} -``` - -CpuDxe is preferable because the page fault exception handler is only registered after -gEfiCpuArchProtocolGuid has been installed. +# MemoryProtectionExceptionHandlerLib + +## About + +If memory protections are on, MemoryProtectionExceptionHandlerLib registers an exception handler which +uses platform early store to log the page fault. + +## Usage + +To use this library, make MemoryProtectionExceptionHandlerLib a null library for a +module such as CpuDxe: + +```C +UefiCpuPkg\CpuDxe\CpuDxe.inf { + +NULL|MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf +} +``` + +CpuDxe is preferable because the page fault exception handler is only registered after +gEfiCpuArchProtocolGuid has been installed. diff --git a/MsCorePkg/Library/MemoryTypeInformationChangeLib/MemoryTypeInformationChangeLib.inf b/MsCorePkg/Library/MemoryTypeInformationChangeLib/MemoryTypeInformationChangeLib.inf index d54faa0b94..14ad869f33 100644 --- a/MsCorePkg/Library/MemoryTypeInformationChangeLib/MemoryTypeInformationChangeLib.inf +++ b/MsCorePkg/Library/MemoryTypeInformationChangeLib/MemoryTypeInformationChangeLib.inf @@ -1,29 +1,29 @@ -## @file MemoryTypeInformationChangeLib.inf -# Reports the memory type information change as a telemetry event. -## -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MemoryTypeInformationChangeLib - FILE_GUID = 6884A444-8A1D-4812-AB91-601B0FE3BBEA - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = MemoryTypeInformationChangeLib - - -[Sources] - MemoryTypeInformationChangeLib.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - MsWheaPkg/MsWheaPkg.dec - - -[LibraryClasses] - BaseLib - MuTelemetryHelperLib +## @file MemoryTypeInformationChangeLib.inf +# Reports the memory type information change as a telemetry event. +## +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MemoryTypeInformationChangeLib + FILE_GUID = 6884A444-8A1D-4812-AB91-601B0FE3BBEA + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = MemoryTypeInformationChangeLib + + +[Sources] + MemoryTypeInformationChangeLib.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + MsWheaPkg/MsWheaPkg.dec + + +[LibraryClasses] + BaseLib + MuTelemetryHelperLib diff --git a/MsCorePkg/Library/MuSecureBootKeySelectorLib/MuSecureBootKeySelectorLib.inf b/MsCorePkg/Library/MuSecureBootKeySelectorLib/MuSecureBootKeySelectorLib.inf index 847e63507e..bbc2b153b2 100644 --- a/MsCorePkg/Library/MuSecureBootKeySelectorLib/MuSecureBootKeySelectorLib.inf +++ b/MsCorePkg/Library/MuSecureBootKeySelectorLib/MuSecureBootKeySelectorLib.inf @@ -1,46 +1,46 @@ -## @file MuSecureBootKeySelectorLib.inf -# -# This library implements functions to interact with platform supplied -# secure boot related keys through SecureBootKeyStoreLib. -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MuSecureBootKeySelectorLib - FILE_GUID = CFDAC736-EB80-4227-8BB2-4A5C2ECAE119 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MuSecureBootKeySelectorLib | DXE_DRIVER UEFI_APPLICATION - -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - MuSecureBootKeySelectorLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - SecurityPkg/SecurityPkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - DebugLib - SecureBootVariableLib - UefiBootServicesTableLib - SecureBootKeyStoreLib - -[Protocols] - gEfiRealTimeClockArchProtocolGuid # SOMETIMES_CONSUMES - gEdkiiVariablePolicyProtocolGuid # CONSUMES - -[Guids] - gEfiGlobalVariableGuid # CONSUMES - gEfiImageSecurityDatabaseGuid # CONSUMES - -[Depex] - gEdkiiVariablePolicyProtocolGuid +## @file MuSecureBootKeySelectorLib.inf +# +# This library implements functions to interact with platform supplied +# secure boot related keys through SecureBootKeyStoreLib. +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MuSecureBootKeySelectorLib + FILE_GUID = CFDAC736-EB80-4227-8BB2-4A5C2ECAE119 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MuSecureBootKeySelectorLib | DXE_DRIVER UEFI_APPLICATION + +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + MuSecureBootKeySelectorLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + SecurityPkg/SecurityPkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + DebugLib + SecureBootVariableLib + UefiBootServicesTableLib + SecureBootKeyStoreLib + +[Protocols] + gEfiRealTimeClockArchProtocolGuid # SOMETIMES_CONSUMES + gEdkiiVariablePolicyProtocolGuid # CONSUMES + +[Guids] + gEfiGlobalVariableGuid # CONSUMES + gEfiImageSecurityDatabaseGuid # CONSUMES + +[Depex] + gEdkiiVariablePolicyProtocolGuid diff --git a/MsCorePkg/Library/PeiDebugLib/PeiDebugLib.inf b/MsCorePkg/Library/PeiDebugLib/PeiDebugLib.inf index db615ecd39..33eb1c8434 100644 --- a/MsCorePkg/Library/PeiDebugLib/PeiDebugLib.inf +++ b/MsCorePkg/Library/PeiDebugLib/PeiDebugLib.inf @@ -1,63 +1,63 @@ -### @file -# Debug Library to be used with DebugPortPEI library -# Routes all DebugPrint and DebugAssert calls through PPI -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# Copyright (C) 2013 - 2015, Intel Corporation. All rights reserved.
-# This software and associated documentation (if any) is furnished -# under a license and may only be used or copied in accordance with -# the terms of the license. Except as permitted by the license, no -# part of this software or documentation may be reproduced, stored in -# a retrieval system, or transmitted in any form or by any means -# without the express written consent of Intel Corporation. -# This file contains 'Framework Code' and is licensed as such under -# the terms of your license agreement with Intel or your vendor. This -# file may not be modified, except as allowed by additional terms of -# your license agreement. -# -# @par Specification Reference: -# -# @par Glossary: -### - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = PeiDebugLib - FILE_GUID = 8ec54b67-63ed-418a-b845-06ef1297499f - VERSION_STRING = 1.0 - MODULE_TYPE = PEIM - LIBRARY_CLASS = DebugLib|PEIM -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[LibraryClasses] - PcdLib - ReportStatusCodeLib - BaseMemoryLib - BaseLib - DebugPrintErrorLevelLib - PeiServicesLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask - gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel - -[Sources] - DebugLib.c - -[Ppis] - gDebugPortPpiGuid ## SOMETIMES_CONSUMES - -[Depex] - gDebugPortPpiGuid - +### @file +# Debug Library to be used with DebugPortPEI library +# Routes all DebugPrint and DebugAssert calls through PPI +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Copyright (C) 2013 - 2015, Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished +# under a license and may only be used or copied in accordance with +# the terms of the license. Except as permitted by the license, no +# part of this software or documentation may be reproduced, stored in +# a retrieval system, or transmitted in any form or by any means +# without the express written consent of Intel Corporation. +# This file contains 'Framework Code' and is licensed as such under +# the terms of your license agreement with Intel or your vendor. This +# file may not be modified, except as allowed by additional terms of +# your license agreement. +# +# @par Specification Reference: +# +# @par Glossary: +### + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = PeiDebugLib + FILE_GUID = 8ec54b67-63ed-418a-b845-06ef1297499f + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + LIBRARY_CLASS = DebugLib|PEIM +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[LibraryClasses] + PcdLib + ReportStatusCodeLib + BaseMemoryLib + BaseLib + DebugPrintErrorLevelLib + PeiServicesLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel + +[Sources] + DebugLib.c + +[Ppis] + gDebugPortPpiGuid ## SOMETIMES_CONSUMES + +[Depex] + gDebugPortPpiGuid + diff --git a/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 8336d7b0a0..e8b4faf8d6 100644 --- a/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -1,84 +1,84 @@ -/** @file - *PlatformBootManager - Ms Extensions to BdsDxe. - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - - -[Defines] -INF_VERSION = 0x00010018 -BASE_NAME = PlatformBootManagerLib -FILE_GUID = df8f3324-5448-46bc-872c-be198ecf2f76 -VERSION_STRING = 1.0 -MODULE_TYPE = DXE_DRIVER -UEFI_SPECIFICATION_VERSION = 2.7 -LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER -CONSTRUCTOR = PlatformBootManagerEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 EBC -# - -[Sources] - BdsPlatform.c - BdsPlatform.h - MemoryTest.c - MsPlatform.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - SecurityPkg/SecurityPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - CapsuleLib - DebugLib - DeviceBootManagerLib - DevicePathLib - DxeServicesTableLib - HobLib - MemoryAllocationLib - PcdLib - PerformanceLib - UefiBootManagerLib - UefiBootServicesTableLib - UefiLib - UefiRuntimeServicesTableLib - -[Protocols] - gEfiPciRootBridgeIoProtocolGuid ## CONSUMES - gEfiDxeSmmReadyToLockProtocolGuid ## PRODUCES - gEfiGenericMemTestProtocolGuid ## CONSUMES - gEfiAbsolutePointerProtocolGuid ## CONSUMES - -[Guids] - gEfiCapsuleVendorGuid - gEfiEndOfDxeEventGroupGuid - gEfiGlobalVariableGuid - gEfiMemoryOverwriteControlDataGuid - gMuReadyToProcessCapsulesNotifyGuid ## PRODUCES - -[FeaturePcd] - -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile - gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand - gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn - gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow - gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed - gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution - gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution - gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType - -[Depex.common.DXE_DRIVER] - gEfiVariableArchProtocolGuid - -#[BuildOptions] -# MSFT:*_*_*_CC_FLAGS = /FAcs +/** @file + *PlatformBootManager - Ms Extensions to BdsDxe. + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +[Defines] +INF_VERSION = 0x00010018 +BASE_NAME = PlatformBootManagerLib +FILE_GUID = df8f3324-5448-46bc-872c-be198ecf2f76 +VERSION_STRING = 1.0 +MODULE_TYPE = DXE_DRIVER +UEFI_SPECIFICATION_VERSION = 2.7 +LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER +CONSTRUCTOR = PlatformBootManagerEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 EBC +# + +[Sources] + BdsPlatform.c + BdsPlatform.h + MemoryTest.c + MsPlatform.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + SecurityPkg/SecurityPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + CapsuleLib + DebugLib + DeviceBootManagerLib + DevicePathLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + PcdLib + PerformanceLib + UefiBootManagerLib + UefiBootServicesTableLib + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiPciRootBridgeIoProtocolGuid ## CONSUMES + gEfiDxeSmmReadyToLockProtocolGuid ## PRODUCES + gEfiGenericMemTestProtocolGuid ## CONSUMES + gEfiAbsolutePointerProtocolGuid ## CONSUMES + +[Guids] + gEfiCapsuleVendorGuid + gEfiEndOfDxeEventGroupGuid + gEfiGlobalVariableGuid + gEfiMemoryOverwriteControlDataGuid + gMuReadyToProcessCapsulesNotifyGuid ## PRODUCES + +[FeaturePcd] + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile + gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow + gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType + +[Depex.common.DXE_DRIVER] + gEfiVariableArchProtocolGuid + +#[BuildOptions] +# MSFT:*_*_*_CC_FLAGS = /FAcs diff --git a/MsCorePkg/Library/SecureBootKeyStoreLibNull/SecureBootKeyStoreLibNull.inf b/MsCorePkg/Library/SecureBootKeyStoreLibNull/SecureBootKeyStoreLibNull.inf index a7890abf8e..725e0e01b4 100644 --- a/MsCorePkg/Library/SecureBootKeyStoreLibNull/SecureBootKeyStoreLibNull.inf +++ b/MsCorePkg/Library/SecureBootKeyStoreLibNull/SecureBootKeyStoreLibNull.inf @@ -1,25 +1,25 @@ -## @file - SecureBootKeyStoreLibNull.inf -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SecureBootKeyStoreLibNull - FILE_GUID = 368739AF-8617-4923-905E-D55198F87E34 - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = SecureBootKeyStoreLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Packages] - MdePkg/MdePkg.dec - SecurityPkg/SecurityPkg.dec - -[Sources] - SecureBootKeyStoreLibNull.c +## @file - SecureBootKeyStoreLibNull.inf +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SecureBootKeyStoreLibNull + FILE_GUID = 368739AF-8617-4923-905E-D55198F87E34 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = SecureBootKeyStoreLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Packages] + MdePkg/MdePkg.dec + SecurityPkg/SecurityPkg.dec + +[Sources] + SecureBootKeyStoreLibNull.c diff --git a/MsCorePkg/Library/TpmSgNvIndexLib/TpmSgNvIndexLib.inf b/MsCorePkg/Library/TpmSgNvIndexLib/TpmSgNvIndexLib.inf index 25799d1069..d763be9a6a 100644 --- a/MsCorePkg/Library/TpmSgNvIndexLib/TpmSgNvIndexLib.inf +++ b/MsCorePkg/Library/TpmSgNvIndexLib/TpmSgNvIndexLib.inf @@ -1,35 +1,35 @@ -## -# @file Library to create SystemGuard NV Index consumed by OS -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = TpmSgNvIndexLib - FILE_GUID = 08D9C2BF-DEC4-46D4-B29D-06D26B44D902 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = TpmSgNvIndexLib - -# -# The following information is for reference only and not required by the build -# tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - TpmSgNvIndexLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - SecurityPkg/SecurityPkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - Tpm2CommandLib +## +# @file Library to create SystemGuard NV Index consumed by OS +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = TpmSgNvIndexLib + FILE_GUID = 08D9C2BF-DEC4-46D4-B29D-06D26B44D902 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = TpmSgNvIndexLib + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + TpmSgNvIndexLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + SecurityPkg/SecurityPkg.dec + +[LibraryClasses] + DebugLib + BaseMemoryLib + Tpm2CommandLib diff --git a/MsCorePkg/MsCorePkg.dec b/MsCorePkg/MsCorePkg.dec index 4f895d9e12..29db2bc93c 100644 --- a/MsCorePkg/MsCorePkg.dec +++ b/MsCorePkg/MsCorePkg.dec @@ -1,139 +1,139 @@ -## @file MsCorePkg.dec -# This Package provides all definitions, library classes and libraries instances for MsCore. -# MsCore is common code used in the Microsoft UEFI Core code base -# This is targetted at promoting to open source and should be aligned with -# Tianocore standards -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = MsCorePkg - PACKAGE_UNI_FILE = MsCorePkg.uni - PACKAGE_GUID = C5278380-3276-469B-AE19-C840440367C5 - PACKAGE_VERSION = 0.10 - - -[Includes] - Include - -[LibraryClasses] - - MathLib|Include/Library/MathLib.h - - ## @libraryclass Provides the device/family subset of Uefi PlatformBootManagerLib - # - DeviceBootManagerLib|Include/Library/DeviceBootManagerLib.h - - ## @libraryclass Provides PCI device info to CheckHardwareConnected - # - DeviceSpecificBusInfoLib|Include/Library/DeviceSpecificBusInfoLib.h - - ## @libraryclass Provides the methods for storing the password - # - PasswordStoreLib|Include/Library/PasswordStoreLib.h - - ## @libraryclass provides support for simple json parsing - # - JsonLiteParserLib|Include/Library/JsonLiteParser.h - - ## @libraryclass provides interfaces to define NV index for SystemGuard. - TpmSgNvIndexLib|Include/Library/TpmSgNvIndexLib.h - - ## @libraryclass Provides support for a queue system - # - QueueLib|Include/Library/QueueLib.h - - ## @libraryclass Supports storing capsule updates in EFI partition - # - CapsulePersistenceLib|Include/Library/CapsulePersistenceLib.h - - ## @libraryclass Provides support for checking if persisted capsule is supported - # - IsCapsuleSupportedLib|Include/Library/IsCapsuleSupportedLib.h - - ## @libraryclass Provides key stores initialized by platforms - # - SecureBootKeyStoreLib|Include/Library/SecureBootKeyStoreLib.h - - ## @libraryclass Provides support for selecting from provided key store or inspecting currently selected key - # - MuSecureBootKeySelectorLib|Include/Library/MuSecureBootKeySelectorLib.h - - ## @libraryclass Supports updating the FACS Hardware Signature - # - UpdateFacsHardwareSignatureLib|Include/Library/UpdateFacsHardwareSignatureLib.h - -[Guids] - # {a2966407-1f6b-4c86-b21e-fcc474c6f28e} - gMsCorePkgTokenSpaceGuid = { 0xa2966407, 0x1f6b, 0x4c86, { 0xb2, 0x1e, 0xfc, 0xc4, 0x74, 0xc6, 0xf2, 0x8e }} - - ## Variable namespace GUID for the DXE phase variables. - # {ECF590C6-F8F9-4387-8422-486E3CCD8B20} - gMuVarPolicyDxePhaseGuid = { 0xecf590c6, 0xf8f9, 0x4387, { 0x84, 0x22, 0x48, 0x6e, 0x3c, 0xcd, 0x8b, 0x20 }} - - ## Variable namespace GUID for write-once, single-byte variables, specifically to be used for VarState policies. - # {6A85A0B9-3C08-4585-AC1F-8ED221CF059F} - gMuVarPolicyWriteOnceStateVarGuid = { 0x6a85a0b9, 0x3c08, 0x4585, { 0xac, 0x1f, 0x8e, 0xd2, 0x21, 0xcf, 0x05, 0x9f }} - - ## DeviceSpecificBusInfo Library Guid - # - gDeviceSpecificBusInfoLibTelemetryGuid = {0x3b82283d, 0x71dd, 0x4c61, {0xad, 0x2b, 0x51, 0x9b, 0x8d, 0x7b, 0x77, 0xc9}} - - ## HOB Guid for DebugFileLogger - gMuDebugLoggerGuid = {0x1c842fbb, 0x1e63, 0x432c, { 0xa1, 0xa9, 0x8a, 0x81, 0x27, 0xf1, 0x2d, 0x47 }} - - ## Event notification that capsules can be processed - # { 2AB1C860-E697-4EDE-8C0F-65CD6E444435 } - gMuReadyToProcessCapsulesNotifyGuid = { 0x2AB1C860, 0xE697, 0x4EDE, {0x8C, 0x0F, 0x65, 0xCD, 0x6E, 0x44, 0x44, 0x35}} - - ## Capsule Queue UEFI variable GUID - # {3c3ab3b3-bf9e-4a7f-a34f-519914f9a158} - # - # Used for storing capsule queue information via UEFI variable - gCapsuleQueueDataGuid = {0x3c3ab3b3, 0xbf9e, 0x4a7f, {0xa3, 0x4f, 0x51, 0x99, 0x14, 0xf9, 0xa1, 0x58}} - - ## MemoryProtectionExceptionHandler GUID for exception handler installation - # {61BDAF9E-67CB-40CD-A942-A3E3D0B973B2} - gMemoryProtectionExceptionHandlerGuid = {0x61BDAF9E, 0x67CB, 0x40CD, {0xA9, 0x42, 0xA3, 0xE3, 0xD0, 0xB9, 0x73, 0xB2 }} - -[Ppis] - gDebugPortPpiGuid = { 0x9d83f2d1, 0x9832, 0x4ded, { 0xaf, 0x78, 0x0e, 0xfe, 0x93, 0x07, 0xe8, 0xb1 }} - - -[Protocols] - ## Mu Crypto Pkcs7 protocol - # - gMuPKCS7ProtocolGuid = { 0x93cdb916, 0x7608, 0x4f1f, { 0xb5, 0x16, 0xc, 0x61, 0xbb, 0x24, 0x5c, 0x4f }} - - ## Mu Crypto PKCS5 Password Hashing Protocol - # - gMuPKCS5PasswordHashProtocolGuid = { 0x959b7ec7, 0x1857, 0x4551, { 0xaa, 0xfb, 0x1b, 0x7a, 0xe9, 0x48, 0x20, 0x2d }} - - ## Microsoft DXE Serial Status Code Handler Protocol GUID - ## - gMsSerialStatusCodeHandlerDxeProtocolGuid = { 0xa5065ca9, 0x5425, 0x4847, { 0x80, 0x8c, 0x5, 0x60, 0x18, 0x77, 0xa, 0xeb }} - - ## Capsule service protocol published by CapsuleServiceProtocol - # {D2A5D76F-F648-45A5-8B25-4601F3750C28} - # - gCapsuleServiceProtocolGuid = { 0xD2A5D76F, 0xF648, 0x45A5, {0x8B, 0x25, 0x46, 0x01, 0xF3, 0x75, 0x0C, 0x28}} - -[PcdsFeatureFlag] - -[PcdsFixedAtBuild] - - ## Define a GUID for the regulatory graphics ACPI Table - gMsCorePkgTokenSpaceGuid.PcdRegulatoryGraphicFileGuid|{ 0x7B, 0x35, 0x39, 0x36, 0xD7, 0xB3, 0x23, 0x4C, 0x20, 0x9A, 0x0B, 0x74, 0x91, 0xD5, 0x70, 0xCE }|VOID*|0x00010177 - - ## Number of pages (EFI_PAGE_SIZE) to allocate in the EFI partition for each file log - ## Default: 1024 * 4KiB = 4MB - gMsCorePkgTokenSpaceGuid.PcdDebugFileLoggerAllocatedPages|1024|UINT32|0x4000001C - -[PcdsDynamic, PcdsDynamicEx] - gMsCorePkgTokenSpaceGuid.PcdDeviceStateBitmask|0x00000000|UINT32|0x00010178 - -[UserExtensions.TianoCore."ExtraFiles"] - MsCorePkgExtra.uni +## @file MsCorePkg.dec +# This Package provides all definitions, library classes and libraries instances for MsCore. +# MsCore is common code used in the Microsoft UEFI Core code base +# This is targetted at promoting to open source and should be aligned with +# Tianocore standards +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = MsCorePkg + PACKAGE_UNI_FILE = MsCorePkg.uni + PACKAGE_GUID = C5278380-3276-469B-AE19-C840440367C5 + PACKAGE_VERSION = 0.10 + + +[Includes] + Include + +[LibraryClasses] + + MathLib|Include/Library/MathLib.h + + ## @libraryclass Provides the device/family subset of Uefi PlatformBootManagerLib + # + DeviceBootManagerLib|Include/Library/DeviceBootManagerLib.h + + ## @libraryclass Provides PCI device info to CheckHardwareConnected + # + DeviceSpecificBusInfoLib|Include/Library/DeviceSpecificBusInfoLib.h + + ## @libraryclass Provides the methods for storing the password + # + PasswordStoreLib|Include/Library/PasswordStoreLib.h + + ## @libraryclass provides support for simple json parsing + # + JsonLiteParserLib|Include/Library/JsonLiteParser.h + + ## @libraryclass provides interfaces to define NV index for SystemGuard. + TpmSgNvIndexLib|Include/Library/TpmSgNvIndexLib.h + + ## @libraryclass Provides support for a queue system + # + QueueLib|Include/Library/QueueLib.h + + ## @libraryclass Supports storing capsule updates in EFI partition + # + CapsulePersistenceLib|Include/Library/CapsulePersistenceLib.h + + ## @libraryclass Provides support for checking if persisted capsule is supported + # + IsCapsuleSupportedLib|Include/Library/IsCapsuleSupportedLib.h + + ## @libraryclass Provides key stores initialized by platforms + # + SecureBootKeyStoreLib|Include/Library/SecureBootKeyStoreLib.h + + ## @libraryclass Provides support for selecting from provided key store or inspecting currently selected key + # + MuSecureBootKeySelectorLib|Include/Library/MuSecureBootKeySelectorLib.h + + ## @libraryclass Supports updating the FACS Hardware Signature + # + UpdateFacsHardwareSignatureLib|Include/Library/UpdateFacsHardwareSignatureLib.h + +[Guids] + # {a2966407-1f6b-4c86-b21e-fcc474c6f28e} + gMsCorePkgTokenSpaceGuid = { 0xa2966407, 0x1f6b, 0x4c86, { 0xb2, 0x1e, 0xfc, 0xc4, 0x74, 0xc6, 0xf2, 0x8e }} + + ## Variable namespace GUID for the DXE phase variables. + # {ECF590C6-F8F9-4387-8422-486E3CCD8B20} + gMuVarPolicyDxePhaseGuid = { 0xecf590c6, 0xf8f9, 0x4387, { 0x84, 0x22, 0x48, 0x6e, 0x3c, 0xcd, 0x8b, 0x20 }} + + ## Variable namespace GUID for write-once, single-byte variables, specifically to be used for VarState policies. + # {6A85A0B9-3C08-4585-AC1F-8ED221CF059F} + gMuVarPolicyWriteOnceStateVarGuid = { 0x6a85a0b9, 0x3c08, 0x4585, { 0xac, 0x1f, 0x8e, 0xd2, 0x21, 0xcf, 0x05, 0x9f }} + + ## DeviceSpecificBusInfo Library Guid + # + gDeviceSpecificBusInfoLibTelemetryGuid = {0x3b82283d, 0x71dd, 0x4c61, {0xad, 0x2b, 0x51, 0x9b, 0x8d, 0x7b, 0x77, 0xc9}} + + ## HOB Guid for DebugFileLogger + gMuDebugLoggerGuid = {0x1c842fbb, 0x1e63, 0x432c, { 0xa1, 0xa9, 0x8a, 0x81, 0x27, 0xf1, 0x2d, 0x47 }} + + ## Event notification that capsules can be processed + # { 2AB1C860-E697-4EDE-8C0F-65CD6E444435 } + gMuReadyToProcessCapsulesNotifyGuid = { 0x2AB1C860, 0xE697, 0x4EDE, {0x8C, 0x0F, 0x65, 0xCD, 0x6E, 0x44, 0x44, 0x35}} + + ## Capsule Queue UEFI variable GUID + # {3c3ab3b3-bf9e-4a7f-a34f-519914f9a158} + # + # Used for storing capsule queue information via UEFI variable + gCapsuleQueueDataGuid = {0x3c3ab3b3, 0xbf9e, 0x4a7f, {0xa3, 0x4f, 0x51, 0x99, 0x14, 0xf9, 0xa1, 0x58}} + + ## MemoryProtectionExceptionHandler GUID for exception handler installation + # {61BDAF9E-67CB-40CD-A942-A3E3D0B973B2} + gMemoryProtectionExceptionHandlerGuid = {0x61BDAF9E, 0x67CB, 0x40CD, {0xA9, 0x42, 0xA3, 0xE3, 0xD0, 0xB9, 0x73, 0xB2 }} + +[Ppis] + gDebugPortPpiGuid = { 0x9d83f2d1, 0x9832, 0x4ded, { 0xaf, 0x78, 0x0e, 0xfe, 0x93, 0x07, 0xe8, 0xb1 }} + + +[Protocols] + ## Mu Crypto Pkcs7 protocol + # + gMuPKCS7ProtocolGuid = { 0x93cdb916, 0x7608, 0x4f1f, { 0xb5, 0x16, 0xc, 0x61, 0xbb, 0x24, 0x5c, 0x4f }} + + ## Mu Crypto PKCS5 Password Hashing Protocol + # + gMuPKCS5PasswordHashProtocolGuid = { 0x959b7ec7, 0x1857, 0x4551, { 0xaa, 0xfb, 0x1b, 0x7a, 0xe9, 0x48, 0x20, 0x2d }} + + ## Microsoft DXE Serial Status Code Handler Protocol GUID + ## + gMsSerialStatusCodeHandlerDxeProtocolGuid = { 0xa5065ca9, 0x5425, 0x4847, { 0x80, 0x8c, 0x5, 0x60, 0x18, 0x77, 0xa, 0xeb }} + + ## Capsule service protocol published by CapsuleServiceProtocol + # {D2A5D76F-F648-45A5-8B25-4601F3750C28} + # + gCapsuleServiceProtocolGuid = { 0xD2A5D76F, 0xF648, 0x45A5, {0x8B, 0x25, 0x46, 0x01, 0xF3, 0x75, 0x0C, 0x28}} + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild] + + ## Define a GUID for the regulatory graphics ACPI Table + gMsCorePkgTokenSpaceGuid.PcdRegulatoryGraphicFileGuid|{ 0x7B, 0x35, 0x39, 0x36, 0xD7, 0xB3, 0x23, 0x4C, 0x20, 0x9A, 0x0B, 0x74, 0x91, 0xD5, 0x70, 0xCE }|VOID*|0x00010177 + + ## Number of pages (EFI_PAGE_SIZE) to allocate in the EFI partition for each file log + ## Default: 1024 * 4KiB = 4MB + gMsCorePkgTokenSpaceGuid.PcdDebugFileLoggerAllocatedPages|1024|UINT32|0x4000001C + +[PcdsDynamic, PcdsDynamicEx] + gMsCorePkgTokenSpaceGuid.PcdDeviceStateBitmask|0x00000000|UINT32|0x00010178 + +[UserExtensions.TianoCore."ExtraFiles"] + MsCorePkgExtra.uni diff --git a/MsCorePkg/MsCorePkg.uni b/MsCorePkg/MsCorePkg.uni index e471239168..8d0d96523b 100644 --- a/MsCorePkg/MsCorePkg.uni +++ b/MsCorePkg/MsCorePkg.uni @@ -1,14 +1,14 @@ -// /** @file -// This Package provides all definitions, library classes and libraries instances for MsCore. -// MsCore is common code used in the Microsoft UEFI Core code base -// This is targetted at promoting to open source and should be aligned with -// Tianocore standards -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: BSD-2-Clause-Patent -// **/ - - -#string STR_PACKAGE_ABSTRACT #language en-US "This Package provides all definitions, library classes and libraries instances for MsCore." - +// /** @file +// This Package provides all definitions, library classes and libraries instances for MsCore. +// MsCore is common code used in the Microsoft UEFI Core code base +// This is targetted at promoting to open source and should be aligned with +// Tianocore standards +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: BSD-2-Clause-Patent +// **/ + + +#string STR_PACKAGE_ABSTRACT #language en-US "This Package provides all definitions, library classes and libraries instances for MsCore." + #string STR_PACKAGE_DESCRIPTION #language en-US "MsCore is common code used in the Microsoft UEFI Core code base" \ No newline at end of file diff --git a/MsCorePkg/MsCorePkgExtra.uni b/MsCorePkg/MsCorePkgExtra.uni index 00ec802abb..a028a437c5 100644 --- a/MsCorePkg/MsCorePkgExtra.uni +++ b/MsCorePkg/MsCorePkgExtra.uni @@ -1,10 +1,10 @@ -## @file -# MsCore Package Localized Strings and Content -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -#string STR_PROPERTIES_PACKAGE_NAME -#language en-US -"MsCore Package" +## @file +# MsCore Package Localized Strings and Content +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +#string STR_PROPERTIES_PACKAGE_NAME +#language en-US +"MsCore Package" diff --git a/MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf b/MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf index c4aeea91eb..05a88b701c 100644 --- a/MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf +++ b/MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf @@ -1,55 +1,55 @@ -## @file -# This module consolidates all crypto needed for Project Mu UEFI and provides -# protocol for those functions. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MuCryptoDxe - FILE_GUID = C9B8B0B7-9C85-46E8-B343-362FBD26E8F3 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MuCryptoDxeEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MuCryptoDxe.c - Pkcs7Support.c - Pkcs5Support.c - MuCryptoDxe.h - - -[Packages] - MdePkg/MdePkg.dec - CryptoPkg/CryptoPkg.dec - SecurityPkg/SecurityPkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - BaseCryptLib - UefiDriverEntryPoint - Hash2CryptoLib - -[Protocols] - gMuPKCS7ProtocolGuid - gMuPKCS5PasswordHashProtocolGuid - - -[Guids] - gEfiEndOfDxeEventGroupGuid - gEfiEventReadyToBootGuid - -[Depex] +## @file +# This module consolidates all crypto needed for Project Mu UEFI and provides +# protocol for those functions. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MuCryptoDxe + FILE_GUID = C9B8B0B7-9C85-46E8-B343-362FBD26E8F3 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MuCryptoDxeEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MuCryptoDxe.c + Pkcs7Support.c + Pkcs5Support.c + MuCryptoDxe.h + + +[Packages] + MdePkg/MdePkg.dec + CryptoPkg/CryptoPkg.dec + SecurityPkg/SecurityPkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + DebugLib + BaseCryptLib + UefiDriverEntryPoint + Hash2CryptoLib + +[Protocols] + gMuPKCS7ProtocolGuid + gMuPKCS5PasswordHashProtocolGuid + + +[Guids] + gEfiEndOfDxeEventGroupGuid + gEfiEventReadyToBootGuid + +[Depex] TRUE \ No newline at end of file diff --git a/MsCorePkg/MuCryptoDxe/Readme.md b/MsCorePkg/MuCryptoDxe/Readme.md index 9fa2a9e707..31431f4508 100644 --- a/MsCorePkg/MuCryptoDxe/Readme.md +++ b/MsCorePkg/MuCryptoDxe/Readme.md @@ -1,126 +1,126 @@ -# MuCryptoDxe - -## About - -MuCryptoDxe is a DXE_DRIVER you can include in your platform to have a protocol that can call -Crypto functions without having to statically linked against the crypto library in many places - -## Supported Architectures - -This package is not architecturally dependent. - -## Methods supported - -There are two protocols exposed in this GUID - -### MU_PKCS5_PASSWORD_HASH_PROTOCOL - -### __HashPassword__ - -Hashes a password by passing through to the BaseCryptLib. Returns EFI_STATUS - -```c -NOTE: DigestSize will be used to determine the hash algorithm and must correspond to a known hash digest size. Use standards. - - @retval EFI_SUCCESS Congratulations! Your hash is in the output buffer. - @retval EFI_INVALID_PARAMETER One of the pointers was NULL or one of the sizes was too large. - @retval EFI_INVALID_PARAMETER The hash algorithm could not be determined from the digest size. - @retval EFI_ABORTED An error occurred in the OpenSSL subroutines. - -**Inputs**: - - IN CONST MU_PKCS5_PASSWORD_HASH_PROTOCOL - IN UINTN PasswordSize - IN CONST CHAR8 *Password - IN UINTN SaltSize - IN CONST UINT8 *Salt - IN UINTN IterationCount - IN UINTN DigestSize - IN UINTN OutputSize - OUT UINT8 *Output -``` - -## MU_PKCS7_PROTOCOL - -### Verify - -Verifies the validity of a PKCS#7 signed data as described in "PKCS #7: Cryptographic Message -Syntax Standard". -The input signed data could be wrapped in a ContentInfo structure. - -If P7Data, TrustedCert or InData is NULL, then return EFI_INVALID_PARAMETER. -If P7Length, CertLength or DataLength overflow, then return EFI_INVALID_PARAMETER. -If this interface is not supported, then return EFI_UNSUPPORTED. - -```c - @retval EFI_SUCCESS The specified PKCS#7 signed data is valid. - @retval EFI_SECURITY_VIOLATION Invalid PKCS#7 signed data. - @retval EFI_UNSUPPORTED This interface is not supported. - -**Inputs:** - - IN CONST MU_PKCS7_PROTOCOL - IN CONST UINT8 *P7Data, - IN UINTN P7DataLength, - IN CONST UINT8 *TrustedCert, - IN UINTN TrustedCertLength, - IN CONST UINT8 *Data, - IN UINTN DataLength (in bytes) -``` - -### VerifyEKU - -This function receives a PKCS7 formatted signature, and then verifies that the specified -Enhanced or Extended Key Usages (EKU's) are present in the end-entity leaf signing certificate. - -Note that this function does not validate the certificate chain. - -Applications for custom EKU's are quite flexible. -For example, a policy EKU may be present in an Issuing Certificate Authority (CA), and any -sub-ordinate certificate issued might also contain this EKU, thus constraining the sub-ordinate -certificate. -Other applications might allow a certificate embedded in a device to specify that other Object -Identifiers (OIDs) are present which contains binary data specifying custom capabilities that -the device is able to do. - -```c - @retval EFI_SUCCESS - The required EKUs were found in the signature. - @retval EFI_INVALID_PARAMETER - A parameter was invalid. - @retval EFI_NOT_FOUND - One or more EKU's were not found in the signature. - -**Inputs:** - - IN CONST MU_PKCS7_PROTOCOL - IN CONST UINT8 *Pkcs7Signature, - IN CONST UINT32 SignatureSize, (in bytes) - IN CONST CHAR8 *RequiredEKUs[], null-terminated strings listing OIDs of required EKUs - IN CONST UINT32 RequiredEKUsSize, - IN BOOLEAN RequireAllPresent -``` - -## Including in your platform - -### Sample DSC change - -```inf - [Components.] - ... - ... - MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf -``` - -### Sample FDF change - -```inf - [FV.] - ... - ... - INF MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf -``` - ---- - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# MuCryptoDxe + +## About + +MuCryptoDxe is a DXE_DRIVER you can include in your platform to have a protocol that can call +Crypto functions without having to statically linked against the crypto library in many places + +## Supported Architectures + +This package is not architecturally dependent. + +## Methods supported + +There are two protocols exposed in this GUID + +### MU_PKCS5_PASSWORD_HASH_PROTOCOL + +### __HashPassword__ + +Hashes a password by passing through to the BaseCryptLib. Returns EFI_STATUS + +```c +NOTE: DigestSize will be used to determine the hash algorithm and must correspond to a known hash digest size. Use standards. + + @retval EFI_SUCCESS Congratulations! Your hash is in the output buffer. + @retval EFI_INVALID_PARAMETER One of the pointers was NULL or one of the sizes was too large. + @retval EFI_INVALID_PARAMETER The hash algorithm could not be determined from the digest size. + @retval EFI_ABORTED An error occurred in the OpenSSL subroutines. + +**Inputs**: + + IN CONST MU_PKCS5_PASSWORD_HASH_PROTOCOL + IN UINTN PasswordSize + IN CONST CHAR8 *Password + IN UINTN SaltSize + IN CONST UINT8 *Salt + IN UINTN IterationCount + IN UINTN DigestSize + IN UINTN OutputSize + OUT UINT8 *Output +``` + +## MU_PKCS7_PROTOCOL + +### Verify + +Verifies the validity of a PKCS#7 signed data as described in "PKCS #7: Cryptographic Message +Syntax Standard". +The input signed data could be wrapped in a ContentInfo structure. + +If P7Data, TrustedCert or InData is NULL, then return EFI_INVALID_PARAMETER. +If P7Length, CertLength or DataLength overflow, then return EFI_INVALID_PARAMETER. +If this interface is not supported, then return EFI_UNSUPPORTED. + +```c + @retval EFI_SUCCESS The specified PKCS#7 signed data is valid. + @retval EFI_SECURITY_VIOLATION Invalid PKCS#7 signed data. + @retval EFI_UNSUPPORTED This interface is not supported. + +**Inputs:** + + IN CONST MU_PKCS7_PROTOCOL + IN CONST UINT8 *P7Data, + IN UINTN P7DataLength, + IN CONST UINT8 *TrustedCert, + IN UINTN TrustedCertLength, + IN CONST UINT8 *Data, + IN UINTN DataLength (in bytes) +``` + +### VerifyEKU + +This function receives a PKCS7 formatted signature, and then verifies that the specified +Enhanced or Extended Key Usages (EKU's) are present in the end-entity leaf signing certificate. + +Note that this function does not validate the certificate chain. + +Applications for custom EKU's are quite flexible. +For example, a policy EKU may be present in an Issuing Certificate Authority (CA), and any +sub-ordinate certificate issued might also contain this EKU, thus constraining the sub-ordinate +certificate. +Other applications might allow a certificate embedded in a device to specify that other Object +Identifiers (OIDs) are present which contains binary data specifying custom capabilities that +the device is able to do. + +```c + @retval EFI_SUCCESS - The required EKUs were found in the signature. + @retval EFI_INVALID_PARAMETER - A parameter was invalid. + @retval EFI_NOT_FOUND - One or more EKU's were not found in the signature. + +**Inputs:** + + IN CONST MU_PKCS7_PROTOCOL + IN CONST UINT8 *Pkcs7Signature, + IN CONST UINT32 SignatureSize, (in bytes) + IN CONST CHAR8 *RequiredEKUs[], null-terminated strings listing OIDs of required EKUs + IN CONST UINT32 RequiredEKUsSize, + IN BOOLEAN RequireAllPresent +``` + +## Including in your platform + +### Sample DSC change + +```inf + [Components.] + ... + ... + MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf +``` + +### Sample FDF change + +```inf + [FV.] + ... + ... + INF MsCorePkg/MuCryptoDxe/MuCryptoDxe.inf +``` + +--- + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsCorePkg/MuVarPolicyFoundationDxe/Feature_MuVarPolicyFoundationDxe_Readme.md b/MsCorePkg/MuVarPolicyFoundationDxe/Feature_MuVarPolicyFoundationDxe_Readme.md index d64ee5a538..91a86defad 100644 --- a/MsCorePkg/MuVarPolicyFoundationDxe/Feature_MuVarPolicyFoundationDxe_Readme.md +++ b/MsCorePkg/MuVarPolicyFoundationDxe/Feature_MuVarPolicyFoundationDxe_Readme.md @@ -1,106 +1,106 @@ -# MuVarPolicyFoundationDxe Driver and Policies - -## Overview - -This driver works in conjunction with the Variable Policy engine to create two policy-based -concepts that can be leveraged by other drivers in the system and to produce an EDK2 Variable -Locking Protocol. -The two concepts are: Dxe Phase Indicators and Write Once State Variables. - -## DXE Phase Indicators - -To support the DXE Phase Indicators, a new policy is installed that creates the -`gMuVarPolicyDxePhaseGuid` variable namespace. -By policy, all variables in this namespace are required to be the size of a `PHASE_INDICATOR` -(which is a `UINT8`) and must be volatile and readable in both BootServices and Runtime. -All variables in this namespace will also be made read-only immediately upon creation (as such, -they are also Write-Once, but have a special purpose). -Because these variables are required to be volatile, -it will not be possible to create more after ExitBootServices. - -This driver will also register callbacks for EndOfDxe, ReadyToBoot, and ExitBootServices. -At the time of the corresponding event, a new `PHASE_INDICATOR` variable will be created for the -callback that has just been triggered. -The purpose of these variables is two-fold: - -- They can be queried by any driver or library that needs to know what phases of boot have - already occurred. - This is especially convenient for libraries that might be linked against any type of driver or - application, but may not have been able to register callbacks for all the events because they - don't know their execution order or time. -- They can be used as the delegated "Variable State" variables in other Variable Policy lock - policies. - As such, you could describe a variable that locks "at ReadyToBoot" or "EndOfDxe". - -Note that the `PHASE_INDICATOR` variables are intentionally named as short abbreviations, such -as "EOD" and "RTB". -This is to minimize the size of the policy entries for lock-on-state policies. - -### Important Note on Timing - -The EndOfDxe and ReadyToBoot state variables will be created at the **end** of the Notify list -for the respective event. -As such, any variable that locks on those events will still be writeable in Notify callbacks for -the event. -However, the ExitBootServices state variable (due to architectural requirements) will be created -at a non-deterministic time in the Notify list. -Therefore, it is unpredictable whether any variable which locks "on ExitBootServices" would -still be writeable in any given callback. - -## Write-Once State Variables - -The Write-Once State Variables are actually quite similar to the DXE Phase Variables in terms of -policy, but are kept distinct because of the different intentions for their use. -This driver will also register a policy that creates the `gMuVarPolicyWriteOnceStateVarGuid` -namespace. -This policy will also limit these variables to being: volatile, BootServices and Runtime, -read-only on create, and a fixed size -- `sizeof(POLICY_LOCK_VAR)`, which is also a `UINT8`, -given that that is the size of the Value field of the current `VARIABLE_LOCK_ON_VAR_STATE_POLICY` -structure. - -The primary difference is that the DXE Phase Variables have a very clear purpose and meaning. -While the `gMuVarPolicyWriteOnceStateVarGuid` namespace is designed to be general-purpose and -used to easily describe delegated variables for `VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE`-type -policies without requiring every driver to define two policies in order to employ this common -pattern. - -### Example - -Driver XYZ wants to define a policy to allow a boot application (that executes after the policy -creation interface may be closed) to modify a collection of variables until the boot application -chooses to lock them. -One way to accomplish this is the create a policy that delegates the lock control of the target -variables to the state of variable A. -However, now the variable A is the linchpin for the protections of the target variables and -should have some protections of its own. -This might require another policy. - -Instead, the driver could create a policy that delegates lock control of the target variables to -a variable in the `gMuVarPolicyWriteOnceStateVarGuid`. -This would not require a second policy, as a general-purpose policy is already in place. -Now the boot application only needs to create variable A in the -`gMuVarPolicyWriteOnceStateVarGuid` namespace (with the value designated in the policy created -by driver XYZ) in order to lock the target variables. - -### Important Note on Naming - -Since the `gMuVarPolicyWriteOnceStateVarGuid` namespace is a single variable namespace, naming -collisions are possible. Because of the write-once nature of the policy, it is not a concern -that an existing lock may be overwritten, but there still may be policy confusion if there are -two policies that delegate to the exact same name. -It is up to the platform architect to ensure that naming collisions like this do not occur. - -### EDK2 Variable Locking Protocol - -Finally, this driver installs an EDK2 Variable Locking Protocol instance. This implementation -locks a variable by creating a policy entry and registering it via the Variable Policy Protocol. -The policy entry is of type VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE and locks the variable based -on state of the Phase Indicator variable "EOD" (meaning End Of Dxe) in `gMuVarPolicyDxePhaseGuid` -namespace. - ---- - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# MuVarPolicyFoundationDxe Driver and Policies + +## Overview + +This driver works in conjunction with the Variable Policy engine to create two policy-based +concepts that can be leveraged by other drivers in the system and to produce an EDK2 Variable +Locking Protocol. +The two concepts are: Dxe Phase Indicators and Write Once State Variables. + +## DXE Phase Indicators + +To support the DXE Phase Indicators, a new policy is installed that creates the +`gMuVarPolicyDxePhaseGuid` variable namespace. +By policy, all variables in this namespace are required to be the size of a `PHASE_INDICATOR` +(which is a `UINT8`) and must be volatile and readable in both BootServices and Runtime. +All variables in this namespace will also be made read-only immediately upon creation (as such, +they are also Write-Once, but have a special purpose). +Because these variables are required to be volatile, +it will not be possible to create more after ExitBootServices. + +This driver will also register callbacks for EndOfDxe, ReadyToBoot, and ExitBootServices. +At the time of the corresponding event, a new `PHASE_INDICATOR` variable will be created for the +callback that has just been triggered. +The purpose of these variables is two-fold: + +- They can be queried by any driver or library that needs to know what phases of boot have + already occurred. + This is especially convenient for libraries that might be linked against any type of driver or + application, but may not have been able to register callbacks for all the events because they + don't know their execution order or time. +- They can be used as the delegated "Variable State" variables in other Variable Policy lock + policies. + As such, you could describe a variable that locks "at ReadyToBoot" or "EndOfDxe". + +Note that the `PHASE_INDICATOR` variables are intentionally named as short abbreviations, such +as "EOD" and "RTB". +This is to minimize the size of the policy entries for lock-on-state policies. + +### Important Note on Timing + +The EndOfDxe and ReadyToBoot state variables will be created at the **end** of the Notify list +for the respective event. +As such, any variable that locks on those events will still be writeable in Notify callbacks for +the event. +However, the ExitBootServices state variable (due to architectural requirements) will be created +at a non-deterministic time in the Notify list. +Therefore, it is unpredictable whether any variable which locks "on ExitBootServices" would +still be writeable in any given callback. + +## Write-Once State Variables + +The Write-Once State Variables are actually quite similar to the DXE Phase Variables in terms of +policy, but are kept distinct because of the different intentions for their use. +This driver will also register a policy that creates the `gMuVarPolicyWriteOnceStateVarGuid` +namespace. +This policy will also limit these variables to being: volatile, BootServices and Runtime, +read-only on create, and a fixed size -- `sizeof(POLICY_LOCK_VAR)`, which is also a `UINT8`, +given that that is the size of the Value field of the current `VARIABLE_LOCK_ON_VAR_STATE_POLICY` +structure. + +The primary difference is that the DXE Phase Variables have a very clear purpose and meaning. +While the `gMuVarPolicyWriteOnceStateVarGuid` namespace is designed to be general-purpose and +used to easily describe delegated variables for `VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE`-type +policies without requiring every driver to define two policies in order to employ this common +pattern. + +### Example + +Driver XYZ wants to define a policy to allow a boot application (that executes after the policy +creation interface may be closed) to modify a collection of variables until the boot application +chooses to lock them. +One way to accomplish this is the create a policy that delegates the lock control of the target +variables to the state of variable A. +However, now the variable A is the linchpin for the protections of the target variables and +should have some protections of its own. +This might require another policy. + +Instead, the driver could create a policy that delegates lock control of the target variables to +a variable in the `gMuVarPolicyWriteOnceStateVarGuid`. +This would not require a second policy, as a general-purpose policy is already in place. +Now the boot application only needs to create variable A in the +`gMuVarPolicyWriteOnceStateVarGuid` namespace (with the value designated in the policy created +by driver XYZ) in order to lock the target variables. + +### Important Note on Naming + +Since the `gMuVarPolicyWriteOnceStateVarGuid` namespace is a single variable namespace, naming +collisions are possible. Because of the write-once nature of the policy, it is not a concern +that an existing lock may be overwritten, but there still may be policy confusion if there are +two policies that delegate to the exact same name. +It is up to the platform architect to ensure that naming collisions like this do not occur. + +### EDK2 Variable Locking Protocol + +Finally, this driver installs an EDK2 Variable Locking Protocol instance. This implementation +locks a variable by creating a policy entry and registering it via the Variable Policy Protocol. +The policy entry is of type VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE and locks the variable based +on state of the Phase Indicator variable "EOD" (meaning End Of Dxe) in `gMuVarPolicyDxePhaseGuid` +namespace. + +--- + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsCorePkg/MuVarPolicyFoundationDxe/MuVarPolicyFoundationDxe.inf b/MsCorePkg/MuVarPolicyFoundationDxe/MuVarPolicyFoundationDxe.inf index 2ffb1fe034..3177e07022 100644 --- a/MsCorePkg/MuVarPolicyFoundationDxe/MuVarPolicyFoundationDxe.inf +++ b/MsCorePkg/MuVarPolicyFoundationDxe/MuVarPolicyFoundationDxe.inf @@ -1,59 +1,59 @@ -## @file MuVarPolicyFoundationDxe.inf -# This DXE driver will publish policies and state variables to support a couple of different design patterns: -# - Locking policies and performing other tests based on whether a DXE phase has passed -# - EndOfDxe -# - ReadyToBoot -# - ExitBootServices -# - Setting up a reference variable that can only be written once that can be used in other variable policies -# -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MuVarPolicyFoundationDxe - FILE_GUID = 8C7DB881-DA76-4486-8654-8152EE3470A3 - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - ENTRY_POINT = MuVarPolicyFoundationDxeMain - - -[Sources] - MuVarPolicyFoundationDxe.c - - -[Packages] - MdePkg/MdePkg.dec - MsCorePkg/MsCorePkg.dec - MdeModulePkg/MdeModulePkg.dec - - -[LibraryClasses] - DebugLib - BaseLib - MemoryAllocationLib - UefiDriverEntryPoint - BaseMemoryLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - VariablePolicyHelperLib - - -[Protocols] - gEdkiiVariablePolicyProtocolGuid ## CONSUMES # Used to register the DXE Phase Variable protection policy. - - -[Guids] - gMuVarPolicyDxePhaseGuid ## CONSUMES ## GUID ## Variable namespace - gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace - gEfiEndOfDxeEventGroupGuid ## CONSUMES ## EVENT ## EndOfDxe Event Group - gEfiEventReadyToBootGuid ## CONSUMES ## EVENT ## ReadyToBoot Event Group - gEfiEventExitBootServicesGuid ## CONSUMES ## EVENT ## ExitBootServices Event Group - - -[Depex] - gEfiVariableArchProtocolGuid AND - gEdkiiVariablePolicyProtocolGuid +## @file MuVarPolicyFoundationDxe.inf +# This DXE driver will publish policies and state variables to support a couple of different design patterns: +# - Locking policies and performing other tests based on whether a DXE phase has passed +# - EndOfDxe +# - ReadyToBoot +# - ExitBootServices +# - Setting up a reference variable that can only be written once that can be used in other variable policies +# +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MuVarPolicyFoundationDxe + FILE_GUID = 8C7DB881-DA76-4486-8654-8152EE3470A3 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + ENTRY_POINT = MuVarPolicyFoundationDxeMain + + +[Sources] + MuVarPolicyFoundationDxe.c + + +[Packages] + MdePkg/MdePkg.dec + MsCorePkg/MsCorePkg.dec + MdeModulePkg/MdeModulePkg.dec + + +[LibraryClasses] + DebugLib + BaseLib + MemoryAllocationLib + UefiDriverEntryPoint + BaseMemoryLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + VariablePolicyHelperLib + + +[Protocols] + gEdkiiVariablePolicyProtocolGuid ## CONSUMES # Used to register the DXE Phase Variable protection policy. + + +[Guids] + gMuVarPolicyDxePhaseGuid ## CONSUMES ## GUID ## Variable namespace + gMuVarPolicyWriteOnceStateVarGuid ## CONSUMES ## GUID ## Variable namespace + gEfiEndOfDxeEventGroupGuid ## CONSUMES ## EVENT ## EndOfDxe Event Group + gEfiEventReadyToBootGuid ## CONSUMES ## EVENT ## ReadyToBoot Event Group + gEfiEventExitBootServicesGuid ## CONSUMES ## EVENT ## ExitBootServices Event Group + + +[Depex] + gEfiVariableArchProtocolGuid AND + gEdkiiVariablePolicyProtocolGuid diff --git a/MsCorePkg/UnitTests/JsonTest/JsonTestApp.inf b/MsCorePkg/UnitTests/JsonTest/JsonTestApp.inf index 8bab1084b9..3e7d19d328 100644 --- a/MsCorePkg/UnitTests/JsonTest/JsonTestApp.inf +++ b/MsCorePkg/UnitTests/JsonTest/JsonTestApp.inf @@ -1,48 +1,48 @@ -## @file -# XmlB64TestApp.inf -# -# Test application to verify that XML with B64 content works correctly. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = JsonTestApp - FILE_GUID = f6da48ca-b21c-424a-b79d-da02e25e6318 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = JsonTestAppEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 -# - -[Sources] - JsonTestApp.c - -[Packages] - MdePkg/MdePkg.dec - MsCorePkg/MsCorePkg.dec - -[Protocols] - - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - JsonLiteParserLib - PrintLib - UefiApplicationEntryPoint - UefiLib - UnitTestLib - -[Guids] - -[BuildOptions] - *_GCC5_*_CC_FLAGS = -Wno-incompatible-pointer-types +## @file +# XmlB64TestApp.inf +# +# Test application to verify that XML with B64 content works correctly. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = JsonTestApp + FILE_GUID = f6da48ca-b21c-424a-b79d-da02e25e6318 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = JsonTestAppEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 +# + +[Sources] + JsonTestApp.c + +[Packages] + MdePkg/MdePkg.dec + MsCorePkg/MsCorePkg.dec + +[Protocols] + + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + JsonLiteParserLib + PrintLib + UefiApplicationEntryPoint + UefiLib + UnitTestLib + +[Guids] + +[BuildOptions] + *_GCC5_*_CC_FLAGS = -Wno-incompatible-pointer-types diff --git a/MsCorePkg/UnitTests/JsonTest/readme.md b/MsCorePkg/UnitTests/JsonTest/readme.md index c89d433638..d837497d2c 100644 --- a/MsCorePkg/UnitTests/JsonTest/readme.md +++ b/MsCorePkg/UnitTests/JsonTest/readme.md @@ -1,18 +1,18 @@ -# Verify Json Lite library functionality - -The Json Lite Library parses json strings in to tuples and encodes tuples into a json string. - -## About - -These tests verify that the Json Lite Library functions properly. - -## JsonTestApp - -This application consumes the UnitTestLib and implements various test cases for the verification of the Json Lite Library. - ---- - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Verify Json Lite library functionality + +The Json Lite Library parses json strings in to tuples and encodes tuples into a json string. + +## About + +These tests verify that the Json Lite Library functions properly. + +## JsonTestApp + +This application consumes the UnitTestLib and implements various test cases for the verification of the Json Lite Library. + +--- + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsCorePkg/UnitTests/MathLibUnitTest/CreateTestData.py b/MsCorePkg/UnitTests/MathLibUnitTest/CreateTestData.py index 019f50efcf..aff6135ae4 100644 --- a/MsCorePkg/UnitTests/MathLibUnitTest/CreateTestData.py +++ b/MsCorePkg/UnitTests/MathLibUnitTest/CreateTestData.py @@ -1,31 +1,31 @@ -## @file -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -import os -import sys -import math - - -if __name__ == "__main__": - #START: -9.4247779607693793 STOP: 9.4247779607693793 STEP:0.039269908169872414 - start = 3 - stop = 3000 - step = 6 - total = (stop - start) / step - funct = math.sqrt - - print("Start: ", start) - print("Stop: ", stop) - print("Step: ", step) - print("Total: ", total) - - allVals = list() - - for index in range(start,stop,step): - value = round(funct(index)) - allVals.append(value) +## @file +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +import os +import sys +import math + + +if __name__ == "__main__": + #START: -9.4247779607693793 STOP: 9.4247779607693793 STEP:0.039269908169872414 + start = 3 + stop = 3000 + step = 6 + total = (stop - start) / step + funct = math.sqrt + + print("Start: ", start) + print("Stop: ", stop) + print("Step: ", step) + print("Total: ", total) + + allVals = list() + + for index in range(start,stop,step): + value = round(funct(index)) + allVals.append(value) print(allVals) \ No newline at end of file diff --git a/MsCorePkg/Universal/StatusCodeHandler/Serial/Dxe/SerialStatusCodeHandlerDxe.inf b/MsCorePkg/Universal/StatusCodeHandler/Serial/Dxe/SerialStatusCodeHandlerDxe.inf index 27c8abbae7..95a67bc290 100644 --- a/MsCorePkg/Universal/StatusCodeHandler/Serial/Dxe/SerialStatusCodeHandlerDxe.inf +++ b/MsCorePkg/Universal/StatusCodeHandler/Serial/Dxe/SerialStatusCodeHandlerDxe.inf @@ -1,58 +1,58 @@ -## @file -# Simple SerialLib based Status Code handler -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -## - - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SerialStatusCodeHandlerDxe - FILE_GUID = C5D0E6B2-A841-4C67-A0E3-92354DE07E51 - MODULE_TYPE = DXE_DRIVER - ENTRY_POINT = DxeEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - StatusCodeHandlerDxe.c - ../Common/SerialStatusCodeHandler.h - ../Common/SerialStatusCodeHandler.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiDriverEntryPoint - ReportStatusCodeLib - DebugLib - SerialPortLib - PrintLib - BaseMemoryLib - DebugPrintErrorLevelLib - -[Guids] - gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID - gEfiEventExitBootServicesGuid - -[Pcd] - -[Protocols] - gEfiRscHandlerProtocolGuid ## CONSUMES - gMsSerialStatusCodeHandlerDxeProtocolGuid ## PRODUCES - -[Depex] - gEfiRscHandlerProtocolGuid +## @file +# Simple SerialLib based Status Code handler +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SerialStatusCodeHandlerDxe + FILE_GUID = C5D0E6B2-A841-4C67-A0E3-92354DE07E51 + MODULE_TYPE = DXE_DRIVER + ENTRY_POINT = DxeEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + StatusCodeHandlerDxe.c + ../Common/SerialStatusCodeHandler.h + ../Common/SerialStatusCodeHandler.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiDriverEntryPoint + ReportStatusCodeLib + DebugLib + SerialPortLib + PrintLib + BaseMemoryLib + DebugPrintErrorLevelLib + +[Guids] + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID + gEfiEventExitBootServicesGuid + +[Pcd] + +[Protocols] + gEfiRscHandlerProtocolGuid ## CONSUMES + gMsSerialStatusCodeHandlerDxeProtocolGuid ## PRODUCES + +[Depex] + gEfiRscHandlerProtocolGuid diff --git a/MsCorePkg/Universal/StatusCodeHandler/Serial/Pei/SerialStatusCodeHandlerPei.inf b/MsCorePkg/Universal/StatusCodeHandler/Serial/Pei/SerialStatusCodeHandlerPei.inf index 9c2c004fcf..f123e4329b 100644 --- a/MsCorePkg/Universal/StatusCodeHandler/Serial/Pei/SerialStatusCodeHandlerPei.inf +++ b/MsCorePkg/Universal/StatusCodeHandler/Serial/Pei/SerialStatusCodeHandlerPei.inf @@ -1,54 +1,54 @@ -## @file -# Simple SerialLib based Status Code handler -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SerialStatusCodeHandlerPei - FILE_GUID = 254B3E77-863A-43A0-9287-8979B2D0513F - MODULE_TYPE = PEIM - ENTRY_POINT = PeiEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - StatusCodeHandlerPei.c - ../Common/SerialStatusCodeHandler.h - ../Common/SerialStatusCodeHandler.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - PeimEntryPoint - PeiServicesLib - ReportStatusCodeLib - DebugLib - SerialPortLib - PrintLib - BaseMemoryLib - DebugPrintErrorLevelLib - -[Guids] - gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd] - -[Ppis] - gEfiPeiRscHandlerPpiGuid ## CONSUMES - -[Depex] - gEfiPeiRscHandlerPpiGuid +## @file +# Simple SerialLib based Status Code handler +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SerialStatusCodeHandlerPei + FILE_GUID = 254B3E77-863A-43A0-9287-8979B2D0513F + MODULE_TYPE = PEIM + ENTRY_POINT = PeiEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + StatusCodeHandlerPei.c + ../Common/SerialStatusCodeHandler.h + ../Common/SerialStatusCodeHandler.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + PeimEntryPoint + PeiServicesLib + ReportStatusCodeLib + DebugLib + SerialPortLib + PrintLib + BaseMemoryLib + DebugPrintErrorLevelLib + +[Guids] + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID + +[Pcd] + +[Ppis] + gEfiPeiRscHandlerPpiGuid ## CONSUMES + +[Depex] + gEfiPeiRscHandlerPpiGuid diff --git a/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerSmm.inf b/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerSmm.inf index 72405ad74d..3856829b1b 100644 --- a/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerSmm.inf +++ b/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerSmm.inf @@ -1,58 +1,58 @@ -## @file -# Simple SerialLib based Status Code handler -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SerialStatusCodeHandlerTraditionalMm - FILE_GUID = EA5DCD04-3861-4B95-A6B1-EC5E944C350E - MODULE_TYPE = DXE_SMM_DRIVER - PI_SPECIFICATION_VERSION = 1.20 - ENTRY_POINT = TraditionalEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - StatusCodeHandlerMm.c - StatusCodeHandlerMm.h - StatusCodeHandlerTraditional.c - ../Common/SerialStatusCodeHandler.h - ../Common/SerialStatusCodeHandler.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MmServicesTableLib - UefiDriverEntryPoint - ReportStatusCodeLib - DebugLib - SerialPortLib - PrintLib - BaseMemoryLib - DebugPrintErrorLevelLib - -[Guids] - gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd] - -[Protocols] - gEfiMmRscHandlerProtocolGuid ## CONSUMES - -[Depex] - gEfiMmRscHandlerProtocolGuid - +## @file +# Simple SerialLib based Status Code handler +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SerialStatusCodeHandlerTraditionalMm + FILE_GUID = EA5DCD04-3861-4B95-A6B1-EC5E944C350E + MODULE_TYPE = DXE_SMM_DRIVER + PI_SPECIFICATION_VERSION = 1.20 + ENTRY_POINT = TraditionalEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + StatusCodeHandlerMm.c + StatusCodeHandlerMm.h + StatusCodeHandlerTraditional.c + ../Common/SerialStatusCodeHandler.h + ../Common/SerialStatusCodeHandler.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + MmServicesTableLib + UefiDriverEntryPoint + ReportStatusCodeLib + DebugLib + SerialPortLib + PrintLib + BaseMemoryLib + DebugPrintErrorLevelLib + +[Guids] + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID + +[Pcd] + +[Protocols] + gEfiMmRscHandlerProtocolGuid ## CONSUMES + +[Depex] + gEfiMmRscHandlerProtocolGuid + diff --git a/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerStandaloneMm.inf b/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerStandaloneMm.inf index 3db0569637..5a3e104b14 100644 --- a/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerStandaloneMm.inf +++ b/MsCorePkg/Universal/StatusCodeHandler/Serial/Smm/SerialStatusCodeHandlerStandaloneMm.inf @@ -1,58 +1,58 @@ -## @file -# Simple SerialLib based Status Code handler -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# -# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SerialStatusCodeHandlerStandaloneMm - FILE_GUID = 1ED8E3F5-3C4B-4B2B-A9BE-9FFEE0C42B75 - MODULE_TYPE = MM_STANDALONE - PI_SPECIFICATION_VERSION = 0x00010032 - ENTRY_POINT = StandaloneEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - StatusCodeHandlerMm.c - StatusCodeHandlerMm.h - StatusCodeHandlerStandalone.c - ../Common/SerialStatusCodeHandler.h - ../Common/SerialStatusCodeHandler.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MmServicesTableLib - StandaloneMmDriverEntryPoint - ReportStatusCodeLib - DebugLib - SerialPortLib - PrintLib - BaseMemoryLib - DebugPrintErrorLevelLib - -[Guids] - gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID - -[Pcd] - -[Protocols] - gEfiMmRscHandlerProtocolGuid ## CONSUMES - -[Depex] - gEfiMmRscHandlerProtocolGuid - +## @file +# Simple SerialLib based Status Code handler +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# +# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SerialStatusCodeHandlerStandaloneMm + FILE_GUID = 1ED8E3F5-3C4B-4B2B-A9BE-9FFEE0C42B75 + MODULE_TYPE = MM_STANDALONE + PI_SPECIFICATION_VERSION = 0x00010032 + ENTRY_POINT = StandaloneEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + StatusCodeHandlerMm.c + StatusCodeHandlerMm.h + StatusCodeHandlerStandalone.c + ../Common/SerialStatusCodeHandler.h + ../Common/SerialStatusCodeHandler.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + MmServicesTableLib + StandaloneMmDriverEntryPoint + ReportStatusCodeLib + DebugLib + SerialPortLib + PrintLib + BaseMemoryLib + DebugPrintErrorLevelLib + +[Guids] + gEfiStatusCodeDataTypeStringGuid ## SOMETIMES_CONSUMES ## GUID + +[Pcd] + +[Protocols] + gEfiMmRscHandlerProtocolGuid ## CONSUMES + +[Depex] + gEfiMmRscHandlerProtocolGuid + diff --git a/MsGraphicsPkg/Application/BmpDisplay/BmpDisplay.inf b/MsGraphicsPkg/Application/BmpDisplay/BmpDisplay.inf index 2d52643312..5080747980 100644 --- a/MsGraphicsPkg/Application/BmpDisplay/BmpDisplay.inf +++ b/MsGraphicsPkg/Application/BmpDisplay/BmpDisplay.inf @@ -1,42 +1,42 @@ -## @file -# BmpDisplay.inf -# -# A simple UEFI application that displays a user-specified BMP image. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BmpDisplay - FILE_GUID = CBAEADF9-1AED-427E-A1C2-ED079EBAFE4F - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = BmpDisplayEntrypoint - -[Sources] - BmpDisplay.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - BmpSupportLib - MemoryAllocationLib - PrintLib - ShellLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UefiLib - -[Protocols] - gEfiGraphicsOutputProtocolGuid ## CONSUMES - -[Depex] - gEfiGraphicsOutputProtocolGuid +## @file +# BmpDisplay.inf +# +# A simple UEFI application that displays a user-specified BMP image. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BmpDisplay + FILE_GUID = CBAEADF9-1AED-427E-A1C2-ED079EBAFE4F + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = BmpDisplayEntrypoint + +[Sources] + BmpDisplay.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + BmpSupportLib + MemoryAllocationLib + PrintLib + ShellLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UefiLib + +[Protocols] + gEfiGraphicsOutputProtocolGuid ## CONSUMES + +[Depex] + gEfiGraphicsOutputProtocolGuid diff --git a/MsGraphicsPkg/Application/BmpDisplay/ReadMe.md b/MsGraphicsPkg/Application/BmpDisplay/ReadMe.md index 2f32eb0a59..2ed19bc0f1 100644 --- a/MsGraphicsPkg/Application/BmpDisplay/ReadMe.md +++ b/MsGraphicsPkg/Application/BmpDisplay/ReadMe.md @@ -1,13 +1,13 @@ -# BmpDisplay test application - -## About - -While UEFI uses and displays BMP format files, there are some BMP specification that UEFI -follows that not all drawing programs honor. -Running this tool to display a BMP in the Uefi Shell will check to make sure your BMP file are -displayable in UEFI. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# BmpDisplay test application + +## About + +While UEFI uses and displays BMP format files, there are some BMP specification that UEFI +follows that not all drawing programs honor. +Running this tool to display a BMP in the Uefi Shell will check to make sure your BMP file are +displayable in UEFI. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineDxe.inf b/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineDxe.inf index f3767133cb..d86cb052de 100644 --- a/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineDxe.inf +++ b/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineDxe.inf @@ -1,79 +1,79 @@ -## @file -# The DXE driver produces FORM DISPLAY ENGINE protocol. -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -#Override : 00000002 | MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf | 60ed12cbc6548db7016bd842943cb8be | 2022-02-07T20-47-30 | 683ed68b7ecab2be6740359535a52a3ea086dd8a - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DisplayEngine - FILE_GUID = c09e4ce4-ae29-4340-b941-078871bd89d1 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = InitializeDisplayEngine - UNLOAD_IMAGE = UnloadDisplayEngine -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC AARCH64 -# - -[Sources] - FormDisplayStr.uni - FormDisplay.c - FormDisplay.h - ProcessOptions.c - InputHandler.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - UefiBootServicesTableLib - DebugLib - BaseMemoryLib - BaseLib - PrintLib - HiiLib - MemoryAllocationLib - DxeServicesTableLib - UIToolKitLib - DxeServicesLib - BmpSupportLib - MsUiThemeLib - MsColorTableLib - SwmDialogsLib - -[Protocols] - gEdkiiFormDisplayEngineProtocolGuid ## PRODUCES - gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES - gMsSWMProtocolGuid ## CONSUMES - gEfiGraphicsOutputProtocolGuid ## CONSUMES - gEfiHiiFontProtocolGuid ## CONSUMES - gEfiSimpleTextInputExProtocolGuid ## CONSUMES - gMsOSKProtocolGuid ## CONSUMES - -[Depex] - gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid AND gEdkiiFormBrowserEx2ProtocolGuid AND gMsSWMProtocolGuid - -[FeaturePcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu ## CONSUMES - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdCurrentPointerState - -[UserExtensions.TianoCore."ExtraFiles"] - DisplayEngineExtra.uni - -[Guids] - gMsEventMasterFrameNotifyGroupGuid ## CONSUMES - gEfiEventReadyToBootGuid ## CONSUMES +## @file +# The DXE driver produces FORM DISPLAY ENGINE protocol. +# +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +#Override : 00000002 | MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf | 60ed12cbc6548db7016bd842943cb8be | 2022-02-07T20-47-30 | 683ed68b7ecab2be6740359535a52a3ea086dd8a + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DisplayEngine + FILE_GUID = c09e4ce4-ae29-4340-b941-078871bd89d1 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = InitializeDisplayEngine + UNLOAD_IMAGE = UnloadDisplayEngine +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC AARCH64 +# + +[Sources] + FormDisplayStr.uni + FormDisplay.c + FormDisplay.h + ProcessOptions.c + InputHandler.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiBootServicesTableLib + DebugLib + BaseMemoryLib + BaseLib + PrintLib + HiiLib + MemoryAllocationLib + DxeServicesTableLib + UIToolKitLib + DxeServicesLib + BmpSupportLib + MsUiThemeLib + MsColorTableLib + SwmDialogsLib + +[Protocols] + gEdkiiFormDisplayEngineProtocolGuid ## PRODUCES + gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES + gMsSWMProtocolGuid ## CONSUMES + gEfiGraphicsOutputProtocolGuid ## CONSUMES + gEfiHiiFontProtocolGuid ## CONSUMES + gEfiSimpleTextInputExProtocolGuid ## CONSUMES + gMsOSKProtocolGuid ## CONSUMES + +[Depex] + gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid AND gEdkiiFormBrowserEx2ProtocolGuid AND gMsSWMProtocolGuid + +[FeaturePcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu ## CONSUMES + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdCurrentPointerState + +[UserExtensions.TianoCore."ExtraFiles"] + DisplayEngineExtra.uni + +[Guids] + gMsEventMasterFrameNotifyGroupGuid ## CONSUMES + gEfiEventReadyToBootGuid ## CONSUMES diff --git a/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineExtra.uni b/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineExtra.uni index 9529b04191..4c8ced7d9a 100644 --- a/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineExtra.uni +++ b/MsGraphicsPkg/DisplayEngineDxe/DisplayEngineExtra.uni @@ -1,15 +1,15 @@ -// /** @file -// DisplayEngine Localized Strings and Content -// -// Copyright (c) 2014 - 2018, Intel Corporation. -// Copyright (C) Microsoft Corporation. All rights reserved.. -// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - -#string STR_PROPERTIES_MODULE_NAME -#language en-US -"DisplayEngine DXE Driver" - - +// /** @file +// DisplayEngine Localized Strings and Content +// +// Copyright (c) 2014 - 2018, Intel Corporation. +// Copyright (C) Microsoft Corporation. All rights reserved.. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"DisplayEngine DXE Driver" + + diff --git a/MsGraphicsPkg/DisplayEngineDxe/FormDisplayStr.uni b/MsGraphicsPkg/DisplayEngineDxe/FormDisplayStr.uni index 4f0c04e644..a150ac0be4 100644 --- a/MsGraphicsPkg/DisplayEngineDxe/FormDisplayStr.uni +++ b/MsGraphicsPkg/DisplayEngineDxe/FormDisplayStr.uni @@ -1,42 +1,42 @@ -// *++ -// -// Copyright (c) 2004 - 2014, Intel Corporation. -// Copyright (C) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// Module Name: -// -// SetupBrowserStr.uni -// -// Abstract: -// -// String definitions for Browser. -// -// --*/ - - -/=# - -#langdef en-US "English" -#langdef fr-FR "Français" - -#string UNKNOWN_STRING #language en-US "!" - #language fr-FR "!" -#string STATUS_BROWSER_ERROR #language en-US "Browser met some error, return!" - #language fr-FR "Browser met some error, return!" -#string STATUS_BROWSER_FORM_NOT_FOUND #language en-US "Form not found, return!" - #language fr-FR "Form not found, return!" -#string STATUS_BROWSER_NO_SUBMIT_IF #language en-US "Not allowed to submit, return!" - #language fr-FR "Not allowed to submit, return!" -#string SAVE_FAILED #language en-US "Failed to Save" - #language fr-FR "Échouer à économiser" -#string NO_SUBMIT_IF_CHECK_FAILED #language en-US "NO_SUBMIT_IF check fail." - #language fr-FR "NO_SUBMIT_IF check fail." -#string FORM_SUPPRESSED #language en-US "Form is suppressed. Nothing is displayed." - #language fr-FR "Form is suppressed. Nothing is displayed." -#string PROTOCOL_NOT_FOUND #language en-US "Convert string to device path fail. Can't goto the destination." - #language fr-FR "Convert string to device path fail. Can't goto the destination." -#string DISCARD_OR_JUMP #language en-US "Press OK to continue" - #language fr-FR "Press OK to continue" -#string DISCARD_OR_CHECK #language en-US "Press OK to discard the changes then continue" - #language fr-FR "Press OK to discard the changes then continue" +// *++ +// +// Copyright (c) 2004 - 2014, Intel Corporation. +// Copyright (C) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// Module Name: +// +// SetupBrowserStr.uni +// +// Abstract: +// +// String definitions for Browser. +// +// --*/ + + +/=# + +#langdef en-US "English" +#langdef fr-FR "Français" + +#string UNKNOWN_STRING #language en-US "!" + #language fr-FR "!" +#string STATUS_BROWSER_ERROR #language en-US "Browser met some error, return!" + #language fr-FR "Browser met some error, return!" +#string STATUS_BROWSER_FORM_NOT_FOUND #language en-US "Form not found, return!" + #language fr-FR "Form not found, return!" +#string STATUS_BROWSER_NO_SUBMIT_IF #language en-US "Not allowed to submit, return!" + #language fr-FR "Not allowed to submit, return!" +#string SAVE_FAILED #language en-US "Failed to Save" + #language fr-FR "Échouer à économiser" +#string NO_SUBMIT_IF_CHECK_FAILED #language en-US "NO_SUBMIT_IF check fail." + #language fr-FR "NO_SUBMIT_IF check fail." +#string FORM_SUPPRESSED #language en-US "Form is suppressed. Nothing is displayed." + #language fr-FR "Form is suppressed. Nothing is displayed." +#string PROTOCOL_NOT_FOUND #language en-US "Convert string to device path fail. Can't goto the destination." + #language fr-FR "Convert string to device path fail. Can't goto the destination." +#string DISCARD_OR_JUMP #language en-US "Press OK to continue" + #language fr-FR "Press OK to continue" +#string DISCARD_OR_CHECK #language en-US "Press OK to discard the changes then continue" + #language fr-FR "Press OK to discard the changes then continue" diff --git a/MsGraphicsPkg/DisplayEngineDxe/ReadMe.md b/MsGraphicsPkg/DisplayEngineDxe/ReadMe.md index e04096df2d..3b0b967a15 100644 --- a/MsGraphicsPkg/DisplayEngineDxe/ReadMe.md +++ b/MsGraphicsPkg/DisplayEngineDxe/ReadMe.md @@ -1,12 +1,12 @@ -# DisplayEngineDxe Driver - -## About - -This DisplayEngine driver supports the SetupBrowser display engine interface, and this version -uses the Simple Window Manager to implement the backend of the IFR operations. -Currently, not all IFR's are implemented. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# DisplayEngineDxe Driver + +## About + +This DisplayEngine driver supports the SetupBrowser display engine interface, and this version +uses the Simple Window Manager to implement the backend of the IFR operations. +Currently, not all IFR's are implemented. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Docs/ReadMe.md b/MsGraphicsPkg/Docs/ReadMe.md index 1a36f89dac..71b82a4e45 100644 --- a/MsGraphicsPkg/Docs/ReadMe.md +++ b/MsGraphicsPkg/Docs/ReadMe.md @@ -1,10 +1,10 @@ -# MS Graphics Package - -## About - -This package has shared drivers and libraries that extend the UEFI graphics with a simple windowing system. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# MS Graphics Package + +## About + +This package has shared drivers and libraries that extend the UEFI graphics with a simple windowing system. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/GopOverrideDxe/GopOverrideDxe.inf b/MsGraphicsPkg/GopOverrideDxe/GopOverrideDxe.inf index b09596c50d..b50a7b3964 100644 --- a/MsGraphicsPkg/GopOverrideDxe/GopOverrideDxe.inf +++ b/MsGraphicsPkg/GopOverrideDxe/GopOverrideDxe.inf @@ -1,49 +1,49 @@ -## @file -# Implements a Graphics (GOP) Override Driver -# -# Copyright (C) Microsoft Corporation. All rights reserved.. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = GopOverrideDxe - FILE_GUID = 27D4595D-D3AA-4008-9B02-881B0AC25F09 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = DriverInit - UNLOAD_IMAGE = DriverUnload - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - GopOverrideDxe.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - BaseLib - MemoryAllocationLib - DxeServicesTableLib - UefiBootServicesTableLib - PcdLib - -[Guids] - -[Protocols] - gEfiGraphicsOutputProtocolGuid # CONSUMES - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdMsGopOverrideProtocolGuid - -[Depex] - TRUE +## @file +# Implements a Graphics (GOP) Override Driver +# +# Copyright (C) Microsoft Corporation. All rights reserved.. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = GopOverrideDxe + FILE_GUID = 27D4595D-D3AA-4008-9B02-881B0AC25F09 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = DriverInit + UNLOAD_IMAGE = DriverUnload + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + GopOverrideDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + BaseLib + MemoryAllocationLib + DxeServicesTableLib + UefiBootServicesTableLib + PcdLib + +[Guids] + +[Protocols] + gEfiGraphicsOutputProtocolGuid # CONSUMES + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdMsGopOverrideProtocolGuid + +[Depex] + TRUE diff --git a/MsGraphicsPkg/GopOverrideDxe/ReadMe.md b/MsGraphicsPkg/GopOverrideDxe/ReadMe.md index d196f047a3..2d087727f7 100644 --- a/MsGraphicsPkg/GopOverrideDxe/ReadMe.md +++ b/MsGraphicsPkg/GopOverrideDxe/ReadMe.md @@ -1,11 +1,11 @@ -# Gop Override Dxe Driver - -## About - -This driver provides a less optimal method of providing the MsGopOverrideProtocol for the -Rendering Engine. See [What Does the GopOverrideDxe Do](GopOverrideOverview_mu.png) - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Gop Override Dxe Driver + +## About + +This driver provides a less optimal method of providing the MsGopOverrideProtocol for the +Rendering Engine. See [What Does the GopOverrideDxe Do](GopOverrideOverview_mu.png) + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/BaseUiProgressCircleLib/ReadMe.md b/MsGraphicsPkg/Library/BaseUiProgressCircleLib/ReadMe.md index 038267ca63..87bb783b36 100644 --- a/MsGraphicsPkg/Library/BaseUiProgressCircleLib/ReadMe.md +++ b/MsGraphicsPkg/Library/BaseUiProgressCircleLib/ReadMe.md @@ -1,11 +1,11 @@ -# Base Ui Progress Circle Library - -## About - -Implements Ui Progress Circle or Donut. -You can specify 100% or drawing whatever segments you specify. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Base Ui Progress Circle Library + +## About + +Implements Ui Progress Circle or Donut. +You can specify 100% or drawing whatever segments you specify. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/BaseUiProgressCircleLib/UiProgressCircleLib.inf b/MsGraphicsPkg/Library/BaseUiProgressCircleLib/UiProgressCircleLib.inf index 4e319894ef..8fed1102dd 100644 --- a/MsGraphicsPkg/Library/BaseUiProgressCircleLib/UiProgressCircleLib.inf +++ b/MsGraphicsPkg/Library/BaseUiProgressCircleLib/UiProgressCircleLib.inf @@ -1,34 +1,34 @@ -## @file -# A Library that supports drawing a Circle/Donut UI element. -# Support for both progress 1-100 or indeterminate -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UiProgressCircleLib - FILE_GUID = DBCB03A1-50C6-4668-BF93-8D99525B7C72 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = UiProgressCircleLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - ProgressCircle.c - -[Packages] - MdePkg/MdePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - - -[LibraryClasses] - DebugLib - MemoryAllocationLib +## @file +# A Library that supports drawing a Circle/Donut UI element. +# Support for both progress 1-100 or indeterminate +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = UiProgressCircleLib + FILE_GUID = DBCB03A1-50C6-4668-BF93-8D99525B7C72 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = UiProgressCircleLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + ProgressCircle.c + +[Packages] + MdePkg/MdePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + + +[LibraryClasses] + DebugLib + MemoryAllocationLib BaseMemoryLib \ No newline at end of file diff --git a/MsGraphicsPkg/Library/BaseUiRectangleLib/BaseUiRectangleLib.inf b/MsGraphicsPkg/Library/BaseUiRectangleLib/BaseUiRectangleLib.inf index d3484eb58d..046ced1187 100644 --- a/MsGraphicsPkg/Library/BaseUiRectangleLib/BaseUiRectangleLib.inf +++ b/MsGraphicsPkg/Library/BaseUiRectangleLib/BaseUiRectangleLib.inf @@ -1,35 +1,35 @@ -## @file -# LIbrary to display the On screen notifications for the platform -# -# -# @copyright -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -# -## - - -[Defines] -INF_VERSION = 0x00010017 -BASE_NAME = BaseUiRectangleLib -FILE_GUID = F42F50A1-1344-4A07-A32D-9C216499A2F4 -VERSION_STRING = 1.0 -MODULE_TYPE = BASE -LIBRARY_CLASS = UiRectangleLib - - -[LibraryClasses] -DebugLib -MemoryAllocationLib -FrameBufferMemDrawLib - - -[Packages] -MdePkg/MdePkg.dec -MsGraphicsPkg/MsGraphicsPkg.dec - - -[Sources] -UiRectangle.c -UiRectangle.h +## @file +# LIbrary to display the On screen notifications for the platform +# +# +# @copyright +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +# +## + + +[Defines] +INF_VERSION = 0x00010017 +BASE_NAME = BaseUiRectangleLib +FILE_GUID = F42F50A1-1344-4A07-A32D-9C216499A2F4 +VERSION_STRING = 1.0 +MODULE_TYPE = BASE +LIBRARY_CLASS = UiRectangleLib + + +[LibraryClasses] +DebugLib +MemoryAllocationLib +FrameBufferMemDrawLib + + +[Packages] +MdePkg/MdePkg.dec +MsGraphicsPkg/MsGraphicsPkg.dec + + +[Sources] +UiRectangle.c +UiRectangle.h diff --git a/MsGraphicsPkg/Library/BaseUiRectangleLib/ReadMe.md b/MsGraphicsPkg/Library/BaseUiRectangleLib/ReadMe.md index 796108e1a7..f6e0628158 100644 --- a/MsGraphicsPkg/Library/BaseUiRectangleLib/ReadMe.md +++ b/MsGraphicsPkg/Library/BaseUiRectangleLib/ReadMe.md @@ -1,11 +1,11 @@ -# Base UI Rectanble Library - -## About - -This library provides the ability to draw rectangles on the display. -They can be solid, checkered, or striped. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Base UI Rectanble Library + +## About + +This library provides the ability to draw rectangles on the display. +They can be solid, checkered, or striped. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/BootGraphicsLib/BootGraphicsLib.inf b/MsGraphicsPkg/Library/BootGraphicsLib/BootGraphicsLib.inf index 964019e212..991c22e43c 100644 --- a/MsGraphicsPkg/Library/BootGraphicsLib/BootGraphicsLib.inf +++ b/MsGraphicsPkg/Library/BootGraphicsLib/BootGraphicsLib.inf @@ -1,49 +1,49 @@ -## @file -# This library is for showing the main system boot graphics. -# -# Copyright (C) Microsoft Corporation. All rights reserved.. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BootGraphicsLib - FILE_GUID = 0d42b5bd-b0d0-41e8-8432-8cc303b672f2 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = BootGraphicsLib|DXE_DRIVER UEFI_APPLICATION - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - BootGraphicsLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiLib - DebugLib - PcdLib - DisplayDeviceStateLib - BootGraphicsProviderLib - BmpSupportLib - MemoryAllocationLib - -[Protocols] - gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES - gEdkiiBootLogo2ProtocolGuid ## SOMETIMES_CONSUMES - -[Guids] - gLogoDisplayedEventGroup ## CONSUMES - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdPostBackgroundColoringSkipCount - +## @file +# This library is for showing the main system boot graphics. +# +# Copyright (C) Microsoft Corporation. All rights reserved.. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BootGraphicsLib + FILE_GUID = 0d42b5bd-b0d0-41e8-8432-8cc303b672f2 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = BootGraphicsLib|DXE_DRIVER UEFI_APPLICATION + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + BootGraphicsLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiLib + DebugLib + PcdLib + DisplayDeviceStateLib + BootGraphicsProviderLib + BmpSupportLib + MemoryAllocationLib + +[Protocols] + gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES + gEdkiiBootLogo2ProtocolGuid ## SOMETIMES_CONSUMES + +[Guids] + gLogoDisplayedEventGroup ## CONSUMES + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdPostBackgroundColoringSkipCount + diff --git a/MsGraphicsPkg/Library/BootGraphicsLib/ReadMe.md b/MsGraphicsPkg/Library/BootGraphicsLib/ReadMe.md index 2f96859695..61143917fa 100644 --- a/MsGraphicsPkg/Library/BootGraphicsLib/ReadMe.md +++ b/MsGraphicsPkg/Library/BootGraphicsLib/ReadMe.md @@ -1,11 +1,11 @@ -# Boot Graphics Library - -## About - -This BootGraphicsLib is only intended to be used by BDS to draw the main boot graphics to the -screen. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Boot Graphics Library + +## About + +This BootGraphicsLib is only intended to be used by BDS to draw the main boot graphics to the +screen. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/BootGraphicsLibNull/BootGraphicsLib.inf b/MsGraphicsPkg/Library/BootGraphicsLibNull/BootGraphicsLib.inf index 2b8cd8a119..25c230a959 100644 --- a/MsGraphicsPkg/Library/BootGraphicsLibNull/BootGraphicsLib.inf +++ b/MsGraphicsPkg/Library/BootGraphicsLibNull/BootGraphicsLib.inf @@ -1,38 +1,38 @@ -## @file -# This library is for showing the main system boot graphics. NULL implementation for testing -# -# Copyright (C) Microsoft Corporation. All rights reserved.. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BootGraphicsLib - FILE_GUID = 772d66cc-bf69-4ef7-9779-9f4c88f1b507 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = BootGraphicsLib|DXE_DRIVER UEFI_APPLICATION - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - BootGraphicsLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - - -[Protocols] - - -[Pcd] - - +## @file +# This library is for showing the main system boot graphics. NULL implementation for testing +# +# Copyright (C) Microsoft Corporation. All rights reserved.. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BootGraphicsLib + FILE_GUID = 772d66cc-bf69-4ef7-9779-9f4c88f1b507 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = BootGraphicsLib|DXE_DRIVER UEFI_APPLICATION + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + BootGraphicsLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + + +[Protocols] + + +[Pcd] + + diff --git a/MsGraphicsPkg/Library/BootGraphicsLibNull/ReadMe.md b/MsGraphicsPkg/Library/BootGraphicsLibNull/ReadMe.md index 69473509c8..72b461bcfc 100644 --- a/MsGraphicsPkg/Library/BootGraphicsLibNull/ReadMe.md +++ b/MsGraphicsPkg/Library/BootGraphicsLibNull/ReadMe.md @@ -1,10 +1,10 @@ -# Boot Graphics Null Library - -## About - -This library is used in the CI build configuration. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Boot Graphics Null Library + +## About + +This library is used in the CI build configuration. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/BootGraphicsProviderLib.inf b/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/BootGraphicsProviderLib.inf index 5942160dd0..5600e4e1f5 100644 --- a/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/BootGraphicsProviderLib.inf +++ b/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/BootGraphicsProviderLib.inf @@ -1,38 +1,38 @@ -## @file -# This library is NULL implementation for testing -# -# Copyright (C) Microsoft Corporation. All rights reserved.. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BootGraphicsProviderLibNull - FILE_GUID = ad2b103b-e42e-476d-b96c-7aff7c6ff375 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = BootGraphicsProviderLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - BootGraphicsProviderLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - - -[Protocols] - - -[Pcd] - - +## @file +# This library is NULL implementation for testing +# +# Copyright (C) Microsoft Corporation. All rights reserved.. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BootGraphicsProviderLibNull + FILE_GUID = ad2b103b-e42e-476d-b96c-7aff7c6ff375 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = BootGraphicsProviderLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + BootGraphicsProviderLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + + +[Protocols] + + +[Pcd] + + diff --git a/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/ReadMe.md b/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/ReadMe.md index 2173dc4a27..3af26a63a4 100644 --- a/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/ReadMe.md +++ b/MsGraphicsPkg/Library/BootGraphicsProviderLibNull/ReadMe.md @@ -1,10 +1,10 @@ -# Boot Graphics Provider NULL Library - -## About - -This library is used by CI builds to test compile users of the BootGraphicsLib. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Boot Graphics Provider NULL Library + +## About + +This library is used by CI builds to test compile users of the BootGraphicsLib. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ColorBarDisplayDeviceStateLib.inf b/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ColorBarDisplayDeviceStateLib.inf index 183f814ea2..74c7a4f800 100644 --- a/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ColorBarDisplayDeviceStateLib.inf +++ b/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ColorBarDisplayDeviceStateLib.inf @@ -1,40 +1,40 @@ -## @file -# Library to display the device state notifications for the platform using color bars -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] -INF_VERSION = 0x00010017 -BASE_NAME = ColorBarDisplayDeviceStateLib -FILE_GUID = 31BDD15E-B4B9-4028-ACA8-27892F194473 -VERSION_STRING = 1.0 -MODULE_TYPE = BASE -LIBRARY_CLASS = DisplayDeviceStateLib - - -[LibraryClasses] -DebugLib -UiRectangleLib -MemoryAllocationLib -DeviceStateLib -BaseMemoryLib - - -[Packages] -MdePkg/MdePkg.dec -MdeModulePkg/MdeModulePkg.dec -MsGraphicsPkg/MsGraphicsPkg.dec -MsCorePkg/MsCorePkg.dec - - -[Sources] -ColorBarDisplayDeviceStateLib.c -Resources/UnlockBitmap.h -Resources/UnlockBitmap32.h -Resources/UnlockBitmap64.h -Resources/UnlockBitmap112.h -Resources/UnlockBitmap128.h -Resources/UnlockBitmap256.h +## @file +# Library to display the device state notifications for the platform using color bars +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] +INF_VERSION = 0x00010017 +BASE_NAME = ColorBarDisplayDeviceStateLib +FILE_GUID = 31BDD15E-B4B9-4028-ACA8-27892F194473 +VERSION_STRING = 1.0 +MODULE_TYPE = BASE +LIBRARY_CLASS = DisplayDeviceStateLib + + +[LibraryClasses] +DebugLib +UiRectangleLib +MemoryAllocationLib +DeviceStateLib +BaseMemoryLib + + +[Packages] +MdePkg/MdePkg.dec +MdeModulePkg/MdeModulePkg.dec +MsGraphicsPkg/MsGraphicsPkg.dec +MsCorePkg/MsCorePkg.dec + + +[Sources] +ColorBarDisplayDeviceStateLib.c +Resources/UnlockBitmap.h +Resources/UnlockBitmap32.h +Resources/UnlockBitmap64.h +Resources/UnlockBitmap112.h +Resources/UnlockBitmap128.h +Resources/UnlockBitmap256.h diff --git a/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ReadMe.md b/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ReadMe.md index 0639856ecf..e156bf4b32 100644 --- a/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ReadMe.md +++ b/MsGraphicsPkg/Library/ColorBarDisplayDeviceStateLib/ReadMe.md @@ -1,20 +1,20 @@ -# Color Bar Display Device State Library - -## About - -There are a number of states that are critical when manufacturing a system. -Some of these are the fuses that must be set that protect the device. -These fuses are not set on some machines for test purposes, etc. - -To quickly notice that these customer critical settings are correct, this library display color -bars on the display if there state is not in the secure state. - -This allows an end user to quickly notice that secure boot is off. - -This allows an end of line tester to verify that the fuses are in the correct state for -customer delivery. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Color Bar Display Device State Library + +## About + +There are a number of states that are critical when manufacturing a system. +Some of these are the fuses that must be set that protect the device. +These fuses are not set on some machines for test purposes, etc. + +To quickly notice that these customer critical settings are correct, this library display color +bars on the display if there state is not in the secure state. + +This allows an end user to quickly notice that secure boot is off. + +This allows an end of line tester to verify that the fuses are in the correct state for +customer delivery. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/DisplayDeviceStateLibNull.inf b/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/DisplayDeviceStateLibNull.inf index d9dc62732d..e604400a9e 100644 --- a/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/DisplayDeviceStateLibNull.inf +++ b/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/DisplayDeviceStateLibNull.inf @@ -1,27 +1,27 @@ -## @file -# Null library for displaying device state -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] -INF_VERSION = 0x00010017 -BASE_NAME = DisplayDeviceStateLibNull -FILE_GUID = 64A22F09-750E-4C9E-96AD-0C2572D07C26 -VERSION_STRING = 1.0 -MODULE_TYPE = BASE -LIBRARY_CLASS = DisplayDeviceStateLib - - -[LibraryClasses] - - - -[Packages] -MdePkg/MdePkg.dec - - -[Sources] -DisplayDeviceStateLibNull.c +## @file +# Null library for displaying device state +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] +INF_VERSION = 0x00010017 +BASE_NAME = DisplayDeviceStateLibNull +FILE_GUID = 64A22F09-750E-4C9E-96AD-0C2572D07C26 +VERSION_STRING = 1.0 +MODULE_TYPE = BASE +LIBRARY_CLASS = DisplayDeviceStateLib + + +[LibraryClasses] + + + +[Packages] +MdePkg/MdePkg.dec + + +[Sources] +DisplayDeviceStateLibNull.c diff --git a/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/ReadMe.md b/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/ReadMe.md index 4b99183ff5..044b4ab0d7 100644 --- a/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/ReadMe.md +++ b/MsGraphicsPkg/Library/DisplayDeviceStateLibNull/ReadMe.md @@ -1,11 +1,11 @@ -# Display Device State Null Library - -## About - -The Display Device State NULL library is in the CI build when a real DisplayDeviceState library -is not accessible. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Display Device State Null Library + +## About + +The Display Device State NULL library is in the CI build when a real DisplayDeviceState library +is not accessible. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/MsColorTableLib/MsColorTableLib.inf b/MsGraphicsPkg/Library/MsColorTableLib/MsColorTableLib.inf index 0c0f239640..43461bba28 100644 --- a/MsGraphicsPkg/Library/MsColorTableLib/MsColorTableLib.inf +++ b/MsGraphicsPkg/Library/MsColorTableLib/MsColorTableLib.inf @@ -1,28 +1,28 @@ -## @file MsColorTableLib -# A shared place for all colors used in this package -# -# @copyright -# Copyright (C) Microsoft Corporation. All rights reserved.. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsColorTableLib - FILE_GUID = 48E8F777-6876-42E8-8DD3-223EA1930DB9 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsColorTableLib - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsColorTableLib.c - -[Packages] - MdePkg/MdePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] +## @file MsColorTableLib +# A shared place for all colors used in this package +# +# @copyright +# Copyright (C) Microsoft Corporation. All rights reserved.. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsColorTableLib + FILE_GUID = 48E8F777-6876-42E8-8DD3-223EA1930DB9 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsColorTableLib + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsColorTableLib.c + +[Packages] + MdePkg/MdePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] diff --git a/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Dxe/MsEarlyGraphicsLibNull.inf b/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Dxe/MsEarlyGraphicsLibNull.inf index 3c673691bd..326167ca92 100644 --- a/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Dxe/MsEarlyGraphicsLibNull.inf +++ b/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Dxe/MsEarlyGraphicsLibNull.inf @@ -1,37 +1,37 @@ -## @file -# Dxe MsEarly Graphics library instance. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsPlatformEarlyGraphicsLibNull - FILE_GUID = C24D06EC-4F1F-4A1C-BB0B-FE75828A3556 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsPlatformEarlyGraphicsLib|DXE_DRIVER DXE_RUNTIME_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsEarlyGraphicsLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - -[Guids] - -[Protocols] - -[Depex] - TRUE - +## @file +# Dxe MsEarly Graphics library instance. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsPlatformEarlyGraphicsLibNull + FILE_GUID = C24D06EC-4F1F-4A1C-BB0B-FE75828A3556 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsPlatformEarlyGraphicsLib|DXE_DRIVER DXE_RUNTIME_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsEarlyGraphicsLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + +[Guids] + +[Protocols] + +[Depex] + TRUE + diff --git a/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Pei/MsEarlyGraphicsLibNull.inf b/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Pei/MsEarlyGraphicsLibNull.inf index 28b2a652e5..c5c849b05a 100644 --- a/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Pei/MsEarlyGraphicsLibNull.inf +++ b/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/Pei/MsEarlyGraphicsLibNull.inf @@ -1,35 +1,35 @@ -## @file -# Pei MsEarlyGraphics Library -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsPlatformEarlyGraphicsLibNull - FILE_GUID = FB246AFC-92DE-4800-8D15-35D1BDD0CF0C - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsPlatformEarlyGraphicsLib|PEIM - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only) -# - -[Sources] - MsEarlyGraphicsLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - -[Ppis] - -[Depex] - TRUE - +## @file +# Pei MsEarlyGraphics Library +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsPlatformEarlyGraphicsLibNull + FILE_GUID = FB246AFC-92DE-4800-8D15-35D1BDD0CF0C + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsPlatformEarlyGraphicsLib|PEIM + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only) +# + +[Sources] + MsEarlyGraphicsLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + +[Ppis] + +[Depex] + TRUE + diff --git a/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/ReadMe.md b/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/ReadMe.md index 0a0199c272..615e8af996 100644 --- a/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/ReadMe.md +++ b/MsGraphicsPkg/Library/MsEarlyGraphicsLibNull/ReadMe.md @@ -1,10 +1,10 @@ -# Ms Early Graphics NULL Library - -## About - -This library is used in the CI build configuration. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Ms Early Graphics NULL Library + +## About + +This library is used in the CI build configuration. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/MsUiThemeCopyLib/MsUiThemeCopyLib.inf b/MsGraphicsPkg/Library/MsUiThemeCopyLib/MsUiThemeCopyLib.inf index fa98c5d861..56f7339b86 100644 --- a/MsGraphicsPkg/Library/MsUiThemeCopyLib/MsUiThemeCopyLib.inf +++ b/MsGraphicsPkg/Library/MsUiThemeCopyLib/MsUiThemeCopyLib.inf @@ -1,32 +1,32 @@ -## @file MsUiThemeCopyLib.inf -# -# This library contains access functions for dealing with the -# Copying of an MS_UI_THEME -# -# @copyright -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MsUiThemeCopyLib - FILE_GUID = 7A6722F7-4446-4112-9802-F6B7DEE04824 - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = MsUiThemeCopyLib - -[Sources] - MsUiThemeCopyLib.c - -[Packages] - MsGraphicsPkg/MsGraphicsPkg.dec - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - -[BuildOptions] +## @file MsUiThemeCopyLib.inf +# +# This library contains access functions for dealing with the +# Copying of an MS_UI_THEME +# +# @copyright +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MsUiThemeCopyLib + FILE_GUID = 7A6722F7-4446-4112-9802-F6B7DEE04824 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = MsUiThemeCopyLib + +[Sources] + MsUiThemeCopyLib.c + +[Packages] + MsGraphicsPkg/MsGraphicsPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + +[BuildOptions] # DEBUG_*_*_CC_FLAGS = /FAcs /P \ No newline at end of file diff --git a/MsGraphicsPkg/Library/MsUiThemeCopyLib/ReadMe.md b/MsGraphicsPkg/Library/MsUiThemeCopyLib/ReadMe.md index 96b3013649..b4ea6984c2 100644 --- a/MsGraphicsPkg/Library/MsUiThemeCopyLib/ReadMe.md +++ b/MsGraphicsPkg/Library/MsUiThemeCopyLib/ReadMe.md @@ -1,10 +1,10 @@ -# Ms Ui Theme Copy Library - -## About - -MsUiThemeCopyLib is used to unpack the fonts from the packed FV into execution time structures. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Ms Ui Theme Copy Library + +## About + +MsUiThemeCopyLib is used to unpack the fonts from the packed FV into execution time structures. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/MsUiThemeLib/Dxe/MsUiThemeLib.inf b/MsGraphicsPkg/Library/MsUiThemeLib/Dxe/MsUiThemeLib.inf index b5f444b6f7..10ed99b67d 100644 --- a/MsGraphicsPkg/Library/MsUiThemeLib/Dxe/MsUiThemeLib.inf +++ b/MsGraphicsPkg/Library/MsUiThemeLib/Dxe/MsUiThemeLib.inf @@ -1,46 +1,46 @@ -## @file -# MsUiThemeLib.inf -# -# Description: Supplies the theme for this platform to the UEFI settings UI -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsUiThemeLib - FILE_GUID = bbcd73b4-b796-4d4a-b927-334dd8adf502 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsUiThemeLib|DXE_DRIVER UEFI_APPLICATION DXE_RUNTIME_DRIVER UEFI_DRIVER - CONSTRUCTOR = MsUiThemeLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsUiThemeLib.c - ../MsUiThemeLibCommon.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - DebugLib - UefiBootServicesTableLib - -[Protocols] - gMsUiThemeProtocolGuid - -[Guids] - -[Depex] - gMsUiThemeProtocolGuid - -[BuildOptions] - - +## @file +# MsUiThemeLib.inf +# +# Description: Supplies the theme for this platform to the UEFI settings UI +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsUiThemeLib + FILE_GUID = bbcd73b4-b796-4d4a-b927-334dd8adf502 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsUiThemeLib|DXE_DRIVER UEFI_APPLICATION DXE_RUNTIME_DRIVER UEFI_DRIVER + CONSTRUCTOR = MsUiThemeLibConstructor + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsUiThemeLib.c + ../MsUiThemeLibCommon.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + DebugLib + UefiBootServicesTableLib + +[Protocols] + gMsUiThemeProtocolGuid + +[Guids] + +[Depex] + gMsUiThemeProtocolGuid + +[BuildOptions] + + diff --git a/MsGraphicsPkg/Library/MsUiThemeLib/Pei/MsUiThemeLib.inf b/MsGraphicsPkg/Library/MsUiThemeLib/Pei/MsUiThemeLib.inf index 9ccdecd220..8ad34f2271 100644 --- a/MsGraphicsPkg/Library/MsUiThemeLib/Pei/MsUiThemeLib.inf +++ b/MsGraphicsPkg/Library/MsUiThemeLib/Pei/MsUiThemeLib.inf @@ -1,46 +1,46 @@ -## @file -# MsUiThemeLib.inf -# -# Description: Supplies the theme for this platform to the UEFI settings UI -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsUiThemeLib - FILE_GUID = 61dd6b10-d4ad-4173-b11b-2e52fe113d23 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsUiThemeLib|PEIM - CONSTRUCTOR = MsUiThemeLibConstructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsUiThemeLib.c - ../MsUiThemeLibCommon.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - DebugLib - PeimEntryPoint - HobLib - -[Protocols] - -[Guids] - -[Depex] - gMsUiThemePpiGuid - -[BuildOptions] - - +## @file +# MsUiThemeLib.inf +# +# Description: Supplies the theme for this platform to the UEFI settings UI +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsUiThemeLib + FILE_GUID = 61dd6b10-d4ad-4173-b11b-2e52fe113d23 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsUiThemeLib|PEIM + CONSTRUCTOR = MsUiThemeLibConstructor + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsUiThemeLib.c + ../MsUiThemeLibCommon.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + DebugLib + PeimEntryPoint + HobLib + +[Protocols] + +[Guids] + +[Depex] + gMsUiThemePpiGuid + +[BuildOptions] + + diff --git a/MsGraphicsPkg/Library/MsUiThemeLib/ReadMe.md b/MsGraphicsPkg/Library/MsUiThemeLib/ReadMe.md index 4e231a00b8..aa4f5fe90c 100644 --- a/MsGraphicsPkg/Library/MsUiThemeLib/ReadMe.md +++ b/MsGraphicsPkg/Library/MsUiThemeLib/ReadMe.md @@ -1,10 +1,10 @@ -# Ms Ui Theme Library - -## About - -The MsUiThemeLib publishes the MuUiTheme (Ppi/Protocol). - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Ms Ui Theme Library + +## About + +The MsUiThemeLib publishes the MuUiTheme (Ppi/Protocol). + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/QrEncoderLib/ReadMe.md b/MsGraphicsPkg/Library/QrEncoderLib/ReadMe.md index bdc393f8f5..19ce449832 100644 --- a/MsGraphicsPkg/Library/QrEncoderLib/ReadMe.md +++ b/MsGraphicsPkg/Library/QrEncoderLib/ReadMe.md @@ -1,12 +1,12 @@ -# Qr Encoder Library - -## About - -This package builds a QR code bit map object from binary data. -The encoder supports all 40 versions, all 4 error correction levels (L, Q, M, H), but only three -character encoding modes (Numeric, AlphNumeric, and Byte). - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Qr Encoder Library + +## About + +This package builds a QR code bit map object from binary data. +The encoder supports all 40 versions, all 4 error correction levels (L, Q, M, H), but only three +character encoding modes (Numeric, AlphNumeric, and Byte). + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/SamplePlatformThemeLib/PlatformThemeLib.inf b/MsGraphicsPkg/Library/SamplePlatformThemeLib/PlatformThemeLib.inf index 5e256af4d2..5c3074d7e7 100644 --- a/MsGraphicsPkg/Library/SamplePlatformThemeLib/PlatformThemeLib.inf +++ b/MsGraphicsPkg/Library/SamplePlatformThemeLib/PlatformThemeLib.inf @@ -1,35 +1,35 @@ -## @file -# MsPlatformThemeLib.inf -# -# Description: Supplies the platform theme. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PlatformThemeLib - FILE_GUID = 511bca7c-3c33-433c-85c5-5e3eb2bfcb8f - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = PlatformThemeLib - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - PlatformThemeLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - DebugLib - -[Protocols] - -[Guids] +## @file +# MsPlatformThemeLib.inf +# +# Description: Supplies the platform theme. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PlatformThemeLib + FILE_GUID = 511bca7c-3c33-433c-85c5-5e3eb2bfcb8f + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PlatformThemeLib + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + PlatformThemeLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + DebugLib + +[Protocols] + +[Guids] diff --git a/MsGraphicsPkg/Library/SamplePlatformThemeLib/ReadMe.md b/MsGraphicsPkg/Library/SamplePlatformThemeLib/ReadMe.md index d3b269ca9e..b2e26aa8fe 100644 --- a/MsGraphicsPkg/Library/SamplePlatformThemeLib/ReadMe.md +++ b/MsGraphicsPkg/Library/SamplePlatformThemeLib/ReadMe.md @@ -1,26 +1,26 @@ -# Sample Platform Theme Library - -## About - -The Sample Platform Theme Library is used to specify the fonts and display size information to -the Simple Window Manager. - -## How to choose scale and font sizes - -The starting point is a 3000 W x 2000 H display as a 100% size. - -Start with your display size. - -Scale = (The width in pixels of the your display) / 3000. - -Change the #define SCALE value to your whole number scale value. - -Using Scale, multiply each font size in the sample by your Scale value and select a font point -close to your Scale value.. -Keep in mind that each font must be a unique fonts. -The same font file cannot be used for multiple fonts. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Sample Platform Theme Library + +## About + +The Sample Platform Theme Library is used to specify the fonts and display size information to +the Simple Window Manager. + +## How to choose scale and font sizes + +The starting point is a 3000 W x 2000 H display as a 100% size. + +Start with your display size. + +Scale = (The width in pixels of the your display) / 3000. + +Change the #define SCALE value to your whole number scale value. + +Using Scale, multiply each font size in the sample by your Scale value and select a font point +close to your Scale value.. +Keep in mind that each font must be a unique fonts. +The same font file cannot be used for multiple fonts. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/SimpleUIToolKit/ReadMe.md b/MsGraphicsPkg/Library/SimpleUIToolKit/ReadMe.md index ecc14d36ad..1b6b38dda7 100644 --- a/MsGraphicsPkg/Library/SimpleUIToolKit/ReadMe.md +++ b/MsGraphicsPkg/Library/SimpleUIToolKit/ReadMe.md @@ -1,11 +1,11 @@ -# Simple UI ToolKit Library - -## About - -The Simple UI Toolkit library allows code to create interfaces dynamically. -The two sample users of the Simple UI Toolkit is the Display Engine and SwmDialogs Library. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Simple UI ToolKit Library + +## About + +The Simple UI Toolkit library allows code to create interfaces dynamically. +The two sample users of the Simple UI Toolkit is the Display Engine and SwmDialogs Library. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/SimpleUIToolKit/SimpleUIToolKit.inf b/MsGraphicsPkg/Library/SimpleUIToolKit/SimpleUIToolKit.inf index bb26999106..2ca145266f 100644 --- a/MsGraphicsPkg/Library/SimpleUIToolKit/SimpleUIToolKit.inf +++ b/MsGraphicsPkg/Library/SimpleUIToolKit/SimpleUIToolKit.inf @@ -1,61 +1,61 @@ -## @file -# ManufacturingModeLib.inf -# -# Description: Library for determining if Manufacturing mode should be -# enabled on this boot. This library is what everyone should -# use to determine which mode we are in. It can be called from -# PEI or DXE. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UIToolKitLib - FILE_GUID = 4042708A-0F2D-4823-AC60-0D77B311188A - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = UIToolKitLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - Bitmap.c - Button.c - Canvas.c - EditBox.c - Grid.c - Label.c - ListBox.c - SimpleUIToolKit.c - ToggleSwitch.c - Utilities.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - MathLib - MsUiThemeLib - PcdLib - FltUsedLib - -[Protocols] - gMsOSKProtocolGuid - -[Guids] - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdMsGopOverrideProtocolGuid - -[BuildOptions] - *_VS2013x86_*_CC_FLAGS = /Oi /Og /fp:fast /arch:SSE -# *_VS2015x86_*_CC_FLAGS = /Od /FAcs +## @file +# ManufacturingModeLib.inf +# +# Description: Library for determining if Manufacturing mode should be +# enabled on this boot. This library is what everyone should +# use to determine which mode we are in. It can be called from +# PEI or DXE. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = UIToolKitLib + FILE_GUID = 4042708A-0F2D-4823-AC60-0D77B311188A + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = UIToolKitLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + Bitmap.c + Button.c + Canvas.c + EditBox.c + Grid.c + Label.c + ListBox.c + SimpleUIToolKit.c + ToggleSwitch.c + Utilities.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + DebugLib + BaseMemoryLib + MathLib + MsUiThemeLib + PcdLib + FltUsedLib + +[Protocols] + gMsOSKProtocolGuid + +[Guids] + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdMsGopOverrideProtocolGuid + +[BuildOptions] + *_VS2013x86_*_CC_FLAGS = /Oi /Og /fp:fast /arch:SSE +# *_VS2015x86_*_CC_FLAGS = /Od /FAcs diff --git a/MsGraphicsPkg/Library/SwmDialogsLib/ReadMe.md b/MsGraphicsPkg/Library/SwmDialogsLib/ReadMe.md index 7affb609ad..ccba21ba03 100644 --- a/MsGraphicsPkg/Library/SwmDialogsLib/ReadMe.md +++ b/MsGraphicsPkg/Library/SwmDialogsLib/ReadMe.md @@ -1,19 +1,19 @@ -# Swm Dialogs Library - -## About - -The Simple Window Manager Dialog Library has a couple of dialogs that can be use by UEFI -application. -These dialogs use the Simple Window Manager. - -## Dialog types - -1. Simple Message Box -2. Password Prompt -3. Selection Prompt -4. SwmDialogsVerifyThumbprintPrompt special for DFCI - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Swm Dialogs Library + +## About + +The Simple Window Manager Dialog Library has a couple of dialogs that can be use by UEFI +application. +These dialogs use the Simple Window Manager. + +## Dialog types + +1. Simple Message Box +2. Password Prompt +3. Selection Prompt +4. SwmDialogsVerifyThumbprintPrompt special for DFCI + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogs.inf b/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogs.inf index 9ed603e548..06c526dc16 100644 --- a/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogs.inf +++ b/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogs.inf @@ -1,63 +1,63 @@ -## @file -# SwmDialogs.inf -# -# Description: Library to provide Dialog Boxes in a Simple Window Manager -# environment. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SwmDialogsLib - FILE_GUID = 16a792c5-000d-4a9d-932c-4e5f00bc6e57 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = SwmDialogsLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = SwmDialogsConstructor - DESTRUCTOR = SwmDialogsDestructor - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - SwmDialogs.c - SwmDialogs.h - MessageBox.c - PasswordDialog.c - SemmUserAuthDialog.c - SingleSelectDialog.c - SwmDialogsStrings.uni - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - HiiLib - MemoryAllocationLib - MsColorTableLib - MsUiThemeLib - UIToolKitLib - UefiBootServicesTableLib - - -[Protocols] - gMsSWMProtocolGuid - gMsOSKProtocolGuid - gEfiSimpleTextInputExProtocolGuid - -[Guids] - -[Pcd] - -[Depex] - -[BuildOptions] -# *_VS2015x86_*_CC_FLAGS = /Od /FAcs +## @file +# SwmDialogs.inf +# +# Description: Library to provide Dialog Boxes in a Simple Window Manager +# environment. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SwmDialogsLib + FILE_GUID = 16a792c5-000d-4a9d-932c-4e5f00bc6e57 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = SwmDialogsLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = SwmDialogsConstructor + DESTRUCTOR = SwmDialogsDestructor + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + SwmDialogs.c + SwmDialogs.h + MessageBox.c + PasswordDialog.c + SemmUserAuthDialog.c + SingleSelectDialog.c + SwmDialogsStrings.uni + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HiiLib + MemoryAllocationLib + MsColorTableLib + MsUiThemeLib + UIToolKitLib + UefiBootServicesTableLib + + +[Protocols] + gMsSWMProtocolGuid + gMsOSKProtocolGuid + gEfiSimpleTextInputExProtocolGuid + +[Guids] + +[Pcd] + +[Depex] + +[BuildOptions] +# *_VS2015x86_*_CC_FLAGS = /Od /FAcs diff --git a/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogsStrings.uni b/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogsStrings.uni index e90cdd2cf0..087cdc9736 100644 --- a/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogsStrings.uni +++ b/MsGraphicsPkg/Library/SwmDialogsLib/SwmDialogsStrings.uni @@ -1,42 +1,42 @@ -// *++ -// -// Strings for Simple Window Manager -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: BSD-2-Clause-Patent -// --*/ - -#langdef en-US " English " -#langdef fr-FR " Français " -#langdef ja-JP "\wide 日本語 " - -#langdef en " Standard English " -#langdef fr " Standard Français " -#langdef ja "\wide 日本語 " - -//////////////////////////////////////////////////////////////////////////////////// -// Generic Strings -// -#string STR_NULL_STRING #language en-US "" - #language ja-JP "" - -#string STR_GENERIC_YES_STRING #language en-US "Yes" - #language ja-JP "Yes" ## TODO - -#string STR_GENERIC_NO_STRING #language en-US "No" - #language ja-JP "No" ## TODO - -#string STR_GENERIC_OK_STRING #language en-US "Ok" - #language ja-JP "Ok" ## TODO - -#string STR_GENERIC_CANCEL_STRING #language en-US "Cancel" - #language ja-JP "Cancel" ## TODO - -#string STR_GENERIC_RETRY_STRING #language en-US "Retry" - #language ja-JP "Retry" ## TODO - -#string STR_GENERIC_NEXT_STRING #language en-US "Next" - #language ja-JP "Next" ## TODO - -#string STR_GENERIC_RESTART_STRING #language en-US "Restart now" - #language ja-JP "Restart now" ## TODO +// *++ +// +// Strings for Simple Window Manager +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: BSD-2-Clause-Patent +// --*/ + +#langdef en-US " English " +#langdef fr-FR " Français " +#langdef ja-JP "\wide 日本語 " + +#langdef en " Standard English " +#langdef fr " Standard Français " +#langdef ja "\wide 日本語 " + +//////////////////////////////////////////////////////////////////////////////////// +// Generic Strings +// +#string STR_NULL_STRING #language en-US "" + #language ja-JP "" + +#string STR_GENERIC_YES_STRING #language en-US "Yes" + #language ja-JP "Yes" ## TODO + +#string STR_GENERIC_NO_STRING #language en-US "No" + #language ja-JP "No" ## TODO + +#string STR_GENERIC_OK_STRING #language en-US "Ok" + #language ja-JP "Ok" ## TODO + +#string STR_GENERIC_CANCEL_STRING #language en-US "Cancel" + #language ja-JP "Cancel" ## TODO + +#string STR_GENERIC_RETRY_STRING #language en-US "Retry" + #language ja-JP "Retry" ## TODO + +#string STR_GENERIC_NEXT_STRING #language en-US "Next" + #language ja-JP "Next" ## TODO + +#string STR_GENERIC_RESTART_STRING #language en-US "Restart now" + #language ja-JP "Restart now" ## TODO diff --git a/MsGraphicsPkg/MsEarlyGraphics/Dxe/MsEarlyGraphics.inf b/MsGraphicsPkg/MsEarlyGraphics/Dxe/MsEarlyGraphics.inf index f3ff7fa14e..48bbe9d134 100644 --- a/MsGraphicsPkg/MsEarlyGraphics/Dxe/MsEarlyGraphics.inf +++ b/MsGraphicsPkg/MsEarlyGraphics/Dxe/MsEarlyGraphics.inf @@ -1,60 +1,60 @@ -## -# MsEarlyGraphics displays messages to the display prior to GOP Dxe Enumeration -# using data from the PEI GOP driver. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsEarlyGraphicsDxe - FILE_GUID = 3977d4c4-b0eb-4548-96b9-671fa2e36820 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MsEarlyGraphicsEntry - UNLOAD_IMAGE = MsEarlyGraphicsUnload - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC AARCH64 -# - -[Sources] - MsEarlyGraphics.c - MsEarlyGraphics.h - ../MsEarlyGraphicsCommon.c - ../MsEarlyGraphicsCommon.h - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - BaseLib - UefiLib - DebugLib - BaseMemoryLib - UefiDriverEntryPoint - MsPlatformEarlyGraphicsLib - MsUiThemeLib - -[Guids] - -[Protocols] - gMsEarlyGraphicsProtocolGuid ## PRODUCES - -[FeaturePcd] - -[Pcd] - -[Depex] - TRUE - -#[BuildOptions] -# DEBUG_VS2013x86_*_CC_FLAGS = /Od /FAcs - - +## +# MsEarlyGraphics displays messages to the display prior to GOP Dxe Enumeration +# using data from the PEI GOP driver. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsEarlyGraphicsDxe + FILE_GUID = 3977d4c4-b0eb-4548-96b9-671fa2e36820 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MsEarlyGraphicsEntry + UNLOAD_IMAGE = MsEarlyGraphicsUnload + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC AARCH64 +# + +[Sources] + MsEarlyGraphics.c + MsEarlyGraphics.h + ../MsEarlyGraphicsCommon.c + ../MsEarlyGraphicsCommon.h + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + BaseLib + UefiLib + DebugLib + BaseMemoryLib + UefiDriverEntryPoint + MsPlatformEarlyGraphicsLib + MsUiThemeLib + +[Guids] + +[Protocols] + gMsEarlyGraphicsProtocolGuid ## PRODUCES + +[FeaturePcd] + +[Pcd] + +[Depex] + TRUE + +#[BuildOptions] +# DEBUG_VS2013x86_*_CC_FLAGS = /Od /FAcs + + diff --git a/MsGraphicsPkg/MsEarlyGraphics/Pei/MsEarlyGraphics.inf b/MsGraphicsPkg/MsEarlyGraphics/Pei/MsEarlyGraphics.inf index b3465143a1..c8645be1a3 100644 --- a/MsGraphicsPkg/MsEarlyGraphics/Pei/MsEarlyGraphics.inf +++ b/MsGraphicsPkg/MsEarlyGraphics/Pei/MsEarlyGraphics.inf @@ -1,55 +1,55 @@ -## @file -# PEI driver - -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsEarlyGraphicsPei - FILE_GUID = 95f6849d-e6c1-41bb-b7ab-8dea44b1b09b - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - - ENTRY_POINT = MsEarlyGraphicsEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsEarlyGraphics.c - MsEarlyGraphics.h - ../MsEarlyGraphicsCommon.c - ../MsEarlyGraphicsCommon.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - PeimEntryPoint - DebugLib - SynchronizationLib - PrintLib - BaseLib - BaseMemoryLib - PeiServicesLib - MemoryAllocationLib - MsPlatformEarlyGraphicsLib - MsUiThemeLib - -[Protocols] - gMsEarlyGraphicsProtocolGuid - -[Guids] - gMsEarlyGraphicsHobGuid - gMsUiThemeHobGuid - -[Depex] - gMsUiThemePpiGuid - +## @file +# PEI driver + +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsEarlyGraphicsPei + FILE_GUID = 95f6849d-e6c1-41bb-b7ab-8dea44b1b09b + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + + ENTRY_POINT = MsEarlyGraphicsEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsEarlyGraphics.c + MsEarlyGraphics.h + ../MsEarlyGraphicsCommon.c + ../MsEarlyGraphicsCommon.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + SynchronizationLib + PrintLib + BaseLib + BaseMemoryLib + PeiServicesLib + MemoryAllocationLib + MsPlatformEarlyGraphicsLib + MsUiThemeLib + +[Protocols] + gMsEarlyGraphicsProtocolGuid + +[Guids] + gMsEarlyGraphicsHobGuid + gMsUiThemeHobGuid + +[Depex] + gMsUiThemePpiGuid + diff --git a/MsGraphicsPkg/MsEarlyGraphics/ReadMe.md b/MsGraphicsPkg/MsEarlyGraphics/ReadMe.md index bccba51772..bc50080b1b 100644 --- a/MsGraphicsPkg/MsEarlyGraphics/ReadMe.md +++ b/MsGraphicsPkg/MsEarlyGraphics/ReadMe.md @@ -1,12 +1,12 @@ -# MS Early Graphics Drivers - -## About - -The MsEarlyGraphics drivers load the fonts used for the Simple Window Manager, and is used to -display Preboot information on the graphics console, when the display if first initialized (for -example, in PEI) by drawing directly to the frame buffer. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# MS Early Graphics Drivers + +## About + +The MsEarlyGraphics drivers load the fonts used for the Simple Window Manager, and is used to +display Preboot information on the graphics console, when the display if first initialized (for +example, in PEI) by drawing directly to the frame buffer. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/MsUiTheme/Dxe/MsUiThemeProtocol.inf b/MsGraphicsPkg/MsUiTheme/Dxe/MsUiThemeProtocol.inf index 2de1a7a3ac..96424950a1 100644 --- a/MsGraphicsPkg/MsUiTheme/Dxe/MsUiThemeProtocol.inf +++ b/MsGraphicsPkg/MsUiTheme/Dxe/MsUiThemeProtocol.inf @@ -1,52 +1,52 @@ -## @file -# MsUiThemeProtocol.inf -# -# MsUiThemeProtocol implements the desired Fonts and Theme settings -# -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsUiThemeProtocol - FILE_GUID = 16a5dd36-4c29-4e85-b0b9-c05883753de7 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MsUiThemeProtocolEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsUiThemeProtocol.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - UefiBootServicesTableLib - DebugLib - HobLib - PlatformThemeLib - MsUiThemeCopyLib - -[Guids] - gMsUiThemeHobGuid - -[Protocols] - gMsUiThemeProtocolGuid - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdUiThemeInDxe - -[Depex] - TRUE +## @file +# MsUiThemeProtocol.inf +# +# MsUiThemeProtocol implements the desired Fonts and Theme settings +# +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsUiThemeProtocol + FILE_GUID = 16a5dd36-4c29-4e85-b0b9-c05883753de7 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MsUiThemeProtocolEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsUiThemeProtocol.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiBootServicesTableLib + DebugLib + HobLib + PlatformThemeLib + MsUiThemeCopyLib + +[Guids] + gMsUiThemeHobGuid + +[Protocols] + gMsUiThemeProtocolGuid + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdUiThemeInDxe + +[Depex] + TRUE diff --git a/MsGraphicsPkg/MsUiTheme/Pei/MsUiThemePpi.inf b/MsGraphicsPkg/MsUiTheme/Pei/MsUiThemePpi.inf index 399fe42359..40347c4cce 100644 --- a/MsGraphicsPkg/MsUiTheme/Pei/MsUiThemePpi.inf +++ b/MsGraphicsPkg/MsUiTheme/Pei/MsUiThemePpi.inf @@ -1,56 +1,56 @@ -## @file -# MsUiThemePpi.inf -# -# MsUiThemeProtocol implements the desired Fonts and Theme settings -# -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsUiThemePpi - FILE_GUID = 2580fe68-b683-4ffc-a43e-25a088299102 - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - ENTRY_POINT = MsUiThemePpiEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsUiThemePpi.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - PeimEntryPoint - PeiServicesTablePointerLib - PeiServicesLib - PlatformThemeLib - MsUiThemeCopyLib - -[Guids] - gMsUiThemeHobGuid - -[Protocols] - -[Ppis] - gMsUiThemePpiGuid - -[FeaturePcd] - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdUiThemeInDxe - -[Depex] - gEfiPeiMemoryDiscoveredPpiGuid +## @file +# MsUiThemePpi.inf +# +# MsUiThemeProtocol implements the desired Fonts and Theme settings +# +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsUiThemePpi + FILE_GUID = 2580fe68-b683-4ffc-a43e-25a088299102 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = MsUiThemePpiEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsUiThemePpi.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + DebugLib + BaseMemoryLib + PeimEntryPoint + PeiServicesTablePointerLib + PeiServicesLib + PlatformThemeLib + MsUiThemeCopyLib + +[Guids] + gMsUiThemeHobGuid + +[Protocols] + +[Ppis] + gMsUiThemePpiGuid + +[FeaturePcd] + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdUiThemeInDxe + +[Depex] + gEfiPeiMemoryDiscoveredPpiGuid diff --git a/MsGraphicsPkg/MsUiTheme/ReadMe.md b/MsGraphicsPkg/MsUiTheme/ReadMe.md index c88318f0db..8e3ce7915c 100644 --- a/MsGraphicsPkg/MsUiTheme/ReadMe.md +++ b/MsGraphicsPkg/MsUiTheme/ReadMe.md @@ -1,11 +1,11 @@ -# MS UI Theme Drivers - -## About - -The MsUiTheme drivers load the fonts used by the platform. -Each platform must supply the font information required based on the display information. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# MS UI Theme Drivers + +## About + +The MsUiTheme drivers load the fonts used by the platform. +Each platform must supply the font information required based on the display information. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/OnScreenKeyboardDxe/OnScreenKeyboardDxe.inf b/MsGraphicsPkg/OnScreenKeyboardDxe/OnScreenKeyboardDxe.inf index 983a6d506f..96d8d4de0f 100644 --- a/MsGraphicsPkg/OnScreenKeyboardDxe/OnScreenKeyboardDxe.inf +++ b/MsGraphicsPkg/OnScreenKeyboardDxe/OnScreenKeyboardDxe.inf @@ -1,70 +1,70 @@ -## @file -# Implements a simple on-screen virtual keyboard for text input. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = OnScreenKeyboardDxe - FILE_GUID = 917C56F2-2FE3-498F-AFFB-87AC0E19FE5E - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = OSKDriverEntryPoint - UNLOAD_IMAGE = DriverUnload - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - OnScreenKeyboardDriver.c - OnScreenKeyboardProtocol.c - DisplayTransform.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - BaseLib - HiiLib - MemoryAllocationLib - DxeServicesTableLib - MsUiThemeLib - MsColorTableLib - MathLib - FltUsedLib - UIToolKitLib - -[Guids] - gEfiConsoleInDeviceGuid - gOSKDevicePathGuid - gMuEventPreExitBootServicesGuid - - -[Protocols] - gEfiGraphicsOutputProtocolGuid # CONSUMES - gEfiHiiFontProtocolGuid # CONSUMES - gMsSWMProtocolGuid # CONSUMES - - gMsOSKProtocolGuid # PRODUCES - gEfiSimpleTextInProtocolGuid # PRODUCES - gEfiSimpleTextInputExProtocolGuid # PRODUCES - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdSmallAssetMaxScreenWidth - gMsGraphicsPkgTokenSpaceGuid.PcdEnableTypematicOSK - -[Depex] - -[BuildOptions] - *_VS2013x86_IA32_CC_FLAGS = /Oi /Og /fp:fast /arch:SSE - *_VS2013x86_X64_CC_FLAGS = /Oi /Og /fp:fast /arch:SSE +## @file +# Implements a simple on-screen virtual keyboard for text input. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = OnScreenKeyboardDxe + FILE_GUID = 917C56F2-2FE3-498F-AFFB-87AC0E19FE5E + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = OSKDriverEntryPoint + UNLOAD_IMAGE = DriverUnload + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + OnScreenKeyboardDriver.c + OnScreenKeyboardProtocol.c + DisplayTransform.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + BaseLib + HiiLib + MemoryAllocationLib + DxeServicesTableLib + MsUiThemeLib + MsColorTableLib + MathLib + FltUsedLib + UIToolKitLib + +[Guids] + gEfiConsoleInDeviceGuid + gOSKDevicePathGuid + gMuEventPreExitBootServicesGuid + + +[Protocols] + gEfiGraphicsOutputProtocolGuid # CONSUMES + gEfiHiiFontProtocolGuid # CONSUMES + gMsSWMProtocolGuid # CONSUMES + + gMsOSKProtocolGuid # PRODUCES + gEfiSimpleTextInProtocolGuid # PRODUCES + gEfiSimpleTextInputExProtocolGuid # PRODUCES + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdSmallAssetMaxScreenWidth + gMsGraphicsPkgTokenSpaceGuid.PcdEnableTypematicOSK + +[Depex] + +[BuildOptions] + *_VS2013x86_IA32_CC_FLAGS = /Oi /Og /fp:fast /arch:SSE + *_VS2013x86_X64_CC_FLAGS = /Oi /Og /fp:fast /arch:SSE diff --git a/MsGraphicsPkg/OnScreenKeyboardDxe/ReadMe.md b/MsGraphicsPkg/OnScreenKeyboardDxe/ReadMe.md index c889ba28c3..f5b3ce828a 100644 --- a/MsGraphicsPkg/OnScreenKeyboardDxe/ReadMe.md +++ b/MsGraphicsPkg/OnScreenKeyboardDxe/ReadMe.md @@ -1,12 +1,12 @@ -# OnScreenKeyboardDxe - -## About - -This driver implements an OnScreen keyboard driver. -This driver relies heavily on the SimpleWindowManager, The SimpleUI Toolkit, and the -RenderingEngine to implement a floating on screen keyboard that can be rotated on the display. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# OnScreenKeyboardDxe + +## About + +This driver implements an OnScreen keyboard driver. +This driver relies heavily on the SimpleWindowManager, The SimpleUI Toolkit, and the +RenderingEngine to implement a floating on screen keyboard that can be rotated on the display. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/OnScreenKeyboardDxe/Resources/KeyboardChars.txt b/MsGraphicsPkg/OnScreenKeyboardDxe/Resources/KeyboardChars.txt index 9c40461f43..b622bc00b4 100644 Binary files a/MsGraphicsPkg/OnScreenKeyboardDxe/Resources/KeyboardChars.txt and b/MsGraphicsPkg/OnScreenKeyboardDxe/Resources/KeyboardChars.txt differ diff --git a/MsGraphicsPkg/RenderingEngineDxe/ReadMe.md b/MsGraphicsPkg/RenderingEngineDxe/ReadMe.md index 6e0aa9bda1..a45198c8bf 100644 --- a/MsGraphicsPkg/RenderingEngineDxe/ReadMe.md +++ b/MsGraphicsPkg/RenderingEngineDxe/ReadMe.md @@ -1,13 +1,13 @@ -# Rendering Engine Driver - -## About - -The Rendering Engine is responsible for maintaining the supported windows, displaying popups, -and restopring windows when popups are dismissed. -The Rendering Engins is the only consumer of the MsGopOverrideProtocol and is the publisher of -the "real" Efi Graphics Output protocol. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Rendering Engine Driver + +## About + +The Rendering Engine is responsible for maintaining the supported windows, displaying popups, +and restopring windows when popups are dismissed. +The Rendering Engins is the only consumer of the MsGopOverrideProtocol and is the publisher of +the "real" Efi Graphics Output protocol. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/RenderingEngineDxe/RenderingEngineDxe.inf b/MsGraphicsPkg/RenderingEngineDxe/RenderingEngineDxe.inf index 1ee83e1de1..2c764aad2f 100644 --- a/MsGraphicsPkg/RenderingEngineDxe/RenderingEngineDxe.inf +++ b/MsGraphicsPkg/RenderingEngineDxe/RenderingEngineDxe.inf @@ -1,52 +1,52 @@ -## @file -# -# Implements a Graphics Software Compositor as a filter driver that connects to the -# Intel GOP driver and produces its own GOP protocol. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = RenderingEngineDxe - FILE_GUID = 02AA389E-CA29-43BF-BE05-A4CA038812F2 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = DriverInit - UNLOAD_IMAGE = DriverUnload - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - RenderingEngine.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - BaseLib - MemoryAllocationLib - DxeServicesTableLib - -[Protocols] - gEfiDevicePathProtocolGuid # CONSUMES - gMsSREProtocolGuid # PRODUCES - gEfiGraphicsOutputProtocolGuid # PRODUCES - -[Guids] - gMuEventPreExitBootServicesGuid - -[Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdMsGopOverrideProtocolGuid - -[Depex] - TRUE +## @file +# +# Implements a Graphics Software Compositor as a filter driver that connects to the +# Intel GOP driver and produces its own GOP protocol. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = RenderingEngineDxe + FILE_GUID = 02AA389E-CA29-43BF-BE05-A4CA038812F2 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = DriverInit + UNLOAD_IMAGE = DriverUnload + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + RenderingEngine.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + BaseLib + MemoryAllocationLib + DxeServicesTableLib + +[Protocols] + gEfiDevicePathProtocolGuid # CONSUMES + gMsSREProtocolGuid # PRODUCES + gEfiGraphicsOutputProtocolGuid # PRODUCES + +[Guids] + gMuEventPreExitBootServicesGuid + +[Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdMsGopOverrideProtocolGuid + +[Depex] + TRUE diff --git a/MsGraphicsPkg/SimpleWindowManagerDxe/ReadMe.md b/MsGraphicsPkg/SimpleWindowManagerDxe/ReadMe.md index 5d43bd80ab..ea4da2aae6 100644 --- a/MsGraphicsPkg/SimpleWindowManagerDxe/ReadMe.md +++ b/MsGraphicsPkg/SimpleWindowManagerDxe/ReadMe.md @@ -1,11 +1,11 @@ -# Simple Window Manager - -## About - -The Simple Window Manager manages window placement and pop up dialogs. -The Simple Window Manager uses the Rendering Engine to display objects in their display region. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Simple Window Manager + +## About + +The Simple Window Manager manages window placement and pop up dialogs. +The Simple Window Manager uses the Rendering Engine to display objects in their display region. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerDxe.inf b/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerDxe.inf index 46195390a5..6026fe7eae 100644 --- a/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerDxe.inf +++ b/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerDxe.inf @@ -1,71 +1,71 @@ -## @file -# Implements a simple window manager -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SimpleWindowManagerDxe - FILE_GUID = 8E747032-7D55-4D95-9A84-77F83370B3A4 - MODULE_TYPE = UEFI_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = DriverInit - UNLOAD_IMAGE = DriverUnload - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - WindowManager.c - SimpleWindowManagerProtocol.c - SimpleWindowManagerStrings.uni - WaitForEvent.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - DebugLib - BaseLib - HiiLib - MemoryAllocationLib - MsUiThemeLib - DxeServicesTableLib - UIToolKitLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - PcdLib - MsColorTableLib - SwmDialogsLib - -[Guids] - gMsTouchPanelGuid - -[Protocols] - gEfiGraphicsOutputProtocolGuid # CONSUMES - gEfiAbsolutePointerProtocolGuid # CONSUMES - gEfiDevicePathProtocolGuid # CONSUMES - gEfiSimpleTextInputExProtocolGuid # CONSUMES - gEfiHiiFontProtocolGuid # CONSUMES - gMsOSKProtocolGuid # CONSUMES - gMsSREProtocolGuid # CONSUMES - gMsSWMProtocolGuid # PRODUCES - - [Pcd] - gMsGraphicsPkgTokenSpaceGuid.PcdPowerOffDelay - gMsGraphicsPkgTokenSpaceGuid.PcdPowerOffHold - gMsGraphicsPkgTokenSpaceGuid.PcdSmallAssetMaxScreenWidth - -[BuildOptions.AARCH64] - MSFT:*_*_AARCH64_DLINK_FLAGS = /include:_fltused - -[BuildOptions] - MSFT:*_*_X64_DLINK_FLAGS = /include:_fltused +## @file +# Implements a simple window manager +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SimpleWindowManagerDxe + FILE_GUID = 8E747032-7D55-4D95-9A84-77F83370B3A4 + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = DriverInit + UNLOAD_IMAGE = DriverUnload + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + WindowManager.c + SimpleWindowManagerProtocol.c + SimpleWindowManagerStrings.uni + WaitForEvent.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + BaseLib + HiiLib + MemoryAllocationLib + MsUiThemeLib + DxeServicesTableLib + UIToolKitLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + PcdLib + MsColorTableLib + SwmDialogsLib + +[Guids] + gMsTouchPanelGuid + +[Protocols] + gEfiGraphicsOutputProtocolGuid # CONSUMES + gEfiAbsolutePointerProtocolGuid # CONSUMES + gEfiDevicePathProtocolGuid # CONSUMES + gEfiSimpleTextInputExProtocolGuid # CONSUMES + gEfiHiiFontProtocolGuid # CONSUMES + gMsOSKProtocolGuid # CONSUMES + gMsSREProtocolGuid # CONSUMES + gMsSWMProtocolGuid # PRODUCES + + [Pcd] + gMsGraphicsPkgTokenSpaceGuid.PcdPowerOffDelay + gMsGraphicsPkgTokenSpaceGuid.PcdPowerOffHold + gMsGraphicsPkgTokenSpaceGuid.PcdSmallAssetMaxScreenWidth + +[BuildOptions.AARCH64] + MSFT:*_*_AARCH64_DLINK_FLAGS = /include:_fltused + +[BuildOptions] + MSFT:*_*_X64_DLINK_FLAGS = /include:_fltused diff --git a/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerStrings.uni b/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerStrings.uni index edd0f19417..589aadc286 100644 --- a/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerStrings.uni +++ b/MsGraphicsPkg/SimpleWindowManagerDxe/SimpleWindowManagerStrings.uni @@ -1,33 +1,33 @@ -// *++ -// -// Strings for Simple Window Manager -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: BSD-2-Clause-Patent -// --*/ - -#langdef en-US " English " -#langdef fr-FR " Français " -#langdef ja-JP "\wide 日本語 " - -#langdef en " Standard English " -#langdef fr " Standard Français " -#langdef ja "\wide 日本語 " - -//////////////////////////////////////////////////////////////////////////////////// -// Generic Strings -// -#string STR_NULL_STRING #language en-US "" - #language ja-JP "" - -//////////////////////////////////////////////////////////////////////////////////// -// Generic Strings -// -#string STR_POWER_TIMEOUT_TITLE #language en-US "Shutdown pending" - #language ja-JP "Shutdown pending" - -#string STR_POWER_TIMEOUT_CAPTION #language en-US "Shutdown pending due to inactivity" - #language ja-JP "Shutdown pending due to inactivity" - -#string STR_POWER_TIMEOUT_BODY #language en-US "Shutting down in 30 seconds due to inactivity. Click Cancel to stop the shutdown and return to settings." - #language ja-JP "Shutting down in 30 seconds due to inactivity. Click Cancel to stop the shutdown and return to settings." +// *++ +// +// Strings for Simple Window Manager +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: BSD-2-Clause-Patent +// --*/ + +#langdef en-US " English " +#langdef fr-FR " Français " +#langdef ja-JP "\wide 日本語 " + +#langdef en " Standard English " +#langdef fr " Standard Français " +#langdef ja "\wide 日本語 " + +//////////////////////////////////////////////////////////////////////////////////// +// Generic Strings +// +#string STR_NULL_STRING #language en-US "" + #language ja-JP "" + +//////////////////////////////////////////////////////////////////////////////////// +// Generic Strings +// +#string STR_POWER_TIMEOUT_TITLE #language en-US "Shutdown pending" + #language ja-JP "Shutdown pending" + +#string STR_POWER_TIMEOUT_CAPTION #language en-US "Shutdown pending due to inactivity" + #language ja-JP "Shutdown pending due to inactivity" + +#string STR_POWER_TIMEOUT_BODY #language en-US "Shutting down in 30 seconds due to inactivity. Click Cancel to stop the shutdown and return to settings." + #language ja-JP "Shutting down in 30 seconds due to inactivity. Click Cancel to stop the shutdown and return to settings." diff --git a/MsWheaPkg/DummyErrorDriver/DummyErrorDriver.inf b/MsWheaPkg/DummyErrorDriver/DummyErrorDriver.inf index bea450dc33..893ef4c647 100644 --- a/MsWheaPkg/DummyErrorDriver/DummyErrorDriver.inf +++ b/MsWheaPkg/DummyErrorDriver/DummyErrorDriver.inf @@ -1,40 +1,40 @@ -## @file -# DummyErrorDriver.inf -# -# Raises various ReportStatusCode calls found throughout project MU. -# Can be used to test parsing functions and telemetry functionality. -# -## -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = DummyErrorDriver - FILE_GUID = 608D44A7-AAD7-4188-8121-672F2BE83C26 - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - ENTRY_POINT = DummyErrorDriverEntryPoint - -[Sources] - DummyErrorDriver.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - ReportStatusCodeLib - UefiRuntimeServicesTableLib - -[Guids] - gRaiseTelemetryErrorsAtBoot - -[Depex] - gEfiRscHandlerProtocolGuid AND - gEfiVariableWriteArchProtocolGuid +## @file +# DummyErrorDriver.inf +# +# Raises various ReportStatusCode calls found throughout project MU. +# Can be used to test parsing functions and telemetry functionality. +# +## +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = DummyErrorDriver + FILE_GUID = 608D44A7-AAD7-4188-8121-672F2BE83C26 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + ENTRY_POINT = DummyErrorDriverEntryPoint + +[Sources] + DummyErrorDriver.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + ReportStatusCodeLib + UefiRuntimeServicesTableLib + +[Guids] + gRaiseTelemetryErrorsAtBoot + +[Depex] + gEfiRscHandlerProtocolGuid AND + gEfiVariableWriteArchProtocolGuid diff --git a/MsWheaPkg/EnableDisableErrors/EnableDisableErrors.inf b/MsWheaPkg/EnableDisableErrors/EnableDisableErrors.inf index 5391bb5c61..45555a35a8 100644 --- a/MsWheaPkg/EnableDisableErrors/EnableDisableErrors.inf +++ b/MsWheaPkg/EnableDisableErrors/EnableDisableErrors.inf @@ -1,43 +1,43 @@ -## @file -# -# -# -# -## -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = EnableDisableErrors - FILE_GUID = E06294D1-E633-47A7-BA58-69318A439053 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = EnableDisableErrorsEntry - -[Sources] - EnableDisableErrors.c - -[Packages] - MdePkg/MdePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - UefiApplicationEntryPoint - DebugLib - UefiBootServicesTableLib - MemoryAllocationLib - UefiRuntimeServicesTableLib - MuTelemetryHelperLib - PrintLib - -[Protocols] - gEfiShellParametersProtocolGuid - -[Guids] - gRaiseTelemetryErrorsAtBoot ## PRODUCES +## @file +# +# +# +# +## +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = EnableDisableErrors + FILE_GUID = E06294D1-E633-47A7-BA58-69318A439053 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = EnableDisableErrorsEntry + +[Sources] + EnableDisableErrors.c + +[Packages] + MdePkg/MdePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + UefiApplicationEntryPoint + DebugLib + UefiBootServicesTableLib + MemoryAllocationLib + UefiRuntimeServicesTableLib + MuTelemetryHelperLib + PrintLib + +[Protocols] + gEfiShellParametersProtocolGuid + +[Guids] + gRaiseTelemetryErrorsAtBoot ## PRODUCES gEfiHardwareErrorVariableGuid ## CONSUMES \ No newline at end of file diff --git a/MsWheaPkg/HwErrBert/HwErrBert.inf b/MsWheaPkg/HwErrBert/HwErrBert.inf index 34d90cc254..b6cb626a23 100644 --- a/MsWheaPkg/HwErrBert/HwErrBert.inf +++ b/MsWheaPkg/HwErrBert/HwErrBert.inf @@ -1,70 +1,70 @@ -## @file -- HwErrorBert.inf -# -# Driver that looks through flash for variables with gEfiHardwareErrorVariableGuid -# and publishes them to BERT ACPI table. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = HwErrorBert - FILE_GUID = 328AC7D1-6D2B-4F6B-8A2D-EA6302A62F60 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = HwErrorBertEntry - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = AARCH64 X64 -# - -[Sources] - HwErrorBert.c - BertHelper.c - BertHelper.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - UefiLib - DebugLib - HobLib - MemoryAllocationLib - PcdLib - PrintLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiRuntimeServicesTableLib - BaseMemoryLib - CheckHwErrRecHeaderLib - -[Protocols] - gEfiAcpiTableProtocolGuid ## CONSUMES - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId - gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision - gMsWheaPkgTokenSpaceGuid.PcdBertEntriesVariableNames - -[Guids] - gEfiHardwareErrorVariableGuid ## CONSUMES - gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES - gEfiFirmwareErrorSectionGuid ## SOMETIMES_CONSUMES - gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES - gEfiEventReadyToBootGuid ## CONSUMES ## Event - gEfiEventExitBootServicesGuid ## CONSUMES - -[Depex] +## @file -- HwErrorBert.inf +# +# Driver that looks through flash for variables with gEfiHardwareErrorVariableGuid +# and publishes them to BERT ACPI table. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = HwErrorBert + FILE_GUID = 328AC7D1-6D2B-4F6B-8A2D-EA6302A62F60 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = HwErrorBertEntry + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = AARCH64 X64 +# + +[Sources] + HwErrorBert.c + BertHelper.c + BertHelper.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + UefiLib + DebugLib + HobLib + MemoryAllocationLib + PcdLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + BaseMemoryLib + CheckHwErrRecHeaderLib + +[Protocols] + gEfiAcpiTableProtocolGuid ## CONSUMES + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + gMsWheaPkgTokenSpaceGuid.PcdBertEntriesVariableNames + +[Guids] + gEfiHardwareErrorVariableGuid ## CONSUMES + gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES + gEfiFirmwareErrorSectionGuid ## SOMETIMES_CONSUMES + gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES + gEfiEventReadyToBootGuid ## CONSUMES ## Event + gEfiEventExitBootServicesGuid ## CONSUMES + +[Depex] TRUE \ No newline at end of file diff --git a/MsWheaPkg/HwhMenu/HwhMenu.inf b/MsWheaPkg/HwhMenu/HwhMenu.inf index beb8c74748..96f9081fac 100644 --- a/MsWheaPkg/HwhMenu/HwhMenu.inf +++ b/MsWheaPkg/HwhMenu/HwhMenu.inf @@ -1,61 +1,61 @@ -## @file -# HwhMenu.inf -# -# Presents HwErrRecs to the user on Frontpage -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = HwhMenu - FILE_GUID = af8f0389-6ba2-47d3-9e55-80b3dd9b8a98 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = HwhMenuEntry - -[Sources] - HwhMenu.h - HwhMenu.c - HwhMenuVfr.h - HwhMenuStrings.uni - HwhMenuVfr.Vfr - CreatorIDParser.h - CreatorIDParser.c - PlatformIDParser.h - PlatformIDParser.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseMemoryLib - DebugLib - DevicePathLib - PrintLib - HiiLib - UefiDriverEntryPoint - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - UefiHiiServicesLib - CheckHwErrRecHeaderLib - MuTelemetryHelperLib - ParserRegistryLib - -[Guids] - gHwhMenuFormsetGuid ## PRODUCES - gEfiHardwareErrorVariableGuid ## CONSUMES - gEfiIfrTianoGuid ## CONSUMES - -[Protocols] - gEfiHiiConfigAccessProtocolGuid - -[Depex] - gEfiHiiConfigRoutingProtocolGuid - -[BuildOptions] - MSFT:*_*_*_CC_FLAGS = /FAcs /Oi- - +## @file +# HwhMenu.inf +# +# Presents HwErrRecs to the user on Frontpage +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = HwhMenu + FILE_GUID = af8f0389-6ba2-47d3-9e55-80b3dd9b8a98 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = HwhMenuEntry + +[Sources] + HwhMenu.h + HwhMenu.c + HwhMenuVfr.h + HwhMenuStrings.uni + HwhMenuVfr.Vfr + CreatorIDParser.h + CreatorIDParser.c + PlatformIDParser.h + PlatformIDParser.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + DevicePathLib + PrintLib + HiiLib + UefiDriverEntryPoint + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiHiiServicesLib + CheckHwErrRecHeaderLib + MuTelemetryHelperLib + ParserRegistryLib + +[Guids] + gHwhMenuFormsetGuid ## PRODUCES + gEfiHardwareErrorVariableGuid ## CONSUMES + gEfiIfrTianoGuid ## CONSUMES + +[Protocols] + gEfiHiiConfigAccessProtocolGuid + +[Depex] + gEfiHiiConfigRoutingProtocolGuid + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS = /FAcs /Oi- + diff --git a/MsWheaPkg/HwhMenu/HwhMenuStrings.uni b/MsWheaPkg/HwhMenu/HwhMenuStrings.uni index 5e7cdbbfa9..36ef918601 100644 --- a/MsWheaPkg/HwhMenu/HwhMenuStrings.uni +++ b/MsWheaPkg/HwhMenu/HwhMenuStrings.uni @@ -1,90 +1,90 @@ -/** @file -HwhMenuStrings.uni - -This file maintains the text strings used by the Hardware Health Menu. - -Copyright (c) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#langdef en-US " English " -#langdef en " Standard English " - -// Common Form strings - -#string STR_NULL_STRING #language en-US "" -#string STR_HWH_MENU_TITLE #language en-US "Hardware Health" - -///////////////////////////////////////////////////////////////////////////// -// Dialog: Hardware Health -// -#string STR_HWH_PAGE_RIGHT #language en-US "Next" -#string STR_HWH_PAGE_LEFT #language en-US "Previous" -#string STR_HWH_PAGE_NUM #language en-US "Page 1 of 1" -#string STR_FP_HW_HEADER_LOGS_TRUE #language en-US "\fh!48!Error Logs" -#string STR_FP_HW_HEADER_LOGS_FALSE #language en-US "\fh!48!No Logs To Display" -#string STR_HWH_VIEW_LOGS #language en-US "View Logs" -#string STR_HWH_LOG_DATE #language en-US "Date (MM/DD/YY):" -#string STR_HWH_LOG_TIME #language en-US "Time:" -#string STR_HWH_LOG_SEVERITY #language en-US "Severity:" -#string STR_HWH_LOG_NUMSECTIONS #language en-US "Number of Sections:" -#string STR_HWH_LOG_CREATORID #language en-US "Creator ID:" -#string STR_HWH_LOG_SOURCEID #language en-US "Source ID:" - -///////////////////////////////////////////////////////////////////////////// -// Error Report Strings -// - -#string STR_HWH_LOG_SEVERITY_VALUE #language en-US "SEVERITY" -#string STR_HWH_LOG_TIME_VALUE #language en-US "TIME" -#string STR_HWH_LOG_DATE_VALUE #language en-US "DATE" -#string STR_HWH_LOG_NUMSECTIONS_VALUE #language en-US "NUMBER OF SECTIONS" -#string STR_HWH_LOG_CREATORID_VALUE #language en-US "CREATOR ID" -#string STR_HWH_LOG_SOURCEID_VALUE #language en-US "SOURCE ID" - -#string STR_HWH_LOG_LINE_0_0 #language en-US "" -#string STR_HWH_LOG_LINE_0_1 #language en-US "" -#string STR_HWH_LOG_LINE_0_2 #language en-US "" -#string STR_HWH_LOG_LINE_1_0 #language en-US "" -#string STR_HWH_LOG_LINE_1_1 #language en-US "" -#string STR_HWH_LOG_LINE_1_2 #language en-US "" -#string STR_HWH_LOG_LINE_2_0 #language en-US "" -#string STR_HWH_LOG_LINE_2_1 #language en-US "" -#string STR_HWH_LOG_LINE_2_2 #language en-US "" -#string STR_HWH_LOG_LINE_3_0 #language en-US "" -#string STR_HWH_LOG_LINE_3_1 #language en-US "" -#string STR_HWH_LOG_LINE_3_2 #language en-US "" -#string STR_HWH_LOG_LINE_4_0 #language en-US "" -#string STR_HWH_LOG_LINE_4_1 #language en-US "" -#string STR_HWH_LOG_LINE_4_2 #language en-US "" -#string STR_HWH_LOG_LINE_5_0 #language en-US "" -#string STR_HWH_LOG_LINE_5_1 #language en-US "" -#string STR_HWH_LOG_LINE_5_2 #language en-US "" -#string STR_HWH_LOG_LINE_6_0 #language en-US "" -#string STR_HWH_LOG_LINE_6_1 #language en-US "" -#string STR_HWH_LOG_LINE_6_2 #language en-US "" -#string STR_HWH_LOG_LINE_7_0 #language en-US "" -#string STR_HWH_LOG_LINE_7_1 #language en-US "" -#string STR_HWH_LOG_LINE_7_2 #language en-US "" -#string STR_HWH_LOG_LINE_8_0 #language en-US "" -#string STR_HWH_LOG_LINE_8_1 #language en-US "" -#string STR_HWH_LOG_LINE_8_2 #language en-US "" -#string STR_HWH_LOG_LINE_9_0 #language en-US "" -#string STR_HWH_LOG_LINE_9_1 #language en-US "" -#string STR_HWH_LOG_LINE_9_2 #language en-US "" -#string STR_HWH_LOG_LINE_10_0 #language en-US "" -#string STR_HWH_LOG_LINE_10_1 #language en-US "" -#string STR_HWH_LOG_LINE_10_2 #language en-US "" -#string STR_HWH_LOG_LINE_11_0 #language en-US "" -#string STR_HWH_LOG_LINE_11_1 #language en-US "" -#string STR_HWH_LOG_LINE_11_2 #language en-US "" -#string STR_HWH_LOG_LINE_12_0 #language en-US "" -#string STR_HWH_LOG_LINE_12_1 #language en-US "" -#string STR_HWH_LOG_LINE_12_2 #language en-US "" -#string STR_HWH_LOG_LINE_13_0 #language en-US "" -#string STR_HWH_LOG_LINE_13_1 #language en-US "" -#string STR_HWH_LOG_LINE_13_2 #language en-US "" -#string STR_HWH_LOG_LINE_14_0 #language en-US "" -#string STR_HWH_LOG_LINE_14_1 #language en-US "" -#string STR_HWH_LOG_LINE_14_2 #language en-US "" +/** @file +HwhMenuStrings.uni + +This file maintains the text strings used by the Hardware Health Menu. + +Copyright (c) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#langdef en-US " English " +#langdef en " Standard English " + +// Common Form strings + +#string STR_NULL_STRING #language en-US "" +#string STR_HWH_MENU_TITLE #language en-US "Hardware Health" + +///////////////////////////////////////////////////////////////////////////// +// Dialog: Hardware Health +// +#string STR_HWH_PAGE_RIGHT #language en-US "Next" +#string STR_HWH_PAGE_LEFT #language en-US "Previous" +#string STR_HWH_PAGE_NUM #language en-US "Page 1 of 1" +#string STR_FP_HW_HEADER_LOGS_TRUE #language en-US "\fh!48!Error Logs" +#string STR_FP_HW_HEADER_LOGS_FALSE #language en-US "\fh!48!No Logs To Display" +#string STR_HWH_VIEW_LOGS #language en-US "View Logs" +#string STR_HWH_LOG_DATE #language en-US "Date (MM/DD/YY):" +#string STR_HWH_LOG_TIME #language en-US "Time:" +#string STR_HWH_LOG_SEVERITY #language en-US "Severity:" +#string STR_HWH_LOG_NUMSECTIONS #language en-US "Number of Sections:" +#string STR_HWH_LOG_CREATORID #language en-US "Creator ID:" +#string STR_HWH_LOG_SOURCEID #language en-US "Source ID:" + +///////////////////////////////////////////////////////////////////////////// +// Error Report Strings +// + +#string STR_HWH_LOG_SEVERITY_VALUE #language en-US "SEVERITY" +#string STR_HWH_LOG_TIME_VALUE #language en-US "TIME" +#string STR_HWH_LOG_DATE_VALUE #language en-US "DATE" +#string STR_HWH_LOG_NUMSECTIONS_VALUE #language en-US "NUMBER OF SECTIONS" +#string STR_HWH_LOG_CREATORID_VALUE #language en-US "CREATOR ID" +#string STR_HWH_LOG_SOURCEID_VALUE #language en-US "SOURCE ID" + +#string STR_HWH_LOG_LINE_0_0 #language en-US "" +#string STR_HWH_LOG_LINE_0_1 #language en-US "" +#string STR_HWH_LOG_LINE_0_2 #language en-US "" +#string STR_HWH_LOG_LINE_1_0 #language en-US "" +#string STR_HWH_LOG_LINE_1_1 #language en-US "" +#string STR_HWH_LOG_LINE_1_2 #language en-US "" +#string STR_HWH_LOG_LINE_2_0 #language en-US "" +#string STR_HWH_LOG_LINE_2_1 #language en-US "" +#string STR_HWH_LOG_LINE_2_2 #language en-US "" +#string STR_HWH_LOG_LINE_3_0 #language en-US "" +#string STR_HWH_LOG_LINE_3_1 #language en-US "" +#string STR_HWH_LOG_LINE_3_2 #language en-US "" +#string STR_HWH_LOG_LINE_4_0 #language en-US "" +#string STR_HWH_LOG_LINE_4_1 #language en-US "" +#string STR_HWH_LOG_LINE_4_2 #language en-US "" +#string STR_HWH_LOG_LINE_5_0 #language en-US "" +#string STR_HWH_LOG_LINE_5_1 #language en-US "" +#string STR_HWH_LOG_LINE_5_2 #language en-US "" +#string STR_HWH_LOG_LINE_6_0 #language en-US "" +#string STR_HWH_LOG_LINE_6_1 #language en-US "" +#string STR_HWH_LOG_LINE_6_2 #language en-US "" +#string STR_HWH_LOG_LINE_7_0 #language en-US "" +#string STR_HWH_LOG_LINE_7_1 #language en-US "" +#string STR_HWH_LOG_LINE_7_2 #language en-US "" +#string STR_HWH_LOG_LINE_8_0 #language en-US "" +#string STR_HWH_LOG_LINE_8_1 #language en-US "" +#string STR_HWH_LOG_LINE_8_2 #language en-US "" +#string STR_HWH_LOG_LINE_9_0 #language en-US "" +#string STR_HWH_LOG_LINE_9_1 #language en-US "" +#string STR_HWH_LOG_LINE_9_2 #language en-US "" +#string STR_HWH_LOG_LINE_10_0 #language en-US "" +#string STR_HWH_LOG_LINE_10_1 #language en-US "" +#string STR_HWH_LOG_LINE_10_2 #language en-US "" +#string STR_HWH_LOG_LINE_11_0 #language en-US "" +#string STR_HWH_LOG_LINE_11_1 #language en-US "" +#string STR_HWH_LOG_LINE_11_2 #language en-US "" +#string STR_HWH_LOG_LINE_12_0 #language en-US "" +#string STR_HWH_LOG_LINE_12_1 #language en-US "" +#string STR_HWH_LOG_LINE_12_2 #language en-US "" +#string STR_HWH_LOG_LINE_13_0 #language en-US "" +#string STR_HWH_LOG_LINE_13_1 #language en-US "" +#string STR_HWH_LOG_LINE_13_2 #language en-US "" +#string STR_HWH_LOG_LINE_14_0 #language en-US "" +#string STR_HWH_LOG_LINE_14_1 #language en-US "" +#string STR_HWH_LOG_LINE_14_2 #language en-US "" diff --git a/MsWheaPkg/HwhMenu/HwhMenuVfr.Vfr b/MsWheaPkg/HwhMenu/HwhMenuVfr.Vfr index 892aeb1590..13c31586d2 100644 --- a/MsWheaPkg/HwhMenu/HwhMenuVfr.Vfr +++ b/MsWheaPkg/HwhMenu/HwhMenuVfr.Vfr @@ -1,542 +1,542 @@ -/** @file -HwhMenuVfr.Vfr - -The Vfr to support the HwhMenu display. - -Copyright (c) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "HwhMenuVfr.h" - -formset - guid = HWH_MENU_FORMSET_GUID, - title = STRING_TOKEN(STR_HWH_MENU_TITLE), - help = STRING_TOKEN(STR_NULL_STRING), - classguid = HWH_MENU_FORMSET_GUID, - class = EFI_OTHER_DEVICE_CLASS, - subclass = EFI_GENERAL_APPLICATION_SUBCLASS, - - varstore HWH_MENU_CONFIG, - varid = HWH_MENU_VARID, - name = HwhMenuConfig, - guid = HWH_MENU_FORMSET_GUID; - -///////////////////////////////////////////////////////////////////////////// -// Form ID 6: HW -// - - form formid = HWH_MENU_FORM_ID, - title = STRING_TOKEN(STR_NULL_STRING); - - suppressif ideqval HwhMenuConfig.Logs == LOGS_FALSE; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_FP_HW_HEADER_LOGS_TRUE); - endif; - - suppressif ideqval HwhMenuConfig.Logs == LOGS_TRUE; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_FP_HW_HEADER_LOGS_FALSE); - endif; - - suppressif ideqval HwhMenuConfig.Logs == LOGS_FALSE; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 70, // Grid cell height in pixels. - endguidop; - - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_DATE); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_DATE_VALUE); - text - help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing - text = STRING_TOKEN(STR_NULL_STRING); - - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 70, // Grid cell height in pixels. - endguidop; - - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_TIME); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_TIME_VALUE); - text - help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing - text = STRING_TOKEN(STR_NULL_STRING); - - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 70, // Grid cell height in pixels. - endguidop; - - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_SEVERITY); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_SEVERITY_VALUE); - text - help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing - text = STRING_TOKEN(STR_NULL_STRING); - - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 70, // Grid cell height in pixels. - endguidop; - - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_NUMSECTIONS); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_NUMSECTIONS_VALUE); - text - help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing - text = STRING_TOKEN(STR_NULL_STRING); - - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 70, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_CREATORID); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_CREATORID_VALUE); - text - help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing - text = STRING_TOKEN(STR_NULL_STRING); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_SOURCEID); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_SOURCEID_VALUE); - text - help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing - text = STRING_TOKEN(STR_NULL_STRING); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_NULL_STRING); - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_0_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_0_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_0_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_1_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_1_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_1_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_2_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_2_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_2_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_3_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_3_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_3_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_4_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_4_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_4_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_5_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_5_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_5_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_6_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_6_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_6_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_7_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_7_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_7_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_8_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_8_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_8_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_9_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_9_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_9_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_10_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_10_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_10_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_11_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_11_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_11_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_12_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_12_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_12_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_13_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_13_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_13_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 65, // Grid cell height in pixels. - endguidop; - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_14_0); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_14_1); - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_LOG_LINE_14_2); - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - - guidop - guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START - datatype = UINT32, // - data = 100, // Grid cell height in pixels. - endguidop; - - subtitle - text = STRING_TOKEN(STR_NULL_STRING), - flags = HORIZONTAL; - text - help = STRING_TOKEN(STR_NULL_STRING), //Page Left Button - text = STRING_TOKEN(STR_HWH_PAGE_LEFT), - flags = INTERACTIVE, - key = HWH_MENU_LEFT_ID; - text - help = STRING_TOKEN(STR_NULL_STRING), - text = STRING_TOKEN(STR_HWH_PAGE_NUM); - text - help = STRING_TOKEN(STR_NULL_STRING), //Page Right Button - text = STRING_TOKEN(STR_HWH_PAGE_RIGHT), - flags = INTERACTIVE, - key = HWH_MENU_RIGHT_ID; - - guidop - guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END - endguidop; - - endif; - - label LABEL_UPDATE_LOCATION; - // - // This is an unused update label location to force the form to be redrawn after UpdateForm() is called - // - label LABEL_UPDATE_END; - - endform; - -endformset; +/** @file +HwhMenuVfr.Vfr + +The Vfr to support the HwhMenu display. + +Copyright (c) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "HwhMenuVfr.h" + +formset + guid = HWH_MENU_FORMSET_GUID, + title = STRING_TOKEN(STR_HWH_MENU_TITLE), + help = STRING_TOKEN(STR_NULL_STRING), + classguid = HWH_MENU_FORMSET_GUID, + class = EFI_OTHER_DEVICE_CLASS, + subclass = EFI_GENERAL_APPLICATION_SUBCLASS, + + varstore HWH_MENU_CONFIG, + varid = HWH_MENU_VARID, + name = HwhMenuConfig, + guid = HWH_MENU_FORMSET_GUID; + +///////////////////////////////////////////////////////////////////////////// +// Form ID 6: HW +// + + form formid = HWH_MENU_FORM_ID, + title = STRING_TOKEN(STR_NULL_STRING); + + suppressif ideqval HwhMenuConfig.Logs == LOGS_FALSE; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_FP_HW_HEADER_LOGS_TRUE); + endif; + + suppressif ideqval HwhMenuConfig.Logs == LOGS_TRUE; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_FP_HW_HEADER_LOGS_FALSE); + endif; + + suppressif ideqval HwhMenuConfig.Logs == LOGS_FALSE; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 70, // Grid cell height in pixels. + endguidop; + + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_DATE); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_DATE_VALUE); + text + help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing + text = STRING_TOKEN(STR_NULL_STRING); + + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 70, // Grid cell height in pixels. + endguidop; + + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_TIME); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_TIME_VALUE); + text + help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing + text = STRING_TOKEN(STR_NULL_STRING); + + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 70, // Grid cell height in pixels. + endguidop; + + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_SEVERITY); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_SEVERITY_VALUE); + text + help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing + text = STRING_TOKEN(STR_NULL_STRING); + + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 70, // Grid cell height in pixels. + endguidop; + + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_NUMSECTIONS); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_NUMSECTIONS_VALUE); + text + help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing + text = STRING_TOKEN(STR_NULL_STRING); + + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 70, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_CREATORID); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_CREATORID_VALUE); + text + help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing + text = STRING_TOKEN(STR_NULL_STRING); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_SOURCEID); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_SOURCEID_VALUE); + text + help = STRING_TOKEN(STR_NULL_STRING), //Blank Column For Spacing + text = STRING_TOKEN(STR_NULL_STRING); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_NULL_STRING); + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_0_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_0_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_0_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_1_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_1_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_1_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_2_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_2_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_2_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_3_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_3_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_3_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_4_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_4_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_4_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_5_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_5_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_5_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_6_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_6_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_6_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_7_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_7_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_7_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_8_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_8_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_8_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_9_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_9_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_9_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_10_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_10_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_10_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_11_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_11_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_11_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_12_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_12_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_12_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_13_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_13_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_13_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 65, // Grid cell height in pixels. + endguidop; + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_14_0); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_14_1); + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_LOG_LINE_14_2); + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + + guidop + guid = GRID_CLASS_START_OPCODE_GUID, // Custom UI Grid opcode - START + datatype = UINT32, // + data = 100, // Grid cell height in pixels. + endguidop; + + subtitle + text = STRING_TOKEN(STR_NULL_STRING), + flags = HORIZONTAL; + text + help = STRING_TOKEN(STR_NULL_STRING), //Page Left Button + text = STRING_TOKEN(STR_HWH_PAGE_LEFT), + flags = INTERACTIVE, + key = HWH_MENU_LEFT_ID; + text + help = STRING_TOKEN(STR_NULL_STRING), + text = STRING_TOKEN(STR_HWH_PAGE_NUM); + text + help = STRING_TOKEN(STR_NULL_STRING), //Page Right Button + text = STRING_TOKEN(STR_HWH_PAGE_RIGHT), + flags = INTERACTIVE, + key = HWH_MENU_RIGHT_ID; + + guidop + guid = GRID_CLASS_END_OPCODE_GUID, // Custom UI Grid opcode - END + endguidop; + + endif; + + label LABEL_UPDATE_LOCATION; + // + // This is an unused update label location to force the form to be redrawn after UpdateForm() is called + // + label LABEL_UPDATE_END; + + endform; + +endformset; diff --git a/MsWheaPkg/HwhMenu/readme.md b/MsWheaPkg/HwhMenu/readme.md index 32fec55132..fa78d3a761 100644 --- a/MsWheaPkg/HwhMenu/readme.md +++ b/MsWheaPkg/HwhMenu/readme.md @@ -1,97 +1,97 @@ -# HwhMenu - -## About - -![HWH Menu](hwh_menu_mu.gif) - -A UEFI front page application which displays various fields of hardware error records to the user. -The application attempts to parse fields to provide more useful information and prints the raw -data if it cannot. - -## Main File - -### **HwhMenu.c** - -The main application file. - -### Loading Logs - -The HwErrRecs are loaded when the Hardware Health tab is first opened using GetVariable(). -The records are verified using CheckHwErrRecHeaderLib within MsWheaPkg before being added to a -linked list structure. The linked list is not being deleted because it will simply be reclaimed -when the OS boots or another allocation call is made which needs that memory. The config struct -used by the vfr holds a single UINT8 which if equal to LOGS_TRUE means there are errors to -display. If it is equal to LOGS_FALSE, the page will be suppressed and a string saying that -there are no logs present will be displayed at the top. - -### Paging between logs and updating the form - -There is a simple paging interface between records. -Whenever Next or Previous is pressed by the user, the page attempts to perform the desired action. -If it is successful, UpdateForm() is called which simply inserts nothing into the label section -of the VFR. What this does is make the form think it has been updated and tricks it into -refreshing, thus allowing all error specific strings which have been edited to be displayed to -the user. - -### Parsing the logs - -Each field which we display is parsed using the structs defined in Cper.h. -Parsing most fields is straightforward, but parsing section data requires a bit more work. -When preparing section data for the user, a call is made to ParserRegistryLib using the Section -Type guid within the section header of the hardware error record. The parser registry holds a -table which associates guids with function pointers, and any entity which employs its own section -guid should register a section data parser with the library. During parsing, if the section type -matches one in the register, the function pointer is called with the parameters specified in -ParserRegistryLib.h (SECTIONFUNCTIONPTR). The parser parses the data and populates an array of -strings with their desired display. HwhMenu.c holds a 2D array of EFI_STRING_IDs which are the -lines/columns where section data can be placed. The populated string array is written to these -strings until there is no more data to display or there are no more strings to put the data. -The user can place '\n' within their strings to separate a line into columns. See the -GenericSectionParserLib for a parsing example. - -### Adding to the Section Parser - -If you, the platform developer, recognize a section guid and know how to parse the bytes, you can provide a -function to do so by calling ParserLibRegisterSectionParser() with the guid you're able to parse and a function -pointer to parse it. This can be done within a new driver or by simply extending an existing driver. The HWH menu -will pass to your function (if the guid matches) a pointer to the section data and a pointer to an array of strings -to fill out with your completed parse. - -## Secondary files - -### **CreatorIDParser.c and PlatformIDParser.c** - -Called from within the HwhMenu.c file to parse the Creator and Platform IDs. - -### **HwhMenuVfr.h** - -Holds configuration information and guid opcodes used in the VFR file - -## Including the HWH Menu - -To include, paste the following in the platform DSC flie: - -``` { .md } - -[LibraryClasses] - ParserRegistryLib |MsWheaPkg/Library/ParserRegistryLib/ParserRegistryLib.inf - CheckHwErrRecHeaderLib|MsWheaPkg/Library/CheckHwErrRecHeaderLib/CheckHwErrRecHeaderLib.inf -[Components.X64] - MsWheaPkg/HwhMenu/HwhMenu.inf - -``` - -and the following in the platform FDF file - -``` { .md } - -[FV.FVDXE] - INF MsWheaPkg/HwhMenu/HwhMenu.inf - -``` - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. - -SPDX-License-Identifier: BSD-2-Clause-Patent +# HwhMenu + +## About + +![HWH Menu](hwh_menu_mu.gif) + +A UEFI front page application which displays various fields of hardware error records to the user. +The application attempts to parse fields to provide more useful information and prints the raw +data if it cannot. + +## Main File + +### **HwhMenu.c** + +The main application file. + +### Loading Logs + +The HwErrRecs are loaded when the Hardware Health tab is first opened using GetVariable(). +The records are verified using CheckHwErrRecHeaderLib within MsWheaPkg before being added to a +linked list structure. The linked list is not being deleted because it will simply be reclaimed +when the OS boots or another allocation call is made which needs that memory. The config struct +used by the vfr holds a single UINT8 which if equal to LOGS_TRUE means there are errors to +display. If it is equal to LOGS_FALSE, the page will be suppressed and a string saying that +there are no logs present will be displayed at the top. + +### Paging between logs and updating the form + +There is a simple paging interface between records. +Whenever Next or Previous is pressed by the user, the page attempts to perform the desired action. +If it is successful, UpdateForm() is called which simply inserts nothing into the label section +of the VFR. What this does is make the form think it has been updated and tricks it into +refreshing, thus allowing all error specific strings which have been edited to be displayed to +the user. + +### Parsing the logs + +Each field which we display is parsed using the structs defined in Cper.h. +Parsing most fields is straightforward, but parsing section data requires a bit more work. +When preparing section data for the user, a call is made to ParserRegistryLib using the Section +Type guid within the section header of the hardware error record. The parser registry holds a +table which associates guids with function pointers, and any entity which employs its own section +guid should register a section data parser with the library. During parsing, if the section type +matches one in the register, the function pointer is called with the parameters specified in +ParserRegistryLib.h (SECTIONFUNCTIONPTR). The parser parses the data and populates an array of +strings with their desired display. HwhMenu.c holds a 2D array of EFI_STRING_IDs which are the +lines/columns where section data can be placed. The populated string array is written to these +strings until there is no more data to display or there are no more strings to put the data. +The user can place '\n' within their strings to separate a line into columns. See the +GenericSectionParserLib for a parsing example. + +### Adding to the Section Parser + +If you, the platform developer, recognize a section guid and know how to parse the bytes, you can provide a +function to do so by calling ParserLibRegisterSectionParser() with the guid you're able to parse and a function +pointer to parse it. This can be done within a new driver or by simply extending an existing driver. The HWH menu +will pass to your function (if the guid matches) a pointer to the section data and a pointer to an array of strings +to fill out with your completed parse. + +## Secondary files + +### **CreatorIDParser.c and PlatformIDParser.c** + +Called from within the HwhMenu.c file to parse the Creator and Platform IDs. + +### **HwhMenuVfr.h** + +Holds configuration information and guid opcodes used in the VFR file + +## Including the HWH Menu + +To include, paste the following in the platform DSC flie: + +``` { .md } + +[LibraryClasses] + ParserRegistryLib |MsWheaPkg/Library/ParserRegistryLib/ParserRegistryLib.inf + CheckHwErrRecHeaderLib|MsWheaPkg/Library/CheckHwErrRecHeaderLib/CheckHwErrRecHeaderLib.inf +[Components.X64] + MsWheaPkg/HwhMenu/HwhMenu.inf + +``` + +and the following in the platform FDF file + +``` { .md } + +[FV.FVDXE] + INF MsWheaPkg/HwhMenu/HwhMenu.inf + +``` + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. + +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsWheaPkg/Library/CheckHwErrRecHeaderLib/CheckHwErrRecHeaderLib.inf b/MsWheaPkg/Library/CheckHwErrRecHeaderLib/CheckHwErrRecHeaderLib.inf index 9d85848075..b675d9b0bc 100644 --- a/MsWheaPkg/Library/CheckHwErrRecHeaderLib/CheckHwErrRecHeaderLib.inf +++ b/MsWheaPkg/Library/CheckHwErrRecHeaderLib/CheckHwErrRecHeaderLib.inf @@ -1,35 +1,35 @@ -## @file CheckHwErrRecHeaderLib.inf -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = CheckHwErrRecHeaderLib - FILE_GUID = 52260ec4-ba41-4c02-a1b6-1b205f7431eb - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = CheckHwErrRecHeaderLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - CheckHwErrRecHeaderLib.c - -[Packages] - MdePkg/MdePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - DebugLib - SafeIntLib - -[Depex] - TRUE +## @file CheckHwErrRecHeaderLib.inf +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = CheckHwErrRecHeaderLib + FILE_GUID = 52260ec4-ba41-4c02-a1b6-1b205f7431eb + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = CheckHwErrRecHeaderLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + CheckHwErrRecHeaderLib.c + +[Packages] + MdePkg/MdePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + DebugLib + SafeIntLib + +[Depex] + TRUE diff --git a/MsWheaPkg/Library/GenericSectionParserLib/GenericSectionParserLib.inf b/MsWheaPkg/Library/GenericSectionParserLib/GenericSectionParserLib.inf index 662a186bee..b38508f7ae 100644 --- a/MsWheaPkg/Library/GenericSectionParserLib/GenericSectionParserLib.inf +++ b/MsWheaPkg/Library/GenericSectionParserLib/GenericSectionParserLib.inf @@ -1,40 +1,40 @@ -## @file -# GenericSectionParser.inf -# -# This library implements a parser for the MS Generic WHEA section type. -# It must be linked against the ParserRegistryLib. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = GenericSectionParser - FILE_GUID = 3B42322C-F94B-4F57-636A-873D4DEDD256 - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - CONSTRUCTOR = GenericSectionParserLibConstructor - -[Sources] - GenericSectionParserLib.c - -[Packages] - MdePkg/MdePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - DebugLib - BaseLib - PrintLib - UefiBootServicesTableLib - UefiDriverEntryPoint - ParserRegistryLib - MuTelemetryHelperLib - -[Guids] - gMuTelemetrySectionTypeGuid - -[Depex] - gEfiRscHandlerProtocolGuid +## @file +# GenericSectionParser.inf +# +# This library implements a parser for the MS Generic WHEA section type. +# It must be linked against the ParserRegistryLib. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = GenericSectionParser + FILE_GUID = 3B42322C-F94B-4F57-636A-873D4DEDD256 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + CONSTRUCTOR = GenericSectionParserLibConstructor + +[Sources] + GenericSectionParserLib.c + +[Packages] + MdePkg/MdePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + DebugLib + BaseLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + ParserRegistryLib + MuTelemetryHelperLib + +[Guids] + gMuTelemetrySectionTypeGuid + +[Depex] + gEfiRscHandlerProtocolGuid diff --git a/MsWheaPkg/Library/MsWheaEarlyStorageLib/MsWheaEarlyStorageLib.inf b/MsWheaPkg/Library/MsWheaEarlyStorageLib/MsWheaEarlyStorageLib.inf index 6d4cf3efff..b2a52072fd 100644 --- a/MsWheaPkg/Library/MsWheaEarlyStorageLib/MsWheaEarlyStorageLib.inf +++ b/MsWheaPkg/Library/MsWheaEarlyStorageLib/MsWheaEarlyStorageLib.inf @@ -1,50 +1,50 @@ -## @file -- MsWheaEarlyStorageLib.inf -# -# This header defines APIs to utilize special memory for MsWheaReport during -# early stage. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsWheaEarlyStorageLib - FILE_GUID = E3E9F981-545E-4AF1-ACFA-44578AB7D159 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsWheaEarlyStorageLib - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsWheaEarlyStorageLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - DebugLib - IoLib - PcdLib - BaseLib - BaseMemoryLib - -[Protocols] - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue - gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity - -[Guids] - -[BuildOptions] - *_GCC5_*_CC_FLAGS = -Wno-unused-function +## @file -- MsWheaEarlyStorageLib.inf +# +# This header defines APIs to utilize special memory for MsWheaReport during +# early stage. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsWheaEarlyStorageLib + FILE_GUID = E3E9F981-545E-4AF1-ACFA-44578AB7D159 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsWheaEarlyStorageLib + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsWheaEarlyStorageLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + PcdLib + BaseLib + BaseMemoryLib + +[Protocols] + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue + gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity + +[Guids] + +[BuildOptions] + *_GCC5_*_CC_FLAGS = -Wno-unused-function diff --git a/MsWheaPkg/Library/MsWheaEarlyStorageLibNull/MsWheaEarlyStorageLibNull.inf b/MsWheaPkg/Library/MsWheaEarlyStorageLibNull/MsWheaEarlyStorageLibNull.inf index 79264c0e73..f3fcf30224 100644 --- a/MsWheaPkg/Library/MsWheaEarlyStorageLibNull/MsWheaEarlyStorageLibNull.inf +++ b/MsWheaPkg/Library/MsWheaEarlyStorageLibNull/MsWheaEarlyStorageLibNull.inf @@ -1,38 +1,38 @@ -## @file -- MsWheaEarlyStorageLibNull.inf -# -# This header defines APIs to utilize special memory for MsWheaReport during -# early stage. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsWheaEarlyStorageLibNull - FILE_GUID = B6535970-7D7B-4564-A067-297BE78CC66D - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsWheaEarlyStorageLib - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsWheaEarlyStorageLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - -[Protocols] - -[Pcd] - -[Guids] +## @file -- MsWheaEarlyStorageLibNull.inf +# +# This header defines APIs to utilize special memory for MsWheaReport during +# early stage. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsWheaEarlyStorageLibNull + FILE_GUID = B6535970-7D7B-4564-A067-297BE78CC66D + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsWheaEarlyStorageLib + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsWheaEarlyStorageLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + +[Protocols] + +[Pcd] + +[Guids] diff --git a/MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf b/MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf index 1ca5785d33..27e2ee543d 100644 --- a/MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf +++ b/MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf @@ -1,42 +1,42 @@ -## @file MuTelemetryHelperLib.inf -# Helper functions to make it even easier to report telemetry events in -# source code. -# -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MuTelemetryHelperLib - FILE_GUID = 621C6068-5F0D-4590-8C60-F5E9B720F140 - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = MuTelemetryHelperLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = ANY -# - - -[Sources] - MuTelemetryHelperLib.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - DebugLib - ReportStatusCodeLib - BaseMemoryLib - MemoryAllocationLib - -[Guids] - gMsWheaRSCDataTypeGuid ## CONSUMES +## @file MuTelemetryHelperLib.inf +# Helper functions to make it even easier to report telemetry events in +# source code. +# +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MuTelemetryHelperLib + FILE_GUID = 621C6068-5F0D-4590-8C60-F5E9B720F140 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = MuTelemetryHelperLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ANY +# + + +[Sources] + MuTelemetryHelperLib.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + DebugLib + ReportStatusCodeLib + BaseMemoryLib + MemoryAllocationLib + +[Guids] + gMsWheaRSCDataTypeGuid ## CONSUMES diff --git a/MsWheaPkg/Library/ParserRegistryLib/ParserRegistryLib.inf b/MsWheaPkg/Library/ParserRegistryLib/ParserRegistryLib.inf index 8561d748b6..6a0dd134fb 100644 --- a/MsWheaPkg/Library/ParserRegistryLib/ParserRegistryLib.inf +++ b/MsWheaPkg/Library/ParserRegistryLib/ParserRegistryLib.inf @@ -1,34 +1,34 @@ -## @file -# ParserRegistryLib.inf -# -# Holds a table which associates a guid with a function. When ParserLibRegisterSectionParser -# is called, a guid and function are put into the table. And when ParserLibFindSectionParser -# is called, the input guid is used to return an associated function (if one exists) -# -## -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = ParserRegistryLib - FILE_GUID = 2B04327D-134B-4F53-B185-473742E43A57 - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - LIBRARY_CLASS = ParserRegistryLib - -[Sources] - ParserRegistryLib.c - -[Packages] - MsWheaPkg/MsWheaPkg.dec - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - MemoryAllocationLib - - +## @file +# ParserRegistryLib.inf +# +# Holds a table which associates a guid with a function. When ParserLibRegisterSectionParser +# is called, a guid and function are put into the table. And when ParserLibFindSectionParser +# is called, the input guid is used to return an associated function (if one exists) +# +## +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = ParserRegistryLib + FILE_GUID = 2B04327D-134B-4F53-B185-473742E43A57 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = ParserRegistryLib + +[Sources] + ParserRegistryLib.c + +[Packages] + MsWheaPkg/MsWheaPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + + diff --git a/MsWheaPkg/Library/ParserRegistryLib/readme.md b/MsWheaPkg/Library/ParserRegistryLib/readme.md index 68e5fcc24e..d3de27063a 100644 --- a/MsWheaPkg/Library/ParserRegistryLib/readme.md +++ b/MsWheaPkg/Library/ParserRegistryLib/readme.md @@ -1,16 +1,16 @@ -# ParserRegistryLib - -## About - -Holds a table which associates guids with function pointers used for parsing section data. -If an entity wishes to parse a section type in a specific way, they simply need to call the register -function using a the section type guid and function pointer. When HwhMenu.c tries to parse -section data, it will look through all guids and return a function pointer if one matches. -The functions being registered must adhere to the SECTIONFUNCTIONPTR type located in -ParserRegistryLib.h. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. - -SPDX-License-Identifier: BSD-2-Clause-Patent +# ParserRegistryLib + +## About + +Holds a table which associates guids with function pointers used for parsing section data. +If an entity wishes to parse a section type in a specific way, they simply need to call the register +function using a the section type guid and function pointer. When HwhMenu.c tries to parse +section data, it will look through all guids and return a function pointer if one matches. +The functions being registered must adhere to the SECTIONFUNCTIONPTR type located in +ParserRegistryLib.h. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. + +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/MsWheaPkg/MsWheaPkg.ci.yaml b/MsWheaPkg/MsWheaPkg.ci.yaml index c719c6cc71..6ba40af1f6 100644 --- a/MsWheaPkg/MsWheaPkg.ci.yaml +++ b/MsWheaPkg/MsWheaPkg.ci.yaml @@ -1,90 +1,90 @@ -## -# CI configuration for MsWheaPkg -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -{ - ## options defined ci/Plugin/CompilerPlugin - "CompilerPlugin": { - "DscPath": "MsWheaPkg.dsc" - }, - ## options defined ci/Plugin/HostUnitTestCompilerPlugin - "HostUnitTestCompilerPlugin": { - "DscPath": "Test/MsWheaPkgHostTest.dsc" - }, - - ## options defined ci/Plugin/CharEncodingCheck - "CharEncodingCheck": { - "IgnoreFiles": [] - }, - - ## options defined ci/Plugin/DependencyCheck - "DependencyCheck": { - "AcceptableDependencies": [ - "MdePkg/MdePkg.dec", - "MdeModulePkg/MdeModulePkg.dec", - "MsWheaPkg/MsWheaPkg.dec" - ], - "AcceptableDependencies-HOST_APPLICATION":[ # for host based unit tests - "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" - ], - "AcceptableDependencies-UEFI_APPLICATION": [ - "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec", - "ShellPkg/ShellPkg.dec" - ], - "IgnoreInf": [] - }, - - ## options defined ci/Plugin/DscCompleteCheck - "DscCompleteCheck": { - "IgnoreInf": [], - "DscPath": "MsWheaPkg.dsc" - }, - ## options defined ci/Plugin/HostUnitTestDscCompleteCheck - "HostUnitTestDscCompleteCheck": { - "IgnoreInf": [""], - "DscPath": "Test/MsWheaPkgHostTest.dsc" - }, - - ## options defined ci/Plugin/GuidCheck - "GuidCheck": { - "IgnoreGuidName": [], - "IgnoreGuidValue": [], - "IgnoreFoldersAndFiles": [], - "IgnoreDuplicates": [] - }, - - ## options defined ci/Plugin/LibraryClassCheck - "LibraryClassCheck": { - "IgnoreLibraryClass": [], - "IgnoreHeaderFile": [] - }, - - ## options defined ci/Plugin/SpellCheck - "SpellCheck": { - "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore - ], - "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files - ], - "ExtendWords": [ # words to extend to the dictionary for this package - "MSCHANGE", - "BERTs", - "DXEIPL", - "hwerrrec", - "hwhmenu", - "creatorid", - "hwhmenu", - "sectionfunctionptr", - "frontpage", - "fvdxe", - "NUMSECTIONS", - "VARSEV", - "PREVERR", - "malformatted", - "Subcomponent", - - ], - "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) - } +## +# CI configuration for MsWheaPkg +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + ## options defined ci/Plugin/CompilerPlugin + "CompilerPlugin": { + "DscPath": "MsWheaPkg.dsc" + }, + ## options defined ci/Plugin/HostUnitTestCompilerPlugin + "HostUnitTestCompilerPlugin": { + "DscPath": "Test/MsWheaPkgHostTest.dsc" + }, + + ## options defined ci/Plugin/CharEncodingCheck + "CharEncodingCheck": { + "IgnoreFiles": [] + }, + + ## options defined ci/Plugin/DependencyCheck + "DependencyCheck": { + "AcceptableDependencies": [ + "MdePkg/MdePkg.dec", + "MdeModulePkg/MdeModulePkg.dec", + "MsWheaPkg/MsWheaPkg.dec" + ], + "AcceptableDependencies-HOST_APPLICATION":[ # for host based unit tests + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" + ], + "AcceptableDependencies-UEFI_APPLICATION": [ + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec", + "ShellPkg/ShellPkg.dec" + ], + "IgnoreInf": [] + }, + + ## options defined ci/Plugin/DscCompleteCheck + "DscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "MsWheaPkg.dsc" + }, + ## options defined ci/Plugin/HostUnitTestDscCompleteCheck + "HostUnitTestDscCompleteCheck": { + "IgnoreInf": [""], + "DscPath": "Test/MsWheaPkgHostTest.dsc" + }, + + ## options defined ci/Plugin/GuidCheck + "GuidCheck": { + "IgnoreGuidName": [], + "IgnoreGuidValue": [], + "IgnoreFoldersAndFiles": [], + "IgnoreDuplicates": [] + }, + + ## options defined ci/Plugin/LibraryClassCheck + "LibraryClassCheck": { + "IgnoreLibraryClass": [], + "IgnoreHeaderFile": [] + }, + + ## options defined ci/Plugin/SpellCheck + "SpellCheck": { + "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore + ], + "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files + ], + "ExtendWords": [ # words to extend to the dictionary for this package + "MSCHANGE", + "BERTs", + "DXEIPL", + "hwerrrec", + "hwhmenu", + "creatorid", + "hwhmenu", + "sectionfunctionptr", + "frontpage", + "fvdxe", + "NUMSECTIONS", + "VARSEV", + "PREVERR", + "malformatted", + "Subcomponent", + + ], + "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) + } } \ No newline at end of file diff --git a/MsWheaPkg/MsWheaPkg.dec b/MsWheaPkg/MsWheaPkg.dec index 7dea4cf595..b24a4af133 100644 --- a/MsWheaPkg/MsWheaPkg.dec +++ b/MsWheaPkg/MsWheaPkg.dec @@ -1,76 +1,76 @@ -## @file -# Package declaration file for Microsoft WHEA Package -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -[Defines] - DEC_SPECIFICATION = 0x00010017 - PACKAGE_NAME = MsWheaPkg - PACKAGE_VERSION = 0.1 - PACKAGE_GUID = B34D6A40-334D-4596-836E-ECCD0409CD2D - -[Guids] - gMsWheaPkgTokenSpaceGuid = { 0x9b859fdb, 0xcae9, 0x44f8, { 0x80, 0x86, 0xbb, 0xc0, 0xb2, 0x69, 0x3a, 0x1d } } - gMsWheaReportServiceGuid = { 0x8efebc4a, 0x5222, 0x409c, { 0xa5, 0x9f, 0x6f, 0x06, 0xdd, 0xb7, 0x96, 0x78 } } - gMuTelemetrySectionTypeGuid = { 0x85183a8b, 0x9c41, 0x429c, { 0x93, 0x9c, 0x5c, 0x3c, 0x08, 0x7c, 0xa2, 0x80 } } - gMsWheaReportRecordIDGuid = { 0x8efeb64a, 0x5322, 0x429c, { 0xa5, 0x9f, 0x6f, 0x16, 0xdd, 0xa7, 0x86, 0x79 } } - - # Internal guid to be populated in DataType guid of report status code call - gMsWheaRSCDataTypeGuid = { 0x91deea05, 0x8c0a, 0x4dcd, { 0xb9, 0x1e, 0xf2, 0x1c, 0xa0, 0xc6, 0x84, 0x5 } } - - # Test guid to be populated in IhvSharingGuid of MS_WHEA_RSC_INTERNAL_ERROR_DATA - gMuTestIhvSharedGuid = { 0x6de15562, 0x3b90, 0x4f73, { 0xb4, 0x58, 0x5a, 0x59, 0xe4, 0x21, 0xb2, 0xb8 } } - # Test guid to be populated in LibraryID of MS_WHEA_RSC_INTERNAL_ERROR_DATA - gMuTestLibraryGuid = { 0xf3446251, 0x8ba4, 0x4fe9, { 0xae, 0xed, 0x26, 0x5c, 0x45, 0xca, 0x4a, 0xf6 } } - - ## Guid which we'll use to get and store the variable which states whether or not we should raise errors at boot - # - gRaiseTelemetryErrorsAtBoot = {0x34b1e7cd, 0x9cc8, 0x4dcd, {0x9f, 0x9a, 0xf7, 0x1f, 0x1f, 0xae, 0xfd, 0xc6}} - - ## HWH Menu Formset Guid - # - # Include/Guid/HwhMenuGuid.h - gHwhMenuFormsetGuid = {0x3b82383d, 0x7add, 0x4c6a, {0xad, 0x2b, 0x71, 0x9b, 0x8d, 0x7b, 0x77, 0xc9}} - -[Includes] - Include - -[Includes.common.Private] - Private - Test/Include - -[Protocols] - -[Ppis] - -[LibraryClasses] - MsWheaEarlyStorageLib|Include/Library/MsWheaEarlyStorageLib.h - MuTelemetryHelperLib |Include/Library/MuTelemetryHelperLib.h - ParserRegistryLib|Include/Library/ParserRegistryLib.h - - ## @libraryclass Checks the validity of hardware error records - ## - CheckHwErrRecHeaderLib|Include/Library/CheckHwErrRecHeaderLib.h - -[PcdsFeatureFlag] - -[PcdsFixedAtBuild] - # Configure this Pcd to determine the TPL the RSC handler used by Whea listener, default to TPL_CALLBACK - gMsWheaPkgTokenSpaceGuid.PcdMsWheaRSCHandlerTpl|0x00000008|UINT32|0x00000001 - - gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity|0x00000100|UINT32|0x00000002 - gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue|0xFF|UINT8|0x00000003 - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported|TRUE|BOOLEAN|0x00000005 - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount|0xFFFF|UINT16|0x00000006 # By default, don't limit HwErr count - - # Platform identifier guid, set as Pcd. Platform SHOULD override this field during build!!! - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000004 - - # Variable names intended for extra BERT table entries, should be unicode string separated by ';'. - # Note: The variables for potential BERT candidate should be stored under GUID gEfiHardwareErrorVariableGuid. - # If such variable exists, its content MUST comply with CPER error format. - gMsWheaPkgTokenSpaceGuid.PcdBertEntriesVariableNames|L""|VOID*|0x00000007 +## @file +# Package declaration file for Microsoft WHEA Package +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + DEC_SPECIFICATION = 0x00010017 + PACKAGE_NAME = MsWheaPkg + PACKAGE_VERSION = 0.1 + PACKAGE_GUID = B34D6A40-334D-4596-836E-ECCD0409CD2D + +[Guids] + gMsWheaPkgTokenSpaceGuid = { 0x9b859fdb, 0xcae9, 0x44f8, { 0x80, 0x86, 0xbb, 0xc0, 0xb2, 0x69, 0x3a, 0x1d } } + gMsWheaReportServiceGuid = { 0x8efebc4a, 0x5222, 0x409c, { 0xa5, 0x9f, 0x6f, 0x06, 0xdd, 0xb7, 0x96, 0x78 } } + gMuTelemetrySectionTypeGuid = { 0x85183a8b, 0x9c41, 0x429c, { 0x93, 0x9c, 0x5c, 0x3c, 0x08, 0x7c, 0xa2, 0x80 } } + gMsWheaReportRecordIDGuid = { 0x8efeb64a, 0x5322, 0x429c, { 0xa5, 0x9f, 0x6f, 0x16, 0xdd, 0xa7, 0x86, 0x79 } } + + # Internal guid to be populated in DataType guid of report status code call + gMsWheaRSCDataTypeGuid = { 0x91deea05, 0x8c0a, 0x4dcd, { 0xb9, 0x1e, 0xf2, 0x1c, 0xa0, 0xc6, 0x84, 0x5 } } + + # Test guid to be populated in IhvSharingGuid of MS_WHEA_RSC_INTERNAL_ERROR_DATA + gMuTestIhvSharedGuid = { 0x6de15562, 0x3b90, 0x4f73, { 0xb4, 0x58, 0x5a, 0x59, 0xe4, 0x21, 0xb2, 0xb8 } } + # Test guid to be populated in LibraryID of MS_WHEA_RSC_INTERNAL_ERROR_DATA + gMuTestLibraryGuid = { 0xf3446251, 0x8ba4, 0x4fe9, { 0xae, 0xed, 0x26, 0x5c, 0x45, 0xca, 0x4a, 0xf6 } } + + ## Guid which we'll use to get and store the variable which states whether or not we should raise errors at boot + # + gRaiseTelemetryErrorsAtBoot = {0x34b1e7cd, 0x9cc8, 0x4dcd, {0x9f, 0x9a, 0xf7, 0x1f, 0x1f, 0xae, 0xfd, 0xc6}} + + ## HWH Menu Formset Guid + # + # Include/Guid/HwhMenuGuid.h + gHwhMenuFormsetGuid = {0x3b82383d, 0x7add, 0x4c6a, {0xad, 0x2b, 0x71, 0x9b, 0x8d, 0x7b, 0x77, 0xc9}} + +[Includes] + Include + +[Includes.common.Private] + Private + Test/Include + +[Protocols] + +[Ppis] + +[LibraryClasses] + MsWheaEarlyStorageLib|Include/Library/MsWheaEarlyStorageLib.h + MuTelemetryHelperLib |Include/Library/MuTelemetryHelperLib.h + ParserRegistryLib|Include/Library/ParserRegistryLib.h + + ## @libraryclass Checks the validity of hardware error records + ## + CheckHwErrRecHeaderLib|Include/Library/CheckHwErrRecHeaderLib.h + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild] + # Configure this Pcd to determine the TPL the RSC handler used by Whea listener, default to TPL_CALLBACK + gMsWheaPkgTokenSpaceGuid.PcdMsWheaRSCHandlerTpl|0x00000008|UINT32|0x00000001 + + gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity|0x00000100|UINT32|0x00000002 + gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue|0xFF|UINT8|0x00000003 + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported|TRUE|BOOLEAN|0x00000005 + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount|0xFFFF|UINT16|0x00000006 # By default, don't limit HwErr count + + # Platform identifier guid, set as Pcd. Platform SHOULD override this field during build!!! + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000004 + + # Variable names intended for extra BERT table entries, should be unicode string separated by ';'. + # Note: The variables for potential BERT candidate should be stored under GUID gEfiHardwareErrorVariableGuid. + # If such variable exists, its content MUST comply with CPER error format. + gMsWheaPkgTokenSpaceGuid.PcdBertEntriesVariableNames|L""|VOID*|0x00000007 diff --git a/MsWheaPkg/MsWheaReport/Dxe/MsWheaReportDxe.inf b/MsWheaPkg/MsWheaReport/Dxe/MsWheaReportDxe.inf index fb93ab115f..787687b0ba 100644 --- a/MsWheaPkg/MsWheaReport/Dxe/MsWheaReportDxe.inf +++ b/MsWheaPkg/MsWheaReport/Dxe/MsWheaReportDxe.inf @@ -1,84 +1,84 @@ -## @file -- MsWheaReportDxe.inf -# -# MsWheaReportDxe implements Microsoft WHEA report service for Dxe phase. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsWheaReportDxe - FILE_GUID = 995F045B-0265-46A4-8D21-001211A24A4F - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MsWheaReportDxeEntry - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - ../MsWheaReportCommon.h - ../MsWheaReportCommon.c - ../MsWheaEarlyStorageMgr.c - ../MsWheaEarlyStorageMgr.h - ../MsWheaReportHER.c - ../MsWheaReportHER.h - MsWheaReportDxe.c - MsWheaReportList.c - MsWheaReportList.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - UefiLib - DebugLib - HobLib - MemoryAllocationLib - PcdLib - PrintLib - ReportStatusCodeLib - UefiBootServicesTableLib - UefiDriverEntryPoint - UefiRuntimeServicesTableLib - MsWheaEarlyStorageLib - VariablePolicyHelperLib - -[Protocols] - gEfiAcpiTableProtocolGuid ## CONSUMES - gEfiRuntimeArchProtocolGuid ## CONSUMES - gEfiRscHandlerProtocolGuid ## CONSUMES - gEfiVariableWriteArchProtocolGuid ## CONSUMES - gEfiVariableArchProtocolGuid ## CONSUMES - gEfiRealTimeClockArchProtocolGuid ## CONSUMES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity - gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid - gMsWheaPkgTokenSpaceGuid.PcdMsWheaRSCHandlerTpl - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize - -[Guids] - gEfiHardwareErrorVariableGuid ## CONSUMES - gEfiEventExitBootServicesGuid ## CONSUMES - gMuTelemetrySectionTypeGuid ## CONSUMES - gMsWheaRSCDataTypeGuid ## CONSUMES - gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES - gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES - gMsWheaReportRecordIDGuid ## CONSUMES - -[Depex] - gEfiRscHandlerProtocolGuid +## @file -- MsWheaReportDxe.inf +# +# MsWheaReportDxe implements Microsoft WHEA report service for Dxe phase. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsWheaReportDxe + FILE_GUID = 995F045B-0265-46A4-8D21-001211A24A4F + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MsWheaReportDxeEntry + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + ../MsWheaReportCommon.h + ../MsWheaReportCommon.c + ../MsWheaEarlyStorageMgr.c + ../MsWheaEarlyStorageMgr.h + ../MsWheaReportHER.c + ../MsWheaReportHER.h + MsWheaReportDxe.c + MsWheaReportList.c + MsWheaReportList.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + UefiLib + DebugLib + HobLib + MemoryAllocationLib + PcdLib + PrintLib + ReportStatusCodeLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + MsWheaEarlyStorageLib + VariablePolicyHelperLib + +[Protocols] + gEfiAcpiTableProtocolGuid ## CONSUMES + gEfiRuntimeArchProtocolGuid ## CONSUMES + gEfiRscHandlerProtocolGuid ## CONSUMES + gEfiVariableWriteArchProtocolGuid ## CONSUMES + gEfiVariableArchProtocolGuid ## CONSUMES + gEfiRealTimeClockArchProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity + gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid + gMsWheaPkgTokenSpaceGuid.PcdMsWheaRSCHandlerTpl + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize + +[Guids] + gEfiHardwareErrorVariableGuid ## CONSUMES + gEfiEventExitBootServicesGuid ## CONSUMES + gMuTelemetrySectionTypeGuid ## CONSUMES + gMsWheaRSCDataTypeGuid ## CONSUMES + gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES + gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES + gMsWheaReportRecordIDGuid ## CONSUMES + +[Depex] + gEfiRscHandlerProtocolGuid diff --git a/MsWheaPkg/MsWheaReport/Pei/MsWheaReportPei.inf b/MsWheaPkg/MsWheaReport/Pei/MsWheaReportPei.inf index dcd279cd1f..8beb86b65f 100644 --- a/MsWheaPkg/MsWheaReport/Pei/MsWheaReportPei.inf +++ b/MsWheaPkg/MsWheaReport/Pei/MsWheaReportPei.inf @@ -1,68 +1,68 @@ -## @file -- MsWheaReportPei.inf -# -# MsWheaReportPei implements Microsoft WHEA report service for PEI phase. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsWheaReportPei - FILE_GUID = 57A2921A-7BC2-43C5-AA5D-064EDCBB992F - MODULE_TYPE = PEIM - VERSION_STRING = 1.0 - ENTRY_POINT = MsWheaReportPeiEntry - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - ../MsWheaReportCommon.h - ../MsWheaReportCommon.c - ../MsWheaEarlyStorageMgr.c - ../MsWheaEarlyStorageMgr.h - MsWheaReportPei.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - HobLib - IoLib - MemoryAllocationLib - PcdLib - ReportStatusCodeLib - PeimEntryPoint - PeiServicesLib - MsWheaEarlyStorageLib - -[Protocols] - -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize - gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity - gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid - -[Ppis] - gEfiPeiRscHandlerPpiGuid ## CONSUMES - -[Guids] - gMuTelemetrySectionTypeGuid ## CONSUMES - gMsWheaRSCDataTypeGuid ## CONSUMES - gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES - gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES - gMsWheaReportRecordIDGuid ## CONSUMES - -[Depex] - gEfiPeiRscHandlerPpiGuid +## @file -- MsWheaReportPei.inf +# +# MsWheaReportPei implements Microsoft WHEA report service for PEI phase. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsWheaReportPei + FILE_GUID = 57A2921A-7BC2-43C5-AA5D-064EDCBB992F + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = MsWheaReportPeiEntry + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + ../MsWheaReportCommon.h + ../MsWheaReportCommon.c + ../MsWheaEarlyStorageMgr.c + ../MsWheaEarlyStorageMgr.h + MsWheaReportPei.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HobLib + IoLib + MemoryAllocationLib + PcdLib + ReportStatusCodeLib + PeimEntryPoint + PeiServicesLib + MsWheaEarlyStorageLib + +[Protocols] + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize + gMsWheaPkgTokenSpaceGuid.PcdMsWheaReportEarlyStorageCapacity + gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid + +[Ppis] + gEfiPeiRscHandlerPpiGuid ## CONSUMES + +[Guids] + gMuTelemetrySectionTypeGuid ## CONSUMES + gMsWheaRSCDataTypeGuid ## CONSUMES + gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES + gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES + gMsWheaReportRecordIDGuid ## CONSUMES + +[Depex] + gEfiPeiRscHandlerPpiGuid diff --git a/MsWheaPkg/MsWheaReport/Smm/MsWheaReportSmm.inf b/MsWheaPkg/MsWheaReport/Smm/MsWheaReportSmm.inf index 92fabc1f7e..7f6dcbade1 100644 --- a/MsWheaPkg/MsWheaReport/Smm/MsWheaReportSmm.inf +++ b/MsWheaPkg/MsWheaReport/Smm/MsWheaReportSmm.inf @@ -1,76 +1,76 @@ -## @file -- MsWheaReportSmm.inf -# -# MsWheaReportSmm implements Microsoft WHEA report service for SMM environment. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - PI_SPECIFICATION_VERSION = 0x00010014 - BASE_NAME = MsWheaReportSmm - FILE_GUID = 73103E54-C56A-4D5D-8A0B-B7934FC7C9FD - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - ENTRY_POINT = MsWheaReportTraditionalEntry - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - ../MsWheaReportCommon.h - ../MsWheaReportCommon.c - ../MsWheaEarlyStorageMgr.c - ../MsWheaEarlyStorageMgr.h - ../MsWheaEarlyStorageMgr.h - ../MsWheaReportHER.c - ../MsWheaReportHER.h - MsWheaReportMm.c - MsWheaReportMm.h - MsWheaReportTraditional.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - MemoryAllocationLib - PcdLib - PrintLib - ReportStatusCodeLib - UefiDriverEntryPoint - MmServicesTableLib - MsWheaEarlyStorageLib - -[Protocols] - gEfiAcpiTableProtocolGuid ## CONSUMES - gEfiMmRscHandlerProtocolGuid ## CONSUMES - gEfiSmmVariableProtocolGuid ## CONSUMES - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize - -[Guids] - gEfiHardwareErrorVariableGuid ## CONSUMES - gEfiEventExitBootServicesGuid ## CONSUMES - gMuTelemetrySectionTypeGuid ## CONSUMES - gMsWheaRSCDataTypeGuid ## CONSUMES - gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES - gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES - gMsWheaReportRecordIDGuid ## CONSUMES - -[Depex] - gEfiMmRscHandlerProtocolGuid AND - gEfiVariableWriteArchProtocolGuid +## @file -- MsWheaReportSmm.inf +# +# MsWheaReportSmm implements Microsoft WHEA report service for SMM environment. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + PI_SPECIFICATION_VERSION = 0x00010014 + BASE_NAME = MsWheaReportSmm + FILE_GUID = 73103E54-C56A-4D5D-8A0B-B7934FC7C9FD + MODULE_TYPE = DXE_SMM_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MsWheaReportTraditionalEntry + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + ../MsWheaReportCommon.h + ../MsWheaReportCommon.c + ../MsWheaEarlyStorageMgr.c + ../MsWheaEarlyStorageMgr.h + ../MsWheaEarlyStorageMgr.h + ../MsWheaReportHER.c + ../MsWheaReportHER.h + MsWheaReportMm.c + MsWheaReportMm.h + MsWheaReportTraditional.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + PcdLib + PrintLib + ReportStatusCodeLib + UefiDriverEntryPoint + MmServicesTableLib + MsWheaEarlyStorageLib + +[Protocols] + gEfiAcpiTableProtocolGuid ## CONSUMES + gEfiMmRscHandlerProtocolGuid ## CONSUMES + gEfiSmmVariableProtocolGuid ## CONSUMES + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize + +[Guids] + gEfiHardwareErrorVariableGuid ## CONSUMES + gEfiEventExitBootServicesGuid ## CONSUMES + gMuTelemetrySectionTypeGuid ## CONSUMES + gMsWheaRSCDataTypeGuid ## CONSUMES + gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES + gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES + gMsWheaReportRecordIDGuid ## CONSUMES + +[Depex] + gEfiMmRscHandlerProtocolGuid AND + gEfiVariableWriteArchProtocolGuid diff --git a/MsWheaPkg/MsWheaReport/Smm/MsWheaReportStandaloneMm.inf b/MsWheaPkg/MsWheaReport/Smm/MsWheaReportStandaloneMm.inf index e5f49e2133..8e33b1bee0 100644 --- a/MsWheaPkg/MsWheaReport/Smm/MsWheaReportStandaloneMm.inf +++ b/MsWheaPkg/MsWheaReport/Smm/MsWheaReportStandaloneMm.inf @@ -1,76 +1,76 @@ -## @file -- MsWheaReportStandaloneMm.inf -# -# MsWheaReportStandaloneMm implements Microsoft WHEA report service for MM environment. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - PI_SPECIFICATION_VERSION = 0x00010032 - BASE_NAME = MsWheaReportStandaloneMm - FILE_GUID = DA2ED037-5994-4EF6-A1FF-9C7690FC72D5 - MODULE_TYPE = MM_STANDALONE - VERSION_STRING = 1.0 - ENTRY_POINT = MsWheaReportStandaloneEntry - -# -# The following information is for reference only and not required by the -# build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - ../MsWheaReportCommon.h - ../MsWheaReportCommon.c - ../MsWheaEarlyStorageMgr.c - ../MsWheaEarlyStorageMgr.h - ../MsWheaEarlyStorageMgr.h - ../MsWheaReportHER.c - ../MsWheaReportHER.h - MsWheaReportMm.c - MsWheaReportMm.h - MsWheaReportStandalone.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - MemoryAllocationLib - PcdLib - PrintLib - ReportStatusCodeLib - StandaloneMmDriverEntryPoint - MmServicesTableLib - MsWheaEarlyStorageLib - -[Protocols] - gEfiAcpiTableProtocolGuid ## CONSUMES - gEfiMmRscHandlerProtocolGuid ## CONSUMES - gEfiSmmVariableProtocolGuid ## CONSUMES - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize - -[Guids] - gEfiHardwareErrorVariableGuid ## CONSUMES - gEfiEventExitBootServicesGuid ## CONSUMES - gMuTelemetrySectionTypeGuid ## CONSUMES - gMsWheaRSCDataTypeGuid ## CONSUMES - gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES - gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES - gMsWheaReportRecordIDGuid ## CONSUMES - -[Depex] - gEfiMmRscHandlerProtocolGuid AND - gEfiSmmFaultTolerantWriteProtocolGuid +## @file -- MsWheaReportStandaloneMm.inf +# +# MsWheaReportStandaloneMm implements Microsoft WHEA report service for MM environment. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + PI_SPECIFICATION_VERSION = 0x00010032 + BASE_NAME = MsWheaReportStandaloneMm + FILE_GUID = DA2ED037-5994-4EF6-A1FF-9C7690FC72D5 + MODULE_TYPE = MM_STANDALONE + VERSION_STRING = 1.0 + ENTRY_POINT = MsWheaReportStandaloneEntry + +# +# The following information is for reference only and not required by the +# build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + ../MsWheaReportCommon.h + ../MsWheaReportCommon.c + ../MsWheaEarlyStorageMgr.c + ../MsWheaEarlyStorageMgr.h + ../MsWheaEarlyStorageMgr.h + ../MsWheaReportHER.c + ../MsWheaReportHER.h + MsWheaReportMm.c + MsWheaReportMm.h + MsWheaReportStandalone.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + PcdLib + PrintLib + ReportStatusCodeLib + StandaloneMmDriverEntryPoint + MmServicesTableLib + MsWheaEarlyStorageLib + +[Protocols] + gEfiAcpiTableProtocolGuid ## CONSUMES + gEfiMmRscHandlerProtocolGuid ## CONSUMES + gEfiSmmVariableProtocolGuid ## CONSUMES + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize + +[Guids] + gEfiHardwareErrorVariableGuid ## CONSUMES + gEfiEventExitBootServicesGuid ## CONSUMES + gMuTelemetrySectionTypeGuid ## CONSUMES + gMsWheaRSCDataTypeGuid ## CONSUMES + gMsWheaReportServiceGuid ## SOMETIMES_CONSUMES + gEfiEventNotificationTypeBootGuid ## SOMETIMES_CONSUMES + gMsWheaReportRecordIDGuid ## CONSUMES + +[Depex] + gEfiMmRscHandlerProtocolGuid AND + gEfiSmmFaultTolerantWriteProtocolGuid diff --git a/MsWheaPkg/MsWheaReport/Test/MsWheaReportCommonHostTest.inf b/MsWheaPkg/MsWheaReport/Test/MsWheaReportCommonHostTest.inf index 75e8f2329e..5014c5d51c 100644 --- a/MsWheaPkg/MsWheaReport/Test/MsWheaReportCommonHostTest.inf +++ b/MsWheaPkg/MsWheaReport/Test/MsWheaReportCommonHostTest.inf @@ -1,53 +1,53 @@ -## @file MsWheaReportCommonHostTest.inf -# Host-based UnitTest for Common routines in the MsWheaReport driver. -# -## -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MsWheaReportCommonHostTest - FILE_GUID = C6B9D08E-24D5-4C20-BE91-204014F5B2FD - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MsWheaReportCommonHostTest.c - ../MsWheaReportCommon.h - ../MsWheaReportCommon.c - - -[Packages] - MdePkg/MdePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - MsWheaPkg/MsWheaPkg.dec - - -[LibraryClasses] - DebugLib - UnitTestLib - - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid - - -[Guids] - gMsWheaReportServiceGuid - gMsWheaReportRecordIDGuid - gMsWheaRSCDataTypeGuid - - -[BuildOptions] - MSFT:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL - GCC:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL +## @file MsWheaReportCommonHostTest.inf +# Host-based UnitTest for Common routines in the MsWheaReport driver. +# +## +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MsWheaReportCommonHostTest + FILE_GUID = C6B9D08E-24D5-4C20-BE91-204014F5B2FD + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MsWheaReportCommonHostTest.c + ../MsWheaReportCommon.h + ../MsWheaReportCommon.c + + +[Packages] + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + MsWheaPkg/MsWheaPkg.dec + + +[LibraryClasses] + DebugLib + UnitTestLib + + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid + + +[Guids] + gMsWheaReportServiceGuid + gMsWheaReportRecordIDGuid + gMsWheaRSCDataTypeGuid + + +[BuildOptions] + MSFT:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL + GCC:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL diff --git a/MsWheaPkg/MsWheaReport/Test/MsWheaReportHERHostTest.inf b/MsWheaPkg/MsWheaReport/Test/MsWheaReportHERHostTest.inf index 5c53b76a83..ea75e2615c 100644 --- a/MsWheaPkg/MsWheaReport/Test/MsWheaReportHERHostTest.inf +++ b/MsWheaPkg/MsWheaReport/Test/MsWheaReportHERHostTest.inf @@ -1,65 +1,65 @@ -## @file MsWheaReportHERHostTest.inf -# Host-based UnitTest for HER routines in the MsWheaReport driver. -# -## -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MsWheaReportHERHostTest - FILE_GUID = 93E26E85-F3B3-45E8-8257-BD9E8B2FDEF4 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MsWheaReportHERHostTest.c - ../MsWheaReportHER.h - ../MsWheaReportHER.c - ../MsWheaReportCommon.h - # Need these for a couple shared functions called by MsWheaReportHER. - ../MsWheaReportCommon.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - MsWheaPkg/MsWheaPkg.dec - - -[LibraryClasses] - DebugLib - UnitTestLib - - -[Pcd] - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize - # Needed by MsWheaReportCommon - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid - - -[Guids] - gEfiHardwareErrorVariableGuid - # Needed by MsWheaReportCommon - gMsWheaReportServiceGuid - gMsWheaReportRecordIDGuid - gEfiEventNotificationTypeBootGuid - gMsWheaRSCDataTypeGuid - gMuTelemetrySectionTypeGuid - - -[BuildOptions] - MSFT:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL - GCC:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL +## @file MsWheaReportHERHostTest.inf +# Host-based UnitTest for HER routines in the MsWheaReport driver. +# +## +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MsWheaReportHERHostTest + FILE_GUID = 93E26E85-F3B3-45E8-8257-BD9E8B2FDEF4 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MsWheaReportHERHostTest.c + ../MsWheaReportHER.h + ../MsWheaReportHER.c + ../MsWheaReportCommon.h + # Need these for a couple shared functions called by MsWheaReportHER. + ../MsWheaReportCommon.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + MsWheaPkg/MsWheaPkg.dec + + +[LibraryClasses] + DebugLib + UnitTestLib + + +[Pcd] + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareMaxCount + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize + # Needed by MsWheaReportCommon + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid + + +[Guids] + gEfiHardwareErrorVariableGuid + # Needed by MsWheaReportCommon + gMsWheaReportServiceGuid + gMsWheaReportRecordIDGuid + gEfiEventNotificationTypeBootGuid + gMsWheaRSCDataTypeGuid + gMuTelemetrySectionTypeGuid + + +[BuildOptions] + MSFT:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL + GCC:NOOPT_*_*_CC_FLAGS = -DINTERNAL_UNIT_TEST ## cspell:words DINTERNAL diff --git a/MsWheaPkg/Test/MsWheaPkgHostTest.dsc b/MsWheaPkg/Test/MsWheaPkgHostTest.dsc index e93d0df403..7e94ace421 100644 --- a/MsWheaPkg/Test/MsWheaPkgHostTest.dsc +++ b/MsWheaPkg/Test/MsWheaPkgHostTest.dsc @@ -1,42 +1,42 @@ -## @file -# MsWheaPkg DSC file used to build host-based unit tests. -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - PLATFORM_NAME = MsWheaPkgHostTest - PLATFORM_GUID = 5DCE1750-D532-4180-B8D3-5EADA36BAD87 - PLATFORM_VERSION = 0.1 - DSC_SPECIFICATION = 0x00010005 - OUTPUT_DIRECTORY = Build/MsWheaPkg/HostTest - SUPPORTED_ARCHITECTURES = IA32|X64 - BUILD_TARGETS = NOOPT - SKUID_IDENTIFIER = DEFAULT - -!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc - -[Components] - # - # Build MdeModulePkg HOST_APPLICATION Tests - # - # MsWheaReport - MsWheaPkg/MsWheaReport/Test/MsWheaReportCommonHostTest.inf { - - # Disable ASSERTs. We need to test return values. - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07 - } - MsWheaPkg/MsWheaReport/Test/MsWheaReportHERHostTest.inf { - - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid|{0x16, 0x33, 0x43, 0x92, 0xA2, 0x00, 0x43, 0xEE, 0xBF, 0x63, 0x7F, 0x41, 0xEA, 0x3C, 0xEA, 0xAB} - } - - # MuTelemetryHelperLib - MsWheaPkg/Test/UnitTests/Library/MuTelemetryHelperLib/MuTelemetryHelperLibHostTest.inf { - - MuTelemetryHelperLib|MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf - # NOTE: This is a sloppy way to do this, but will clean it up. - ReportStatusCodeLib|MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf +## @file +# MsWheaPkg DSC file used to build host-based unit tests. +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME = MsWheaPkgHostTest + PLATFORM_GUID = 5DCE1750-D532-4180-B8D3-5EADA36BAD87 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/MsWheaPkg/HostTest + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = NOOPT + SKUID_IDENTIFIER = DEFAULT + +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc + +[Components] + # + # Build MdeModulePkg HOST_APPLICATION Tests + # + # MsWheaReport + MsWheaPkg/MsWheaReport/Test/MsWheaReportCommonHostTest.inf { + + # Disable ASSERTs. We need to test return values. + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07 + } + MsWheaPkg/MsWheaReport/Test/MsWheaReportHERHostTest.inf { + + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid|{0x16, 0x33, 0x43, 0x92, 0xA2, 0x00, 0x43, 0xEE, 0xBF, 0x63, 0x7F, 0x41, 0xEA, 0x3C, 0xEA, 0xAB} + } + + # MuTelemetryHelperLib + MsWheaPkg/Test/UnitTests/Library/MuTelemetryHelperLib/MuTelemetryHelperLibHostTest.inf { + + MuTelemetryHelperLib|MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf + # NOTE: This is a sloppy way to do this, but will clean it up. + ReportStatusCodeLib|MsWheaPkg/Library/MuTelemetryHelperLib/MuTelemetryHelperLib.inf } \ No newline at end of file diff --git a/MsWheaPkg/Test/UnitTests/Library/MuTelemetryHelperLib/MuTelemetryHelperLibHostTest.inf b/MsWheaPkg/Test/UnitTests/Library/MuTelemetryHelperLib/MuTelemetryHelperLibHostTest.inf index ceb96f9dc6..3937d74016 100644 --- a/MsWheaPkg/Test/UnitTests/Library/MuTelemetryHelperLib/MuTelemetryHelperLibHostTest.inf +++ b/MsWheaPkg/Test/UnitTests/Library/MuTelemetryHelperLib/MuTelemetryHelperLibHostTest.inf @@ -1,42 +1,42 @@ -## @file MuTelemetryHelperLibHostTest.inf -# Host-based UnitTest for MuTelemetryHelperLib. -# -## -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MuTelemetryHelperLibHostTest - FILE_GUID = 768C1D44-BA74-4FBD-9567-F53DC107EF04 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MuTelemetryHelperLibHostTest.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - MsWheaPkg/MsWheaPkg.dec - - -[Guids] - gZeroGuid - - -[LibraryClasses] - DebugLib - UnitTestLib - MuTelemetryHelperLib +## @file MuTelemetryHelperLibHostTest.inf +# Host-based UnitTest for MuTelemetryHelperLib. +# +## +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MuTelemetryHelperLibHostTest + FILE_GUID = 768C1D44-BA74-4FBD-9567-F53DC107EF04 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MuTelemetryHelperLibHostTest.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + MsWheaPkg/MsWheaPkg.dec + + +[Guids] + gZeroGuid + + +[LibraryClasses] + DebugLib + UnitTestLib + MuTelemetryHelperLib diff --git a/MsWheaPkg/Test/UnitTests/MsWheaEarlyStorageUnitTestApp/MsWheaEarlyUnitTestApp.inf b/MsWheaPkg/Test/UnitTests/MsWheaEarlyStorageUnitTestApp/MsWheaEarlyUnitTestApp.inf index 3fdc7081ce..c1831a4feb 100644 --- a/MsWheaPkg/Test/UnitTests/MsWheaEarlyStorageUnitTestApp/MsWheaEarlyUnitTestApp.inf +++ b/MsWheaPkg/Test/UnitTests/MsWheaEarlyStorageUnitTestApp/MsWheaEarlyUnitTestApp.inf @@ -1,60 +1,60 @@ -## @file MsWheaEarlyUnitTestApp.inf -# -# Tests for MS WHEA early storage management. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsWheaEarlyUnitTestApp - FILE_GUID = 2D954146-24C3-4D66-9B86-3C5B241A1F7A - VERSION_STRING = 1.0 - MODULE_TYPE = UEFI_APPLICATION - ENTRY_POINT = MsWheaEarlyUnitTestAppEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MsWheaEarlyUnitTestApp.c - ../../../MsWheaReport/MsWheaEarlyStorageMgr.c - ../../../MsWheaReport/MsWheaEarlyStorageMgr.h - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - DebugLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UnitTestLib - UnitTestPersistenceLib - PrintLib - MemoryAllocationLib - BaseLib - ShellLib - PcdLib - UefiLib - MsWheaEarlyStorageLib - -[Protocols] - -[Guids] - gMsWheaReportServiceGuid - -[FixedPcd] - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported - gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue - -[BuildOptions.Common] - MSFT:*_*_*_CC_FLAGS = /D INTERNAL_UNIT_TEST +## @file MsWheaEarlyUnitTestApp.inf +# +# Tests for MS WHEA early storage management. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsWheaEarlyUnitTestApp + FILE_GUID = 2D954146-24C3-4D66-9B86-3C5B241A1F7A + VERSION_STRING = 1.0 + MODULE_TYPE = UEFI_APPLICATION + ENTRY_POINT = MsWheaEarlyUnitTestAppEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MsWheaEarlyUnitTestApp.c + ../../../MsWheaReport/MsWheaEarlyStorageMgr.c + ../../../MsWheaReport/MsWheaEarlyStorageMgr.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + DebugLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UnitTestLib + UnitTestPersistenceLib + PrintLib + MemoryAllocationLib + BaseLib + ShellLib + PcdLib + UefiLib + MsWheaEarlyStorageLib + +[Protocols] + +[Guids] + gMsWheaReportServiceGuid + +[FixedPcd] + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported + gMsWheaPkgTokenSpaceGuid.PcdMsWheaEarlyStorageDefaultValue + +[BuildOptions.Common] + MSFT:*_*_*_CC_FLAGS = /D INTERNAL_UNIT_TEST GCC:*_*_*_CC_FLAGS = -D INTERNAL_UNIT_TEST \ No newline at end of file diff --git a/MsWheaPkg/Test/UnitTests/MsWheaReportUnitTestApp/MsWheaReportUnitTestApp.inf b/MsWheaPkg/Test/UnitTests/MsWheaReportUnitTestApp/MsWheaReportUnitTestApp.inf index b5f6adaa4b..99230c3378 100644 --- a/MsWheaPkg/Test/UnitTests/MsWheaReportUnitTestApp/MsWheaReportUnitTestApp.inf +++ b/MsWheaPkg/Test/UnitTests/MsWheaReportUnitTestApp/MsWheaReportUnitTestApp.inf @@ -1,64 +1,64 @@ -## @file MsWheaReportUnitTestApp.inf -# -# Tests for MS WHEA report tests with various payloads and error severities. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsWheaReportUnitTestApp - FILE_GUID = 75C3E1C3-40EE-4CC2-AF40-5ADE47870D86 - VERSION_STRING = 1.0 - MODULE_TYPE = UEFI_APPLICATION - ENTRY_POINT = MsWheaReportUnitTestAppEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MsWheaReportUnitTestApp.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsWheaPkg/MsWheaPkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - DebugLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UnitTestLib - UnitTestPersistenceLib - PrintLib - ReportStatusCodeLib - MemoryAllocationLib - BaseLib - ShellLib - PcdLib - UefiLib - MuTelemetryHelperLib - -[Protocols] - -[Guids] - gEfiEventNotificationTypeBootGuid ## CONSUMES - gMuTelemetrySectionTypeGuid ## CONSUMES - gEfiHardwareErrorVariableGuid ## CONSUMES - gMsWheaReportServiceGuid ## CONSUMES - gMuTestLibraryGuid ## CONSUMES - gMuTestIhvSharedGuid ## CONSUMES - -[FixedPcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES - gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid ## CONSUMES - gMsWheaPkgTokenSpaceGuid.PcdMsWheaRSCHandlerTpl ## CONSUMES - gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported +## @file MsWheaReportUnitTestApp.inf +# +# Tests for MS WHEA report tests with various payloads and error severities. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsWheaReportUnitTestApp + FILE_GUID = 75C3E1C3-40EE-4CC2-AF40-5ADE47870D86 + VERSION_STRING = 1.0 + MODULE_TYPE = UEFI_APPLICATION + ENTRY_POINT = MsWheaReportUnitTestAppEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MsWheaReportUnitTestApp.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsWheaPkg/MsWheaPkg.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + DebugLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UnitTestLib + UnitTestPersistenceLib + PrintLib + ReportStatusCodeLib + MemoryAllocationLib + BaseLib + ShellLib + PcdLib + UefiLib + MuTelemetryHelperLib + +[Protocols] + +[Guids] + gEfiEventNotificationTypeBootGuid ## CONSUMES + gMuTelemetrySectionTypeGuid ## CONSUMES + gEfiHardwareErrorVariableGuid ## CONSUMES + gMsWheaReportServiceGuid ## CONSUMES + gMuTestLibraryGuid ## CONSUMES + gMuTestIhvSharedGuid ## CONSUMES + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES + gMsWheaPkgTokenSpaceGuid.PcdDeviceIdentifierGuid ## CONSUMES + gMsWheaPkgTokenSpaceGuid.PcdMsWheaRSCHandlerTpl ## CONSUMES + gMsWheaPkgTokenSpaceGuid.PcdVariableHardwareErrorRecordAttributeSupported diff --git a/PcBdsPkg/Library/ConsoleMsgLibNull/ConsoleMsgLibNull.inf b/PcBdsPkg/Library/ConsoleMsgLibNull/ConsoleMsgLibNull.inf index 5f1ccd858f..6ddf4341fb 100644 --- a/PcBdsPkg/Library/ConsoleMsgLibNull/ConsoleMsgLibNull.inf +++ b/PcBdsPkg/Library/ConsoleMsgLibNull/ConsoleMsgLibNull.inf @@ -1,37 +1,37 @@ -## -# @file Empty Console Message Library -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ConsoleMsgLib - FILE_GUID = 7D346383-45E2-43E9-88F9-AA2D006AEBB9 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = ConsoleMsgLib - -# -# The following information is for reference only and not required by the build -# tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - ConsoleMsgLibNull.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Protocols] - -[Pcd] - -[Depex] - TRUE +## +# @file Empty Console Message Library +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ConsoleMsgLib + FILE_GUID = 7D346383-45E2-43E9-88F9-AA2D006AEBB9 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = ConsoleMsgLib + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + ConsoleMsgLibNull.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Protocols] + +[Pcd] + +[Depex] + TRUE diff --git a/PcBdsPkg/Library/DeviceBootManagerLib/DeviceBootManagerLib.inf b/PcBdsPkg/Library/DeviceBootManagerLib/DeviceBootManagerLib.inf index bc72107f8e..011ddc44f3 100644 --- a/PcBdsPkg/Library/DeviceBootManagerLib/DeviceBootManagerLib.inf +++ b/PcBdsPkg/Library/DeviceBootManagerLib/DeviceBootManagerLib.inf @@ -1,82 +1,82 @@ -## @file -# DeviceBootManager - Ms Device specific extensions to BdsDxe. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - EDK_RELEASE_VERSION = 0x00020000 - INF_VERSION = 0x00010017 - BASE_NAME = DeviceBootManagerLib - FILE_GUID = DA42AF9B-60D8-4AB6-A705-D9E626E5149C - VERSION_STRING = 1.0 - MODULE_TYPE = DXE_DRIVER - UEFI_SPECIFICATION_VERSION = 2.70 - LIBRARY_CLASS = DeviceBootManagerLib|DXE_DRIVER - CONSTRUCTOR = DeviceBootManagerConstructor - -[Sources] - DeviceBootManagerLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsCorePkg/MsCorePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - PcBdsPkg/PcBdsPkg.dec - DfciPkg/DfciPkg.dec - ShellPkg/ShellPkg.dec - MsWheaPkg/MsWheaPkg.dec - -[LibraryClasses] - DebugLib - HobLib - MemoryAllocationLib - BaseMemoryLib - DevicePathLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - MsPlatformDevicesLib - MsNetworkDependencyLib - MsBootOptionsLib - ConsoleMsgLib - MsBootPolicyLib - MsBootManagerSettingsLib - MsPlatformPowerCheckLib - ThermalServicesLib - PowerServicesLib - MsNVBootReasonLib - BootGraphicsLib - GraphicsConsoleHelperLib - MuTelemetryHelperLib - VariablePolicyHelperLib - UpdateFacsHardwareSignatureLib - -[Guids] - gUefiShellFileGuid - gMsStartOfBdsNotifyGuid - gDfciStartOfBdsNotifyGuid - gMsBootMenuFormsetGuid - gEfiEventPreReadyToBootGuid - gEfiEventPostReadyToBootGuid - gDfciSettingsManagerVarNamespace - -[Protocols] - gMsOSKProtocolGuid ## CONSUMES - gMsSWMProtocolGuid ## CONSUMES - gTpmPpProtocolGuid ## CONSUMES - gEdkiiVariablePolicyProtocolGuid ## CONSUMES - -[Pcd] - gPcBdsPkgTokenSpaceGuid.PcdPowerAndThermalRetries - gPcBdsPkgTokenSpaceGuid.PcdShutdownGraphicDisplayTime - gPcBdsPkgTokenSpaceGuid.PcdThermalControlRetryWait - gPcBdsPkgTokenSpaceGuid.PcdShellFile - gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapOutput - gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapTypes - gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapDumpOutput - gPcBdsPkgTokenSpaceGuid.PcdLowResolutionInternalShell - -[Depex] +## @file +# DeviceBootManager - Ms Device specific extensions to BdsDxe. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + EDK_RELEASE_VERSION = 0x00020000 + INF_VERSION = 0x00010017 + BASE_NAME = DeviceBootManagerLib + FILE_GUID = DA42AF9B-60D8-4AB6-A705-D9E626E5149C + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + UEFI_SPECIFICATION_VERSION = 2.70 + LIBRARY_CLASS = DeviceBootManagerLib|DXE_DRIVER + CONSTRUCTOR = DeviceBootManagerConstructor + +[Sources] + DeviceBootManagerLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + PcBdsPkg/PcBdsPkg.dec + DfciPkg/DfciPkg.dec + ShellPkg/ShellPkg.dec + MsWheaPkg/MsWheaPkg.dec + +[LibraryClasses] + DebugLib + HobLib + MemoryAllocationLib + BaseMemoryLib + DevicePathLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + MsPlatformDevicesLib + MsNetworkDependencyLib + MsBootOptionsLib + ConsoleMsgLib + MsBootPolicyLib + MsBootManagerSettingsLib + MsPlatformPowerCheckLib + ThermalServicesLib + PowerServicesLib + MsNVBootReasonLib + BootGraphicsLib + GraphicsConsoleHelperLib + MuTelemetryHelperLib + VariablePolicyHelperLib + UpdateFacsHardwareSignatureLib + +[Guids] + gUefiShellFileGuid + gMsStartOfBdsNotifyGuid + gDfciStartOfBdsNotifyGuid + gMsBootMenuFormsetGuid + gEfiEventPreReadyToBootGuid + gEfiEventPostReadyToBootGuid + gDfciSettingsManagerVarNamespace + +[Protocols] + gMsOSKProtocolGuid ## CONSUMES + gMsSWMProtocolGuid ## CONSUMES + gTpmPpProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES + +[Pcd] + gPcBdsPkgTokenSpaceGuid.PcdPowerAndThermalRetries + gPcBdsPkgTokenSpaceGuid.PcdShutdownGraphicDisplayTime + gPcBdsPkgTokenSpaceGuid.PcdThermalControlRetryWait + gPcBdsPkgTokenSpaceGuid.PcdShellFile + gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapOutput + gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapTypes + gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapDumpOutput + gPcBdsPkgTokenSpaceGuid.PcdLowResolutionInternalShell + +[Depex] TRUE \ No newline at end of file diff --git a/PcBdsPkg/Library/GraphicsConsoleHelperLib/GraphicsConsoleHelper.inf b/PcBdsPkg/Library/GraphicsConsoleHelperLib/GraphicsConsoleHelper.inf index 8e9e93e492..92a114470b 100644 --- a/PcBdsPkg/Library/GraphicsConsoleHelperLib/GraphicsConsoleHelper.inf +++ b/PcBdsPkg/Library/GraphicsConsoleHelperLib/GraphicsConsoleHelper.inf @@ -1,44 +1,44 @@ -## @file -# Library to help set the console to known points (low res, native res) -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = GraphicsConsoleHelperLib - FILE_GUID = f7ea5f4e-78cb-46f6-91a2-15f094ec8ce5 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = GraphicsConsoleHelperLib|DXE_DRIVER UEFI_APPLICATION - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - GraphicsConsoleHelper.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - DebugLib - PcdLib - MemoryAllocationLib - -[Protocols] - gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES - -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn - gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow - gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution - gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution +## @file +# Library to help set the console to known points (low res, native res) +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = GraphicsConsoleHelperLib + FILE_GUID = f7ea5f4e-78cb-46f6-91a2-15f094ec8ce5 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = GraphicsConsoleHelperLib|DXE_DRIVER UEFI_APPLICATION + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + GraphicsConsoleHelper.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + DebugLib + PcdLib + MemoryAllocationLib + +[Protocols] + gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution diff --git a/PcBdsPkg/Library/GraphicsConsoleHelperLibNull/GraphicsConsoleHelperLibNull.inf b/PcBdsPkg/Library/GraphicsConsoleHelperLibNull/GraphicsConsoleHelperLibNull.inf index ca2717ac1f..d0302d71be 100644 --- a/PcBdsPkg/Library/GraphicsConsoleHelperLibNull/GraphicsConsoleHelperLibNull.inf +++ b/PcBdsPkg/Library/GraphicsConsoleHelperLibNull/GraphicsConsoleHelperLibNull.inf @@ -1,35 +1,35 @@ -## @file -# GraphicsConsoleHelperLibNull - Null instance for compiling -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = GraphicsConsoleHelperNull - FILE_GUID = 57038927-e7a2-4e52-94dc-8b3857830ff8 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = GraphicsConsoleHelperLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 AARCH64 -# - -[Sources] - GraphicsConsoleHelperLibNull.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Protocols] - -[FeaturePcd] +## @file +# GraphicsConsoleHelperLibNull - Null instance for compiling +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = GraphicsConsoleHelperNull + FILE_GUID = 57038927-e7a2-4e52-94dc-8b3857830ff8 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = GraphicsConsoleHelperLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 AARCH64 +# + +[Sources] + GraphicsConsoleHelperLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Protocols] + +[FeaturePcd] diff --git a/PcBdsPkg/Library/MsAltBootLibNull/MsAltBootLibNull.inf b/PcBdsPkg/Library/MsAltBootLibNull/MsAltBootLibNull.inf index 899548e9e7..72528d670c 100644 --- a/PcBdsPkg/Library/MsAltBootLibNull/MsAltBootLibNull.inf +++ b/PcBdsPkg/Library/MsAltBootLibNull/MsAltBootLibNull.inf @@ -1,39 +1,39 @@ -## -# @file Library to interface with alternate boot variable -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsAltBootLib - FILE_GUID = 10a000e1-2eb2-4fd4-99ac-b98d1867b924 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsAltBootLib - -# -# The following information is for reference only and not required by the build -# tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsAltBootLibNull.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Protocols] - -[Guids] - -[Pcd] - -[Depex] - TRUE +## +# @file Library to interface with alternate boot variable +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsAltBootLib + FILE_GUID = 10a000e1-2eb2-4fd4-99ac-b98d1867b924 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsAltBootLib + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsAltBootLibNull.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Protocols] + +[Guids] + +[Pcd] + +[Depex] + TRUE diff --git a/PcBdsPkg/Library/MsBootManagerSettingsDxeLib/MsBootManagerSettingsDxeLib.inf b/PcBdsPkg/Library/MsBootManagerSettingsDxeLib/MsBootManagerSettingsDxeLib.inf index 819c0494f6..c1b33f242a 100644 --- a/PcBdsPkg/Library/MsBootManagerSettingsDxeLib/MsBootManagerSettingsDxeLib.inf +++ b/PcBdsPkg/Library/MsBootManagerSettingsDxeLib/MsBootManagerSettingsDxeLib.inf @@ -1,59 +1,59 @@ -## @file -# Library to support Device disable Settings (get/set) -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MsBootManagerSettingsDxeLib - FILE_GUID = 99b78f45-3e90-42af-bb7f-aa720879052b - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsBootManagerSettingsLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR = MsBootManagerSettingsConstructor -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - BootManagerSettings.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DebugLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - MemoryAllocationLib - BaseLib - BaseMemoryLib - UefiLib - PcdLib - -[Guids] - gMsBootManagerSettingsGuid - -[Protocols] - gDfciSettingsProviderSupportProtocolGuid - -[FeaturePcd] - gDfciPkgTokenSpaceGuid.PcdSettingsManagerInstallProvider - -[Pcd] - gPcBdsPkgTokenSpaceGuid.PcdEnableIPv6Boot - gPcBdsPkgTokenSpaceGuid.PcdEnableAltBoot - gPcBdsPkgTokenSpaceGuid.PcdEnableBootOrderLock - gPcBdsPkgTokenSpaceGuid.PcdEnableUsbBoot - gPcBdsPkgTokenSpaceGuid.PcdStartNetwork - gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapOutput - gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapTypes - -[Depex] - TRUE +## @file +# Library to support Device disable Settings (get/set) +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MsBootManagerSettingsDxeLib + FILE_GUID = 99b78f45-3e90-42af-bb7f-aa720879052b + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsBootManagerSettingsLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = MsBootManagerSettingsConstructor +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + BootManagerSettings.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DebugLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + MemoryAllocationLib + BaseLib + BaseMemoryLib + UefiLib + PcdLib + +[Guids] + gMsBootManagerSettingsGuid + +[Protocols] + gDfciSettingsProviderSupportProtocolGuid + +[FeaturePcd] + gDfciPkgTokenSpaceGuid.PcdSettingsManagerInstallProvider + +[Pcd] + gPcBdsPkgTokenSpaceGuid.PcdEnableIPv6Boot + gPcBdsPkgTokenSpaceGuid.PcdEnableAltBoot + gPcBdsPkgTokenSpaceGuid.PcdEnableBootOrderLock + gPcBdsPkgTokenSpaceGuid.PcdEnableUsbBoot + gPcBdsPkgTokenSpaceGuid.PcdStartNetwork + gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapOutput + gPcBdsPkgTokenSpaceGuid.PcdEnableMemMapTypes + +[Depex] + TRUE diff --git a/PcBdsPkg/Library/MsBootOptionsLib/MsBootOptionsLib.inf b/PcBdsPkg/Library/MsBootOptionsLib/MsBootOptionsLib.inf index a9e07489a6..303ca008ba 100644 --- a/PcBdsPkg/Library/MsBootOptionsLib/MsBootOptionsLib.inf +++ b/PcBdsPkg/Library/MsBootOptionsLib/MsBootOptionsLib.inf @@ -1,53 +1,53 @@ -## @file -# Library that is attached BdsDxe to implement Microsoft extensions to UefiBootManagerLib. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsBootOptionsLib - FILE_GUID = f18d4fc6-f2ff-4f91-bbf9-9da16072b1e3 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsBootOptionsLib | DXE_DRIVER -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsBootOptionsLib.c - -[Packages] - PcBdsPkg/PcBdsPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - BaseMemoryLib - DebugLib - DevicePathLib - DxeServicesLib - MemoryAllocationLib - PcdLib - UefiBootManagerLib - UefiBootServicesTableLib - UefiLib - -[Guids] - gMsBootPolicyFileGuid - -[Protocols] - gEfiFirmwareVolume2ProtocolGuid - -[FeaturePcd] - -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile - gPcBdsPkgTokenSpaceGuid.PcdShellFile - -[Depex] - TRUE +## @file +# Library that is attached BdsDxe to implement Microsoft extensions to UefiBootManagerLib. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsBootOptionsLib + FILE_GUID = f18d4fc6-f2ff-4f91-bbf9-9da16072b1e3 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsBootOptionsLib | DXE_DRIVER +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsBootOptionsLib.c + +[Packages] + PcBdsPkg/PcBdsPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + DevicePathLib + DxeServicesLib + MemoryAllocationLib + PcdLib + UefiBootManagerLib + UefiBootServicesTableLib + UefiLib + +[Guids] + gMsBootPolicyFileGuid + +[Protocols] + gEfiFirmwareVolume2ProtocolGuid + +[FeaturePcd] + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile + gPcBdsPkgTokenSpaceGuid.PcdShellFile + +[Depex] + TRUE diff --git a/PcBdsPkg/Library/MsBootPolicyLibNull/MsBootPolicyLibNull.inf b/PcBdsPkg/Library/MsBootPolicyLibNull/MsBootPolicyLibNull.inf index 2fa1c56aaa..0d947b97dc 100644 --- a/PcBdsPkg/Library/MsBootPolicyLibNull/MsBootPolicyLibNull.inf +++ b/PcBdsPkg/Library/MsBootPolicyLibNull/MsBootPolicyLibNull.inf @@ -1,32 +1,32 @@ -## @file -# Null Power Services Library class to support Platforms that dont have battery -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsBootPolicyLibNull - FILE_GUID = 8532FF36-7788-4BDF-B7F7-1865927273CF - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsBootPolicyLib|DXE_DRIVER UEFI_APPLICATION - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsBootPolicyLib.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - MsCorePkg/MsCorePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - MsPlatformDevicesLib +## @file +# Null Power Services Library class to support Platforms that dont have battery +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsBootPolicyLibNull + FILE_GUID = 8532FF36-7788-4BDF-B7F7-1865927273CF + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsBootPolicyLib|DXE_DRIVER UEFI_APPLICATION + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsBootPolicyLib.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + MsCorePkg/MsCorePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + MsPlatformDevicesLib diff --git a/PcBdsPkg/Library/MsNVBootReasonLibNull/MsNVBootReasonLibNull.inf b/PcBdsPkg/Library/MsNVBootReasonLibNull/MsNVBootReasonLibNull.inf index 3d5f6b4179..6269ad0405 100644 --- a/PcBdsPkg/Library/MsNVBootReasonLibNull/MsNVBootReasonLibNull.inf +++ b/PcBdsPkg/Library/MsNVBootReasonLibNull/MsNVBootReasonLibNull.inf @@ -1,36 +1,36 @@ -## @file -# Null Power Services Library class to support Platforms that dont have battery -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsNVBootReasonLib - FILE_GUID = 9ab7d76f-2683-4a1c-af85-70ab5b165f08 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsNVBootReasonLib|DXE_DRIVER UEFI_APPLICATION - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsNVBootReasonLibNull.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Protocols] - -[Guids] - -[Pcd] - +## @file +# Null Power Services Library class to support Platforms that dont have battery +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsNVBootReasonLib + FILE_GUID = 9ab7d76f-2683-4a1c-af85-70ab5b165f08 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsNVBootReasonLib|DXE_DRIVER UEFI_APPLICATION + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsNVBootReasonLibNull.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Protocols] + +[Guids] + +[Pcd] + diff --git a/PcBdsPkg/Library/MsNetworkDependencyLib/MsNetworkDependencyLib.inf b/PcBdsPkg/Library/MsNetworkDependencyLib/MsNetworkDependencyLib.inf index 7502f1532a..f19f4db937 100644 --- a/PcBdsPkg/Library/MsNetworkDependencyLib/MsNetworkDependencyLib.inf +++ b/PcBdsPkg/Library/MsNetworkDependencyLib/MsNetworkDependencyLib.inf @@ -1,46 +1,46 @@ -## @file -# Library that is attached to drivers that require networking. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsNetworkDependencyLib - FILE_GUID = 231f57fd-3875-4ec9-82fb-c077ffb22b2e - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsNetworkDependencyLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsNetworkDependencyLib.c - -[Packages] - PcBdsPkg/PcBdsPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - DebugLib - UefiBootManagerLib - UefiBootServicesTableLib - DxeServicesTableLib - TimerLib - -[Guids] - -[Protocols] - gMsNetworkDelayProtocolGuid - -[FeaturePcd] - -[Pcd] - -[Depex] - TRUE +## @file +# Library that is attached to drivers that require networking. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsNetworkDependencyLib + FILE_GUID = 231f57fd-3875-4ec9-82fb-c077ffb22b2e + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsNetworkDependencyLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsNetworkDependencyLib.c + +[Packages] + PcBdsPkg/PcBdsPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DebugLib + UefiBootManagerLib + UefiBootServicesTableLib + DxeServicesTableLib + TimerLib + +[Guids] + +[Protocols] + gMsNetworkDelayProtocolGuid + +[FeaturePcd] + +[Pcd] + +[Depex] + TRUE diff --git a/PcBdsPkg/Library/MsNetworkDependencyLib/readme.md b/PcBdsPkg/Library/MsNetworkDependencyLib/readme.md index 18f4b87ab6..37db33c2cd 100644 --- a/PcBdsPkg/Library/MsNetworkDependencyLib/readme.md +++ b/PcBdsPkg/Library/MsNetworkDependencyLib/readme.md @@ -1,30 +1,30 @@ -# MS Network DependencyLib and NetworkDelayLib - -## About - -These libraries implement a method to disable the network stack unless there is a reason to use the network. Not starting -the network improves boot performance and causes fewer issues during manufacturing. - -## How to use these libraries - -Add the NetworkDelayLib as a NULL library reference. All this library does is introduce a [Depex] on a NetworkDelay protocol. - -```text - MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf { - - NULL|PcBdsPkg/Library/MsNetworkDelayLib/MsNetworkDelayLib.inf - } -``` - -The NetworkDependencyLib implements a StartNetwork() interface that will publish the NetworkDelay protocol. - -The future goal of this functionality is to have the EFI_BOOT_MANAGER_POLICY.ConnectDeviceClass() function be overridden -and insert a call to DeviceDependencyLib.StartNetwork() when a request is made to start the network class. - -You nay see other references to NetworkDependencyLib as the conversion to using EFI_BOOT_MANAGER_POLICY.ConnectDeviceClass() -is not complete. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# MS Network DependencyLib and NetworkDelayLib + +## About + +These libraries implement a method to disable the network stack unless there is a reason to use the network. Not starting +the network improves boot performance and causes fewer issues during manufacturing. + +## How to use these libraries + +Add the NetworkDelayLib as a NULL library reference. All this library does is introduce a [Depex] on a NetworkDelay protocol. + +```text + MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf { + + NULL|PcBdsPkg/Library/MsNetworkDelayLib/MsNetworkDelayLib.inf + } +``` + +The NetworkDependencyLib implements a StartNetwork() interface that will publish the NetworkDelay protocol. + +The future goal of this functionality is to have the EFI_BOOT_MANAGER_POLICY.ConnectDeviceClass() function be overridden +and insert a call to DeviceDependencyLib.StartNetwork() when a request is made to start the network class. + +You nay see other references to NetworkDependencyLib as the conversion to using EFI_BOOT_MANAGER_POLICY.ConnectDeviceClass() +is not complete. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/PcBdsPkg/Library/MsPlatformDevicesLibNull/MsPlatformDevicesLibNull.inf b/PcBdsPkg/Library/MsPlatformDevicesLibNull/MsPlatformDevicesLibNull.inf index 57735170ea..4c5a18ef35 100644 --- a/PcBdsPkg/Library/MsPlatformDevicesLibNull/MsPlatformDevicesLibNull.inf +++ b/PcBdsPkg/Library/MsPlatformDevicesLibNull/MsPlatformDevicesLibNull.inf @@ -1,27 +1,27 @@ -## @file -# Empty Ms Platform Devices Library -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsPlatformDevicesLib - FILE_GUID = 2FDF4E63-5AD5-4385-A729-868019B45A91 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsPlatformDevicesLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsPlatformDevicesLibNull.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - MsCorePkg/MsCorePkg.dec - MdeModulePkg/MdeModulePkg.dec +## @file +# Empty Ms Platform Devices Library +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsPlatformDevicesLib + FILE_GUID = 2FDF4E63-5AD5-4385-A729-868019B45A91 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsPlatformDevicesLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsPlatformDevicesLibNull.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + MsCorePkg/MsCorePkg.dec + MdeModulePkg/MdeModulePkg.dec diff --git a/PcBdsPkg/Library/MsPlatformPowerCheckLibNull/MsPlatformPowerCheckLibNull.inf b/PcBdsPkg/Library/MsPlatformPowerCheckLibNull/MsPlatformPowerCheckLibNull.inf index bb29d554ac..8c29e805bc 100644 --- a/PcBdsPkg/Library/MsPlatformPowerCheckLibNull/MsPlatformPowerCheckLibNull.inf +++ b/PcBdsPkg/Library/MsPlatformPowerCheckLibNull/MsPlatformPowerCheckLibNull.inf @@ -1,33 +1,33 @@ -## @file -# Empty Platform Library of power check. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsPlatformPowerCheckLib - FILE_GUID = 673D8757-AE03-4875-84FF-BB70E59D956A - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MsPlatformPowerCheckLib - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MsPlatformPowerCheckLibNull.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Protocols] - -[Guids] - - +## @file +# Empty Platform Library of power check. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsPlatformPowerCheckLib + FILE_GUID = 673D8757-AE03-4875-84FF-BB70E59D956A + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MsPlatformPowerCheckLib + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MsPlatformPowerCheckLibNull.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Protocols] + +[Guids] + + diff --git a/PcBdsPkg/Library/MuUefiVersionLibNull/MuUefiVersionLibNull.inf b/PcBdsPkg/Library/MuUefiVersionLibNull/MuUefiVersionLibNull.inf index 1a68278aa1..6405ced0a7 100644 --- a/PcBdsPkg/Library/MuUefiVersionLibNull/MuUefiVersionLibNull.inf +++ b/PcBdsPkg/Library/MuUefiVersionLibNull/MuUefiVersionLibNull.inf @@ -1,37 +1,37 @@ -## -# @file Empty library to provide platform version information -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MuUefiVersionLib - FILE_GUID = 81a4bd4d-d368-4740-ab10-9525dcc1c2dc - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = MuUefiVersionLib - -# -# The following information is for reference only and not required by the build -# tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MuUefiVersionLibNull.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Protocols] - -[Pcd] - -[Depex] - TRUE +## +# @file Empty library to provide platform version information +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MuUefiVersionLib + FILE_GUID = 81a4bd4d-d368-4740-ab10-9525dcc1c2dc + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = MuUefiVersionLib + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MuUefiVersionLibNull.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Protocols] + +[Pcd] + +[Depex] + TRUE diff --git a/PcBdsPkg/Library/PowerServicesLibNull/PowerServicesLibNull.inf b/PcBdsPkg/Library/PowerServicesLibNull/PowerServicesLibNull.inf index 6e34060a45..3572507a60 100644 --- a/PcBdsPkg/Library/PowerServicesLibNull/PowerServicesLibNull.inf +++ b/PcBdsPkg/Library/PowerServicesLibNull/PowerServicesLibNull.inf @@ -1,28 +1,28 @@ -## @file -# Null Power Services Library class to support Platforms that dont have battery -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PowerServicesLibNull - FILE_GUID = 288AC8FF-0670-49e4-BB57-6A16F89D0C5A - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = PowerServicesLib|DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - PowerServicesLib.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - +## @file +# Null Power Services Library class to support Platforms that dont have battery +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PowerServicesLibNull + FILE_GUID = 288AC8FF-0670-49e4-BB57-6A16F89D0C5A + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PowerServicesLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + PowerServicesLib.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + diff --git a/PcBdsPkg/Library/ThermalServicesLibNull/ThermalServicesLibNull.inf b/PcBdsPkg/Library/ThermalServicesLibNull/ThermalServicesLibNull.inf index 33618f3974..81875cdd4b 100644 --- a/PcBdsPkg/Library/ThermalServicesLibNull/ThermalServicesLibNull.inf +++ b/PcBdsPkg/Library/ThermalServicesLibNull/ThermalServicesLibNull.inf @@ -1,38 +1,38 @@ -## @file -# This is the Thermal Services Library that encapsulates the platform specific -# thermal information. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ThermalServicesLibNull - FILE_GUID = FB697F5D-A9FA-407D-A99F-6078CB618E2C - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = ThermalServicesLib|DXE_DRIVER - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - ThermalServicesLib.c - -[Packages] - MdePkg/MdePkg.dec - PcBdsPkg/PcBdsPkg.dec - -[LibraryClasses] - -[Guids] - - -[Protocols] - -[Depex] - +## @file +# This is the Thermal Services Library that encapsulates the platform specific +# thermal information. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ThermalServicesLibNull + FILE_GUID = FB697F5D-A9FA-407D-A99F-6078CB618E2C + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = ThermalServicesLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + ThermalServicesLib.c + +[Packages] + MdePkg/MdePkg.dec + PcBdsPkg/PcBdsPkg.dec + +[LibraryClasses] + +[Guids] + + +[Protocols] + +[Depex] + diff --git a/PcBdsPkg/MsBootPolicy/MsBootPolicy.inf b/PcBdsPkg/MsBootPolicy/MsBootPolicy.inf index 68ab70ed05..ce97d55bee 100644 --- a/PcBdsPkg/MsBootPolicy/MsBootPolicy.inf +++ b/PcBdsPkg/MsBootPolicy/MsBootPolicy.inf @@ -1,66 +1,66 @@ -## -# MsBootPolicy implements the desired boot behavior when -# 1. No UEFI boot options are present, or they all failed -# 2. The ALT boot request has been requested -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MsBootPolicy - FILE_GUID = 50670071-478f-4be7-ad13-8754f379c62f - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = MsBootPolicyEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - MsBootPolicy.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - MsGraphicsPkg/MsGraphicsPkg.dec - PcBdsPkg/PcBdsPkg.dec - DfciPkg/DfciPkg.dec - -[LibraryClasses] - DevicePathLib - BaseLib - MemoryAllocationLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - ReportStatusCodeLib - UefiLib - BaseMemoryLib - DebugLib - PrintLib - MsBootPolicyLib - UefiBootManagerLib - MsNetworkDependencyLib - MsBootManagerSettingsLib - MsAltBootLib - BootGraphicsLib - BootGraphicsProviderLib - GraphicsConsoleHelperLib - -[Guids] - -[Protocols] - gEfiSimpleFileSystemProtocolGuid - gEfiLoadFileProtocolGuid - gDfciSettingAccessProtocolGuid - gEfiLoadedImageProtocolGuid - -[FeaturePcd] - -[Pcd] - +## +# MsBootPolicy implements the desired boot behavior when +# 1. No UEFI boot options are present, or they all failed +# 2. The ALT boot request has been requested +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MsBootPolicy + FILE_GUID = 50670071-478f-4be7-ad13-8754f379c62f + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = MsBootPolicyEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MsBootPolicy.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsGraphicsPkg/MsGraphicsPkg.dec + PcBdsPkg/PcBdsPkg.dec + DfciPkg/DfciPkg.dec + +[LibraryClasses] + DevicePathLib + BaseLib + MemoryAllocationLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + ReportStatusCodeLib + UefiLib + BaseMemoryLib + DebugLib + PrintLib + MsBootPolicyLib + UefiBootManagerLib + MsNetworkDependencyLib + MsBootManagerSettingsLib + MsAltBootLib + BootGraphicsLib + BootGraphicsProviderLib + GraphicsConsoleHelperLib + +[Guids] + +[Protocols] + gEfiSimpleFileSystemProtocolGuid + gEfiLoadFileProtocolGuid + gDfciSettingAccessProtocolGuid + gEfiLoadedImageProtocolGuid + +[FeaturePcd] + +[Pcd] + diff --git a/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAIVRSProtectionUnitTestApp.inf b/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAIVRSProtectionUnitTestApp.inf index cfd6d97b8d..514d84af24 100644 --- a/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAIVRSProtectionUnitTestApp.inf +++ b/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAIVRSProtectionUnitTestApp.inf @@ -1,59 +1,59 @@ -## @file DMAIVRSProtectionUnitTestApp.inf -## -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = DMAIVRSProtectionUnitTestApp - FILE_GUID = 1FE28524-ABCF-4A6C-8B33-8C7F6A054465 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = DMAProtectionUnitTestApp - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - Acpi.c - Acpi.h - DMAProtectionTest.h - DMAProtectionUnitTestApp.c - IVRS/DmaProtection.h - IVRS/DMAProtectionTestArch.c - IVRS/IVRS.h - IVRS/IVRSAcpiTable.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiTestingPkg/UefiTestingPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - ShellPkg/ShellPkg.dec - -[LibraryClasses] - BaseLib - UefiApplicationEntryPoint - DebugLib - UnitTestLib - UnitTestBootLib - PrintLib - ShellLib - IoLib - PciLib - MemoryAllocationLib - PciSegmentLib - -[Guids] - gDMAUnitTestVariableGuid - gEfiAcpi20TableGuid - gEfiAcpi10TableGuid - -[Protocols] - gEfiPciIoProtocolGuid ## CONSUMES +## @file DMAIVRSProtectionUnitTestApp.inf +## +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = DMAIVRSProtectionUnitTestApp + FILE_GUID = 1FE28524-ABCF-4A6C-8B33-8C7F6A054465 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = DMAProtectionUnitTestApp + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + Acpi.c + Acpi.h + DMAProtectionTest.h + DMAProtectionUnitTestApp.c + IVRS/DmaProtection.h + IVRS/DMAProtectionTestArch.c + IVRS/IVRS.h + IVRS/IVRSAcpiTable.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiTestingPkg/UefiTestingPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + BaseLib + UefiApplicationEntryPoint + DebugLib + UnitTestLib + UnitTestBootLib + PrintLib + ShellLib + IoLib + PciLib + MemoryAllocationLib + PciSegmentLib + +[Guids] + gDMAUnitTestVariableGuid + gEfiAcpi20TableGuid + gEfiAcpi10TableGuid + +[Protocols] + gEfiPciIoProtocolGuid ## CONSUMES diff --git a/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAVTdProtectionUnitTestApp.inf b/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAVTdProtectionUnitTestApp.inf index 4e3e6c854f..b83c20ebab 100644 --- a/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAVTdProtectionUnitTestApp.inf +++ b/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/DMAVTdProtectionUnitTestApp.inf @@ -1,63 +1,63 @@ -## @file DMAVTdProtectionUnitTestApp.inf -## -# Copyright (c) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = DMAVTdProtectionUnitTestApp - FILE_GUID = 1843f23c-7494-4ed8-afcf-969e2be65a49 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = DMAProtectionUnitTestApp - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources] - Acpi.c - Acpi.h - DMAProtectionTest.h - DMAProtectionUnitTestApp.c - VTd/DmaProtection.h - VTd/DMAProtectionTestArch.c - VTd/DmarAcpiTable.c - VTd/PciInfo.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiTestingPkg/UefiTestingPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - ShellPkg/ShellPkg.dec - IntelSiliconPkg/IntelSiliconPkg.dec - -[Protocols] - gEfiPciIoProtocolGuid ## CONSUMES - -[LibraryClasses] - BaseLib - UefiApplicationEntryPoint - DebugLib - UnitTestLib - UnitTestBootLib - PrintLib - ShellLib - IoLib - MemoryAllocationLib - PciSegmentLib - - - -[Guids] - gDMAUnitTestVariableGuid - gEfiAcpi20TableGuid - gEfiAcpi10TableGuid - - - +## @file DMAVTdProtectionUnitTestApp.inf +## +# Copyright (c) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = DMAVTdProtectionUnitTestApp + FILE_GUID = 1843f23c-7494-4ed8-afcf-969e2be65a49 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = DMAProtectionUnitTestApp + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + Acpi.c + Acpi.h + DMAProtectionTest.h + DMAProtectionUnitTestApp.c + VTd/DmaProtection.h + VTd/DMAProtectionTestArch.c + VTd/DmarAcpiTable.c + VTd/PciInfo.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiTestingPkg/UefiTestingPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + ShellPkg/ShellPkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + +[Protocols] + gEfiPciIoProtocolGuid ## CONSUMES + +[LibraryClasses] + BaseLib + UefiApplicationEntryPoint + DebugLib + UnitTestLib + UnitTestBootLib + PrintLib + ShellLib + IoLib + MemoryAllocationLib + PciSegmentLib + + + +[Guids] + gDMAUnitTestVariableGuid + gEfiAcpi20TableGuid + gEfiAcpi10TableGuid + + + diff --git a/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/README.md b/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/README.md index bac3dad1b8..f3f0590bec 100644 --- a/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/README.md +++ b/UefiTestingPkg/AuditTests/DMAProtectionAudit/UEFI/README.md @@ -1,20 +1,20 @@ -# DMAR Table Audit - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -## About - -`DMAProtectionUnitTestApp.c` - -Shell based UEFI unit test based off of the UnitTestFrameworkPkg that test for: - -1. IOMMU status register shows IOMMU enabled -2. All excluded regions are set as EfiReservedMemoryType(VTd)/EfiACPIMemoryNVS(IVRS) -3. Bus mastering enabled (BME) is disabled on ExitBootServices. Because we can no longer write to file after ExitBootServices - a variable is used to store the test state and the machine. - -Note: this unit test requires a restart to finish its testing. If you plan to use this unit test in automation make sure -to set up your startup.nsh script properly. +# DMAR Table Audit + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +## About + +`DMAProtectionUnitTestApp.c` + +Shell based UEFI unit test based off of the UnitTestFrameworkPkg that test for: + +1. IOMMU status register shows IOMMU enabled +2. All excluded regions are set as EfiReservedMemoryType(VTd)/EfiACPIMemoryNVS(IVRS) +3. Bus mastering enabled (BME) is disabled on ExitBootServices. Because we can no longer write to file after ExitBootServices + a variable is used to store the test state and the machine. + +Note: this unit test requires a restart to finish its testing. If you plan to use this unit test in automation make sure +to set up your startup.nsh script properly. diff --git a/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/DMARTableAudit.py b/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/DMARTableAudit.py index a8bf4a1914..1170cbe13d 100644 --- a/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/DMARTableAudit.py +++ b/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/DMARTableAudit.py @@ -1,136 +1,136 @@ -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -# -# Python script allowing reading DMAR from Windows, storing result in XML -# or text form. -## - -import os, sys -import argparse -from ctypes import * -from collections import namedtuple -import logging -import pywintypes -import win32api, win32process, win32security, win32file -import winerror -import struct -import subprocess -import datetime -import xml.etree.ElementTree as ET -from edk2toollib.acpi.dmar_parser import * - -DMARParserVersion = '1.01' - -class SystemFirmwareTable(object): - - def __init__(self): - # enable required SeSystemEnvironmentPrivilege privilege - privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) - token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) - win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) - win32api.CloseHandle( token ) - - kernel32 = windll.kernel32 - ntdll = windll.ntdll - - # import firmware variable APIs - try: - self._GetSystemFirmwareTable = kernel32.GetSystemFirmwareTable - self._GetSystemFirmwareTable.restype = c_int - self._GetSystemFirmwareTable.argtypes = [c_int, c_int, c_void_p, c_int] - - self._NtQuerySystemInformation = ntdll.NtQuerySystemInformation - - # NTSTATUS WINAPI NtQuerySystemInformation( - # _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, - # _Inout_ PVOID SystemInformation, - # _In_ ULONG SystemInformationLength, - # _Out_opt_ PULONG ReturnLength - # ); - self._NtQuerySystemInformation.restype = c_ulong - self._NtQuerySystemInformation.argtypes = [c_int, c_void_p, c_ulong, POINTER(c_ulong)] - - except AttributeError: - logging.error( "GetSystemFirmwareTable function doesn't seem to exist" ) - pass - - # - #Function to get an AcpiTable - # return a tuple of error code, table data, and errorstring (None if not error) - # - def get_acpi_table(self, TableId): - err = 0 #success - TableType = struct.unpack(b'>i', b'ACPI')[0] #big endian - TableIdAsInt = struct.unpack(b' TableLength): - logging.info("Table Length is: 0x%x" % length) - Table = create_string_buffer( length ) - length2 = self._GetSystemFirmwareTable( TableType, TableIdAsInt, Table, length) - - if(length2 != length): - err = kernel32.GetLastError() - logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, WinError(err)) - elif length != 0: - return (err, Table[:length], None) - err = kernel32.GetLastError() - logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, "Length = 0") - return (-20, None, "GetSystemFirmwareTable is None") - - -if __name__ == "__main__": - - # - # 1. Setup: command line args, logger, cleanup before we start, create the text file log, create XML tree with UEFI version and model - # - parser = argparse.ArgumentParser(description='DMAR Test Tool') - parser.add_argument('-i', '--InputXml', dest='input_xml_file', help='Name of the inpit XML file which will contain allowed RMRRs with PCI path', default=None) - parser.add_argument('-t', '--OutputText', dest='output_text_file', help='Name of the output text file which will contain the DMAR info', default=None) - parser.add_argument('-x', '--OutputXml', dest='output_xml_file', help='Name of the output XML file which will contain the DMAR info', default=None) - options = parser.parse_args() - - - - # Set up logging - logger = logging.getLogger('') - logger.setLevel(logging.INFO) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - # - # 2. Inspect DMAR - # - table = SystemFirmwareTable() - (errorcode, data, errorstring) = table.get_acpi_table(b'DMAR') - dmar_table = DMARTable(data) - - DMARTest = dmar_table.DMARBitEnabled() - ANDDCount = dmar_table.ANDDCount() - RMRRTest = dmar_table.CheckRMRRCount(options.input_xml_file) - - print("\n") - print("DMAR bit should be set:\t\tPASS" if DMARTest else "DMAR bit should be set:\t\tFAIL") - print("No ANDD structs in DMAR:\tPASS" if ANDDCount == 0 else "No ANDD structs in DMAR:\tFAIL") - print("No RMRR besides exception list:\tPASS" if RMRRTest else "No RMRR besides exception list:\tFAIL") - - if(options.output_text_file is not None): - text_log = open(options.output_text_file, 'w') - text_log.write(str(dmar_table)) - text_log.close() - - if(options.output_xml_file is not None): - xml_file = open(options.output_xml_file, 'wb') - xml_file.write(ET.tostring(dmar_table.xml)) - xml_file.close() +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +# +# Python script allowing reading DMAR from Windows, storing result in XML +# or text form. +## + +import os, sys +import argparse +from ctypes import * +from collections import namedtuple +import logging +import pywintypes +import win32api, win32process, win32security, win32file +import winerror +import struct +import subprocess +import datetime +import xml.etree.ElementTree as ET +from edk2toollib.acpi.dmar_parser import * + +DMARParserVersion = '1.01' + +class SystemFirmwareTable(object): + + def __init__(self): + # enable required SeSystemEnvironmentPrivilege privilege + privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) + token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) + win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) + win32api.CloseHandle( token ) + + kernel32 = windll.kernel32 + ntdll = windll.ntdll + + # import firmware variable APIs + try: + self._GetSystemFirmwareTable = kernel32.GetSystemFirmwareTable + self._GetSystemFirmwareTable.restype = c_int + self._GetSystemFirmwareTable.argtypes = [c_int, c_int, c_void_p, c_int] + + self._NtQuerySystemInformation = ntdll.NtQuerySystemInformation + + # NTSTATUS WINAPI NtQuerySystemInformation( + # _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, + # _Inout_ PVOID SystemInformation, + # _In_ ULONG SystemInformationLength, + # _Out_opt_ PULONG ReturnLength + # ); + self._NtQuerySystemInformation.restype = c_ulong + self._NtQuerySystemInformation.argtypes = [c_int, c_void_p, c_ulong, POINTER(c_ulong)] + + except AttributeError: + logging.error( "GetSystemFirmwareTable function doesn't seem to exist" ) + pass + + # + #Function to get an AcpiTable + # return a tuple of error code, table data, and errorstring (None if not error) + # + def get_acpi_table(self, TableId): + err = 0 #success + TableType = struct.unpack(b'>i', b'ACPI')[0] #big endian + TableIdAsInt = struct.unpack(b' TableLength): + logging.info("Table Length is: 0x%x" % length) + Table = create_string_buffer( length ) + length2 = self._GetSystemFirmwareTable( TableType, TableIdAsInt, Table, length) + + if(length2 != length): + err = kernel32.GetLastError() + logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, WinError(err)) + elif length != 0: + return (err, Table[:length], None) + err = kernel32.GetLastError() + logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, "Length = 0") + return (-20, None, "GetSystemFirmwareTable is None") + + +if __name__ == "__main__": + + # + # 1. Setup: command line args, logger, cleanup before we start, create the text file log, create XML tree with UEFI version and model + # + parser = argparse.ArgumentParser(description='DMAR Test Tool') + parser.add_argument('-i', '--InputXml', dest='input_xml_file', help='Name of the inpit XML file which will contain allowed RMRRs with PCI path', default=None) + parser.add_argument('-t', '--OutputText', dest='output_text_file', help='Name of the output text file which will contain the DMAR info', default=None) + parser.add_argument('-x', '--OutputXml', dest='output_xml_file', help='Name of the output XML file which will contain the DMAR info', default=None) + options = parser.parse_args() + + + + # Set up logging + logger = logging.getLogger('') + logger.setLevel(logging.INFO) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + # + # 2. Inspect DMAR + # + table = SystemFirmwareTable() + (errorcode, data, errorstring) = table.get_acpi_table(b'DMAR') + dmar_table = DMARTable(data) + + DMARTest = dmar_table.DMARBitEnabled() + ANDDCount = dmar_table.ANDDCount() + RMRRTest = dmar_table.CheckRMRRCount(options.input_xml_file) + + print("\n") + print("DMAR bit should be set:\t\tPASS" if DMARTest else "DMAR bit should be set:\t\tFAIL") + print("No ANDD structs in DMAR:\tPASS" if ANDDCount == 0 else "No ANDD structs in DMAR:\tFAIL") + print("No RMRR besides exception list:\tPASS" if RMRRTest else "No RMRR besides exception list:\tFAIL") + + if(options.output_text_file is not None): + text_log = open(options.output_text_file, 'w') + text_log.write(str(dmar_table)) + text_log.close() + + if(options.output_xml_file is not None): + xml_file = open(options.output_xml_file, 'wb') + xml_file.write(ET.tostring(dmar_table.xml)) + xml_file.close() diff --git a/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/IVRSTableAudit.py b/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/IVRSTableAudit.py index c8665f8645..10c00136a6 100644 --- a/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/IVRSTableAudit.py +++ b/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/IVRSTableAudit.py @@ -1,151 +1,151 @@ -## -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# Python script allowing reading DMAR from Windows, storing result in XML -# or text form. -## - -import os, sys -import argparse -from ctypes import * -from collections import namedtuple -import logging -import pywintypes -import win32api, win32process, win32security, win32file -import winerror -import struct -import subprocess -import datetime -import xml.etree.ElementTree as ET -from edk2toollib.acpi.ivrs_parser import * - -IVRSParserVersion = '1.00' - -class SystemFirmwareTable(object): - - def __init__(self): - # enable required SeSystemEnvironmentPrivilege privilege - privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) - token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) - win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) - win32api.CloseHandle( token ) - - # import firmware variable APIs - try: - self._GetSystemFirmwareTable = windll.kernel32.GetSystemFirmwareTable - self._GetSystemFirmwareTable.restype = c_int - self._GetSystemFirmwareTable.argtypes = [c_int, c_int, c_void_p, c_int] - - self._NtQuerySystemInformation = windll.ntdll.NtQuerySystemInformation - - # NTSTATUS WINAPI NtQuerySystemInformation( - # _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, - # _Inout_ PVOID SystemInformation, - # _In_ ULONG SystemInformationLength, - # _Out_opt_ PULONG ReturnLength - # ); - self._NtQuerySystemInformation.restype = c_ulong - self._NtQuerySystemInformation.argtypes = [c_int, c_void_p, c_ulong, POINTER(c_ulong)] - - except AttributeError: - logging.error( "GetSystemFirmwareTable function doesn't seem to exist" ) - pass - - def CheckExemptListCount(self, iommu_table, goldenxml=None): - goldenignores = list() - - if goldenxml is None or not os.path.isfile(goldenxml): - print("XML File not found") - else: - goldenfile = ET.parse(goldenxml) - goldenroot = goldenfile.getroot() - for entry in goldenroot: - if entry.tag == "IVMD": - goldenignores.append(entry.attrib) - - for IVMDentry in iommu_table.IVMD_list: - if not IVMDentry.validateIVMD(goldenignores): - print("IVMD PCIe Endpoint " + str(IVMDentry) + " found but not in golden XML") - return False - - return True - - # - #Function to get an AcpiTable - # return a tuple of error code, table data, and errorstring (None if not error) - # - def GetAcpiTable(self, TableId): - err = 0 #success - TableType = struct.unpack(b'>i', b'ACPI')[0] #big endian - TableIdAsInt = struct.unpack(b' TableLength): - logging.info("Table Length is: 0x%x" % length) - Table = create_string_buffer( length ) - length2 = self._GetSystemFirmwareTable( TableType, TableIdAsInt, Table, length) - - if(length2 != length): - err = windll.kernel32.GetLastError() - logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, WinError(err)) - elif length != 0: - return (err, Table[:length], None) - err = windll.kernel32.GetLastError() - logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, "Length = 0") - return (-20, None, "GetSystemFirmwareTable is None") - - -if __name__ == "__main__": - - # - # 1. Setup: command line args, logger, cleanup before we start, create the text file log, create XML tree with UEFI version and model - # - parser = argparse.ArgumentParser(description='IVRS Test Tool') - parser.add_argument('-i', '--InputXml', dest='input_xml_file', help='Name of the inpit XML file which will contain allowed exclusions with PCI path', default=None) - parser.add_argument('-t', '--OutputText', dest='output_text_file', help='Name of the output text file which will contain the IVRS info', default=None) - parser.add_argument('-x', '--OutputXml', dest='output_xml_file', help='Name of the output XML file which will contain the IVRS info', default=None) - options = parser.parse_args() - - # Set up logging - logger = logging.getLogger('') - logger.setLevel(logging.INFO) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - # - # 2. Inspect IVRS table - # - table = SystemFirmwareTable() - (errorcode, data, errorstring) = table.GetAcpiTable(b'IVRS') - if data == None: - raise Exception ('No IVRS table found, is this a supported platform?') - - iommu_table = IVRS_TABLE(data) - - IVRSTest = iommu_table.IVRSBitEnabled() - IVMDTest = table.CheckExemptListCount(iommu_table, options.input_xml_file) - - print("\n") - print("IVRS bit should be set:\t\tPASS" if IVRSTest else "DMAR bit should be set:\t\tFAIL") - print("No IVMD besides exception list:\tPASS" if IVMDTest else "No IVMD besides exception list:\tFAIL") - - if(options.output_text_file is not None): - sys.stdout = open(options.output_text_file, 'w') - iommu_table.DumpInfo() - sys.stdout.close() - - if(options.output_xml_file is not None): - xml_file = open(options.output_xml_file, 'wb') - xml_file.write(ET.tostring(iommu_table.ToXmlElementTree())) - xml_file.close() +## +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# Python script allowing reading DMAR from Windows, storing result in XML +# or text form. +## + +import os, sys +import argparse +from ctypes import * +from collections import namedtuple +import logging +import pywintypes +import win32api, win32process, win32security, win32file +import winerror +import struct +import subprocess +import datetime +import xml.etree.ElementTree as ET +from edk2toollib.acpi.ivrs_parser import * + +IVRSParserVersion = '1.00' + +class SystemFirmwareTable(object): + + def __init__(self): + # enable required SeSystemEnvironmentPrivilege privilege + privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) + token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) + win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) + win32api.CloseHandle( token ) + + # import firmware variable APIs + try: + self._GetSystemFirmwareTable = windll.kernel32.GetSystemFirmwareTable + self._GetSystemFirmwareTable.restype = c_int + self._GetSystemFirmwareTable.argtypes = [c_int, c_int, c_void_p, c_int] + + self._NtQuerySystemInformation = windll.ntdll.NtQuerySystemInformation + + # NTSTATUS WINAPI NtQuerySystemInformation( + # _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, + # _Inout_ PVOID SystemInformation, + # _In_ ULONG SystemInformationLength, + # _Out_opt_ PULONG ReturnLength + # ); + self._NtQuerySystemInformation.restype = c_ulong + self._NtQuerySystemInformation.argtypes = [c_int, c_void_p, c_ulong, POINTER(c_ulong)] + + except AttributeError: + logging.error( "GetSystemFirmwareTable function doesn't seem to exist" ) + pass + + def CheckExemptListCount(self, iommu_table, goldenxml=None): + goldenignores = list() + + if goldenxml is None or not os.path.isfile(goldenxml): + print("XML File not found") + else: + goldenfile = ET.parse(goldenxml) + goldenroot = goldenfile.getroot() + for entry in goldenroot: + if entry.tag == "IVMD": + goldenignores.append(entry.attrib) + + for IVMDentry in iommu_table.IVMD_list: + if not IVMDentry.validateIVMD(goldenignores): + print("IVMD PCIe Endpoint " + str(IVMDentry) + " found but not in golden XML") + return False + + return True + + # + #Function to get an AcpiTable + # return a tuple of error code, table data, and errorstring (None if not error) + # + def GetAcpiTable(self, TableId): + err = 0 #success + TableType = struct.unpack(b'>i', b'ACPI')[0] #big endian + TableIdAsInt = struct.unpack(b' TableLength): + logging.info("Table Length is: 0x%x" % length) + Table = create_string_buffer( length ) + length2 = self._GetSystemFirmwareTable( TableType, TableIdAsInt, Table, length) + + if(length2 != length): + err = windll.kernel32.GetLastError() + logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, WinError(err)) + elif length != 0: + return (err, Table[:length], None) + err = windll.kernel32.GetLastError() + logging.error( 'GetSystemFirmwareTable failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, "Length = 0") + return (-20, None, "GetSystemFirmwareTable is None") + + +if __name__ == "__main__": + + # + # 1. Setup: command line args, logger, cleanup before we start, create the text file log, create XML tree with UEFI version and model + # + parser = argparse.ArgumentParser(description='IVRS Test Tool') + parser.add_argument('-i', '--InputXml', dest='input_xml_file', help='Name of the inpit XML file which will contain allowed exclusions with PCI path', default=None) + parser.add_argument('-t', '--OutputText', dest='output_text_file', help='Name of the output text file which will contain the IVRS info', default=None) + parser.add_argument('-x', '--OutputXml', dest='output_xml_file', help='Name of the output XML file which will contain the IVRS info', default=None) + options = parser.parse_args() + + # Set up logging + logger = logging.getLogger('') + logger.setLevel(logging.INFO) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + # + # 2. Inspect IVRS table + # + table = SystemFirmwareTable() + (errorcode, data, errorstring) = table.GetAcpiTable(b'IVRS') + if data == None: + raise Exception ('No IVRS table found, is this a supported platform?') + + iommu_table = IVRS_TABLE(data) + + IVRSTest = iommu_table.IVRSBitEnabled() + IVMDTest = table.CheckExemptListCount(iommu_table, options.input_xml_file) + + print("\n") + print("IVRS bit should be set:\t\tPASS" if IVRSTest else "DMAR bit should be set:\t\tFAIL") + print("No IVMD besides exception list:\tPASS" if IVMDTest else "No IVMD besides exception list:\tFAIL") + + if(options.output_text_file is not None): + sys.stdout = open(options.output_text_file, 'w') + iommu_table.DumpInfo() + sys.stdout.close() + + if(options.output_xml_file is not None): + xml_file = open(options.output_xml_file, 'wb') + xml_file.write(ET.tostring(iommu_table.ToXmlElementTree())) + xml_file.close() diff --git a/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/Readme.md b/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/Readme.md index 91d88275c0..bbd561e7eb 100644 --- a/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/Readme.md +++ b/UefiTestingPkg/AuditTests/DMAProtectionAudit/Windows/Readme.md @@ -1,24 +1,24 @@ -# DMAR Table Audit - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -## About - -`DMARTableAudit.py` - -Unit test that checks: - -1. DMA remapping bit is enabled -2. No ANDD structures are included in DMAR table -3. RMRRs are limited to only the RMRRs specified in provided XML file (if no XML provided then verify no RMRRs exist) - -Software Requirements - -1. Python3 -2. Pywin32 - * `pip install Pywin32` -3. Project Mu python library - * `pip install mu-python-library` +# DMAR Table Audit + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +## About + +`DMARTableAudit.py` + +Unit test that checks: + +1. DMA remapping bit is enabled +2. No ANDD structures are included in DMAR table +3. RMRRs are limited to only the RMRRs specified in provided XML file (if no XML provided then verify no RMRRs exist) + +Software Requirements + +1. Python3 +2. Pywin32 + * `pip install Pywin32` +3. Project Mu python library + * `pip install mu-python-library` diff --git a/UefiTestingPkg/AuditTests/PagingAudit/UEFI/DxePagingAuditTestApp.inf b/UefiTestingPkg/AuditTests/PagingAudit/UEFI/DxePagingAuditTestApp.inf index 62750d6f20..fbfa37f3ef 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/UEFI/DxePagingAuditTestApp.inf +++ b/UefiTestingPkg/AuditTests/PagingAudit/UEFI/DxePagingAuditTestApp.inf @@ -1,58 +1,58 @@ -## @file DxePagingAuditTestApp.inf -# This Shell App writes page table and memory map information to SFS. -# -## -# Copyright (c) Microsoft Corporation. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = DxePagingAuditTestApp - FILE_GUID = 5CA3255F-0C91-4C8D-A4CF-36E8BC49D6C4 - VERSION_STRING = 1.0 - MODULE_TYPE = UEFI_APPLICATION - ENTRY_POINT = DxePagingAuditTestAppEntryPoint - - -[Sources] - Dxe/App/DxePagingAuditTestApp.c - PagingAuditCommon.c - PagingAuditCommon.h - - -[Sources.X64] - X64/PagingAuditProcessor.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - ShellPkg/ShellPkg.dec - UefiTestingPkg/UefiTestingPkg.dec - -[LibraryClasses] - PrintLib - DebugLib - UefiBootServicesTableLib - UefiLib - PeCoffGetEntryPointLib - UefiApplicationEntryPoint - ShellLib - UefiCpuLib - HobLib - DxeServicesTableLib - -[Guids] - gEfiDebugImageInfoTableGuid ## SOMETIMES_CONSUMES ## GUID - gEfiMemoryAttributesTableGuid - -[Protocols] - gEfiBlockIoProtocolGuid - gHeapGuardDebugProtocolGuid - gEfiSimpleFileSystemProtocolGuid - -[FixedPcd] - gUefiTestingPkgTokenSpaceGuid.PcdPlatformSmrrUnsupported ## SOMETIMES_CONSUMES +## @file DxePagingAuditTestApp.inf +# This Shell App writes page table and memory map information to SFS. +# +## +# Copyright (c) Microsoft Corporation. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = DxePagingAuditTestApp + FILE_GUID = 5CA3255F-0C91-4C8D-A4CF-36E8BC49D6C4 + VERSION_STRING = 1.0 + MODULE_TYPE = UEFI_APPLICATION + ENTRY_POINT = DxePagingAuditTestAppEntryPoint + + +[Sources] + Dxe/App/DxePagingAuditTestApp.c + PagingAuditCommon.c + PagingAuditCommon.h + + +[Sources.X64] + X64/PagingAuditProcessor.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + ShellPkg/ShellPkg.dec + UefiTestingPkg/UefiTestingPkg.dec + +[LibraryClasses] + PrintLib + DebugLib + UefiBootServicesTableLib + UefiLib + PeCoffGetEntryPointLib + UefiApplicationEntryPoint + ShellLib + UefiCpuLib + HobLib + DxeServicesTableLib + +[Guids] + gEfiDebugImageInfoTableGuid ## SOMETIMES_CONSUMES ## GUID + gEfiMemoryAttributesTableGuid + +[Protocols] + gEfiBlockIoProtocolGuid + gHeapGuardDebugProtocolGuid + gEfiSimpleFileSystemProtocolGuid + +[FixedPcd] + gUefiTestingPkgTokenSpaceGuid.PcdPlatformSmrrUnsupported ## SOMETIMES_CONSUMES diff --git a/UefiTestingPkg/AuditTests/PagingAudit/UEFI/SmmPagingAuditDriver.inf b/UefiTestingPkg/AuditTests/PagingAudit/UEFI/SmmPagingAuditDriver.inf index 43455d5ad1..7643bfc048 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/UEFI/SmmPagingAuditDriver.inf +++ b/UefiTestingPkg/AuditTests/PagingAudit/UEFI/SmmPagingAuditDriver.inf @@ -1,55 +1,55 @@ -## @file SmmPagingProtectionsTestSmm.inf -# This is the SMM portion of the SmmPagingProtectionsTest driver. -# This driver will be signalled by the DXE portion and will perform requested operations -# to probe the extent of the SMM memory protections (like NX). -# -## -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmPagingAuditDriver - FILE_GUID = 8D474447-F773-4E46-9C5D-0B6DEC141E46 - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x0001000A - ENTRY_POINT = SmmPagingAuditDriverEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - Smm/Driver/SmmPagingAuditDriver.c - Smm/SmmPagingAuditCommon.h - PagingAuditCommon.h - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - SmmServicesTableLib - DebugLib - SmmMemLib - BaseMemoryLib - PeCoffGetEntryPointLib - BaseLib - BaseMemoryLib - DebugLib - HobLib - UefiLib - PcdLib - UefiCpuLib - DxeServicesTableLib - -[Depex] +## @file SmmPagingProtectionsTestSmm.inf +# This is the SMM portion of the SmmPagingProtectionsTest driver. +# This driver will be signalled by the DXE portion and will perform requested operations +# to probe the extent of the SMM memory protections (like NX). +# +## +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SmmPagingAuditDriver + FILE_GUID = 8D474447-F773-4E46-9C5D-0B6DEC141E46 + MODULE_TYPE = DXE_SMM_DRIVER + VERSION_STRING = 1.0 + PI_SPECIFICATION_VERSION = 0x0001000A + ENTRY_POINT = SmmPagingAuditDriverEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + Smm/Driver/SmmPagingAuditDriver.c + Smm/SmmPagingAuditCommon.h + PagingAuditCommon.h + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + SmmServicesTableLib + DebugLib + SmmMemLib + BaseMemoryLib + PeCoffGetEntryPointLib + BaseLib + BaseMemoryLib + DebugLib + HobLib + UefiLib + PcdLib + UefiCpuLib + DxeServicesTableLib + +[Depex] TRUE \ No newline at end of file diff --git a/UefiTestingPkg/AuditTests/PagingAudit/Windows/BinaryParsing.py b/UefiTestingPkg/AuditTests/PagingAudit/Windows/BinaryParsing.py index 2c34c50296..763808c3bf 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/Windows/BinaryParsing.py +++ b/UefiTestingPkg/AuditTests/PagingAudit/Windows/BinaryParsing.py @@ -1,103 +1,103 @@ -# Functions used to parse memory range information from files. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -import struct -from ctypes import * -from collections import namedtuple -from MemoryRangeObjects import * -import logging -import csv - -def ParseFileToBytes(fileName): - file = open(fileName, "rb") - d = memoryview(file.read()) - file.close() - return d.tolist() - - -def ParseInfoFile(fileName): - logging.debug("-- Processing file '%s'..." % fileName) - MemoryRanges = [] - with open(fileName, "r") as file: - database_reader = csv.reader(file) - for row in database_reader: - MemoryRanges.append(MemoryRange(row[0], *row[1:])) - logging.debug("%d entries found in file %s" % (len(MemoryRanges), fileName)) - return MemoryRanges - - -def Parse4kPages(fileName, addressbits): - num = 0 - pages = [] - logging.debug("-- Processing file '%s'..." % fileName) - ByteArray = ParseFileToBytes(fileName) - byteZeroIndex = 0 - while (byteZeroIndex + 7) < len(ByteArray): - if 0 == (ByteArray[byteZeroIndex + 0] + ByteArray[byteZeroIndex + 1] + ByteArray[byteZeroIndex + 2] + ByteArray[byteZeroIndex + 3] + ByteArray[byteZeroIndex + 4] + ByteArray[byteZeroIndex + 5] + ByteArray[byteZeroIndex + 6] + ByteArray[byteZeroIndex + 7]): - byteZeroIndex += 8 - continue - Present = ((ByteArray[byteZeroIndex + 0] & 0x1)) - ReadWrite = ((ByteArray[byteZeroIndex + 0] & 0x2) >> 1) - User = ((ByteArray[byteZeroIndex + 0] & 0x4) >> 2) - # PageTableBaseAddress is 40 bits long - PageTableBaseAddress = (((((ByteArray[byteZeroIndex + 1] & 0xF0) >> 4)) + (ByteArray[byteZeroIndex + 2] << 4) + (ByteArray[byteZeroIndex + 3] << 12) + (ByteArray[byteZeroIndex + 4] << 20) + (ByteArray[byteZeroIndex + 5] << 28) + ((ByteArray[byteZeroIndex + 6] & 0xF) << 36) << 12) & addressbits) - Nx = ((ByteArray[byteZeroIndex + 7] & 0x80) >> 7) - - byteZeroIndex += 8 - num += 1 - pages.append(MemoryRange("PTEntry", "4k", Present, ReadWrite, Nx, 1, User, (PageTableBaseAddress))) - logging.debug("%d entries found in file %s" % (num, fileName)) - return pages - - -def Parse2mPages(fileName, addressbits): - num = 0 - pages = [] - logging.debug("-- Processing file '%s'..." % fileName) - ByteArray = ParseFileToBytes(fileName) - byteZeroIndex = 0 - while (byteZeroIndex + 7) < len(ByteArray): - if 0 == (ByteArray[byteZeroIndex + 0] + ByteArray[byteZeroIndex + 1] + ByteArray[byteZeroIndex + 2] + ByteArray[byteZeroIndex + 3] + ByteArray[byteZeroIndex + 4] + ByteArray[byteZeroIndex + 5] + ByteArray[byteZeroIndex + 6] + ByteArray[byteZeroIndex + 7]): - byteZeroIndex += 8 - continue - Present = ((ByteArray[byteZeroIndex + 0] & 0x1) >> 0) - ReadWrite = ((ByteArray[byteZeroIndex + 0] & 0x2) >> 1) - MustBe1 = ((ByteArray[byteZeroIndex + 0] & 0x80) >> 7) - User = ((ByteArray[byteZeroIndex + 0] & 0x4) >> 2) - # PageTableBaseAddress is 31 bits long - PageTableBaseAddress = (((((ByteArray[byteZeroIndex + 2] & 0xE0) >> 5)) + (ByteArray[byteZeroIndex + 3] << 3) + (ByteArray[byteZeroIndex + 4] << 11) + (ByteArray[byteZeroIndex + 5] << 19) + ((ByteArray[byteZeroIndex + 6] & 0xF) << 27) << 21) & addressbits) - Nx = ((ByteArray[byteZeroIndex + 7] & 0x80) >> 7) - - byteZeroIndex += 8 - num += 1 - pages.append(MemoryRange("PTEntry", "2m", Present, ReadWrite, Nx, MustBe1, User, (PageTableBaseAddress))) - logging.debug("%d entries found in file %s" % (num, fileName)) - return pages - - -def Parse1gPages(fileName, addressbits): - num = 0 - pages = [] - logging.debug("-- Processing file '%s'..." % fileName) - ByteArray = ParseFileToBytes(fileName) - byteZeroIndex = 0 - while (byteZeroIndex + 7) < len(ByteArray): - if 0 == (ByteArray[byteZeroIndex + 0] + ByteArray[byteZeroIndex + 1] + ByteArray[byteZeroIndex + 2] + ByteArray[byteZeroIndex + 3] + ByteArray[byteZeroIndex + 4] + ByteArray[byteZeroIndex + 5] + ByteArray[byteZeroIndex + 6] + ByteArray[byteZeroIndex + 7]): - byteZeroIndex += 8 - continue - Present = ((ByteArray[byteZeroIndex + 0] & 0x1)) - ReadWrite = ((ByteArray[byteZeroIndex + 0] & 0x2) >> 1) - MustBe1 = ((ByteArray[byteZeroIndex + 0] & 0x80) >> 7) - User = ((ByteArray[byteZeroIndex + 0] & 0x4) >> 2) - # PageTableBaseAddress is 22 bits long - PageTableBaseAddress = (((((ByteArray[byteZeroIndex + 3] & 0xC0) >> 6)) + (ByteArray[byteZeroIndex + 4] << 2) + (ByteArray[byteZeroIndex + 5] << 10) + ((ByteArray[byteZeroIndex + 6] & 0xF) << 18) << 30) & addressbits) # shift and address bits - Nx = ((ByteArray[byteZeroIndex + 7] & 0x80) >> 7) - - byteZeroIndex += 8 - pages.append(MemoryRange("PTEntry", "1g", Present, ReadWrite, Nx, MustBe1, User, PageTableBaseAddress)) - num += 1 - logging.debug("%d entries found in file %s" % (num, fileName)) +# Functions used to parse memory range information from files. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +import struct +from ctypes import * +from collections import namedtuple +from MemoryRangeObjects import * +import logging +import csv + +def ParseFileToBytes(fileName): + file = open(fileName, "rb") + d = memoryview(file.read()) + file.close() + return d.tolist() + + +def ParseInfoFile(fileName): + logging.debug("-- Processing file '%s'..." % fileName) + MemoryRanges = [] + with open(fileName, "r") as file: + database_reader = csv.reader(file) + for row in database_reader: + MemoryRanges.append(MemoryRange(row[0], *row[1:])) + logging.debug("%d entries found in file %s" % (len(MemoryRanges), fileName)) + return MemoryRanges + + +def Parse4kPages(fileName, addressbits): + num = 0 + pages = [] + logging.debug("-- Processing file '%s'..." % fileName) + ByteArray = ParseFileToBytes(fileName) + byteZeroIndex = 0 + while (byteZeroIndex + 7) < len(ByteArray): + if 0 == (ByteArray[byteZeroIndex + 0] + ByteArray[byteZeroIndex + 1] + ByteArray[byteZeroIndex + 2] + ByteArray[byteZeroIndex + 3] + ByteArray[byteZeroIndex + 4] + ByteArray[byteZeroIndex + 5] + ByteArray[byteZeroIndex + 6] + ByteArray[byteZeroIndex + 7]): + byteZeroIndex += 8 + continue + Present = ((ByteArray[byteZeroIndex + 0] & 0x1)) + ReadWrite = ((ByteArray[byteZeroIndex + 0] & 0x2) >> 1) + User = ((ByteArray[byteZeroIndex + 0] & 0x4) >> 2) + # PageTableBaseAddress is 40 bits long + PageTableBaseAddress = (((((ByteArray[byteZeroIndex + 1] & 0xF0) >> 4)) + (ByteArray[byteZeroIndex + 2] << 4) + (ByteArray[byteZeroIndex + 3] << 12) + (ByteArray[byteZeroIndex + 4] << 20) + (ByteArray[byteZeroIndex + 5] << 28) + ((ByteArray[byteZeroIndex + 6] & 0xF) << 36) << 12) & addressbits) + Nx = ((ByteArray[byteZeroIndex + 7] & 0x80) >> 7) + + byteZeroIndex += 8 + num += 1 + pages.append(MemoryRange("PTEntry", "4k", Present, ReadWrite, Nx, 1, User, (PageTableBaseAddress))) + logging.debug("%d entries found in file %s" % (num, fileName)) + return pages + + +def Parse2mPages(fileName, addressbits): + num = 0 + pages = [] + logging.debug("-- Processing file '%s'..." % fileName) + ByteArray = ParseFileToBytes(fileName) + byteZeroIndex = 0 + while (byteZeroIndex + 7) < len(ByteArray): + if 0 == (ByteArray[byteZeroIndex + 0] + ByteArray[byteZeroIndex + 1] + ByteArray[byteZeroIndex + 2] + ByteArray[byteZeroIndex + 3] + ByteArray[byteZeroIndex + 4] + ByteArray[byteZeroIndex + 5] + ByteArray[byteZeroIndex + 6] + ByteArray[byteZeroIndex + 7]): + byteZeroIndex += 8 + continue + Present = ((ByteArray[byteZeroIndex + 0] & 0x1) >> 0) + ReadWrite = ((ByteArray[byteZeroIndex + 0] & 0x2) >> 1) + MustBe1 = ((ByteArray[byteZeroIndex + 0] & 0x80) >> 7) + User = ((ByteArray[byteZeroIndex + 0] & 0x4) >> 2) + # PageTableBaseAddress is 31 bits long + PageTableBaseAddress = (((((ByteArray[byteZeroIndex + 2] & 0xE0) >> 5)) + (ByteArray[byteZeroIndex + 3] << 3) + (ByteArray[byteZeroIndex + 4] << 11) + (ByteArray[byteZeroIndex + 5] << 19) + ((ByteArray[byteZeroIndex + 6] & 0xF) << 27) << 21) & addressbits) + Nx = ((ByteArray[byteZeroIndex + 7] & 0x80) >> 7) + + byteZeroIndex += 8 + num += 1 + pages.append(MemoryRange("PTEntry", "2m", Present, ReadWrite, Nx, MustBe1, User, (PageTableBaseAddress))) + logging.debug("%d entries found in file %s" % (num, fileName)) + return pages + + +def Parse1gPages(fileName, addressbits): + num = 0 + pages = [] + logging.debug("-- Processing file '%s'..." % fileName) + ByteArray = ParseFileToBytes(fileName) + byteZeroIndex = 0 + while (byteZeroIndex + 7) < len(ByteArray): + if 0 == (ByteArray[byteZeroIndex + 0] + ByteArray[byteZeroIndex + 1] + ByteArray[byteZeroIndex + 2] + ByteArray[byteZeroIndex + 3] + ByteArray[byteZeroIndex + 4] + ByteArray[byteZeroIndex + 5] + ByteArray[byteZeroIndex + 6] + ByteArray[byteZeroIndex + 7]): + byteZeroIndex += 8 + continue + Present = ((ByteArray[byteZeroIndex + 0] & 0x1)) + ReadWrite = ((ByteArray[byteZeroIndex + 0] & 0x2) >> 1) + MustBe1 = ((ByteArray[byteZeroIndex + 0] & 0x80) >> 7) + User = ((ByteArray[byteZeroIndex + 0] & 0x4) >> 2) + # PageTableBaseAddress is 22 bits long + PageTableBaseAddress = (((((ByteArray[byteZeroIndex + 3] & 0xC0) >> 6)) + (ByteArray[byteZeroIndex + 4] << 2) + (ByteArray[byteZeroIndex + 5] << 10) + ((ByteArray[byteZeroIndex + 6] & 0xF) << 18) << 30) & addressbits) # shift and address bits + Nx = ((ByteArray[byteZeroIndex + 7] & 0x80) >> 7) + + byteZeroIndex += 8 + pages.append(MemoryRange("PTEntry", "1g", Present, ReadWrite, Nx, MustBe1, User, PageTableBaseAddress)) + num += 1 + logging.debug("%d entries found in file %s" % (num, fileName)) return pages \ No newline at end of file diff --git a/UefiTestingPkg/AuditTests/PagingAudit/Windows/DxePaging_template.html b/UefiTestingPkg/AuditTests/PagingAudit/Windows/DxePaging_template.html index 29f518f578..6612a72a3b 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/Windows/DxePaging_template.html +++ b/UefiTestingPkg/AuditTests/PagingAudit/Windows/DxePaging_template.html @@ -1,712 +1,712 @@ - - - - - - DXE Paging Analysis - - - - - - - -
-

DXE Paging Analysis

-
-
-
-

Platform Name:

-

Version:

-

Date Collected:

-
-
-
-

Test Results

-
-
-
-
-
-
Page Filter
-
- Page Size - -
-

-
- Present Attribute - -
-

-
- Execute Attribute - -
-

-
- Read/Write Attribute - -
-

-
- Privilege Level - -
-

-

- -

-
-
-
Memory Range Filter
-
- UEFI Memory Type - -
-

-
- GCD Memory Type - -
-

-
- Special Memory Regions - -
-

-
- Memory Contents - -
-

-
- Section Type - -
-

-

- -

-
-
-
Actions
- Filters: -

-
-
- - - - - - - - - - - - - - - - - - - - -
Base AddressEnd AddressPage Size# of PagesPresentRead/WriteExecutePrivilegeUEFI Memory TypeGCD Memory TypeSection TypeSpecial Memory UsageUEFI Memory Contents
-
-
-

Parsing Tool Errors

- - - - - - - - -
Error Msg
-
-
-
-
-

-

- DXE Paging Analysis Template Version: 1.00
- DXE Paging Analysis Tool Version:
-

-

License

-
-
-

- Copyright (C) Microsoft Corporation. All rights reserved.
- - All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

- - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
-

-
-
-
-

External Licenses

-
-
-
-
-
- - - - - - - - - - - - - - + + + + + + DXE Paging Analysis + + + + + + + +
+

DXE Paging Analysis

+ +
+
+

Platform Name:

+

Version:

+

Date Collected:

+
+
+
+

Test Results

+
+
+
+
+
+
Page Filter
+
+ Page Size + +
+

+
+ Present Attribute + +
+

+
+ Execute Attribute + +
+

+
+ Read/Write Attribute + +
+

+
+ Privilege Level + +
+

+

+ +

+
+
+
Memory Range Filter
+
+ UEFI Memory Type + +
+

+
+ GCD Memory Type + +
+

+
+ Special Memory Regions + +
+

+
+ Memory Contents + +
+

+
+ Section Type + +
+

+

+ +

+
+
+
Actions
+ Filters: +

+
+
+ + + + + + + + + + + + + + + + + + + + +
Base AddressEnd AddressPage Size# of PagesPresentRead/WriteExecutePrivilegeUEFI Memory TypeGCD Memory TypeSection TypeSpecial Memory UsageUEFI Memory Contents
+
+
+

Parsing Tool Errors

+ + + + + + + + +
Error Msg
+
+
+
+
+

+

+ DXE Paging Analysis Template Version: 1.00
+ DXE Paging Analysis Tool Version:
+

+

License

+
+
+

+ Copyright (C) Microsoft Corporation. All rights reserved.
+ + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

+ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +
+

+
+
+
+

External Licenses

+
+
+
+
+
+ + + + + + + + + + + + + + diff --git a/UefiTestingPkg/AuditTests/PagingAudit/Windows/MemoryRangeObjects.py b/UefiTestingPkg/AuditTests/PagingAudit/Windows/MemoryRangeObjects.py index fb597fb9a1..443bad44c8 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/Windows/MemoryRangeObjects.py +++ b/UefiTestingPkg/AuditTests/PagingAudit/Windows/MemoryRangeObjects.py @@ -1,363 +1,363 @@ -import copy -import logging - -# Memory range is either a page table entry, memory map entry, -# or a description of the memory contents. -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -class MemoryRange(object): - # MemmoryMap type list - MemoryMapTypes = [ - "EfiReservedMemoryType", - "EfiLoaderCode", - "EfiLoaderData", - "EfiBootServicesCode", - "EfiBootServicesData", - "EfiRuntimeServicesCode", - "EfiRuntimeServicesData", - "EfiConventionalMemory", - "EfiUnusableMemory", - "EfiACPIReclaimMemory", - "EfiACPIMemoryNVS", - "EfiMemoryMappedIO", - "EfiMemoryMappedIOPortSpace", - "EfiPalCode", - "EfiPersistentMemory", - "EfiMaxMemoryType" - ] - - MemorySpaceTypes = [ - "EfiGcdMemoryTypeNonExistent", - "EfiGcdMemoryTypeReserved", - "EfiGcdMemoryTypeSystemMemory", - "EfiGcdMemoryTypeMemoryMappedIo", - "EfiGcdMemoryTypePersistent", - "EfiGcdMemoryTypePersistentMemory", - "EfiGcdMemoryTypeMoreReliable", - "EfiGcdMemoryTypeMaximum" - ] - - # Definitions from Uefi\UefiSpec.h - MemoryAttributes = { - 0x0000000000000001 : "EFI_MEMORY_UC", - 0x0000000000000002 : "EFI_MEMORY_WC", - 0x0000000000000004 : "EFI_MEMORY_WT", - 0x0000000000000008 : "EFI_MEMORY_WB", - 0x0000000000000010 : "EFI_MEMORY_UCE", - 0x0000000000001000 : "EFI_MEMORY_WP", - 0x0000000000002000 : "EFI_MEMORY_RP", - 0x0000000000004000 : "EFI_MEMORY_XP", - 0x0000000000020000 : "EFI_MEMORY_RO", - 0x0000000000008000 : "EFI_MEMORY_NV", - 0x8000000000000000 : "EFI_MEMORY_RUNTIME", - 0x0000000000010000 : "EFI_MEMORY_MORE_RELIABLE" - } - - - SystemMemoryTypes = [ - "TSEG", - "GuardPage" - ] - - PageSize = { - "1g" : 1 * 1024 * 1024 * 1024, - "2m" : 2 * 1024 * 1024, - "4k" : 4 * 1024, - } - - TsegEfiMemoryType = 16 - NoneGcdMemoryType = 7 - - @staticmethod - def attributes_to_flags(attributes): - # Walk through each of the attribute bit masks defined in MemoryAttributes. - # If one of them is set in the attributes parameter, add the textual representation - # to a list and return it. - return [MemoryRange.MemoryAttributes[attr] for attr in MemoryRange.MemoryAttributes if (attributes & attr) > 0] - - - def __init__(self, record_type, *args, **kwargs): - self.RecordType = record_type - self.MemoryType = None - self.GcdType = None - self.SystemMemoryType = None - self.MustBe1 = None - self.UserPrivilege = None - self.ImageName = None - self.NumberOfEntries = 1 - self.Found = False - self.Attribute = 0 - self.AddressBitwidth = None - self.PageSplit = False - - # Check to see whether we're a type that we recognize. - if self.RecordType not in ("TSEG", "MemoryMap", "LoadedImage", "SmmLoadedImage", "PDE", "GDT", "IDT", "PTEntry", "MAT", "GuardPage", "Bitwidth"): - raise RuntimeError("Unknown type '%s' found!" % self.RecordType) - - # Continue processing according to the data type. - if self.RecordType in ("LoadedImage", "SmmLoadedImage"): - self.LoadedImageEntryInit(int(args[0], 16), int(args[1], 16), args[2]) - elif self.RecordType in ("MemoryMap", "TSEG", "MAT"): - self.MemoryMapEntryInit(*(int(arg, 16) for arg in args)) - elif self.RecordType in ("PDE", "GDT", "IDT"): - self.LoadedImageEntryInit(int(args[0], 16), int(args[1], 16), self.RecordType) - elif self.RecordType in ("PTEntry"): - self.PteInit(*args) - elif self.RecordType in ("GuardPage"): - self.GuardPageInit(*args) - elif self.RecordType in ("Bitwidth"): - self.BitwidthInit(int(args[0], 16)) - - self.CalculateEnd() - - def CalculateEnd(self): - self.PhysicalEnd = self.PhysicalStart + self.PhysicalSize - 1 - - def GetMemoryTypeDescription(self): - if self.MemoryType is None: - return "None" - else: - try: return MemoryRange.MemoryMapTypes[self.MemoryType] - except: raise Exception("Memory type is invalid") - - def GetGcdTypeDescription(self): - if self.GcdType is None: - return "None" - else: - try: return MemoryRange.MemorySpaceTypes[self.GcdType] - except: raise Exception("Gcd type is invalid") - - def GetSystemMemoryType(self): - if self.SystemMemoryType is None: - return "None" - try: - return MemoryRange.SystemMemoryTypes[self.SystemMemoryType] - except: - raise Exception("System Memory Type is invalid %d" % self.SystemMemoryType) - - - # - # Initializes memory descriptions - # - def MemoryMapEntryInit(self, Type, PhysicalStart, VirtualStart, NumberOfPages, Attribute, GcdType): - if(Type < 16): - self.MemoryType = Type - if (Type == self.TsegEfiMemoryType): - #set it as tseg - self.SystemMemoryType = 0 - self.PhysicalStart = PhysicalStart - self.VirtualStart = VirtualStart - self.PhysicalSize = NumberOfPages * 4 * 1024 - self.Attribute = Attribute - self.NumberOfPages = NumberOfPages - if (GcdType < self.NoneGcdMemoryType): - self.GcdType = GcdType - - def MemoryRangeToString(self): - return """\n Memory Map Entry ------------------------------------------------------------------- - Type : %s - PhysicalStart : 0x%010X - PhysicalEnd : 0x%010X - VirtualStart : 0x%010X - NumberOfPages : 0x%010X - Attribute : 0x%010X - PhysicalSize : 0x%010X - GcdType : 0x%010X -""" % (self.GetMemoryTypeDescription(), self.PhysicalStart, self.PhysicalEnd, self.VirtualStart, self.NumberOfPages, self.Attribute, self.PhysicalSize, self.GcdType) - - # - # intitalizes memory contents description - # - def LoadedImageEntryInit(self, Base, Size, Name): - self.PhysicalStart = Base - self.PhysicalSize = Size - self.ImageName = Name - def LoadedImageEntryToString(self): - return """\n Loaded Image ------------------------------------------------------------------- - PhysicalStart : 0x%010X - PhysicalEnd : 0x%010X - PhysicalSize : 0x%010X - Name : %s -""" % (self.PhysicalStart, (self.PhysicalEnd), self.PhysicalSize, self.ImageName) - - def GuardPageInit(self, VA): - self.SystemMemoryType = 1 - self.PhysicalStart = int(VA, 16) - self.PageSize = "4k" - self.PhysicalSize = self.getPageSize() - self.ReadWrite = 0 - self.UserPrivilege = 1 - self.Nx = 0 - self.Present = 0 - - def BitwidthInit(self, Bitwidth): - self.AddressBitwidth = Bitwidth - self.PhysicalStart = 0 - self.PhysicalSize = (1 << self.AddressBitwidth) - - # - # Initializes page table entries - # - def PteInit(self, PageSize, Present, ReadWrite, Nx, MustBe1, User, VA): - self.MustBe1 = MustBe1 - self.PageSize = PageSize if self.MustBe1 == 1 else "pde" - self.PhysicalStart = VA - self.ReadWrite = ReadWrite - self.Nx = Nx - self.UserPrivilege = User - self.PhysicalSize = self.getPageSize() - self.Present = Present - if (self.PageSize == "4k") and (self.MustBe1 == 0): - raise Exception("Data error: 4K pages must have MustBe1 be set to 1") - def pteDebugStr(self): - return """\n %s ------------------------------------------------------------------- - MustBe1 : 0x%010X - Present : 0x%010X - ReadWrite : 0x%010X - Nx : 0x%010X - PhysicalStart : 0x%010X - PhysicalEnd : 0x%010X - PhysicalSize : 0x%010X - Number : 0x%010X - Type : %s - LoadedImage : %s -""" % (self.getPageSizeStr(), self.MustBe1, self.Present, self.ReadWrite, self.Nx, self.PhysicalStart, self.PhysicalEnd, self.PhysicalSize, self.NumberOfEntries, self.GetMemoryTypeDescription(), self.ImageName ) - - def getPageSize(self): - return MemoryRange.PageSize[self.PageSize] - - def getPageSizeStr(self): - return self.PageSize - - # Used to combine two page table entries with the same attributes - def grow(self, other): - self.NumberOfEntries += other.NumberOfEntries - self.PhysicalSize += other.PhysicalSize - self.CalculateEnd() - - # Returns dict describing this object - def toDictionary(self): - # Pre-process the Section Type - # Set a reasonable default. - section_type = "UNEXPECTED VALUE" - # If this range is not associated with an image, it does not have - # a section type. - if self.ImageName == None: - section_type = "Not Tracked" - else: - # if an image range can't be read or executed, this is almost certainly - # an error. - if self.Nx == 1 and self.ReadWrite == 0: - section_type = "ERROR" - elif self.Nx == 1: - section_type = "DATA" - elif self.ReadWrite == 0: - section_type = "CODE" - - return { - "Page Size" : self.getPageSizeStr(), - "Present" : "Yes" if (self.Present == 1) else "No", - "Read/Write" : "Enabled" if (self.ReadWrite == 1) else "Disabled", - "Execute" : "Disabled" if (self.Nx == 1) else "Enabled", - "Privilege" : "User" if (self.UserPrivilege == 1) else "Supervisor", - "Start" : "0x{0:010X}".format(self.PhysicalStart), - "End" : "0x{0:010X}".format(self.PhysicalEnd), - "Number of Entries" : self.NumberOfEntries if (not self.PageSplit) else str(self.NumberOfEntries) + " (p)" , - "Memory Type" : self.GetMemoryTypeDescription(), - "GCD Memory Type" : self.GetGcdTypeDescription(), - "Section Type" : section_type, - "System Memory": self.GetSystemMemoryType(), - "Memory Contents" : self.ImageName, - "Partial Page": self.PageSplit} - - def overlap(self, compare): - if(self.PhysicalStart >= compare.PhysicalStart) and (self.PhysicalStart <= compare.PhysicalEnd): - return True - - if(compare.PhysicalStart >= self.PhysicalStart) and (compare.PhysicalStart <= self.PhysicalEnd): - return True - - return False - - def eq(self, compare): - if (self.PhysicalStart == compare.PhysicalStart) and (self.PhysicalEnd == compare.PhysicalEnd): - return True - - return False - - def split(self, end_of_current): - ''' split the memory range object into two and copy - all attributes to the new object. - end_of_current = physical end of the first object. - - modify self - return - ''' - if end_of_current is None: - raise Exception("Failed Split - Invalid parameter. end_of_current can not be none") - - if end_of_current <= self.PhysicalStart: - raise Exception("Failed Split - Invalid parameter. end_of_current can not be <= start. " + - f"self.PhysicalStart = {self.PhysicalStart} " + - f"end_of_current = {end_of_current}" ) - - if end_of_current >= self.PhysicalEnd: - raise Exception("Failed Split - Invalid parameter. end_of_current can not be >= end" + - f"self.PhysicalEnd = {self.PhysicalEnd} " + - f"end_of_current = {end_of_current}" ) - - self.PageSplit = True - next = copy.deepcopy(self) - self.PhysicalEnd = end_of_current - next.PhysicalStart = end_of_current +1 - return next - - def sameAttributes(self, compare): - if compare is None: - return False - - if not (((self.PhysicalEnd + 1) == compare.PhysicalStart) or ((compare.PhysicalEnd + 1) == self.PhysicalStart)): - return False - - if (self.PageSize != compare.PageSize): - return False - - if (self.ReadWrite != compare.ReadWrite): - return False - - if (self.MustBe1 != compare.MustBe1): - return False - - if (self.Present != compare.Present): - return False - - if (self.Nx != compare.Nx): - return False - - if(self.UserPrivilege != compare.UserPrivilege): - return False - - if (self.ImageName != compare.ImageName): - return False - - if (self.MemoryType != compare.MemoryType): - return False - - if (self.GcdType != compare.GcdType): - return False - - if (self.SystemMemoryType != compare.SystemMemoryType): - return False - - if (self.Attribute != compare.Attribute): - return False - - if (self.PageSplit or compare.PageSplit): - return False - +import copy +import logging + +# Memory range is either a page table entry, memory map entry, +# or a description of the memory contents. +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +class MemoryRange(object): + # MemmoryMap type list + MemoryMapTypes = [ + "EfiReservedMemoryType", + "EfiLoaderCode", + "EfiLoaderData", + "EfiBootServicesCode", + "EfiBootServicesData", + "EfiRuntimeServicesCode", + "EfiRuntimeServicesData", + "EfiConventionalMemory", + "EfiUnusableMemory", + "EfiACPIReclaimMemory", + "EfiACPIMemoryNVS", + "EfiMemoryMappedIO", + "EfiMemoryMappedIOPortSpace", + "EfiPalCode", + "EfiPersistentMemory", + "EfiMaxMemoryType" + ] + + MemorySpaceTypes = [ + "EfiGcdMemoryTypeNonExistent", + "EfiGcdMemoryTypeReserved", + "EfiGcdMemoryTypeSystemMemory", + "EfiGcdMemoryTypeMemoryMappedIo", + "EfiGcdMemoryTypePersistent", + "EfiGcdMemoryTypePersistentMemory", + "EfiGcdMemoryTypeMoreReliable", + "EfiGcdMemoryTypeMaximum" + ] + + # Definitions from Uefi\UefiSpec.h + MemoryAttributes = { + 0x0000000000000001 : "EFI_MEMORY_UC", + 0x0000000000000002 : "EFI_MEMORY_WC", + 0x0000000000000004 : "EFI_MEMORY_WT", + 0x0000000000000008 : "EFI_MEMORY_WB", + 0x0000000000000010 : "EFI_MEMORY_UCE", + 0x0000000000001000 : "EFI_MEMORY_WP", + 0x0000000000002000 : "EFI_MEMORY_RP", + 0x0000000000004000 : "EFI_MEMORY_XP", + 0x0000000000020000 : "EFI_MEMORY_RO", + 0x0000000000008000 : "EFI_MEMORY_NV", + 0x8000000000000000 : "EFI_MEMORY_RUNTIME", + 0x0000000000010000 : "EFI_MEMORY_MORE_RELIABLE" + } + + + SystemMemoryTypes = [ + "TSEG", + "GuardPage" + ] + + PageSize = { + "1g" : 1 * 1024 * 1024 * 1024, + "2m" : 2 * 1024 * 1024, + "4k" : 4 * 1024, + } + + TsegEfiMemoryType = 16 + NoneGcdMemoryType = 7 + + @staticmethod + def attributes_to_flags(attributes): + # Walk through each of the attribute bit masks defined in MemoryAttributes. + # If one of them is set in the attributes parameter, add the textual representation + # to a list and return it. + return [MemoryRange.MemoryAttributes[attr] for attr in MemoryRange.MemoryAttributes if (attributes & attr) > 0] + + + def __init__(self, record_type, *args, **kwargs): + self.RecordType = record_type + self.MemoryType = None + self.GcdType = None + self.SystemMemoryType = None + self.MustBe1 = None + self.UserPrivilege = None + self.ImageName = None + self.NumberOfEntries = 1 + self.Found = False + self.Attribute = 0 + self.AddressBitwidth = None + self.PageSplit = False + + # Check to see whether we're a type that we recognize. + if self.RecordType not in ("TSEG", "MemoryMap", "LoadedImage", "SmmLoadedImage", "PDE", "GDT", "IDT", "PTEntry", "MAT", "GuardPage", "Bitwidth"): + raise RuntimeError("Unknown type '%s' found!" % self.RecordType) + + # Continue processing according to the data type. + if self.RecordType in ("LoadedImage", "SmmLoadedImage"): + self.LoadedImageEntryInit(int(args[0], 16), int(args[1], 16), args[2]) + elif self.RecordType in ("MemoryMap", "TSEG", "MAT"): + self.MemoryMapEntryInit(*(int(arg, 16) for arg in args)) + elif self.RecordType in ("PDE", "GDT", "IDT"): + self.LoadedImageEntryInit(int(args[0], 16), int(args[1], 16), self.RecordType) + elif self.RecordType in ("PTEntry"): + self.PteInit(*args) + elif self.RecordType in ("GuardPage"): + self.GuardPageInit(*args) + elif self.RecordType in ("Bitwidth"): + self.BitwidthInit(int(args[0], 16)) + + self.CalculateEnd() + + def CalculateEnd(self): + self.PhysicalEnd = self.PhysicalStart + self.PhysicalSize - 1 + + def GetMemoryTypeDescription(self): + if self.MemoryType is None: + return "None" + else: + try: return MemoryRange.MemoryMapTypes[self.MemoryType] + except: raise Exception("Memory type is invalid") + + def GetGcdTypeDescription(self): + if self.GcdType is None: + return "None" + else: + try: return MemoryRange.MemorySpaceTypes[self.GcdType] + except: raise Exception("Gcd type is invalid") + + def GetSystemMemoryType(self): + if self.SystemMemoryType is None: + return "None" + try: + return MemoryRange.SystemMemoryTypes[self.SystemMemoryType] + except: + raise Exception("System Memory Type is invalid %d" % self.SystemMemoryType) + + + # + # Initializes memory descriptions + # + def MemoryMapEntryInit(self, Type, PhysicalStart, VirtualStart, NumberOfPages, Attribute, GcdType): + if(Type < 16): + self.MemoryType = Type + if (Type == self.TsegEfiMemoryType): + #set it as tseg + self.SystemMemoryType = 0 + self.PhysicalStart = PhysicalStart + self.VirtualStart = VirtualStart + self.PhysicalSize = NumberOfPages * 4 * 1024 + self.Attribute = Attribute + self.NumberOfPages = NumberOfPages + if (GcdType < self.NoneGcdMemoryType): + self.GcdType = GcdType + + def MemoryRangeToString(self): + return """\n Memory Map Entry +------------------------------------------------------------------ + Type : %s + PhysicalStart : 0x%010X + PhysicalEnd : 0x%010X + VirtualStart : 0x%010X + NumberOfPages : 0x%010X + Attribute : 0x%010X + PhysicalSize : 0x%010X + GcdType : 0x%010X +""" % (self.GetMemoryTypeDescription(), self.PhysicalStart, self.PhysicalEnd, self.VirtualStart, self.NumberOfPages, self.Attribute, self.PhysicalSize, self.GcdType) + + # + # intitalizes memory contents description + # + def LoadedImageEntryInit(self, Base, Size, Name): + self.PhysicalStart = Base + self.PhysicalSize = Size + self.ImageName = Name + def LoadedImageEntryToString(self): + return """\n Loaded Image +------------------------------------------------------------------ + PhysicalStart : 0x%010X + PhysicalEnd : 0x%010X + PhysicalSize : 0x%010X + Name : %s +""" % (self.PhysicalStart, (self.PhysicalEnd), self.PhysicalSize, self.ImageName) + + def GuardPageInit(self, VA): + self.SystemMemoryType = 1 + self.PhysicalStart = int(VA, 16) + self.PageSize = "4k" + self.PhysicalSize = self.getPageSize() + self.ReadWrite = 0 + self.UserPrivilege = 1 + self.Nx = 0 + self.Present = 0 + + def BitwidthInit(self, Bitwidth): + self.AddressBitwidth = Bitwidth + self.PhysicalStart = 0 + self.PhysicalSize = (1 << self.AddressBitwidth) + + # + # Initializes page table entries + # + def PteInit(self, PageSize, Present, ReadWrite, Nx, MustBe1, User, VA): + self.MustBe1 = MustBe1 + self.PageSize = PageSize if self.MustBe1 == 1 else "pde" + self.PhysicalStart = VA + self.ReadWrite = ReadWrite + self.Nx = Nx + self.UserPrivilege = User + self.PhysicalSize = self.getPageSize() + self.Present = Present + if (self.PageSize == "4k") and (self.MustBe1 == 0): + raise Exception("Data error: 4K pages must have MustBe1 be set to 1") + def pteDebugStr(self): + return """\n %s +------------------------------------------------------------------ + MustBe1 : 0x%010X + Present : 0x%010X + ReadWrite : 0x%010X + Nx : 0x%010X + PhysicalStart : 0x%010X + PhysicalEnd : 0x%010X + PhysicalSize : 0x%010X + Number : 0x%010X + Type : %s + LoadedImage : %s +""" % (self.getPageSizeStr(), self.MustBe1, self.Present, self.ReadWrite, self.Nx, self.PhysicalStart, self.PhysicalEnd, self.PhysicalSize, self.NumberOfEntries, self.GetMemoryTypeDescription(), self.ImageName ) + + def getPageSize(self): + return MemoryRange.PageSize[self.PageSize] + + def getPageSizeStr(self): + return self.PageSize + + # Used to combine two page table entries with the same attributes + def grow(self, other): + self.NumberOfEntries += other.NumberOfEntries + self.PhysicalSize += other.PhysicalSize + self.CalculateEnd() + + # Returns dict describing this object + def toDictionary(self): + # Pre-process the Section Type + # Set a reasonable default. + section_type = "UNEXPECTED VALUE" + # If this range is not associated with an image, it does not have + # a section type. + if self.ImageName == None: + section_type = "Not Tracked" + else: + # if an image range can't be read or executed, this is almost certainly + # an error. + if self.Nx == 1 and self.ReadWrite == 0: + section_type = "ERROR" + elif self.Nx == 1: + section_type = "DATA" + elif self.ReadWrite == 0: + section_type = "CODE" + + return { + "Page Size" : self.getPageSizeStr(), + "Present" : "Yes" if (self.Present == 1) else "No", + "Read/Write" : "Enabled" if (self.ReadWrite == 1) else "Disabled", + "Execute" : "Disabled" if (self.Nx == 1) else "Enabled", + "Privilege" : "User" if (self.UserPrivilege == 1) else "Supervisor", + "Start" : "0x{0:010X}".format(self.PhysicalStart), + "End" : "0x{0:010X}".format(self.PhysicalEnd), + "Number of Entries" : self.NumberOfEntries if (not self.PageSplit) else str(self.NumberOfEntries) + " (p)" , + "Memory Type" : self.GetMemoryTypeDescription(), + "GCD Memory Type" : self.GetGcdTypeDescription(), + "Section Type" : section_type, + "System Memory": self.GetSystemMemoryType(), + "Memory Contents" : self.ImageName, + "Partial Page": self.PageSplit} + + def overlap(self, compare): + if(self.PhysicalStart >= compare.PhysicalStart) and (self.PhysicalStart <= compare.PhysicalEnd): + return True + + if(compare.PhysicalStart >= self.PhysicalStart) and (compare.PhysicalStart <= self.PhysicalEnd): + return True + + return False + + def eq(self, compare): + if (self.PhysicalStart == compare.PhysicalStart) and (self.PhysicalEnd == compare.PhysicalEnd): + return True + + return False + + def split(self, end_of_current): + ''' split the memory range object into two and copy + all attributes to the new object. + end_of_current = physical end of the first object. + + modify self + return + ''' + if end_of_current is None: + raise Exception("Failed Split - Invalid parameter. end_of_current can not be none") + + if end_of_current <= self.PhysicalStart: + raise Exception("Failed Split - Invalid parameter. end_of_current can not be <= start. " + + f"self.PhysicalStart = {self.PhysicalStart} " + + f"end_of_current = {end_of_current}" ) + + if end_of_current >= self.PhysicalEnd: + raise Exception("Failed Split - Invalid parameter. end_of_current can not be >= end" + + f"self.PhysicalEnd = {self.PhysicalEnd} " + + f"end_of_current = {end_of_current}" ) + + self.PageSplit = True + next = copy.deepcopy(self) + self.PhysicalEnd = end_of_current + next.PhysicalStart = end_of_current +1 + return next + + def sameAttributes(self, compare): + if compare is None: + return False + + if not (((self.PhysicalEnd + 1) == compare.PhysicalStart) or ((compare.PhysicalEnd + 1) == self.PhysicalStart)): + return False + + if (self.PageSize != compare.PageSize): + return False + + if (self.ReadWrite != compare.ReadWrite): + return False + + if (self.MustBe1 != compare.MustBe1): + return False + + if (self.Present != compare.Present): + return False + + if (self.Nx != compare.Nx): + return False + + if(self.UserPrivilege != compare.UserPrivilege): + return False + + if (self.ImageName != compare.ImageName): + return False + + if (self.MemoryType != compare.MemoryType): + return False + + if (self.GcdType != compare.GcdType): + return False + + if (self.SystemMemoryType != compare.SystemMemoryType): + return False + + if (self.Attribute != compare.Attribute): + return False + + if (self.PageSplit or compare.PageSplit): + return False + return True \ No newline at end of file diff --git a/UefiTestingPkg/AuditTests/PagingAudit/Windows/PagingReportGenerator.py b/UefiTestingPkg/AuditTests/PagingAudit/Windows/PagingReportGenerator.py index 8ca40b9b61..1d0cd84c4e 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/Windows/PagingReportGenerator.py +++ b/UefiTestingPkg/AuditTests/PagingAudit/Windows/PagingReportGenerator.py @@ -1,295 +1,295 @@ -# Collects files from UEFI app, parses them, and generates a HTML report -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -import logging -import operator -import glob -import json -import datetime -import os -import sys -import argparse - -#Add script dir to path for import -sp = os.path.dirname(os.path.realpath(sys.argv[0])) -sys.path.append(sp) - -from MemoryRangeObjects import * -from BinaryParsing import * - - -VERSION = "0.90" - - -class ParsingTool(object): - - def __init__(self, DatFolderPath, PlatformName, PlatformVersion, Type): - self.Logger = logging.getLogger("ParsingTool") - self.MemoryAttributesTable = [] - self.MemoryRangeInfo = [] - self.PageDirectoryInfo = [] - self.DatFolderPath = DatFolderPath - self.ErrorMsg = [] - self.PlatformName = PlatformName - self.PlatformVersion = PlatformVersion - self.Type = Type - self.AddressBits = 0 - - def Parse(self): - #Get Info Files - InfoFileList = glob.glob(os.path.join(self.DatFolderPath, "*MemoryInfo*.dat")) - Pte1gbFileList = glob.glob(os.path.join(self.DatFolderPath, "*1G*.dat")) - Pte2mbFileList = glob.glob(os.path.join(self.DatFolderPath, "*2M*.dat")) - Pte4kbFileList = glob.glob(os.path.join(self.DatFolderPath, "*4K*.dat")) - MatFileList = glob.glob(os.path.join(self.DatFolderPath, "*MAT*.dat")) - GuardPageFileList = glob.glob(os.path.join(self.DatFolderPath, "*GuardPage*.dat")) - - logging.debug("Found %d Info Files" % len(InfoFileList)) - logging.debug("Found %d 1gb Page Files" % len(Pte1gbFileList)) - logging.debug("Found %d 2mb Page Files" % len(Pte2mbFileList)) - logging.debug("Found %d 4kb Page Files" % len(Pte4kbFileList)) - logging.debug("Found %d MAT Files" % len(MatFileList)) - logging.debug("Found %d GuardPage Files" % len(GuardPageFileList)) - - - # Parse each file, keeping PTEs and "Memory Ranges" separate - # Memory ranges are either "memory descriptions" for memory map types and TSEG - # or "memory contents" for loaded image information or IDT/GDT - for info in InfoFileList: - self.MemoryRangeInfo.extend(ParseInfoFile(info)) - - for mr in self.MemoryRangeInfo: - if mr.AddressBitwidth is not None: - if self.AddressBits == 0: - self.AddressBits = (1 << mr.AddressBitwidth) - 1 - self.MemoryRangeInfo.remove(mr) - elif self.AddressBits != (1 << mr.AddressBitwidth) - 1: - self.ErrorMsg.append("Bitwidth discrepancy, %d and %d. Should not proceed with mixed bitwidth files in the same folder", self.AddressBits, (1 << mr.AddressBitwidth) - 1) - logging.error("Bitwidth discrepancy, %d and %d. Should not proceed with mixed bitwidth files in the same folder", self.AddressBits, (1 << mr.AddressBitwidth) - 1) - else: - self.MemoryRangeInfo.remove(mr) - - if self.AddressBits == 0: - self.ErrorMsg.append("Did not find bitwidth from memory information file. Assuming 39 here and the results may not be accurate") - self.AddressBits = (1 << 39) - 1 - - for pte1g in Pte1gbFileList: - self.PageDirectoryInfo.extend(Parse1gPages(pte1g, self.AddressBits)) - - for pte2m in Pte2mbFileList: - self.PageDirectoryInfo.extend(Parse2mPages(pte2m, self.AddressBits)) - - for pte4k in Pte4kbFileList: - self.PageDirectoryInfo.extend(Parse4kPages(pte4k, self.AddressBits)) - - for guardpage in GuardPageFileList: - self.PageDirectoryInfo.extend(ParseInfoFile(guardpage)) - - for mat in MatFileList: - self.MemoryAttributesTable.extend(ParseInfoFile(mat)) - - if len(self.PageDirectoryInfo) == 0: - self.ErrorMsg.append("No Memory Range info found in PTE files") - else: - # Sort in descending order - self.PageDirectoryInfo.sort(key=operator.attrgetter('PhysicalStart')) - #check for Page Table Overlap - this is an error - index =0 - maxindex = len(self.PageDirectoryInfo) -1 - while index < maxindex: #this will allow all comparisions to work - if(self.PageDirectoryInfo[index].overlap(self.PageDirectoryInfo[index+1])): - self.ErrorMsg.append("Page Table Entry Overlap. Index %d Overlapping %d at StartAddress 0x%X" % - (index, index+1, self.PageDirectoryInfo[index].PhysicalStart)) - logging.error("PTE overlap index %d and %d. Base Address = 0x%x", index, index+1, self.PageDirectoryInfo[index].PhysicalStart) - index += 1 - - if len(self.MemoryRangeInfo) == 0: - self.ErrorMsg.append("No Memory Range info found in Info files") - - # Matching memory ranges up to page table entries - # use index based iteration so that page splitting - # is supported. - index = 0 - while index < len(self.PageDirectoryInfo): - pte = self.PageDirectoryInfo[index] - for mr in self.MemoryRangeInfo: - if pte.overlap(mr): - if (mr.MemoryType is not None) or (mr.GcdType is not None): - if (pte.PhysicalStart < mr.PhysicalStart): - next = pte.split(mr.PhysicalStart-1) - self.PageDirectoryInfo.insert(index+1, next) - # decrement the index so that we process this partial PTE again - # because we are breaking from the MemoryRange Loop - index -= 1 - break - - if (pte.PhysicalEnd > mr.PhysicalEnd): - next = pte.split(mr.PhysicalEnd) - self.PageDirectoryInfo.insert(index +1, next) - - if pte.MemoryType is None: - pte.MemoryType = mr.MemoryType - else: - logging.error("Multiple memory types found for one region " + pte.pteDebugStr() +" " + mr.MemoryRangeToString()) - self.ErrorMsg.append("Multiple memory types found for one region. Base: 0x%X. EFI Memory Type: %d and %d"% (pte.PhysicalStart, pte.MemoryType,mr.MemoryType)) - - if pte.GcdType is None: - pte.GcdType = mr.GcdType - logging.info("pte.GcdType: %d"% (pte.GcdType)) - else: - logging.error("Multiple memory types found for one region " + pte.pteDebugStr() +" " + mr.MemoryRangeToString()) - self.ErrorMsg.append("Multiple memory types found for one region. Base: 0x%X. GCD Memory Type: %d and %d"% (pte.PhysicalStart, pte.GcdType,mr.GcdType)) - - if mr.ImageName is not None: - if pte.ImageName is None: - pte.ImageName = mr.ImageName - else: - self.ErrorMsg.append("Multiple memory contents found for one region. Base: 0x%X. Memory Contents: %s and %s" % (pte.PhysicalStart, pte.ImageName, mr.ImageName )) - logging.error("Multiple memory contents found for one region " +pte.pteDebugStr() + " " + mr.LoadedImageEntryToString()) - - if mr.SystemMemoryType is not None: - if pte.SystemMemoryType is None: - pte.SystemMemoryType = mr.SystemMemoryType - else: - self.ErrorMsg.append("Multiple System Memory types found for one region. Base: 0x%X. EFI Memory Type: %s and %s."% (pte.PhysicalStart,pte.SystemMemoryType, mr.SystemMemoryType)) - logging.error("Multiple system memory types found for one region " +pte.pteDebugStr() + " " + mr.LoadedImageEntryToString()) - - for MatEntry in self.MemoryAttributesTable: - if pte.overlap(MatEntry): - pte.Attribute = MatEntry.Attribute - index += 1 - - # Combining adjacent PTEs that have the same attributes. - index = 0 - while index < (len(self.PageDirectoryInfo) - 1): - currentPte = self.PageDirectoryInfo[index] - nextPte = self.PageDirectoryInfo[index + 1] - if currentPte.sameAttributes(nextPte): - currentPte.grow(nextPte) - del self.PageDirectoryInfo[index + 1] - else: - index += 1 - - return 0 - - def AddErrorMsg(self, msg): - self.ErrorMsg.append(msg) - - def OutputHtmlReport(self, ToolVersion, OutputFilePath): - # Create the dictionary to produce a JSON string. - json_dict = { - 'ToolVersion': ToolVersion, - 'PlatformVersion': self.PlatformVersion, - 'PlatformName': self.PlatformName, - 'DateCollected': datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" ), - } - - # Process all of the Page Infos and add them to the JSON. - pde_infos = [] - for pde in self.PageDirectoryInfo: - info_dict = pde.toDictionary() - # Check for errors. - if info_dict['Section Type'] == "ERROR": - self.AddErrorMsg("Page Descriptor at %s has an error parsing the Section Type." % info_dict['Start']) - pde_infos.append(info_dict) - json_dict['MemoryRanges'] = pde_infos - - # Finally, add any errors and produce the JSON string. - json_dict['errors'] = self.ErrorMsg - js = json.dumps(json_dict) - - # - # Open template and replace placeholder with json - # - f = open(OutputFilePath, "w") - if self.Type == 'DXE': - template = open(os.path.join(sp, "DxePaging_template.html"), "r") - else: - template = open(os.path.join(sp, "SmmPaging_template.html"), "r") - - for line in template.readlines(): - if "%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%" in line: - line = line.replace("%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%", js) - f.write(line) - template.close() - f.close() - return 0 - -# -# Parse and Validate Args. Then run the tool -# -def main(): - - parser = argparse.ArgumentParser(description='Parse Paging information and generate HTML report') - parser.add_argument('-i', "--InputFolderPath", dest="InputFolder", help="Path to folder containing the DAT files from the UEFI shell tool (default is CWD)", default=os.getcwd()) - parser.add_argument('-o', "--OutputReport", dest="OutputReport", help="Path to output html report (default is report.html)", default=os.path.join(os.getcwd(), "report.html")) - parser.add_argument('-p', "--PlatformName", dest="PlatformName", help="Name of Platform. Will show up on report", default="Test Platform") - parser.add_argument('-t', "--type", choices=['SMM', 'DXE'], dest="Type", help="SMM or DXE Paging Report", required=True) - parser.add_argument("--PlatformVersion", dest="PlatformVersion", help="Version of Platform. Will show up report", default="1.0.0") - - #Turn on dubug level logging - parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) - #Output debug log - parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) - - options = parser.parse_args() - - #setup file based logging if outputReport specified - if(options.OutputLog): - if(len(options.OutputLog) < 2): - logging.critical("the output log file parameter is invalid") - return -2 - else: - #setup file based logging - filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') - if(options.debug): - filelogger.setLevel(logging.DEBUG) - else: - filelogger.setLevel(logging.INFO) - - filelogger.setFormatter(formatter) - logging.getLogger('').addHandler(filelogger) - - logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) - - #Do parameter validation - if(options.InputFolder is None or not os.path.isdir(options.InputFolder)): - logging.critical("Invalid Input Folder Path to folder containing DAT files") - return -5 - - if(options.OutputReport is None): - logging.critical("No OutputReport Path") - return -6 - - logging.debug("Input Folder Path is: %s" % options.InputFolder) - logging.debug("Output Report is: %s" % options.OutputReport) - - spt = ParsingTool(options.InputFolder, options.PlatformName, options.PlatformVersion, options.Type) - spt.Parse() - return spt.OutputHtmlReport(VERSION, options.OutputReport) - -#-------------------------------- -# Control starts here -# -#-------------------------------- -if __name__ == '__main__': - #setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - #call main worker function - retcode = main() - - if retcode != 0: - logging.critical("Failed. Return Code: %i" % retcode) - #end logging - logging.shutdown() - sys.exit(retcode) +# Collects files from UEFI app, parses them, and generates a HTML report +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +import logging +import operator +import glob +import json +import datetime +import os +import sys +import argparse + +#Add script dir to path for import +sp = os.path.dirname(os.path.realpath(sys.argv[0])) +sys.path.append(sp) + +from MemoryRangeObjects import * +from BinaryParsing import * + + +VERSION = "0.90" + + +class ParsingTool(object): + + def __init__(self, DatFolderPath, PlatformName, PlatformVersion, Type): + self.Logger = logging.getLogger("ParsingTool") + self.MemoryAttributesTable = [] + self.MemoryRangeInfo = [] + self.PageDirectoryInfo = [] + self.DatFolderPath = DatFolderPath + self.ErrorMsg = [] + self.PlatformName = PlatformName + self.PlatformVersion = PlatformVersion + self.Type = Type + self.AddressBits = 0 + + def Parse(self): + #Get Info Files + InfoFileList = glob.glob(os.path.join(self.DatFolderPath, "*MemoryInfo*.dat")) + Pte1gbFileList = glob.glob(os.path.join(self.DatFolderPath, "*1G*.dat")) + Pte2mbFileList = glob.glob(os.path.join(self.DatFolderPath, "*2M*.dat")) + Pte4kbFileList = glob.glob(os.path.join(self.DatFolderPath, "*4K*.dat")) + MatFileList = glob.glob(os.path.join(self.DatFolderPath, "*MAT*.dat")) + GuardPageFileList = glob.glob(os.path.join(self.DatFolderPath, "*GuardPage*.dat")) + + logging.debug("Found %d Info Files" % len(InfoFileList)) + logging.debug("Found %d 1gb Page Files" % len(Pte1gbFileList)) + logging.debug("Found %d 2mb Page Files" % len(Pte2mbFileList)) + logging.debug("Found %d 4kb Page Files" % len(Pte4kbFileList)) + logging.debug("Found %d MAT Files" % len(MatFileList)) + logging.debug("Found %d GuardPage Files" % len(GuardPageFileList)) + + + # Parse each file, keeping PTEs and "Memory Ranges" separate + # Memory ranges are either "memory descriptions" for memory map types and TSEG + # or "memory contents" for loaded image information or IDT/GDT + for info in InfoFileList: + self.MemoryRangeInfo.extend(ParseInfoFile(info)) + + for mr in self.MemoryRangeInfo: + if mr.AddressBitwidth is not None: + if self.AddressBits == 0: + self.AddressBits = (1 << mr.AddressBitwidth) - 1 + self.MemoryRangeInfo.remove(mr) + elif self.AddressBits != (1 << mr.AddressBitwidth) - 1: + self.ErrorMsg.append("Bitwidth discrepancy, %d and %d. Should not proceed with mixed bitwidth files in the same folder", self.AddressBits, (1 << mr.AddressBitwidth) - 1) + logging.error("Bitwidth discrepancy, %d and %d. Should not proceed with mixed bitwidth files in the same folder", self.AddressBits, (1 << mr.AddressBitwidth) - 1) + else: + self.MemoryRangeInfo.remove(mr) + + if self.AddressBits == 0: + self.ErrorMsg.append("Did not find bitwidth from memory information file. Assuming 39 here and the results may not be accurate") + self.AddressBits = (1 << 39) - 1 + + for pte1g in Pte1gbFileList: + self.PageDirectoryInfo.extend(Parse1gPages(pte1g, self.AddressBits)) + + for pte2m in Pte2mbFileList: + self.PageDirectoryInfo.extend(Parse2mPages(pte2m, self.AddressBits)) + + for pte4k in Pte4kbFileList: + self.PageDirectoryInfo.extend(Parse4kPages(pte4k, self.AddressBits)) + + for guardpage in GuardPageFileList: + self.PageDirectoryInfo.extend(ParseInfoFile(guardpage)) + + for mat in MatFileList: + self.MemoryAttributesTable.extend(ParseInfoFile(mat)) + + if len(self.PageDirectoryInfo) == 0: + self.ErrorMsg.append("No Memory Range info found in PTE files") + else: + # Sort in descending order + self.PageDirectoryInfo.sort(key=operator.attrgetter('PhysicalStart')) + #check for Page Table Overlap - this is an error + index =0 + maxindex = len(self.PageDirectoryInfo) -1 + while index < maxindex: #this will allow all comparisions to work + if(self.PageDirectoryInfo[index].overlap(self.PageDirectoryInfo[index+1])): + self.ErrorMsg.append("Page Table Entry Overlap. Index %d Overlapping %d at StartAddress 0x%X" % + (index, index+1, self.PageDirectoryInfo[index].PhysicalStart)) + logging.error("PTE overlap index %d and %d. Base Address = 0x%x", index, index+1, self.PageDirectoryInfo[index].PhysicalStart) + index += 1 + + if len(self.MemoryRangeInfo) == 0: + self.ErrorMsg.append("No Memory Range info found in Info files") + + # Matching memory ranges up to page table entries + # use index based iteration so that page splitting + # is supported. + index = 0 + while index < len(self.PageDirectoryInfo): + pte = self.PageDirectoryInfo[index] + for mr in self.MemoryRangeInfo: + if pte.overlap(mr): + if (mr.MemoryType is not None) or (mr.GcdType is not None): + if (pte.PhysicalStart < mr.PhysicalStart): + next = pte.split(mr.PhysicalStart-1) + self.PageDirectoryInfo.insert(index+1, next) + # decrement the index so that we process this partial PTE again + # because we are breaking from the MemoryRange Loop + index -= 1 + break + + if (pte.PhysicalEnd > mr.PhysicalEnd): + next = pte.split(mr.PhysicalEnd) + self.PageDirectoryInfo.insert(index +1, next) + + if pte.MemoryType is None: + pte.MemoryType = mr.MemoryType + else: + logging.error("Multiple memory types found for one region " + pte.pteDebugStr() +" " + mr.MemoryRangeToString()) + self.ErrorMsg.append("Multiple memory types found for one region. Base: 0x%X. EFI Memory Type: %d and %d"% (pte.PhysicalStart, pte.MemoryType,mr.MemoryType)) + + if pte.GcdType is None: + pte.GcdType = mr.GcdType + logging.info("pte.GcdType: %d"% (pte.GcdType)) + else: + logging.error("Multiple memory types found for one region " + pte.pteDebugStr() +" " + mr.MemoryRangeToString()) + self.ErrorMsg.append("Multiple memory types found for one region. Base: 0x%X. GCD Memory Type: %d and %d"% (pte.PhysicalStart, pte.GcdType,mr.GcdType)) + + if mr.ImageName is not None: + if pte.ImageName is None: + pte.ImageName = mr.ImageName + else: + self.ErrorMsg.append("Multiple memory contents found for one region. Base: 0x%X. Memory Contents: %s and %s" % (pte.PhysicalStart, pte.ImageName, mr.ImageName )) + logging.error("Multiple memory contents found for one region " +pte.pteDebugStr() + " " + mr.LoadedImageEntryToString()) + + if mr.SystemMemoryType is not None: + if pte.SystemMemoryType is None: + pte.SystemMemoryType = mr.SystemMemoryType + else: + self.ErrorMsg.append("Multiple System Memory types found for one region. Base: 0x%X. EFI Memory Type: %s and %s."% (pte.PhysicalStart,pte.SystemMemoryType, mr.SystemMemoryType)) + logging.error("Multiple system memory types found for one region " +pte.pteDebugStr() + " " + mr.LoadedImageEntryToString()) + + for MatEntry in self.MemoryAttributesTable: + if pte.overlap(MatEntry): + pte.Attribute = MatEntry.Attribute + index += 1 + + # Combining adjacent PTEs that have the same attributes. + index = 0 + while index < (len(self.PageDirectoryInfo) - 1): + currentPte = self.PageDirectoryInfo[index] + nextPte = self.PageDirectoryInfo[index + 1] + if currentPte.sameAttributes(nextPte): + currentPte.grow(nextPte) + del self.PageDirectoryInfo[index + 1] + else: + index += 1 + + return 0 + + def AddErrorMsg(self, msg): + self.ErrorMsg.append(msg) + + def OutputHtmlReport(self, ToolVersion, OutputFilePath): + # Create the dictionary to produce a JSON string. + json_dict = { + 'ToolVersion': ToolVersion, + 'PlatformVersion': self.PlatformVersion, + 'PlatformName': self.PlatformName, + 'DateCollected': datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" ), + } + + # Process all of the Page Infos and add them to the JSON. + pde_infos = [] + for pde in self.PageDirectoryInfo: + info_dict = pde.toDictionary() + # Check for errors. + if info_dict['Section Type'] == "ERROR": + self.AddErrorMsg("Page Descriptor at %s has an error parsing the Section Type." % info_dict['Start']) + pde_infos.append(info_dict) + json_dict['MemoryRanges'] = pde_infos + + # Finally, add any errors and produce the JSON string. + json_dict['errors'] = self.ErrorMsg + js = json.dumps(json_dict) + + # + # Open template and replace placeholder with json + # + f = open(OutputFilePath, "w") + if self.Type == 'DXE': + template = open(os.path.join(sp, "DxePaging_template.html"), "r") + else: + template = open(os.path.join(sp, "SmmPaging_template.html"), "r") + + for line in template.readlines(): + if "%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%" in line: + line = line.replace("%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%", js) + f.write(line) + template.close() + f.close() + return 0 + +# +# Parse and Validate Args. Then run the tool +# +def main(): + + parser = argparse.ArgumentParser(description='Parse Paging information and generate HTML report') + parser.add_argument('-i', "--InputFolderPath", dest="InputFolder", help="Path to folder containing the DAT files from the UEFI shell tool (default is CWD)", default=os.getcwd()) + parser.add_argument('-o', "--OutputReport", dest="OutputReport", help="Path to output html report (default is report.html)", default=os.path.join(os.getcwd(), "report.html")) + parser.add_argument('-p', "--PlatformName", dest="PlatformName", help="Name of Platform. Will show up on report", default="Test Platform") + parser.add_argument('-t', "--type", choices=['SMM', 'DXE'], dest="Type", help="SMM or DXE Paging Report", required=True) + parser.add_argument("--PlatformVersion", dest="PlatformVersion", help="Version of Platform. Will show up report", default="1.0.0") + + #Turn on dubug level logging + parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) + #Output debug log + parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) + + options = parser.parse_args() + + #setup file based logging if outputReport specified + if(options.OutputLog): + if(len(options.OutputLog) < 2): + logging.critical("the output log file parameter is invalid") + return -2 + else: + #setup file based logging + filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') + if(options.debug): + filelogger.setLevel(logging.DEBUG) + else: + filelogger.setLevel(logging.INFO) + + filelogger.setFormatter(formatter) + logging.getLogger('').addHandler(filelogger) + + logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) + + #Do parameter validation + if(options.InputFolder is None or not os.path.isdir(options.InputFolder)): + logging.critical("Invalid Input Folder Path to folder containing DAT files") + return -5 + + if(options.OutputReport is None): + logging.critical("No OutputReport Path") + return -6 + + logging.debug("Input Folder Path is: %s" % options.InputFolder) + logging.debug("Output Report is: %s" % options.OutputReport) + + spt = ParsingTool(options.InputFolder, options.PlatformName, options.PlatformVersion, options.Type) + spt.Parse() + return spt.OutputHtmlReport(VERSION, options.OutputReport) + +#-------------------------------- +# Control starts here +# +#-------------------------------- +if __name__ == '__main__': + #setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + #call main worker function + retcode = main() + + if retcode != 0: + logging.critical("Failed. Return Code: %i" % retcode) + #end logging + logging.shutdown() + sys.exit(retcode) diff --git a/UefiTestingPkg/AuditTests/PagingAudit/Windows/SmmPaging_template.html b/UefiTestingPkg/AuditTests/PagingAudit/Windows/SmmPaging_template.html index dd2d57e9a8..958ed6710d 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/Windows/SmmPaging_template.html +++ b/UefiTestingPkg/AuditTests/PagingAudit/Windows/SmmPaging_template.html @@ -1,669 +1,669 @@ - - - - - - Smm Paging Analysis - - - - - - - -
-

Smm Paging Analysis

- -
-
-

Platform Name:

-

Version:

-

Date Collected:

-
-
-
-

Test Results

-
-
-
-
-
-
Page Filter
-
- Page Size - -
-

-
- Execute Attribute - -
-

-
- Read/Write Attribute - -
-

-
- Privilege Level - -
-

-

- -

-
-
-
Memory Range Filter
-
- UEFI Memory Type - -
-

-
- Special Memory Regions - -
-

-
- Memory Contents - -
-

-
- Section Type - -
-

-

- -

-
-
-
Actions
- Filters: -

-
-
- - - - - - - - - - - - - - - - - - -
Base AddressEnd AddressPage Size# of PagesRead/WriteExecutePrivilegeUEFI Memory TypeSection TypeSpecial Memory UsageUEFI Memory Contents
-
-
-

Parsing Tool Errors

- - - - - - - - -
Error Msg
-
-
-
-
-

-

- SMM Paging Analysis Template Version: 1.00
- SMM Paging Analysis Tool Version:
-

-

License

-
-
-

- Copyright (C) Microsoft Corporation. All rights reserved.
- - All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

- - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
-

-
-
-
-

External Licenses

-
-
-
-
-
- - - - - - - - - - - - - - + + + + + + Smm Paging Analysis + + + + + + + +
+

Smm Paging Analysis

+ +
+
+

Platform Name:

+

Version:

+

Date Collected:

+
+
+
+

Test Results

+
+
+
+
+
+
Page Filter
+
+ Page Size + +
+

+
+ Execute Attribute + +
+

+
+ Read/Write Attribute + +
+

+
+ Privilege Level + +
+

+

+ +

+
+
+
Memory Range Filter
+
+ UEFI Memory Type + +
+

+
+ Special Memory Regions + +
+

+
+ Memory Contents + +
+

+
+ Section Type + +
+

+

+ +

+
+
+
Actions
+ Filters: +

+
+
+ + + + + + + + + + + + + + + + + + +
Base AddressEnd AddressPage Size# of PagesRead/WriteExecutePrivilegeUEFI Memory TypeSection TypeSpecial Memory UsageUEFI Memory Contents
+
+
+

Parsing Tool Errors

+ + + + + + + + +
Error Msg
+
+
+
+
+

+

+ SMM Paging Analysis Template Version: 1.00
+ SMM Paging Analysis Tool Version:
+

+

License

+
+
+

+ Copyright (C) Microsoft Corporation. All rights reserved.
+ + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

+ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +
+

+
+
+
+

External Licenses

+
+
+
+
+
+ + + + + + + + + + + + + + diff --git a/UefiTestingPkg/AuditTests/TpmEventLogAudit/TpmEventLogAuditTestApp.inf b/UefiTestingPkg/AuditTests/TpmEventLogAudit/TpmEventLogAuditTestApp.inf index c36411eb2f..6b803dc94f 100644 --- a/UefiTestingPkg/AuditTests/TpmEventLogAudit/TpmEventLogAuditTestApp.inf +++ b/UefiTestingPkg/AuditTests/TpmEventLogAudit/TpmEventLogAuditTestApp.inf @@ -1,37 +1,37 @@ -## -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = TpmEventLogAuditTestApp - FILE_GUID = 7CD1FBCA-1381-48AB-B0BA-C3C66811C0DD - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = UefiTestApp - -[Sources] - TpmEventLogAudit.c - TpmEventLogXml.c - TpmEventLogXml.h - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - SecurityPkg/SecurityPkg.dec - XmlSupportPkg/XmlSupportPkg.dec - -[LibraryClasses] - BaseLib - UefiApplicationEntryPoint - DebugLib - ShellLib - UefiBootServicesTableLib - BaseMemoryLib - Tpm2CommandLib - XmlTreeLib - XmlTreeQueryLib - -[Protocols] - gEfiTcg2ProtocolGuid +## +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = TpmEventLogAuditTestApp + FILE_GUID = 7CD1FBCA-1381-48AB-B0BA-C3C66811C0DD + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiTestApp + +[Sources] + TpmEventLogAudit.c + TpmEventLogXml.c + TpmEventLogXml.h + +[Packages] + MdePkg/MdePkg.dec + ShellPkg/ShellPkg.dec + SecurityPkg/SecurityPkg.dec + XmlSupportPkg/XmlSupportPkg.dec + +[LibraryClasses] + BaseLib + UefiApplicationEntryPoint + DebugLib + ShellLib + UefiBootServicesTableLib + BaseMemoryLib + Tpm2CommandLib + XmlTreeLib + XmlTreeQueryLib + +[Protocols] + gEfiTcg2ProtocolGuid diff --git a/UefiTestingPkg/AuditTests/UefiVarLockAudit/UEFI/UefiVarLockAuditTestApp.inf b/UefiTestingPkg/AuditTests/UefiVarLockAudit/UEFI/UefiVarLockAuditTestApp.inf index e6ccdbc45d..1c5852ea62 100644 --- a/UefiTestingPkg/AuditTests/UefiVarLockAudit/UEFI/UefiVarLockAuditTestApp.inf +++ b/UefiTestingPkg/AuditTests/UefiVarLockAudit/UEFI/UefiVarLockAuditTestApp.inf @@ -1,54 +1,54 @@ - -## @file -# A UEFI Audit test app that enumerates all variables in NV ram -# collects the attribute information and then attempts to make changes -# to the variable in order to gather variable protection information. -# -# If the variable is successfully deleted it will be recreated with the -# same data value. -# -# The result data is output in XML -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UefiVarLockAuditTestApp - FILE_GUID = f9b66f10-1b91-4388-91a8-773f6413e543 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = LockTestEntry - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - LockTest.c - LockTestXml.h - LockTestXml.c - InternalFunctions.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - ShellPkg/ShellPkg.dec - - -[LibraryClasses] - UefiApplicationEntryPoint - UefiLib - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - DebugLib - BaseLib - BaseMemoryLib - ShellLib - PrintLib - XmlTreeLib - XmlTreeQueryLib + +## @file +# A UEFI Audit test app that enumerates all variables in NV ram +# collects the attribute information and then attempts to make changes +# to the variable in order to gather variable protection information. +# +# If the variable is successfully deleted it will be recreated with the +# same data value. +# +# The result data is output in XML +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = UefiVarLockAuditTestApp + FILE_GUID = f9b66f10-1b91-4388-91a8-773f6413e543 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = LockTestEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + LockTest.c + LockTestXml.h + LockTestXml.c + InternalFunctions.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + ShellPkg/ShellPkg.dec + + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + DebugLib + BaseLib + BaseMemoryLib + ShellLib + PrintLib + XmlTreeLib + XmlTreeQueryLib diff --git a/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVarAudit.py b/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVarAudit.py index 4a9d3a695f..2507142c93 100644 --- a/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVarAudit.py +++ b/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVarAudit.py @@ -1,120 +1,120 @@ -# -# Script to iterate thru an xml file and -# check the UEFI variable read/write properties of a given variable -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -## - - -import os, sys -import argparse -import logging -import datetime -import struct -import hashlib -import shutil -import time -import xml.etree.ElementTree as ET -from xml.etree.ElementTree import Element -from UefiVariablesSupportLib import UefiVariable - -# -#main script function -# -def main(): - - parser = argparse.ArgumentParser(description='Variable Audit Tool') - - #Output debug log - parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) - parser.add_argument("--OutputXml", dest="OutputXml", help="Output Xml file that contains final results", default=None) - parser.add_argument("--InputXml", dest="InputXml", help="Input Xml file", default=None) - - #Turn on dubug level logging - parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) - options = parser.parse_args() - - #setup file based logging if outputReport specified - if(options.OutputLog): - if(len(options.OutputLog) < 2): - logging.critical("the output log file parameter is invalid") - return -2 - else: - #setup file based logging - filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') - if(options.debug): - filelogger.setLevel(logging.DEBUG) - else: - filelogger.setLevel(logging.INFO) - - filelogger.setFormatter(formatter) - logging.getLogger('').addHandler(filelogger) - - logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) - - #Check for required input parameters - if(not options.InputXml) or (not os.path.isfile(options.InputXml)): - logging.critical("No Input Xml file specified") - return -1 - - if(not options.OutputXml): - logging.critical("Output Xml file path not specified") - return -2 - - Uefi = UefiVariable() - - #read in XML file as doc - XmlFile = ET.parse(options.InputXml) - XmlRoot = XmlFile.getroot() - - for var in XmlRoot.findall("Variable"): - name = var.get("Name") - guid = var.get("Guid") - (ReadStatus, Data, ReadErrorString) = Uefi.GetUefiVar(name, guid) - (WriteSuccess, ErrorCode, WriteErrorString)= Uefi.SetUefiVar(name, guid) - if(WriteSuccess != 0): - logging.info("Must Restore Var %s:%s" % (name, guid)) - (RestoreSuccess, RestoreEC, RestoreErrorString) = Uefi.SetUefiVar(name, guid, Data) - if (RestoreSuccess == 0): - logging.critical("Restoring failed for Var %s:%s 0x%X ErrorCode: 0x%X %s" % (name, guid, RestoreSuccess, RestoreEC, RestoreErrorString)) - #append - # - #0x0 Success - #0x8000000000000002 Invalid Parameter - ele = Element("FromOs") - rs = Element("ReadStatus") - ws = Element("WriteStatus") - rs.text = "0x%lX" % (ReadStatus) - if(ReadErrorString is not None): - rs.text = rs.text + " %s" % ReadErrorString - ws.text = "0x%lX" % ErrorCode - if(WriteErrorString is not None): - ws.text = ws.text + " %s" % WriteErrorString - ele.append(rs) - ele.append(ws) - var.append(ele) - - XmlFile.write(options.OutputXml) - return 0 - - -if __name__ == '__main__': - #setup main console as logger - logger = logging.getLogger('') - logger.setLevel(logging.DEBUG) - formatter = logging.Formatter("%(levelname)s - %(message)s") - console = logging.StreamHandler() - console.setLevel(logging.CRITICAL) - console.setFormatter(formatter) - logger.addHandler(console) - - #call main worker function - retcode = main() - - if retcode != 0: - logging.critical("Failed. Return Code: %i" % retcode) - #end logging - logging.shutdown() - sys.exit(retcode) +# +# Script to iterate thru an xml file and +# check the UEFI variable read/write properties of a given variable +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +## + + +import os, sys +import argparse +import logging +import datetime +import struct +import hashlib +import shutil +import time +import xml.etree.ElementTree as ET +from xml.etree.ElementTree import Element +from UefiVariablesSupportLib import UefiVariable + +# +#main script function +# +def main(): + + parser = argparse.ArgumentParser(description='Variable Audit Tool') + + #Output debug log + parser.add_argument("-l", dest="OutputLog", help="Create an output log file: ie -l out.txt", default=None) + parser.add_argument("--OutputXml", dest="OutputXml", help="Output Xml file that contains final results", default=None) + parser.add_argument("--InputXml", dest="InputXml", help="Input Xml file", default=None) + + #Turn on dubug level logging + parser.add_argument("--debug", action="store_true", dest="debug", help="turn on debug logging level for file log", default=False) + options = parser.parse_args() + + #setup file based logging if outputReport specified + if(options.OutputLog): + if(len(options.OutputLog) < 2): + logging.critical("the output log file parameter is invalid") + return -2 + else: + #setup file based logging + filelogger = logging.FileHandler(filename=options.OutputLog, mode='w') + if(options.debug): + filelogger.setLevel(logging.DEBUG) + else: + filelogger.setLevel(logging.INFO) + + filelogger.setFormatter(formatter) + logging.getLogger('').addHandler(filelogger) + + logging.info("Log Started: " + datetime.datetime.strftime(datetime.datetime.now(), "%A, %B %d, %Y %I:%M%p" )) + + #Check for required input parameters + if(not options.InputXml) or (not os.path.isfile(options.InputXml)): + logging.critical("No Input Xml file specified") + return -1 + + if(not options.OutputXml): + logging.critical("Output Xml file path not specified") + return -2 + + Uefi = UefiVariable() + + #read in XML file as doc + XmlFile = ET.parse(options.InputXml) + XmlRoot = XmlFile.getroot() + + for var in XmlRoot.findall("Variable"): + name = var.get("Name") + guid = var.get("Guid") + (ReadStatus, Data, ReadErrorString) = Uefi.GetUefiVar(name, guid) + (WriteSuccess, ErrorCode, WriteErrorString)= Uefi.SetUefiVar(name, guid) + if(WriteSuccess != 0): + logging.info("Must Restore Var %s:%s" % (name, guid)) + (RestoreSuccess, RestoreEC, RestoreErrorString) = Uefi.SetUefiVar(name, guid, Data) + if (RestoreSuccess == 0): + logging.critical("Restoring failed for Var %s:%s 0x%X ErrorCode: 0x%X %s" % (name, guid, RestoreSuccess, RestoreEC, RestoreErrorString)) + #append + # + #0x0 Success + #0x8000000000000002 Invalid Parameter + ele = Element("FromOs") + rs = Element("ReadStatus") + ws = Element("WriteStatus") + rs.text = "0x%lX" % (ReadStatus) + if(ReadErrorString is not None): + rs.text = rs.text + " %s" % ReadErrorString + ws.text = "0x%lX" % ErrorCode + if(WriteErrorString is not None): + ws.text = ws.text + " %s" % WriteErrorString + ele.append(rs) + ele.append(ws) + var.append(ele) + + XmlFile.write(options.OutputXml) + return 0 + + +if __name__ == '__main__': + #setup main console as logger + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(levelname)s - %(message)s") + console = logging.StreamHandler() + console.setLevel(logging.CRITICAL) + console.setFormatter(formatter) + logger.addHandler(console) + + #call main worker function + retcode = main() + + if retcode != 0: + logging.critical("Failed. Return Code: %i" % retcode) + #end logging + logging.shutdown() + sys.exit(retcode) diff --git a/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVariablesSupportLib.py b/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVariablesSupportLib.py index 33030d2743..9398cbc195 100644 --- a/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVariablesSupportLib.py +++ b/UefiTestingPkg/AuditTests/UefiVarLockAudit/Windows/UefiVariablesSupportLib.py @@ -1,92 +1,92 @@ -## -## Python lib to support Reading and writing UEFI variables from windows -## -# -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -import os, sys -from ctypes import * -import logging -import pywintypes -import win32api, win32process, win32security, win32file -import winerror - -kernel32 = windll.kernel32 -EFI_VAR_MAX_BUFFER_SIZE = 1024*1024 - -class UefiVariable(object): - - def __init__(self): - # enable required SeSystemEnvironmentPrivilege privilege - privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) - token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) - win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) - win32api.CloseHandle( token ) - - # get windows firmware variable API - try: - self._GetFirmwareEnvironmentVariable = kernel32.GetFirmwareEnvironmentVariableW - self._GetFirmwareEnvironmentVariable.restype = c_int - self._GetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] - self._SetFirmwareEnvironmentVariable = kernel32.SetFirmwareEnvironmentVariableW - self._SetFirmwareEnvironmentVariable.restype = c_int - self._SetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] - self._SetFirmwareEnvironmentVariableEx = kernel32.SetFirmwareEnvironmentVariableExW - self._SetFirmwareEnvironmentVariableEx.restype = c_int - self._SetFirmwareEnvironmentVariableEx.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int, c_int] - except AttributeError: - logging.warn( "Some get/set functions don't't seem to exist" ) - - # - #Function to get variable - # return a tuple of error code and variable data as string - # - def GetUefiVar(self, name, guid ): - err = 0 #success - efi_var = create_string_buffer( EFI_VAR_MAX_BUFFER_SIZE ) - if self._GetFirmwareEnvironmentVariable is not None: - logging.info("calling GetFirmwareEnvironmentVariable( name='%s', GUID='%s' ).." % (name, "{%s}" % guid) ) - length = self._GetFirmwareEnvironmentVariable( name, "{%s}" % guid, efi_var, EFI_VAR_MAX_BUFFER_SIZE ) - if (0 == length) or (efi_var is None): - err = kernel32.GetLastError() - logging.error( 'GetFirmwareEnvironmentVariable[Ex] failed (GetLastError = 0x%x)' % err) - logging.error(WinError()) - return (err, None, WinError(err)) - return (err, efi_var[:length], None) - # - #Function to set variable - # return a tuple of boolean status, errorcode, errorstring (None if not error) - # - def SetUefiVar(self, name, guid, var=None, attrs=None): - var_len = 0 - err = 0 - errorstring = None - if var is None: - var = bytes(0) - else: - var_len = len(var) - if(attrs == None): - if self._SetFirmwareEnvironmentVariable is not None: - logging.info("Calling SetFirmwareEnvironmentVariable (name='%s', Guid='%s')..." % (name, "{%s}" % guid, )) - success = self._SetFirmwareEnvironmentVariable(name, "{%s}" % guid, var, var_len) - else: - if self._SetFirmwareEnvironmentVariableEx is not None: - logging.info(" calling SetFirmwareEnvironmentVariableEx( name='%s', GUID='%s', length=0x%X, attributes=0x%X ).." % (name, "{%s}" % guid, var_len, attrs) ) - success = self._SetFirmwareEnvironmentVariableEx( name, "{%s}" % guid, var, var_len, attrs ) - - if 0 == success: - err = kernel32.GetLastError() - logging.error('SetFirmwareEnvironmentVariable failed (GetLastError = 0x%x)' % err ) - logging.error(WinError()) - errorstring = WinError(err) - return (success,err, errorstring) - - - -#Test code -#UefiVar = UefiVariable() -#(errorcode, data, errorstring) = UefiVar.GetUefiVar('PK', '8BE4DF61-93CA-11D2-AA0D-00E098032B8C') +## +## Python lib to support Reading and writing UEFI variables from windows +## +# +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +import os, sys +from ctypes import * +import logging +import pywintypes +import win32api, win32process, win32security, win32file +import winerror + +kernel32 = windll.kernel32 +EFI_VAR_MAX_BUFFER_SIZE = 1024*1024 + +class UefiVariable(object): + + def __init__(self): + # enable required SeSystemEnvironmentPrivilege privilege + privilege = win32security.LookupPrivilegeValue( None, 'SeSystemEnvironmentPrivilege' ) + token = win32security.OpenProcessToken( win32process.GetCurrentProcess(), win32security.TOKEN_READ|win32security.TOKEN_ADJUST_PRIVILEGES ) + win32security.AdjustTokenPrivileges( token, False, [(privilege, win32security.SE_PRIVILEGE_ENABLED)] ) + win32api.CloseHandle( token ) + + # get windows firmware variable API + try: + self._GetFirmwareEnvironmentVariable = kernel32.GetFirmwareEnvironmentVariableW + self._GetFirmwareEnvironmentVariable.restype = c_int + self._GetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] + self._SetFirmwareEnvironmentVariable = kernel32.SetFirmwareEnvironmentVariableW + self._SetFirmwareEnvironmentVariable.restype = c_int + self._SetFirmwareEnvironmentVariable.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int] + self._SetFirmwareEnvironmentVariableEx = kernel32.SetFirmwareEnvironmentVariableExW + self._SetFirmwareEnvironmentVariableEx.restype = c_int + self._SetFirmwareEnvironmentVariableEx.argtypes = [c_wchar_p, c_wchar_p, c_void_p, c_int, c_int] + except AttributeError: + logging.warn( "Some get/set functions don't't seem to exist" ) + + # + #Function to get variable + # return a tuple of error code and variable data as string + # + def GetUefiVar(self, name, guid ): + err = 0 #success + efi_var = create_string_buffer( EFI_VAR_MAX_BUFFER_SIZE ) + if self._GetFirmwareEnvironmentVariable is not None: + logging.info("calling GetFirmwareEnvironmentVariable( name='%s', GUID='%s' ).." % (name, "{%s}" % guid) ) + length = self._GetFirmwareEnvironmentVariable( name, "{%s}" % guid, efi_var, EFI_VAR_MAX_BUFFER_SIZE ) + if (0 == length) or (efi_var is None): + err = kernel32.GetLastError() + logging.error( 'GetFirmwareEnvironmentVariable[Ex] failed (GetLastError = 0x%x)' % err) + logging.error(WinError()) + return (err, None, WinError(err)) + return (err, efi_var[:length], None) + # + #Function to set variable + # return a tuple of boolean status, errorcode, errorstring (None if not error) + # + def SetUefiVar(self, name, guid, var=None, attrs=None): + var_len = 0 + err = 0 + errorstring = None + if var is None: + var = bytes(0) + else: + var_len = len(var) + if(attrs == None): + if self._SetFirmwareEnvironmentVariable is not None: + logging.info("Calling SetFirmwareEnvironmentVariable (name='%s', Guid='%s')..." % (name, "{%s}" % guid, )) + success = self._SetFirmwareEnvironmentVariable(name, "{%s}" % guid, var, var_len) + else: + if self._SetFirmwareEnvironmentVariableEx is not None: + logging.info(" calling SetFirmwareEnvironmentVariableEx( name='%s', GUID='%s', length=0x%X, attributes=0x%X ).." % (name, "{%s}" % guid, var_len, attrs) ) + success = self._SetFirmwareEnvironmentVariableEx( name, "{%s}" % guid, var, var_len, attrs ) + + if 0 == success: + err = kernel32.GetLastError() + logging.error('SetFirmwareEnvironmentVariable failed (GetLastError = 0x%x)' % err ) + logging.error(WinError()) + errorstring = WinError(err) + return (success,err, errorstring) + + + +#Test code +#UefiVar = UefiVariable() +#(errorcode, data, errorstring) = UefiVar.GetUefiVar('PK', '8BE4DF61-93CA-11D2-AA0D-00E098032B8C') #(status, errorcode, errorstring) = UefiVar.SetUefiVar('PK','8BE4DF61-93CA-11D2-AA0D-00E098032B8C',None, None) \ No newline at end of file diff --git a/UefiTestingPkg/FunctionalSystemTests/ExceptionPersistenceTestApp/ExceptionPersistenceTestApp.inf b/UefiTestingPkg/FunctionalSystemTests/ExceptionPersistenceTestApp/ExceptionPersistenceTestApp.inf index aef5765270..11c3375e97 100644 --- a/UefiTestingPkg/FunctionalSystemTests/ExceptionPersistenceTestApp/ExceptionPersistenceTestApp.inf +++ b/UefiTestingPkg/FunctionalSystemTests/ExceptionPersistenceTestApp/ExceptionPersistenceTestApp.inf @@ -1,35 +1,35 @@ -## @file ExceptionPersistenceTestApp.inf -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = ExceptionPersistenceTestApp - FILE_GUID = 6B8ADC4C-6F65-4D74-8DB2-6685F0F6EE4D - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = ExceptionPersistenceTestApp - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - ExceptionPersistenceTestApp.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - MsCorePkg/MsCorePkg.dec - -[LibraryClasses] - UefiLib - UefiApplicationEntryPoint - DebugLib - UnitTestLib - ExceptionPersistenceLib +## @file ExceptionPersistenceTestApp.inf +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = ExceptionPersistenceTestApp + FILE_GUID = 6B8ADC4C-6F65-4D74-8DB2-6685F0F6EE4D + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = ExceptionPersistenceTestApp + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + ExceptionPersistenceTestApp.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + UefiLib + UefiApplicationEntryPoint + DebugLib + UnitTestLib + ExceptionPersistenceLib diff --git a/UefiTestingPkg/FunctionalSystemTests/MemmapAndMatTestApp/MemmapAndMatTestApp.inf b/UefiTestingPkg/FunctionalSystemTests/MemmapAndMatTestApp/MemmapAndMatTestApp.inf index 9874d21a91..2d1d80d7d0 100644 --- a/UefiTestingPkg/FunctionalSystemTests/MemmapAndMatTestApp/MemmapAndMatTestApp.inf +++ b/UefiTestingPkg/FunctionalSystemTests/MemmapAndMatTestApp/MemmapAndMatTestApp.inf @@ -1,43 +1,43 @@ -## @file MemmapAndMatTestApp.inf -# This application contains tests and utility functions for the MemoryMap and -# UEFI Memory Attributes Table. -# -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = MemmapAndMatFunctionalTestApp - FILE_GUID = AAF8A860-380F-40E8-922B-002F87EE9BA2 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = MemmapAndMatTestApp - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemmapAndMatTestApp.c - -[Packages] - MdePkg/MdePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - -[Protocols] - - -[LibraryClasses] - BaseLib - UefiLib - UefiApplicationEntryPoint - DebugLib - UnitTestLib - PrintLib - -[Guids] - gEfiMemoryAttributesTableGuid ## CONSUMES # Used to locate the MAT table. +## @file MemmapAndMatTestApp.inf +# This application contains tests and utility functions for the MemoryMap and +# UEFI Memory Attributes Table. +# +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = MemmapAndMatFunctionalTestApp + FILE_GUID = AAF8A860-380F-40E8-922B-002F87EE9BA2 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = MemmapAndMatTestApp + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MemmapAndMatTestApp.c + +[Packages] + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[Protocols] + + +[LibraryClasses] + BaseLib + UefiLib + UefiApplicationEntryPoint + DebugLib + UnitTestLib + PrintLib + +[Guids] + gEfiMemoryAttributesTableGuid ## CONSUMES # Used to locate the MAT table. diff --git a/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/App/MemoryProtectionTestApp.inf b/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/App/MemoryProtectionTestApp.inf index 3f0fc34ce9..7c5f9cf560 100644 --- a/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/App/MemoryProtectionTestApp.inf +++ b/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/App/MemoryProtectionTestApp.inf @@ -1,78 +1,78 @@ -## @file MemoryProtectionTestApp.inf -# -# Tests for page guard, pool guard, NX protections, stack guard, and null pointer detection. -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = MemoryProtectionTestApp - FILE_GUID = 0C187938-97DE-4B98-AFBB-A71C43A55F0E - VERSION_STRING = 1.0 - MODULE_TYPE = UEFI_APPLICATION - ENTRY_POINT = MemoryProtectionTestAppEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - MemoryProtectionTestApp.c - -[Sources.X64] - X64/UefiHardwareNxProtection.c - -[Sources.ARM] - Arm/UefiHardwareNxProtection.c - -[Sources.AARCH64] - Arm/UefiHardwareNxProtection.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - ShellPkg/ShellPkg.dec - MsCorePkg/MsCorePkg.dec - - -[LibraryClasses] - DebugLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UnitTestLib - UnitTestPersistenceLib - UnitTestBootLib - PrintLib - MemoryAllocationLib - BaseLib - ShellLib - UefiLib - CpuExceptionHandlerLib - HwResetSystemLib - HobLib - ExceptionPersistenceLib - -[Guids] - gMemoryProtectionExceptionHandlerGuid ## CONSUMES - -[Protocols] - gEfiSmmCommunicationProtocolGuid - gEfiCpuArchProtocolGuid ## CONSUMES - gMemoryProtectionNonstopModeProtocolGuid ## CONSUMES - -[Guids] - gEdkiiPiSmmCommunicationRegionTableGuid - gEfiDebugImageInfoTableGuid ## SOMETIMES_CONSUMES ## GUID - gEfiMemoryAttributesTableGuid - gMmMemoryProtectionSettingsGuid - gDxeMemoryProtectionSettingsGuid - -[BuildOptions] - GCC:*_CLANG40WIN_AARCH64_CC_FLAGS = -Wno-infinite-recursion - MSFT:*_*_*_CC_FLAGS = /wd4054 /wd4055 /wd4717 +## @file MemoryProtectionTestApp.inf +# +# Tests for page guard, pool guard, NX protections, stack guard, and null pointer detection. +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = MemoryProtectionTestApp + FILE_GUID = 0C187938-97DE-4B98-AFBB-A71C43A55F0E + VERSION_STRING = 1.0 + MODULE_TYPE = UEFI_APPLICATION + ENTRY_POINT = MemoryProtectionTestAppEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + MemoryProtectionTestApp.c + +[Sources.X64] + X64/UefiHardwareNxProtection.c + +[Sources.ARM] + Arm/UefiHardwareNxProtection.c + +[Sources.AARCH64] + Arm/UefiHardwareNxProtection.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + ShellPkg/ShellPkg.dec + MsCorePkg/MsCorePkg.dec + + +[LibraryClasses] + DebugLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UnitTestLib + UnitTestPersistenceLib + UnitTestBootLib + PrintLib + MemoryAllocationLib + BaseLib + ShellLib + UefiLib + CpuExceptionHandlerLib + HwResetSystemLib + HobLib + ExceptionPersistenceLib + +[Guids] + gMemoryProtectionExceptionHandlerGuid ## CONSUMES + +[Protocols] + gEfiSmmCommunicationProtocolGuid + gEfiCpuArchProtocolGuid ## CONSUMES + gMemoryProtectionNonstopModeProtocolGuid ## CONSUMES + +[Guids] + gEdkiiPiSmmCommunicationRegionTableGuid + gEfiDebugImageInfoTableGuid ## SOMETIMES_CONSUMES ## GUID + gEfiMemoryAttributesTableGuid + gMmMemoryProtectionSettingsGuid + gDxeMemoryProtectionSettingsGuid + +[BuildOptions] + GCC:*_CLANG40WIN_AARCH64_CC_FLAGS = -Wno-infinite-recursion + MSFT:*_*_*_CC_FLAGS = /wd4054 /wd4055 /wd4717 diff --git a/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Readme.md b/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Readme.md index c0f1b397d2..6ebf98496e 100644 --- a/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Readme.md +++ b/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Readme.md @@ -1,21 +1,21 @@ -# Memory Protection Tests - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -## About This Test - -This is set of tests to ensure that heap guard, stack guard, null pointer detection, and nx protections are working properly. - -It consists of: - -- An SMM driver -- A Shell-based test app - -The Shell-based app may be built at any time and run from Shell. The app can use the SMM driver to preform SMM tests if the -SMM driver is installed. - -It is not the intention of this test to include the driver in production systems. They should only be used for purpose-built -test images. +# Memory Protection Tests + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +## About This Test + +This is set of tests to ensure that heap guard, stack guard, null pointer detection, and nx protections are working properly. + +It consists of: + +- An SMM driver +- A Shell-based test app + +The Shell-based app may be built at any time and run from Shell. The app can use the SMM driver to preform SMM tests if the +SMM driver is installed. + +It is not the intention of this test to include the driver in production systems. They should only be used for purpose-built +test images. diff --git a/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Smm/MemoryProtectionTestSmm.inf b/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Smm/MemoryProtectionTestSmm.inf index 215abbcdfe..6731225e78 100644 --- a/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Smm/MemoryProtectionTestSmm.inf +++ b/UefiTestingPkg/FunctionalSystemTests/MemoryProtectionTest/Smm/MemoryProtectionTestSmm.inf @@ -1,50 +1,50 @@ -## @file MemoryProtectionTestSmm.inf -# -# Tests for page guard, pool guard, and null pointer detection in SMM. -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = MemoryProtectionTestSmm - FILE_GUID = 4AFD1797-7010-493F-B4E2-2EE6A2AFF4CB - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x0001000A - ENTRY_POINT = MemoryProtectionTestEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MemoryProtectionTestSmm.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - -[LibraryClasses] - UefiDriverEntryPoint - SmmServicesTableLib - DebugLib - SmmMemLib - PcdLib - BaseMemoryLib - UefiBootServicesTableLib - HobLib - - -[Protocols] - gSmmExceptionTestProtocolGuid ## CONSUMES -[Guids] - gMmMemoryProtectionSettingsGuid - -[Depex] - gSmmExceptionTestProtocolGuid +## @file MemoryProtectionTestSmm.inf +# +# Tests for page guard, pool guard, and null pointer detection in SMM. +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MemoryProtectionTestSmm + FILE_GUID = 4AFD1797-7010-493F-B4E2-2EE6A2AFF4CB + MODULE_TYPE = DXE_SMM_DRIVER + VERSION_STRING = 1.0 + PI_SPECIFICATION_VERSION = 0x0001000A + ENTRY_POINT = MemoryProtectionTestEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MemoryProtectionTestSmm.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + SmmServicesTableLib + DebugLib + SmmMemLib + PcdLib + BaseMemoryLib + UefiBootServicesTableLib + HobLib + + +[Protocols] + gSmmExceptionTestProtocolGuid ## CONSUMES +[Guids] + gMmMemoryProtectionSettingsGuid + +[Depex] + gSmmExceptionTestProtocolGuid diff --git a/UefiTestingPkg/FunctionalSystemTests/MorLockTestApp/MorLockTestApp.inf b/UefiTestingPkg/FunctionalSystemTests/MorLockTestApp/MorLockTestApp.inf index 0941bb3e14..316de71ca5 100644 --- a/UefiTestingPkg/FunctionalSystemTests/MorLockTestApp/MorLockTestApp.inf +++ b/UefiTestingPkg/FunctionalSystemTests/MorLockTestApp/MorLockTestApp.inf @@ -1,45 +1,45 @@ -## @file -# This application will test the MorLock v1 and v2 variable protection feature. -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = MorLockFunctionalTestApp - FILE_GUID = ab26bc38-9271-44b4-b6e0-8deb1a7caac2 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = MorLockTestApp - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - MorLockTestApp.c - - -[Packages] - MdePkg/MdePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - - -[LibraryClasses] - BaseLib - UefiApplicationEntryPoint - UefiRuntimeServicesTableLib - DebugLib - UnitTestLib - UnitTestPersistenceLib - UnitTestBootLib - PrintLib - -[Guids] - gEfiMemoryOverwriteControlDataGuid ## CONSUMES - gEfiMemoryOverwriteRequestControlLockGuid ## CONSUMES +## @file +# This application will test the MorLock v1 and v2 variable protection feature. +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = MorLockFunctionalTestApp + FILE_GUID = ab26bc38-9271-44b4-b6e0-8deb1a7caac2 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = MorLockTestApp + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + MorLockTestApp.c + + +[Packages] + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + + +[LibraryClasses] + BaseLib + UefiApplicationEntryPoint + UefiRuntimeServicesTableLib + DebugLib + UnitTestLib + UnitTestPersistenceLib + UnitTestBootLib + PrintLib + +[Guids] + gEfiMemoryOverwriteControlDataGuid ## CONSUMES + gEfiMemoryOverwriteRequestControlLockGuid ## CONSUMES diff --git a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/App/SmmPagingProtectionsTestApp.inf b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/App/SmmPagingProtectionsTestApp.inf index daba5a7848..51d734a8d2 100644 --- a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/App/SmmPagingProtectionsTestApp.inf +++ b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/App/SmmPagingProtectionsTestApp.inf @@ -1,52 +1,52 @@ -## @file SmmPagingProtectionsTestApp.inf -# This user-facing application requests that the underlying SMM memory -# protection test infrastructure exercise a particular test. -# -## -# Copyright (c) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -# MS_CHANGE - Entire file created. - -[Defines] - INF_VERSION = 0x00010017 - BASE_NAME = SmmPagingProtectionsFunctionalTestApp - FILE_GUID = 573F65EF-9A1A-48BB-BD2D-1FD252C6280D - VERSION_STRING = 1.0 - MODULE_TYPE = UEFI_APPLICATION - ENTRY_POINT = SmmPagingProtectionsTestAppEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - SmmPagingProtectionsTestApp.c - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - - -[LibraryClasses] - UefiLib - DebugLib - UefiApplicationEntryPoint - UefiBootServicesTableLib - UnitTestLib - UnitTestPersistenceLib - UnitTestBootLib - PrintLib - -[Protocols] - gEfiSmmCommunicationProtocolGuid - - -[Guids] - gEdkiiPiSmmCommunicationRegionTableGuid +## @file SmmPagingProtectionsTestApp.inf +# This user-facing application requests that the underlying SMM memory +# protection test infrastructure exercise a particular test. +# +## +# Copyright (c) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +# MS_CHANGE - Entire file created. + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = SmmPagingProtectionsFunctionalTestApp + FILE_GUID = 573F65EF-9A1A-48BB-BD2D-1FD252C6280D + VERSION_STRING = 1.0 + MODULE_TYPE = UEFI_APPLICATION + ENTRY_POINT = SmmPagingProtectionsTestAppEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + SmmPagingProtectionsTestApp.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + + +[LibraryClasses] + UefiLib + DebugLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UnitTestLib + UnitTestPersistenceLib + UnitTestBootLib + PrintLib + +[Protocols] + gEfiSmmCommunicationProtocolGuid + + +[Guids] + gEdkiiPiSmmCommunicationRegionTableGuid diff --git a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Readme.md b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Readme.md index 72bce99e6d..37fb1ac384 100644 --- a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Readme.md +++ b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Readme.md @@ -1,23 +1,23 @@ -# SMM Paging Protections Test - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent - -## About This Test - -This is a [currently] small test to prove that certain SMM paging protections have been applied. - -It consists of: - -- An SMM driver -- A DXE driver -- A Shell-based test app - -In order to use this test, the SMM and DXE drivers must be built and included in your FW image to be dispatched at boot time. -The Shell-based app may be built at any time and run from Shell. The app will ask the DXE driver to pass a message to the -SMM driver to invoke a particular test. - -It is not the intention of this test to include the two drivers in production systems. They should only be used for purpose-built -test images. +# SMM Paging Protections Test + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +## About This Test + +This is a [currently] small test to prove that certain SMM paging protections have been applied. + +It consists of: + +- An SMM driver +- A DXE driver +- A Shell-based test app + +In order to use this test, the SMM and DXE drivers must be built and included in your FW image to be dispatched at boot time. +The Shell-based app may be built at any time and run from Shell. The app will ask the DXE driver to pass a message to the +SMM driver to invoke a particular test. + +It is not the intention of this test to include the two drivers in production systems. They should only be used for purpose-built +test images. diff --git a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestSmm.inf b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestSmm.inf index cc0d2e3934..35e0732e1e 100644 --- a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestSmm.inf +++ b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestSmm.inf @@ -1,54 +1,54 @@ -## @file SmmPagingProtectionsTestSmm.inf -# This is the SMM portion of the SmmPagingProtectionsTest driver. -# This driver will be signalled by the DXE portion and will perform requested operations -# to probe the extent of the SMM memory protections (like NX). -# -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -# MS_CHANGE - Entire file created. - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmPagingProtectionsTestSmm - FILE_GUID = E78CF4BA-7AEF-4EFB-AF0C-03ED8ECC495B - MODULE_TYPE = DXE_SMM_DRIVER - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x0001000A - ENTRY_POINT = TraditionalMmPagingProtectionsTestEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - SmmPagingProtectionsTestDriver.c - SmmPagingProtectionsTestDriver.h - SmmPagingProtectionsTestTraditionalMm.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - UefiTestingPkg/UefiTestingPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - MemoryAllocationLib - SmmMemLib - MmServicesTableLib - UefiDriverEntryPoint - PlatformSmmProtectionsTestLib - -[Protocols] - gSmmExceptionTestProtocolGuid ## CONSUMES - -[Depex] - gSmmExceptionTestProtocolGuid +## @file SmmPagingProtectionsTestSmm.inf +# This is the SMM portion of the SmmPagingProtectionsTest driver. +# This driver will be signalled by the DXE portion and will perform requested operations +# to probe the extent of the SMM memory protections (like NX). +# +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +# MS_CHANGE - Entire file created. + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SmmPagingProtectionsTestSmm + FILE_GUID = E78CF4BA-7AEF-4EFB-AF0C-03ED8ECC495B + MODULE_TYPE = DXE_SMM_DRIVER + VERSION_STRING = 1.0 + PI_SPECIFICATION_VERSION = 0x0001000A + ENTRY_POINT = TraditionalMmPagingProtectionsTestEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + SmmPagingProtectionsTestDriver.c + SmmPagingProtectionsTestDriver.h + SmmPagingProtectionsTestTraditionalMm.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + UefiTestingPkg/UefiTestingPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + SmmMemLib + MmServicesTableLib + UefiDriverEntryPoint + PlatformSmmProtectionsTestLib + +[Protocols] + gSmmExceptionTestProtocolGuid ## CONSUMES + +[Depex] + gSmmExceptionTestProtocolGuid diff --git a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestStandaloneMm.inf b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestStandaloneMm.inf index 7e43252e22..aa5857d5c9 100644 --- a/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestStandaloneMm.inf +++ b/UefiTestingPkg/FunctionalSystemTests/SmmPagingProtectionsTest/Smm/SmmPagingProtectionsTestStandaloneMm.inf @@ -1,55 +1,55 @@ -## @file SmmPagingProtectionsTestSmm.inf -# This is the SMM portion of the SmmPagingProtectionsTest driver. -# This driver will be signalled by the DXE portion and will perform requested operations -# to probe the extent of the SMM memory protections (like NX). -# -## -# Copyright (C) Microsoft Corporation. All rights reserved. -## SPDX-License-Identifier: BSD-2-Clause-Patent -## - -# MS_CHANGE - Entire file created. - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = SmmPagingProtectionsTestStandaloneMm - FILE_GUID = E1A3A284-D6C7-4C44-B913-A460CC269DE2 - MODULE_TYPE = MM_STANDALONE - VERSION_STRING = 1.0 - PI_SPECIFICATION_VERSION = 0x00010032 - ENTRY_POINT = StandaloneMmPagingProtectionsTestEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - - -[Sources] - SmmPagingProtectionsTestDriver.c - SmmPagingProtectionsTestDriver.h - SmmPagingProtectionsTestStandaloneMm.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - UefiTestingPkg/UefiTestingPkg.dec - StandaloneMmPkg/StandaloneMmPkg.dec - -[LibraryClasses] - BaseLib - BaseMemoryLib - DebugLib - MemoryAllocationLib - MemLib - MmServicesTableLib - StandaloneMmDriverEntryPoint - PlatformSmmProtectionsTestLib - -[Protocols] - gSmmExceptionTestProtocolGuid ## CONSUMES - -[Depex] - gSmmExceptionTestProtocolGuid +## @file SmmPagingProtectionsTestSmm.inf +# This is the SMM portion of the SmmPagingProtectionsTest driver. +# This driver will be signalled by the DXE portion and will perform requested operations +# to probe the extent of the SMM memory protections (like NX). +# +## +# Copyright (C) Microsoft Corporation. All rights reserved. +## SPDX-License-Identifier: BSD-2-Clause-Patent +## + +# MS_CHANGE - Entire file created. + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SmmPagingProtectionsTestStandaloneMm + FILE_GUID = E1A3A284-D6C7-4C44-B913-A460CC269DE2 + MODULE_TYPE = MM_STANDALONE + VERSION_STRING = 1.0 + PI_SPECIFICATION_VERSION = 0x00010032 + ENTRY_POINT = StandaloneMmPagingProtectionsTestEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +[Sources] + SmmPagingProtectionsTestDriver.c + SmmPagingProtectionsTestDriver.h + SmmPagingProtectionsTestStandaloneMm.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + UefiTestingPkg/UefiTestingPkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + MemLib + MmServicesTableLib + StandaloneMmDriverEntryPoint + PlatformSmmProtectionsTestLib + +[Protocols] + gSmmExceptionTestProtocolGuid ## CONSUMES + +[Depex] + gSmmExceptionTestProtocolGuid diff --git a/UefiTestingPkg/Library/PlatformSmmProtectionsTestLibNull/PlatformSmmProtectionsTestLibNull.inf b/UefiTestingPkg/Library/PlatformSmmProtectionsTestLibNull/PlatformSmmProtectionsTestLibNull.inf index c966ebdf5a..38a7b5420b 100644 --- a/UefiTestingPkg/Library/PlatformSmmProtectionsTestLibNull/PlatformSmmProtectionsTestLibNull.inf +++ b/UefiTestingPkg/Library/PlatformSmmProtectionsTestLibNull/PlatformSmmProtectionsTestLibNull.inf @@ -1,24 +1,24 @@ -## @file -# Null Implementation of PlatformSmmProtectionsTestLib -# -# @copyright -# Copyright (C) 2016 Microsoft Corporation. -# -## - -[Defines] - INF_VERSION = 1.27 - BASE_NAME = PlatformSmmProtectionsTestLibNull - FILE_GUID = 95D58F5C-5A4A-486C-BD73-12901473BEC0 - VERSION_STRING = 1.0 - MODULE_TYPE = BASE - LIBRARY_CLASS = PlatformSmmProtectionsTestLib - -[LibraryClasses] - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[Sources] - PlatformSmmProtectionsTestLibNull.c +## @file +# Null Implementation of PlatformSmmProtectionsTestLib +# +# @copyright +# Copyright (C) 2016 Microsoft Corporation. +# +## + +[Defines] + INF_VERSION = 1.27 + BASE_NAME = PlatformSmmProtectionsTestLibNull + FILE_GUID = 95D58F5C-5A4A-486C-BD73-12901473BEC0 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = PlatformSmmProtectionsTestLib + +[LibraryClasses] + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[Sources] + PlatformSmmProtectionsTestLibNull.c diff --git a/UefiTestingPkg/PerfTests/BlockIoPerfTest/BlockIoPerfTest.inf b/UefiTestingPkg/PerfTests/BlockIoPerfTest/BlockIoPerfTest.inf index 0d85450a45..e5afced828 100644 --- a/UefiTestingPkg/PerfTests/BlockIoPerfTest/BlockIoPerfTest.inf +++ b/UefiTestingPkg/PerfTests/BlockIoPerfTest/BlockIoPerfTest.inf @@ -1,36 +1,36 @@ -## -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = BlockIoPerfTest - FILE_GUID = af87df79-d69d-4759-a7cb-124115a349cd - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 1.0 - ENTRY_POINT = TestMain - -[Sources] - BlockIoPerfTest.c - -[Packages] - MdePkg/MdePkg.dec - ShellPkg/ShellPkg.dec - XmlSupportPkg/XmlSupportPkg.dec - -[LibraryClasses] - BaseLib - UefiApplicationEntryPoint - DebugLib - ShellLib - UefiBootServicesTableLib - BaseMemoryLib - TimerLib - MemoryAllocationLib - UefiLib - DevicePathLib - -[Protocols] - gEfiBlockIoProtocolGuid - gEfiDevicePathProtocolGuid +## +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = BlockIoPerfTest + FILE_GUID = af87df79-d69d-4759-a7cb-124115a349cd + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = TestMain + +[Sources] + BlockIoPerfTest.c + +[Packages] + MdePkg/MdePkg.dec + ShellPkg/ShellPkg.dec + XmlSupportPkg/XmlSupportPkg.dec + +[LibraryClasses] + BaseLib + UefiApplicationEntryPoint + DebugLib + ShellLib + UefiBootServicesTableLib + BaseMemoryLib + TimerLib + MemoryAllocationLib + UefiLib + DevicePathLib + +[Protocols] + gEfiBlockIoProtocolGuid + gEfiDevicePathProtocolGuid diff --git a/UefiTestingPkg/Readme.md b/UefiTestingPkg/Readme.md index c3d0c7e987..c74edc3c5e 100644 --- a/UefiTestingPkg/Readme.md +++ b/UefiTestingPkg/Readme.md @@ -1,78 +1,78 @@ -# UEFI Testing Package - -## About - -This package adds tests. - -## System Functional tests - -Tests that invoke system functions and query system state for verification. - -### MemmapAndMatTestApp - -This test compares the UEFI memory map and Memory Attributes Table against known -requirements. The MAT has strict requirements to allow OS usage and page protections. - -### MorLockTestApp - -This test verifies the UEFI variable store handling of MorLock v1 and v2 behavior. - -### SmmPagingProtections - -This test verifies the SMM paging attributes by invoking operations that should cause cpu exceptions if the memory protections -are in place. The SMM cpu exception handler needs to be configured to force reset on trap to allow automated testing. -See `UefiCpuPkg/Include/Protocol/SmmExceptionTestProtocol.h`, `gUefiCpuPkgTokenSpaceGuid.PcdSmmExceptionRebootInsteadOfHaltDefault`, -and `gUefiCpuPkgTokenSpaceGuid.PcdSmmExceptionTestModeSupport`. - -## System Audit tests - -UEFI applications that collect data from the system and then that data can be used to -compare against known good values. - -### UefiVarLockAudit - -Audit collection tool that gathers information about UEFI variables. This allows -auditing the variables within a system, checking attributes, and confirming -read/write status. This information is put into an XML file that allows for -easy comparison and programmatic auditing. - -#### UEFI - -UEFI shell application that gets the current variable information from the UEFI -shell and creates an XML file. - -#### Windows (UEFI) - -Python script that can be run from the Windows OS. It takes the UEFI created -XML file as input and then queries all listed variables and updates the XML with -access and status codes. This gives additional verification for variables that -may employ late locking or other protections from OS access. - -### TpmEventLogAudit - -Audit tool to collect the TPM Event Log from the system in standard format. It can -then be programmatically compared against a known event log for the given system. Easy -this that can be tested are the number of events in some PCRs, confirm that all PCRs -should be capped, etc. - -### SMMPagingAudit - -Audit tool creates a human readable description of the SMM page tables and memory environment. - -#### App - -UEFI shell application collects information from SMM and writes it to files. - -#### SMM - -SMM Library linked into SMM driver used to collect information about SMM environment. Activated by the shell app collects -IDT, GDT, page tables, and loaded images. - -#### Windows (SMM) - -Python scripts that process the files generated by the UEFI app and output a report for verification and analysis. - -## Copyright - -Copyright (C) Microsoft Corporation. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent +# UEFI Testing Package + +## About + +This package adds tests. + +## System Functional tests + +Tests that invoke system functions and query system state for verification. + +### MemmapAndMatTestApp + +This test compares the UEFI memory map and Memory Attributes Table against known +requirements. The MAT has strict requirements to allow OS usage and page protections. + +### MorLockTestApp + +This test verifies the UEFI variable store handling of MorLock v1 and v2 behavior. + +### SmmPagingProtections + +This test verifies the SMM paging attributes by invoking operations that should cause cpu exceptions if the memory protections +are in place. The SMM cpu exception handler needs to be configured to force reset on trap to allow automated testing. +See `UefiCpuPkg/Include/Protocol/SmmExceptionTestProtocol.h`, `gUefiCpuPkgTokenSpaceGuid.PcdSmmExceptionRebootInsteadOfHaltDefault`, +and `gUefiCpuPkgTokenSpaceGuid.PcdSmmExceptionTestModeSupport`. + +## System Audit tests + +UEFI applications that collect data from the system and then that data can be used to +compare against known good values. + +### UefiVarLockAudit + +Audit collection tool that gathers information about UEFI variables. This allows +auditing the variables within a system, checking attributes, and confirming +read/write status. This information is put into an XML file that allows for +easy comparison and programmatic auditing. + +#### UEFI + +UEFI shell application that gets the current variable information from the UEFI +shell and creates an XML file. + +#### Windows (UEFI) + +Python script that can be run from the Windows OS. It takes the UEFI created +XML file as input and then queries all listed variables and updates the XML with +access and status codes. This gives additional verification for variables that +may employ late locking or other protections from OS access. + +### TpmEventLogAudit + +Audit tool to collect the TPM Event Log from the system in standard format. It can +then be programmatically compared against a known event log for the given system. Easy +this that can be tested are the number of events in some PCRs, confirm that all PCRs +should be capped, etc. + +### SMMPagingAudit + +Audit tool creates a human readable description of the SMM page tables and memory environment. + +#### App + +UEFI shell application collects information from SMM and writes it to files. + +#### SMM + +SMM Library linked into SMM driver used to collect information about SMM environment. Activated by the shell app collects +IDT, GDT, page tables, and loaded images. + +#### Windows (SMM) + +Python scripts that process the files generated by the UEFI app and output a report for verification and analysis. + +## Copyright + +Copyright (C) Microsoft Corporation. All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/XmlSupportPkg/Library/UnitTestResultReportJUnitFormatLib/UnitTestResultReportLib.inf b/XmlSupportPkg/Library/UnitTestResultReportJUnitFormatLib/UnitTestResultReportLib.inf index 62bad2b202..958d945fd1 100644 --- a/XmlSupportPkg/Library/UnitTestResultReportJUnitFormatLib/UnitTestResultReportLib.inf +++ b/XmlSupportPkg/Library/UnitTestResultReportJUnitFormatLib/UnitTestResultReportLib.inf @@ -1,45 +1,45 @@ -## @file -# Library to support outputting the unit test report in JUnit xml format to a file -# -# -# @copyright -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# @par Specification Reference: -# -## - - -[Defines] -INF_VERSION = 0x00010017 -BASE_NAME = UnitTestResultReportJUnitLogFileLib -FILE_GUID = 40726C0E-0B6D-4D85-9D14-03ABB6F94855 -VERSION_STRING = 1.0 -MODULE_TYPE = UEFI_APPLICATION -LIBRARY_CLASS = UnitTestResultReportLib|UEFI_APPLICATION - - -[LibraryClasses] - DebugLib - BaseLib - XmlTreeLib - ShellLib - MemoryAllocationLib - PrintLib - - -[Packages] - MdePkg/MdePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - XmlSupportPkg/XmlSupportPkg.dec - ShellPkg/ShellPkg.dec # shell lib for writing file - - -[Guids] - - -[Sources] - UnitTestResultReportLib.c - JUnitXmlSupport.c - JUnitXmlSupport.h +## @file +# Library to support outputting the unit test report in JUnit xml format to a file +# +# +# @copyright +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# @par Specification Reference: +# +## + + +[Defines] +INF_VERSION = 0x00010017 +BASE_NAME = UnitTestResultReportJUnitLogFileLib +FILE_GUID = 40726C0E-0B6D-4D85-9D14-03ABB6F94855 +VERSION_STRING = 1.0 +MODULE_TYPE = UEFI_APPLICATION +LIBRARY_CLASS = UnitTestResultReportLib|UEFI_APPLICATION + + +[LibraryClasses] + DebugLib + BaseLib + XmlTreeLib + ShellLib + MemoryAllocationLib + PrintLib + + +[Packages] + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + XmlSupportPkg/XmlSupportPkg.dec + ShellPkg/ShellPkg.dec # shell lib for writing file + + +[Guids] + + +[Sources] + UnitTestResultReportLib.c + JUnitXmlSupport.c + JUnitXmlSupport.h diff --git a/XmlSupportPkg/Library/XmlTreeLib/XmlTreeLib.inf b/XmlSupportPkg/Library/XmlTreeLib/XmlTreeLib.inf index f40a353b1d..127774631b 100644 --- a/XmlSupportPkg/Library/XmlTreeLib/XmlTreeLib.inf +++ b/XmlSupportPkg/Library/XmlTreeLib/XmlTreeLib.inf @@ -1,47 +1,47 @@ -## @file -# XmlTreeLib.inf -# -# Description: Library for parsing Extensible Markup Language (XML) data. -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = XmlTreeFasterLib #Uses FasterXml lib - FILE_GUID = 0812AF87-7D95-4E56-AC5E-B492EA5DEDD4 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = XmlTreeLib - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - XmlTreeLib.c - fasterxml/xmlerr.c - fasterxml/xml_fasterxml.c - fasterxml/xml_namespacemanager.c - fasterxml/xml_skiplist.c - fasterxml/xml_xmlstructure.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - -[LibraryClasses] - DebugLib - BaseMemoryLib - BaseLib - -[Protocols] - -[Guids] - -[BuildOptions] - # LLVM doesn't support pragma warning push/pop or disabling specific warnings via pragmas - # such pragma found in fasterxml/xml_fasterxml.c (prefast-related) +## @file +# XmlTreeLib.inf +# +# Description: Library for parsing Extensible Markup Language (XML) data. +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = XmlTreeFasterLib #Uses FasterXml lib + FILE_GUID = 0812AF87-7D95-4E56-AC5E-B492EA5DEDD4 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = XmlTreeLib + +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + XmlTreeLib.c + fasterxml/xmlerr.c + fasterxml/xml_fasterxml.c + fasterxml/xml_namespacemanager.c + fasterxml/xml_skiplist.c + fasterxml/xml_xmlstructure.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + +[LibraryClasses] + DebugLib + BaseMemoryLib + BaseLib + +[Protocols] + +[Guids] + +[BuildOptions] + # LLVM doesn't support pragma warning push/pop or disabling specific warnings via pragmas + # such pragma found in fasterxml/xml_fasterxml.c (prefast-related) GCC:*_*_*_CC_FLAGS = -Wno-unknown-pragmas \ No newline at end of file diff --git a/XmlSupportPkg/Library/XmlTreeQueryLib/XmlTreeQueryLib.inf b/XmlSupportPkg/Library/XmlTreeQueryLib/XmlTreeQueryLib.inf index cfbc581b2b..5930d50d1b 100644 --- a/XmlSupportPkg/Library/XmlTreeQueryLib/XmlTreeQueryLib.inf +++ b/XmlSupportPkg/Library/XmlTreeQueryLib/XmlTreeQueryLib.inf @@ -1,37 +1,37 @@ -## @file -# -# This library supports basic query functions on valid xml trees - -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = XmlTreeQueryLib - FILE_GUID = DC128BB6-0CB9-4AF7-9A01-4D9150C43446 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = XmlTreeQueryLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER - -# CONSTRUCTOR = NONE -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - XmlTreeQueryLib.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - -[LibraryClasses] - DebugLib - XmlTreeLib - DebugLib - BaseLib - +## @file +# +# This library supports basic query functions on valid xml trees + +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = XmlTreeQueryLib + FILE_GUID = DC128BB6-0CB9-4AF7-9A01-4D9150C43446 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = XmlTreeQueryLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER + +# CONSTRUCTOR = NONE +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + XmlTreeQueryLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + +[LibraryClasses] + DebugLib + XmlTreeLib + DebugLib + BaseLib + diff --git a/XmlSupportPkg/ReadMe.md b/XmlSupportPkg/ReadMe.md index af1bfa2792..8a4088dc96 100644 --- a/XmlSupportPkg/ReadMe.md +++ b/XmlSupportPkg/ReadMe.md @@ -1,50 +1,50 @@ -# Xml Support Package - -## About - -This package adds some limited XML support to the UEFI environment. Xml brings value in that there are -numerous, robust, readily available parsing solutions in nearly every environment, language, and -operating system. The UEFI support is limited in that it only supports ASCII strings and does not -support XSD, schema, namespaces, or other extensions to XML. - -### XmlTreeLib - -The XmlTreeLib is the cornerstone of this package. It provides functions for: - -* Reading and parsing XML strings into an XML node/tree structure -* Creating or altering xml nodes within a tree -* Writing xml nodes/trees to ASCII string -* Escaping and Un-Escaping strings - -### XmlTreeQueryLib - -The XmlTreeQueryLib provides very basic and simple query functions allowing code to interact -with the XmlTree to do things like: - -* Find the first child element node with a name equal to the parameter -* Find the first attribute node of a given element with a name equal to the parameter - -### UnitTestResultReportLib - -A UnitTestResultReportLib that formats the results in XML using the JUnit defined -schema. This instance allows the UEFI Unit Test Framework to integrate results with -existing tools and other frameworks. - -## Testing - -There are UEFI shell and host based unit tests for each library. These tests attempt -to verify basic functionality of publicly defined functions. Check the **Test/UnitTest** -folder at the root of the package for more details. - -## Developer Notes - -* These libraries have known limitations and have not been fully vetted for un-trusted input. -If used in such a situation it is suggested to validate the input before leveraging -the XML libraries. With that said the ability to use xml in UEFI has been invaluable for -building features and tests that interact with code running in other environments. -* The parser has been tuned to fail fast and when invalid XML encountered just return NULL. - -## Copyright - -Copyright (C) Microsoft Corporation. -SPDX-License-Identifier: BSD-2-Clause-Patent +# Xml Support Package + +## About + +This package adds some limited XML support to the UEFI environment. Xml brings value in that there are +numerous, robust, readily available parsing solutions in nearly every environment, language, and +operating system. The UEFI support is limited in that it only supports ASCII strings and does not +support XSD, schema, namespaces, or other extensions to XML. + +### XmlTreeLib + +The XmlTreeLib is the cornerstone of this package. It provides functions for: + +* Reading and parsing XML strings into an XML node/tree structure +* Creating or altering xml nodes within a tree +* Writing xml nodes/trees to ASCII string +* Escaping and Un-Escaping strings + +### XmlTreeQueryLib + +The XmlTreeQueryLib provides very basic and simple query functions allowing code to interact +with the XmlTree to do things like: + +* Find the first child element node with a name equal to the parameter +* Find the first attribute node of a given element with a name equal to the parameter + +### UnitTestResultReportLib + +A UnitTestResultReportLib that formats the results in XML using the JUnit defined +schema. This instance allows the UEFI Unit Test Framework to integrate results with +existing tools and other frameworks. + +## Testing + +There are UEFI shell and host based unit tests for each library. These tests attempt +to verify basic functionality of publicly defined functions. Check the **Test/UnitTest** +folder at the root of the package for more details. + +## Developer Notes + +* These libraries have known limitations and have not been fully vetted for un-trusted input. +If used in such a situation it is suggested to validate the input before leveraging +the XML libraries. With that said the ability to use xml in UEFI has been invaluable for +building features and tests that interact with code running in other environments. +* The parser has been tuned to fail fast and when invalid XML encountered just return NULL. + +## Copyright + +Copyright (C) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent diff --git a/XmlSupportPkg/Test/UnitTest/XmlTreeLib/XmlTreeLibUnitTestsHost.inf b/XmlSupportPkg/Test/UnitTest/XmlTreeLib/XmlTreeLibUnitTestsHost.inf index 977c38be5f..c6c8772a63 100644 --- a/XmlSupportPkg/Test/UnitTest/XmlTreeLib/XmlTreeLibUnitTestsHost.inf +++ b/XmlSupportPkg/Test/UnitTest/XmlTreeLib/XmlTreeLibUnitTestsHost.inf @@ -1,47 +1,47 @@ -## @file -# Host based Application that Unit Tests the XmlTreeLib -# this includes parsing Xml, printing Xml, escaping and removing escape sequences for xml strings. -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = XmlTreeLibUnitTestApp - FILE_GUID = 3a8af353-f2a7-4c53-8ac3-1953dc60b429 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - XmlTreeLibUnitTests.c - TestData.h - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - - -[LibraryClasses] - BaseLib - MemoryAllocationLib - XmlTreeLib - UnitTestLib - PrintLib - -[Protocols] - -[Guids] - -[FeaturePcd] - -[Pcd] - +## @file +# Host based Application that Unit Tests the XmlTreeLib +# this includes parsing Xml, printing Xml, escaping and removing escape sequences for xml strings. +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = XmlTreeLibUnitTestApp + FILE_GUID = 3a8af353-f2a7-4c53-8ac3-1953dc60b429 + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + XmlTreeLibUnitTests.c + TestData.h + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + + +[LibraryClasses] + BaseLib + MemoryAllocationLib + XmlTreeLib + UnitTestLib + PrintLib + +[Protocols] + +[Guids] + +[FeaturePcd] + +[Pcd] + diff --git a/XmlSupportPkg/Test/UnitTest/XmlTreeQueryLib/XmlTreeQueryLibUnitTestsHost.inf b/XmlSupportPkg/Test/UnitTest/XmlTreeQueryLib/XmlTreeQueryLibUnitTestsHost.inf index c7c8760237..18484ff507 100644 --- a/XmlSupportPkg/Test/UnitTest/XmlTreeQueryLib/XmlTreeQueryLibUnitTestsHost.inf +++ b/XmlSupportPkg/Test/UnitTest/XmlTreeQueryLib/XmlTreeQueryLibUnitTestsHost.inf @@ -1,49 +1,49 @@ -## @file -# Host based Application that Unit Tests the XmlTreeQueryLib -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = XmlTreeQueryLibUnitTest - FILE_GUID = b356f888-e427-4abe-95b7-4b2b1b7699dc - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - XmlTreeQueryLibUnitTests.c - AttributeTests.c - ElementTests.c - XmlTreeQueryLibUnitTests.h - - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - XmlSupportPkg/XmlSupportPkg.dec - - -[LibraryClasses] - BaseLib - MemoryAllocationLib - XmlTreeLib - XmlTreeQueryLib - UnitTestLib - PrintLib - -[Protocols] - -[Guids] - -[FeaturePcd] - -[Pcd] - +## @file +# Host based Application that Unit Tests the XmlTreeQueryLib +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = XmlTreeQueryLibUnitTest + FILE_GUID = b356f888-e427-4abe-95b7-4b2b1b7699dc + MODULE_TYPE = HOST_APPLICATION + VERSION_STRING = 1.0 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + XmlTreeQueryLibUnitTests.c + AttributeTests.c + ElementTests.c + XmlTreeQueryLibUnitTests.h + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + XmlSupportPkg/XmlSupportPkg.dec + + +[LibraryClasses] + BaseLib + MemoryAllocationLib + XmlTreeLib + XmlTreeQueryLib + UnitTestLib + PrintLib + +[Protocols] + +[Guids] + +[FeaturePcd] + +[Pcd] + diff --git a/XmlSupportPkg/Test/XmlSupportPkgHostTest.dsc b/XmlSupportPkg/Test/XmlSupportPkgHostTest.dsc index 07a32f2844..123b722890 100644 --- a/XmlSupportPkg/Test/XmlSupportPkgHostTest.dsc +++ b/XmlSupportPkg/Test/XmlSupportPkgHostTest.dsc @@ -1,35 +1,35 @@ -## @file -# -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - PLATFORM_NAME = XmlSupportPkgHostTest - PLATFORM_GUID = f826100e-74e8-4dce-bb47-2c2d9afd45a0 - PLATFORM_VERSION = 0.1 - DSC_SPECIFICATION = 0x00010005 - OUTPUT_DIRECTORY = Build/XmlSupportPkg/HostTest - SUPPORTED_ARCHITECTURES = IA32|X64 - BUILD_TARGETS = NOOPT - SKUID_IDENTIFIER = DEFAULT - -!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc - -[LibraryClasses] - - XmlTreeLib|XmlSupportPkg/Library/XmlTreeLib/XmlTreeLib.inf - XmlTreeQueryLib|XmlSupportPkg/Library/XmlTreeQueryLib/XmlTreeQueryLib.inf - -[Components] - # - # Build HOST_APPLICATION that tests the SampleUnitTest - # - XmlSupportPkg/Test/UnitTest/XmlTreeLib/XmlTreeLibUnitTestsHost.inf - XmlSupportPkg/Test/UnitTest/XmlTreeQueryLib/XmlTreeQueryLibUnitTestsHost.inf { - - #Turn off Halt on Assert and Print Assert so that libraries can - #be tested in more of a release mode environment - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0E - } +## @file +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME = XmlSupportPkgHostTest + PLATFORM_GUID = f826100e-74e8-4dce-bb47-2c2d9afd45a0 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/XmlSupportPkg/HostTest + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = NOOPT + SKUID_IDENTIFIER = DEFAULT + +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc + +[LibraryClasses] + + XmlTreeLib|XmlSupportPkg/Library/XmlTreeLib/XmlTreeLib.inf + XmlTreeQueryLib|XmlSupportPkg/Library/XmlTreeQueryLib/XmlTreeQueryLib.inf + +[Components] + # + # Build HOST_APPLICATION that tests the SampleUnitTest + # + XmlSupportPkg/Test/UnitTest/XmlTreeLib/XmlTreeLibUnitTestsHost.inf + XmlSupportPkg/Test/UnitTest/XmlTreeQueryLib/XmlTreeQueryLibUnitTestsHost.inf { + + #Turn off Halt on Assert and Print Assert so that libraries can + #be tested in more of a release mode environment + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0E + } diff --git a/XmlSupportPkg/XmlSupportPkg.ci.yaml b/XmlSupportPkg/XmlSupportPkg.ci.yaml index ad6dd9b306..8dfedb95dd 100644 --- a/XmlSupportPkg/XmlSupportPkg.ci.yaml +++ b/XmlSupportPkg/XmlSupportPkg.ci.yaml @@ -1,101 +1,101 @@ -## -# CI configuration for XmlSupportPkg -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -{ - ## options defined .pytool/Plugin/CompilerPlugin - "CompilerPlugin": { - "DscPath": "XmlSupportPkg.dsc" - }, - ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin - "HostUnitTestCompilerPlugin": { - "DscPath": "Test/XmlSupportPkgHostTest.dsc" - }, - ## options defined .pytool/Plugin/CharEncodingCheck - "CharEncodingCheck": { - "IgnoreFiles": [] - }, - - ## options defined .pytool/Plugin/DependencyCheck - "DependencyCheck": { - "AcceptableDependencies": [ - "MdePkg/MdePkg.dec", - "MdeModulePkg/MdeModulePkg.dec", - "XmlSupportPkg/XmlSupportPkg.dec", - "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" - ], - "AcceptableDependencies-HOST_APPLICATION":[ # for host based unit tests - "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" - ], - "AcceptableDependencies-UEFI_APPLICATION": [ - "ShellPkg/ShellPkg.dec" - ], - "IgnoreInf": [] - }, - - ## options defined .pytool/Plugin/DscCompleteCheck - "DscCompleteCheck": { - "IgnoreInf": [], - "DscPath": "XmlSupportPkg.dsc" - }, - ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck - "HostUnitTestDscCompleteCheck": { - "IgnoreInf": [], - "DscPath": "Test/XmlSupportPkgHostTest.dsc" - }, - ## options defined .pytool/Plugin/GuidCheck - "GuidCheck": { - "IgnoreGuidName": [], - "IgnoreGuidValue": [], - "IgnoreFoldersAndFiles": [], - "IgnoreDuplicates": [] - }, - - ## options defined .pytool/Plugin/LibraryClassCheck - "LibraryClassCheck": { - "IgnoreLibraryClass": [], - "IgnoreHeaderFile": [] - }, - - ## options defined .pytool/Plugin/SpellCheck - "SpellCheck": { - # Fails test but run in AuditOnly mode to collect log - "AuditOnly": False, - "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore - ], - "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files - ], - "ExtendWords": [ # words to extend to the dictionary for this package - "PCXML", # A bunch of stuff from XML lib. - "XMLEF", - "PCVOID", - "NTXMLTRANSFORMCHARACTER", - "NTXMLRAWNEXTCHARACTER", - "NTXMLFETCHCHARACTERDECODER", - "NTXMLSPECIALSTRINGCOMPARE", - "NTXMLCOMPARESTRINGS", - "PXMLSTRUCTURE", - "RTLXMLCALLBACK", - "NTXML", - "PCXMLDOC", - "PCENCODER", - "PCUNICODE", - "PCXMLSTRUCTURE", - "PVOID", - "PXMLDOC", - "PLUTF", - "PCLUTF", - "Upcase", - "fasterxml", - "namespacemanager", - "prefast", - "xmlstructure", - "xmldsig", - "junit", - "nofailure" - ], - "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) - } +## +# CI configuration for XmlSupportPkg +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + ## options defined .pytool/Plugin/CompilerPlugin + "CompilerPlugin": { + "DscPath": "XmlSupportPkg.dsc" + }, + ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin + "HostUnitTestCompilerPlugin": { + "DscPath": "Test/XmlSupportPkgHostTest.dsc" + }, + ## options defined .pytool/Plugin/CharEncodingCheck + "CharEncodingCheck": { + "IgnoreFiles": [] + }, + + ## options defined .pytool/Plugin/DependencyCheck + "DependencyCheck": { + "AcceptableDependencies": [ + "MdePkg/MdePkg.dec", + "MdeModulePkg/MdeModulePkg.dec", + "XmlSupportPkg/XmlSupportPkg.dec", + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" + ], + "AcceptableDependencies-HOST_APPLICATION":[ # for host based unit tests + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" + ], + "AcceptableDependencies-UEFI_APPLICATION": [ + "ShellPkg/ShellPkg.dec" + ], + "IgnoreInf": [] + }, + + ## options defined .pytool/Plugin/DscCompleteCheck + "DscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "XmlSupportPkg.dsc" + }, + ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck + "HostUnitTestDscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "Test/XmlSupportPkgHostTest.dsc" + }, + ## options defined .pytool/Plugin/GuidCheck + "GuidCheck": { + "IgnoreGuidName": [], + "IgnoreGuidValue": [], + "IgnoreFoldersAndFiles": [], + "IgnoreDuplicates": [] + }, + + ## options defined .pytool/Plugin/LibraryClassCheck + "LibraryClassCheck": { + "IgnoreLibraryClass": [], + "IgnoreHeaderFile": [] + }, + + ## options defined .pytool/Plugin/SpellCheck + "SpellCheck": { + # Fails test but run in AuditOnly mode to collect log + "AuditOnly": False, + "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore + ], + "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files + ], + "ExtendWords": [ # words to extend to the dictionary for this package + "PCXML", # A bunch of stuff from XML lib. + "XMLEF", + "PCVOID", + "NTXMLTRANSFORMCHARACTER", + "NTXMLRAWNEXTCHARACTER", + "NTXMLFETCHCHARACTERDECODER", + "NTXMLSPECIALSTRINGCOMPARE", + "NTXMLCOMPARESTRINGS", + "PXMLSTRUCTURE", + "RTLXMLCALLBACK", + "NTXML", + "PCXMLDOC", + "PCENCODER", + "PCUNICODE", + "PCXMLSTRUCTURE", + "PVOID", + "PXMLDOC", + "PLUTF", + "PCLUTF", + "Upcase", + "fasterxml", + "namespacemanager", + "prefast", + "xmlstructure", + "xmldsig", + "junit", + "nofailure" + ], + "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) + } } \ No newline at end of file diff --git a/XmlSupportPkg/XmlSupportPkg.dec b/XmlSupportPkg/XmlSupportPkg.dec index f8befba0ef..dd18050dc1 100644 --- a/XmlSupportPkg/XmlSupportPkg.dec +++ b/XmlSupportPkg/XmlSupportPkg.dec @@ -1,25 +1,25 @@ -## @file -# This package provides EDKII XML support. -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - - -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = XmlSupportPkg - PACKAGE_GUID = 6A252D3B-CBF1-4F90-A4F6-5729A936F4B3 - PACKAGE_VERSION = 0.1 - -[Includes] - Include - -[LibraryClasses] - ## @libraryclass Provides basic services for working with XML - # - XmlTreeLib|Include/Library/XmlTreeLib.h - - ## @libraryclass Provides query services for XML - # - XmlTreeQueryLib|Include/Library/XmlTreeQueryLib.h +## @file +# This package provides EDKII XML support. +# +# Copyright (C) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = XmlSupportPkg + PACKAGE_GUID = 6A252D3B-CBF1-4F90-A4F6-5729A936F4B3 + PACKAGE_VERSION = 0.1 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Provides basic services for working with XML + # + XmlTreeLib|Include/Library/XmlTreeLib.h + + ## @libraryclass Provides query services for XML + # + XmlTreeQueryLib|Include/Library/XmlTreeQueryLib.h diff --git a/ZeroTouchPkg/ZeroTouchPkg.ci.yaml b/ZeroTouchPkg/ZeroTouchPkg.ci.yaml index f770b96946..8985540092 100644 --- a/ZeroTouchPkg/ZeroTouchPkg.ci.yaml +++ b/ZeroTouchPkg/ZeroTouchPkg.ci.yaml @@ -1,60 +1,60 @@ -## -# CI configuration for ZeroTouchPkg -# -# Copyright (c) Microsoft Corporation -# SPDX-License-Identifier: BSD-2-Clause-Patent -## -{ - ## options defined ci/Plugin/CompilerPlugin - "CompilerPlugin": { - "DscPath": "ZeroTouchPkg.dsc" - }, - - ## options defined ci/Plugin/CharEncodingCheck - "CharEncodingCheck": { - "IgnoreFiles": [] - }, - - ## options defined ci/Plugin/DependencyCheck - "DependencyCheck": { - "AcceptableDependencies": [ - "MdePkg/MdePkg.dec", - "MdeModulePkg/MdeModulePkg.dec", - "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec", - "ZeroTouchPkg/ZeroTouchPkg.dec" - ], - "IgnoreInf": [] - }, - - ## options defined ci/Plugin/DscCompleteCheck - "DscCompleteCheck": { - "IgnoreInf": [], - "DscPath": "ZeroTouchPkg.dsc" - }, - - ## options defined ci/Plugin/GuidCheck - "GuidCheck": { - "IgnoreGuidName": [], - "IgnoreGuidValue": [], - "IgnoreFoldersAndFiles": [], - "IgnoreDuplicates": [] - }, - - ## options defined ci/Plugin/LibraryClassCheck - "LibraryClassCheck": { - "IgnoreLibraryClass": [], - "IgnoreHeaderFile": [] - }, - - ## options defined ci/Plugin/SpellCheck - "SpellCheck": { - "AuditOnly": True, # Fails test but run in AuditOnly mode to collect log - "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore - ], - "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files - ], - "ExtendWords": [ # words to extend to the dictionary for this package - ], - "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) - } +## +# CI configuration for ZeroTouchPkg +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + ## options defined ci/Plugin/CompilerPlugin + "CompilerPlugin": { + "DscPath": "ZeroTouchPkg.dsc" + }, + + ## options defined ci/Plugin/CharEncodingCheck + "CharEncodingCheck": { + "IgnoreFiles": [] + }, + + ## options defined ci/Plugin/DependencyCheck + "DependencyCheck": { + "AcceptableDependencies": [ + "MdePkg/MdePkg.dec", + "MdeModulePkg/MdeModulePkg.dec", + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec", + "ZeroTouchPkg/ZeroTouchPkg.dec" + ], + "IgnoreInf": [] + }, + + ## options defined ci/Plugin/DscCompleteCheck + "DscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "ZeroTouchPkg.dsc" + }, + + ## options defined ci/Plugin/GuidCheck + "GuidCheck": { + "IgnoreGuidName": [], + "IgnoreGuidValue": [], + "IgnoreFoldersAndFiles": [], + "IgnoreDuplicates": [] + }, + + ## options defined ci/Plugin/LibraryClassCheck + "LibraryClassCheck": { + "IgnoreLibraryClass": [], + "IgnoreHeaderFile": [] + }, + + ## options defined ci/Plugin/SpellCheck + "SpellCheck": { + "AuditOnly": True, # Fails test but run in AuditOnly mode to collect log + "IgnoreStandardPaths": [ # Standard Plugin defined paths that should be ignore + ], + "IgnoreFiles": [ # use gitignore syntax to ignore errors in matching files + ], + "ExtendWords": [ # words to extend to the dictionary for this package + ], + "AdditionalIncludePaths": [] # Additional paths to spell check relative to package root (wildcards supported) + } } \ No newline at end of file diff --git a/ZeroTouchPkg/ZeroTouchPkg.dec b/ZeroTouchPkg/ZeroTouchPkg.dec index 8ccb05c01d..8b3e3215ed 100644 --- a/ZeroTouchPkg/ZeroTouchPkg.dec +++ b/ZeroTouchPkg/ZeroTouchPkg.dec @@ -1,56 +1,56 @@ -## @file -# ZeroTouchPkg.dec -# -# This Package provides all definitions, library classes and libraries instances for ZeroTouch. -# ZeroTouch is common code used in the Microsoft UEFI Core code base -# -# This is targetted at promoting to open source and should be aligned with -# Tianocore standards -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - DEC_SPECIFICATION = 0x00010005 - PACKAGE_NAME = ZeroTouchPkg - PACKAGE_UNI_FILE = ZeroTouchPkg.uni - PACKAGE_GUID = 80061278-f44e-45b5-be81-1acc13362a7e - PACKAGE_VERSION = 0.20 - -[Includes] - Include - -[LibraryClasses] - ## @libraryclass Library to used to obtain the zero touch certificate - ## - ZeroTouchSettingsLib|Include/Library/ZeroTouchSettingsLib.h - -[Guids] - ## ZeroTouch Package token space guid - # Include/Guid/ZeroTouchTokenSpace.h - # { 353455c8-b2ec-44f3-91cf-0f7633c2de6b } - gZeroTouchPkgTokenSpaceGuid = { 0x353455c8, 0xb2ec, 0x44f3, { 0x91, 0xcf, 0x0f, 0x76, 0x33, 0xc2, 0xde, 0x6b } } - - ## Zero Touch Variable GUID - # Include/Guid/ZeroTouchVariables.h - # { be023d3e-5f0e-4ce0-805c-06b70aa24fe7 } - gZeroTouchVariableGuid = { 0xbe023d3e, 0x5f0e, 0x4ce0, { 0x80, 0x5c, 0x06, 0xb7, 0x0a, 0xa2, 0x4f, 0xe7 }} - -[Ppis] - -[Protocols] - -[PcdsFeatureFlag] - -[PcdsFixedAtBuild] - ## FFS filename of the Zero Touch certificate file. - # {ba8e0276-1ec6-4eac-b78f-612fe7694438 ae2d011c-4128-4960-a536-b424ccc3d1ea} - gZeroTouchPkgTokenSpaceGuid.PcdZeroTouchCertificateFile |{ 0x76, 0x02, 0x8e, 0xba, 0xc6, 0x1e, 0xac, 0x4e, 0xb7, 0x8f, 0x61, 0x2f, 0xe7, 0x69, 0x44, 0x38 }|VOID*|0x10000001 - -[PcdsFixedAtBuild, PcdsPatchableInModule] - -[PcdsDynamic, PcdsDynamicEx] - -[UserExtensions.TianoCore."ExtraFiles"] - ZeroTouchPkgExtra.uni +## @file +# ZeroTouchPkg.dec +# +# This Package provides all definitions, library classes and libraries instances for ZeroTouch. +# ZeroTouch is common code used in the Microsoft UEFI Core code base +# +# This is targetted at promoting to open source and should be aligned with +# Tianocore standards +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = ZeroTouchPkg + PACKAGE_UNI_FILE = ZeroTouchPkg.uni + PACKAGE_GUID = 80061278-f44e-45b5-be81-1acc13362a7e + PACKAGE_VERSION = 0.20 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Library to used to obtain the zero touch certificate + ## + ZeroTouchSettingsLib|Include/Library/ZeroTouchSettingsLib.h + +[Guids] + ## ZeroTouch Package token space guid + # Include/Guid/ZeroTouchTokenSpace.h + # { 353455c8-b2ec-44f3-91cf-0f7633c2de6b } + gZeroTouchPkgTokenSpaceGuid = { 0x353455c8, 0xb2ec, 0x44f3, { 0x91, 0xcf, 0x0f, 0x76, 0x33, 0xc2, 0xde, 0x6b } } + + ## Zero Touch Variable GUID + # Include/Guid/ZeroTouchVariables.h + # { be023d3e-5f0e-4ce0-805c-06b70aa24fe7 } + gZeroTouchVariableGuid = { 0xbe023d3e, 0x5f0e, 0x4ce0, { 0x80, 0x5c, 0x06, 0xb7, 0x0a, 0xa2, 0x4f, 0xe7 }} + +[Ppis] + +[Protocols] + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild] + ## FFS filename of the Zero Touch certificate file. + # {ba8e0276-1ec6-4eac-b78f-612fe7694438 ae2d011c-4128-4960-a536-b424ccc3d1ea} + gZeroTouchPkgTokenSpaceGuid.PcdZeroTouchCertificateFile |{ 0x76, 0x02, 0x8e, 0xba, 0xc6, 0x1e, 0xac, 0x4e, 0xb7, 0x8f, 0x61, 0x2f, 0xe7, 0x69, 0x44, 0x38 }|VOID*|0x10000001 + +[PcdsFixedAtBuild, PcdsPatchableInModule] + +[PcdsDynamic, PcdsDynamicEx] + +[UserExtensions.TianoCore."ExtraFiles"] + ZeroTouchPkgExtra.uni diff --git a/ZeroTouchPkg/ZeroTouchPkg.dsc b/ZeroTouchPkg/ZeroTouchPkg.dsc index b1efe7164f..9930447a00 100644 --- a/ZeroTouchPkg/ZeroTouchPkg.dsc +++ b/ZeroTouchPkg/ZeroTouchPkg.dsc @@ -1,58 +1,58 @@ -## @file -# ZeroTouchPkg.dsc -# ZeroTouch Package Localized Strings and Content -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - PLATFORM_NAME = ZeroTouch - PLATFORM_GUID = 709fa506-3f3b-4ea3-9622-453c3881e8a3 - PLATFORM_VERSION = .10 - DSC_SPECIFICATION = 0x00010005 - OUTPUT_DIRECTORY = Build/ZeroTouchPkg - SUPPORTED_ARCHITECTURES = IA32|X64 - BUILD_TARGETS = DEBUG|RELEASE - SKUID_IDENTIFIER = DEFAULT - -[PcdsFeatureFlag] - -[PcdsFixedAtBuild] - -[LibraryClasses.common] - -[LibraryClasses.IA32] - -[LibraryClasses.X64, LibraryClasses.AARCH64] - ZeroTouchSettingsLib|ZeroTouchPkg/Library/ZeroTouchSettings/ZeroTouchSettings.inf - -################################################################################################### -# -# Components Section - list of the modules and components that will be processed by compilation -# tools and the EDK II tools to generate PE32/PE32+/Coff image files. -# -# Note: The EDK II DSC file is not used to specify how compiled binary images get placed -# into firmware volume images. This section is just a list of modules to compile from -# source into UEFI-compliant binaries. -# It is the FDF file that contains information on combining binary files into firmware -# volume images, whose concept is beyond UEFI and is described in PI specification. -# Binary modules do not need to be listed in this section, as they should be -# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi), -# Logo (Logo.bmp), and etc. -# There may also be modules listed in this section that are not required in the FDF file, -# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be -# generated for it, but the binary will not be put into any firmware volume. -# -################################################################################################### - -[Components] - -[Components.IA32] - -[Components.X64, Components.AARCH64] - ZeroTouchPkg/Library/ZeroTouchSettings/ZeroTouchSettings.inf - -[BuildOptions] -#force deprecated interfaces off - *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES +## @file +# ZeroTouchPkg.dsc +# ZeroTouch Package Localized Strings and Content +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + PLATFORM_NAME = ZeroTouch + PLATFORM_GUID = 709fa506-3f3b-4ea3-9622-453c3881e8a3 + PLATFORM_VERSION = .10 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/ZeroTouchPkg + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + +[PcdsFeatureFlag] + +[PcdsFixedAtBuild] + +[LibraryClasses.common] + +[LibraryClasses.IA32] + +[LibraryClasses.X64, LibraryClasses.AARCH64] + ZeroTouchSettingsLib|ZeroTouchPkg/Library/ZeroTouchSettings/ZeroTouchSettings.inf + +################################################################################################### +# +# Components Section - list of the modules and components that will be processed by compilation +# tools and the EDK II tools to generate PE32/PE32+/Coff image files. +# +# Note: The EDK II DSC file is not used to specify how compiled binary images get placed +# into firmware volume images. This section is just a list of modules to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary files into firmware +# volume images, whose concept is beyond UEFI and is described in PI specification. +# Binary modules do not need to be listed in this section, as they should be +# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi), +# Logo (Logo.bmp), and etc. +# There may also be modules listed in this section that are not required in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be +# generated for it, but the binary will not be put into any firmware volume. +# +################################################################################################### + +[Components] + +[Components.IA32] + +[Components.X64, Components.AARCH64] + ZeroTouchPkg/Library/ZeroTouchSettings/ZeroTouchSettings.inf + +[BuildOptions] +#force deprecated interfaces off + *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/ZeroTouchPkg/ZeroTouchPkg.uni b/ZeroTouchPkg/ZeroTouchPkg.uni index 2f7fc6be88..3df3de07ee 100644 --- a/ZeroTouchPkg/ZeroTouchPkg.uni +++ b/ZeroTouchPkg/ZeroTouchPkg.uni @@ -1,16 +1,16 @@ -// /** @file -// This Package provides all definitions, library classes and libraries instances. -// for ZeroTouch. -// -// MsZeroTouch is common code used in the Microsoft UEFI Core code base -// This is targetted at promoting to open source and should be aligned with -// Tianocore standards -// -// Copyright (C) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - -#string STR_PACKAGE_ABSTRACT #language en-US "This Package provides all definitions, library classes and libraries instances for ZeroTouch." - +// /** @file +// This Package provides all definitions, library classes and libraries instances. +// for ZeroTouch. +// +// MsZeroTouch is common code used in the Microsoft UEFI Core code base +// This is targetted at promoting to open source and should be aligned with +// Tianocore standards +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PACKAGE_ABSTRACT #language en-US "This Package provides all definitions, library classes and libraries instances for ZeroTouch." + #string STR_PACKAGE_DESCRIPTION #language en-US "ZeroTouch is common code used in the Microsoft UEFI Core code base" \ No newline at end of file diff --git a/ZeroTouchPkg/ZeroTouchPkgExtra.uni b/ZeroTouchPkg/ZeroTouchPkgExtra.uni index 42abcb6708..f42d2437ce 100644 --- a/ZeroTouchPkg/ZeroTouchPkgExtra.uni +++ b/ZeroTouchPkg/ZeroTouchPkgExtra.uni @@ -1,11 +1,11 @@ -## @file -# ZeroTouch Package Localized Strings and Content -# -# Copyright (C) Microsoft Corporation. All rights reserved. -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -#string STR_PROPERTIES_PACKAGE_NAME -#language en-US -"ZeroTouch Package" +## @file +# ZeroTouch Package Localized Strings and Content +# +# Copyright (C) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +#string STR_PROPERTIES_PACKAGE_NAME +#language en-US +"ZeroTouch Package"