-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the fuzzing test for Traversing SignatureList.
Signed-off-by: Zhao, Zhiqiang <[email protected]>
- Loading branch information
1 parent
07eddcd
commit ead8f4f
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
49 changes: 49 additions & 0 deletions
49
.../UefiHostFuzzTestCasePkg/TestCase/DeviceSecurityPkg/TestSignatureList/TestSignatureList.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** @file | ||
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <assert.h> | ||
|
||
#include <Uefi.h> | ||
|
||
#include <Library/BaseLib.h> | ||
#include <Library/DebugLib.h> | ||
#include <Library/BaseMemoryLib.h> | ||
#include <Library/MemoryAllocationLib.h> | ||
#include <Library/BaseCryptLib.h> | ||
|
||
#define TOTAL_SIZE (512 * 1024) | ||
/* 384 kB */ | ||
#define MAX_LEN (384 * 1024) | ||
|
||
VOID | ||
FixBuffer ( | ||
UINT8 *TestBuffer | ||
) | ||
{ | ||
} | ||
|
||
UINTN | ||
EFIAPI | ||
GetMaxBufferSize ( | ||
VOID | ||
) | ||
{ | ||
return TOTAL_SIZE; | ||
} | ||
|
||
VOID | ||
EFIAPI | ||
RunTestHarness( | ||
IN VOID *TestBuffer, | ||
IN UINTN TestBufferSize | ||
) | ||
{ | ||
Traverse_SignatureList(TestBuffer, TestBufferSize); | ||
} |
44 changes: 44 additions & 0 deletions
44
...efiHostFuzzTestCasePkg/TestCase/DeviceSecurityPkg/TestSignatureList/TestSignatureList.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
## @file | ||
# SPDM library. | ||
# | ||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = TestSignatureList | ||
FILE_GUID = 77D7770D-158E-4354-B813-B8792A0E982F | ||
MODULE_TYPE = USER_DEFINED | ||
VERSION_STRING = 1.0 | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 AARCH64 | ||
# | ||
|
||
[Sources] | ||
TestSignatureList.c | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
MdeModulePkg/MdeModulePkg.dec | ||
DeviceSecurityPkg/DeviceSecurityPkg.dec | ||
CryptoPkg/CryptoPkg.dec | ||
UefiHostTestPkg/UefiHostTestPkg.dec | ||
|
||
[LibraryClasses] | ||
BaseLib | ||
BaseMemoryLib | ||
DebugLib | ||
RngLib | ||
MemoryAllocationLib | ||
ToolChainHarnessLib | ||
TestSignListLib | ||
|
||
[Guids] | ||
gEdkiiDeviceSignatureDatabaseGuid ## CONSUMES | ||
gEfiCertX509Guid ## CONSUMES |
83 changes: 83 additions & 0 deletions
83
HBFA/UefiHostFuzzTestCasePkg/UefiHostFuzzTestDeviceSecurityPkg.dsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
## @file UefiHostFuzzTestCasePkg | ||
# | ||
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
PLATFORM_NAME = UefiHostFuzzTestDeviceSecurityPkg | ||
PLATFORM_GUID = 9497CEE4-EEEB-4B38-B0EF-03E01920F042 | ||
PLATFORM_VERSION = 0.1 | ||
DSC_SPECIFICATION = 0x00010005 | ||
OUTPUT_DIRECTORY = Build/UefiHostFuzzTestDeviceSecurityPkg | ||
SUPPORTED_ARCHITECTURES = IA32|X64 | ||
BUILD_TARGETS = DEBUG|RELEASE|NOOPT | ||
SKUID_IDENTIFIER = DEFAULT | ||
|
||
DEFINE TEST_WITH_INSTRUMENT = FALSE | ||
|
||
[LibraryClasses] | ||
BaseLib|UefiHostTestPkg/Library/BaseLibHost/BaseLibHost.inf | ||
BaseMemoryLib|UefiHostTestPkg/Library/BaseMemoryLibHost/BaseMemoryLibHost.inf | ||
MemoryAllocationLib|UefiHostTestPkg/Library/MemoryAllocationLibHost/MemoryAllocationLibHost.inf | ||
DebugLib|UefiHostTestPkg/Library/DebugLibHost/DebugLibHost.inf | ||
UefiBootServicesTableLib|UefiHostTestPkg/Library/UefiBootServicesTableLibHost/UefiBootServicesTableLibHost.inf | ||
DevicePathLib|UefiHostTestPkg/Library/UefiDevicePathLibHost/UefiDevicePathLibHost.inf | ||
DxeServicesTableLib|UefiHostTestPkg/Library/DxeServicesTableLibHost/DxeServicesTableLibHost.inf | ||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf | ||
SmmServicesTableLib|UefiHostTestPkg/Library/SmmServicesTableLibHost/SmmServicesTableLibHost.inf | ||
MmServicesTableLib|UefiHostTestPkg/Library/SmmServicesTableLibHost/SmmServicesTableLibHost.inf | ||
UefiDriverEntryPoint|UefiHostTestPkg/Library/UefiDriverEntryPointHost/UefiDriverEntryPointHost.inf | ||
ToolChainHarnessLib|UefiHostFuzzTestPkg/Library/ToolChainHarnessLib/ToolChainHarnessLib.inf | ||
|
||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf | ||
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf | ||
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf | ||
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf | ||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf | ||
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf | ||
TimerLib|UefiHostTestPkg/Library/BaseTimerLibHost/BaseTimerLibHost.inf | ||
|
||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf | ||
SmmServicesTableLib|UefiHostTestPkg/Library/SmmServicesTableLibHost/SmmServicesTableLibHost.inf | ||
MmServicesTableLib|UefiHostTestPkg/Library/SmmServicesTableLibHost/SmmServicesTableLibHost.inf | ||
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf | ||
PeiServicesTablePointerLib|UefiHostTestPkg/Library/PeiServicesTablePointerLibHost/PeiServicesTablePointerLibHost.inf | ||
UefiDriverEntryPoint|UefiHostTestPkg/Library/UefiDriverEntryPointHost/UefiDriverEntryPointHost.inf | ||
PeimEntryPoint|UefiHostTestPkg/Library/PeimEntryPointHost/PeimEntryPointHost.inf | ||
ToolChainHarnessLib|UefiHostFuzzTestPkg/Library/ToolChainHarnessLib/ToolChainHarnessLib.inf | ||
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf | ||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf | ||
|
||
RngLib|MdePkg/Library/BaseRngLibNull/BaseRngLibNull.inf | ||
TestSignListLib|DeviceSecurityPkg/Library/TestSignListLib/TestSignListLib.inf | ||
SpdmSecuredMessageLib|DeviceSecurityPkg/Library/SpdmLib/SpdmSecuredMessageLib.inf | ||
MemLibWrapper|DeviceSecurityPkg/Library/OsStub/MemLibWrapper/MemLibWrapper.inf | ||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFull.inf | ||
#BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | ||
BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf | ||
SpdmCommonLib|DeviceSecurityPkg/Library/SpdmLib/SpdmCommonLib.inf | ||
SpdmCryptLib|DeviceSecurityPkg/Library/SpdmLib/SpdmCryptLib.inf | ||
SpdmDeviceSecretLib|DeviceSecurityPkg/Library/SpdmLib/SpdmDeviceSecretLibNull.inf | ||
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf | ||
CryptlibWrapper|DeviceSecurityPkg/Library/OsStub/CryptlibWrapper/CryptlibWrapper.inf | ||
|
||
!if $(TEST_WITH_INSTRUMENT) | ||
IniParsingLib|UefiInstrumentTestPkg/Library/IniParsingLib/IniParsingLib.inf | ||
NULL|UefiInstrumentTestPkg/Library/InstrumentLib/InstrumentLib.inf | ||
InstrumentHookLib|UefiInstrumentTestPkg/Library/InstrumentHookLibNull/InstrumentHookLibNull.inf | ||
!endif | ||
|
||
!if $(TEST_WITH_KLEE) | ||
BaseLib|UefiHostTestPkg/Library/BaseLibHost/BaseLibHostNoAsm.inf | ||
!endif | ||
|
||
[LibraryClasses.common.USER_DEFINED] | ||
|
||
[PcdsFixedAtBuild] | ||
#gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled|TRUE | ||
|
||
[Components] | ||
UefiHostFuzzTestCasePkg/TestCase/DeviceSecurityPkg/TestSignatureList/TestSignatureList.inf | ||
!include UefiHostFuzzTestPkg/UefiHostFuzzTestBuildOption.dsc |