Compare commits
217 Commits
edk2-stabl
...
edk2-stabl
Author | SHA1 | Date | |
---|---|---|---|
872f953262 | |||
21f984cede | |||
e9d62effa3 | |||
388f9a9355 | |||
3ab9d60fcb | |||
3d39107f2d | |||
391610903b | |||
e7bd0dd26d | |||
47343af304 | |||
b9bdfc7285 | |||
6c8dd15c4a | |||
098af8b408 | |||
6c4efc0509 | |||
404250c8f7 | |||
1a110fcd4e | |||
e6a12a0fc8 | |||
4ecb1ba5ef | |||
c8b94334ca | |||
4e56034b5e | |||
0cbf1b772b | |||
397f1f4138 | |||
a2dd544f85 | |||
99e5cf5574 | |||
be7dc48727 | |||
1aa2cf0521 | |||
d3d560e0f0 | |||
fedd32d82f | |||
0a1b6d0be3 | |||
29d59baa39 | |||
124b3f9289 | |||
98ee0c68a2 | |||
28f4616fde | |||
e176bafc9d | |||
b6490426e3 | |||
d49fe0ca20 | |||
e691d80e37 | |||
61a85646eb | |||
435a05aff5 | |||
483449c9da | |||
b6104becb9 | |||
355b181f74 | |||
d11e235976 | |||
d448574e73 | |||
5e9a8a6dfb | |||
cabd0de9f6 | |||
662b42db76 | |||
4eea8f0136 | |||
544cb0132d | |||
b470520d75 | |||
1c48866e04 | |||
a4d2ddb947 | |||
91d95113d0 | |||
64e25d4b06 | |||
b465a81100 | |||
cc28ab7a1d | |||
36c50bd5d5 | |||
2cfec1d840 | |||
1b840718f7 | |||
5ec3033154 | |||
d150439b72 | |||
1b0db1ec87 | |||
fdce11226c | |||
f714fd67f2 | |||
fb2a1a36a2 | |||
12a0c11e81 | |||
8d9698ecf8 | |||
6133e72c00 | |||
a13967f2a3 | |||
8a7ca9923e | |||
990ab937c2 | |||
8c610e6075 | |||
8577d63cd8 | |||
76e8aac158 | |||
b96b44feab | |||
0af7f8e6a9 | |||
1366cd58cd | |||
dc0dae2d18 | |||
d00719485f | |||
09af9bd9be | |||
978b9d511f | |||
8d57088335 | |||
375683654d | |||
aa49066fe6 | |||
0166dad496 | |||
ffddac3e0f | |||
1946bee22a | |||
d4fae44d0d | |||
adad542ba1 | |||
c527aecd48 | |||
dc7e206ac6 | |||
4f808c62a3 | |||
5692db78a8 | |||
ed038688bf | |||
2363c69260 | |||
8ead7af22b | |||
cf299745ae | |||
0e0ae47da6 | |||
8cadcaa13d | |||
3cb6315933 | |||
0ec33398b4 | |||
a46e4738f5 | |||
4ae3b05a5a | |||
c26e291375 | |||
6ad819c1ab | |||
207414cba4 | |||
004ce0ab04 | |||
5550f4d33b | |||
2c1e9f1dc5 | |||
da29cc0e98 | |||
3b87d72874 | |||
eb520b93d2 | |||
31e97bdae2 | |||
a3212009d9 | |||
b70c4fdcde | |||
264eccb5df | |||
2bdc90429a | |||
24cf727265 | |||
e3c7db50ca | |||
8670a4ce67 | |||
e18bc21d6a | |||
5e0b708f74 | |||
e4dfb2ffa3 | |||
324931009e | |||
653fb710ce | |||
26442d11e6 | |||
f82b827c92 | |||
29d14d3a30 | |||
93edd1887e | |||
92e9c44f20 | |||
709b163940 | |||
73e3cb6c7e | |||
694bfd6ff5 | |||
30f0ec8d80 | |||
870ee2f6c8 | |||
6a9d0c1753 | |||
4a57aeaa7e | |||
6038e7a2c2 | |||
e556cebb2f | |||
a482f08d99 | |||
d30886d24c | |||
1c03498a25 | |||
69f8ef04a8 | |||
4c5e875ec1 | |||
39d76b2596 | |||
d3095addf3 | |||
cd09c38465 | |||
015be4075f | |||
a7d977040b | |||
d25fd8710d | |||
19c87b7d44 | |||
c4add64fd4 | |||
b9b7406c43 | |||
f77e3faa04 | |||
5d0a827122 | |||
9380177354 | |||
b65afdde74 | |||
5d1af380d3 | |||
9c1f455f5f | |||
cc942105ed | |||
ae511331e0 | |||
151c270899 | |||
cf0d09ca7b | |||
f1567720b1 | |||
61915c4144 | |||
244be783ae | |||
70c2f10fde | |||
5df413119e | |||
091ab12b34 | |||
69e95b9efe | |||
c63e13055a | |||
c640186ec8 | |||
2d8ca4f90e | |||
ebb3cc35f5 | |||
d8ab884fe9 | |||
52dbaaeace | |||
ffa51b3bde | |||
71dd80f14f | |||
2793a49565 | |||
2e14ee75c0 | |||
1d058c3e86 | |||
d8be01079b | |||
3a7a676114 | |||
9641a7f975 | |||
a8c77eba37 | |||
aec99d9bc3 | |||
dd5c7e3c52 | |||
3f3daf8930 | |||
fb97626fe0 | |||
4fc6912b96 | |||
e97c78c546 | |||
a6e9a9c025 | |||
00b51fcb1e | |||
86b3bee2f3 | |||
440121b542 | |||
ea9af51479 | |||
7faece6985 | |||
698d3d7726 | |||
b5701a4c7a | |||
4168137537 | |||
a09df5d2e1 | |||
ed0dce7d54 | |||
f56ed0e51d | |||
32b0a492d5 | |||
5648836987 | |||
8028b2907e | |||
5c06585528 | |||
28d7eea97e | |||
7bcb021a6d | |||
414d7d11e6 | |||
a62fb4229d | |||
1b461403ee | |||
067503a8c6 | |||
317d84abe3 | |||
f94345d9ea | |||
859e09523d | |||
cdfc7ed34f | |||
2ace920de1 |
@ -51,6 +51,12 @@ steps:
|
||||
# Set default
|
||||
- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
||||
|
||||
# Fetch the target branch so that pr_eval can diff them.
|
||||
# Seems like azure pipelines/github changed checkout process in nov 2020.
|
||||
- script: git fetch origin $(System.PullRequest.targetBranch)
|
||||
displayName: fetch target branch
|
||||
condition: eq(variables['Build.Reason'], 'PullRequest')
|
||||
|
||||
# trim the package list if this is a PR
|
||||
- task: CmdLine@1
|
||||
displayName: Check if ${{ parameters.build_pkg }} need testing
|
||||
|
@ -31,7 +31,7 @@ jobs:
|
||||
Build.Pkgs: 'MdeModulePkg'
|
||||
Build.Targets: 'RELEASE,NO-TARGET'
|
||||
TARGET_NETWORK:
|
||||
Build.Pkgs: 'NetworkPkg'
|
||||
Build.Pkgs: 'NetworkPkg,RedfishPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
TARGET_OTHER:
|
||||
Build.Pkgs: 'PcAtChipsetPkg,ShellPkg'
|
||||
@ -41,7 +41,7 @@ jobs:
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
||||
TARGET_CRYPTO:
|
||||
Build.Pkgs: 'CryptoPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
|
||||
TARGET_SECURITY:
|
||||
Build.Pkgs: 'SecurityPkg'
|
||||
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
|
||||
|
@ -31,6 +31,12 @@ steps:
|
||||
echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
|
||||
echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
|
||||
|
||||
# Fetch the target branch so that pr_eval can diff them.
|
||||
# Seems like azure pipelines/github changed checkout process in nov 2020.
|
||||
- script: git fetch origin $(System.PullRequest.targetBranch)
|
||||
displayName: fetch target branch
|
||||
condition: eq(variables['Build.Reason'], 'PullRequest')
|
||||
|
||||
# trim the package list if this is a PR
|
||||
- task: CmdLine@1
|
||||
displayName: Check if ${{ parameters.build_pkgs }} need testing
|
||||
|
8
.mailmap
8
.mailmap
@ -38,6 +38,7 @@ Jim Dailey <Jim.Dailey@Dell.com>
|
||||
Jim Dailey <Jim.Dailey@Dell.com> <Jim_Dailey@Dell.com>
|
||||
Laszlo Ersek <lersek@redhat.com> <lersek@6f19259b-4bc3-4df7-8a09-765794883524>
|
||||
Laszlo Ersek <lersek@redhat.com> <lersek@Edk2>
|
||||
Liming Gao <gaoliming@byosoft.com.cn>
|
||||
Liming Gao <liming.gao@intel.com> <Gao, Liming liming.gao@intel.com>
|
||||
Liming Gao <liming.gao@intel.com> <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
|
||||
Liming Gao <liming.gao@intel.com> <lgao4@Edk2>
|
||||
@ -47,6 +48,7 @@ Marc-André Lureau <marcandre.lureau@redhat.com> <marcandre.lureau@redhat.com>
|
||||
Marvin Häuser <Marvin.Haeuser@outlook.com>
|
||||
Marvin Häuser <Marvin.Haeuser@outlook.com> edk2-devel <edk2-devel-bounces@lists.01.org>
|
||||
Marvin Häuser <mhaeuser@outlook.de>
|
||||
Matt DeVillier <matt.devillier@gmail.com>
|
||||
Maurice Ma <maurice.ma@intel.com>
|
||||
Michael Kubacki <michael.a.kubacki@intel.com>
|
||||
Michael Kubacki <michael.a.kubacki@intel.com> </o=Intel/ou=External (FYDIBOHF25SPDLT)/cn=Recipients/cn=3c8b0226e75f4ab08d20c151cb7a8a72>
|
||||
@ -60,14 +62,20 @@ Ray Ni <ray.ni@intel.com> <niruiyu@Edk2>
|
||||
Ray Ni <ray.ni@intel.com> <ruiyu.ni@intel.com>
|
||||
Ray Ni <ray.ni@intel.com> <Ruiyu.ni@Intel.com>
|
||||
Ray Ni <ray.ni@intel.com> <ruyu.ni@intel.com>
|
||||
Rebecca Cran <rebecca@bluestop.org>
|
||||
Rebecca Cran <rebecca@bsdio.com>
|
||||
Samer El-Haj-Mahmoud <samer@elhajmahmoud.com> <elhaj@hpe.com>
|
||||
Samer El-Haj-Mahmoud <samer@elhajmahmoud.com> <Samer El-Haj-Mahmoud elhaj@hp.com>
|
||||
Shenglei Zhang <shenglei.zhang@intel.com>
|
||||
Star Zeng <star.zeng@intel.com>
|
||||
Star Zeng <star.zeng@intel.com> <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
|
||||
Star Zeng <star.zeng@intel.com> <lzeng14@Edk2>
|
||||
Tom Lendacky <thomas.lendacky@amd.com>
|
||||
Vitaly Cheptsov <vit9696@protonmail.com> Vitaly Cheptsov via Groups.Io <vit9696=protonmail.com@groups.io>
|
||||
Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Vladimir Olovyannikov via edk2-devel <edk2-devel@lists.01.org>
|
||||
Wei6 Xu <wei6.xu@intel.com>
|
||||
Yonghong Zhu <yonghong.zhu@intel.com>
|
||||
Yonghong Zhu <yonghong.zhu@intel.com> <yzhu52@Edk2>
|
||||
Yu-Chen Lin <yuchenlin@synology.com>
|
||||
Zhichao Gao <zhichao.gao@intel.com>
|
||||
Zhiguang Liu <zhiguang.liu@intel.com>
|
||||
|
@ -55,7 +55,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
||||
"FatPkg",
|
||||
"CryptoPkg",
|
||||
"UnitTestFrameworkPkg",
|
||||
"OvmfPkg"
|
||||
"OvmfPkg",
|
||||
"RedfishPkg"
|
||||
)
|
||||
|
||||
def GetArchitecturesSupported(self):
|
||||
|
@ -178,5 +178,6 @@
|
||||
"vcruntimed",
|
||||
"ucrtd",
|
||||
"msvcrtd",
|
||||
"XIPFLAGS"
|
||||
]
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ ArmMmuPeiLibConstructor (
|
||||
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
||||
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
||||
//
|
||||
WriteBackDataCacheRange (ArmReplaceLiveTranslationEntry,
|
||||
WriteBackDataCacheRange ((VOID *)(UINTN)ArmReplaceLiveTranslationEntry,
|
||||
ArmReplaceLiveTranslationEntrySize);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ FillTranslationTable (
|
||||
return;
|
||||
}
|
||||
|
||||
PhysicalBase = MemoryRegion->PhysicalBase;
|
||||
PhysicalBase = (UINT32)MemoryRegion->PhysicalBase;
|
||||
RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - PhysicalBase);
|
||||
|
||||
switch (MemoryRegion->Attributes) {
|
||||
@ -291,7 +291,7 @@ FillTranslationTable (
|
||||
PhysicalBase += TT_DESCRIPTOR_SECTION_SIZE;
|
||||
RemainLength -= TT_DESCRIPTOR_SECTION_SIZE;
|
||||
} else {
|
||||
PageMapLength = MIN (RemainLength, TT_DESCRIPTOR_SECTION_SIZE -
|
||||
PageMapLength = MIN ((UINT32)RemainLength, TT_DESCRIPTOR_SECTION_SIZE -
|
||||
(PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE));
|
||||
|
||||
// Case: Physical address aligned on the Section Size (1MB) && the length
|
||||
|
@ -152,7 +152,7 @@ UpdatePageEntries (
|
||||
FirstLevelTable = (ARM_FIRST_LEVEL_DESCRIPTOR *)ArmGetTTBR0BaseAddress ();
|
||||
|
||||
// Calculate number of 4KB page table entries to change
|
||||
NumPageEntries = Length / TT_DESCRIPTOR_PAGE_SIZE;
|
||||
NumPageEntries = (UINT32)(Length / TT_DESCRIPTOR_PAGE_SIZE);
|
||||
|
||||
// Iterate for the number of 4KB pages to change
|
||||
Offset = 0;
|
||||
@ -288,7 +288,7 @@ UpdateSectionEntries (
|
||||
ASSERT (FirstLevelIdx < TRANSLATION_TABLE_SECTION_COUNT);
|
||||
|
||||
// calculate number of 1MB first level entries this applies to
|
||||
NumSections = Length / TT_DESCRIPTOR_SECTION_SIZE;
|
||||
NumSections = (UINT32)(Length / TT_DESCRIPTOR_SECTION_SIZE);
|
||||
|
||||
// iterate through each descriptor
|
||||
for(i=0; i<NumSections; i++) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*++ @file NorFlashFvbDxe.c
|
||||
|
||||
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -736,7 +736,7 @@ NorFlashFvbInitialize (
|
||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);
|
||||
mFlashNvStorageVariableBase = PcdGet32 (PcdFlashNvStorageVariableBase);
|
||||
|
||||
// Set the index of the first LBA for the FVB
|
||||
Instance->StartLba = (PcdGet32 (PcdFlashNvStorageVariableBase) - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
|
||||
|
@ -2,6 +2,7 @@
|
||||
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -160,6 +161,7 @@
|
||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
||||
!endif
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||
RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
||||
|
||||
#
|
||||
# Secure Boot dependencies
|
||||
@ -173,6 +175,8 @@
|
||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||
!endif
|
||||
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
|
||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
|
||||
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
|
||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||
|
||||
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
|
||||
@ -246,6 +250,7 @@
|
||||
!if $(TARGET) != RELEASE
|
||||
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
|
||||
!endif
|
||||
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
|
||||
|
||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
|
||||
@ -377,6 +382,10 @@
|
||||
<PcdsFixedAtBuild>
|
||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||
}
|
||||
ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf {
|
||||
<PcdsFixedAtBuild>
|
||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||
}
|
||||
OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf {
|
||||
<PcdsFixedAtBuild>
|
||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||
|
321
ArmVirtPkg/ArmVirtKvmTool.dsc
Normal file
321
ArmVirtPkg/ArmVirtKvmTool.dsc
Normal file
@ -0,0 +1,321 @@
|
||||
# @file
|
||||
# Workspace file for KVMTool virtual platform.
|
||||
#
|
||||
# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
PLATFORM_NAME = ArmVirtKvmTool
|
||||
PLATFORM_GUID = 4CB2C61E-FA32-4130-8E37-54ABC71A1A43
|
||||
PLATFORM_VERSION = 0.1
|
||||
DSC_SPECIFICATION = 0x0001001B
|
||||
!ifdef $(EDK2_OUT_DIR)
|
||||
OUTPUT_DIRECTORY = $(EDK2_OUT_DIR)
|
||||
!else
|
||||
OUTPUT_DIRECTORY = Build/ArmVirtKvmTool-$(ARCH)
|
||||
!endif
|
||||
SUPPORTED_ARCHITECTURES = AARCH64|ARM
|
||||
BUILD_TARGETS = DEBUG|RELEASE
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
FLASH_DEFINITION = ArmVirtPkg/ArmVirtKvmTool.fdf
|
||||
|
||||
!include ArmVirtPkg/ArmVirt.dsc.inc
|
||||
|
||||
[LibraryClasses.common]
|
||||
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
||||
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
|
||||
|
||||
# Virtio Support
|
||||
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
||||
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
||||
|
||||
ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
|
||||
ArmVirtMemInfoLib|ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.inf
|
||||
|
||||
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
|
||||
NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
|
||||
|
||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
|
||||
# BDS Libraries
|
||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
|
||||
BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
|
||||
|
||||
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
||||
|
||||
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
|
||||
|
||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||
|
||||
PlatformPeiLib|ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf
|
||||
|
||||
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
||||
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
|
||||
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
|
||||
|
||||
[LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
|
||||
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
||||
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
|
||||
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
|
||||
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
#
|
||||
# We need to avoid jump tables in SEC and BASE modules, so that the PE/COFF
|
||||
# self-relocation code itself is guaranteed to be position independent.
|
||||
#
|
||||
GCC:*_*_*_CC_XIPFLAGS = -fno-jump-tables
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsFeatureFlag.common]
|
||||
## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
|
||||
# It could be set FALSE to save size.
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
|
||||
|
||||
# Use MMIO for accessing RTC controller registers.
|
||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcUseMmio|TRUE
|
||||
|
||||
[PcdsFixedAtBuild.common]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
|
||||
|
||||
gArmPlatformTokenSpaceGuid.PcdCoreCount|1
|
||||
|
||||
!if $(ARCH) == AARCH64
|
||||
gArmTokenSpaceGuid.PcdVFPEnabled|1
|
||||
!endif
|
||||
|
||||
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
|
||||
|
||||
# Size of the region used by UEFI in permanent memory (Reserved 64MB)
|
||||
gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
|
||||
|
||||
#
|
||||
# TTY Terminal Type
|
||||
# 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
|
||||
|
||||
#
|
||||
# ARM Virtual Architectural Timer -- fetch frequency from KVM
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0
|
||||
|
||||
# Use MMIO for accessing Serial port registers.
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo|{0xFF}
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
|
||||
|
||||
#
|
||||
# The maximum physical I/O addressability of the processor, set with
|
||||
# BuildCpuHob().
|
||||
#
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
|
||||
|
||||
[PcdsPatchableInModule.common]
|
||||
#
|
||||
# This will be overridden in the code
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdSystemMemoryBase|0x0
|
||||
gArmTokenSpaceGuid.PcdSystemMemorySize|0x0
|
||||
|
||||
#
|
||||
# The device tree base address is handed off by kvmtool.
|
||||
# We are booting from RAM using the Linux kernel boot protocol,
|
||||
# x0 will point to the DTB image in memory.
|
||||
#
|
||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x0
|
||||
|
||||
gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress|0x0
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x0
|
||||
|
||||
[PcdsDynamicDefault.common]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
|
||||
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
|
||||
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
|
||||
|
||||
#
|
||||
# ARM General Interrupt Controller
|
||||
#
|
||||
gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
|
||||
gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
|
||||
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
|
||||
|
||||
#
|
||||
# Set video resolution for boot options and for text setup.
|
||||
# PlatformDxe can set the former at runtime.
|
||||
#
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480
|
||||
|
||||
## Force DTB
|
||||
gArmVirtTokenSpaceGuid.PcdForceNoAcpi|TRUE
|
||||
|
||||
# Setup Flash storage variables
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x40000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x40000
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x40000
|
||||
|
||||
## RTC Register address in MMIO space.
|
||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64|0x0
|
||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister64|0x0
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Components Section - list of all EDK II Modules needed by this Platform
|
||||
#
|
||||
################################################################################
|
||||
[Components.common]
|
||||
#
|
||||
# PEI Phase modules
|
||||
#
|
||||
ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf {
|
||||
<LibraryClasses>
|
||||
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
|
||||
LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
||||
PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
|
||||
HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
|
||||
PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
|
||||
MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
|
||||
}
|
||||
|
||||
#
|
||||
# DXE
|
||||
#
|
||||
MdeModulePkg/Core/Dxe/DxeMain.inf {
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
|
||||
#
|
||||
# Architectural Protocols
|
||||
#
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
|
||||
NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
||||
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
||||
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
||||
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
||||
|
||||
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
|
||||
ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
|
||||
ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
|
||||
<LibraryClasses>
|
||||
NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
|
||||
}
|
||||
|
||||
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
|
||||
|
||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
|
||||
#
|
||||
# Platform Driver
|
||||
#
|
||||
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
|
||||
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||
OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||
OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||
|
||||
#
|
||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
||||
#
|
||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||
FatPkg/EnhancedFatDxe/Fat.inf
|
||||
MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
||||
|
||||
#
|
||||
# Bds
|
||||
#
|
||||
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
|
||||
<LibraryClasses>
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
|
||||
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
|
||||
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
MdeModulePkg/Logo/LogoDxe.inf
|
||||
MdeModulePkg/Application/UiApp/UiApp.inf {
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
|
||||
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
|
||||
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
|
||||
}
|
||||
|
||||
#
|
||||
# SCSI Bus and Disk Driver
|
||||
#
|
||||
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
||||
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
234
ArmVirtPkg/ArmVirtKvmTool.fdf
Normal file
234
ArmVirtPkg/ArmVirtKvmTool.fdf
Normal file
@ -0,0 +1,234 @@
|
||||
#
|
||||
# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FD Section
|
||||
# The [FD] Section is made up of the definition statements and a
|
||||
# description of what goes into the Flash Device Image. Each FD section
|
||||
# defines one flash "device" image. A flash device image may be one of
|
||||
# the following: Removable media bootable image (like a boot floppy
|
||||
# image,) an Option ROM image (that would be "flashed" into an add-in
|
||||
# card,) a System "Flash" image (that would be burned into a system's
|
||||
# flash) or an Update ("Capsule") image that will be used to update and
|
||||
# existing system flash.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[FD.KVMTOOL_EFI]
|
||||
BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
|
||||
# The size in bytes of the FLASH Device
|
||||
Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize
|
||||
ErasePolarity = 1
|
||||
|
||||
# This one is tricky, it must be: BlockSize * NumBlocks = Size
|
||||
BlockSize = 0x00001000
|
||||
NumBlocks = 0x200
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Following are lists of FD Region layout which correspond to the locations of different
|
||||
# images within the flash device.
|
||||
#
|
||||
# Regions must be defined in ascending order and may not overlap.
|
||||
#
|
||||
# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
|
||||
# the pipe "|" character, followed by the size of the region, also in hex with the leading
|
||||
# "0x" characters. Like:
|
||||
# Offset|Size
|
||||
# PcdOffsetCName|PcdSizeCName
|
||||
# RegionType <FV, DATA, or FILE>
|
||||
#
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# Implement the Linux kernel header layout so that the loader will identify
|
||||
# it as something bootable, and execute it with a FDT pointer in x0 or r2.
|
||||
# This area will be reused to store a copy of the FDT so round it up to 32 KB.
|
||||
#
|
||||
0x00000000|0x00008000
|
||||
DATA = {
|
||||
!if $(ARCH) == AARCH64
|
||||
0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
|
||||
0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
|
||||
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
|
||||
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res4
|
||||
0x41, 0x52, 0x4d, 0x64, # magic: "ARM\x64"
|
||||
0x00, 0x00, 0x00, 0x00 # res5
|
||||
!else
|
||||
0x08, 0x10, 0x4f, 0xe2, # adr r1, .
|
||||
0x02, 0x00, 0xa0, 0xe1, # mov r0, r2 (DTB)
|
||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
||||
0x00, 0x00, 0xa0, 0xe1, # nop
|
||||
|
||||
0xf6, 0x1f, 0x00, 0xea, # b 0x8000
|
||||
0x18, 0x28, 0x6f, 0x01, # magic
|
||||
0x00, 0x00, 0x00, 0x00, # start
|
||||
0x00, 0x00, 0x20, 0x00, # image size: 2 MB
|
||||
0x01, 0x02, 0x03, 0x04 # endiannness flag
|
||||
!endif
|
||||
}
|
||||
|
||||
0x00008000|0x001f8000
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
|
||||
FV = FVMAIN_COMPACT
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FV Section
|
||||
#
|
||||
# [FV] section is used to define what components or modules are placed within a flash
|
||||
# device file. This section also defines order the components and modules are positioned
|
||||
# within the image. The [FV] section consists of define statements, set statements and
|
||||
# module statements.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[FV.FvMain]
|
||||
FvNameGuid = 8A91C08E-7D9D-4933-84D6-901D26D0766E
|
||||
BlockSize = 0x40
|
||||
NumBlocks = 0 # This FV gets compressed so make it just big enough
|
||||
FvAlignment = 16 # FV alignment and FV attributes setting.
|
||||
ERASE_POLARITY = 1
|
||||
MEMORY_MAPPED = TRUE
|
||||
STICKY_WRITE = TRUE
|
||||
LOCK_CAP = TRUE
|
||||
LOCK_STATUS = TRUE
|
||||
WRITE_DISABLED_CAP = TRUE
|
||||
WRITE_ENABLED_CAP = TRUE
|
||||
WRITE_STATUS = TRUE
|
||||
WRITE_LOCK_CAP = TRUE
|
||||
WRITE_LOCK_STATUS = TRUE
|
||||
READ_DISABLED_CAP = TRUE
|
||||
READ_ENABLED_CAP = TRUE
|
||||
READ_STATUS = TRUE
|
||||
READ_LOCK_CAP = TRUE
|
||||
READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
|
||||
INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
|
||||
INF ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
|
||||
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
|
||||
|
||||
#
|
||||
# PI DXE Drivers producing Architectural Protocols (EFI Services)
|
||||
#
|
||||
INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
|
||||
|
||||
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
||||
|
||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
||||
|
||||
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
|
||||
#
|
||||
# Multiple Console IO support
|
||||
#
|
||||
INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
||||
|
||||
INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
|
||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
|
||||
|
||||
#
|
||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
|
||||
#
|
||||
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||
INF FatPkg/EnhancedFatDxe/Fat.inf
|
||||
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
|
||||
|
||||
#
|
||||
# Platform Driver
|
||||
#
|
||||
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||
INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
|
||||
INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
|
||||
INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
|
||||
|
||||
#
|
||||
# UEFI application (Shell Embedded Boot Loader)
|
||||
#
|
||||
INF ShellPkg/Application/Shell/Shell.inf
|
||||
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
||||
|
||||
#
|
||||
# Bds
|
||||
#
|
||||
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
|
||||
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
|
||||
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
|
||||
INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
INF MdeModulePkg/Application/UiApp/UiApp.inf
|
||||
|
||||
#
|
||||
# SCSI Bus and Disk Driver
|
||||
#
|
||||
INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
||||
INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
||||
|
||||
#
|
||||
# TianoCore logo (splash screen)
|
||||
#
|
||||
INF MdeModulePkg/Logo/LogoDxe.inf
|
||||
|
||||
#
|
||||
# Ramdisk support
|
||||
#
|
||||
INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
|
||||
|
||||
[FV.FVMAIN_COMPACT]
|
||||
FvAlignment = 16
|
||||
ERASE_POLARITY = 1
|
||||
MEMORY_MAPPED = TRUE
|
||||
STICKY_WRITE = TRUE
|
||||
LOCK_CAP = TRUE
|
||||
LOCK_STATUS = TRUE
|
||||
WRITE_DISABLED_CAP = TRUE
|
||||
WRITE_ENABLED_CAP = TRUE
|
||||
WRITE_STATUS = TRUE
|
||||
WRITE_LOCK_CAP = TRUE
|
||||
WRITE_LOCK_STATUS = TRUE
|
||||
READ_DISABLED_CAP = TRUE
|
||||
READ_ENABLED_CAP = TRUE
|
||||
READ_STATUS = TRUE
|
||||
READ_LOCK_CAP = TRUE
|
||||
READ_LOCK_STATUS = TRUE
|
||||
|
||||
INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
|
||||
|
||||
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
|
||||
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
|
||||
SECTION FV_IMAGE = FVMAIN
|
||||
}
|
||||
}
|
||||
|
||||
!include ArmVirtRules.fdf.inc
|
@ -6,6 +6,8 @@
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation
|
||||
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
{
|
||||
@ -50,6 +52,7 @@
|
||||
"OvmfPkg/OvmfPkg.dec",
|
||||
"EmbeddedPkg/EmbeddedPkg.dec",
|
||||
"ArmPlatformPkg/ArmPlatformPkg.dec",
|
||||
"PcAtChipsetPkg/PcAtChipsetPkg.dec",
|
||||
"SecurityPkg/SecurityPkg.dec",
|
||||
"ShellPkg/ShellPkg.dec" #Is this ok?
|
||||
],
|
||||
@ -111,7 +114,8 @@
|
||||
"unbootable",
|
||||
"virt's",
|
||||
"werror",
|
||||
"xenio"
|
||||
"xenio",
|
||||
"kvmtool"
|
||||
], # words to extend to the dictionary for this package
|
||||
"IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignore
|
||||
"AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#/** @file
|
||||
#
|
||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -30,6 +31,7 @@
|
||||
[Guids.common]
|
||||
gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
|
||||
gEarlyPL011BaseAddressGuid = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
|
||||
gEarly16550UartBaseAddressGuid = { 0xea67ca3e, 0x1f54, 0x436b, { 0x97, 0x88, 0xd4, 0xeb, 0x29, 0xc3, 0x42, 0x67 } }
|
||||
|
||||
gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||
# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
|
||||
# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -40,6 +40,7 @@
|
||||
DEFINE NETWORK_SNP_ENABLE = FALSE
|
||||
DEFINE NETWORK_TLS_ENABLE = FALSE
|
||||
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
||||
DEFINE NETWORK_ISCSI_ENABLE = TRUE
|
||||
|
||||
!if $(NETWORK_SNP_ENABLE) == TRUE
|
||||
!error "NETWORK_SNP_ENABLE is IA32/X64/EBC only"
|
||||
@ -105,6 +106,9 @@
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
||||
|
@ -103,6 +103,7 @@ READ_LOCK_STATUS = TRUE
|
||||
#
|
||||
INF ShellPkg/Application/Shell/Shell.inf
|
||||
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
||||
INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
|
||||
INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
|
||||
|
||||
#
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright (c) 2011-2015, ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2014, Linaro Limited. All rights reserved.
|
||||
# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
|
||||
# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
@ -38,6 +38,7 @@
|
||||
DEFINE NETWORK_SNP_ENABLE = FALSE
|
||||
DEFINE NETWORK_TLS_ENABLE = FALSE
|
||||
DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
|
||||
DEFINE NETWORK_ISCSI_ENABLE = TRUE
|
||||
|
||||
!if $(NETWORK_SNP_ENABLE) == TRUE
|
||||
!error "NETWORK_SNP_ENABLE is IA32/X64/EBC only"
|
||||
@ -84,6 +85,8 @@
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
|
||||
[BuildOptions]
|
||||
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
||||
|
||||
#
|
||||
# We need to avoid jump tables in SEC modules, so that the PE/COFF
|
||||
# self-relocation code itself is guaranteed to be position independent.
|
||||
|
@ -182,6 +182,7 @@ READ_LOCK_STATUS = TRUE
|
||||
#
|
||||
INF ShellPkg/Application/Shell/Shell.inf
|
||||
INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
|
||||
INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
|
||||
INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
|
||||
|
||||
#
|
||||
|
22
ArmVirtPkg/Include/Guid/Early16550UartBaseAddress.h
Normal file
22
ArmVirtPkg/Include/Guid/Early16550UartBaseAddress.h
Normal file
@ -0,0 +1,22 @@
|
||||
/** @file
|
||||
GUID for the HOB that caches the base address of the 16550 serial port, for
|
||||
when PCD access is not available.
|
||||
|
||||
Copyright (c) 2020, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef EARLY_16550_UART_BASE_ADDRESS_H__
|
||||
#define EARLY_16550_UART_BASE_ADDRESS_H__
|
||||
|
||||
#define EARLY_16550_UART_BASE_ADDRESS_GUID { \
|
||||
0xea67ca3e, 0x1f54, 0x436b, { \
|
||||
0x97, 0x88, 0xd4, 0xeb, 0x29, 0xc3, 0x42, 0x67 \
|
||||
} \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEarly16550UartBaseAddressGuid;
|
||||
|
||||
#endif // EARLY_16550_UART_BASE_ADDRESS_H__
|
82
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c
Normal file
82
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.c
Normal file
@ -0,0 +1,82 @@
|
||||
/** @file
|
||||
|
||||
The KvmtoolPlatformDxe performs the platform specific initialization like:
|
||||
- It decides if the firmware should expose ACPI or Device Tree-based
|
||||
hardware description to the operating system.
|
||||
|
||||
Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Guid/VariableFormat.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/FdtClient.h>
|
||||
|
||||
/** Decide if the firmware should expose ACPI tables or Device Tree and
|
||||
install the appropriate protocol interface.
|
||||
|
||||
Note: This function is derived from "ArmVirtPkg/PlatformHasAcpiDtDxe",
|
||||
by dropping the word size check, and the fw_cfg check.
|
||||
|
||||
@param [in] ImageHandle Handle for this image.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory to install the
|
||||
protocols.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
PlatformHasAcpiDt (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
{
|
||||
if (!PcdGetBool (PcdForceNoAcpi)) {
|
||||
// Expose ACPI tables
|
||||
return gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gEdkiiPlatformHasAcpiGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
// Expose the Device Tree.
|
||||
return gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gEdkiiPlatformHasDeviceTreeGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
/** Entry point for Kvmtool Platform Dxe
|
||||
|
||||
@param [in] ImageHandle Handle for this image.
|
||||
@param [in] SystemTable Pointer to the EFI system table.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory to install the
|
||||
protocols.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
KvmtoolPlatformDxeEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = PlatformHasAcpiDt (ImageHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
43
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
Normal file
43
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
Normal file
@ -0,0 +1,43 @@
|
||||
## @file
|
||||
# The KvmtoolPlatformDxe performs the platform specific initialization like:
|
||||
# - It decides if the firmware should expose ACPI or Device Tree-based
|
||||
# hardware description to the operating system.
|
||||
#
|
||||
# Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = KvmtoolPlatformDxe
|
||||
FILE_GUID = 7479CCCD-D721-442A-8C73-A72DBB886669
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = KvmtoolPlatformDxeEntryPoint
|
||||
|
||||
[Sources]
|
||||
KvmtoolPlatformDxe.c
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
|
||||
[Guids]
|
||||
gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL
|
||||
gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
|
||||
|
||||
[Pcd]
|
||||
gArmVirtTokenSpaceGuid.PcdForceNoAcpi
|
||||
|
||||
[Depex]
|
||||
TRUE
|
@ -0,0 +1,137 @@
|
||||
/** @file
|
||||
Early Platform Hook Library instance for 16550 Uart.
|
||||
|
||||
Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Base.h>
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Pi/PiBootMode.h>
|
||||
#include <Pi/PiHob.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PlatformHookLib.h>
|
||||
#include <libfdt.h>
|
||||
|
||||
/** Get the UART base address of the console serial-port from the DT.
|
||||
|
||||
This function fetches the node referenced in the "stdout-path"
|
||||
property of the "chosen" node and returns the base address of
|
||||
the console UART.
|
||||
|
||||
@param [in] Fdt Pointer to a Flattened Device Tree (Fdt).
|
||||
@param [out] SerialConsoleAddress If success, contains the base address
|
||||
of the console serial-port.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_NOT_FOUND Console serial-port info not found in DT.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetSerialConsolePortAddress (
|
||||
IN CONST VOID *Fdt,
|
||||
OUT UINT64 *SerialConsoleAddress
|
||||
)
|
||||
{
|
||||
CONST CHAR8 *Prop;
|
||||
INT32 PropSize;
|
||||
CONST CHAR8 *Path;
|
||||
INT32 PathLen;
|
||||
INT32 ChosenNode;
|
||||
INT32 SerialConsoleNode;
|
||||
INT32 Len;
|
||||
CONST CHAR8 *NodeStatus;
|
||||
CONST UINT64 *RegProperty;
|
||||
|
||||
if ((Fdt == NULL) || (fdt_check_header (Fdt) != 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// The "chosen" node resides at the the root of the DT. Fetch it.
|
||||
ChosenNode = fdt_path_offset (Fdt, "/chosen");
|
||||
if (ChosenNode < 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Prop = fdt_getprop (Fdt, ChosenNode, "stdout-path", &PropSize);
|
||||
if (PropSize < 0) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Determine the actual path length, as a colon terminates the path.
|
||||
Path = ScanMem8 (Prop, ':', PropSize);
|
||||
if (Path == NULL) {
|
||||
PathLen = AsciiStrLen (Prop);
|
||||
} else {
|
||||
PathLen = Path - Prop;
|
||||
}
|
||||
|
||||
// Aliases cannot start with a '/', so it must be the actual path.
|
||||
if (Prop[0] == '/') {
|
||||
SerialConsoleNode = fdt_path_offset_namelen (Fdt, Prop, PathLen);
|
||||
} else {
|
||||
// Lookup the alias, as this contains the actual path.
|
||||
Path = fdt_get_alias_namelen (Fdt, Prop, PathLen);
|
||||
if (Path == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
SerialConsoleNode = fdt_path_offset (Fdt, Path);
|
||||
}
|
||||
|
||||
NodeStatus = fdt_getprop (Fdt, SerialConsoleNode, "status", &Len);
|
||||
if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
RegProperty = fdt_getprop (Fdt, SerialConsoleNode, "reg", &Len);
|
||||
if (Len != 16) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*SerialConsoleAddress = fdt64_to_cpu (ReadUnaligned64 (RegProperty));
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/** Platform hook to retrieve the 16550 UART base address from the platform
|
||||
Device tree and store it in PcdSerialRegisterBase.
|
||||
|
||||
@retval RETURN_SUCCESS Success.
|
||||
@retval RETURN_INVALID_PARAMETER A parameter was invalid.
|
||||
@retval RETURN_NOT_FOUND Serial port information not found.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PlatformHookSerialPortInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
RETURN_STATUS Status;
|
||||
VOID *DeviceTreeBase;
|
||||
UINT64 SerialConsoleAddress;
|
||||
|
||||
if (PcdGet64 (PcdSerialRegisterBase) != 0) {
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
if (DeviceTreeBase == NULL) {
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
||||
Status = GetSerialConsolePortAddress (DeviceTreeBase, &SerialConsoleAddress);
|
||||
if (RETURN_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return (EFI_STATUS)PcdSet64S (PcdSerialRegisterBase, SerialConsoleAddress);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
## @file
|
||||
# Early Platform Hook Library instance for 16550 Uart.
|
||||
#
|
||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = EarlyFdt16550SerialPortHookLib
|
||||
MODULE_UNI_FILE = Fdt16550SerialPortHookLib.uni
|
||||
FILE_GUID = FFB19961-79CC-4684-84A8-C31B0A2BBE82
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformHookLib|SEC PEI_CORE PEIM
|
||||
|
||||
[Sources]
|
||||
EarlyFdt16550SerialPortHookLib.c
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
PcdLib
|
||||
FdtLib
|
||||
HobLib
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[Pcd]
|
||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
@ -0,0 +1,56 @@
|
||||
/** @file
|
||||
Platform Hook Library instance for 16550 Uart.
|
||||
|
||||
Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Base.h>
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Pi/PiBootMode.h>
|
||||
#include <Pi/PiHob.h>
|
||||
|
||||
#include <Guid/Early16550UartBaseAddress.h>
|
||||
#include <Guid/Fdt.h>
|
||||
#include <Guid/FdtHob.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PlatformHookLib.h>
|
||||
|
||||
/** Platform hook to retrieve the 16550 UART base address from the GUID Hob
|
||||
that caches the UART base address from early boot stage and store it in
|
||||
PcdSerialRegisterBase.
|
||||
|
||||
@retval RETURN_SUCCESS Success.
|
||||
@retval RETURN_NOT_FOUND Serial Port information not found.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
PlatformHookSerialPortInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID *Hob;
|
||||
UINT64 *UartBase;
|
||||
|
||||
if (PcdGet64 (PcdSerialRegisterBase) != 0) {
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
Hob = GetFirstGuidHob (&gEarly16550UartBaseAddressGuid);
|
||||
if ((Hob == NULL) || (GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (*UartBase))) {
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
||||
UartBase = GET_GUID_HOB_DATA (Hob);
|
||||
if ((UINTN)*UartBase == 0) {
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
||||
return (RETURN_STATUS)PcdSet64S (PcdSerialRegisterBase, (UINTN)*UartBase);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
## @file
|
||||
# Platform Hook Library instance for 16550 Uart.
|
||||
#
|
||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = Fdt16550SerialPortHookLib
|
||||
MODULE_UNI_FILE = Fdt16550SerialPortHookLib.uni
|
||||
FILE_GUID = C6DFD3F0-179D-4376-89A5-F641A2E7EFB5
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformHookLib|DXE_CORE DXE_DRIVER UEFI_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION
|
||||
CONSTRUCTOR = PlatformHookSerialPortInitialize
|
||||
|
||||
[Sources]
|
||||
Fdt16550SerialPortHookLib.c
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
PcdLib
|
||||
HobLib
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
||||
|
||||
[Guids]
|
||||
gEarly16550UartBaseAddressGuid
|
@ -0,0 +1,13 @@
|
||||
// /** @file
|
||||
// Platform Hook Library instance for 16550 Uart.
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Platform Hook Library instance for 16550 Uart."
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "Platform Hook Library instance for 16550 Uart."
|
@ -0,0 +1,79 @@
|
||||
/** @file
|
||||
Kvmtool platform PEI library.
|
||||
|
||||
Copyright (c) 2020, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <PiPei.h>
|
||||
|
||||
#include <Guid/Early16550UartBaseAddress.h>
|
||||
#include <Guid/FdtHob.h>
|
||||
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <libfdt.h>
|
||||
|
||||
/** Initialise Platform HOBs
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES Out of resources.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatformPeim (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID *Base;
|
||||
VOID *NewBase;
|
||||
UINTN FdtSize;
|
||||
UINTN FdtPages;
|
||||
UINT64 *FdtHobData;
|
||||
UINT64 *UartHobData;
|
||||
|
||||
Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
|
||||
if ((Base == NULL) || (fdt_check_header (Base) != 0)) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
|
||||
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
|
||||
NewBase = AllocatePages (FdtPages);
|
||||
if (NewBase == NULL) {
|
||||
ASSERT (0);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
|
||||
|
||||
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData));
|
||||
if (FdtHobData == NULL) {
|
||||
ASSERT (0);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
*FdtHobData = (UINTN)NewBase;
|
||||
|
||||
UartHobData = BuildGuidHob (
|
||||
&gEarly16550UartBaseAddressGuid,
|
||||
sizeof (*UartHobData)
|
||||
);
|
||||
if (UartHobData == NULL) {
|
||||
ASSERT (0);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
*UartHobData = PcdGet64 (PcdSerialRegisterBase);
|
||||
|
||||
BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize));
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
## @file
|
||||
# Kvmtool platform PEI library.
|
||||
#
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = PlatformPeiLib
|
||||
FILE_GUID = 21073FB3-BA6F-43EB-83F0-4A840C648165
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = KvmtoolPlatformPeiLib
|
||||
|
||||
[Sources]
|
||||
KvmtoolPlatformPeiLib.c
|
||||
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
HobLib
|
||||
FdtLib
|
||||
PcdLib
|
||||
PeiServicesLib
|
||||
|
||||
[FixedPcd]
|
||||
gArmTokenSpaceGuid.PcdFvSize
|
||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeAllocationPadding
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||
gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
||||
|
||||
[Guids]
|
||||
gFdtHobGuid
|
||||
gEarly16550UartBaseAddressGuid
|
||||
|
||||
[Depex]
|
||||
gEfiPeiMemoryDiscoveredPpiGuid
|
@ -0,0 +1,230 @@
|
||||
/** @file
|
||||
FDT client library for motorola,mc146818 RTC driver
|
||||
|
||||
Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/FdtClient.h>
|
||||
|
||||
/** RTC Index register is at offset 0x0
|
||||
*/
|
||||
#define RTC_INDEX_REG_OFFSET 0x0ULL
|
||||
|
||||
/** RTC Target register is at offset 0x1
|
||||
*/
|
||||
#define RTC_TARGET_REG_OFFSET 0x1ULL
|
||||
|
||||
/** Add the RTC controller address range to the memory map.
|
||||
|
||||
@param [in] ImageHandle The handle to the image.
|
||||
@param [in] RtcPageBase Base address of the RTC controller.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Flash device not found.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
KvmtoolRtcMapMemory (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_PHYSICAL_ADDRESS RtcPageBase
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gDS->AddMemorySpace (
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
RtcPageBase,
|
||||
EFI_PAGE_SIZE,
|
||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR, "Failed to add memory space. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gDS->AllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
0,
|
||||
EFI_PAGE_SIZE,
|
||||
&RtcPageBase,
|
||||
ImageHandle,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"Failed to allocate memory space. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
gDS->RemoveMemorySpace (
|
||||
RtcPageBase,
|
||||
EFI_PAGE_SIZE
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gDS->SetMemorySpaceAttributes (
|
||||
RtcPageBase,
|
||||
EFI_PAGE_SIZE,
|
||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"Failed to set memory attributes. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
gDS->FreeMemorySpace (
|
||||
RtcPageBase,
|
||||
EFI_PAGE_SIZE
|
||||
);
|
||||
gDS->RemoveMemorySpace (
|
||||
RtcPageBase,
|
||||
EFI_PAGE_SIZE
|
||||
);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Entrypoint for KvmtoolRtcFdtClientLib.
|
||||
|
||||
Locate the RTC node in the DT and update the Index and
|
||||
Target register base addresses in the respective PCDs.
|
||||
Add the RTC memory region to the memory map.
|
||||
Disable the RTC node as the RTC is owned by UEFI.
|
||||
|
||||
@param [in] ImageHandle The handle to the image.
|
||||
@param [in] SystemTable Pointer to the System Table.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Flash device not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
KvmtoolRtcFdtClientLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
FDT_CLIENT_PROTOCOL *FdtClient;
|
||||
INT32 Node;
|
||||
CONST UINT32 *Reg;
|
||||
UINT32 RegSize;
|
||||
UINT64 RegBase;
|
||||
UINT64 Range;
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&FdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FdtClient->FindCompatibleNode (
|
||||
FdtClient,
|
||||
"motorola,mc146818",
|
||||
&Node
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: No 'motorola,mc146818' compatible DT node found\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = FdtClient->GetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"reg",
|
||||
(CONST VOID **)&Reg,
|
||||
&RegSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: No 'reg' property found in 'motorola,mc146818' compatible DT node\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
ASSERT (RegSize == 16);
|
||||
|
||||
RegBase = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));
|
||||
Range = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"Found motorola,mc146818 RTC @ 0x%Lx Range = 0x%x\n",
|
||||
RegBase,
|
||||
Range
|
||||
));
|
||||
|
||||
// The address range must cover the RTC Index and the Target registers.
|
||||
ASSERT (Range >= 0x2);
|
||||
|
||||
// RTC Index register is at offset 0x0
|
||||
PcdStatus = PcdSet64S (
|
||||
PcdRtcIndexRegister64,
|
||||
(RegBase + RTC_INDEX_REG_OFFSET)
|
||||
);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
// RTC Target register is at offset 0x1
|
||||
PcdStatus = PcdSet64S (
|
||||
PcdRtcTargetRegister64,
|
||||
(RegBase + RTC_TARGET_REG_OFFSET)
|
||||
);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
Status = KvmtoolRtcMapMemory (ImageHandle, (RegBase & ~EFI_PAGE_MASK));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"Failed to map memory for motorola,mc146818. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// UEFI takes ownership of the RTC hardware, and exposes its functionality
|
||||
// through the UEFI Runtime Services GetTime, SetTime, etc. This means we
|
||||
// need to disable it in the device tree to prevent the OS from attaching
|
||||
// its device driver as well.
|
||||
//
|
||||
Status = FdtClient->SetNodeProperty (
|
||||
FdtClient,
|
||||
Node,
|
||||
"status",
|
||||
"disabled",
|
||||
sizeof ("disabled")
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"Failed to set motorola,mc146818 status to 'disabled', Status = %r\n",
|
||||
Status
|
||||
));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
## @file
|
||||
# FDT client library for motorola,mc146818 RTC driver
|
||||
#
|
||||
# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = KvmtoolRtcFdtClientLib
|
||||
FILE_GUID = 3254B4F7-30B5-48C6-B06A-D8FF97F3EF95
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = KvmtoolRtcFdtClientLib|DXE_DRIVER DXE_RUNTIME_DRIVER
|
||||
CONSTRUCTOR = KvmtoolRtcFdtClientLibConstructor
|
||||
|
||||
[Sources]
|
||||
KvmtoolRtcFdtClientLib.c
|
||||
|
||||
[Packages]
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
PcAtChipsetPkg/PcAtChipsetPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
PcdLib
|
||||
UefiBootServicesTableLib
|
||||
DxeServicesTableLib
|
||||
|
||||
[Protocols]
|
||||
gFdtClientProtocolGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64
|
||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister64
|
||||
|
||||
[Depex]
|
||||
gFdtClientProtocolGuid
|
@ -0,0 +1,98 @@
|
||||
/** @file
|
||||
Kvmtool virtual memory map library.
|
||||
|
||||
Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Base.h>
|
||||
#include <Library/ArmLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
// Number of Virtual Memory Map Descriptors
|
||||
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5
|
||||
|
||||
/**
|
||||
Return the Virtual Memory Map of your platform
|
||||
|
||||
This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
|
||||
on your platform.
|
||||
|
||||
@param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR
|
||||
describing a Physical-to-Virtual Memory
|
||||
mapping. This array must be ended by a
|
||||
zero-filled entry. The allocated memory
|
||||
will not be freed.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ArmVirtGetMemoryMap (
|
||||
OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap
|
||||
)
|
||||
{
|
||||
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
|
||||
UINTN Idx;
|
||||
EFI_PHYSICAL_ADDRESS TopOfAddressSpace;
|
||||
|
||||
ASSERT (VirtualMemoryMap != NULL);
|
||||
|
||||
TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());
|
||||
|
||||
VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)
|
||||
AllocatePages (
|
||||
EFI_SIZE_TO_PAGES (
|
||||
sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
|
||||
MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS
|
||||
)
|
||||
);
|
||||
if (VirtualMemoryTable == NULL) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: Error: Failed to Allocate Pages\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
Idx = 0;
|
||||
// System DRAM
|
||||
VirtualMemoryTable[Idx].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
|
||||
VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;
|
||||
VirtualMemoryTable[Idx].Length = PcdGet64 (PcdSystemMemorySize);
|
||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
|
||||
// Peripheral space before DRAM
|
||||
VirtualMemoryTable[++Idx].PhysicalBase = 0x0;
|
||||
VirtualMemoryTable[Idx].VirtualBase = 0x0;
|
||||
VirtualMemoryTable[Idx].Length = PcdGet64 (PcdSystemMemoryBase);
|
||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
|
||||
|
||||
// Peripheral space after DRAM
|
||||
VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdSystemMemoryBase) +
|
||||
PcdGet64 (PcdSystemMemorySize);
|
||||
VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;
|
||||
VirtualMemoryTable[Idx].Length = TopOfAddressSpace -
|
||||
VirtualMemoryTable[Idx].PhysicalBase;
|
||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
|
||||
|
||||
// Map the FV region as normal executable memory
|
||||
VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
|
||||
VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase;
|
||||
VirtualMemoryTable[Idx].Length = FixedPcdGet32 (PcdFvSize);
|
||||
VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
|
||||
// End of Table
|
||||
VirtualMemoryTable[++Idx].PhysicalBase = 0;
|
||||
VirtualMemoryTable[Idx].VirtualBase = 0;
|
||||
VirtualMemoryTable[Idx].Length = 0;
|
||||
VirtualMemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
|
||||
|
||||
ASSERT((Idx + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
|
||||
|
||||
*VirtualMemoryMap = VirtualMemoryTable;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
## @file
|
||||
# Kvmtool virtual memory map library.
|
||||
#
|
||||
# Copyright (c) 2018, ARM Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = KvmtoolVirtMemInfoLib
|
||||
FILE_GUID = B752E953-394F-462C-811C-F8BE35C8C071
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = ArmVirtMemInfoLib
|
||||
|
||||
[Sources]
|
||||
KvmtoolVirtMemInfoLib.c
|
||||
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
ArmLib
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
MemoryAllocationLib
|
||||
PcdLib
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||
gArmTokenSpaceGuid.PcdSystemMemoryBase
|
||||
gArmTokenSpaceGuid.PcdSystemMemorySize
|
||||
|
||||
[FixedPcd]
|
||||
gArmTokenSpaceGuid.PcdFvSize
|
335
ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c
Normal file
335
ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c
Normal file
@ -0,0 +1,335 @@
|
||||
/** @file
|
||||
An instance of the NorFlashPlatformLib for Kvmtool platform.
|
||||
|
||||
Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/NorFlashPlatformLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Protocol/FdtClient.h>
|
||||
|
||||
/** Macro defining the NOR block size configured in Kvmtool.
|
||||
*/
|
||||
#define KVMTOOL_NOR_BLOCK_SIZE SIZE_64KB
|
||||
|
||||
/** Macro defining the maximum number of Flash devices.
|
||||
*/
|
||||
#define MAX_FLASH_DEVICES 4
|
||||
|
||||
/** Macro defining the cfi-flash label describing the UEFI variable store.
|
||||
*/
|
||||
#define LABEL_UEFI_VAR_STORE "System-firmware"
|
||||
|
||||
STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[MAX_FLASH_DEVICES];
|
||||
STATIC UINTN mNorFlashDeviceCount = 0;
|
||||
STATIC INT32 mUefiVarStoreNode = MAX_INT32;
|
||||
STATIC FDT_CLIENT_PROTOCOL *mFdtClient;
|
||||
|
||||
/** This function performs platform specific actions to initialise
|
||||
the NOR flash, if required.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
**/
|
||||
EFI_STATUS
|
||||
NorFlashPlatformInitialization (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "NorFlashPlatformInitialization\n"));
|
||||
|
||||
if ((mNorFlashDeviceCount > 0) && (mUefiVarStoreNode != MAX_INT32)) {
|
||||
//
|
||||
// UEFI takes ownership of the cfi-flash hardware, and exposes its
|
||||
// functionality through the UEFI Runtime Variable Service. This means we
|
||||
// need to disable it in the device tree to prevent the OS from attaching
|
||||
// its device driver as well.
|
||||
// Note: This library is loaded twice. First by FaultTolerantWriteDxe to
|
||||
// setup the PcdFlashNvStorageFtw* and later by NorFlashDxe to provide the
|
||||
// NorFlashPlatformLib interfaces. If the node is disabled when the library
|
||||
// is first loaded, then during the subsequent loading of the library the
|
||||
// call to FindNextCompatibleNode() from the library constructor skips the
|
||||
// FDT node used for UEFI storage variable. Due to this we cannot setup the
|
||||
// NOR flash device description i.e. mNorFlashDevices[].
|
||||
// Since NorFlashPlatformInitialization() is called only by NorFlashDxe,
|
||||
// we know it is safe to disable the node here.
|
||||
//
|
||||
Status = mFdtClient->SetNodeProperty (
|
||||
mFdtClient,
|
||||
mUefiVarStoreNode,
|
||||
"status",
|
||||
"disabled",
|
||||
sizeof ("disabled")
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "Failed to set cfi-flash status to 'disabled'\n"));
|
||||
}
|
||||
} else {
|
||||
Status = EFI_NOT_FOUND;
|
||||
DEBUG ((DEBUG_ERROR, "Flash device for UEFI variable storage not found\n"));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/** Initialise Non volatile Flash storage variables.
|
||||
|
||||
@param [in] FlashDevice Pointer to the NOR Flash device.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES Insufficient flash storage space.
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
SetupVariableStore (
|
||||
IN NOR_FLASH_DESCRIPTION * FlashDevice
|
||||
)
|
||||
{
|
||||
UINTN FlashRegion;
|
||||
UINTN FlashNvStorageVariableBase;
|
||||
UINTN FlashNvStorageFtwWorkingBase;
|
||||
UINTN FlashNvStorageFtwSpareBase;
|
||||
UINTN FlashNvStorageVariableSize;
|
||||
UINTN FlashNvStorageFtwWorkingSize;
|
||||
UINTN FlashNvStorageFtwSpareSize;
|
||||
|
||||
FlashNvStorageVariableSize = PcdGet32 (PcdFlashNvStorageVariableSize);
|
||||
FlashNvStorageFtwWorkingSize = PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
||||
FlashNvStorageFtwSpareSize = PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
||||
|
||||
if ((FlashNvStorageVariableSize == 0) ||
|
||||
(FlashNvStorageFtwWorkingSize == 0) ||
|
||||
(FlashNvStorageFtwSpareSize == 0)) {
|
||||
DEBUG ((DEBUG_ERROR, "FlashNvStorage size not defined\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Setup the variable store
|
||||
FlashRegion = FlashDevice->DeviceBaseAddress;
|
||||
|
||||
FlashNvStorageVariableBase = FlashRegion;
|
||||
FlashRegion += PcdGet32 (PcdFlashNvStorageVariableSize);
|
||||
|
||||
FlashNvStorageFtwWorkingBase = FlashRegion;
|
||||
FlashRegion += PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
||||
|
||||
FlashNvStorageFtwSpareBase = FlashRegion;
|
||||
FlashRegion += PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
||||
|
||||
if (FlashRegion > (FlashDevice->DeviceBaseAddress + FlashDevice->Size)) {
|
||||
DEBUG ((DEBUG_ERROR, "Insufficient flash storage size\n"));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
PcdSet32S (
|
||||
PcdFlashNvStorageVariableBase,
|
||||
FlashNvStorageVariableBase
|
||||
);
|
||||
|
||||
PcdSet32S (
|
||||
PcdFlashNvStorageFtwWorkingBase,
|
||||
FlashNvStorageFtwWorkingBase
|
||||
);
|
||||
|
||||
PcdSet32S (
|
||||
PcdFlashNvStorageFtwSpareBase,
|
||||
FlashNvStorageFtwSpareBase
|
||||
);
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"PcdFlashNvStorageVariableBase = 0x%x\n",
|
||||
FlashNvStorageVariableBase
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"PcdFlashNvStorageVariableSize = 0x%x\n",
|
||||
FlashNvStorageVariableSize
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"PcdFlashNvStorageFtwWorkingBase = 0x%x\n",
|
||||
FlashNvStorageFtwWorkingBase
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"PcdFlashNvStorageFtwWorkingSize = 0x%x\n",
|
||||
FlashNvStorageFtwWorkingSize
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"PcdFlashNvStorageFtwSpareBase = 0x%x\n",
|
||||
FlashNvStorageFtwSpareBase
|
||||
));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"PcdFlashNvStorageFtwSpareSize = 0x%x\n",
|
||||
FlashNvStorageFtwSpareSize
|
||||
));
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/** Return the Flash devices on the platform.
|
||||
|
||||
@param [out] NorFlashDescriptions Pointer to the Flash device description.
|
||||
@param [out] Count Number of Flash devices.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_NOT_FOUND Flash device not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
NorFlashPlatformGetDevices (
|
||||
OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions,
|
||||
OUT UINT32 *Count
|
||||
)
|
||||
{
|
||||
if (mNorFlashDeviceCount > 0) {
|
||||
*NorFlashDescriptions = mNorFlashDevices;
|
||||
*Count = mNorFlashDeviceCount;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
/** Entrypoint for NorFlashPlatformLib.
|
||||
|
||||
@param [in] ImageHandle The handle to the image.
|
||||
@param [in] SystemTable Pointer to the System Table.
|
||||
|
||||
@retval EFI_SUCCESS Success.
|
||||
@retval EFI_INVALID_PARAMETER A parameter is invalid.
|
||||
@retval EFI_NOT_FOUND Flash device not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
NorFlashPlatformLibConstructor (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE * SystemTable
|
||||
)
|
||||
{
|
||||
INT32 Node;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS FindNodeStatus;
|
||||
CONST UINT32 *Reg;
|
||||
UINT32 PropSize;
|
||||
UINT64 Base;
|
||||
UINT64 Size;
|
||||
UINTN UefiVarStoreIndex;
|
||||
CONST CHAR8 *Label;
|
||||
UINT32 LabelLen;
|
||||
|
||||
if (mNorFlashDeviceCount != 0) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gFdtClientProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&mFdtClient
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
UefiVarStoreIndex = MAX_UINTN;
|
||||
for (FindNodeStatus = mFdtClient->FindCompatibleNode (
|
||||
mFdtClient,
|
||||
"cfi-flash",
|
||||
&Node
|
||||
);
|
||||
!EFI_ERROR (FindNodeStatus) &&
|
||||
(mNorFlashDeviceCount < MAX_FLASH_DEVICES);
|
||||
FindNodeStatus = mFdtClient->FindNextCompatibleNode (
|
||||
mFdtClient,
|
||||
"cfi-flash",
|
||||
Node,
|
||||
&Node
|
||||
)) {
|
||||
Status = mFdtClient->GetNodeProperty (
|
||||
mFdtClient,
|
||||
Node,
|
||||
"label",
|
||||
(CONST VOID **)&Label,
|
||||
&LabelLen
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: GetNodeProperty ('label') failed (Status == %r)\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
} else if (AsciiStrCmp (Label, LABEL_UEFI_VAR_STORE) == 0) {
|
||||
UefiVarStoreIndex = mNorFlashDeviceCount;
|
||||
mUefiVarStoreNode = Node;
|
||||
}
|
||||
|
||||
Status = mFdtClient->GetNodeProperty (
|
||||
mFdtClient,
|
||||
Node,
|
||||
"reg",
|
||||
(CONST VOID **)&Reg,
|
||||
&PropSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: GetNodeProperty () failed (Status == %r)\n",
|
||||
__FUNCTION__, Status));
|
||||
continue;
|
||||
}
|
||||
|
||||
ASSERT ((PropSize % (4 * sizeof (UINT32))) == 0);
|
||||
|
||||
while ((PropSize >= (4 * sizeof (UINT32))) &&
|
||||
(mNorFlashDeviceCount < MAX_FLASH_DEVICES)) {
|
||||
Base = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[0]));
|
||||
Size = SwapBytes64 (ReadUnaligned64 ((VOID *)&Reg[2]));
|
||||
Reg += 4;
|
||||
|
||||
PropSize -= 4 * sizeof (UINT32);
|
||||
|
||||
//
|
||||
// Disregard any flash devices that overlap with the primary FV.
|
||||
// The firmware is not updatable from inside the guest anyway.
|
||||
//
|
||||
if ((PcdGet64 (PcdFvBaseAddress) + PcdGet32 (PcdFvSize) > Base) &&
|
||||
(Base + Size) > PcdGet64 (PcdFvBaseAddress)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"NOR%d : Base = 0x%lx, Size = 0x%lx\n",
|
||||
mNorFlashDeviceCount,
|
||||
Base,
|
||||
Size
|
||||
));
|
||||
|
||||
mNorFlashDevices[mNorFlashDeviceCount].DeviceBaseAddress = (UINTN)Base;
|
||||
mNorFlashDevices[mNorFlashDeviceCount].RegionBaseAddress = (UINTN)Base;
|
||||
mNorFlashDevices[mNorFlashDeviceCount].Size = (UINTN)Size;
|
||||
mNorFlashDevices[mNorFlashDeviceCount].BlockSize = KVMTOOL_NOR_BLOCK_SIZE;
|
||||
mNorFlashDeviceCount++;
|
||||
}
|
||||
} // for
|
||||
|
||||
// Setup the variable store in the last device
|
||||
if (mNorFlashDeviceCount > 0) {
|
||||
if (UefiVarStoreIndex == MAX_UINTN) {
|
||||
// We did not find a label matching the UEFI Variable store. Default to
|
||||
// using the last cfi-flash device as the variable store.
|
||||
UefiVarStoreIndex = mNorFlashDeviceCount - 1;
|
||||
mUefiVarStoreNode = Node;
|
||||
}
|
||||
if (mNorFlashDevices[UefiVarStoreIndex].DeviceBaseAddress != 0) {
|
||||
return SetupVariableStore (&mNorFlashDevices[UefiVarStoreIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
49
ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
Normal file
49
ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
Normal file
@ -0,0 +1,49 @@
|
||||
## @file
|
||||
# Nor Flash library for Kvmtool.
|
||||
#
|
||||
# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001B
|
||||
BASE_NAME = NorFlashKvmtoolLib
|
||||
FILE_GUID = E75F07A1-B160-4893-BDD4-09E32FF847DC
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = NorFlashPlatformLib
|
||||
CONSTRUCTOR = NorFlashPlatformLibConstructor
|
||||
|
||||
[Sources.common]
|
||||
NorFlashKvmtool.c
|
||||
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
PcdLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
[Protocols]
|
||||
gFdtClientProtocolGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||
gArmTokenSpaceGuid.PcdFvSize
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
|
||||
[Depex]
|
||||
gFdtClientProtocolGuid
|
@ -14,8 +14,8 @@
|
||||
"id": "iasl-ci-1",
|
||||
"scope": "cibuild",
|
||||
"type": "nuget",
|
||||
"name": "iasl",
|
||||
"source": "https://api.nuget.org/v3/index.json",
|
||||
"version": "20190215.0.0",
|
||||
"name": "edk2-acpica-iasl",
|
||||
"source": "https://pkgs.dev.azure.com/projectmu/acpica/_packaging/mu_iasl/nuget/v3/index.json",
|
||||
"version": "20200717.0.0",
|
||||
"flags": ["set_path", "host_specific"]
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
@REM @file
|
||||
@REM This script will exec Brotli tool with -e/-d options.
|
||||
@REM
|
||||
@REM Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
@REM
|
||||
|
||||
@echo off
|
||||
@setlocal
|
||||
|
||||
set QLT=-q 9 -w 22
|
||||
set ARGS=
|
||||
|
||||
:Begin
|
||||
if "%1"=="" goto End
|
||||
|
||||
if "%1"=="-d" (
|
||||
set ARGS=%ARGS% %1
|
||||
shift
|
||||
goto Begin
|
||||
)
|
||||
|
||||
if "%1"=="-e" (
|
||||
shift
|
||||
goto Begin
|
||||
)
|
||||
|
||||
if "%1"=="-g" (
|
||||
set ARGS=%ARGS% %1 %2
|
||||
shift
|
||||
shift
|
||||
goto Begin
|
||||
)
|
||||
|
||||
if "%1"=="-o" (
|
||||
set ARGS=%ARGS% %1 %2
|
||||
shift
|
||||
shift
|
||||
goto Begin
|
||||
)
|
||||
|
||||
if "%1"=="-q" (
|
||||
set QLT=%1 %2
|
||||
shift
|
||||
shift
|
||||
goto Begin
|
||||
)
|
||||
|
||||
set ARGS=%ARGS% %1
|
||||
shift
|
||||
goto Begin
|
||||
|
||||
:End
|
||||
Brotli %QLT% %ARGS%
|
||||
@echo on
|
@ -515,7 +515,7 @@
|
||||
"$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
|
||||
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
|
||||
cd $(OUTPUT_DIR)(+)${s_dir}
|
||||
"$(ASM16)" /nologo /c /omf $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
|
||||
"$(ASM16)" /nologo /c /omf $(ASM16_FLAGS) $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
|
||||
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
|
||||
|
||||
<Command.GCC>
|
||||
|
572
BaseTools/Source/C/BrotliCompress/BrotliCompress.c
Normal file
572
BaseTools/Source/C/BrotliCompress/BrotliCompress.c
Normal file
@ -0,0 +1,572 @@
|
||||
/** @file
|
||||
BrotliCompress Compress/Decompress tool (BrotliCompress)
|
||||
|
||||
Copyright (c) 2020, ByoSoft Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
/* Command line interface for Brotli library. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "./brotli/c/common/constants.h"
|
||||
#include "./brotli/c/common/version.h"
|
||||
#include <brotli/decode.h>
|
||||
#include <brotli/encode.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <share.h>
|
||||
#include <sys/utime.h>
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
#define STDIN_FILENO _fileno(stdin)
|
||||
#define STDOUT_FILENO _fileno(stdout)
|
||||
#define S_IRUSR S_IREAD
|
||||
#define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
|
||||
#define fopen ms_fopen
|
||||
#define open ms_open
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define fseek _fseeki64
|
||||
#define ftell _ftelli64
|
||||
#endif
|
||||
|
||||
static FILE* ms_fopen(const char* FileName, const char* Mode) {
|
||||
FILE* Result;
|
||||
Result = NULL;
|
||||
fopen_s(&Result, FileName, Mode);
|
||||
return Result;
|
||||
}
|
||||
|
||||
static int ms_open(const char* FileName, int Oflag, int Pmode) {
|
||||
int Result;
|
||||
Result = -1;
|
||||
_sopen_s(&Result, FileName, Oflag | O_BINARY, _SH_DENYNO, Pmode);
|
||||
return Result;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
#ifndef _MAX_PATH
|
||||
#define _MAX_PATH 500
|
||||
#endif
|
||||
|
||||
#define DEFAULT_LGWIN 22
|
||||
#define DECODE_HEADER_SIZE 0x10
|
||||
#define GAP_MEM_BLOCK 0x1000
|
||||
size_t ScratchBufferSize = 0;
|
||||
static const size_t kFileBufferSize = 1 << 19;
|
||||
|
||||
static void Version(void) {
|
||||
int Major;
|
||||
int Minor;
|
||||
int Patch;
|
||||
Major = BROTLI_VERSION >> 24;
|
||||
Minor = (BROTLI_VERSION >> 12) & 0xFFF;
|
||||
Patch = BROTLI_VERSION & 0xFFF;
|
||||
printf("BrotliCompress %d.%d.%d\n", Major, Minor, Patch);
|
||||
}
|
||||
|
||||
static void Usage() {
|
||||
printf("Usage: %s [OPTION]... [FILE]...\n", __FILE__);
|
||||
printf(
|
||||
"Options:\n"
|
||||
" -e, --compress compress\n"
|
||||
" -d, --decompress decompress\n"
|
||||
" -h, --help display this help and exit\n");
|
||||
printf(
|
||||
" -o FILE, --output=FILE output file (only if 1 input file)\n");
|
||||
printf(
|
||||
" -g NUM, --gap=NUM scratch memory gap level (1-16)\n");
|
||||
printf(
|
||||
" -q NUM, --quality=NUM compression level (%d-%d)\n",
|
||||
BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY);
|
||||
printf(
|
||||
" -v, --version display version and exit\n");
|
||||
}
|
||||
|
||||
static int64_t FileSize(const char* Path) {
|
||||
FILE *FileHandle;
|
||||
int64_t RetVal;
|
||||
FileHandle = fopen(Path, "rb");
|
||||
|
||||
if (FileHandle == NULL) {
|
||||
printf ("Failed to open file [%s]\n", Path);
|
||||
return -1;
|
||||
}
|
||||
if (fseek(FileHandle, 0L, SEEK_END) != 0) {
|
||||
printf ("Failed to seek file [%s]\n", Path);
|
||||
fclose(FileHandle);
|
||||
return -1;
|
||||
}
|
||||
RetVal = ftell(FileHandle);
|
||||
if (fclose(FileHandle) != 0) {
|
||||
printf ("Failed to close file [%s]\n", Path);
|
||||
return -1;
|
||||
}
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
static BROTLI_BOOL HasMoreInput(FILE *FileHandle) {
|
||||
return feof(FileHandle) ? BROTLI_FALSE : BROTLI_TRUE;
|
||||
}
|
||||
|
||||
int OpenFiles(char *InputFile, FILE **InHandle, char *OutputFile, FILE **OutHandle) {
|
||||
*InHandle = NULL;
|
||||
*OutHandle = NULL;
|
||||
*InHandle = fopen(InputFile, "rb");
|
||||
if (*InHandle == NULL) {
|
||||
printf("Failed to open input file [%s]\n", InputFile);
|
||||
return BROTLI_FALSE;
|
||||
}
|
||||
|
||||
*OutHandle = fopen(OutputFile, "wb+");
|
||||
if (*OutHandle == NULL) {
|
||||
printf("Failed to open output file [%s]\n", OutputFile);
|
||||
fclose(*InHandle);
|
||||
return BROTLI_FALSE;
|
||||
}
|
||||
return BROTLI_TRUE;
|
||||
}
|
||||
|
||||
int CompressFile(char *InputFile, uint8_t *InputBuffer, char *OutputFile, uint8_t *OutputBuffer, int Quality, int Gap) {
|
||||
int64_t InputFileSize;
|
||||
FILE *InputFileHandle;
|
||||
FILE *OutputFileHandle;
|
||||
BrotliEncoderState *EncodeState;
|
||||
uint32_t LgWin;
|
||||
BROTLI_BOOL IsEof;
|
||||
size_t AvailableIn;
|
||||
const uint8_t *NextIn;
|
||||
size_t AvailableOut;
|
||||
uint8_t *NextOut;
|
||||
uint8_t *Input;
|
||||
uint8_t *Output;
|
||||
size_t OutSize;
|
||||
uint32_t SizeHint;
|
||||
BROTLI_BOOL IsOk;
|
||||
AvailableIn = 0;
|
||||
IsEof = BROTLI_FALSE;
|
||||
Input = InputBuffer;
|
||||
Output = OutputBuffer;
|
||||
IsOk = BROTLI_TRUE;
|
||||
LgWin = DEFAULT_LGWIN;
|
||||
|
||||
InputFileSize = FileSize(InputFile);
|
||||
|
||||
IsOk = OpenFiles(InputFile, &InputFileHandle, OutputFile, &OutputFileHandle);
|
||||
if (!IsOk) {
|
||||
return IsOk;
|
||||
}
|
||||
|
||||
fseek (OutputFileHandle, DECODE_HEADER_SIZE, SEEK_SET);
|
||||
|
||||
EncodeState = BrotliEncoderCreateInstance(NULL, NULL, NULL);
|
||||
if (!EncodeState) {
|
||||
printf("Out of memory\n");
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
BrotliEncoderSetParameter(EncodeState, BROTLI_PARAM_QUALITY, (uint32_t)Quality);
|
||||
|
||||
if (InputFileSize >= 0) {
|
||||
LgWin = BROTLI_MIN_WINDOW_BITS;
|
||||
while (BROTLI_MAX_BACKWARD_LIMIT(LgWin) < InputFileSize) {
|
||||
LgWin++;
|
||||
if (LgWin == BROTLI_MAX_WINDOW_BITS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
BrotliEncoderSetParameter(EncodeState, BROTLI_PARAM_LGWIN, LgWin);
|
||||
if (InputFileSize > 0) {
|
||||
SizeHint = InputFileSize < (1 << 30)? (uint32_t)InputFileSize : (1u << 30);
|
||||
BrotliEncoderSetParameter(EncodeState, BROTLI_PARAM_SIZE_HINT, SizeHint);
|
||||
}
|
||||
|
||||
AvailableIn = 0;
|
||||
NextIn = NULL;
|
||||
AvailableOut = kFileBufferSize;
|
||||
NextOut = Output;
|
||||
for (;;) {
|
||||
if (AvailableIn == 0 && !IsEof) {
|
||||
AvailableIn = fread(Input, 1, kFileBufferSize, InputFileHandle);
|
||||
NextIn = Input;
|
||||
if (ferror(InputFileHandle)) {
|
||||
printf("Failed to read input [%s]\n", InputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
IsEof = !HasMoreInput(InputFileHandle);
|
||||
}
|
||||
|
||||
if (!BrotliEncoderCompressStream(EncodeState,
|
||||
IsEof ? BROTLI_OPERATION_FINISH : BROTLI_OPERATION_PROCESS,
|
||||
&AvailableIn, &NextIn, &AvailableOut, &NextOut, NULL)) {
|
||||
printf("Failed to compress data [%s]\n", InputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
if (AvailableOut == 0) {
|
||||
OutSize = (size_t)(NextOut - Output);
|
||||
if (OutSize > 0) {
|
||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
||||
if (ferror(OutputFileHandle)) {
|
||||
printf("Failed to write output [%s]\n", OutputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
}
|
||||
AvailableOut = kFileBufferSize;
|
||||
NextOut = Output;
|
||||
}
|
||||
if (BrotliEncoderIsFinished(EncodeState)) {
|
||||
OutSize = (size_t)(NextOut - Output);
|
||||
if (OutSize > 0) {
|
||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
||||
if (ferror(OutputFileHandle)) {
|
||||
printf("Failed to write output [%s]\n", OutputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
AvailableOut = 0;
|
||||
}
|
||||
}
|
||||
if (IsEof) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Finish:
|
||||
if (EncodeState) {
|
||||
BrotliEncoderDestroyInstance(EncodeState);
|
||||
}
|
||||
if (InputFileHandle) {
|
||||
fclose(InputFileHandle);
|
||||
}
|
||||
if (OutputFileHandle) {
|
||||
fclose(OutputFileHandle);
|
||||
}
|
||||
return IsOk;
|
||||
}
|
||||
|
||||
/* Default BrotliAllocFunc */
|
||||
void* BrotliAllocFunc(void* Opaque, size_t Size) {
|
||||
*(size_t *)Opaque = *(size_t *) Opaque + Size;
|
||||
return malloc(Size);
|
||||
}
|
||||
|
||||
/* Default BrotliFreeFunc */
|
||||
void BrotliFreeFunc(void* Opaque, void* Address) {
|
||||
free(Address);
|
||||
}
|
||||
|
||||
int DecompressFile(char *InputFile, uint8_t *InputBuffer, char *OutputFile, uint8_t *OutputBuffer, int Quality, int Gap) {
|
||||
FILE *InputFileHandle;
|
||||
FILE *OutputFileHandle;
|
||||
BrotliDecoderState *DecoderState;
|
||||
BrotliDecoderResult Result;
|
||||
size_t AvailableIn;
|
||||
const uint8_t *NextIn;
|
||||
size_t AvailableOut;
|
||||
uint8_t *NextOut;
|
||||
uint8_t *Input;
|
||||
uint8_t *Output;
|
||||
size_t OutSize;
|
||||
BROTLI_BOOL IsOk;
|
||||
AvailableIn = 0;
|
||||
Input = InputBuffer;
|
||||
Output = OutputBuffer;
|
||||
IsOk = BROTLI_TRUE;
|
||||
|
||||
IsOk = OpenFiles(InputFile, &InputFileHandle, OutputFile, &OutputFileHandle);
|
||||
if (!IsOk) {
|
||||
return IsOk;
|
||||
}
|
||||
fseek(InputFileHandle, DECODE_HEADER_SIZE, SEEK_SET);
|
||||
|
||||
DecoderState = BrotliDecoderCreateInstance(BrotliAllocFunc, BrotliFreeFunc, &ScratchBufferSize);
|
||||
if (!DecoderState) {
|
||||
printf("Out of memory\n");
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
/* This allows decoding "large-window" streams. Though it creates
|
||||
fragmentation (new builds decode streams that old builds don't),
|
||||
it is better from used experience perspective. */
|
||||
BrotliDecoderSetParameter(DecoderState, BROTLI_DECODER_PARAM_LARGE_WINDOW, 1u);
|
||||
|
||||
AvailableIn = 0;
|
||||
NextIn = NULL;
|
||||
AvailableOut = kFileBufferSize;
|
||||
NextOut = Output;
|
||||
Result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
|
||||
for (;;) {
|
||||
if (Result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
|
||||
if (!HasMoreInput(InputFileHandle)) {
|
||||
printf("Corrupt input [%s]\n", InputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
AvailableIn = fread(Input, 1, kFileBufferSize, InputFileHandle);
|
||||
NextIn = Input;
|
||||
if (ferror(InputFileHandle)) {
|
||||
printf("Failed to read input [%s]\n", InputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
} else if (Result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
|
||||
OutSize = (size_t) (NextOut - Output);
|
||||
if (OutSize > 0) {
|
||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
||||
if (ferror(OutputFileHandle)) {
|
||||
printf("Failed to write output [%s]\n", OutputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
}
|
||||
AvailableOut = kFileBufferSize;
|
||||
NextOut = Output;
|
||||
} else if (Result == BROTLI_DECODER_RESULT_SUCCESS) {
|
||||
OutSize = (size_t) (NextOut - Output);
|
||||
if (OutSize > 0) {
|
||||
fwrite(Output, 1, OutSize, OutputFileHandle);
|
||||
if (ferror(OutputFileHandle)) {
|
||||
printf("Failed to write output [%s]\n", OutputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
}
|
||||
AvailableOut = 0;
|
||||
if (AvailableIn != 0 || HasMoreInput(InputFileHandle)) {
|
||||
printf("Corrupt input [%s]\n", InputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
} else {
|
||||
printf("Corrupt input [%s]\n", InputFile);
|
||||
IsOk = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
if (!HasMoreInput(InputFileHandle) && Result == BROTLI_DECODER_RESULT_SUCCESS ) {
|
||||
break;
|
||||
}
|
||||
Result = BrotliDecoderDecompressStream(DecoderState, &AvailableIn, &NextIn, &AvailableOut, &NextOut, 0);
|
||||
}
|
||||
Finish:
|
||||
if (DecoderState) {
|
||||
BrotliDecoderDestroyInstance(DecoderState);
|
||||
}
|
||||
if (InputFileHandle) {
|
||||
fclose(InputFileHandle);
|
||||
}
|
||||
if (OutputFileHandle) {
|
||||
fclose(OutputFileHandle);
|
||||
}
|
||||
return IsOk;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
BROTLI_BOOL CompressBool;
|
||||
BROTLI_BOOL DecompressBool;
|
||||
char *OutputFile;
|
||||
char *InputFile;
|
||||
char OutputTmpFile[_MAX_PATH];
|
||||
FILE *OutputHandle;
|
||||
int Quality;
|
||||
int Gap;
|
||||
int OutputFileLength;
|
||||
int InputFileLength;
|
||||
int Ret;
|
||||
size_t InputFileSize;
|
||||
uint8_t *Buffer;
|
||||
uint8_t *InputBuffer;
|
||||
uint8_t *OutputBuffer;
|
||||
int64_t Size;
|
||||
|
||||
InputFile = NULL;
|
||||
OutputFile = NULL;
|
||||
CompressBool = BROTLI_FALSE;
|
||||
DecompressBool = BROTLI_FALSE;
|
||||
//
|
||||
//Set default Quality and Gap
|
||||
//
|
||||
Quality = 9;
|
||||
Gap = 1;
|
||||
InputFileSize = 0;
|
||||
Ret = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
Usage();
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0 ) {
|
||||
Usage();
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(argv[1], "-v") == 0 || strcmp (argv[1], "--version") == 0 ) {
|
||||
Version();
|
||||
return 0;
|
||||
}
|
||||
while (argc > 1) {
|
||||
if (strcmp(argv[1], "-e") == 0 || strcmp(argv[1], "--compress") == 0 ) {
|
||||
CompressBool = BROTLI_TRUE;
|
||||
if (DecompressBool) {
|
||||
printf("Can't use -e/--compress with -d/--decompess on the same time\n");
|
||||
return 1;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "--decompress") == 0 ) {
|
||||
DecompressBool = BROTLI_TRUE;
|
||||
if (CompressBool) {
|
||||
printf("Can't use -e/--compress with -d/--decompess on the same time\n");
|
||||
return 1;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(argv[1], "-o") == 0 || strncmp(argv[1], "--output", 8) == 0) {
|
||||
if (strcmp(argv[1], "-o") == 0) {
|
||||
OutputFileLength = strlen(argv[2]);
|
||||
if (OutputFileLength > _MAX_PATH) {
|
||||
printf ("The file path %s is too long\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
OutputFile = argv[2];
|
||||
if (OutputFile == NULL) {
|
||||
fprintf(stderr, "Input file can't be null\n");
|
||||
return 1;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
} else {
|
||||
OutputFileLength = strlen(argv[1] - 9);
|
||||
OutputFile = (char *)argv[1] + 9;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(argv[1], "-q") == 0 || strncmp(argv[1], "--quality", 9) == 0) {
|
||||
if (strcmp(argv[1], "-q") == 0) {
|
||||
Quality = strtol(argv[2], NULL, 16);
|
||||
argc--;
|
||||
argv++;
|
||||
} else {
|
||||
Quality = strtol((char *)argv[1] + 10, NULL, 16);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(argv[1], "-g") == 0 || strncmp(argv[1], "--gap", 5) == 0) {
|
||||
if (strcmp(argv[1], "-g") == 0) {
|
||||
Gap = strtol(argv[2], NULL, 16);
|
||||
argc--;
|
||||
argv++;
|
||||
} else {
|
||||
Gap = strtol((char *)argv[1] + 6, NULL, 16);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if (argc > 1) {
|
||||
InputFileLength = strlen(argv[1]);
|
||||
if (InputFileLength > _MAX_PATH - 1) {
|
||||
printf ("The file path %s is too long\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
InputFile = argv[1];
|
||||
if (InputFile == NULL) {
|
||||
printf("Input file can't be null\n");
|
||||
return 1;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
Buffer = (uint8_t*)malloc(kFileBufferSize * 2);
|
||||
if (!Buffer) {
|
||||
printf("Out of memory\n");
|
||||
goto Finish;
|
||||
}
|
||||
memset(Buffer, 0, kFileBufferSize*2);
|
||||
InputBuffer = Buffer;
|
||||
OutputBuffer = Buffer + kFileBufferSize;
|
||||
if (CompressBool) {
|
||||
//
|
||||
// Compress file
|
||||
//
|
||||
Ret = CompressFile(InputFile, InputBuffer, OutputFile, OutputBuffer, Quality, Gap);
|
||||
if (!Ret) {
|
||||
printf ("Failed to compress file [%s]\n", InputFile);
|
||||
goto Finish;
|
||||
}
|
||||
//
|
||||
// Decompress file for get Outputfile size
|
||||
//
|
||||
strcpy (OutputTmpFile, OutputFile);
|
||||
if (strlen(InputFile) + strlen(".tmp") < _MAX_PATH) {
|
||||
strcat(OutputTmpFile, ".tmp");
|
||||
} else {
|
||||
printf ("Output file path is too long[%s]\n", OutputFile);
|
||||
Ret = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
memset(Buffer, 0, kFileBufferSize*2);
|
||||
Ret = DecompressFile(OutputFile, InputBuffer, OutputTmpFile, OutputBuffer, Quality, Gap);
|
||||
if (!Ret) {
|
||||
printf ("Failed to decompress file [%s]\n", OutputFile);
|
||||
goto Finish;
|
||||
}
|
||||
remove (OutputTmpFile);
|
||||
|
||||
//
|
||||
// fill decoder header
|
||||
//
|
||||
InputFileSize = FileSize(InputFile);
|
||||
Size = (int64_t)InputFileSize;
|
||||
OutputHandle = fopen(OutputFile, "rb+"); /* open output_path file and add in head info */
|
||||
fwrite(&Size, 1, sizeof(int64_t), OutputHandle);
|
||||
ScratchBufferSize += Gap * GAP_MEM_BLOCK; /* there is a memory gap between IA32 and X64 environment*/
|
||||
ScratchBufferSize += kFileBufferSize * 2;
|
||||
Size = (int64_t) ScratchBufferSize;
|
||||
fwrite(&Size, 1, sizeof(int64_t), OutputHandle);
|
||||
if (fclose(OutputHandle) != 0) {
|
||||
printf("Failed to close output file [%s]\n", OutputFile);
|
||||
Ret = BROTLI_FALSE;
|
||||
goto Finish;
|
||||
}
|
||||
} else {
|
||||
Ret = DecompressFile(InputFile, InputBuffer, OutputFile, OutputBuffer, Quality, Gap);
|
||||
if (!Ret) {
|
||||
printf ("Failed to decompress file [%s]\n", InputFile);
|
||||
goto Finish;
|
||||
}
|
||||
}
|
||||
Finish:
|
||||
if (Buffer != NULL) {
|
||||
free (Buffer);
|
||||
}
|
||||
return !Ret;
|
||||
}
|
@ -6,10 +6,10 @@
|
||||
#
|
||||
MAKEROOT ?= ..
|
||||
|
||||
APPNAME = Brotli
|
||||
APPNAME = BrotliCompress
|
||||
|
||||
OBJECTS = \
|
||||
brotli/c/tools/brotli.o \
|
||||
BrotliCompress.o \
|
||||
brotli/c/common/dictionary.o \
|
||||
brotli/c/common/transform.o \
|
||||
brotli/c/dec/bit_reader.o \
|
||||
|
@ -9,7 +9,7 @@
|
||||
INC = -I .\brotli\c\include $(INC)
|
||||
CFLAGS = $(CFLAGS) /W2
|
||||
|
||||
APPNAME = Brotli
|
||||
APPNAME = BrotliCompress
|
||||
|
||||
#LIBS = $(LIB_PATH)\Common.lib
|
||||
|
||||
@ -40,7 +40,7 @@ ENC_OBJ = \
|
||||
brotli\c\enc\utf8_util.obj
|
||||
|
||||
OBJECTS = \
|
||||
brotli\c\tools\brotli.obj \
|
||||
BrotliCompress.obj \
|
||||
$(COMMON_OBJ) \
|
||||
$(DEC_OBJ) \
|
||||
$(ENC_OBJ)
|
||||
|
@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)
|
||||
#define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0])
|
||||
#define __OFFSET_OF(TYPE, Field) ((UINT32) &(((TYPE *)0)->Field))
|
||||
#define __OFFSET_OF(TYPE, Field) ((UINT32)(size_t) &(((TYPE *)0)->Field))
|
||||
#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex) if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size)
|
||||
#define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0]))
|
||||
|
||||
|
@ -26,6 +26,9 @@ ifndef HOST_ARCH
|
||||
else ifneq (,$(findstring arm,$(uname_m)))
|
||||
HOST_ARCH=ARM
|
||||
endif
|
||||
ifneq (,$(findstring riscv64,$(uname_m)))
|
||||
HOST_ARCH=RISCV64
|
||||
endif
|
||||
ifndef HOST_ARCH
|
||||
$(info Could not detected HOST_ARCH from uname results)
|
||||
$(error HOST_ARCH is not defined!)
|
||||
|
@ -903,7 +903,12 @@ Returns:
|
||||
fprintf (FvMapFile, "BaseAddress=0x%010llx, ", (unsigned long long) (ImageBaseAddress + Offset));
|
||||
}
|
||||
|
||||
fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
|
||||
fprintf (FvMapFile, "EntryPoint=0x%010llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
|
||||
if (!pImageContext->IsTeImage) {
|
||||
fprintf (FvMapFile, "Type=PE");
|
||||
} else {
|
||||
fprintf (FvMapFile, "Type=TE");
|
||||
}
|
||||
fprintf (FvMapFile, ")\n");
|
||||
|
||||
fprintf (FvMapFile, "(GUID=%s", FileGuidName);
|
||||
|
@ -57,6 +57,16 @@
|
||||
#define NULL ((VOID *) 0)
|
||||
#endif
|
||||
|
||||
#ifdef __CC_ARM
|
||||
//
|
||||
// Older RVCT ARM compilers don't fully support #pragma pack and require __packed
|
||||
// as a prefix for the structure.
|
||||
//
|
||||
#define PACKED __packed
|
||||
#else
|
||||
#define PACKED
|
||||
#endif
|
||||
|
||||
//
|
||||
// Support for variable length argument lists using the ANSI standard.
|
||||
//
|
||||
|
85
BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
Normal file
85
BaseTools/Source/C/Include/RiscV64/ProcessorBind.h
Normal file
@ -0,0 +1,85 @@
|
||||
/** @file
|
||||
Processor or Compiler specific defines and types for RISC-V.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
//
|
||||
// Define the processor type so other code can make processor based choices
|
||||
//
|
||||
#define MDE_CPU_RISCV64
|
||||
|
||||
//
|
||||
// Make sure we are using the correct packing rules per EFI specification
|
||||
//
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
//
|
||||
// Use ANSI C 2000 stdint.h integer width declarations
|
||||
//
|
||||
#include <stdint.h>
|
||||
typedef uint8_t BOOLEAN;
|
||||
typedef int8_t INT8;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int16_t INT16;
|
||||
typedef uint16_t UINT16;
|
||||
typedef int32_t INT32;
|
||||
typedef uint32_t UINT32;
|
||||
typedef int64_t INT64;
|
||||
typedef uint64_t UINT64;
|
||||
typedef char CHAR8;
|
||||
typedef uint16_t CHAR16;
|
||||
|
||||
//
|
||||
// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
// 8 bytes on supported 64-bit processor instructions)
|
||||
//
|
||||
typedef UINT64 UINTN;
|
||||
|
||||
//
|
||||
// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
// 8 bytes on supported 64-bit processor instructions)
|
||||
//
|
||||
typedef INT64 INTN;
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
//
|
||||
|
||||
//
|
||||
// A value of native width with the highest bit set.
|
||||
//
|
||||
#define MAX_BIT 0x8000000000000000
|
||||
|
||||
//
|
||||
// A value of native width with the two highest bits set.
|
||||
//
|
||||
#define MAX_2_BITS 0xC000000000000000
|
||||
|
||||
//
|
||||
// The stack alignment required for RISC-V
|
||||
//
|
||||
#define CPU_STACK_ALIGNMENT 16
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
// use the correct C calling convention. All protocol member functions and
|
||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||
//
|
||||
#define EFIAPI
|
||||
|
||||
#if defined(__GNUC__)
|
||||
//
|
||||
// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
// Define this macro to unify the usage.
|
||||
//
|
||||
#define ASM_GLOBAL .globl
|
||||
#endif
|
||||
|
||||
#endif
|
@ -45,7 +45,10 @@ def RunCommand(WorkDir=None, *Args, **kwargs):
|
||||
|
||||
output_lock.acquire(True)
|
||||
print("execute command \"{0}\" in directory {1}".format(" ".join(Args), WorkDir))
|
||||
print(message)
|
||||
try:
|
||||
print(message)
|
||||
except:
|
||||
pass
|
||||
output_lock.release()
|
||||
|
||||
return p.returncode, stdout
|
||||
|
@ -28,6 +28,9 @@ ifndef HOST_ARCH
|
||||
else ifneq (,$(findstring arm,$(uname_m)))
|
||||
HOST_ARCH=ARM
|
||||
endif
|
||||
ifneq (,$(findstring riscv64,$(uname_m)))
|
||||
HOST_ARCH=RISCV64
|
||||
endif
|
||||
ifndef HOST_ARCH
|
||||
$(info Could not detected HOST_ARCH from uname results)
|
||||
$(error HOST_ARCH is not defined!)
|
||||
@ -64,6 +67,9 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
|
||||
else ifeq ($(HOST_ARCH), AARCH64)
|
||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
|
||||
|
||||
else ifeq ($(HOST_ARCH), RISCV64)
|
||||
ARCH_INCLUDE = -I $(MAKEROOT)/Include/RiscV64/
|
||||
|
||||
else
|
||||
$(error Bad HOST_ARCH)
|
||||
endif
|
||||
|
@ -55,7 +55,7 @@ AR = lib.exe
|
||||
LD = link.exe
|
||||
LINKER = $(LD)
|
||||
|
||||
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
|
||||
INC = $(INC) -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common
|
||||
|
||||
CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MT /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MT /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||
|
@ -192,6 +192,7 @@ VfrParserStart (
|
||||
#token LateCheckFlag("LATE_CHECK") "LATE_CHECK"
|
||||
#token ReadOnlyFlag("READ_ONLY") "READ_ONLY"
|
||||
#token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"
|
||||
#token RestStyleFlag("REST_STYLE") "REST_STYLE"
|
||||
#token Class("class") "class"
|
||||
#token Subclass("subclass") "subclass"
|
||||
#token ClassGuid("classguid") "classguid"
|
||||
@ -584,7 +585,7 @@ vfrFormSetDefinition :
|
||||
<<
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;
|
||||
EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;
|
||||
EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3, ClassGuid4;
|
||||
UINT8 ClassGuidNum = 0;
|
||||
CIfrFormSet *FSObj = NULL;
|
||||
UINT16 C, SC;
|
||||
@ -600,13 +601,16 @@ vfrFormSetDefinition :
|
||||
"\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>
|
||||
{
|
||||
"\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>
|
||||
{
|
||||
"\|" guidDefinition[ClassGuid4] << ++ClassGuidNum; >>
|
||||
}
|
||||
}
|
||||
}
|
||||
","
|
||||
}
|
||||
<<
|
||||
if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {
|
||||
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");
|
||||
if (mOverrideClassGuid != NULL && ClassGuidNum >= 4) {
|
||||
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 4 class guids, can't add extra class guid!");
|
||||
}
|
||||
switch (ClassGuidNum) {
|
||||
case 0:
|
||||
@ -643,10 +647,23 @@ vfrFormSetDefinition :
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (mOverrideClassGuid != NULL) {
|
||||
ClassGuidNum ++;
|
||||
}
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
||||
FSObj->SetClassGuid(&ClassGuid1);
|
||||
FSObj->SetClassGuid(&ClassGuid2);
|
||||
FSObj->SetClassGuid(&ClassGuid3);
|
||||
if (mOverrideClassGuid != NULL) {
|
||||
FSObj->SetClassGuid(mOverrideClassGuid);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
|
||||
FSObj->SetClassGuid(&ClassGuid1);
|
||||
FSObj->SetClassGuid(&ClassGuid2);
|
||||
FSObj->SetClassGuid(&ClassGuid3);
|
||||
FSObj->SetClassGuid(&ClassGuid4);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1321,6 +1338,7 @@ questionheaderFlagsField[UINT8 & Flags] :
|
||||
ReadOnlyFlag << $Flags |= 0x01; >>
|
||||
| InteractiveFlag << $Flags |= 0x04; >>
|
||||
| ResetRequiredFlag << $Flags |= 0x10; >>
|
||||
| RestStyleFlag << $Flags |= 0x20; >>
|
||||
| ReconnectRequiredFlag << $Flags |= 0x40; >>
|
||||
| O:OptionOnlyFlag <<
|
||||
gCVfrErrorHandle.HandleWarning (
|
||||
@ -3766,6 +3784,7 @@ oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
|
||||
| "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
|
||||
| InteractiveFlag << $HFlags |= 0x04; >>
|
||||
| ResetRequiredFlag << $HFlags |= 0x10; >>
|
||||
| RestStyleFlag << $HFlags |= 0x20; >>
|
||||
| ReconnectRequiredFlag << $HFlags |= 0x40; >>
|
||||
| ManufacturingFlag << $LFlags |= 0x20; >>
|
||||
| DefaultFlag << $LFlags |= 0x10; >>
|
||||
|
@ -72,9 +72,10 @@ class MemoryDataPipe(DataPipe):
|
||||
#Platform Module Pcds
|
||||
ModulePcds = {}
|
||||
for m in PlatformInfo.Platform.Modules:
|
||||
m_pcds = PlatformInfo.Platform.Modules[m].Pcds
|
||||
module = PlatformInfo.Platform.Modules[m]
|
||||
m_pcds = module.Pcds
|
||||
if m_pcds:
|
||||
ModulePcds[(m.File,m.Root,m.Arch)] = [PCD_DATA(
|
||||
ModulePcds[module.Guid] = [PCD_DATA(
|
||||
pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type,
|
||||
pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue,
|
||||
pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges,
|
||||
|
@ -1980,12 +1980,14 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
||||
AutoGenH.Append("#include <Library/PcdLib.h>\n")
|
||||
|
||||
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
|
||||
AutoGenH.Append('\nextern GUID gEdkiiDscPlatformGuid;')
|
||||
AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
|
||||
|
||||
if Info.IsLibrary:
|
||||
return
|
||||
|
||||
AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
|
||||
AutoGenH.Append("#define EDKII_DSC_PLATFORM_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.PlatformInfo.Guid))
|
||||
|
||||
if Info.IsLibrary:
|
||||
return
|
||||
@ -2002,6 +2004,7 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
|
||||
# Publish the CallerId Guid
|
||||
#
|
||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
|
||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEdkiiDscPlatformGuid = %s;\n' % GuidStringToGuidStructureString(Info.PlatformInfo.Guid))
|
||||
AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
|
||||
|
||||
## Create common code for header file
|
||||
|
@ -576,7 +576,7 @@ cleanlib:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
|
||||
ExtraData="[%s]" % str(MyAgo))
|
||||
|
||||
self.ProcessBuildTargetList()
|
||||
self.ProcessBuildTargetList(MyAgo.OutputDir, ToolsDef)
|
||||
self.ParserGenerateFfsCmd()
|
||||
|
||||
# Generate macros used to represent input files
|
||||
@ -786,8 +786,10 @@ cleanlib:
|
||||
|
||||
def ReplaceMacro(self, str):
|
||||
for Macro in self.MacroList:
|
||||
if self._AutoGenObject.Macros[Macro] and self._AutoGenObject.Macros[Macro] in str:
|
||||
str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + Macro + ')')
|
||||
if self._AutoGenObject.Macros[Macro] and os.path.normcase(self._AutoGenObject.Macros[Macro]) in os.path.normcase(str):
|
||||
replace_dir = str[os.path.normcase(str).index(os.path.normcase(self._AutoGenObject.Macros[Macro])): os.path.normcase(str).index(
|
||||
os.path.normcase(self._AutoGenObject.Macros[Macro])) + len(self._AutoGenObject.Macros[Macro])]
|
||||
str = str.replace(replace_dir, '$(' + Macro + ')')
|
||||
return str
|
||||
|
||||
def CommandExceedLimit(self):
|
||||
@ -901,7 +903,7 @@ cleanlib:
|
||||
BuildTargets[Target].Commands[i] = SingleCommand.replace('$(INC)', '').replace(FlagDict[Flag]['Macro'], RespMacro)
|
||||
return RespDict
|
||||
|
||||
def ProcessBuildTargetList(self):
|
||||
def ProcessBuildTargetList(self, RespFile, ToolsDef):
|
||||
#
|
||||
# Search dependency file list for each source file
|
||||
#
|
||||
@ -1002,6 +1004,7 @@ cleanlib:
|
||||
self.ObjTargetDict[T.Target.SubDir] = set()
|
||||
self.ObjTargetDict[T.Target.SubDir].add(NewFile)
|
||||
for Type in self._AutoGenObject.Targets:
|
||||
resp_file_number = 0
|
||||
for T in self._AutoGenObject.Targets[Type]:
|
||||
# Generate related macros if needed
|
||||
if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
|
||||
@ -1043,7 +1046,10 @@ cleanlib:
|
||||
Deps.append("$(%s)" % T.ListFileMacro)
|
||||
|
||||
if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE:
|
||||
T, CmdTarget, CmdTargetDict, CmdCppDict = self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict)
|
||||
T, CmdTarget, CmdTargetDict, CmdCppDict = self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict,
|
||||
CmdCppDict, DependencyDict, RespFile,
|
||||
ToolsDef, resp_file_number)
|
||||
resp_file_number += 1
|
||||
TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": CCodeDeps}
|
||||
CmdLine = self._BUILD_TARGET_TEMPLATE.Replace(TargetDict).rstrip().replace('\t$(OBJLIST', '$(OBJLIST')
|
||||
if T.Commands:
|
||||
@ -1060,7 +1066,9 @@ cleanlib:
|
||||
AnnexeTargetDict = {"target": self.PlaceMacro(i.Path, self.Macros), "cmd": "", "deps": self.PlaceMacro(T.Target.Path, self.Macros)}
|
||||
self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(AnnexeTargetDict))
|
||||
|
||||
def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict):
|
||||
def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict, RespFile, ToolsDef,
|
||||
resp_file_number):
|
||||
SaveFilePath = os.path.join(RespFile, "cc_resp_%s.txt" % resp_file_number)
|
||||
if not CmdSumDict:
|
||||
for item in self._AutoGenObject.Targets[Type]:
|
||||
CmdSumDict[item.Target.SubDir] = item.Target.BaseName
|
||||
@ -1087,17 +1095,36 @@ cleanlib:
|
||||
if Temp.startswith('/Fo'):
|
||||
CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH)
|
||||
break
|
||||
else: continue
|
||||
if CmdSign not in list(CmdTargetDict.keys()):
|
||||
CmdTargetDict[CmdSign] = Item.replace(Temp, CmdSign)
|
||||
else:
|
||||
CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
|
||||
continue
|
||||
if CmdSign not in list(CmdTargetDict.keys()):
|
||||
cmd = Item.replace(Temp, CmdSign)
|
||||
if SingleCommandList[-1] in cmd:
|
||||
CmdTargetDict[CmdSign] = [cmd.replace(SingleCommandList[-1], "").rstrip(), SingleCommandList[-1]]
|
||||
else:
|
||||
# CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
|
||||
CmdTargetDict[CmdSign].append(SingleCommandList[-1])
|
||||
Index = CommandList.index(Item)
|
||||
CommandList.pop(Index)
|
||||
if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):
|
||||
Cpplist = CmdCppDict[T.Target.SubDir]
|
||||
Cpplist.insert(0, '$(OBJLIST_%d): ' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
|
||||
T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])
|
||||
source_files = CmdTargetDict[CmdSign][1:]
|
||||
source_files.insert(0, " ")
|
||||
if len(source_files)>2:
|
||||
SaveFileOnChange(SaveFilePath, " ".join(source_files), False)
|
||||
T.Commands[Index] = '%s\n\t%s $(cc_resp_%s)' % (
|
||||
' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign][0], resp_file_number)
|
||||
ToolsDef.append("cc_resp_%s = @%s" % (resp_file_number, SaveFilePath))
|
||||
|
||||
elif len(source_files)<=2 and len(" ".join(CmdTargetDict[CmdSign][:2]))>GlobalData.gCommandMaxLength:
|
||||
SaveFileOnChange(SaveFilePath, " ".join(source_files), False)
|
||||
T.Commands[Index] = '%s\n\t%s $(cc_resp_%s)' % (
|
||||
' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign][0], resp_file_number)
|
||||
ToolsDef.append("cc_resp_%s = @%s" % (resp_file_number, SaveFilePath))
|
||||
|
||||
else:
|
||||
T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), " ".join(CmdTargetDict[CmdSign]))
|
||||
else:
|
||||
T.Commands.pop(Index)
|
||||
return T, CmdSumDict, CmdTargetDict, CmdCppDict
|
||||
|
@ -103,7 +103,7 @@ ${END}
|
||||
if os.path.normpath(dependency_file +".deps") == abspath:
|
||||
continue
|
||||
filename = os.path.basename(dependency_file).strip()
|
||||
if filename not in self.SourceFileList and filename not in targetname:
|
||||
if filename not in targetname:
|
||||
includes.add(dependency_file.strip())
|
||||
|
||||
for item in lines[1:]:
|
||||
@ -116,8 +116,6 @@ ${END}
|
||||
if os.path.normpath(dependency_file +".deps") == abspath:
|
||||
continue
|
||||
filename = os.path.basename(dependency_file).strip()
|
||||
if filename in self.SourceFileList:
|
||||
continue
|
||||
if filename in targetname:
|
||||
continue
|
||||
includes.add(dependency_file.strip())
|
||||
@ -203,7 +201,17 @@ ${END}
|
||||
cc_options = line[len(cc_cmd)+2:].split()
|
||||
else:
|
||||
cc_options = line[len(cc_cmd):].split()
|
||||
SourceFileAbsPathMap = {os.path.basename(item):item for item in cc_options if not item.startswith("/") and os.path.exists(item)}
|
||||
for item in cc_options:
|
||||
if not item.startswith("/"):
|
||||
if item.endswith(".txt") and item.startswith("@"):
|
||||
with open(item[1:], "r") as file:
|
||||
source_files = file.readlines()[0].split()
|
||||
SourceFileAbsPathMap = {os.path.basename(file): file for file in source_files if
|
||||
os.path.exists(file)}
|
||||
else:
|
||||
if os.path.exists(item):
|
||||
SourceFileAbsPathMap.update({os.path.basename(item): item.strip()})
|
||||
# SourceFileAbsPathMap = {os.path.basename(item):item for item in cc_options if not item.startswith("/") and os.path.exists(item)}
|
||||
if line in SourceFileAbsPathMap:
|
||||
current_source = line
|
||||
if current_source not in ModuleDepDict:
|
||||
@ -283,7 +291,8 @@ ${END}
|
||||
targetitem = self.GetRealTarget(source_abs.strip(" :"))
|
||||
|
||||
targetitem += ": "
|
||||
targetitem += lines[1]
|
||||
if len(lines)>=2:
|
||||
targetitem += lines[1]
|
||||
newcontent.append(targetitem)
|
||||
newcontent.extend(lines[2:])
|
||||
newcontent.append("\n")
|
||||
|
@ -1032,7 +1032,7 @@ class ModuleAutoGen(AutoGen):
|
||||
@cached_property
|
||||
def ModulePcdList(self):
|
||||
# apply PCD settings from platform
|
||||
RetVal = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)
|
||||
RetVal = self.PlatformInfo.ApplyPcdSetting(self, self.Module.Pcds)
|
||||
|
||||
return RetVal
|
||||
@cached_property
|
||||
@ -1063,7 +1063,7 @@ class ModuleAutoGen(AutoGen):
|
||||
continue
|
||||
Pcds.add(Key)
|
||||
PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])
|
||||
RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self.Module, PcdsInLibrary, Library=Library))
|
||||
RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self, PcdsInLibrary, Library=Library))
|
||||
return RetVal
|
||||
|
||||
## Get the GUID value mapping
|
||||
@ -1822,9 +1822,6 @@ class ModuleAutoGen(AutoGen):
|
||||
for LibraryAutoGen in self.LibraryAutoGenList:
|
||||
LibraryAutoGen.CreateCodeFile()
|
||||
|
||||
# CanSkip uses timestamps to determine build skipping
|
||||
if self.CanSkip():
|
||||
return
|
||||
self.LibraryAutoGenList
|
||||
AutoGenList = []
|
||||
IgoredAutoGenList = []
|
||||
|
@ -479,8 +479,9 @@ class PlatformInfo(AutoGenInfo):
|
||||
SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue)
|
||||
}
|
||||
|
||||
def ApplyPcdSetting(self, Module, Pcds, Library=""):
|
||||
def ApplyPcdSetting(self, Ma, Pcds, Library=""):
|
||||
# for each PCD in module
|
||||
Module=Ma.Module
|
||||
for Name, Guid in Pcds:
|
||||
PcdInModule = Pcds[Name, Guid]
|
||||
# find out the PCD setting in platform
|
||||
@ -507,9 +508,12 @@ class PlatformInfo(AutoGenInfo):
|
||||
)
|
||||
|
||||
# override PCD settings with module specific setting
|
||||
ModuleScopePcds = self.DataPipe.Get("MOL_PCDS")
|
||||
if Module in self.Platform.Modules:
|
||||
PlatformModule = self.Platform.Modules[str(Module)]
|
||||
for Key in PlatformModule.Pcds:
|
||||
PCD_DATA = ModuleScopePcds.get(Ma.Guid,{})
|
||||
mPcds = {(pcd.TokenCName,pcd.TokenSpaceGuidCName): pcd for pcd in PCD_DATA}
|
||||
for Key in mPcds:
|
||||
if self.BuildOptionPcd:
|
||||
for pcd in self.BuildOptionPcd:
|
||||
(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
|
||||
@ -528,7 +532,7 @@ class PlatformInfo(AutoGenInfo):
|
||||
Flag = True
|
||||
break
|
||||
if Flag:
|
||||
self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library)
|
||||
self._OverridePcd(ToPcd, mPcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library)
|
||||
# use PCD value to calculate the MaxDatumSize when it is not specified
|
||||
for Name, Guid in Pcds:
|
||||
Pcd = Pcds[Name, Guid]
|
||||
|
@ -253,7 +253,7 @@ class PlatformAutoGen(AutoGen):
|
||||
VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
|
||||
VariableInfo.SetVpdRegionOffset(VpdRegionBase)
|
||||
Index = 0
|
||||
for Pcd in DynamicPcdSet:
|
||||
for Pcd in sorted(DynamicPcdSet):
|
||||
pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
|
||||
for SkuName in Pcd.SkuInfoList:
|
||||
Sku = Pcd.SkuInfoList[SkuName]
|
||||
@ -1043,7 +1043,13 @@ class PlatformAutoGen(AutoGen):
|
||||
|
||||
@cached_property
|
||||
def _MbList(self):
|
||||
return [self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain] for m in self.Platform.Modules]
|
||||
ModuleList = []
|
||||
for m in self.Platform.Modules:
|
||||
component = self.Platform.Modules[m]
|
||||
module = self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain]
|
||||
module.Guid = component.Guid
|
||||
ModuleList.append(module)
|
||||
return ModuleList
|
||||
|
||||
@cached_property
|
||||
def _MaList(self):
|
||||
|
@ -214,8 +214,12 @@ def _IsCopyrightLine (LineContent):
|
||||
LineContent = LineContent.upper()
|
||||
Result = False
|
||||
|
||||
#Support below Copyright format
|
||||
# Copyright (C) 2020 Hewlett Packard Enterprise Development LP<BR>
|
||||
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
||||
ReIsCopyrightRe = re.compile(r"""(^|\s)COPYRIGHT *\(""", re.DOTALL)
|
||||
if ReIsCopyrightRe.search(LineContent):
|
||||
ReIsCopyrightTypeB = re.compile(r"""(^|\s)\(C\)\s*COPYRIGHT""", re.DOTALL)
|
||||
if ReIsCopyrightRe.search(LineContent) or ReIsCopyrightTypeB.search(LineContent):
|
||||
Result = True
|
||||
|
||||
return Result
|
||||
|
@ -80,14 +80,7 @@ class DataSection (DataSectionClassObject):
|
||||
|
||||
#Get PE Section alignment when align is set to AUTO
|
||||
if self.Alignment == 'Auto' and self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
|
||||
ImageObj = PeImageClass (Filename)
|
||||
if ImageObj.SectionAlignment < 0x400:
|
||||
self.Alignment = str (ImageObj.SectionAlignment)
|
||||
elif ImageObj.SectionAlignment < 0x100000:
|
||||
self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'
|
||||
else:
|
||||
self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'
|
||||
|
||||
self.Alignment = "0"
|
||||
NoStrip = True
|
||||
if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
|
||||
if self.KeepReloc is not None:
|
||||
|
@ -260,14 +260,7 @@ class EfiSection (EfiSectionClassObject):
|
||||
|
||||
#Get PE Section alignment when align is set to AUTO
|
||||
if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
|
||||
ImageObj = PeImageClass (File)
|
||||
if ImageObj.SectionAlignment < 0x400:
|
||||
Align = str (ImageObj.SectionAlignment)
|
||||
elif ImageObj.SectionAlignment < 0x100000:
|
||||
Align = str (ImageObj.SectionAlignment // 0x400) + 'K'
|
||||
else:
|
||||
Align = str (ImageObj.SectionAlignment // 0x100000) + 'M'
|
||||
|
||||
Align = "0"
|
||||
if File[(len(File)-4):] == '.efi' and FfsInf.InfModule.BaseName == os.path.basename(File)[:-4]:
|
||||
MapFile = File.replace('.efi', '.map')
|
||||
CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
|
||||
|
@ -21,6 +21,7 @@ from .GuidSection import GuidSection
|
||||
from .FvImageSection import FvImageSection
|
||||
from .Ffs import FdfFvFileTypeToFileType
|
||||
from .GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
import shutil
|
||||
|
||||
## generate FFS from FILE
|
||||
#
|
||||
@ -67,6 +68,8 @@ class FileStatement (FileStatementClassObject):
|
||||
if FvName:
|
||||
Str += FvName
|
||||
OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, Str)
|
||||
if os.path.exists(OutputDir):
|
||||
shutil.rmtree(OutputDir)
|
||||
if not os.path.exists(OutputDir):
|
||||
os.makedirs(OutputDir)
|
||||
|
||||
|
@ -633,7 +633,10 @@ class GenFds(object):
|
||||
else:
|
||||
Percentage = str((UsedSizeValue + 0.0) / TotalSizeValue)[0:4].lstrip('0.')
|
||||
|
||||
GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + Percentage + '%Full] ' + str(TotalSizeValue) + ' total, ' + str(UsedSizeValue) + ' used, ' + str(FreeSizeValue) + ' free')
|
||||
GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + Percentage + '%Full] '\
|
||||
+ str(TotalSizeValue) + ' (' + hex(TotalSizeValue) + ')' + ' total, '\
|
||||
+ str(UsedSizeValue) + ' (' + hex(UsedSizeValue) + ')' + ' used, '\
|
||||
+ str(FreeSizeValue) + ' (' + hex(FreeSizeValue) + ')' + ' free')
|
||||
|
||||
## PreprocessImage()
|
||||
#
|
||||
|
@ -140,22 +140,6 @@ class Section (SectionClassObject):
|
||||
FileList.append(File.Path)
|
||||
|
||||
if (not IsMakefile and Suffix is not None and os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix is not None):
|
||||
#
|
||||
# Get Makefile path and time stamp
|
||||
#
|
||||
MakefileDir = FfsInf.EfiOutputPath[:-len('OUTPUT')]
|
||||
Makefile = os.path.join(MakefileDir, 'Makefile')
|
||||
if not os.path.exists(Makefile):
|
||||
Makefile = os.path.join(MakefileDir, 'GNUmakefile')
|
||||
if os.path.exists(Makefile):
|
||||
# Update to search files with suffix in all sub-dirs.
|
||||
Tuple = os.walk(FfsInf.EfiOutputPath)
|
||||
for Dirpath, Dirnames, Filenames in Tuple:
|
||||
for F in Filenames:
|
||||
if os.path.splitext(F)[1] == Suffix:
|
||||
FullName = os.path.join(Dirpath, F)
|
||||
if os.path.getmtime(FullName) > os.path.getmtime(Makefile):
|
||||
FileList.append(FullName)
|
||||
if not FileList:
|
||||
SuffixMap = FfsInf.GetFinalTargetSuffixMap()
|
||||
if Suffix in SuffixMap:
|
||||
|
@ -372,8 +372,7 @@ def TrimAslFile(Source, Target, IncludePathFile,AslDeps = False):
|
||||
AslIncludes = []
|
||||
Lines = DoInclude(Source, '', IncludePathList,IncludeFileList=AslIncludes,filetype='ASL')
|
||||
AslIncludes = [item for item in AslIncludes if item !=Source]
|
||||
if AslDeps and AslIncludes:
|
||||
SaveFileOnChange(os.path.join(os.path.dirname(Target),os.path.basename(Source))+".trim.deps", " \\\n".join([Source+":"] +AslIncludes),False)
|
||||
SaveFileOnChange(os.path.join(os.path.dirname(Target),os.path.basename(Source))+".trim.deps", " \\\n".join([Source+":"] +AslIncludes),False)
|
||||
|
||||
#
|
||||
# Undef MIN and MAX to avoid collision in ASL source code
|
||||
|
@ -70,6 +70,7 @@ class PcdClassObject(object):
|
||||
self.DscDefaultValue = Value
|
||||
self.PcdValueFromComm = ""
|
||||
self.PcdValueFromFdf = ""
|
||||
self.PcdValueFromComponents = {} #{ModuleGuid:value, file_path,lineNo}
|
||||
self.CustomAttribute = {}
|
||||
self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
|
||||
self._Capacity = None
|
||||
@ -298,6 +299,7 @@ class StructurePcd(PcdClassObject):
|
||||
self.PcdFieldValueFromComm = OrderedDict()
|
||||
self.PcdFieldValueFromFdf = OrderedDict()
|
||||
self.DefaultFromDSC=None
|
||||
self.PcdFiledValueFromDscComponent = OrderedDict()
|
||||
def __repr__(self):
|
||||
return self.TypeName
|
||||
|
||||
@ -324,6 +326,12 @@ class StructurePcd(PcdClassObject):
|
||||
self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName] = [Value.strip(), FileName, LineNo]
|
||||
return self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
|
||||
|
||||
def AddComponentOverrideValue(self,FieldName, Value, ModuleGuid, FileName="", LineNo=0, DimensionAttr = '-1'):
|
||||
self.PcdFiledValueFromDscComponent.setdefault(ModuleGuid, OrderedDict())
|
||||
self.PcdFiledValueFromDscComponent[ModuleGuid].setdefault(DimensionAttr,OrderedDict())
|
||||
self.PcdFiledValueFromDscComponent[ModuleGuid][DimensionAttr][FieldName] = [Value.strip(), FileName, LineNo]
|
||||
return self.PcdFiledValueFromDscComponent[ModuleGuid][DimensionAttr][FieldName]
|
||||
|
||||
def SetPcdMode (self, PcdMode):
|
||||
self.PcdMode = PcdMode
|
||||
|
||||
@ -365,6 +373,7 @@ class StructurePcd(PcdClassObject):
|
||||
self.ValueChain = PcdObject.ValueChain if PcdObject.ValueChain else self.ValueChain
|
||||
self.PcdFieldValueFromComm = PcdObject.PcdFieldValueFromComm if PcdObject.PcdFieldValueFromComm else self.PcdFieldValueFromComm
|
||||
self.PcdFieldValueFromFdf = PcdObject.PcdFieldValueFromFdf if PcdObject.PcdFieldValueFromFdf else self.PcdFieldValueFromFdf
|
||||
self.PcdFiledValueFromDscComponent = PcdObject.PcdFiledValueFromDscComponent if PcdObject.PcdFiledValueFromDscComponent else self.PcdFiledValueFromDscComponent
|
||||
|
||||
def __deepcopy__(self,memo):
|
||||
new_pcd = StructurePcd()
|
||||
@ -383,6 +392,7 @@ class StructurePcd(PcdClassObject):
|
||||
new_pcd.SkuOverrideValues = CopyDict(self.SkuOverrideValues)
|
||||
new_pcd.PcdFieldValueFromComm = CopyDict(self.PcdFieldValueFromComm)
|
||||
new_pcd.PcdFieldValueFromFdf = CopyDict(self.PcdFieldValueFromFdf)
|
||||
new_pcd.PcdFiledValueFromDscComponent = CopyDict(self.PcdFiledValueFromDscComponent)
|
||||
new_pcd.ValueChain = {item for item in self.ValueChain}
|
||||
return new_pcd
|
||||
|
||||
@ -463,6 +473,8 @@ class ModuleBuildClassObject(object):
|
||||
self.Pcds = {}
|
||||
self.BuildOptions = {}
|
||||
self.Depex = {}
|
||||
self.StrPcdSet = []
|
||||
self.StrPcdOverallValue = {}
|
||||
|
||||
## Convert the class to a string
|
||||
#
|
||||
|
@ -755,9 +755,10 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=LineNo,
|
||||
ExtraData=ErrorInfo)
|
||||
|
||||
ModuleBuildData = self._Bdb[ModuleFile, self._Arch, self._Target, self._Toolchain]
|
||||
Module = ModuleBuildClassObject()
|
||||
Module.MetaFile = ModuleFile
|
||||
|
||||
Module.Guid = ModuleBuildData.Guid
|
||||
# get module private library instance
|
||||
RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, None, ModuleId]
|
||||
for Record in RecordList:
|
||||
@ -778,7 +779,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
Module.LibraryClasses[LibraryClass] = LibraryPath
|
||||
if LibraryPath not in self.LibraryInstances:
|
||||
self.LibraryInstances.append(LibraryPath)
|
||||
|
||||
S_PcdSet = []
|
||||
# get module private PCD setting
|
||||
for Type in [MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, \
|
||||
MODEL_PCD_FEATURE_FLAG, MODEL_PCD_DYNAMIC, MODEL_PCD_DYNAMIC_EX]:
|
||||
@ -792,20 +793,31 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
else:
|
||||
MaxDatumSize = ''
|
||||
TypeString = self._PCD_TYPE_STRING_[Type]
|
||||
Pcd = PcdClassObject(
|
||||
PcdCName,
|
||||
TokenSpaceGuid,
|
||||
TypeString,
|
||||
'',
|
||||
DefaultValue,
|
||||
'',
|
||||
MaxDatumSize,
|
||||
{},
|
||||
False,
|
||||
None
|
||||
)
|
||||
Module.Pcds[PcdCName, TokenSpaceGuid] = Pcd
|
||||
|
||||
TCName,PCName,DimensionAttr,Field = self.ParsePcdNameStruct(TokenSpaceGuid, PcdCName)
|
||||
|
||||
if ("." in TokenSpaceGuid or "[" in PcdCName):
|
||||
S_PcdSet.append([ TCName,PCName,DimensionAttr,Field, ModuleBuildData.Guid, "", Dummy5, AnalyzePcdExpression(Setting)[0]])
|
||||
DefaultValue = ''
|
||||
if ( PCName,TCName) not in Module.Pcds:
|
||||
Pcd = PcdClassObject(
|
||||
PCName,
|
||||
TCName,
|
||||
TypeString,
|
||||
'',
|
||||
DefaultValue,
|
||||
'',
|
||||
MaxDatumSize,
|
||||
{},
|
||||
False,
|
||||
None,
|
||||
IsDsc=True)
|
||||
Module.Pcds[PCName, TCName] = Pcd
|
||||
|
||||
Module.StrPcdSet = S_PcdSet
|
||||
for TCName,PCName, _,_,_,_,_,_ in S_PcdSet:
|
||||
if (PCName,TCName) in Module.Pcds:
|
||||
Module.StrPcdOverallValue[(PCName,TCName)] = Module.Pcds[(PCName,TCName)].DefaultValue, self.MetaFile,Dummy5
|
||||
# get module private build options
|
||||
RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, None, ModuleId]
|
||||
for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
|
||||
@ -822,7 +834,9 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
File=self.MetaFile, ExtraData=str(ModuleFile), Line=LineNo)
|
||||
ModuleFile = ProcessDuplicatedInf(ModuleFile, RecordList[0][2], GlobalData.gWorkspace)
|
||||
ModuleFile.Arch = self._Arch
|
||||
|
||||
Module.Guid = RecordList[0][2]
|
||||
for item in Module.StrPcdSet:
|
||||
item[4] = RecordList[0][2]
|
||||
self._Modules[ModuleFile] = Module
|
||||
return self._Modules
|
||||
|
||||
@ -1499,7 +1513,15 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
File=self.MetaFile, Line = Dummy5)
|
||||
|
||||
S_PcdSet.append([ TCName,PCName,DimensionAttr,Field, SkuName, default_store, Dummy5, AnalyzePcdExpression(Setting)[0]])
|
||||
|
||||
ModuleScopeOverallValue = {}
|
||||
for m in self.Modules.values():
|
||||
mguid = m.Guid
|
||||
if m.StrPcdSet:
|
||||
S_PcdSet.extend(m.StrPcdSet)
|
||||
mguid = m.StrPcdSet[0][4]
|
||||
for (PCName,TCName) in m.StrPcdOverallValue:
|
||||
Value, dsc_file, lineNo = m.StrPcdOverallValue[(PCName,TCName)]
|
||||
ModuleScopeOverallValue.setdefault((PCName,TCName),{})[mguid] = Value, dsc_file, lineNo
|
||||
# handle pcd value override
|
||||
StrPcdSet = DscBuildData.GetStructurePcdInfo(S_PcdSet)
|
||||
S_pcd_set = OrderedDict()
|
||||
@ -1517,6 +1539,11 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
for str_pcd_data in StrPcdSet[str_pcd]:
|
||||
if str_pcd_data[4] in SkuIds:
|
||||
str_pcd_obj_str.AddOverrideValue(str_pcd_data[3], str(str_pcd_data[7]), TAB_DEFAULT if str_pcd_data[4] == TAB_COMMON else str_pcd_data[4], TAB_DEFAULT_STORES_DEFAULT if str_pcd_data[5] == TAB_COMMON else str_pcd_data[5], self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.File else self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:], LineNo=str_pcd_data[6],DimensionAttr = str_pcd_data[2])
|
||||
elif GlobalData.gGuidPattern.match(str_pcd_data[4]):
|
||||
str_pcd_obj_str.AddComponentOverrideValue(str_pcd_data[3], str(str_pcd_data[7]), str_pcd_data[4].replace("-","S"), self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.File else self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:], LineNo=str_pcd_data[6],DimensionAttr = str_pcd_data[2])
|
||||
PcdComponentValue = ModuleScopeOverallValue.get((str_pcd_obj_str.TokenCName,str_pcd_obj_str.TokenSpaceGuidCName))
|
||||
for module_guid in PcdComponentValue:
|
||||
str_pcd_obj_str.PcdValueFromComponents[module_guid.replace("-","S")] = PcdComponentValue[module_guid]
|
||||
S_pcd_set[str_pcd[1], str_pcd[0]] = str_pcd_obj_str
|
||||
|
||||
# Add the Structure PCD that only defined in DEC, don't have override in DSC file
|
||||
@ -1575,7 +1602,10 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
stru_pcd.ValueChain.add((skuid, defaultstoreid))
|
||||
S_pcd_set = DscBuildData.OverrideByFdf(S_pcd_set,self.WorkspaceDir)
|
||||
S_pcd_set = DscBuildData.OverrideByComm(S_pcd_set)
|
||||
|
||||
# Create a tool to caculate structure pcd value
|
||||
Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
|
||||
|
||||
if Str_Pcd_Values:
|
||||
for (skuname, StoreName, PcdGuid, PcdName, PcdValue) in Str_Pcd_Values:
|
||||
str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))
|
||||
@ -1593,6 +1623,14 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
|
||||
if skuname in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COMMON):
|
||||
str_pcd_obj.DefaultValue = PcdValue
|
||||
else:
|
||||
#Module Scope Structure Pcd
|
||||
moduleguid = skuname.replace("S","-")
|
||||
if GlobalData.gGuidPattern.match(moduleguid):
|
||||
for component in self.Modules.values():
|
||||
if component.Guid == moduleguid:
|
||||
component.Pcds[(PcdName, PcdGuid)].DefaultValue = PcdValue
|
||||
|
||||
else:
|
||||
if skuname not in str_pcd_obj.SkuInfoList:
|
||||
nextskuid = self.SkuIdMgr.GetNextSkuId(skuname)
|
||||
@ -2341,6 +2379,75 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
CApp = CApp + "}\n"
|
||||
return CApp
|
||||
|
||||
def GenerateModuleScopeValue(self, Pcd):
|
||||
CApp = "// Value in Dsc Module scope \n"
|
||||
for ModuleGuid in Pcd.PcdFiledValueFromDscComponent:
|
||||
|
||||
CApp = CApp + "void Assign_%s_%s_%s_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, ModuleGuid,Pcd.BaseDatumType)
|
||||
CApp = CApp + ' UINT32 FieldSize;\n'
|
||||
CApp = CApp + ' CHAR8 *Value;\n'
|
||||
pcddefaultvalue, file_path,lineNo = Pcd.PcdValueFromComponents.get(ModuleGuid,(None,None,None))
|
||||
|
||||
if pcddefaultvalue:
|
||||
IsArray = _IsFieldValueAnArray(pcddefaultvalue)
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList = ValueExpressionEx(pcddefaultvalue, TAB_VOID)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from %s Line %s: %s" %
|
||||
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, file_path, lineNo, FieldList))
|
||||
Value, ValueSize = ParseFieldValue (FieldList)
|
||||
|
||||
if isinstance(Value, str):
|
||||
CApp = CApp + ' Pcd = %s; // From %s Line %s \n' % (Value, file_path, lineNo)
|
||||
elif IsArray:
|
||||
#
|
||||
# Use memcpy() to copy value into field
|
||||
#
|
||||
CApp = CApp + ' Value = %s; // From %s Line %s.\n' % (DscBuildData.IntToCString(Value, ValueSize), file_path, lineNo)
|
||||
CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
|
||||
|
||||
|
||||
PcdFiledValue = Pcd.PcdFiledValueFromDscComponent.get(ModuleGuid)
|
||||
for index in PcdFiledValue:
|
||||
FieldList = PcdFiledValue[index]
|
||||
if not FieldList:
|
||||
continue
|
||||
for FieldName in FieldList:
|
||||
IsArray = _IsFieldValueAnArray(FieldList[FieldName][0])
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
|
||||
except:
|
||||
print("error")
|
||||
try:
|
||||
Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
|
||||
except Exception:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
|
||||
if isinstance(Value, str):
|
||||
CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
|
||||
elif IsArray:
|
||||
#
|
||||
# Use memcpy() to copy value into field
|
||||
#
|
||||
CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.BaseDatumType, FieldName)
|
||||
CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
|
||||
CApp = CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, ValueSize, Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
|
||||
CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
|
||||
else:
|
||||
if '[' in FieldName and ']' in FieldName:
|
||||
Index = int(FieldName.split('[')[1].split(']')[0])
|
||||
CApp = CApp + ' __STATIC_ASSERT((%d < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds the array number"); // From %s Line %d Index of %s\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], FieldList[FieldName][2], FieldName)
|
||||
if ValueSize > 4:
|
||||
CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
|
||||
else:
|
||||
CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
|
||||
CApp = CApp + "}\n"
|
||||
return CApp
|
||||
|
||||
@staticmethod
|
||||
def GenerateCommandLineValueStatement(Pcd):
|
||||
CApp = ' Assign_%s_%s_CommandLine_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
@ -2414,6 +2521,85 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
CApp = ' Assign_%s_%s_Fdf_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
return CApp
|
||||
|
||||
@staticmethod
|
||||
def GenerateModuleValueStatement(module_guid, Pcd):
|
||||
CApp = " Assign_%s_%s_%s_Value(Pcd);\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, module_guid)
|
||||
return CApp
|
||||
def GenerateModuleScopeInitializeFunc(self,SkuName, Pcd, InitByteValue, CApp):
|
||||
for module_guid in Pcd.PcdFiledValueFromDscComponent:
|
||||
CApp = CApp + 'void\n'
|
||||
CApp = CApp + 'Initialize_%s_%s_%s_%s(\n' % (module_guid, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
CApp = CApp + ' void\n'
|
||||
CApp = CApp + ' )\n'
|
||||
CApp = CApp + '{\n'
|
||||
CApp = CApp + ' UINT32 Size;\n'
|
||||
CApp = CApp + ' UINT32 FieldSize;\n'
|
||||
CApp = CApp + ' CHAR8 *Value;\n'
|
||||
CApp = CApp + ' UINT32 OriginalSize;\n'
|
||||
CApp = CApp + ' VOID *OriginalPcd;\n'
|
||||
|
||||
CApp = CApp + ' %s *Pcd; // From %s Line %d \n' % (Pcd.BaseDatumType,Pcd.PkgPath, Pcd.PcdDefineLineNo)
|
||||
|
||||
CApp = CApp + '\n'
|
||||
|
||||
PcdDefaultValue = StringToArray(Pcd.DefaultValueFromDec.strip())
|
||||
InitByteValue += '%s.%s.%s.%s|%s|%s\n' % (module_guid, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DatumType, PcdDefaultValue)
|
||||
#
|
||||
# Get current PCD value and size
|
||||
#
|
||||
CApp = CApp + ' OriginalPcd = PcdGetPtr (%s, %s, %s, %s, &OriginalSize);\n' % (module_guid, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
|
||||
#
|
||||
# Determine the size of the PCD. For simple structures, sizeof(TYPE) provides
|
||||
# the correct value. For structures with a flexible array member, the flexible
|
||||
# array member is detected, and the size is based on the highest index used with
|
||||
# the flexible array member. The flexible array member must be the last field
|
||||
# in a structure. The size formula for this case is:
|
||||
# OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0]) * (HighestIndex + 1)
|
||||
#
|
||||
CApp = CApp + DscBuildData.GenerateSizeStatments(Pcd,SkuName,TAB_DEFAULT_STORES_DEFAULT)
|
||||
if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
|
||||
CApp = CApp + ' OriginalSize = OriginalSize < sizeof(%s) * %d? OriginalSize:sizeof(%s) * %d; \n' % (Pcd.BaseDatumType,Pcd.PcdArraySize(),Pcd.BaseDatumType,Pcd.PcdArraySize())
|
||||
CApp = CApp + ' Size = sizeof(%s) * %d; \n' % (Pcd.BaseDatumType,Pcd.PcdArraySize())
|
||||
|
||||
#
|
||||
# Allocate and zero buffer for the PCD
|
||||
# Must handle cases where current value is smaller, larger, or same size
|
||||
# Always keep that larger one as the current size
|
||||
#
|
||||
CApp = CApp + ' Size = (OriginalSize > Size ? OriginalSize : Size);\n'
|
||||
CApp = CApp + ' Pcd = (%s *)malloc (Size);\n' % (Pcd.BaseDatumType,)
|
||||
CApp = CApp + ' memset (Pcd, 0, Size);\n'
|
||||
|
||||
#
|
||||
# Copy current PCD value into allocated buffer.
|
||||
#
|
||||
CApp = CApp + ' memcpy (Pcd, OriginalPcd, OriginalSize);\n'
|
||||
|
||||
#
|
||||
# Assign field values in PCD
|
||||
#
|
||||
CApp = CApp + DscBuildData.GenerateDefaultValueAssignStatement(Pcd)
|
||||
|
||||
CApp = CApp + "// SkuName: %s, DefaultStoreName: STANDARD \n" % self.SkuIdMgr.SystemSkuId
|
||||
CApp = CApp + DscBuildData.GenerateInitValueStatement(Pcd, self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT)
|
||||
CApp = CApp + DscBuildData.GenerateModuleValueStatement(module_guid,Pcd)
|
||||
CApp = CApp + DscBuildData.GenerateFdfValueStatement(Pcd)
|
||||
CApp = CApp + DscBuildData.GenerateCommandLineValueStatement(Pcd)
|
||||
|
||||
#
|
||||
# Set new PCD value and size
|
||||
#
|
||||
CApp = CApp + ' PcdSetPtr (%s, %s, %s, %s, Size, (void *)Pcd);\n' % (module_guid, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
|
||||
#
|
||||
# Free PCD
|
||||
#
|
||||
CApp = CApp + ' free (Pcd);\n'
|
||||
CApp = CApp + '}\n'
|
||||
CApp = CApp + '\n'
|
||||
return InitByteValue,CApp
|
||||
|
||||
def GenerateInitializeFunc(self, SkuName, DefaultStore, Pcd, InitByteValue, CApp):
|
||||
OverrideValues = {DefaultStore:{}}
|
||||
if Pcd.SkuOverrideValues:
|
||||
@ -2584,12 +2770,22 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
CApp = CApp + '\n'
|
||||
for Pcd in StructuredPcds.values():
|
||||
CApp = CApp + self.GenerateArrayAssignment(Pcd)
|
||||
for PcdName in StructuredPcds:
|
||||
for PcdName in sorted(StructuredPcds.keys()):
|
||||
Pcd = StructuredPcds[PcdName]
|
||||
|
||||
#create void void Cal_tocken_cname_Size functions
|
||||
CApp = CApp + self.GenerateSizeFunction(Pcd)
|
||||
|
||||
#create void Assign_ functions
|
||||
|
||||
# From DEC
|
||||
CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
|
||||
# From Fdf
|
||||
CApp = CApp + self.GenerateFdfValue(Pcd)
|
||||
# From CommandLine
|
||||
CApp = CApp + self.GenerateCommandLineValue(Pcd)
|
||||
|
||||
# From Dsc Global setting
|
||||
if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
|
||||
self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
|
||||
CApp = CApp + self.GenerateInitValueFunction(Pcd, self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT)
|
||||
@ -2599,9 +2795,15 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
continue
|
||||
for DefaultStoreName in Pcd.SkuOverrideValues[SkuName]:
|
||||
CApp = CApp + self.GenerateInitValueFunction(Pcd, SkuName, DefaultStoreName)
|
||||
|
||||
# From Dsc module scope setting
|
||||
CApp = CApp + self.GenerateModuleScopeValue(Pcd)
|
||||
|
||||
#create Initialize_ functions
|
||||
if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
|
||||
self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
|
||||
InitByteValue, CApp = self.GenerateInitializeFunc(self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, Pcd, InitByteValue, CApp)
|
||||
InitByteValue, CApp = self.GenerateModuleScopeInitializeFunc(self.SkuIdMgr.SystemSkuId,Pcd,InitByteValue,CApp)
|
||||
else:
|
||||
for SkuName in self.SkuIdMgr.SkuOverrideOrder():
|
||||
if SkuName not in Pcd.SkuOverrideValues:
|
||||
@ -2618,6 +2820,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
for Pcd in StructuredPcds.values():
|
||||
if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
|
||||
CApp = CApp + ' Initialize_%s_%s_%s_%s();\n' % (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
for ModuleGuid in Pcd.PcdFiledValueFromDscComponent:
|
||||
CApp += " Initialize_%s_%s_%s_%s();\n" % (ModuleGuid,TAB_DEFAULT_STORES_DEFAULT ,Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
|
||||
else:
|
||||
for SkuName in self.SkuIdMgr.SkuOverrideOrder():
|
||||
if SkuName not in self.SkuIdMgr.AvailableSkuIdSet:
|
||||
@ -2633,13 +2837,14 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
CAppBaseFileName = os.path.join(self.OutputPath, PcdValueInitName)
|
||||
SaveFileOnChange(CAppBaseFileName + '.c', CApp, False)
|
||||
|
||||
# start generating makefile
|
||||
MakeApp = PcdMakefileHeader
|
||||
if sys.platform == "win32":
|
||||
MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + 'INC = '
|
||||
else:
|
||||
MakeApp = MakeApp + PcdGccMakefile
|
||||
MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + \
|
||||
'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
|
||||
'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'TOOL_INCLUDE +='
|
||||
|
||||
IncSearchList = []
|
||||
PlatformInc = OrderedDict()
|
||||
@ -2755,6 +2960,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
MakeApp += "$(OBJECTS) : %s\n" % MakeFileName
|
||||
SaveFileOnChange(MakeFileName, MakeApp, False)
|
||||
|
||||
# start generating input file
|
||||
InputValueFile = os.path.join(self.OutputPath, 'Input.txt')
|
||||
OutputValueFile = os.path.join(self.OutputPath, 'Output.txt')
|
||||
SaveFileOnChange(InputValueFile, InitByteValue, False)
|
||||
@ -2764,6 +2970,8 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName)
|
||||
else:
|
||||
Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName) +".exe"
|
||||
|
||||
#start building the structure pcd value tool
|
||||
Messages = ''
|
||||
if sys.platform == "win32":
|
||||
MakeCommand = 'nmake -f %s' % (MakeFileName)
|
||||
@ -2826,6 +3034,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
else:
|
||||
EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s\n%s\n%s' % (MakeCommand, StdOut, StdErr))
|
||||
|
||||
#start executing the structure pcd value tool
|
||||
if DscBuildData.NeedUpdateOutput(OutputValueFile, Dest_PcdValueInitExe, InputValueFile):
|
||||
Command = Dest_PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile)
|
||||
returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command)
|
||||
@ -2833,6 +3042,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
if returncode != 0:
|
||||
EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s\n%s\n' % (Command, StdOut, StdErr))
|
||||
|
||||
#start update structure pcd final value
|
||||
File = open (OutputValueFile, 'r')
|
||||
FileBuffer = File.readlines()
|
||||
File.close()
|
||||
|
@ -60,7 +60,7 @@ gPcdGuidPattern = re.compile(r"PCD\((\w+)[.](\w+)\)")
|
||||
gOffsetGuidPattern = re.compile(r"(0x[0-9A-Fa-f]+) ([-A-Fa-f0-9]+)")
|
||||
|
||||
## Pattern to find module base address and entry point in fixed flash map file
|
||||
gModulePattern = r"\n[-\w]+\s*\(([^,]+),\s*BaseAddress=%(Address)s,\s*EntryPoint=%(Address)s\)\s*\(GUID=([-0-9A-Fa-f]+)[^)]*\)"
|
||||
gModulePattern = r"\n[-\w]+\s*\(([^,]+),\s*BaseAddress=%(Address)s,\s*EntryPoint=%(Address)s,\s*Type=\w+\)\s*\(GUID=([-0-9A-Fa-f]+)[^)]*\)"
|
||||
gMapFileItemPattern = re.compile(gModulePattern % {"Address" : "(-?0[xX][0-9A-Fa-f]+)"})
|
||||
|
||||
## Pattern to find all module referenced header files in source files
|
||||
@ -696,7 +696,7 @@ class ModuleReport(object):
|
||||
FileWrite(File, gSectionSep)
|
||||
|
||||
if "PCD" in ReportType:
|
||||
GlobalPcdReport.GenerateReport(File, self.ModulePcdSet)
|
||||
GlobalPcdReport.GenerateReport(File, self.ModulePcdSet,self.FileGuid)
|
||||
|
||||
if "LIBRARY" in ReportType:
|
||||
self.LibraryReport.GenerateReport(File)
|
||||
@ -881,7 +881,7 @@ class PcdReport(object):
|
||||
if DscDefaultValue:
|
||||
self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
|
||||
|
||||
def GenerateReport(self, File, ModulePcdSet):
|
||||
def GenerateReport(self, File, ModulePcdSet,ModuleGuid=None):
|
||||
if not ModulePcdSet:
|
||||
if self.ConditionalPcds:
|
||||
self.GenerateReportDetail(File, ModulePcdSet, 1)
|
||||
@ -897,7 +897,7 @@ class PcdReport(object):
|
||||
break
|
||||
if not IsEmpty:
|
||||
self.GenerateReportDetail(File, ModulePcdSet, 2)
|
||||
self.GenerateReportDetail(File, ModulePcdSet)
|
||||
self.GenerateReportDetail(File, ModulePcdSet,ModuleGuid = ModuleGuid)
|
||||
|
||||
##
|
||||
# Generate report for PCD information
|
||||
@ -913,7 +913,7 @@ class PcdReport(object):
|
||||
# directives section report, 2 means Unused Pcds section report
|
||||
# @param DscOverridePcds Module DSC override PCDs set
|
||||
#
|
||||
def GenerateReportDetail(self, File, ModulePcdSet, ReportSubType = 0):
|
||||
def GenerateReportDetail(self, File, ModulePcdSet, ReportSubType = 0,ModuleGuid=None):
|
||||
PcdDict = self.AllPcds
|
||||
if ReportSubType == 1:
|
||||
PcdDict = self.ConditionalPcds
|
||||
@ -993,10 +993,12 @@ class PcdReport(object):
|
||||
#The DefaultValue of StructurePcd already be the latest, no need to update.
|
||||
if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):
|
||||
Pcd.DefaultValue = PcdValue
|
||||
PcdComponentValue = None
|
||||
if ModulePcdSet is not None:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in ModulePcdSet:
|
||||
continue
|
||||
InfDefaultValue, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type]
|
||||
InfDefaultValue, PcdComponentValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type]
|
||||
PcdValue = PcdComponentValue
|
||||
#The DefaultValue of StructurePcd already be the latest, no need to update.
|
||||
if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):
|
||||
Pcd.DefaultValue = PcdValue
|
||||
@ -1081,6 +1083,11 @@ class PcdReport(object):
|
||||
if TypeName in ('DYNVPD', 'DEXVPD'):
|
||||
SkuInfoList = Pcd.SkuInfoList
|
||||
Pcd = GlobalData.gStructurePcd[self.Arch][(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)]
|
||||
if ModulePcdSet and ModulePcdSet.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type)):
|
||||
InfDefaultValue, PcdComponentValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type]
|
||||
DscDefaultValBak = Pcd.DefaultValue
|
||||
Pcd.DefaultValue = PcdComponentValue
|
||||
|
||||
Pcd.DatumType = Pcd.StructName
|
||||
if TypeName in ('DYNVPD', 'DEXVPD'):
|
||||
Pcd.SkuInfoList = SkuInfoList
|
||||
@ -1091,48 +1098,53 @@ class PcdReport(object):
|
||||
DscDefaultValue = True
|
||||
DscMatch = True
|
||||
DecMatch = False
|
||||
elif Pcd.SkuOverrideValues:
|
||||
DscOverride = False
|
||||
if Pcd.DefaultFromDSC:
|
||||
DscOverride = True
|
||||
else:
|
||||
DictLen = 0
|
||||
for item in Pcd.SkuOverrideValues:
|
||||
DictLen += len(Pcd.SkuOverrideValues[item])
|
||||
if not DictLen:
|
||||
DscOverride = False
|
||||
else:
|
||||
if not Pcd.SkuInfoList:
|
||||
OverrideValues = Pcd.SkuOverrideValues
|
||||
if OverrideValues:
|
||||
for Data in OverrideValues.values():
|
||||
Struct = list(Data.values())
|
||||
if Struct:
|
||||
DscOverride = self.ParseStruct(Struct[0])
|
||||
break
|
||||
else:
|
||||
SkuList = sorted(Pcd.SkuInfoList.keys())
|
||||
for Sku in SkuList:
|
||||
SkuInfo = Pcd.SkuInfoList[Sku]
|
||||
if SkuInfo.DefaultStoreDict:
|
||||
DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys())
|
||||
for DefaultStore in DefaultStoreList:
|
||||
OverrideValues = Pcd.SkuOverrideValues[Sku]
|
||||
DscOverride = self.ParseStruct(OverrideValues[DefaultStore])
|
||||
if DscOverride:
|
||||
break
|
||||
if DscOverride:
|
||||
break
|
||||
if DscOverride:
|
||||
DscDefaultValue = True
|
||||
DscMatch = True
|
||||
DecMatch = False
|
||||
else:
|
||||
DecMatch = True
|
||||
else:
|
||||
DscDefaultValue = True
|
||||
DscMatch = True
|
||||
DecMatch = False
|
||||
if Pcd.Type in PCD_DYNAMIC_TYPE_SET | PCD_DYNAMIC_EX_TYPE_SET:
|
||||
DscOverride = False
|
||||
if Pcd.DefaultFromDSC:
|
||||
DscOverride = True
|
||||
else:
|
||||
DictLen = 0
|
||||
for item in Pcd.SkuOverrideValues:
|
||||
DictLen += len(Pcd.SkuOverrideValues[item])
|
||||
if not DictLen:
|
||||
DscOverride = False
|
||||
else:
|
||||
if not Pcd.SkuInfoList:
|
||||
OverrideValues = Pcd.SkuOverrideValues
|
||||
if OverrideValues:
|
||||
for Data in OverrideValues.values():
|
||||
Struct = list(Data.values())
|
||||
if Struct:
|
||||
DscOverride = self.ParseStruct(Struct[0])
|
||||
break
|
||||
else:
|
||||
SkuList = sorted(Pcd.SkuInfoList.keys())
|
||||
for Sku in SkuList:
|
||||
SkuInfo = Pcd.SkuInfoList[Sku]
|
||||
if SkuInfo.DefaultStoreDict:
|
||||
DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys())
|
||||
for DefaultStore in DefaultStoreList:
|
||||
OverrideValues = Pcd.SkuOverrideValues[Sku]
|
||||
DscOverride = self.ParseStruct(OverrideValues[DefaultStore])
|
||||
if DscOverride:
|
||||
break
|
||||
if DscOverride:
|
||||
break
|
||||
if DscOverride:
|
||||
DscDefaultValue = True
|
||||
DscMatch = True
|
||||
DecMatch = False
|
||||
else:
|
||||
DecMatch = True
|
||||
else:
|
||||
if Pcd.DscRawValue or (ModuleGuid and ModuleGuid.replace("-","S") in Pcd.PcdValueFromComponents):
|
||||
DscDefaultValue = True
|
||||
DscMatch = True
|
||||
DecMatch = False
|
||||
else:
|
||||
DscDefaultValue = False
|
||||
DecMatch = True
|
||||
|
||||
#
|
||||
# Report PCD item according to their override relationship
|
||||
@ -1153,13 +1165,14 @@ class PcdReport(object):
|
||||
elif BuildOptionMatch:
|
||||
self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*B')
|
||||
else:
|
||||
if DscDefaultValue and DscMatch:
|
||||
if PcdComponentValue:
|
||||
self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, PcdComponentValue, DecMatch, DecDefaultValue, '*M', ModuleGuid)
|
||||
elif DscDefaultValue and DscMatch:
|
||||
if (Pcd.TokenCName, Key, Field) in self.FdfPcdSet:
|
||||
self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*F')
|
||||
else:
|
||||
self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*P')
|
||||
else:
|
||||
self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M')
|
||||
|
||||
|
||||
if ModulePcdSet is None:
|
||||
if IsStructure:
|
||||
@ -1265,7 +1278,7 @@ class PcdReport(object):
|
||||
for filedvalues in Pcd.DefaultValues.values():
|
||||
self.PrintStructureInfo(File, filedvalues)
|
||||
|
||||
def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, Flag = ' '):
|
||||
def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, Flag = ' ',ModuleGuid=None):
|
||||
if not Pcd.SkuInfoList:
|
||||
Value = Pcd.DefaultValue
|
||||
IsByteArray, ArrayList = ByteArrayForamt(Value)
|
||||
@ -1288,14 +1301,20 @@ class PcdReport(object):
|
||||
OverrideValues = GlobalData.gPcdSkuOverrides[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)]
|
||||
else:
|
||||
OverrideValues = Pcd.SkuOverrideValues
|
||||
FieldOverrideValues = None
|
||||
if OverrideValues:
|
||||
for Data in OverrideValues.values():
|
||||
Struct = list(Data.values())
|
||||
if Struct:
|
||||
OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
|
||||
self.PrintStructureInfo(File, OverrideFieldStruct)
|
||||
FieldOverrideValues = Struct[0]
|
||||
FiledOverrideFlag = True
|
||||
break
|
||||
if Pcd.PcdFiledValueFromDscComponent and ModuleGuid and ModuleGuid.replace("-","S") in Pcd.PcdFiledValueFromDscComponent:
|
||||
FieldOverrideValues = Pcd.PcdFiledValueFromDscComponent[ModuleGuid.replace("-","S")]
|
||||
if FieldOverrideValues:
|
||||
OverrideFieldStruct = self.OverrideFieldValue(Pcd, FieldOverrideValues)
|
||||
self.PrintStructureInfo(File, OverrideFieldStruct)
|
||||
|
||||
if not FiledOverrideFlag and (Pcd.PcdFieldValueFromComm or Pcd.PcdFieldValueFromFdf):
|
||||
OverrideFieldStruct = self.OverrideFieldValue(Pcd, {})
|
||||
self.PrintStructureInfo(File, OverrideFieldStruct)
|
||||
|
@ -18,12 +18,22 @@
|
||||
],
|
||||
## Both file path and directory path are accepted.
|
||||
"IgnoreFiles": [
|
||||
"Library/OpensslLib/openssl"
|
||||
"Library/OpensslLib/openssl",
|
||||
# The unit testing folder is not to be checked
|
||||
"Test/UnitTest",
|
||||
# This has OpenSSL interfaces that aren't UEFI spec compliant
|
||||
"Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c",
|
||||
# this has OpenSSL interfaces that aren't UEFI spec compliant
|
||||
"Library/OpensslLib/rand_pool.c"
|
||||
]
|
||||
},
|
||||
"CompilerPlugin": {
|
||||
"DscPath": "CryptoPkg.dsc"
|
||||
},
|
||||
## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
|
||||
"HostUnitTestCompilerPlugin": {
|
||||
"DscPath": "Test/CryptoPkgHostUnitTest.dsc"
|
||||
},
|
||||
"CharEncodingCheck": {
|
||||
"IgnoreFiles": []
|
||||
},
|
||||
|
@ -60,6 +60,7 @@
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
|
||||
TlsLib|CryptoPkg/Library/TlsLibNull/TlsLibNull.inf
|
||||
HashApiLib|CryptoPkg/Library/BaseHashApiLib/BaseHashApiLib.inf
|
||||
RngLib|MdePkg/Library/BaseRngLibNull/BaseRngLibNull.inf
|
||||
|
||||
[LibraryClasses.ARM, LibraryClasses.AARCH64]
|
||||
#
|
||||
@ -223,6 +224,29 @@
|
||||
# generated for it, but the binary will not be put into any firmware volume.
|
||||
#
|
||||
###################################################################################################
|
||||
[Components]
|
||||
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibShell.inf {
|
||||
<LibraryClasses>
|
||||
PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
|
||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
|
||||
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
|
||||
UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.inf
|
||||
UnitTestPersistenceLib|UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersistenceLibNull.inf
|
||||
UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.inf
|
||||
}
|
||||
|
||||
!if $(CRYPTO_SERVICES) == PACKAGE
|
||||
[Components]
|
||||
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||
@ -284,3 +308,9 @@
|
||||
|
||||
[BuildOptions]
|
||||
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
!if $(CRYPTO_SERVICES) IN "PACKAGE ALL"
|
||||
MSFT:*_*_*_CC_FLAGS = /D ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
INTEL:*_*_*_CC_FLAGS = /D ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
GCC:*_*_*_CC_FLAGS = -D ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
RVCT:*_*_*_CC_FLAGS = -DENABLE_MD5_DEPRECATED_INTERFACES
|
||||
!endif
|
||||
|
@ -243,7 +243,7 @@ DeprecatedCryptoServiceMd4HashAll (
|
||||
return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE;
|
||||
}
|
||||
|
||||
#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
#ifndef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
@ -4494,7 +4494,7 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
||||
DeprecatedCryptoServiceMd4Update,
|
||||
DeprecatedCryptoServiceMd4Final,
|
||||
DeprecatedCryptoServiceMd4HashAll,
|
||||
#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
#ifndef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
/// Md5 - deprecated and unsupported
|
||||
DeprecatedCryptoServiceMd5GetContextSize,
|
||||
DeprecatedCryptoServiceMd5Init,
|
||||
|
@ -72,7 +72,7 @@ typedef enum {
|
||||
// One-Way Cryptographic Hash Primitives
|
||||
//=====================================================================================
|
||||
|
||||
#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
|
@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "InternalCryptLib.h"
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
|
@ -40,8 +40,8 @@
|
||||
Hash/CryptSha256.c
|
||||
Hash/CryptSm3.c
|
||||
Hash/CryptSha512.c
|
||||
Hmac/CryptHmacSha256Null.c
|
||||
Kdf/CryptHkdfNull.c
|
||||
Hmac/CryptHmacSha256.c
|
||||
Kdf/CryptHkdf.c
|
||||
Cipher/CryptAesNull.c
|
||||
Pk/CryptRsaBasic.c
|
||||
Pk/CryptRsaExtNull.c
|
||||
|
@ -9,7 +9,7 @@
|
||||
AuthenticodeVerify() will get PE/COFF Authenticode and will do basic check for
|
||||
data structure.
|
||||
|
||||
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
@ -100,7 +100,7 @@ AuthenticodeVerify (
|
||||
//
|
||||
// Check if it's PKCS#7 Signed Data (for Authenticode Scenario)
|
||||
//
|
||||
if (!PKCS7_type_is_signed (Pkcs7)) {
|
||||
if (!PKCS7_type_is_signed (Pkcs7) || PKCS7_get_detached (Pkcs7)) {
|
||||
goto _Exit;
|
||||
}
|
||||
|
||||
|
@ -508,10 +508,6 @@ Exit:
|
||||
free (SignedData);
|
||||
}
|
||||
|
||||
if (SignerCert != NULL) {
|
||||
X509_free (SignerCert);
|
||||
}
|
||||
|
||||
if (Pkcs7 != NULL) {
|
||||
PKCS7_free (Pkcs7);
|
||||
}
|
||||
|
@ -40,9 +40,9 @@
|
||||
Hash/CryptSha256.c
|
||||
Hash/CryptSm3.c
|
||||
Hash/CryptSha512Null.c
|
||||
Hmac/CryptHmacSha256Null.c
|
||||
Kdf/CryptHkdfNull.c
|
||||
Cipher/CryptAesNull.c
|
||||
Hmac/CryptHmacSha256.c
|
||||
Kdf/CryptHkdf.c
|
||||
Cipher/CryptAes.c
|
||||
Pk/CryptRsaBasic.c
|
||||
Pk/CryptRsaExtNull.c
|
||||
Pk/CryptPkcs1OaepNull.c
|
||||
|
@ -0,0 +1,93 @@
|
||||
/** @file
|
||||
C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based
|
||||
Cryptographic Library.
|
||||
|
||||
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Base.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
/* Convert character to lowercase */
|
||||
int tolower (int c)
|
||||
{
|
||||
if (('A' <= (c)) && ((c) <= 'Z')) {
|
||||
return (c - ('A' - 'a'));
|
||||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
/* Compare first n bytes of string s1 with string s2, ignoring case */
|
||||
int strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
int Val;
|
||||
|
||||
ASSERT(s1 != NULL);
|
||||
ASSERT(s2 != NULL);
|
||||
|
||||
if (n != 0) {
|
||||
do {
|
||||
Val = tolower(*s1) - tolower(*s2);
|
||||
if (Val != 0) {
|
||||
return Val;
|
||||
}
|
||||
++s1;
|
||||
++s2;
|
||||
if (*s1 == '\0') {
|
||||
break;
|
||||
}
|
||||
} while (--n != 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read formatted data from a string */
|
||||
int sscanf (const char *buffer, const char *format, ...)
|
||||
{
|
||||
//
|
||||
// Null sscanf() function implementation to satisfy the linker, since
|
||||
// no direct functionality logic dependency in present UEFI cases.
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// -- Dummy OpenSSL Support Routines --
|
||||
//
|
||||
|
||||
int BIO_printf (void *bio, const char *format, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BIO_snprintf(char *buf, size_t n, const char *format, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uid_t getuid (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uid_t geteuid (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
gid_t getgid (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
gid_t getegid (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int errno = 0;
|
90
CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
Normal file
90
CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
Normal file
@ -0,0 +1,90 @@
|
||||
## @file
|
||||
# Cryptographic Library Instance for host based unit tests
|
||||
#
|
||||
# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = BaseCryptLib
|
||||
FILE_GUID = c97d34aa-caf8-42cd-8261-8705f46304b3
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = BaseCryptLib|HOST_APPLICATION
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
InternalCryptLib.h
|
||||
Hash/CryptMd5.c
|
||||
Hash/CryptSha1.c
|
||||
Hash/CryptSha256.c
|
||||
Hash/CryptSha512.c
|
||||
Hash/CryptSm3.c
|
||||
Hmac/CryptHmacSha256.c
|
||||
Kdf/CryptHkdf.c
|
||||
Cipher/CryptAes.c
|
||||
Pk/CryptRsaBasic.c
|
||||
Pk/CryptRsaExt.c
|
||||
Pk/CryptPkcs1Oaep.c
|
||||
Pk/CryptPkcs5Pbkdf2.c
|
||||
Pk/CryptPkcs7Sign.c
|
||||
Pk/CryptPkcs7VerifyCommon.c
|
||||
Pk/CryptPkcs7VerifyBase.c
|
||||
Pk/CryptPkcs7VerifyEku.c
|
||||
Pk/CryptDh.c
|
||||
Pk/CryptX509.c
|
||||
Pk/CryptAuthenticode.c
|
||||
Pk/CryptTs.c
|
||||
Pem/CryptPem.c
|
||||
|
||||
SysCall/UnitTestHostCrtWrapper.c
|
||||
|
||||
[Sources.Ia32]
|
||||
Rand/CryptRandTsc.c
|
||||
|
||||
[Sources.X64]
|
||||
Rand/CryptRandTsc.c
|
||||
|
||||
[Sources.ARM]
|
||||
Rand/CryptRand.c
|
||||
|
||||
[Sources.AARCH64]
|
||||
Rand/CryptRand.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
CryptoPkg/CryptoPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DebugLib
|
||||
OpensslLib
|
||||
|
||||
#
|
||||
# Remove these [BuildOptions] after this library is cleaned up
|
||||
#
|
||||
[BuildOptions]
|
||||
#
|
||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
||||
# C4090: 'function' : different 'const' qualifiers
|
||||
# C4018: '>': signed/unsigned mismatch
|
||||
MSFT:*_*_*_CC_FLAGS = /wd4090 /wd4018
|
||||
|
||||
# -JCryptoPkg/Include : To disable the use of the system includes provided by RVCT
|
||||
# --diag_remark=1 : Reduce severity of "#1-D: last line of file ends without a newline"
|
||||
RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
|
||||
|
||||
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
||||
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
||||
|
||||
XCODE:*_*_*_CC_FLAGS = -std=c99
|
@ -99,7 +99,7 @@ CryptoServiceNotAvailable (
|
||||
// One-Way Cryptographic Hash Primitives
|
||||
//=====================================================================================
|
||||
|
||||
#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
|
||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
/**
|
||||
Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
|
||||
|
||||
|
@ -571,22 +571,9 @@
|
||||
$(OPENSSL_PATH)/ssl/statem/statem_local.h
|
||||
# Autogenerated files list ends here
|
||||
buildinf.h
|
||||
rand_pool_noise.h
|
||||
ossl_store.c
|
||||
rand_pool.c
|
||||
|
||||
[Sources.Ia32]
|
||||
rand_pool_noise_tsc.c
|
||||
|
||||
[Sources.X64]
|
||||
rand_pool_noise_tsc.c
|
||||
|
||||
[Sources.ARM]
|
||||
rand_pool_noise.c
|
||||
|
||||
[Sources.AARCH64]
|
||||
rand_pool_noise.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
CryptoPkg/CryptoPkg.dec
|
||||
@ -594,7 +581,7 @@
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
TimerLib
|
||||
RngLib
|
||||
PrintLib
|
||||
|
||||
[LibraryClasses.ARM]
|
||||
|
@ -520,22 +520,9 @@
|
||||
$(OPENSSL_PATH)/crypto/x509v3/v3_admis.h
|
||||
# Autogenerated files list ends here
|
||||
buildinf.h
|
||||
rand_pool_noise.h
|
||||
ossl_store.c
|
||||
rand_pool.c
|
||||
|
||||
[Sources.Ia32]
|
||||
rand_pool_noise_tsc.c
|
||||
|
||||
[Sources.X64]
|
||||
rand_pool_noise_tsc.c
|
||||
|
||||
[Sources.ARM]
|
||||
rand_pool_noise.c
|
||||
|
||||
[Sources.AARCH64]
|
||||
rand_pool_noise.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
CryptoPkg/CryptoPkg.dec
|
||||
@ -543,7 +530,7 @@
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
TimerLib
|
||||
RngLib
|
||||
PrintLib
|
||||
|
||||
[LibraryClasses.ARM]
|
||||
|
@ -2,8 +2,8 @@
|
||||
OpenSSL_1_1_1b doesn't implement rand_pool_* functions for UEFI.
|
||||
The file implement these functions.
|
||||
|
||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
@ -11,53 +11,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <openssl/aes.h>
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Library/TimerLib.h>
|
||||
|
||||
#include "rand_pool_noise.h"
|
||||
|
||||
/**
|
||||
Get some randomness from low-order bits of GetPerformanceCounter results.
|
||||
And combine them to the 64-bit value
|
||||
|
||||
@param[out] Rand Buffer pointer to store the 64-bit random value.
|
||||
|
||||
@retval TRUE Random number generated successfully.
|
||||
@retval FALSE Failed to generate.
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandNoise64FromPerformanceCounter(
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 *RandPtr;
|
||||
|
||||
if (NULL == Rand) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RandPtr = (UINT32 *) Rand;
|
||||
|
||||
for (Index = 0; Index < 2; Index ++) {
|
||||
*RandPtr = (UINT32) (GetPerformanceCounter () & 0xFF);
|
||||
MicroSecondDelay (10);
|
||||
RandPtr++;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#include <Library/RngLib.h>
|
||||
|
||||
/**
|
||||
Calls RandomNumber64 to fill
|
||||
a buffer of arbitrary size with random bytes.
|
||||
This is a shim layer to RngLib.
|
||||
|
||||
@param[in] Length Size of the buffer, in bytes, to fill with.
|
||||
@param[out] RandBuffer Pointer to the buffer to store the random result.
|
||||
|
||||
@retval EFI_SUCCESS Random bytes generation succeeded.
|
||||
@retval EFI_NOT_READY Failed to request random bytes.
|
||||
@retval TRUE Random bytes generation succeeded.
|
||||
@retval FALSE Failed to request random bytes.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
@ -65,7 +30,7 @@ BOOLEAN
|
||||
EFIAPI
|
||||
RandGetBytes (
|
||||
IN UINTN Length,
|
||||
OUT UINT8 *RandBuffer
|
||||
OUT UINT8 *RandBuffer
|
||||
)
|
||||
{
|
||||
BOOLEAN Ret;
|
||||
@ -73,17 +38,17 @@ RandGetBytes (
|
||||
|
||||
Ret = FALSE;
|
||||
|
||||
if (RandBuffer == NULL) {
|
||||
DEBUG((DEBUG_ERROR, "[OPENSSL_RAND_POOL] NULL RandBuffer. No random numbers are generated and your system is not secure\n"));
|
||||
ASSERT (RandBuffer != NULL); // Since we can't generate random numbers, we should assert. Otherwise we will just blow up later.
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
while (Length > 0) {
|
||||
//
|
||||
// Get random noise from platform.
|
||||
// If it failed, fallback to PerformanceCounter
|
||||
// If you really care about security, you must override
|
||||
// GetRandomNoise64FromPlatform.
|
||||
//
|
||||
Ret = GetRandomNoise64 (&TempRand);
|
||||
if (Ret == FALSE) {
|
||||
Ret = GetRandNoise64FromPerformanceCounter (&TempRand);
|
||||
}
|
||||
// Use RngLib to get random number
|
||||
Ret = GetRandomNumber64 (&TempRand);
|
||||
|
||||
if (!Ret) {
|
||||
return Ret;
|
||||
}
|
||||
@ -91,7 +56,8 @@ RandGetBytes (
|
||||
*((UINT64*) RandBuffer) = TempRand;
|
||||
RandBuffer += sizeof (UINT64);
|
||||
Length -= sizeof (TempRand);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
CopyMem (RandBuffer, &TempRand, Length);
|
||||
Length = 0;
|
||||
}
|
||||
@ -100,125 +66,6 @@ RandGetBytes (
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a 128bit random value that is fully forward and backward prediction resistant,
|
||||
suitable for seeding a NIST SP800-90 Compliant.
|
||||
This function takes multiple random numbers from PerformanceCounter to ensure reseeding
|
||||
and performs AES-CBC-MAC over the data to compute the seed value.
|
||||
|
||||
@param[out] SeedBuffer Pointer to a 128bit buffer to store the random seed.
|
||||
|
||||
@retval TRUE Random seed generation succeeded.
|
||||
@retval FALSE Failed to request random bytes.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
RandGetSeed128 (
|
||||
OUT UINT8 *SeedBuffer
|
||||
)
|
||||
{
|
||||
BOOLEAN Ret;
|
||||
UINT8 RandByte[16];
|
||||
UINT8 Key[16];
|
||||
UINT8 Ffv[16];
|
||||
UINT8 Xored[16];
|
||||
UINT32 Index;
|
||||
UINT32 Index2;
|
||||
AES_KEY AESKey;
|
||||
|
||||
//
|
||||
// Chose an arbitrary key and zero the feed_forward_value (FFV)
|
||||
//
|
||||
for (Index = 0; Index < 16; Index++) {
|
||||
Key[Index] = (UINT8) Index;
|
||||
Ffv[Index] = 0;
|
||||
}
|
||||
|
||||
AES_set_encrypt_key (Key, 16 * 8, &AESKey);
|
||||
|
||||
//
|
||||
// Perform CBC_MAC over 32 * 128 bit values, with 10us gaps between 128 bit value
|
||||
// The 10us gaps will ensure multiple reseeds within the system time with a large
|
||||
// design margin.
|
||||
//
|
||||
for (Index = 0; Index < 32; Index++) {
|
||||
MicroSecondDelay (10);
|
||||
Ret = RandGetBytes (16, RandByte);
|
||||
if (!Ret) {
|
||||
return Ret;
|
||||
}
|
||||
|
||||
//
|
||||
// Perform XOR operations on two 128-bit value.
|
||||
//
|
||||
for (Index2 = 0; Index2 < 16; Index2++) {
|
||||
Xored[Index2] = RandByte[Index2] ^ Ffv[Index2];
|
||||
}
|
||||
|
||||
AES_encrypt (Xored, Ffv, &AESKey);
|
||||
}
|
||||
|
||||
for (Index = 0; Index < 16; Index++) {
|
||||
SeedBuffer[Index] = Ffv[Index];
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/**
|
||||
Generate high-quality entropy source.
|
||||
|
||||
@param[in] Length Size of the buffer, in bytes, to fill with.
|
||||
@param[out] Entropy Pointer to the buffer to store the entropy data.
|
||||
|
||||
@retval EFI_SUCCESS Entropy generation succeeded.
|
||||
@retval EFI_NOT_READY Failed to request random data.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
RandGenerateEntropy (
|
||||
IN UINTN Length,
|
||||
OUT UINT8 *Entropy
|
||||
)
|
||||
{
|
||||
BOOLEAN Ret;
|
||||
UINTN BlockCount;
|
||||
UINT8 Seed[16];
|
||||
UINT8 *Ptr;
|
||||
|
||||
BlockCount = Length / 16;
|
||||
Ptr = (UINT8 *) Entropy;
|
||||
|
||||
//
|
||||
// Generate high-quality seed for DRBG Entropy
|
||||
//
|
||||
while (BlockCount > 0) {
|
||||
Ret = RandGetSeed128 (Seed);
|
||||
if (!Ret) {
|
||||
return Ret;
|
||||
}
|
||||
CopyMem (Ptr, Seed, 16);
|
||||
|
||||
BlockCount--;
|
||||
Ptr = Ptr + 16;
|
||||
}
|
||||
|
||||
//
|
||||
// Populate the remained data as request.
|
||||
//
|
||||
Ret = RandGetSeed128 (Seed);
|
||||
if (!Ret) {
|
||||
return Ret;
|
||||
}
|
||||
CopyMem (Ptr, Seed, (Length % 16));
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add random bytes to the pool to acquire requested amount of entropy
|
||||
*
|
||||
@ -227,27 +74,31 @@ RandGenerateEntropy (
|
||||
*
|
||||
* This is OpenSSL required interface.
|
||||
*/
|
||||
size_t rand_pool_acquire_entropy(RAND_POOL *pool)
|
||||
size_t
|
||||
rand_pool_acquire_entropy (
|
||||
RAND_POOL *pool
|
||||
)
|
||||
{
|
||||
BOOLEAN Ret;
|
||||
size_t bytes_needed;
|
||||
unsigned char * buffer;
|
||||
BOOLEAN Ret;
|
||||
size_t Bytes_needed;
|
||||
unsigned char *Buffer;
|
||||
|
||||
bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
|
||||
if (bytes_needed > 0) {
|
||||
buffer = rand_pool_add_begin(pool, bytes_needed);
|
||||
Bytes_needed = rand_pool_bytes_needed (pool, 1 /*entropy_factor*/);
|
||||
if (Bytes_needed > 0) {
|
||||
Buffer = rand_pool_add_begin (pool, Bytes_needed);
|
||||
|
||||
if (buffer != NULL) {
|
||||
Ret = RandGenerateEntropy(bytes_needed, buffer);
|
||||
if (Buffer != NULL) {
|
||||
Ret = RandGetBytes (Bytes_needed, Buffer);
|
||||
if (FALSE == Ret) {
|
||||
rand_pool_add_end(pool, 0, 0);
|
||||
} else {
|
||||
rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
|
||||
rand_pool_add_end (pool, 0, 0);
|
||||
}
|
||||
else {
|
||||
rand_pool_add_end (pool, Bytes_needed, 8 * Bytes_needed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rand_pool_entropy_available(pool);
|
||||
return rand_pool_entropy_available (pool);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -255,17 +106,15 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
|
||||
*
|
||||
* This is OpenSSL required interface.
|
||||
*/
|
||||
int rand_pool_add_nonce_data(RAND_POOL *pool)
|
||||
int
|
||||
rand_pool_add_nonce_data (
|
||||
RAND_POOL *pool
|
||||
)
|
||||
{
|
||||
struct {
|
||||
UINT64 Rand;
|
||||
UINT64 TimerValue;
|
||||
} data = { 0 };
|
||||
UINT8 data[16];
|
||||
RandGetBytes (sizeof(data), data);
|
||||
|
||||
RandGetBytes(8, (UINT8 *)&(data.Rand));
|
||||
data.TimerValue = GetPerformanceCounter();
|
||||
|
||||
return rand_pool_add(pool, (unsigned char*)&data, sizeof(data), 0);
|
||||
return rand_pool_add (pool, (unsigned char*)&data, sizeof(data), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -273,17 +122,15 @@ int rand_pool_add_nonce_data(RAND_POOL *pool)
|
||||
*
|
||||
* This is OpenSSL required interface.
|
||||
*/
|
||||
int rand_pool_add_additional_data(RAND_POOL *pool)
|
||||
int
|
||||
rand_pool_add_additional_data (
|
||||
RAND_POOL *pool
|
||||
)
|
||||
{
|
||||
struct {
|
||||
UINT64 Rand;
|
||||
UINT64 TimerValue;
|
||||
} data = { 0 };
|
||||
UINT8 data[16];
|
||||
RandGetBytes (sizeof(data), data);
|
||||
|
||||
RandGetBytes(8, (UINT8 *)&(data.Rand));
|
||||
data.TimerValue = GetPerformanceCounter();
|
||||
|
||||
return rand_pool_add(pool, (unsigned char*)&data, sizeof(data), 0);
|
||||
return rand_pool_add (pool, (unsigned char*)&data, sizeof(data), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -291,7 +138,10 @@ int rand_pool_add_additional_data(RAND_POOL *pool)
|
||||
*
|
||||
* This is OpenSSL required interface.
|
||||
*/
|
||||
int rand_pool_init(void)
|
||||
int
|
||||
rand_pool_init (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -301,7 +151,10 @@ int rand_pool_init(void)
|
||||
*
|
||||
* This is OpenSSL required interface.
|
||||
*/
|
||||
void rand_pool_cleanup(void)
|
||||
VOID
|
||||
rand_pool_cleanup(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
@ -310,7 +163,9 @@ void rand_pool_cleanup(void)
|
||||
*
|
||||
* This is OpenSSL required interface.
|
||||
*/
|
||||
void rand_pool_keep_random_devices_open(int keep)
|
||||
VOID
|
||||
rand_pool_keep_random_devices_open (
|
||||
int keep
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
/** @file
|
||||
Provide rand noise source.
|
||||
|
||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
|
||||
/**
|
||||
Get 64-bit noise source
|
||||
|
||||
@param[out] Rand Buffer pointer to store 64-bit noise source
|
||||
|
||||
@retval FALSE Failed to generate
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNoise64 (
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
//
|
||||
// Return FALSE will fallback to use PerformanceCounter to
|
||||
// generate noise.
|
||||
//
|
||||
return FALSE;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/** @file
|
||||
Provide rand noise source.
|
||||
|
||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __RAND_POOL_NOISE_H__
|
||||
#define __RAND_POOL_NOISE_H__
|
||||
|
||||
#include <Uefi/UefiBaseType.h>
|
||||
|
||||
/**
|
||||
Get 64-bit noise source.
|
||||
|
||||
@param[out] Rand Buffer pointer to store 64-bit noise source
|
||||
|
||||
@retval TRUE Get randomness successfully.
|
||||
@retval FALSE Failed to generate
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNoise64 (
|
||||
OUT UINT64 *Rand
|
||||
);
|
||||
|
||||
|
||||
#endif // __RAND_POOL_NOISE_H__
|
@ -1,43 +0,0 @@
|
||||
/** @file
|
||||
Provide rand noise source.
|
||||
|
||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
|
||||
/**
|
||||
Get 64-bit noise source
|
||||
|
||||
@param[out] Rand Buffer pointer to store 64-bit noise source
|
||||
|
||||
@retval TRUE Get randomness successfully.
|
||||
@retval FALSE Failed to generate
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNoise64 (
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 *RandPtr;
|
||||
|
||||
if (NULL == Rand) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RandPtr = (UINT32 *)Rand;
|
||||
|
||||
for (Index = 0; Index < 2; Index ++) {
|
||||
*RandPtr = (UINT32) ((AsmReadTsc ()) & 0xFF);
|
||||
RandPtr++;
|
||||
MicroSecondDelay (10);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
42
CryptoPkg/Test/CryptoPkgHostUnitTest.dsc
Normal file
42
CryptoPkg/Test/CryptoPkgHostUnitTest.dsc
Normal file
@ -0,0 +1,42 @@
|
||||
## @file
|
||||
# CryptoPkg DSC file used to build host-based unit tests.
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
PLATFORM_NAME = CryptoPkgHostTest
|
||||
PLATFORM_GUID = C7F97D6D-54AC-45A9-8197-CC99B20CC7EC
|
||||
PLATFORM_VERSION = 0.1
|
||||
DSC_SPECIFICATION = 0x00010005
|
||||
OUTPUT_DIRECTORY = Build/CryptoPkg/HostTest
|
||||
SUPPORTED_ARCHITECTURES = IA32|X64
|
||||
BUILD_TARGETS = NOOPT
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
|
||||
!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
|
||||
|
||||
[LibraryClasses]
|
||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
|
||||
|
||||
[LibraryClasses.AARCH64, LibraryClasses.ARM]
|
||||
RngLib|MdePkg/Library/BaseRngLibNull/BaseRngLibNull.inf
|
||||
|
||||
[LibraryClasses.X64, LibraryClasses.IA32]
|
||||
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
|
||||
|
||||
[Components]
|
||||
#
|
||||
# Build HOST_APPLICATION that tests the SampleUnitTest
|
||||
#
|
||||
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf
|
||||
|
||||
[BuildOptions]
|
||||
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
MSFT:*_*_*_CC_FLAGS = /D ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
INTEL:*_*_*_CC_FLAGS = /D ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
GCC:*_*_*_CC_FLAGS = -D ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
RVCT:*_*_*_CC_FLAGS = -DENABLE_MD5_DEPRECATED_INTERFACES
|
1002
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
Normal file
1002
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,66 @@
|
||||
/** @file
|
||||
This is defines the tests that will run on BaseCryptLib
|
||||
|
||||
Copyright (c) Microsoft Corporation.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
SUITE_DESC mSuiteDesc[] = {
|
||||
//
|
||||
// Title--------------------------Package-------------------Sup--Tdn----TestNum------------TestDesc
|
||||
//
|
||||
{"EKU verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs7EkuTestNum, mPkcs7EkuTest},
|
||||
{"HASH verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mHashTestNum, mHashTest},
|
||||
{"HMAC verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mHmacTestNum, mHmacTest},
|
||||
{"BlockCipher verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mBlockCipherTestNum, mBlockCipherTest},
|
||||
{"RSA verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaTestNum, mRsaTest},
|
||||
{"RSACert verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaCertTestNum, mRsaCertTest},
|
||||
{"PKCS7 verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs7TestNum, mPkcs7Test},
|
||||
{"PKCS5 verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs5TestNum, mPkcs5Test},
|
||||
{"Authenticode verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mAuthenticodeTestNum, mAuthenticodeTest},
|
||||
{"ImageTimestamp verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mImageTimestampTestNum, mImageTimestampTest},
|
||||
{"DH verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mDhTestNum, mDhTest},
|
||||
{"PRNG verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPrngTestNum, mPrngTest},
|
||||
{"OAEP encrypt verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mOaepTestNum, mOaepTest},
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CreateUnitTest (
|
||||
IN CHAR8* UnitTestName,
|
||||
IN CHAR8* UnitTestVersion,
|
||||
IN OUT UNIT_TEST_FRAMEWORK_HANDLE* Framework
|
||||
) {
|
||||
EFI_STATUS Status;
|
||||
UINTN SuiteIndex;
|
||||
UINTN TestIndex;
|
||||
|
||||
if ( Framework == NULL || UnitTestVersion == NULL || UnitTestName == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
// Start setting up the test framework for running the tests.
|
||||
//
|
||||
Status = InitUnitTestFramework (Framework, UnitTestName, gEfiCallerBaseName, UnitTestVersion);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
for (SuiteIndex = 0; SuiteIndex < ARRAY_SIZE(mSuiteDesc); SuiteIndex++) {
|
||||
UNIT_TEST_SUITE_HANDLE Suite = NULL;
|
||||
Status = CreateUnitTestSuite (&Suite, *Framework, mSuiteDesc[SuiteIndex].Title, mSuiteDesc[SuiteIndex].Package, mSuiteDesc[SuiteIndex].Sup, mSuiteDesc[SuiteIndex].Tdn);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto EXIT;
|
||||
}
|
||||
for (TestIndex = 0; TestIndex < *mSuiteDesc[SuiteIndex].TestNum; TestIndex++) {
|
||||
AddTestCase (Suite, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Description, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->ClassName, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Func, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->PreReq, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->CleanUp, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Context);
|
||||
}
|
||||
}
|
||||
EXIT:
|
||||
return Status;
|
||||
}
|
293
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
Normal file
293
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
Normal file
@ -0,0 +1,293 @@
|
||||
/** @file
|
||||
Application for Block Cipher Primitives Validation.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
//
|
||||
// TDES test vectors are extracted from OpenSSL 0.9.8l, crypto\des\destest.c
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbData[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbKey[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbCipher[] = {
|
||||
0x8C, 0xA6, 0x4D, 0xE9, 0xC1, 0xB1, 0x23, 0xA7,
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcb2Cipher[] = {
|
||||
0x92, 0x95, 0xB5, 0x9B, 0xB3, 0x84, 0x73, 0x6E,
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcData[] = {
|
||||
0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
|
||||
0x4E, 0x6F, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x20
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcKey[] = {
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
0xf1, 0xe0, 0xd3, 0xc2, 0xb5, 0xa4, 0x97, 0x86,
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TdesCbcIvec[] = {
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbc3Cipher[] = {
|
||||
0x3F, 0xE3, 0x01, 0xC9, 0x62, 0xAC, 0x01, 0xD0,
|
||||
0x22, 0x13, 0x76, 0x3C, 0x1C, 0xBD, 0x4C, 0xDC,
|
||||
0x79, 0x96, 0x57, 0xC0, 0x64, 0xEC, 0xF5, 0xD4
|
||||
};
|
||||
|
||||
//
|
||||
// AES test vectors are from NIST KAT of AES
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbData[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbKey[] = {
|
||||
0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbCipher[] = {
|
||||
0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbData[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbKey[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbCipher[] = {
|
||||
0xdd, 0x8a, 0x49, 0x35, 0x14, 0x23, 0x1c, 0xbf, 0x56, 0xec, 0xce, 0xe4, 0xc4, 0x08, 0x89, 0xfb
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbData[] = {
|
||||
0x01, 0x47, 0x30, 0xf8, 0x0a, 0xc6, 0x25, 0xfe, 0x84, 0xf0, 0x26, 0xc6, 0x0b, 0xfd, 0x54, 0x7d
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbKey[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbCipher[] = {
|
||||
0x5c, 0x9d, 0x84, 0x4e, 0xd4, 0x6f, 0x98, 0x85, 0x08, 0x5e, 0x5d, 0x6a, 0x4f, 0x94, 0xc7, 0xd7
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcData[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcKey[] = {
|
||||
0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcIvec[] = {
|
||||
0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcCipher[] = {
|
||||
0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
|
||||
0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1
|
||||
};
|
||||
|
||||
//
|
||||
// ARC4 Test Vector defined in "Appendix A.1 Test Vectors from [CRYPTLIB]" of
|
||||
// IETF Draft draft-kaukonen-cipher-arcfour-03 ("A Stream Cipher Encryption Algorithm 'Arcfour'").
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Data[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Key[] = {
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Cipher[] = {
|
||||
0x74, 0x94, 0xC2, 0xE7, 0x10, 0x4B, 0x08, 0x79
|
||||
};
|
||||
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE) (
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_BLOCK_CIPHER_INIT) (
|
||||
OUT VOID *BlockCipherContext,
|
||||
IN CONST UINT8 *Key,
|
||||
IN UINTN KeyLength
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT) (
|
||||
IN VOID *BlockCipherContext,
|
||||
IN CONST UINT8 *Input,
|
||||
IN UINTN InputSize,
|
||||
OUT UINT8 *Output
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT) (
|
||||
IN VOID *BlockCipherContext,
|
||||
IN CONST UINT8 *Input,
|
||||
IN UINTN InputSize,
|
||||
IN CONST UINT8 *Ivec,
|
||||
OUT UINT8 *Output
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_BLOCK_CIPHER_RESET) (
|
||||
IN OUT VOID *BlockCipherContext
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE GetContextSize;
|
||||
EFI_BLOCK_CIPHER_INIT Init;
|
||||
EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT EcbEncrypt;
|
||||
EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT EcbDecrypt;
|
||||
EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT CbcEncrypt;
|
||||
EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT CbcDecrypt;
|
||||
EFI_BLOCK_CIPHER_RESET Reset;
|
||||
CONST UINT8 *Key;
|
||||
UINTN KeySize;
|
||||
CONST UINT8 *Ivec;
|
||||
CONST UINT8 *Data;
|
||||
UINTN DataSize;
|
||||
CONST UINT8 *Cipher;
|
||||
UINTN CipherSize;
|
||||
VOID *Ctx;
|
||||
} BLOCK_CIPHER_TEST_CONTEXT;
|
||||
|
||||
// These are commented out as they are deprecated, but are left in should they be used again
|
||||
//BLOCK_CIPHER_TEST_CONTEXT mTdesEcbTestCtx = {TdesGetContextSize, TdesInit, TdesEcbEncrypt, TdesEcbDecrypt, NULL, NULL, NULL, TdesEcbKey, 64, NULL, TdesEcbData, 8, TdesEcbCipher, 8};
|
||||
//BLOCK_CIPHER_TEST_CONTEXT mTdesCbcTestCtx = {TdesGetContextSize, TdesInit, NULL, NULL, TdesCbcEncrypt, TdesCbcDecrypt, NULL, TdesCbcKey, 192, TdesCbcIvec, TdesCbcData, sizeof(TdesCbcData), TdesCbc3Cipher, sizeof(TdesCbc3Cipher)};
|
||||
//BLOCK_CIPHER_TEST_CONTEXT mAes128EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes128EcbKey, 128, NULL, Aes128EcbData, sizeof(Aes128EcbData), Aes128EcbCipher, sizeof(Aes128EcbCipher)};
|
||||
//BLOCK_CIPHER_TEST_CONTEXT mAes192EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes192EcbKey, 192, NULL, Aes192EcbData, sizeof(Aes192EcbData), Aes192EcbCipher, sizeof(Aes192EcbCipher)};
|
||||
//BLOCK_CIPHER_TEST_CONTEXT mAes256EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes256EcbKey, 256, NULL, Aes256EcbData, sizeof(Aes256EcbData), Aes256EcbCipher, sizeof(Aes256EcbCipher)};
|
||||
//BLOCK_CIPHER_TEST_CONTEXT mArc4TestCtx = {Arc4GetContextSize, Arc4Init, Arc4Encrypt, (EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT), Arc4Decrypt, NULL, NULL, Arc4Reset, Arc4Key, sizeof(Arc4Key), NULL, Arc4Data, sizeof(Arc4Data), Arc4Cipher, sizeof(Arc4Cipher)};
|
||||
BLOCK_CIPHER_TEST_CONTEXT mAes128CbcTestCtx = {AesGetContextSize, AesInit, NULL, NULL, AesCbcEncrypt, AesCbcDecrypt, NULL, Aes128CbcKey, 128, Aes128CbcIvec, Aes128CbcData, sizeof(Aes128CbcData), Aes128CbcCipher, sizeof(Aes128CbcCipher)};
|
||||
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyBLockCiperPreReq (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BLOCK_CIPHER_TEST_CONTEXT *TestContext;
|
||||
UINTN CtxSize;
|
||||
|
||||
TestContext = Context;
|
||||
CtxSize = TestContext->GetContextSize ();
|
||||
TestContext->Ctx = AllocatePool (CtxSize);
|
||||
if (TestContext->Ctx == NULL) {
|
||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
TestVerifyBLockCiperCleanUp (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BLOCK_CIPHER_TEST_CONTEXT *TestContext;
|
||||
|
||||
TestContext = Context;
|
||||
if (TestContext->Ctx != NULL) {
|
||||
FreePool (TestContext->Ctx);
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyBLockCiper (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINT8 Encrypt[256];
|
||||
UINT8 Decrypt[256];
|
||||
BOOLEAN Status;
|
||||
BLOCK_CIPHER_TEST_CONTEXT *TestContext;
|
||||
|
||||
TestContext = Context;
|
||||
|
||||
ZeroMem (Encrypt, sizeof (Encrypt));
|
||||
ZeroMem (Decrypt, sizeof (Decrypt));
|
||||
|
||||
Status = TestContext->Init (TestContext->Ctx, TestContext->Key, TestContext->KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
if (TestContext->Ivec == NULL) {
|
||||
Status = TestContext->EcbEncrypt (TestContext->Ctx, TestContext->Data, TestContext->DataSize, Encrypt);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
if (TestContext->Reset != NULL) {
|
||||
Status = TestContext->Reset (TestContext->Ctx);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
}
|
||||
|
||||
Status = TestContext->EcbDecrypt (TestContext->Ctx, Encrypt, TestContext->DataSize, Decrypt);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
} else {
|
||||
Status = TestContext->CbcEncrypt (TestContext->Ctx, TestContext->Data, TestContext->DataSize, TestContext->Ivec, Encrypt);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
if (TestContext->Reset != NULL) {
|
||||
Status = TestContext->Reset (TestContext->Ctx);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
}
|
||||
|
||||
Status = TestContext->CbcDecrypt (TestContext->Ctx, Encrypt, TestContext->DataSize, TestContext->Ivec, Decrypt);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
}
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (Encrypt, TestContext->Cipher, TestContext->CipherSize);
|
||||
UT_ASSERT_MEM_EQUAL (Decrypt, TestContext->Data, TestContext->DataSize);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mBlockCipherTest[] = {
|
||||
//
|
||||
// -----Description-------------------------Class-------------------------Function---------------Pre---------------------------Post------------------Context
|
||||
//
|
||||
{"TestVerifyAes128Cbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128CbcTestCtx},
|
||||
// These are commented out as these functions have been deprecated, but they have been left in for future reference
|
||||
//{"TestVerifyTdesEcb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mTdesEcbTestCtx},
|
||||
//{"TestVerifyTdesCbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mTdesCbcTestCtx},
|
||||
//{"TestVerifyAes128Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128EcbTestCtx},
|
||||
//{"TestVerifyAes192Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes192EcbTestCtx},
|
||||
//{"TestVerifyAes256Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes256EcbTestCtx},
|
||||
//{"TestVerifyArc4()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mArc4TestCtx},
|
||||
};
|
||||
|
||||
UINTN mBlockCipherTestNum = ARRAY_SIZE(mBlockCipherTest);
|
106
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
Normal file
106
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
Normal file
@ -0,0 +1,106 @@
|
||||
/** @file
|
||||
Application for Diffie-Hellman Primitives Validation.
|
||||
|
||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
VOID *mDh1;
|
||||
VOID *mDh2;
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyDhPreReq (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
mDh1 = DhNew ();
|
||||
if (mDh1 == NULL) {
|
||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||
}
|
||||
|
||||
mDh2 = DhNew ();
|
||||
if (mDh2 == NULL) {
|
||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
TestVerifyDhCleanUp (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
if (mDh1 != NULL) {
|
||||
DhFree (mDh1);
|
||||
mDh1 = NULL;
|
||||
}
|
||||
if (mDh2 != NULL) {
|
||||
DhFree (mDh2);
|
||||
mDh2 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyDhGenerateKey (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINT8 Prime[64];
|
||||
UINT8 PublicKey1[64];
|
||||
UINTN PublicKey1Length;
|
||||
UINT8 PublicKey2[64];
|
||||
UINTN PublicKey2Length;
|
||||
UINT8 Key1[64];
|
||||
UINTN Key1Length;
|
||||
UINT8 Key2[64];
|
||||
UINTN Key2Length;
|
||||
BOOLEAN Status;
|
||||
|
||||
//
|
||||
// Initialize Key Length
|
||||
//
|
||||
PublicKey1Length = sizeof (PublicKey1);
|
||||
PublicKey2Length = sizeof (PublicKey2);
|
||||
Key1Length = sizeof (Key1);
|
||||
Key2Length = sizeof (Key2);
|
||||
|
||||
Status = DhGenerateParameter (mDh1, 2, 64, Prime);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = DhSetParameter (mDh2, 2, 64, Prime);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = DhGenerateKey (mDh1, PublicKey1, &PublicKey1Length);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = DhGenerateKey (mDh2, PublicKey2, &PublicKey2Length);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = DhComputeKey (mDh1, PublicKey2, PublicKey2Length, Key1, &Key1Length);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = DhComputeKey (mDh2, PublicKey1, PublicKey1Length, Key2, &Key2Length);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
UT_ASSERT_EQUAL (Key1Length, Key2Length);
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (Key1, Key2, Key1Length);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mDhTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------Class---------------------Function----------------Pre-----------------Post------------Context
|
||||
//
|
||||
{"TestVerifyDhGenerateKey()", "CryptoPkg.BaseCryptLib.Dh", TestVerifyDhGenerateKey, TestVerifyDhPreReq, TestVerifyDhCleanUp, NULL},
|
||||
};
|
||||
|
||||
UINTN mDhTestNum = ARRAY_SIZE(mDhTest);
|
202
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
Normal file
202
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
Normal file
@ -0,0 +1,202 @@
|
||||
/** @file
|
||||
Application for Hash Primitives Validation.
|
||||
|
||||
Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
//
|
||||
// Max Known Digest Size is SHA512 Output (64 bytes) by far
|
||||
//
|
||||
#define MAX_DIGEST_SIZE 64
|
||||
|
||||
//
|
||||
// Message string for digest validation
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *HashData = "abc";
|
||||
|
||||
//
|
||||
// Result for MD5("abc"). (From "A.5 Test suite" of IETF RFC1321)
|
||||
//
|
||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Md5Digest[MD5_DIGEST_SIZE] = {
|
||||
0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Result for SHA-1("abc"). (From "A.1 SHA-1 Example" of NIST FIPS 180-2)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha1Digest[SHA1_DIGEST_SIZE] = {
|
||||
0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c,
|
||||
0x9c, 0xd0, 0xd8, 0x9d
|
||||
};
|
||||
|
||||
//
|
||||
// Result for SHA-256("abc"). (From "B.1 SHA-256 Example" of NIST FIPS 180-2)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha256Digest[SHA256_DIGEST_SIZE] = {
|
||||
0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
|
||||
0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad
|
||||
};
|
||||
|
||||
//
|
||||
// Result for SHA-384("abc"). (From "D.1 SHA-384 Example" of NIST FIPS 180-2)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha384Digest[SHA384_DIGEST_SIZE] = {
|
||||
0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
|
||||
0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
|
||||
0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7
|
||||
};
|
||||
|
||||
//
|
||||
// Result for SHA-512("abc"). (From "C.1 SHA-512 Example" of NIST FIPS 180-2)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha512Digest[SHA512_DIGEST_SIZE] = {
|
||||
0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
|
||||
0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
|
||||
0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
|
||||
0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f
|
||||
};
|
||||
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *EFI_HASH_GET_CONTEXT_SIZE) (
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HASH_INIT) (
|
||||
OUT VOID *HashContext
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HASH_UPDATE) (
|
||||
IN OUT VOID *HashContext,
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HASH_FINAL) (
|
||||
IN OUT VOID *HashContext,
|
||||
OUT UINT8 *HashValue
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HASH_ALL) (
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize,
|
||||
OUT UINT8 *HashValue
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT32 DigestSize;
|
||||
EFI_HASH_GET_CONTEXT_SIZE GetContextSize;
|
||||
EFI_HASH_INIT HashInit;
|
||||
EFI_HASH_UPDATE HashUpdate;
|
||||
EFI_HASH_FINAL HashFinal;
|
||||
EFI_HASH_ALL HashAll;
|
||||
CONST UINT8 *Digest;
|
||||
VOID *HashCtx;
|
||||
} HASH_TEST_CONTEXT;
|
||||
|
||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
HASH_TEST_CONTEXT mMd5TestCtx = {MD5_DIGEST_SIZE, Md5GetContextSize, Md5Init, Md5Update, Md5Final, Md5HashAll, Md5Digest};
|
||||
#endif
|
||||
HASH_TEST_CONTEXT mSha1TestCtx = {SHA1_DIGEST_SIZE, Sha1GetContextSize, Sha1Init, Sha1Update, Sha1Final, Sha1HashAll, Sha1Digest};
|
||||
HASH_TEST_CONTEXT mSha256TestCtx = {SHA256_DIGEST_SIZE, Sha256GetContextSize, Sha256Init, Sha256Update, Sha256Final, Sha256HashAll, Sha256Digest};
|
||||
HASH_TEST_CONTEXT mSha384TestCtx = {SHA384_DIGEST_SIZE, Sha384GetContextSize, Sha384Init, Sha384Update, Sha384Final, Sha384HashAll, Sha384Digest};
|
||||
HASH_TEST_CONTEXT mSha512TestCtx = {SHA512_DIGEST_SIZE, Sha512GetContextSize, Sha512Init, Sha512Update, Sha512Final, Sha512HashAll, Sha512Digest};
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyHashPreReq (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
HASH_TEST_CONTEXT *HashTestContext;
|
||||
UINTN CtxSize;
|
||||
|
||||
HashTestContext = Context;
|
||||
CtxSize = HashTestContext->GetContextSize ();
|
||||
HashTestContext->HashCtx = AllocatePool (CtxSize);
|
||||
if (HashTestContext->HashCtx == NULL) {
|
||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
TestVerifyHashCleanUp (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
HASH_TEST_CONTEXT *HashTestContext;
|
||||
|
||||
HashTestContext = Context;
|
||||
if (HashTestContext->HashCtx != NULL) {
|
||||
FreePool (HashTestContext->HashCtx);
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyHash (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINTN DataSize;
|
||||
UINT8 Digest[MAX_DIGEST_SIZE];
|
||||
BOOLEAN Status;
|
||||
HASH_TEST_CONTEXT *HashTestContext;
|
||||
|
||||
HashTestContext = Context;
|
||||
|
||||
DataSize = AsciiStrLen (HashData);
|
||||
|
||||
ZeroMem (Digest, MAX_DIGEST_SIZE);
|
||||
|
||||
Status = HashTestContext->HashInit (HashTestContext->HashCtx);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = HashTestContext->HashUpdate (HashTestContext->HashCtx, HashData, DataSize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = HashTestContext->HashFinal (HashTestContext->HashCtx, Digest);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (Digest, HashTestContext->Digest, HashTestContext->DigestSize);
|
||||
|
||||
ZeroMem (Digest, MAX_DIGEST_SIZE);
|
||||
Status = HashTestContext->HashAll (HashData, DataSize, Digest);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (Digest, HashTestContext->Digest, HashTestContext->DigestSize);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mHashTest[] = {
|
||||
//
|
||||
// -----Description----------------Class---------------------Function---------------Pre------------------Post------------Context
|
||||
//
|
||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||
{"TestVerifyMd5()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mMd5TestCtx},
|
||||
#endif
|
||||
{"TestVerifySha1()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha1TestCtx},
|
||||
{"TestVerifySha256()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha256TestCtx},
|
||||
{"TestVerifySha384()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha384TestCtx},
|
||||
{"TestVerifySha512()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha512TestCtx},
|
||||
};
|
||||
|
||||
UINTN mHashTestNum = ARRAY_SIZE(mHashTest);
|
184
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
Normal file
184
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
Normal file
@ -0,0 +1,184 @@
|
||||
/** @file
|
||||
Application for HMAC Primitives Validation.
|
||||
|
||||
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
//
|
||||
// Max Known Digest Size is SHA512 Output (64 bytes) by far
|
||||
//
|
||||
#define MAX_DIGEST_SIZE 64
|
||||
|
||||
//
|
||||
// Data string for HMAC validation
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *HmacData = "Hi There";
|
||||
|
||||
//
|
||||
// Key value for HMAC-MD5 validation. (From "2. Test Cases for HMAC-MD5" of IETF RFC2202)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacMd5Key[16] = {
|
||||
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b
|
||||
};
|
||||
|
||||
//
|
||||
// Result for HMAC-MD5("Hi There"). (From "2. Test Cases for HMAC-MD5" of IETF RFC2202)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacMd5Digest[] = {
|
||||
0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d
|
||||
};
|
||||
|
||||
//
|
||||
// Key value for HMAC-SHA-1 validation. (From "3. Test Cases for HMAC-SHA-1" of IETF RFC2202)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha1Key[20] = {
|
||||
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
|
||||
0x0b, 0x0b, 0x0b, 0x0b
|
||||
};
|
||||
|
||||
//
|
||||
// Result for HMAC-SHA-1 ("Hi There"). (From "3. Test Cases for HMAC-SHA-1" of IETF RFC2202)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha1Digest[] = {
|
||||
0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e,
|
||||
0xf1, 0x46, 0xbe, 0x00
|
||||
};
|
||||
|
||||
//
|
||||
// Key value for HMAC-SHA-256 validation. (From "4. Test Vectors" of IETF RFC4231)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha256Key[20] = {
|
||||
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
|
||||
0x0b, 0x0b, 0x0b, 0x0b
|
||||
};
|
||||
|
||||
//
|
||||
// Result for HMAC-SHA-256 ("Hi There"). (From "4. Test Vectors" of IETF RFC4231)
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha256Digest[] = {
|
||||
0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b,
|
||||
0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7
|
||||
};
|
||||
|
||||
typedef
|
||||
VOID*
|
||||
(EFIAPI *EFI_HMAC_NEW) (
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HMAC_INIT) (
|
||||
IN OUT VOID *HashContext,
|
||||
IN CONST UINT8 *Key,
|
||||
IN UINTN KeySize
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HMAC_UPDATE) (
|
||||
IN OUT VOID *HashContext,
|
||||
IN CONST VOID *Data,
|
||||
IN UINTN DataSize
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_HMAC_FINAL) (
|
||||
IN OUT VOID *HashContext,
|
||||
OUT UINT8 *HashValue
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT32 DigestSize;
|
||||
EFI_HMAC_NEW HmacNew;
|
||||
EFI_HMAC_INIT HmacInit;
|
||||
EFI_HMAC_UPDATE HmacUpdate;
|
||||
EFI_HMAC_FINAL HmacFinal;
|
||||
CONST UINT8 *Key;
|
||||
UINTN KeySize;
|
||||
CONST UINT8 *Digest;
|
||||
VOID *HmacCtx;
|
||||
} HMAC_TEST_CONTEXT;
|
||||
|
||||
// These functions have been deprecated but they've been left commented out for future reference
|
||||
//HMAC_TEST_CONTEXT mHmacMd5TestCtx = {MD5_DIGEST_SIZE, HmacMd5New, HmacMd5SetKey, HmacMd5Update, HmacMd5Final, HmacMd5Key, sizeof(HmacMd5Key), HmacMd5Digest};
|
||||
//HMAC_TEST_CONTEXT mHmacSha1TestCtx = {SHA1_DIGEST_SIZE, HmacSha1New, HmacSha1SetKey, HmacSha1Update, HmacSha1Final, HmacSha1Key, sizeof(HmacSha1Key), HmacSha1Digest};
|
||||
HMAC_TEST_CONTEXT mHmacSha256TestCtx = {SHA256_DIGEST_SIZE, HmacSha256New, HmacSha256SetKey, HmacSha256Update, HmacSha256Final, HmacSha256Key, sizeof(HmacSha256Key), HmacSha256Digest};
|
||||
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyHmacPreReq (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
HMAC_TEST_CONTEXT *HmacTestContext;
|
||||
|
||||
HmacTestContext = Context;
|
||||
HmacTestContext->HmacCtx = HmacTestContext->HmacNew();
|
||||
if (HmacTestContext->HmacCtx == NULL) {
|
||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
TestVerifyHmacCleanUp (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
HMAC_TEST_CONTEXT *HmacTestContext;
|
||||
|
||||
HmacTestContext = Context;
|
||||
if (HmacTestContext->HmacCtx != NULL) {
|
||||
FreePool (HmacTestContext->HmacCtx);
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyHmac (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINT8 Digest[MAX_DIGEST_SIZE];
|
||||
BOOLEAN Status;
|
||||
HMAC_TEST_CONTEXT *HmacTestContext;
|
||||
|
||||
HmacTestContext = Context;
|
||||
|
||||
ZeroMem (Digest, MAX_DIGEST_SIZE);
|
||||
|
||||
Status = HmacTestContext->HmacInit (HmacTestContext->HmacCtx, HmacTestContext->Key, HmacTestContext->KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = HmacTestContext->HmacUpdate (HmacTestContext->HmacCtx, HmacData, 8);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = HmacTestContext->HmacFinal (HmacTestContext->HmacCtx, Digest);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (Digest, HmacTestContext->Digest, HmacTestContext->DigestSize);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mHmacTest[] = {
|
||||
//
|
||||
// -----Description---------------------Class---------------------Function---------------Pre------------------Post------------Context
|
||||
//
|
||||
{"TestVerifyHmacSha256()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacSha256TestCtx},
|
||||
// These functions have been deprecated but they've been left commented out for future reference
|
||||
//{"TestVerifyHmacMd5()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacMd5TestCtx},
|
||||
//{"TestVerifyHmacSha1()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacSha1TestCtx},
|
||||
|
||||
};
|
||||
|
||||
UINTN mHmacTestNum = ARRAY_SIZE(mHmacTest);
|
308
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
Normal file
308
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
Normal file
@ -0,0 +1,308 @@
|
||||
/** @file
|
||||
This is a unit test for RSA OAEP encrypt.
|
||||
|
||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
CONST UINT8 RandSeed[] = "This is the random seed for PRNG verification.";
|
||||
|
||||
//
|
||||
// Self signed X509 certificate
|
||||
// CN = ca.self
|
||||
// O = Intel
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 SelfTestCert[] = {
|
||||
0x30, 0x82, 0x03, 0x90, 0x30, 0x82, 0x02, 0x78, 0x02, 0x09, 0x00, 0xE4, 0xDF, 0x47, 0x80, 0xEF,
|
||||
0x4B, 0x3C, 0x6D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B,
|
||||
0x05, 0x00, 0x30, 0x81, 0x89, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x43, 0x4E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x08, 0x53, 0x68, 0x61,
|
||||
0x6E, 0x67, 0x48, 0x61, 0x69, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x08,
|
||||
0x53, 0x68, 0x61, 0x6E, 0x67, 0x48, 0x61, 0x69, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0A, 0x0C, 0x05, 0x49, 0x6E, 0x74, 0x65, 0x6C, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0B, 0x0C, 0x03, 0x46, 0x49, 0x45, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x07, 0x63, 0x61, 0x2E, 0x73, 0x65, 0x6C, 0x66, 0x31, 0x24, 0x30, 0x22, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x15, 0x7A, 0x68, 0x69, 0x63, 0x68, 0x61, 0x6F,
|
||||
0x2E, 0x67, 0x61, 0x6F, 0x40, 0x69, 0x6E, 0x74, 0x65, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E,
|
||||
0x17, 0x0D, 0x31, 0x39, 0x30, 0x33, 0x32, 0x37, 0x30, 0x35, 0x35, 0x37, 0x30, 0x39, 0x5A, 0x17,
|
||||
0x0D, 0x32, 0x30, 0x30, 0x33, 0x32, 0x36, 0x30, 0x35, 0x35, 0x37, 0x30, 0x39, 0x5A, 0x30, 0x81,
|
||||
0x89, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x11,
|
||||
0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x08, 0x53, 0x68, 0x61, 0x6E, 0x67, 0x48, 0x61,
|
||||
0x69, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x08, 0x53, 0x68, 0x61, 0x6E,
|
||||
0x67, 0x48, 0x61, 0x69, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x49,
|
||||
0x6E, 0x74, 0x65, 0x6C, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x03, 0x46,
|
||||
0x49, 0x45, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x07, 0x63, 0x61, 0x2E,
|
||||
0x73, 0x65, 0x6C, 0x66, 0x31, 0x24, 0x30, 0x22, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
|
||||
0x01, 0x09, 0x01, 0x16, 0x15, 0x7A, 0x68, 0x69, 0x63, 0x68, 0x61, 0x6F, 0x2E, 0x67, 0x61, 0x6F,
|
||||
0x40, 0x69, 0x6E, 0x74, 0x65, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D,
|
||||
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,
|
||||
0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBC, 0xE4, 0x67, 0xDC, 0xC7,
|
||||
0xEA, 0x6F, 0x8A, 0xA7, 0xCC, 0xB2, 0x54, 0x47, 0x48, 0x6A, 0xE2, 0x39, 0xFF, 0xC2, 0x48, 0x58,
|
||||
0x34, 0x07, 0x03, 0x6D, 0x39, 0xB3, 0x67, 0x46, 0x4C, 0xBC, 0xA0, 0xFA, 0x4E, 0x64, 0x23, 0x56,
|
||||
0x47, 0x7B, 0xC9, 0x1A, 0x2A, 0x55, 0x42, 0x54, 0x10, 0x18, 0x30, 0x92, 0x60, 0x30, 0x5B, 0x9E,
|
||||
0xC0, 0x65, 0xD2, 0xD4, 0x05, 0x4A, 0xA6, 0x10, 0x66, 0x04, 0xA9, 0x54, 0x4E, 0xEE, 0x49, 0x39,
|
||||
0x43, 0x65, 0x1E, 0x2E, 0x28, 0xDE, 0x79, 0x24, 0xA9, 0x7E, 0xD8, 0x5B, 0xBC, 0x2F, 0x46, 0x6A,
|
||||
0xB7, 0xB6, 0x0D, 0x17, 0x88, 0x37, 0x52, 0x5C, 0xFE, 0x93, 0xC0, 0xE2, 0xFD, 0x6A, 0x08, 0x1B,
|
||||
0xFB, 0xD1, 0x87, 0xBD, 0xBD, 0x58, 0x57, 0x2C, 0x06, 0x5D, 0xD2, 0x7D, 0x52, 0xE2, 0x49, 0x8E,
|
||||
0xDC, 0xE5, 0x26, 0xBD, 0x92, 0x60, 0xB0, 0x3F, 0x58, 0x5E, 0x52, 0xD7, 0x91, 0xDA, 0x93, 0x62,
|
||||
0x8D, 0x71, 0x80, 0x53, 0xBA, 0x15, 0xC4, 0x1F, 0xF3, 0xBD, 0xE0, 0xC5, 0xA4, 0xB8, 0xD3, 0x64,
|
||||
0x12, 0x14, 0x1B, 0x11, 0x6B, 0x7B, 0xC2, 0x92, 0xC7, 0xE2, 0x94, 0x0B, 0xB8, 0x67, 0x38, 0x48,
|
||||
0x63, 0x11, 0x74, 0x25, 0x7C, 0x37, 0xC3, 0xB2, 0xAE, 0xD9, 0xA7, 0x17, 0x9C, 0x4B, 0x9D, 0x6C,
|
||||
0x27, 0xB0, 0x87, 0x16, 0x6B, 0xF2, 0x96, 0xE5, 0x1D, 0x37, 0x27, 0xDE, 0xF2, 0x98, 0xB7, 0x81,
|
||||
0x08, 0xD9, 0x7A, 0xBA, 0x84, 0x14, 0x61, 0x60, 0x48, 0xCE, 0xCE, 0x51, 0x73, 0xF4, 0xDB, 0xF1,
|
||||
0x5F, 0x7A, 0x17, 0x71, 0x4F, 0xC1, 0x0B, 0xCE, 0xC7, 0x31, 0xC1, 0x4E, 0xA3, 0xEE, 0x6F, 0x72,
|
||||
0x97, 0x90, 0xFB, 0x8B, 0x54, 0x9F, 0x82, 0x5B, 0x48, 0x5A, 0xF1, 0xAD, 0x8B, 0x3A, 0xCD, 0xCA,
|
||||
0xB2, 0x8B, 0x7A, 0x53, 0xD4, 0xF7, 0x71, 0x16, 0x75, 0xA7, 0x35, 0x02, 0x03, 0x01, 0x00, 0x01,
|
||||
0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03,
|
||||
0x82, 0x01, 0x01, 0x00, 0x78, 0x64, 0xCD, 0x6F, 0xC0, 0xF9, 0xE7, 0xAB, 0x19, 0x0B, 0xA4, 0x92,
|
||||
0x88, 0xD7, 0xE3, 0xC4, 0x9C, 0xCF, 0xF2, 0x49, 0xFC, 0xCE, 0x8C, 0xEC, 0x33, 0x3F, 0x24, 0x6F,
|
||||
0xF7, 0xBC, 0x7C, 0x28, 0xEF, 0xAE, 0xAB, 0x7B, 0xAF, 0x84, 0xE3, 0x4E, 0x38, 0xAB, 0x66, 0x20,
|
||||
0x7C, 0xB9, 0xE0, 0x37, 0xFD, 0x84, 0x28, 0x3C, 0xEE, 0x35, 0xC4, 0x75, 0x04, 0x43, 0xCA, 0x4F,
|
||||
0x36, 0x60, 0xC4, 0x06, 0x16, 0x54, 0x3C, 0xF9, 0x47, 0x78, 0xBD, 0xE9, 0x7F, 0xF1, 0xE3, 0x0B,
|
||||
0xC7, 0x7E, 0x30, 0xA4, 0xCB, 0x3A, 0xC7, 0xCD, 0x50, 0x9A, 0x6C, 0xC1, 0xE3, 0xF8, 0xF8, 0x16,
|
||||
0xAA, 0x67, 0x7F, 0x92, 0xEE, 0x1D, 0x47, 0xF2, 0x96, 0xDF, 0xD7, 0x43, 0x64, 0x78, 0xA7, 0xD9,
|
||||
0xF6, 0xA1, 0xD9, 0xEB, 0x5B, 0x2E, 0xC6, 0x9E, 0xEA, 0xD5, 0x04, 0x52, 0xA4, 0x73, 0x97, 0xC8,
|
||||
0xB3, 0xFD, 0xE1, 0x7E, 0xB1, 0xA4, 0x3F, 0xF4, 0x56, 0x66, 0x8E, 0x6B, 0xBC, 0xD8, 0xF0, 0x7C,
|
||||
0xBF, 0x58, 0xA4, 0xE0, 0x45, 0xDC, 0x2B, 0x0B, 0x2C, 0x40, 0x52, 0x4D, 0x4B, 0xA9, 0x8A, 0x77,
|
||||
0x87, 0x31, 0xF8, 0x45, 0xD9, 0x60, 0xBB, 0xAD, 0x28, 0x29, 0x14, 0x0D, 0x0D, 0x8F, 0x0F, 0x34,
|
||||
0x76, 0x88, 0xF3, 0x5A, 0x65, 0x00, 0x54, 0x22, 0x35, 0xBF, 0x3A, 0x2B, 0xE9, 0xB0, 0x24, 0xE5,
|
||||
0xBE, 0xDF, 0x08, 0xA0, 0x02, 0xB2, 0x81, 0x01, 0xE8, 0x14, 0xBE, 0x6E, 0x7E, 0xBD, 0x60, 0x0C,
|
||||
0x4A, 0xD8, 0x57, 0xA4, 0x50, 0xD3, 0xD0, 0x59, 0xCE, 0x57, 0x27, 0xE9, 0xA6, 0x16, 0x15, 0x5F,
|
||||
0xF2, 0x6C, 0xCC, 0x57, 0x36, 0x20, 0x06, 0xE6, 0xA7, 0x24, 0x22, 0xB0, 0xB1, 0xC4, 0xBC, 0x2C,
|
||||
0x5C, 0xCE, 0x92, 0x11, 0xFF, 0x6F, 0x8C, 0x14, 0x7E, 0xC4, 0x10, 0x02, 0xF6, 0x69, 0x86, 0x6D,
|
||||
0x5B, 0x64, 0x81, 0x13,
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 PrivateKey[] = {
|
||||
0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBC, 0xE4, 0x67, 0xDC,
|
||||
0xC7, 0xEA, 0x6F, 0x8A, 0xA7, 0xCC, 0xB2, 0x54, 0x47, 0x48, 0x6A, 0xE2, 0x39, 0xFF, 0xC2, 0x48,
|
||||
0x58, 0x34, 0x07, 0x03, 0x6D, 0x39, 0xB3, 0x67, 0x46, 0x4C, 0xBC, 0xA0, 0xFA, 0x4E, 0x64, 0x23,
|
||||
0x56, 0x47, 0x7B, 0xC9, 0x1A, 0x2A, 0x55, 0x42, 0x54, 0x10, 0x18, 0x30, 0x92, 0x60, 0x30, 0x5B,
|
||||
0x9E, 0xC0, 0x65, 0xD2, 0xD4, 0x05, 0x4A, 0xA6, 0x10, 0x66, 0x04, 0xA9, 0x54, 0x4E, 0xEE, 0x49,
|
||||
0x39, 0x43, 0x65, 0x1E, 0x2E, 0x28, 0xDE, 0x79, 0x24, 0xA9, 0x7E, 0xD8, 0x5B, 0xBC, 0x2F, 0x46,
|
||||
0x6A, 0xB7, 0xB6, 0x0D, 0x17, 0x88, 0x37, 0x52, 0x5C, 0xFE, 0x93, 0xC0, 0xE2, 0xFD, 0x6A, 0x08,
|
||||
0x1B, 0xFB, 0xD1, 0x87, 0xBD, 0xBD, 0x58, 0x57, 0x2C, 0x06, 0x5D, 0xD2, 0x7D, 0x52, 0xE2, 0x49,
|
||||
0x8E, 0xDC, 0xE5, 0x26, 0xBD, 0x92, 0x60, 0xB0, 0x3F, 0x58, 0x5E, 0x52, 0xD7, 0x91, 0xDA, 0x93,
|
||||
0x62, 0x8D, 0x71, 0x80, 0x53, 0xBA, 0x15, 0xC4, 0x1F, 0xF3, 0xBD, 0xE0, 0xC5, 0xA4, 0xB8, 0xD3,
|
||||
0x64, 0x12, 0x14, 0x1B, 0x11, 0x6B, 0x7B, 0xC2, 0x92, 0xC7, 0xE2, 0x94, 0x0B, 0xB8, 0x67, 0x38,
|
||||
0x48, 0x63, 0x11, 0x74, 0x25, 0x7C, 0x37, 0xC3, 0xB2, 0xAE, 0xD9, 0xA7, 0x17, 0x9C, 0x4B, 0x9D,
|
||||
0x6C, 0x27, 0xB0, 0x87, 0x16, 0x6B, 0xF2, 0x96, 0xE5, 0x1D, 0x37, 0x27, 0xDE, 0xF2, 0x98, 0xB7,
|
||||
0x81, 0x08, 0xD9, 0x7A, 0xBA, 0x84, 0x14, 0x61, 0x60, 0x48, 0xCE, 0xCE, 0x51, 0x73, 0xF4, 0xDB,
|
||||
0xF1, 0x5F, 0x7A, 0x17, 0x71, 0x4F, 0xC1, 0x0B, 0xCE, 0xC7, 0x31, 0xC1, 0x4E, 0xA3, 0xEE, 0x6F,
|
||||
0x72, 0x97, 0x90, 0xFB, 0x8B, 0x54, 0x9F, 0x82, 0x5B, 0x48, 0x5A, 0xF1, 0xAD, 0x8B, 0x3A, 0xCD,
|
||||
0xCA, 0xB2, 0x8B, 0x7A, 0x53, 0xD4, 0xF7, 0x71, 0x16, 0x75, 0xA7, 0x35, 0x02, 0x03, 0x01, 0x00,
|
||||
0x01, 0x02, 0x82, 0x01, 0x00, 0x13, 0xF7, 0xD1, 0x42, 0xF5, 0x9F, 0x42, 0xCB, 0x55, 0x91, 0xBE,
|
||||
0x08, 0x4A, 0xC0, 0xCD, 0x0B, 0xBD, 0x35, 0xDC, 0x43, 0xE9, 0x8F, 0x16, 0x6E, 0xB6, 0x4D, 0x33,
|
||||
0x39, 0xE7, 0xA4, 0x95, 0x0C, 0x2F, 0x69, 0xBA, 0x0C, 0x42, 0x42, 0xAC, 0x43, 0x46, 0x10, 0xD3,
|
||||
0x92, 0x7F, 0x70, 0x74, 0x1E, 0x2E, 0x5B, 0x1C, 0xC1, 0x92, 0xB6, 0xA4, 0x0C, 0xF5, 0x7C, 0xD9,
|
||||
0xB7, 0x54, 0x64, 0x74, 0x79, 0xB1, 0xFF, 0xE6, 0x10, 0xB7, 0x8C, 0xF8, 0x53, 0x88, 0x6D, 0xA9,
|
||||
0x97, 0x04, 0xD9, 0x26, 0x1F, 0x99, 0x12, 0xFB, 0xAC, 0x65, 0xFB, 0xA5, 0xB3, 0x1C, 0x99, 0xB9,
|
||||
0xBF, 0x6B, 0x35, 0x3E, 0x49, 0x55, 0xB5, 0x94, 0x4F, 0xE7, 0x25, 0x67, 0xB1, 0x01, 0xCD, 0xD2,
|
||||
0x58, 0xE4, 0xBE, 0x87, 0x8C, 0x88, 0xD3, 0x0A, 0x38, 0xDC, 0x71, 0x5D, 0x88, 0x0A, 0xE2, 0x3E,
|
||||
0x76, 0x63, 0x3B, 0xE4, 0x3C, 0x8F, 0x2F, 0x29, 0x1D, 0xD1, 0x66, 0x8D, 0xC0, 0x4A, 0x68, 0x15,
|
||||
0x90, 0x4C, 0x95, 0x61, 0xF4, 0xFD, 0xE8, 0xFA, 0x9C, 0x6C, 0x00, 0x22, 0x23, 0xD5, 0x17, 0x6E,
|
||||
0xEE, 0xA8, 0xD8, 0x70, 0xC5, 0x74, 0xEA, 0x09, 0x13, 0x7F, 0x0C, 0x37, 0x4D, 0x50, 0xCD, 0xE9,
|
||||
0x16, 0xC2, 0xD5, 0xDE, 0x5E, 0xC3, 0xFC, 0x46, 0x08, 0xF1, 0x99, 0xC0, 0xB4, 0x28, 0xFD, 0x2B,
|
||||
0x29, 0xEF, 0x76, 0xD7, 0x04, 0x4F, 0x02, 0x54, 0x16, 0x54, 0x55, 0x20, 0xEC, 0xBC, 0xBF, 0x85,
|
||||
0x5F, 0x12, 0xCC, 0xFC, 0x0D, 0xF2, 0xEF, 0xFC, 0x4D, 0x3E, 0xA2, 0x5E, 0x97, 0xFE, 0x35, 0x10,
|
||||
0x0F, 0x53, 0x1F, 0x80, 0xD5, 0xC0, 0xB4, 0xE9, 0xE9, 0x31, 0x4C, 0x89, 0x14, 0x72, 0x39, 0x65,
|
||||
0x89, 0xEF, 0x7A, 0x51, 0x4A, 0xB9, 0xA9, 0xCC, 0x1B, 0x52, 0xB0, 0x02, 0x52, 0x65, 0x2F, 0x0B,
|
||||
0x89, 0x41, 0x70, 0x1E, 0x01, 0x02, 0x81, 0x81, 0x00, 0xDB, 0xE8, 0x21, 0x9E, 0xDB, 0x58, 0x42,
|
||||
0x0B, 0x02, 0x35, 0x87, 0xDF, 0x35, 0xF4, 0xC1, 0xEE, 0xD5, 0x72, 0x2C, 0xDC, 0x4D, 0xC7, 0xDA,
|
||||
0x6D, 0x18, 0x0F, 0x68, 0x6F, 0xE7, 0xB0, 0x6C, 0xA0, 0xB2, 0x9E, 0xB8, 0x5E, 0x4A, 0x86, 0x81,
|
||||
0x97, 0xBD, 0x78, 0xFC, 0x06, 0xD5, 0xBE, 0x98, 0x42, 0x38, 0x78, 0x78, 0x16, 0xAE, 0x39, 0x56,
|
||||
0xFB, 0x67, 0x6B, 0xED, 0x7F, 0xB3, 0xC3, 0x7D, 0x95, 0x86, 0x05, 0x0C, 0xF1, 0x4C, 0xC2, 0x67,
|
||||
0x94, 0x93, 0x1B, 0xB7, 0x91, 0x0A, 0x80, 0xE2, 0x85, 0xA7, 0x75, 0x20, 0x61, 0xCD, 0x40, 0x5B,
|
||||
0x39, 0x13, 0x32, 0xF7, 0xB8, 0xD7, 0x0C, 0x39, 0x4C, 0x82, 0x4B, 0xA3, 0x9F, 0x5E, 0xB1, 0xB0,
|
||||
0x38, 0x81, 0x8B, 0x1E, 0xBD, 0x2B, 0xC2, 0x9F, 0x3A, 0x68, 0x72, 0xC2, 0x90, 0xCB, 0xA2, 0xE2,
|
||||
0xAC, 0x86, 0xFF, 0xC8, 0xD7, 0xB8, 0x97, 0x0E, 0x69, 0x02, 0x81, 0x81, 0x00, 0xDB, 0xE5, 0x21,
|
||||
0x1F, 0x4C, 0x83, 0xD9, 0x7A, 0x56, 0x87, 0x82, 0xF1, 0x40, 0x1A, 0xD3, 0x5B, 0xC5, 0xB4, 0x4D,
|
||||
0x18, 0x8A, 0xE3, 0x6B, 0xC9, 0x7E, 0x8F, 0x5D, 0x00, 0x33, 0x66, 0xEB, 0xAE, 0x8E, 0x54, 0x49,
|
||||
0xD7, 0xEA, 0xF3, 0xF9, 0xED, 0xD7, 0xEE, 0x2C, 0xC8, 0xD6, 0x8F, 0x40, 0x0A, 0x53, 0xCB, 0x5D,
|
||||
0x16, 0xB7, 0xEB, 0x4E, 0xFB, 0x11, 0x18, 0x1B, 0x4B, 0x6B, 0x43, 0x04, 0xD6, 0x1D, 0x8F, 0x6D,
|
||||
0x4D, 0x48, 0x8B, 0x6C, 0x82, 0x52, 0xB4, 0x8D, 0x58, 0x9B, 0x19, 0x8D, 0xE0, 0x0D, 0xFD, 0x15,
|
||||
0x9D, 0x35, 0xDF, 0x5E, 0xED, 0xDB, 0x8F, 0x8C, 0x44, 0x11, 0xC9, 0x9A, 0xD9, 0x3F, 0xD4, 0xA5,
|
||||
0xEE, 0x68, 0x3B, 0x38, 0xD1, 0x66, 0xB0, 0x62, 0x7E, 0xA5, 0x04, 0xD1, 0x67, 0xA4, 0x1D, 0x93,
|
||||
0xD6, 0x2A, 0xFB, 0xF6, 0xC1, 0xB2, 0xC4, 0x02, 0x8A, 0xB2, 0xA8, 0xD0, 0xED, 0x02, 0x81, 0x81,
|
||||
0x00, 0xD1, 0x1D, 0x98, 0x43, 0x09, 0x10, 0x8F, 0x95, 0x0A, 0x5F, 0xBF, 0x3A, 0x1A, 0x84, 0x0A,
|
||||
0x9B, 0x44, 0x6C, 0x53, 0x8E, 0x97, 0x84, 0x72, 0x08, 0x85, 0xF5, 0xB8, 0xF9, 0x99, 0x58, 0x22,
|
||||
0xA4, 0x59, 0xD7, 0x27, 0x39, 0xBB, 0x22, 0xD7, 0x3F, 0x65, 0x95, 0x14, 0x0C, 0xA7, 0xDB, 0x9B,
|
||||
0xCC, 0x75, 0x08, 0xD2, 0x21, 0xB7, 0x41, 0x9D, 0x9E, 0x6A, 0x85, 0xAE, 0x8E, 0x5E, 0x72, 0x8B,
|
||||
0x0C, 0xD2, 0x2A, 0x21, 0x59, 0xA1, 0x05, 0xC9, 0x1B, 0xF7, 0x1C, 0x47, 0x5E, 0x6C, 0x9F, 0x8D,
|
||||
0x49, 0x4D, 0xA9, 0xCA, 0xC6, 0x56, 0x39, 0x59, 0xC6, 0x17, 0xA4, 0xC2, 0xFF, 0x09, 0xB8, 0x7D,
|
||||
0x10, 0x6D, 0x62, 0xE2, 0x50, 0x9D, 0xEA, 0xD8, 0xC9, 0x93, 0x1E, 0xA9, 0x77, 0x78, 0x92, 0x95,
|
||||
0x7A, 0x24, 0x72, 0xE4, 0xE4, 0x6E, 0x51, 0x11, 0xBE, 0xC0, 0x8D, 0xA1, 0xFE, 0xC9, 0x71, 0x13,
|
||||
0xE9, 0x02, 0x81, 0x80, 0x38, 0xE5, 0x3F, 0x3D, 0xB6, 0xF1, 0x82, 0x8A, 0xD9, 0xEA, 0xB4, 0x21,
|
||||
0xB1, 0xE1, 0x7F, 0x00, 0x86, 0xD6, 0x11, 0x00, 0xA1, 0xA7, 0x18, 0x53, 0x89, 0x50, 0x94, 0xD2,
|
||||
0xA1, 0x7A, 0x26, 0xCF, 0x02, 0x7A, 0xA2, 0xA4, 0xA0, 0x61, 0x42, 0x30, 0x9D, 0x27, 0x3E, 0x25,
|
||||
0x35, 0x06, 0xD9, 0x9E, 0x12, 0x72, 0x53, 0x02, 0xB6, 0xD1, 0xC6, 0x9C, 0xC5, 0x9E, 0x84, 0x29,
|
||||
0x6E, 0x76, 0x67, 0xC0, 0xF2, 0xE3, 0x12, 0x77, 0xE5, 0xA6, 0x55, 0x8C, 0x1E, 0xD4, 0x22, 0xA2,
|
||||
0x63, 0x77, 0x28, 0x33, 0x69, 0xCB, 0x2B, 0x15, 0x83, 0x43, 0xE9, 0x6F, 0x07, 0xD9, 0x4B, 0x84,
|
||||
0xAD, 0x49, 0x89, 0xAC, 0x5E, 0x8C, 0xA9, 0xE6, 0x56, 0xC7, 0xC3, 0xFA, 0xC2, 0x64, 0x2F, 0x07,
|
||||
0xEF, 0xB0, 0xA0, 0x71, 0xFD, 0x8F, 0xBD, 0x99, 0xB3, 0x83, 0x80, 0x24, 0x3C, 0x19, 0xE5, 0x42,
|
||||
0x77, 0xD9, 0xA0, 0x3D, 0x02, 0x81, 0x81, 0x00, 0xB7, 0x35, 0xE9, 0x66, 0x4A, 0xCD, 0x5F, 0x5C,
|
||||
0x44, 0x9A, 0x7F, 0x23, 0xAE, 0xC2, 0x7F, 0xF0, 0x8D, 0xE4, 0xDB, 0xCD, 0x1A, 0x8A, 0x40, 0xD7,
|
||||
0x0A, 0xC4, 0x3E, 0xC5, 0x03, 0xFB, 0x47, 0xAB, 0x72, 0xDF, 0xD7, 0x68, 0x27, 0x6E, 0x86, 0x94,
|
||||
0x2A, 0x2A, 0xDA, 0x25, 0x9E, 0xF6, 0x5E, 0xE0, 0x6D, 0x7C, 0x7D, 0xFE, 0x72, 0xDD, 0xC7, 0xBC,
|
||||
0x74, 0xC7, 0xAD, 0xEA, 0x44, 0xBE, 0x5C, 0x8A, 0x03, 0xCD, 0x35, 0x74, 0x6F, 0x4E, 0x92, 0x31,
|
||||
0xBE, 0x57, 0x9A, 0x02, 0x0C, 0xFC, 0xD1, 0xD5, 0xE7, 0x3E, 0x53, 0x0C, 0x47, 0x12, 0x39, 0x45,
|
||||
0x6E, 0x35, 0x24, 0xA6, 0xDA, 0x42, 0x63, 0xC6, 0xBF, 0xCA, 0xE8, 0x32, 0xFD, 0x61, 0xC0, 0x80,
|
||||
0x39, 0xD2, 0xB7, 0x0D, 0xF3, 0xA2, 0xF3, 0xE4, 0x49, 0x26, 0x89, 0xD0, 0xA0, 0x24, 0xC8, 0x27,
|
||||
0x86, 0x10, 0x09, 0x88, 0x6C, 0x35, 0x60, 0xF2,
|
||||
};
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyOaepEncrypt (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
UINT8 File[4];
|
||||
UINT8 *OutBuffer;
|
||||
UINTN OutBufferSize;
|
||||
UINT8 *OutBuffer2;
|
||||
UINTN OutBuffer2Size;
|
||||
|
||||
// Create a file and add content '123' in it
|
||||
File[0] = '1';
|
||||
File[1] = '2';
|
||||
File[2] = '3';
|
||||
File[3] = 0;
|
||||
|
||||
OutBuffer = NULL;
|
||||
OutBufferSize = 0;
|
||||
OutBuffer2 = NULL;
|
||||
OutBuffer2Size = 0;
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
SelfTestCert,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)sizeof (File),
|
||||
NULL,
|
||||
0,
|
||||
&OutBuffer,
|
||||
(UINTN *)&OutBufferSize
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
SelfTestCert,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)4,
|
||||
NULL,
|
||||
0,
|
||||
&OutBuffer2,
|
||||
(UINTN *)&OutBuffer2Size
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
// TRUE - the two OutBuffers are indentical. That means the Oaep encrypt result is incorrect.
|
||||
Status = (CompareMem (OutBuffer, OutBuffer2, OutBufferSize >= OutBuffer2Size ? OutBufferSize : OutBuffer2Size) == 0);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
if (OutBuffer) {
|
||||
FreePool (OutBuffer);
|
||||
OutBuffer = NULL;
|
||||
OutBufferSize = 0;
|
||||
}
|
||||
|
||||
if (OutBuffer2) {
|
||||
FreePool (OutBuffer2);
|
||||
OutBuffer2 = NULL;
|
||||
OutBuffer2Size = 0;
|
||||
}
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
SelfTestCert,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)4,
|
||||
RandSeed,
|
||||
(UINTN)sizeof (RandSeed),
|
||||
&OutBuffer,
|
||||
(UINTN *)&OutBufferSize
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
SelfTestCert,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)4,
|
||||
RandSeed,
|
||||
(UINTN)sizeof (RandSeed),
|
||||
&OutBuffer2,
|
||||
(UINTN *)&OutBuffer2Size
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
// TRUE - the two OutBuffers are indentical. That means the Oaep encrypt result is incorrect.
|
||||
Status = (CompareMem (OutBuffer, OutBuffer2, OutBufferSize >= OutBuffer2Size ? OutBufferSize : OutBuffer2Size) == 0);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
if (OutBuffer) {
|
||||
FreePool (OutBuffer);
|
||||
OutBuffer = NULL;
|
||||
OutBufferSize = 0;
|
||||
}
|
||||
|
||||
if (OutBuffer2) {
|
||||
FreePool (OutBuffer2);
|
||||
OutBuffer2 = NULL;
|
||||
OutBuffer2Size = 0;
|
||||
}
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
NULL,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)4,
|
||||
NULL,
|
||||
0,
|
||||
&OutBuffer,
|
||||
(UINTN *)&OutBufferSize
|
||||
);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
SelfTestCert,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)4,
|
||||
NULL,
|
||||
0,
|
||||
(UINT8 **)NULL,
|
||||
(UINTN *)&OutBufferSize
|
||||
);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
Status = Pkcs1v2Encrypt (
|
||||
SelfTestCert,
|
||||
(UINTN)sizeof (SelfTestCert),
|
||||
File,
|
||||
(UINTN)4,
|
||||
NULL,
|
||||
0,
|
||||
&OutBuffer,
|
||||
(UINTN *)NULL
|
||||
);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mOaepTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyOaepEncrypt()", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt", TestVerifyOaepEncrypt, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mOaepTestNum = ARRAY_SIZE(mOaepTest);
|
||||
|
||||
|
@ -0,0 +1,71 @@
|
||||
/** @file
|
||||
Application for PKCS#5 PBKDF2 Function Validation.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
//
|
||||
// PBKDF2 HMAC-SHA1 Test Vector from RFC6070
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Password = "password"; // Input Password
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINTN PassLen = 8; // Length of Input Password
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Salt = "salt"; // Input Salt
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINTN SaltLen = 4; // Length of Input Salt
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN Count = 2; // InterationCount
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN KeyLen = 20; // Length of derived key
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DerivedKey[] = { // Expected output key
|
||||
0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c, 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0,
|
||||
0xd8, 0xde, 0x89, 0x57
|
||||
};
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyPkcs5Pbkdf2 (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
UINT8 *OutKey;
|
||||
|
||||
OutKey = AllocatePool (KeyLen);
|
||||
|
||||
//
|
||||
// Verify PKCS#5 PBKDF2 Key Derivation Function
|
||||
//
|
||||
Status = Pkcs5HashPassword (
|
||||
PassLen,
|
||||
Password,
|
||||
SaltLen,
|
||||
(CONST UINT8 *)Salt,
|
||||
Count,
|
||||
SHA1_DIGEST_SIZE,
|
||||
KeyLen,
|
||||
OutKey
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Check the output key with the expected key result
|
||||
//
|
||||
UT_ASSERT_MEM_EQUAL (OutKey, DerivedKey, KeyLen);
|
||||
|
||||
//
|
||||
// Release Resources
|
||||
//
|
||||
FreePool (OutKey);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
TEST_DESC mPkcs5Test[] = {
|
||||
//
|
||||
// -----Description------------------------------Class----------------------Function-----------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyPkcs5Pbkdf2()", "CryptoPkg.BaseCryptLib.Pkcs5", TestVerifyPkcs5Pbkdf2, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mPkcs5TestNum = ARRAY_SIZE(mPkcs5Test);
|
@ -0,0 +1,789 @@
|
||||
/*++
|
||||
|
||||
Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Module Name:
|
||||
AllTestSignatures.h
|
||||
|
||||
Abstract:
|
||||
This file has test signatures in byte array format for Unit-Testing the
|
||||
Enhanced Key Usage (EKU) parsing function.
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VerifyEKUsInPkcs7Signature (
|
||||
IN CONST UINT8 *Pkcs7Signature,
|
||||
IN CONST UINT32 SignatureSize,
|
||||
IN CONST CHAR8 *RequiredEKUs[],
|
||||
IN CONST UINT32 RequiredEKUsSize,
|
||||
IN BOOLEAN RequireAllPresent
|
||||
);
|
||||
|
||||
Note: These byte arrays were created by running BinToH.exe on the P7B
|
||||
signature files.
|
||||
--*/
|
||||
|
||||
|
||||
//
|
||||
// This is the ProductionECCSignature.p7b in byte array format. It has one
|
||||
// EKU in it. (Firmware signing)
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
//
|
||||
CONST UINT8 ProductionECCSignature[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0xC0, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x03, 0x80, 0x30, 0x82, 0x03, 0x7C, 0x30, 0x82, 0x03,
|
||||
0x22, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x13, 0x33, 0x00, 0x00, 0x00, 0x03, 0x7E, 0x2E, 0x8F,
|
||||
0xBD, 0xA5, 0xC9, 0x2C, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x0A, 0x06, 0x08, 0x2A,
|
||||
0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x8F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
|
||||
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
|
||||
0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
|
||||
0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E,
|
||||
0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
|
||||
0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x39,
|
||||
0x30, 0x37, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x30, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
|
||||
0x66, 0x74, 0x20, 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72,
|
||||
0x65, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x38, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30,
|
||||
0x37, 0x31, 0x32, 0x31, 0x38, 0x33, 0x37, 0x30, 0x37, 0x5A, 0x17, 0x0D, 0x31, 0x39, 0x30, 0x37,
|
||||
0x31, 0x32, 0x31, 0x38, 0x33, 0x37, 0x30, 0x37, 0x5A, 0x30, 0x3A, 0x31, 0x38, 0x30, 0x36, 0x06,
|
||||
0x03, 0x55, 0x04, 0x03, 0x13, 0x2F, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20,
|
||||
0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x20, 0x53,
|
||||
0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
|
||||
0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04,
|
||||
0x7D, 0xDF, 0xDE, 0xFA, 0xEE, 0xA5, 0x66, 0x33, 0xAA, 0xCC, 0xA4, 0x18, 0x65, 0x9E, 0x3A, 0xC6,
|
||||
0x4B, 0xCB, 0xD5, 0x78, 0x94, 0x14, 0xEE, 0xAA, 0xF3, 0x9D, 0xCB, 0x38, 0x6C, 0x5D, 0xFE, 0x3F,
|
||||
0x8A, 0xA9, 0x8D, 0x04, 0xD2, 0xFE, 0xAA, 0x38, 0xF3, 0xD6, 0x4A, 0x7E, 0xCF, 0x12, 0x95, 0xCF,
|
||||
0xAD, 0x92, 0x33, 0xF7, 0x38, 0x83, 0xC5, 0xFD, 0xCF, 0xD0, 0x96, 0x08, 0xCA, 0x62, 0x7D, 0x22,
|
||||
0xA3, 0x82, 0x01, 0xAF, 0x30, 0x82, 0x01, 0xAB, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01,
|
||||
0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04,
|
||||
0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09, 0x15, 0x01,
|
||||
0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1D,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xE7, 0xD1, 0xD4, 0x74, 0x71, 0xF4, 0xC9,
|
||||
0x35, 0x04, 0xA7, 0x9A, 0x1E, 0x0C, 0xDD, 0xF4, 0x8D, 0x5C, 0x1E, 0xF2, 0x29, 0x30, 0x37, 0x06,
|
||||
0x03, 0x55, 0x1D, 0x11, 0x04, 0x30, 0x30, 0x2E, 0xA4, 0x2C, 0x30, 0x2A, 0x31, 0x10, 0x30, 0x0E,
|
||||
0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x07, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x31, 0x16,
|
||||
0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x05, 0x13, 0x0D, 0x34, 0x34, 0x30, 0x38, 0x31, 0x31, 0x2B,
|
||||
0x34, 0x34, 0x30, 0x38, 0x36, 0x32, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30,
|
||||
0x16, 0x80, 0x14, 0x6F, 0x3A, 0xCC, 0x1B, 0x2F, 0x17, 0x5C, 0xED, 0xEB, 0xC8, 0xBF, 0x93, 0xA7,
|
||||
0xB5, 0x93, 0xD1, 0x4D, 0x40, 0xAA, 0x03, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x6E,
|
||||
0x30, 0x6C, 0x30, 0x6A, 0xA0, 0x68, 0xA0, 0x66, 0x86, 0x64, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F,
|
||||
0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63,
|
||||
0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x6F, 0x70, 0x73, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x4D, 0x69,
|
||||
0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x25, 0x32, 0x30, 0x45, 0x43, 0x43, 0x25, 0x32, 0x30,
|
||||
0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x25, 0x32, 0x30, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x6F, 0x72, 0x79, 0x25, 0x32, 0x30, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x25, 0x32,
|
||||
0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x30, 0x31, 0x38, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x81,
|
||||
0x82, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x76, 0x30, 0x74, 0x30,
|
||||
0x72, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x66, 0x68, 0x74, 0x74,
|
||||
0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
|
||||
0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x6F, 0x70, 0x73, 0x2F, 0x63, 0x65, 0x72,
|
||||
0x74, 0x73, 0x2F, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x25, 0x32, 0x30, 0x45,
|
||||
0x43, 0x43, 0x25, 0x32, 0x30, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x25, 0x32, 0x30, 0x41,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x25, 0x32, 0x30, 0x46, 0x69, 0x72, 0x6D, 0x77,
|
||||
0x61, 0x72, 0x65, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x30, 0x31, 0x38, 0x2E,
|
||||
0x63, 0x72, 0x74, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03,
|
||||
0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x3D, 0xCF, 0xEF, 0xB8, 0xF0, 0x87, 0xEE, 0x7E, 0x80, 0x71,
|
||||
0x04, 0x77, 0x68, 0xDC, 0x66, 0x2F, 0x09, 0xA7, 0xF0, 0x76, 0x57, 0x7C, 0x12, 0x5A, 0xE4, 0x80,
|
||||
0x5A, 0xA0, 0xF2, 0x2C, 0x45, 0x1B, 0x02, 0x21, 0x00, 0xEB, 0x5F, 0x89, 0xD5, 0xEB, 0x03, 0x46,
|
||||
0x9E, 0x08, 0x95, 0x2A, 0x39, 0x30, 0x5D, 0x49, 0xB6, 0x24, 0xCE, 0x78, 0x1B, 0xB8, 0x1D, 0x0F,
|
||||
0xD1, 0x24, 0xD0, 0xA9, 0x18, 0x0F, 0x45, 0x4F, 0xF6, 0x31, 0x82, 0x01, 0x17, 0x30, 0x82, 0x01,
|
||||
0x13, 0x02, 0x01, 0x01, 0x30, 0x81, 0xA7, 0x30, 0x81, 0x8F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
|
||||
0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
|
||||
0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
|
||||
0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E,
|
||||
0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
|
||||
0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x39,
|
||||
0x30, 0x37, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x30, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
|
||||
0x66, 0x74, 0x20, 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72,
|
||||
0x65, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x38, 0x02, 0x13, 0x33, 0x00, 0x00, 0x00, 0x03,
|
||||
0x7E, 0x2E, 0x8F, 0xBD, 0xA5, 0xC9, 0x2C, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x0D,
|
||||
0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06,
|
||||
0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05, 0x00, 0x04, 0x48, 0x30, 0x46, 0x02, 0x21,
|
||||
0x00, 0x85, 0xC7, 0x25, 0x5C, 0xF8, 0x5A, 0x13, 0xB7, 0xB6, 0x3A, 0xF1, 0x04, 0x72, 0xAC, 0xB3,
|
||||
0xF8, 0xC3, 0xE0, 0xE3, 0xD7, 0x98, 0x1B, 0xCF, 0x04, 0xA8, 0x0C, 0x7B, 0xBB, 0x7D, 0x40, 0xC2,
|
||||
0x99, 0x02, 0x21, 0x00, 0xA3, 0x83, 0x12, 0xE4, 0xB6, 0x3C, 0xC9, 0x3F, 0x05, 0xCF, 0x70, 0x57,
|
||||
0x54, 0x74, 0x0E, 0xEC, 0x14, 0xAD, 0x2C, 0x66, 0x9D, 0x72, 0x73, 0x62, 0x41, 0xA6, 0xC7, 0x90,
|
||||
0x05, 0x35, 0xF5, 0x80,
|
||||
};
|
||||
|
||||
//
|
||||
// This is the TestSignedWithMultipleCerts.bin.Signature.p7b in byte array
|
||||
// format. It has two certs in it, and the leaf has an EKU of
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
//
|
||||
CONST UINT8 TestSignedMultipleCerts[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0x90, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x03, 0xC2, 0x30, 0x82, 0x01, 0xC5, 0x30, 0x82, 0x01,
|
||||
0x6A, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x16, 0x2F, 0xD8, 0x2B, 0x8A, 0x98, 0x6A, 0x8A,
|
||||
0x43, 0xC2, 0x22, 0xA5, 0x47, 0xA1, 0x18, 0xDD, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x26, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D,
|
||||
0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D,
|
||||
0x31, 0x38, 0x30, 0x37, 0x31, 0x38, 0x32, 0x33, 0x31, 0x36, 0x31, 0x32, 0x5A, 0x17, 0x0D, 0x33,
|
||||
0x38, 0x30, 0x37, 0x31, 0x38, 0x32, 0x33, 0x32, 0x36, 0x31, 0x32, 0x5A, 0x30, 0x28, 0x31, 0x26,
|
||||
0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1D, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65,
|
||||
0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E,
|
||||
0x65, 0x72, 0x4C, 0x65, 0x61, 0x66, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00,
|
||||
0x04, 0x2E, 0x4C, 0x85, 0xFD, 0x86, 0x85, 0x4C, 0x55, 0x96, 0x17, 0xE3, 0x0C, 0xC1, 0xCB, 0xD9,
|
||||
0x95, 0xCF, 0xC7, 0xEA, 0x57, 0x02, 0x5C, 0x4F, 0x92, 0x7C, 0x35, 0xBF, 0x2B, 0x3D, 0xBA, 0x14,
|
||||
0xE5, 0x39, 0x9D, 0x9B, 0x64, 0x4A, 0x25, 0x29, 0xD5, 0x61, 0xDA, 0xFD, 0x51, 0x24, 0xB3, 0xE2,
|
||||
0x4E, 0x00, 0x59, 0xDF, 0xB4, 0x96, 0x42, 0x59, 0xA4, 0xBC, 0xA7, 0x64, 0x8F, 0x3A, 0x17, 0x33,
|
||||
0x55, 0xA3, 0x78, 0x30, 0x76, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04,
|
||||
0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0F, 0x30, 0x0D,
|
||||
0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09, 0x15, 0x01, 0x30, 0x0C, 0x06,
|
||||
0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x63, 0x69, 0x95, 0xE3, 0xDD, 0xF4, 0xF8, 0x42,
|
||||
0xEA, 0x55, 0x95, 0x54, 0x07, 0xC4, 0xC5, 0x2A, 0xD2, 0xA9, 0x2D, 0x2F, 0x30, 0x1D, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xD6, 0x4A, 0xF8, 0x77, 0x21, 0x34, 0xEC, 0xC0, 0xAE,
|
||||
0x4D, 0x8F, 0x17, 0x86, 0xFF, 0xEA, 0xE3, 0x83, 0x42, 0x32, 0x83, 0x30, 0x0A, 0x06, 0x08, 0x2A,
|
||||
0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0x9A,
|
||||
0xAB, 0xE3, 0x6F, 0xD7, 0xB3, 0x0F, 0x83, 0x8A, 0xA1, 0x64, 0x70, 0xC1, 0xAC, 0x54, 0xE2, 0x59,
|
||||
0x7C, 0x8B, 0x11, 0x8F, 0x76, 0xB1, 0x9C, 0x5F, 0xDA, 0x7D, 0x04, 0x3C, 0x73, 0xB5, 0xCF, 0x02,
|
||||
0x21, 0x00, 0xB3, 0x31, 0xC1, 0x48, 0x3C, 0xEE, 0xA1, 0x6D, 0xA9, 0xF7, 0xF5, 0x9F, 0xD3, 0x6F,
|
||||
0x7D, 0x6F, 0xAB, 0x76, 0x12, 0xEE, 0x01, 0x4D, 0xFC, 0xE6, 0x87, 0xEA, 0xAB, 0x09, 0x98, 0xD8,
|
||||
0x97, 0x6F, 0x30, 0x82, 0x01, 0xF5, 0x30, 0x82, 0x01, 0x58, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02,
|
||||
0x10, 0x4D, 0x88, 0xBF, 0x04, 0xDF, 0x10, 0x57, 0xBA, 0x43, 0x53, 0x6C, 0xFD, 0xA5, 0x90, 0xA7,
|
||||
0x6F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x28, 0x31,
|
||||
0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1D, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63,
|
||||
0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67,
|
||||
0x6E, 0x65, 0x72, 0x52, 0x6F, 0x6F, 0x74, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x31, 0x31,
|
||||
0x36, 0x32, 0x33, 0x32, 0x31, 0x31, 0x33, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x31, 0x31, 0x36,
|
||||
0x32, 0x33, 0x33, 0x31, 0x31, 0x33, 0x5A, 0x30, 0x26, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55,
|
||||
0x04, 0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46,
|
||||
0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x30,
|
||||
0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86,
|
||||
0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x0E, 0x58, 0xA3, 0xDB, 0xD3, 0x9C,
|
||||
0x21, 0xFC, 0x63, 0x6F, 0xBD, 0xB9, 0xA7, 0x8A, 0xB3, 0xBF, 0x40, 0x87, 0x43, 0x06, 0x53, 0x91,
|
||||
0x54, 0x31, 0x11, 0x0D, 0x3B, 0x50, 0x32, 0xEA, 0x11, 0xA3, 0x3D, 0x77, 0x08, 0x9E, 0xBC, 0x06,
|
||||
0x5C, 0x21, 0x48, 0x9D, 0x9B, 0x7C, 0x45, 0xFD, 0x4B, 0xD7, 0x0C, 0x04, 0xD4, 0xE0, 0x0C, 0xB7,
|
||||
0x6C, 0xBF, 0x22, 0xE1, 0x00, 0x99, 0x75, 0x39, 0x27, 0x59, 0xA3, 0x66, 0x30, 0x64, 0x30, 0x0E,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xFF, 0x02,
|
||||
0x01, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x6D,
|
||||
0x8B, 0x24, 0xBF, 0x20, 0x9D, 0x54, 0xAF, 0x04, 0x5B, 0x84, 0x91, 0x96, 0xAE, 0x99, 0xC1, 0x23,
|
||||
0x1C, 0x0E, 0xAC, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x63, 0x69,
|
||||
0x95, 0xE3, 0xDD, 0xF4, 0xF8, 0x42, 0xEA, 0x55, 0x95, 0x54, 0x07, 0xC4, 0xC5, 0x2A, 0xD2, 0xA9,
|
||||
0x2D, 0x2F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x81,
|
||||
0x8A, 0x00, 0x30, 0x81, 0x86, 0x02, 0x41, 0x2A, 0xD4, 0xFC, 0x35, 0x28, 0x73, 0x9F, 0xB3, 0x8A,
|
||||
0xE3, 0x13, 0x7F, 0xCA, 0x36, 0x88, 0x1E, 0xD0, 0x95, 0xDC, 0xE9, 0x8A, 0x9D, 0xC0, 0x27, 0x8C,
|
||||
0xD8, 0x57, 0x57, 0x5F, 0xDC, 0x13, 0x53, 0x68, 0xED, 0x2F, 0x4D, 0x6A, 0x77, 0xA2, 0x55, 0x48,
|
||||
0xCB, 0x24, 0x55, 0x3A, 0x30, 0x32, 0xE5, 0x5C, 0xDF, 0x96, 0xF1, 0x15, 0xD4, 0xE7, 0xCD, 0x6A,
|
||||
0x26, 0xBD, 0x7B, 0x92, 0x50, 0x74, 0xE4, 0x56, 0x02, 0x41, 0x46, 0x33, 0x61, 0x30, 0xFF, 0xA8,
|
||||
0x53, 0x31, 0x38, 0xCA, 0x6B, 0x77, 0x88, 0x36, 0x9A, 0x0B, 0x57, 0xC3, 0xD1, 0xB2, 0xA7, 0x40,
|
||||
0x53, 0x6A, 0xD1, 0x6C, 0x8A, 0x8B, 0x3C, 0x29, 0xC1, 0x2B, 0x82, 0x61, 0x2F, 0x1A, 0x9F, 0x2C,
|
||||
0x9A, 0x81, 0xD0, 0x2B, 0x3E, 0x0D, 0x99, 0xB7, 0xD4, 0x7E, 0xA7, 0xEA, 0x0C, 0x8E, 0x13, 0x0E,
|
||||
0x53, 0x65, 0x48, 0x17, 0xE5, 0xFA, 0x91, 0x79, 0x98, 0xC7, 0xA1, 0x31, 0x81, 0xA6, 0x30, 0x81,
|
||||
0xA3, 0x02, 0x01, 0x01, 0x30, 0x3A, 0x30, 0x26, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69,
|
||||
0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x02, 0x10,
|
||||
0x16, 0x2F, 0xD8, 0x2B, 0x8A, 0x98, 0x6A, 0x8A, 0x43, 0xC2, 0x22, 0xA5, 0x47, 0xA1, 0x18, 0xDD,
|
||||
0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30,
|
||||
0x0B, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05, 0x00, 0x04, 0x46, 0x30, 0x44,
|
||||
0x02, 0x20, 0x40, 0xD4, 0xD4, 0xAF, 0x89, 0xFA, 0x83, 0x44, 0x7B, 0x59, 0xB4, 0x2B, 0x99, 0xF0,
|
||||
0xD4, 0xB0, 0x75, 0x2E, 0x56, 0xAA, 0x0A, 0xDA, 0xCC, 0x82, 0xD5, 0xBC, 0x8D, 0xC4, 0x00, 0xF6,
|
||||
0x46, 0xA4, 0x02, 0x20, 0x6F, 0xA7, 0xE1, 0x32, 0xB2, 0xF2, 0x5A, 0x69, 0xC5, 0x45, 0xB6, 0x35,
|
||||
0x04, 0x05, 0x9B, 0xAC, 0x44, 0xB4, 0xA0, 0xE1, 0x25, 0x92, 0xE8, 0x3E, 0x8F, 0x85, 0xA3, 0xBE,
|
||||
0x34, 0xFE, 0x78, 0x31,
|
||||
};
|
||||
|
||||
//
|
||||
// This is the TestSignedWithMultipleEKUsInCert.bin.Signature.p7b signature in
|
||||
// byte array format. It has two EKU's in it:
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
// "1.3.6.1.4.1.311.76.9.21.2"
|
||||
//
|
||||
CONST UINT8 TestSignedWithMultipleEKUsInCert[] =
|
||||
{
|
||||
0x30, 0x82, 0x06, 0x2C, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x04, 0x9E, 0x30, 0x82, 0x01, 0xF5, 0x30, 0x82, 0x01,
|
||||
0x58, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x4D, 0x88, 0xBF, 0x04, 0xDF, 0x10, 0x57, 0xBA,
|
||||
0x43, 0x53, 0x6C, 0xFD, 0xA5, 0x90, 0xA7, 0x6F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x1D, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D,
|
||||
0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x52, 0x6F, 0x6F, 0x74, 0x30, 0x1E,
|
||||
0x17, 0x0D, 0x31, 0x38, 0x30, 0x31, 0x31, 0x36, 0x32, 0x33, 0x32, 0x31, 0x31, 0x33, 0x5A, 0x17,
|
||||
0x0D, 0x33, 0x38, 0x30, 0x31, 0x31, 0x36, 0x32, 0x33, 0x33, 0x31, 0x31, 0x33, 0x5A, 0x30, 0x26,
|
||||
0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61,
|
||||
0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69,
|
||||
0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00,
|
||||
0x04, 0x0E, 0x58, 0xA3, 0xDB, 0xD3, 0x9C, 0x21, 0xFC, 0x63, 0x6F, 0xBD, 0xB9, 0xA7, 0x8A, 0xB3,
|
||||
0xBF, 0x40, 0x87, 0x43, 0x06, 0x53, 0x91, 0x54, 0x31, 0x11, 0x0D, 0x3B, 0x50, 0x32, 0xEA, 0x11,
|
||||
0xA3, 0x3D, 0x77, 0x08, 0x9E, 0xBC, 0x06, 0x5C, 0x21, 0x48, 0x9D, 0x9B, 0x7C, 0x45, 0xFD, 0x4B,
|
||||
0xD7, 0x0C, 0x04, 0xD4, 0xE0, 0x0C, 0xB7, 0x6C, 0xBF, 0x22, 0xE1, 0x00, 0x99, 0x75, 0x39, 0x27,
|
||||
0x59, 0xA3, 0x66, 0x30, 0x64, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04,
|
||||
0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04,
|
||||
0x08, 0x30, 0x06, 0x01, 0x01, 0xFF, 0x02, 0x01, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23,
|
||||
0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x6D, 0x8B, 0x24, 0xBF, 0x20, 0x9D, 0x54, 0xAF, 0x04, 0x5B,
|
||||
0x84, 0x91, 0x96, 0xAE, 0x99, 0xC1, 0x23, 0x1C, 0x0E, 0xAC, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D,
|
||||
0x0E, 0x04, 0x16, 0x04, 0x14, 0x63, 0x69, 0x95, 0xE3, 0xDD, 0xF4, 0xF8, 0x42, 0xEA, 0x55, 0x95,
|
||||
0x54, 0x07, 0xC4, 0xC5, 0x2A, 0xD2, 0xA9, 0x2D, 0x2F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48,
|
||||
0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x81, 0x8A, 0x00, 0x30, 0x81, 0x86, 0x02, 0x41, 0x2A, 0xD4,
|
||||
0xFC, 0x35, 0x28, 0x73, 0x9F, 0xB3, 0x8A, 0xE3, 0x13, 0x7F, 0xCA, 0x36, 0x88, 0x1E, 0xD0, 0x95,
|
||||
0xDC, 0xE9, 0x8A, 0x9D, 0xC0, 0x27, 0x8C, 0xD8, 0x57, 0x57, 0x5F, 0xDC, 0x13, 0x53, 0x68, 0xED,
|
||||
0x2F, 0x4D, 0x6A, 0x77, 0xA2, 0x55, 0x48, 0xCB, 0x24, 0x55, 0x3A, 0x30, 0x32, 0xE5, 0x5C, 0xDF,
|
||||
0x96, 0xF1, 0x15, 0xD4, 0xE7, 0xCD, 0x6A, 0x26, 0xBD, 0x7B, 0x92, 0x50, 0x74, 0xE4, 0x56, 0x02,
|
||||
0x41, 0x46, 0x33, 0x61, 0x30, 0xFF, 0xA8, 0x53, 0x31, 0x38, 0xCA, 0x6B, 0x77, 0x88, 0x36, 0x9A,
|
||||
0x0B, 0x57, 0xC3, 0xD1, 0xB2, 0xA7, 0x40, 0x53, 0x6A, 0xD1, 0x6C, 0x8A, 0x8B, 0x3C, 0x29, 0xC1,
|
||||
0x2B, 0x82, 0x61, 0x2F, 0x1A, 0x9F, 0x2C, 0x9A, 0x81, 0xD0, 0x2B, 0x3E, 0x0D, 0x99, 0xB7, 0xD4,
|
||||
0x7E, 0xA7, 0xEA, 0x0C, 0x8E, 0x13, 0x0E, 0x53, 0x65, 0x48, 0x17, 0xE5, 0xFA, 0x91, 0x79, 0x98,
|
||||
0xC7, 0xA1, 0x30, 0x82, 0x02, 0xA1, 0x30, 0x82, 0x02, 0x47, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02,
|
||||
0x10, 0x29, 0xBB, 0x52, 0x25, 0xED, 0x34, 0xB7, 0xBA, 0x40, 0xF8, 0xC3, 0x14, 0xB5, 0xC8, 0x86,
|
||||
0x9E, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x26, 0x31,
|
||||
0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63,
|
||||
0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67,
|
||||
0x6E, 0x65, 0x72, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x37, 0x32, 0x37, 0x32,
|
||||
0x30, 0x33, 0x34, 0x31, 0x31, 0x5A, 0x17, 0x0D, 0x32, 0x33, 0x30, 0x37, 0x32, 0x37, 0x32, 0x30,
|
||||
0x34, 0x34, 0x31, 0x31, 0x5A, 0x30, 0x3A, 0x31, 0x38, 0x30, 0x36, 0x06, 0x03, 0x55, 0x04, 0x03,
|
||||
0x0C, 0x2F, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x46, 0x69, 0x72,
|
||||
0x6D, 0x77, 0x61, 0x72, 0x65, 0x4C, 0x65, 0x61, 0x66, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x4D,
|
||||
0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x65, 0x45, 0x4B, 0x55, 0x73, 0x49, 0x6E, 0x43, 0x65, 0x72,
|
||||
0x74, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
|
||||
0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01,
|
||||
0x01, 0x00, 0xD0, 0x61, 0xA5, 0xCD, 0x49, 0x4B, 0x5C, 0x88, 0x89, 0x09, 0xCA, 0xE7, 0xEB, 0x58,
|
||||
0x91, 0x8F, 0x59, 0xBE, 0xE8, 0x16, 0xC0, 0xEF, 0x75, 0xE5, 0x18, 0x88, 0xE8, 0xCE, 0xFA, 0xD2,
|
||||
0xB0, 0x77, 0xC1, 0xD2, 0xF2, 0x9E, 0x65, 0xE8, 0xDB, 0x6B, 0x8C, 0x93, 0xE5, 0x39, 0x1D, 0xF9,
|
||||
0x37, 0x2A, 0x52, 0x7F, 0xC3, 0x93, 0xD7, 0x9F, 0x03, 0x83, 0xBC, 0x6E, 0xC6, 0x83, 0x64, 0x15,
|
||||
0x1A, 0x5C, 0x74, 0x41, 0x40, 0x21, 0xC9, 0x25, 0xF0, 0x14, 0xA3, 0x29, 0x97, 0x29, 0x8C, 0x5D,
|
||||
0xED, 0xE9, 0x8D, 0x66, 0xCC, 0xD1, 0xD1, 0xE0, 0x08, 0x52, 0xA5, 0x93, 0x07, 0xCB, 0xF8, 0x95,
|
||||
0x2C, 0x8D, 0x29, 0x84, 0x10, 0x5F, 0x57, 0x52, 0x10, 0x75, 0x35, 0x8A, 0x84, 0xE3, 0xAE, 0x10,
|
||||
0x57, 0x29, 0xE9, 0xEB, 0x6E, 0xD2, 0xC7, 0x6D, 0x35, 0x43, 0x67, 0x82, 0xE3, 0x98, 0x29, 0x9C,
|
||||
0x59, 0x77, 0xA0, 0x00, 0x27, 0xB2, 0x5D, 0xB9, 0x84, 0x31, 0x89, 0x2F, 0x77, 0xC5, 0xB9, 0x23,
|
||||
0xE0, 0x14, 0x94, 0x6F, 0x33, 0xD5, 0x3B, 0x58, 0xFB, 0xD6, 0xB6, 0xE5, 0xD4, 0x09, 0x3D, 0xB2,
|
||||
0xE7, 0x87, 0xC6, 0xEA, 0x73, 0x61, 0x6D, 0xDA, 0xFA, 0x95, 0x2B, 0x2B, 0x8A, 0xEC, 0x7E, 0x68,
|
||||
0x0F, 0x98, 0x16, 0x08, 0xFF, 0xB2, 0xC1, 0xBF, 0xAB, 0x3D, 0xB0, 0xC2, 0xD5, 0x16, 0xAE, 0x71,
|
||||
0x54, 0x48, 0xD1, 0x52, 0x72, 0xFD, 0x42, 0x09, 0x66, 0xAF, 0x50, 0xDE, 0x4C, 0x3C, 0x6A, 0xBC,
|
||||
0x1F, 0xC5, 0x0A, 0xA0, 0xC5, 0x9A, 0xF1, 0xB2, 0xB2, 0x3F, 0x14, 0xE1, 0x93, 0x07, 0xF0, 0x00,
|
||||
0x04, 0xEF, 0x16, 0x76, 0x18, 0x10, 0x65, 0x63, 0x42, 0x42, 0x12, 0xD0, 0x65, 0xF5, 0xA2, 0xCF,
|
||||
0x90, 0xBE, 0x65, 0x57, 0x25, 0x8C, 0xAC, 0x5E, 0x05, 0x31, 0x91, 0x9E, 0x4D, 0x18, 0xBC, 0x15,
|
||||
0x30, 0x7B, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x78, 0x30, 0x76, 0x30, 0x0E, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x24, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x25, 0x04, 0x1D, 0x30, 0x1B, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C,
|
||||
0x09, 0x15, 0x01, 0x06, 0x0C, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09, 0x15, 0x01,
|
||||
0x02, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x63, 0x69,
|
||||
0x95, 0xE3, 0xDD, 0xF4, 0xF8, 0x42, 0xEA, 0x55, 0x95, 0x54, 0x07, 0xC4, 0xC5, 0x2A, 0xD2, 0xA9,
|
||||
0x2D, 0x2F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xC0, 0xDC, 0xCB,
|
||||
0x76, 0x52, 0x84, 0x91, 0xF5, 0x37, 0x0D, 0x85, 0xB6, 0x45, 0x23, 0xFA, 0xA0, 0xAD, 0xC1, 0x1D,
|
||||
0x92, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00,
|
||||
0x30, 0x45, 0x02, 0x21, 0x00, 0xF4, 0xB0, 0x8A, 0x91, 0x96, 0x61, 0xDF, 0xC3, 0x54, 0xA5, 0xB3,
|
||||
0x1A, 0x3C, 0x28, 0x06, 0xC0, 0xA1, 0xF5, 0x72, 0xD1, 0x02, 0x5C, 0x69, 0xB6, 0x6C, 0xA8, 0xDC,
|
||||
0x6B, 0x78, 0xD9, 0x0C, 0x9A, 0x02, 0x20, 0x37, 0x2C, 0x61, 0x9E, 0x6E, 0x5F, 0xC6, 0xFA, 0x92,
|
||||
0x52, 0xB0, 0x4E, 0x52, 0xC7, 0xF1, 0xE9, 0x0F, 0xB6, 0xD5, 0x08, 0x10, 0x41, 0x3A, 0x61, 0xFD,
|
||||
0xC5, 0x70, 0x87, 0xBB, 0x49, 0x82, 0xEA, 0x31, 0x82, 0x01, 0x65, 0x30, 0x82, 0x01, 0x61, 0x02,
|
||||
0x01, 0x01, 0x30, 0x3A, 0x30, 0x26, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D,
|
||||
0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x02, 0x10, 0x29, 0xBB,
|
||||
0x52, 0x25, 0xED, 0x34, 0xB7, 0xBA, 0x40, 0xF8, 0xC3, 0x14, 0xB5, 0xC8, 0x86, 0x9E, 0x30, 0x0D,
|
||||
0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0D, 0x06,
|
||||
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00,
|
||||
0xBB, 0x51, 0xDD, 0x8F, 0xB4, 0x99, 0x37, 0x13, 0x94, 0x6F, 0x09, 0x05, 0xBA, 0x5B, 0x8D, 0x86,
|
||||
0x9A, 0xB0, 0x51, 0xEB, 0x6B, 0x10, 0xD7, 0xD1, 0x95, 0x4A, 0x4D, 0x23, 0xA3, 0x37, 0x82, 0xDF,
|
||||
0x1F, 0x24, 0xE4, 0x62, 0x4F, 0xD4, 0x52, 0x73, 0xF8, 0x39, 0x2B, 0x46, 0xF4, 0x61, 0xCE, 0xF1,
|
||||
0x64, 0xD7, 0x60, 0xC9, 0xCC, 0xCA, 0x8D, 0x94, 0xA5, 0x67, 0x68, 0x2B, 0xE4, 0xB0, 0xD7, 0x64,
|
||||
0xC8, 0xF3, 0x9C, 0x98, 0x2C, 0x0A, 0x69, 0x56, 0xD6, 0x59, 0xDF, 0x4D, 0x38, 0xE7, 0xD4, 0x63,
|
||||
0x2B, 0x74, 0xA1, 0xA3, 0xF9, 0xE1, 0x1A, 0x12, 0x2B, 0x04, 0x46, 0x11, 0xA8, 0x26, 0x00, 0x15,
|
||||
0x4F, 0x14, 0x7F, 0xB1, 0xB4, 0x25, 0x0C, 0x87, 0xB0, 0x56, 0x8C, 0xBE, 0x0D, 0xFA, 0x66, 0x6F,
|
||||
0x8A, 0xCB, 0x0A, 0x88, 0x3B, 0xF6, 0x52, 0xCD, 0xBB, 0xA2, 0xA9, 0xAD, 0xAD, 0x09, 0x0D, 0xDA,
|
||||
0x79, 0x8A, 0xAE, 0xE5, 0x9D, 0xCE, 0x5C, 0x60, 0x99, 0x67, 0x26, 0xC4, 0xAF, 0xD4, 0x01, 0xB1,
|
||||
0x6D, 0xD1, 0x8C, 0x4D, 0x1D, 0xBD, 0xAB, 0x42, 0x2C, 0xF2, 0xD8, 0x07, 0x3F, 0xDC, 0x5E, 0x68,
|
||||
0x4C, 0xD9, 0xDB, 0xC0, 0x93, 0xBB, 0x8E, 0xA0, 0xA2, 0x09, 0x5F, 0x03, 0x58, 0x48, 0x54, 0xF6,
|
||||
0xF0, 0xDA, 0x7A, 0x7F, 0xC4, 0xD2, 0x9F, 0x64, 0xF5, 0x85, 0x86, 0x48, 0xDF, 0x7F, 0x86, 0x14,
|
||||
0x7C, 0x62, 0x77, 0x1D, 0x22, 0xE5, 0x34, 0x42, 0xE4, 0x49, 0x38, 0xB4, 0xE4, 0x22, 0xFB, 0x5F,
|
||||
0xB5, 0xEA, 0xBA, 0x90, 0x51, 0xC0, 0xC6, 0x94, 0x09, 0xE4, 0xB7, 0x15, 0x3F, 0x07, 0x23, 0xE8,
|
||||
0x46, 0x93, 0xA5, 0x7B, 0x7A, 0x91, 0xDA, 0x8E, 0x7C, 0xAF, 0xBD, 0x41, 0xB9, 0xDE, 0x85, 0x04,
|
||||
0xBC, 0x08, 0x6C, 0x08, 0x56, 0x16, 0xDB, 0xB5, 0xEE, 0x65, 0x76, 0xE9, 0x78, 0xD3, 0xDD, 0xD8,
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This is the TestSignedWithProductId10001.bin.p7b in byte array format.
|
||||
// It has two EKU's in it: (Product ID is 10001)
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
// "1.3.6.1.4.1.311.76.9.21.1.10001"
|
||||
//
|
||||
CONST UINT8 TestSignedWithProductId10001[] =
|
||||
{
|
||||
0x30, 0x82, 0x06, 0x1E, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x04, 0x90, 0x30, 0x82, 0x01, 0xF5, 0x30, 0x82, 0x01,
|
||||
0x58, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x4D, 0x88, 0xBF, 0x04, 0xDF, 0x10, 0x57, 0xBA,
|
||||
0x43, 0x53, 0x6C, 0xFD, 0xA5, 0x90, 0xA7, 0x6F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x1D, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D,
|
||||
0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x52, 0x6F, 0x6F, 0x74, 0x30, 0x1E,
|
||||
0x17, 0x0D, 0x31, 0x38, 0x30, 0x31, 0x31, 0x36, 0x32, 0x33, 0x32, 0x31, 0x31, 0x33, 0x5A, 0x17,
|
||||
0x0D, 0x33, 0x38, 0x30, 0x31, 0x31, 0x36, 0x32, 0x33, 0x33, 0x31, 0x31, 0x33, 0x5A, 0x30, 0x26,
|
||||
0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61,
|
||||
0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69,
|
||||
0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00,
|
||||
0x04, 0x0E, 0x58, 0xA3, 0xDB, 0xD3, 0x9C, 0x21, 0xFC, 0x63, 0x6F, 0xBD, 0xB9, 0xA7, 0x8A, 0xB3,
|
||||
0xBF, 0x40, 0x87, 0x43, 0x06, 0x53, 0x91, 0x54, 0x31, 0x11, 0x0D, 0x3B, 0x50, 0x32, 0xEA, 0x11,
|
||||
0xA3, 0x3D, 0x77, 0x08, 0x9E, 0xBC, 0x06, 0x5C, 0x21, 0x48, 0x9D, 0x9B, 0x7C, 0x45, 0xFD, 0x4B,
|
||||
0xD7, 0x0C, 0x04, 0xD4, 0xE0, 0x0C, 0xB7, 0x6C, 0xBF, 0x22, 0xE1, 0x00, 0x99, 0x75, 0x39, 0x27,
|
||||
0x59, 0xA3, 0x66, 0x30, 0x64, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04,
|
||||
0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04,
|
||||
0x08, 0x30, 0x06, 0x01, 0x01, 0xFF, 0x02, 0x01, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23,
|
||||
0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x6D, 0x8B, 0x24, 0xBF, 0x20, 0x9D, 0x54, 0xAF, 0x04, 0x5B,
|
||||
0x84, 0x91, 0x96, 0xAE, 0x99, 0xC1, 0x23, 0x1C, 0x0E, 0xAC, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D,
|
||||
0x0E, 0x04, 0x16, 0x04, 0x14, 0x63, 0x69, 0x95, 0xE3, 0xDD, 0xF4, 0xF8, 0x42, 0xEA, 0x55, 0x95,
|
||||
0x54, 0x07, 0xC4, 0xC5, 0x2A, 0xD2, 0xA9, 0x2D, 0x2F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48,
|
||||
0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x81, 0x8A, 0x00, 0x30, 0x81, 0x86, 0x02, 0x41, 0x2A, 0xD4,
|
||||
0xFC, 0x35, 0x28, 0x73, 0x9F, 0xB3, 0x8A, 0xE3, 0x13, 0x7F, 0xCA, 0x36, 0x88, 0x1E, 0xD0, 0x95,
|
||||
0xDC, 0xE9, 0x8A, 0x9D, 0xC0, 0x27, 0x8C, 0xD8, 0x57, 0x57, 0x5F, 0xDC, 0x13, 0x53, 0x68, 0xED,
|
||||
0x2F, 0x4D, 0x6A, 0x77, 0xA2, 0x55, 0x48, 0xCB, 0x24, 0x55, 0x3A, 0x30, 0x32, 0xE5, 0x5C, 0xDF,
|
||||
0x96, 0xF1, 0x15, 0xD4, 0xE7, 0xCD, 0x6A, 0x26, 0xBD, 0x7B, 0x92, 0x50, 0x74, 0xE4, 0x56, 0x02,
|
||||
0x41, 0x46, 0x33, 0x61, 0x30, 0xFF, 0xA8, 0x53, 0x31, 0x38, 0xCA, 0x6B, 0x77, 0x88, 0x36, 0x9A,
|
||||
0x0B, 0x57, 0xC3, 0xD1, 0xB2, 0xA7, 0x40, 0x53, 0x6A, 0xD1, 0x6C, 0x8A, 0x8B, 0x3C, 0x29, 0xC1,
|
||||
0x2B, 0x82, 0x61, 0x2F, 0x1A, 0x9F, 0x2C, 0x9A, 0x81, 0xD0, 0x2B, 0x3E, 0x0D, 0x99, 0xB7, 0xD4,
|
||||
0x7E, 0xA7, 0xEA, 0x0C, 0x8E, 0x13, 0x0E, 0x53, 0x65, 0x48, 0x17, 0xE5, 0xFA, 0x91, 0x79, 0x98,
|
||||
0xC7, 0xA1, 0x30, 0x82, 0x02, 0x93, 0x30, 0x82, 0x02, 0x39, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02,
|
||||
0x10, 0x1F, 0x65, 0xF1, 0x29, 0x3B, 0x89, 0x6A, 0xBF, 0x43, 0xAF, 0xC7, 0x30, 0x36, 0xD1, 0x0D,
|
||||
0x2B, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x26, 0x31,
|
||||
0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63,
|
||||
0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67,
|
||||
0x6E, 0x65, 0x72, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38, 0x30, 0x32, 0x31,
|
||||
0x36, 0x34, 0x32, 0x32, 0x33, 0x5A, 0x17, 0x0D, 0x32, 0x33, 0x30, 0x38, 0x30, 0x32, 0x31, 0x36,
|
||||
0x35, 0x32, 0x32, 0x33, 0x5A, 0x30, 0x2B, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x03,
|
||||
0x0C, 0x20, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69,
|
||||
0x67, 0x6E, 0x65, 0x72, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x49, 0x44, 0x31, 0x30, 0x30,
|
||||
0x30, 0x31, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
|
||||
0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82,
|
||||
0x01, 0x01, 0x00, 0x8C, 0x26, 0x35, 0xBC, 0x18, 0x06, 0x44, 0x65, 0xF6, 0x55, 0x29, 0x78, 0x26,
|
||||
0xCA, 0x57, 0xD0, 0x4C, 0x31, 0x84, 0x5B, 0x64, 0xDE, 0x8E, 0x34, 0x84, 0x45, 0x12, 0xE8, 0x5A,
|
||||
0x86, 0x4B, 0x5A, 0x61, 0x4C, 0xD8, 0xE2, 0x7D, 0x3B, 0xBD, 0x25, 0x58, 0x30, 0x1D, 0x5E, 0x65,
|
||||
0x50, 0xC3, 0x07, 0xF2, 0x50, 0xE1, 0x48, 0x2A, 0xD9, 0x70, 0x5F, 0xF3, 0x2B, 0xF1, 0x1F, 0x21,
|
||||
0x06, 0x62, 0x81, 0xE9, 0x8E, 0xDA, 0xDC, 0x69, 0xA3, 0x6E, 0x2F, 0xD2, 0x3A, 0x79, 0x01, 0xAF,
|
||||
0xA1, 0x2A, 0x28, 0xDD, 0x32, 0x4E, 0xCE, 0x40, 0xB8, 0x41, 0xA4, 0x7D, 0x3D, 0x70, 0x3F, 0xC4,
|
||||
0xDA, 0x61, 0x18, 0xBF, 0xFC, 0xAB, 0x16, 0xE3, 0x65, 0x3F, 0x6D, 0x76, 0x37, 0xAD, 0x1F, 0x11,
|
||||
0x05, 0x0F, 0xC2, 0x56, 0xD1, 0x45, 0xBD, 0x25, 0xCC, 0x19, 0xC4, 0x2A, 0x03, 0xED, 0x3B, 0x05,
|
||||
0xA7, 0x87, 0x30, 0xE6, 0x84, 0x11, 0x88, 0xD0, 0x91, 0x4E, 0x52, 0xB5, 0x97, 0xDF, 0x57, 0xEF,
|
||||
0x5E, 0x72, 0x68, 0x49, 0x85, 0xC8, 0x7F, 0xA7, 0x5F, 0x7B, 0xE7, 0xCE, 0xA1, 0x53, 0xBA, 0xF8,
|
||||
0xA9, 0xDF, 0x8C, 0x8C, 0x72, 0xD2, 0xA9, 0x7A, 0xF5, 0x07, 0x4A, 0x75, 0x1A, 0x0F, 0x50, 0x9E,
|
||||
0xEA, 0x4C, 0xFC, 0xC7, 0x74, 0xE2, 0x4D, 0xD1, 0x01, 0xC4, 0xB6, 0xCA, 0xA5, 0xCC, 0x23, 0xFA,
|
||||
0xDE, 0xF2, 0x9C, 0x8B, 0xA6, 0x32, 0x8D, 0xED, 0x97, 0xCC, 0x50, 0xB0, 0xB6, 0x1C, 0x89, 0x64,
|
||||
0xFC, 0xD7, 0xD0, 0x19, 0x01, 0x50, 0xD9, 0xBC, 0x78, 0xB1, 0x76, 0x6D, 0x01, 0xF8, 0xEC, 0x68,
|
||||
0x97, 0x20, 0x32, 0xD0, 0x57, 0x76, 0x93, 0x73, 0xC9, 0x2B, 0x68, 0x9D, 0x5E, 0xE1, 0x70, 0xDD,
|
||||
0x6F, 0x3A, 0x09, 0x20, 0x63, 0xE9, 0xD9, 0x30, 0x05, 0x14, 0x4A, 0x76, 0xA7, 0x3E, 0x61, 0xCD,
|
||||
0x2F, 0x6D, 0xE3, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x79, 0x30, 0x77, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x25, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x25, 0x04, 0x1E, 0x30, 0x1C, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x4C, 0x09, 0x15, 0x01, 0x06, 0x0D, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09, 0x15,
|
||||
0x01, 0xCE, 0x11, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
|
||||
0x63, 0x69, 0x95, 0xE3, 0xDD, 0xF4, 0xF8, 0x42, 0xEA, 0x55, 0x95, 0x54, 0x07, 0xC4, 0xC5, 0x2A,
|
||||
0xD2, 0xA9, 0x2D, 0x2F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x09,
|
||||
0x10, 0xEE, 0x7B, 0xB0, 0x56, 0xB0, 0xCE, 0x42, 0x83, 0x84, 0x90, 0x70, 0xAF, 0x8D, 0x58, 0x1B,
|
||||
0x77, 0x43, 0x0E, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03,
|
||||
0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xEE, 0x2A, 0x00, 0x7E, 0xC6, 0x4E, 0x6F, 0x22, 0xCC,
|
||||
0x16, 0xEA, 0xAC, 0x90, 0x3D, 0xD7, 0x6E, 0xAA, 0xBF, 0x7E, 0xC7, 0x45, 0x3F, 0x36, 0x22, 0x81,
|
||||
0xC6, 0x38, 0xD3, 0x1E, 0xDF, 0x5F, 0x2C, 0x02, 0x20, 0x21, 0xEC, 0xCF, 0x78, 0x1D, 0xDB, 0x4F,
|
||||
0x50, 0xE8, 0xD6, 0x07, 0xB0, 0x6A, 0xE9, 0x1E, 0xBF, 0x9C, 0xE8, 0xB9, 0xF7, 0xC6, 0xEA, 0x04,
|
||||
0x7B, 0x5E, 0xD8, 0x67, 0xAB, 0xD2, 0xDE, 0x77, 0xB9, 0x31, 0x82, 0x01, 0x65, 0x30, 0x82, 0x01,
|
||||
0x61, 0x02, 0x01, 0x01, 0x30, 0x3A, 0x30, 0x26, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x0C, 0x1B, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69,
|
||||
0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x43, 0x41, 0x02, 0x10,
|
||||
0x1F, 0x65, 0xF1, 0x29, 0x3B, 0x89, 0x6A, 0xBF, 0x43, 0xAF, 0xC7, 0x30, 0x36, 0xD1, 0x0D, 0x2B,
|
||||
0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30,
|
||||
0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82,
|
||||
0x01, 0x00, 0x1F, 0x7F, 0x30, 0xDC, 0xD4, 0x12, 0x9D, 0x0B, 0x71, 0x30, 0x69, 0x91, 0xCC, 0x8A,
|
||||
0xFB, 0xF6, 0x54, 0x14, 0x4C, 0x0B, 0x78, 0xCE, 0xD3, 0xC6, 0xCE, 0x3E, 0xAC, 0xCC, 0x0F, 0xCE,
|
||||
0x3A, 0xFC, 0x63, 0x96, 0xD2, 0x7B, 0xDB, 0xF7, 0xE7, 0x6D, 0x64, 0x52, 0x5C, 0x5D, 0x19, 0xBF,
|
||||
0xE3, 0x04, 0x71, 0x8A, 0xD1, 0x2A, 0xB6, 0x5A, 0x8C, 0xFC, 0xE2, 0x51, 0x27, 0x64, 0x9B, 0xA8,
|
||||
0x84, 0x69, 0x60, 0x4E, 0x56, 0x83, 0x91, 0x4F, 0xEB, 0x5A, 0xB7, 0x73, 0xE1, 0xAC, 0x24, 0xD2,
|
||||
0x60, 0xD8, 0x58, 0x21, 0x51, 0x7B, 0x87, 0x93, 0x5B, 0x5F, 0x91, 0x4B, 0x8C, 0xFE, 0xA5, 0x16,
|
||||
0x2E, 0x33, 0x4D, 0xBB, 0x0C, 0x95, 0x5C, 0xC3, 0x9C, 0x3D, 0xBB, 0x58, 0x17, 0x39, 0x1E, 0x10,
|
||||
0x47, 0xCD, 0xEE, 0xD3, 0xE7, 0x73, 0x44, 0x7D, 0x35, 0xD9, 0x9F, 0xC3, 0xAC, 0x11, 0x2E, 0x29,
|
||||
0x54, 0x80, 0x8F, 0x19, 0xDC, 0xC3, 0x11, 0x3D, 0x75, 0xF0, 0x3B, 0x34, 0x63, 0xB1, 0x59, 0x1D,
|
||||
0x4B, 0x66, 0xBE, 0xB8, 0xAC, 0x36, 0x71, 0x63, 0xD4, 0x41, 0xCF, 0x24, 0x2A, 0x3F, 0xC5, 0x25,
|
||||
0xD2, 0x45, 0x9B, 0xD3, 0x77, 0xD8, 0xD8, 0x1A, 0xC6, 0xAE, 0xE3, 0xF5, 0xC5, 0xEB, 0xF3, 0x92,
|
||||
0x27, 0x3C, 0x3F, 0x48, 0x96, 0xF2, 0xB4, 0x66, 0x0A, 0xFB, 0xBF, 0x76, 0xDC, 0x1E, 0xC5, 0xC6,
|
||||
0x4D, 0xA1, 0x5C, 0x13, 0x22, 0xF8, 0x89, 0xE2, 0x15, 0x43, 0x84, 0xEF, 0xC8, 0x30, 0xE5, 0xF0,
|
||||
0xBA, 0x51, 0x96, 0x3E, 0xF9, 0xCB, 0x41, 0xE6, 0x36, 0xD4, 0xE3, 0xDA, 0x71, 0xC8, 0x5E, 0x43,
|
||||
0x7A, 0xBE, 0x8E, 0xC0, 0xA5, 0xEF, 0x66, 0xFD, 0x63, 0xD3, 0xF1, 0xBF, 0x66, 0x4F, 0x35, 0x24,
|
||||
0x66, 0xC9, 0xCD, 0x1E, 0x3D, 0x71, 0x19, 0x84, 0x1A, 0x9D, 0xA5, 0x56, 0xF4, 0xF9, 0xE0, 0x88,
|
||||
0x7C, 0x52,
|
||||
};
|
||||
|
||||
//
|
||||
// This is TestSignEKUsWith1CertInSignature.bin.p7b in byte array format.
|
||||
// It has one EKU in it:
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
//
|
||||
CONST UINT8 TestSignEKUsWith1CertInSignature[] =
|
||||
{
|
||||
0x30, 0x82, 0x02, 0x7D, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x01, 0xB2, 0x30, 0x82, 0x01, 0xAE, 0x30, 0x82, 0x01,
|
||||
0x53, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x3E, 0xEE, 0x4B, 0xFB, 0x00, 0x35, 0xC8, 0x96,
|
||||
0x41, 0xF4, 0xF6, 0x57, 0x16, 0xAD, 0x20, 0xCB, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x49,
|
||||
0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38,
|
||||
0x31, 0x35, 0x31, 0x37, 0x33, 0x35, 0x35, 0x30, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38, 0x31,
|
||||
0x35, 0x31, 0x37, 0x34, 0x35, 0x35, 0x30, 0x5A, 0x30, 0x23, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x0C, 0x18, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73,
|
||||
0x69, 0x6E, 0x67, 0x4C, 0x65, 0x61, 0x66, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x59, 0x30,
|
||||
0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xF6, 0xEA, 0x5E, 0x14, 0x20, 0x6D, 0x11, 0xC0,
|
||||
0xFD, 0xF9, 0xB9, 0xB5, 0x8F, 0xBB, 0x3E, 0x8B, 0xE8, 0x21, 0x21, 0x3A, 0xC2, 0xBA, 0x37, 0x24,
|
||||
0x61, 0x14, 0x7E, 0xA8, 0x86, 0x0A, 0x5C, 0xD3, 0x5F, 0xA8, 0xDC, 0x3A, 0x06, 0x30, 0x53, 0xFC,
|
||||
0x85, 0xBC, 0x60, 0x5C, 0x28, 0x07, 0xCA, 0x12, 0x40, 0xE8, 0x97, 0x6A, 0x63, 0x30, 0xF7, 0x37,
|
||||
0x25, 0x76, 0x4D, 0xA9, 0x1A, 0x8C, 0x36, 0xAA, 0xA3, 0x6A, 0x30, 0x68, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x25, 0x04, 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x4C, 0x09, 0x15, 0x01, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
|
||||
0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40, 0x3C, 0x3E, 0x9C,
|
||||
0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14,
|
||||
0xE8, 0x47, 0x05, 0xA2, 0x59, 0xE9, 0x89, 0x81, 0xF4, 0xC8, 0x0D, 0x4C, 0x0A, 0xD3, 0xD4, 0xDE,
|
||||
0x9F, 0xA6, 0xC7, 0x79, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02,
|
||||
0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0x8C, 0x39, 0xC6, 0x6C, 0xD6, 0x8F, 0x20, 0xA5,
|
||||
0x85, 0x97, 0x27, 0xF9, 0xB5, 0x26, 0xA2, 0xAB, 0xEC, 0x2E, 0x1B, 0x6F, 0x6F, 0x79, 0x9F, 0x8D,
|
||||
0xCE, 0x9D, 0x12, 0x23, 0x5F, 0x04, 0xFA, 0xBE, 0x02, 0x21, 0x00, 0xC5, 0xD8, 0x49, 0xD1, 0x40,
|
||||
0xE3, 0x2C, 0xDF, 0xC3, 0xD4, 0x11, 0xF9, 0x5E, 0x10, 0x8A, 0x3C, 0x4E, 0xA0, 0xD6, 0x6B, 0x8C,
|
||||
0x0E, 0x7B, 0xF1, 0x2B, 0x20, 0x9C, 0x68, 0x53, 0x43, 0x4B, 0x35, 0x31, 0x81, 0xA3, 0x30, 0x81,
|
||||
0xA0, 0x02, 0x01, 0x01, 0x30, 0x36, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E,
|
||||
0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x02, 0x10, 0x3E, 0xEE, 0x4B, 0xFB,
|
||||
0x00, 0x35, 0xC8, 0x96, 0x41, 0xF4, 0xF6, 0x57, 0x16, 0xAD, 0x20, 0xCB, 0x30, 0x0D, 0x06, 0x09,
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x07, 0x2A,
|
||||
0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05, 0x00, 0x04, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xB8,
|
||||
0xCC, 0x0F, 0xD2, 0x50, 0x47, 0x3A, 0x11, 0x8D, 0xAE, 0x6C, 0xE9, 0x03, 0x64, 0xA7, 0x44, 0xE6,
|
||||
0x0F, 0xF8, 0x6F, 0x7E, 0xE7, 0x61, 0x25, 0x8C, 0x67, 0xE8, 0xC2, 0xD6, 0x33, 0x91, 0x62, 0x02,
|
||||
0x20, 0x78, 0xF8, 0x94, 0x0F, 0x46, 0xD2, 0xE2, 0x2B, 0x33, 0xAF, 0xBD, 0x38, 0xA4, 0x43, 0xA6,
|
||||
0x6F, 0x8A, 0xBE, 0x26, 0xDC, 0xD0, 0x82, 0x01, 0x3D, 0x00, 0xF3, 0xC2, 0x07, 0x8A, 0xE8, 0xFD,
|
||||
0x18,
|
||||
};
|
||||
|
||||
//
|
||||
// This is TestSignEKUsWith2CertsInSignature.bin.p7b in byte array format.
|
||||
// It has one EKU in it:
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
//
|
||||
CONST UINT8 TestSignEKUsWith2CertsInSignature[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0x61, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x03, 0x96, 0x30, 0x82, 0x01, 0xAE, 0x30, 0x82, 0x01,
|
||||
0x53, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x3E, 0xEE, 0x4B, 0xFB, 0x00, 0x35, 0xC8, 0x96,
|
||||
0x41, 0xF4, 0xF6, 0x57, 0x16, 0xAD, 0x20, 0xCB, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x49,
|
||||
0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38,
|
||||
0x31, 0x35, 0x31, 0x37, 0x33, 0x35, 0x35, 0x30, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38, 0x31,
|
||||
0x35, 0x31, 0x37, 0x34, 0x35, 0x35, 0x30, 0x5A, 0x30, 0x23, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x0C, 0x18, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73,
|
||||
0x69, 0x6E, 0x67, 0x4C, 0x65, 0x61, 0x66, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x59, 0x30,
|
||||
0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xF6, 0xEA, 0x5E, 0x14, 0x20, 0x6D, 0x11, 0xC0,
|
||||
0xFD, 0xF9, 0xB9, 0xB5, 0x8F, 0xBB, 0x3E, 0x8B, 0xE8, 0x21, 0x21, 0x3A, 0xC2, 0xBA, 0x37, 0x24,
|
||||
0x61, 0x14, 0x7E, 0xA8, 0x86, 0x0A, 0x5C, 0xD3, 0x5F, 0xA8, 0xDC, 0x3A, 0x06, 0x30, 0x53, 0xFC,
|
||||
0x85, 0xBC, 0x60, 0x5C, 0x28, 0x07, 0xCA, 0x12, 0x40, 0xE8, 0x97, 0x6A, 0x63, 0x30, 0xF7, 0x37,
|
||||
0x25, 0x76, 0x4D, 0xA9, 0x1A, 0x8C, 0x36, 0xAA, 0xA3, 0x6A, 0x30, 0x68, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x25, 0x04, 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x4C, 0x09, 0x15, 0x01, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
|
||||
0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40, 0x3C, 0x3E, 0x9C,
|
||||
0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14,
|
||||
0xE8, 0x47, 0x05, 0xA2, 0x59, 0xE9, 0x89, 0x81, 0xF4, 0xC8, 0x0D, 0x4C, 0x0A, 0xD3, 0xD4, 0xDE,
|
||||
0x9F, 0xA6, 0xC7, 0x79, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02,
|
||||
0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0x8C, 0x39, 0xC6, 0x6C, 0xD6, 0x8F, 0x20, 0xA5,
|
||||
0x85, 0x97, 0x27, 0xF9, 0xB5, 0x26, 0xA2, 0xAB, 0xEC, 0x2E, 0x1B, 0x6F, 0x6F, 0x79, 0x9F, 0x8D,
|
||||
0xCE, 0x9D, 0x12, 0x23, 0x5F, 0x04, 0xFA, 0xBE, 0x02, 0x21, 0x00, 0xC5, 0xD8, 0x49, 0xD1, 0x40,
|
||||
0xE3, 0x2C, 0xDF, 0xC3, 0xD4, 0x11, 0xF9, 0x5E, 0x10, 0x8A, 0x3C, 0x4E, 0xA0, 0xD6, 0x6B, 0x8C,
|
||||
0x0E, 0x7B, 0xF1, 0x2B, 0x20, 0x9C, 0x68, 0x53, 0x43, 0x4B, 0x35, 0x30, 0x82, 0x01, 0xE0, 0x30,
|
||||
0x82, 0x01, 0x65, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x79, 0x28, 0x1A, 0xE8, 0x7F, 0x21,
|
||||
0x4F, 0xBB, 0x47, 0x2F, 0x74, 0x75, 0xE6, 0x98, 0x60, 0xD6, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
|
||||
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x21, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x0C, 0x16, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E,
|
||||
0x67, 0x50, 0x6F, 0x6C, 0x69, 0x63, 0x79, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30,
|
||||
0x38, 0x31, 0x35, 0x31, 0x37, 0x33, 0x32, 0x35, 0x34, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38,
|
||||
0x31, 0x35, 0x31, 0x37, 0x34, 0x32, 0x35, 0x34, 0x5A, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06,
|
||||
0x03, 0x55, 0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72,
|
||||
0x73, 0x69, 0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x30, 0x59, 0x30,
|
||||
0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x66, 0x41, 0xE6, 0x86, 0x7D, 0x5B, 0x96, 0x6C,
|
||||
0x99, 0x2A, 0x82, 0x53, 0x58, 0xA3, 0x6F, 0x59, 0xFC, 0x1C, 0x9F, 0xEB, 0xBE, 0x9D, 0x53, 0xBA,
|
||||
0x50, 0x0F, 0x66, 0xBC, 0xE5, 0x90, 0x7E, 0xAA, 0xA2, 0x6C, 0xC2, 0xC9, 0xAA, 0x99, 0x0B, 0x04,
|
||||
0xA0, 0x6A, 0xB4, 0xC1, 0xF7, 0x55, 0x60, 0x58, 0xE3, 0xDE, 0x22, 0x57, 0xB1, 0x8A, 0x5C, 0xBC,
|
||||
0xDF, 0x22, 0x8A, 0x2B, 0x04, 0x7D, 0x7A, 0x6C, 0xA3, 0x7E, 0x30, 0x7C, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x16, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x25, 0x04, 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x4C, 0x09, 0x15, 0x01, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x08,
|
||||
0x30, 0x06, 0x01, 0x01, 0xFF, 0x02, 0x01, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04,
|
||||
0x18, 0x30, 0x16, 0x80, 0x14, 0x0B, 0x8A, 0xC7, 0xA8, 0x53, 0x07, 0x40, 0x74, 0x75, 0x0F, 0x85,
|
||||
0xCE, 0x5D, 0x5C, 0xC2, 0x23, 0x32, 0xC0, 0xFC, 0xC9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
|
||||
0x04, 0x16, 0x04, 0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40,
|
||||
0x3C, 0x3E, 0x9C, 0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x03, 0x69, 0x00, 0x30, 0x66, 0x02, 0x31, 0x00, 0xEE, 0x78, 0xDB, 0x74,
|
||||
0x56, 0xA3, 0xC2, 0x44, 0x25, 0x0F, 0xA1, 0x89, 0xC0, 0x76, 0xD1, 0xE4, 0xFE, 0xAA, 0xA4, 0xC3,
|
||||
0x7D, 0x40, 0xE3, 0x28, 0x1B, 0x0D, 0xAB, 0x32, 0x6B, 0x9A, 0x60, 0x37, 0x2F, 0xB6, 0xF4, 0xCB,
|
||||
0xEA, 0xC8, 0x65, 0xB6, 0xDC, 0x24, 0x90, 0x10, 0xFB, 0xD2, 0x42, 0x05, 0x02, 0x31, 0x00, 0x9E,
|
||||
0x91, 0xF9, 0x96, 0x8A, 0x41, 0x2C, 0x5E, 0x6B, 0xBC, 0x36, 0x05, 0x3B, 0x50, 0x11, 0x91, 0x9A,
|
||||
0xFA, 0x6B, 0x7F, 0x01, 0xF4, 0x6A, 0x7E, 0xCD, 0x98, 0x7E, 0x7D, 0xFD, 0xA8, 0xE3, 0xB2, 0x4F,
|
||||
0x71, 0x91, 0xF5, 0xE0, 0x82, 0xA5, 0xE7, 0x5A, 0xE8, 0x19, 0x09, 0xF6, 0x22, 0xBE, 0xC4, 0x31,
|
||||
0x81, 0xA3, 0x30, 0x81, 0xA0, 0x02, 0x01, 0x01, 0x30, 0x36, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E,
|
||||
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61,
|
||||
0x72, 0x73, 0x69, 0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x02, 0x10,
|
||||
0x3E, 0xEE, 0x4B, 0xFB, 0x00, 0x35, 0xC8, 0x96, 0x41, 0xF4, 0xF6, 0x57, 0x16, 0xAD, 0x20, 0xCB,
|
||||
0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30,
|
||||
0x0B, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05, 0x00, 0x04, 0x47, 0x30, 0x45,
|
||||
0x02, 0x20, 0x4A, 0xFD, 0xAE, 0xDD, 0x5D, 0xC5, 0x86, 0x48, 0xDC, 0xC1, 0xC3, 0xA7, 0xE6, 0x4E,
|
||||
0x7F, 0x8B, 0x7B, 0xAB, 0x2C, 0x60, 0xDD, 0x79, 0x4C, 0xF2, 0x45, 0xED, 0x7A, 0xA5, 0x24, 0xE6,
|
||||
0x0E, 0x60, 0x02, 0x21, 0x00, 0xAD, 0xCA, 0x3C, 0x29, 0x2F, 0xF9, 0xB1, 0x8E, 0x58, 0x29, 0x3F,
|
||||
0x97, 0x20, 0x03, 0x6A, 0x14, 0xDA, 0x83, 0x4A, 0x8F, 0x3E, 0x95, 0x37, 0xC3, 0xF0, 0x12, 0x2A,
|
||||
0x7B, 0x24, 0x59, 0x69, 0x27,
|
||||
};
|
||||
|
||||
//
|
||||
// This is TestSignEKUsWith3CertsInSignature.bin.p7b
|
||||
// It has one EKU in it:
|
||||
// "1.3.6.1.4.1.311.76.9.21.1"
|
||||
//
|
||||
const UINT8 TestSignEKUsWith3CertsInSignature[] =
|
||||
{
|
||||
0x30, 0x82, 0x06, 0x65, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x05, 0x9B, 0x30, 0x82, 0x01, 0xAE, 0x30, 0x82, 0x01,
|
||||
0x53, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x3E, 0xEE, 0x4B, 0xFB, 0x00, 0x35, 0xC8, 0x96,
|
||||
0x41, 0xF4, 0xF6, 0x57, 0x16, 0xAD, 0x20, 0xCB, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x49,
|
||||
0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38,
|
||||
0x31, 0x35, 0x31, 0x37, 0x33, 0x35, 0x35, 0x30, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38, 0x31,
|
||||
0x35, 0x31, 0x37, 0x34, 0x35, 0x35, 0x30, 0x5A, 0x30, 0x23, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x0C, 0x18, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73,
|
||||
0x69, 0x6E, 0x67, 0x4C, 0x65, 0x61, 0x66, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x59, 0x30,
|
||||
0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xF6, 0xEA, 0x5E, 0x14, 0x20, 0x6D, 0x11, 0xC0,
|
||||
0xFD, 0xF9, 0xB9, 0xB5, 0x8F, 0xBB, 0x3E, 0x8B, 0xE8, 0x21, 0x21, 0x3A, 0xC2, 0xBA, 0x37, 0x24,
|
||||
0x61, 0x14, 0x7E, 0xA8, 0x86, 0x0A, 0x5C, 0xD3, 0x5F, 0xA8, 0xDC, 0x3A, 0x06, 0x30, 0x53, 0xFC,
|
||||
0x85, 0xBC, 0x60, 0x5C, 0x28, 0x07, 0xCA, 0x12, 0x40, 0xE8, 0x97, 0x6A, 0x63, 0x30, 0xF7, 0x37,
|
||||
0x25, 0x76, 0x4D, 0xA9, 0x1A, 0x8C, 0x36, 0xAA, 0xA3, 0x6A, 0x30, 0x68, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x25, 0x04, 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x4C, 0x09, 0x15, 0x01, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
|
||||
0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40, 0x3C, 0x3E, 0x9C,
|
||||
0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14,
|
||||
0xE8, 0x47, 0x05, 0xA2, 0x59, 0xE9, 0x89, 0x81, 0xF4, 0xC8, 0x0D, 0x4C, 0x0A, 0xD3, 0xD4, 0xDE,
|
||||
0x9F, 0xA6, 0xC7, 0x79, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02,
|
||||
0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0x8C, 0x39, 0xC6, 0x6C, 0xD6, 0x8F, 0x20, 0xA5,
|
||||
0x85, 0x97, 0x27, 0xF9, 0xB5, 0x26, 0xA2, 0xAB, 0xEC, 0x2E, 0x1B, 0x6F, 0x6F, 0x79, 0x9F, 0x8D,
|
||||
0xCE, 0x9D, 0x12, 0x23, 0x5F, 0x04, 0xFA, 0xBE, 0x02, 0x21, 0x00, 0xC5, 0xD8, 0x49, 0xD1, 0x40,
|
||||
0xE3, 0x2C, 0xDF, 0xC3, 0xD4, 0x11, 0xF9, 0x5E, 0x10, 0x8A, 0x3C, 0x4E, 0xA0, 0xD6, 0x6B, 0x8C,
|
||||
0x0E, 0x7B, 0xF1, 0x2B, 0x20, 0x9C, 0x68, 0x53, 0x43, 0x4B, 0x35, 0x30, 0x82, 0x01, 0xE0, 0x30,
|
||||
0x82, 0x01, 0x65, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x79, 0x28, 0x1A, 0xE8, 0x7F, 0x21,
|
||||
0x4F, 0xBB, 0x47, 0x2F, 0x74, 0x75, 0xE6, 0x98, 0x60, 0xD6, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
|
||||
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x21, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04,
|
||||
0x03, 0x0C, 0x16, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E,
|
||||
0x67, 0x50, 0x6F, 0x6C, 0x69, 0x63, 0x79, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30,
|
||||
0x38, 0x31, 0x35, 0x31, 0x37, 0x33, 0x32, 0x35, 0x34, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38,
|
||||
0x31, 0x35, 0x31, 0x37, 0x34, 0x32, 0x35, 0x34, 0x5A, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06,
|
||||
0x03, 0x55, 0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72,
|
||||
0x73, 0x69, 0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x30, 0x59, 0x30,
|
||||
0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x66, 0x41, 0xE6, 0x86, 0x7D, 0x5B, 0x96, 0x6C,
|
||||
0x99, 0x2A, 0x82, 0x53, 0x58, 0xA3, 0x6F, 0x59, 0xFC, 0x1C, 0x9F, 0xEB, 0xBE, 0x9D, 0x53, 0xBA,
|
||||
0x50, 0x0F, 0x66, 0xBC, 0xE5, 0x90, 0x7E, 0xAA, 0xA2, 0x6C, 0xC2, 0xC9, 0xAA, 0x99, 0x0B, 0x04,
|
||||
0xA0, 0x6A, 0xB4, 0xC1, 0xF7, 0x55, 0x60, 0x58, 0xE3, 0xDE, 0x22, 0x57, 0xB1, 0x8A, 0x5C, 0xBC,
|
||||
0xDF, 0x22, 0x8A, 0x2B, 0x04, 0x7D, 0x7A, 0x6C, 0xA3, 0x7E, 0x30, 0x7C, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x16, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x25, 0x04, 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
|
||||
0x4C, 0x09, 0x15, 0x01, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x08,
|
||||
0x30, 0x06, 0x01, 0x01, 0xFF, 0x02, 0x01, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04,
|
||||
0x18, 0x30, 0x16, 0x80, 0x14, 0x0B, 0x8A, 0xC7, 0xA8, 0x53, 0x07, 0x40, 0x74, 0x75, 0x0F, 0x85,
|
||||
0xCE, 0x5D, 0x5C, 0xC2, 0x23, 0x32, 0xC0, 0xFC, 0xC9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
|
||||
0x04, 0x16, 0x04, 0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40,
|
||||
0x3C, 0x3E, 0x9C, 0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x03, 0x69, 0x00, 0x30, 0x66, 0x02, 0x31, 0x00, 0xEE, 0x78, 0xDB, 0x74,
|
||||
0x56, 0xA3, 0xC2, 0x44, 0x25, 0x0F, 0xA1, 0x89, 0xC0, 0x76, 0xD1, 0xE4, 0xFE, 0xAA, 0xA4, 0xC3,
|
||||
0x7D, 0x40, 0xE3, 0x28, 0x1B, 0x0D, 0xAB, 0x32, 0x6B, 0x9A, 0x60, 0x37, 0x2F, 0xB6, 0xF4, 0xCB,
|
||||
0xEA, 0xC8, 0x65, 0xB6, 0xDC, 0x24, 0x90, 0x10, 0xFB, 0xD2, 0x42, 0x05, 0x02, 0x31, 0x00, 0x9E,
|
||||
0x91, 0xF9, 0x96, 0x8A, 0x41, 0x2C, 0x5E, 0x6B, 0xBC, 0x36, 0x05, 0x3B, 0x50, 0x11, 0x91, 0x9A,
|
||||
0xFA, 0x6B, 0x7F, 0x01, 0xF4, 0x6A, 0x7E, 0xCD, 0x98, 0x7E, 0x7D, 0xFD, 0xA8, 0xE3, 0xB2, 0x4F,
|
||||
0x71, 0x91, 0xF5, 0xE0, 0x82, 0xA5, 0xE7, 0x5A, 0xE8, 0x19, 0x09, 0xF6, 0x22, 0xBE, 0xC4, 0x30,
|
||||
0x82, 0x02, 0x01, 0x30, 0x82, 0x01, 0x62, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x41, 0x02,
|
||||
0xBA, 0xF9, 0x87, 0x65, 0x6C, 0xB8, 0x4C, 0xD9, 0xA1, 0x04, 0x1C, 0x46, 0x4F, 0xE4, 0x30, 0x0A,
|
||||
0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x1D, 0x31, 0x1B, 0x30, 0x19,
|
||||
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x12, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61,
|
||||
0x72, 0x73, 0x69, 0x6E, 0x67, 0x52, 0x6F, 0x6F, 0x74, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30,
|
||||
0x38, 0x31, 0x35, 0x31, 0x37, 0x32, 0x39, 0x32, 0x39, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38,
|
||||
0x31, 0x35, 0x31, 0x37, 0x33, 0x39, 0x32, 0x39, 0x5A, 0x30, 0x21, 0x31, 0x1F, 0x30, 0x1D, 0x06,
|
||||
0x03, 0x55, 0x04, 0x03, 0x0C, 0x16, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72,
|
||||
0x73, 0x69, 0x6E, 0x67, 0x50, 0x6F, 0x6C, 0x69, 0x63, 0x79, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10,
|
||||
0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22,
|
||||
0x03, 0x62, 0x00, 0x04, 0xF9, 0xDC, 0xB9, 0x3F, 0xA8, 0xB5, 0x2B, 0x2E, 0xA7, 0xFC, 0x88, 0xC6,
|
||||
0xEF, 0x9C, 0x36, 0x61, 0x3E, 0xFF, 0x8A, 0x5A, 0x52, 0xFF, 0x5A, 0xD0, 0x2C, 0x08, 0xD6, 0x73,
|
||||
0x12, 0xF9, 0x62, 0x1E, 0x73, 0x76, 0x83, 0x49, 0xC8, 0xDE, 0xEB, 0x29, 0xA4, 0x78, 0x2A, 0xC1,
|
||||
0x30, 0x11, 0x0B, 0x2F, 0x38, 0x00, 0xB7, 0x6B, 0x6B, 0x8E, 0x8C, 0x4B, 0x33, 0x09, 0xF1, 0xEA,
|
||||
0xA4, 0x9E, 0x10, 0x4F, 0xC3, 0xBC, 0x30, 0x16, 0x1A, 0x8B, 0xD7, 0x9C, 0x14, 0x11, 0x4E, 0x56,
|
||||
0x64, 0x7E, 0x51, 0xE7, 0xDA, 0x26, 0x40, 0xB0, 0xD0, 0xF8, 0xF2, 0xB2, 0x5D, 0x8C, 0x8B, 0x49,
|
||||
0x0C, 0x4E, 0x58, 0xB0, 0xA3, 0x63, 0x30, 0x61, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01,
|
||||
0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01,
|
||||
0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23,
|
||||
0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x04, 0xA6, 0xCD, 0x4D, 0xAE, 0x9C, 0x17, 0xDB, 0xC8, 0x13,
|
||||
0x57, 0x2D, 0x72, 0x48, 0xAC, 0xBB, 0x6B, 0x1F, 0xFF, 0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D,
|
||||
0x0E, 0x04, 0x16, 0x04, 0x14, 0x0B, 0x8A, 0xC7, 0xA8, 0x53, 0x07, 0x40, 0x74, 0x75, 0x0F, 0x85,
|
||||
0xCE, 0x5D, 0x5C, 0xC2, 0x23, 0x32, 0xC0, 0xFC, 0xC9, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48,
|
||||
0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x81, 0x8C, 0x00, 0x30, 0x81, 0x88, 0x02, 0x42, 0x01, 0xB4,
|
||||
0x75, 0x0B, 0x2F, 0x2A, 0xAA, 0x77, 0x03, 0x08, 0xD9, 0x95, 0x13, 0x2C, 0xE8, 0x47, 0x69, 0x97,
|
||||
0xD1, 0x6B, 0xE0, 0x23, 0x94, 0xD5, 0x34, 0x8F, 0x80, 0x20, 0xE3, 0x72, 0x07, 0x7C, 0x6A, 0x52,
|
||||
0xE6, 0xF2, 0xC7, 0x85, 0xBD, 0xB6, 0x65, 0x8F, 0x61, 0x73, 0xF9, 0xE7, 0x3A, 0x31, 0x46, 0xC6,
|
||||
0xF2, 0xCE, 0xA7, 0x9E, 0xD0, 0xE2, 0xEF, 0x07, 0x59, 0xD0, 0xF1, 0xC4, 0xF6, 0x58, 0x9A, 0x16,
|
||||
0x02, 0x42, 0x00, 0x86, 0xE0, 0x25, 0xC1, 0x48, 0xD0, 0x33, 0x30, 0x55, 0xA8, 0x60, 0x44, 0xCA,
|
||||
0x47, 0x04, 0x93, 0x46, 0x81, 0xE9, 0x13, 0xE9, 0x67, 0x26, 0x23, 0x2A, 0xBD, 0xEF, 0xC4, 0xCC,
|
||||
0x12, 0x99, 0xB3, 0x9E, 0x3D, 0x78, 0xC8, 0x42, 0x06, 0x40, 0x48, 0xCA, 0x3D, 0xCC, 0xD7, 0xA2,
|
||||
0x35, 0x37, 0x76, 0x12, 0xDB, 0x9C, 0x90, 0xA4, 0xE4, 0x16, 0xAC, 0x5E, 0xD8, 0x04, 0xF1, 0x59,
|
||||
0x66, 0x85, 0xE2, 0x68, 0x31, 0x81, 0xA2, 0x30, 0x81, 0x9F, 0x02, 0x01, 0x01, 0x30, 0x36, 0x30,
|
||||
0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74,
|
||||
0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E,
|
||||
0x67, 0x43, 0x41, 0x02, 0x10, 0x3E, 0xEE, 0x4B, 0xFB, 0x00, 0x35, 0xC8, 0x96, 0x41, 0xF4, 0xF6,
|
||||
0x57, 0x16, 0xAD, 0x20, 0xCB, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04,
|
||||
0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05,
|
||||
0x00, 0x04, 0x46, 0x30, 0x44, 0x02, 0x20, 0x52, 0x90, 0x02, 0x9E, 0xE8, 0xBF, 0xE8, 0x7E, 0x05,
|
||||
0x3B, 0xA3, 0x93, 0xDD, 0x6C, 0x35, 0x31, 0xA3, 0x29, 0x4F, 0x9A, 0x78, 0xEF, 0xD1, 0xAD, 0x07,
|
||||
0x37, 0x2D, 0x9A, 0x81, 0xFD, 0x7D, 0xFC, 0x02, 0x20, 0x4C, 0x8A, 0xA4, 0xBD, 0x63, 0x7B, 0x8A,
|
||||
0x2C, 0x9E, 0xFC, 0x2A, 0x0F, 0x91, 0xF4, 0x97, 0xB5, 0x3B, 0xC9, 0xD1, 0xCA, 0xEB, 0x02, 0x6A,
|
||||
0xB6, 0xFF, 0xE1, 0x15, 0xF5, 0xA2, 0x11, 0xF4, 0xD9,
|
||||
};
|
||||
|
||||
//
|
||||
// This signature was signed with a leaf that has no EKU's present in the certificate.
|
||||
//
|
||||
CONST UINT8 TestSignatureWithNoEKUsPresent[] =
|
||||
{
|
||||
0x30, 0x82, 0x07, 0xDB, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
|
||||
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x06, 0x51, 0x30, 0x82, 0x01, 0xE0, 0x30, 0x82, 0x01,
|
||||
0x65, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x79, 0x28, 0x1A, 0xE8, 0x7F, 0x21, 0x4F, 0xBB,
|
||||
0x47, 0x2F, 0x74, 0x75, 0xE6, 0x98, 0x60, 0xD6, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE,
|
||||
0x3D, 0x04, 0x03, 0x02, 0x30, 0x21, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x16, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x50,
|
||||
0x6F, 0x6C, 0x69, 0x63, 0x79, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38, 0x31,
|
||||
0x35, 0x31, 0x37, 0x33, 0x32, 0x35, 0x34, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38, 0x31, 0x35,
|
||||
0x31, 0x37, 0x34, 0x32, 0x35, 0x34, 0x5A, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55,
|
||||
0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69,
|
||||
0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06,
|
||||
0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03,
|
||||
0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x66, 0x41, 0xE6, 0x86, 0x7D, 0x5B, 0x96, 0x6C, 0x99, 0x2A,
|
||||
0x82, 0x53, 0x58, 0xA3, 0x6F, 0x59, 0xFC, 0x1C, 0x9F, 0xEB, 0xBE, 0x9D, 0x53, 0xBA, 0x50, 0x0F,
|
||||
0x66, 0xBC, 0xE5, 0x90, 0x7E, 0xAA, 0xA2, 0x6C, 0xC2, 0xC9, 0xAA, 0x99, 0x0B, 0x04, 0xA0, 0x6A,
|
||||
0xB4, 0xC1, 0xF7, 0x55, 0x60, 0x58, 0xE3, 0xDE, 0x22, 0x57, 0xB1, 0x8A, 0x5C, 0xBC, 0xDF, 0x22,
|
||||
0x8A, 0x2B, 0x04, 0x7D, 0x7A, 0x6C, 0xA3, 0x7E, 0x30, 0x7C, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D,
|
||||
0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1D,
|
||||
0x25, 0x04, 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09,
|
||||
0x15, 0x01, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x08, 0x30, 0x06,
|
||||
0x01, 0x01, 0xFF, 0x02, 0x01, 0x00, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30,
|
||||
0x16, 0x80, 0x14, 0x0B, 0x8A, 0xC7, 0xA8, 0x53, 0x07, 0x40, 0x74, 0x75, 0x0F, 0x85, 0xCE, 0x5D,
|
||||
0x5C, 0xC2, 0x23, 0x32, 0xC0, 0xFC, 0xC9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
|
||||
0x04, 0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40, 0x3C, 0x3E,
|
||||
0x9C, 0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04,
|
||||
0x03, 0x02, 0x03, 0x69, 0x00, 0x30, 0x66, 0x02, 0x31, 0x00, 0xEE, 0x78, 0xDB, 0x74, 0x56, 0xA3,
|
||||
0xC2, 0x44, 0x25, 0x0F, 0xA1, 0x89, 0xC0, 0x76, 0xD1, 0xE4, 0xFE, 0xAA, 0xA4, 0xC3, 0x7D, 0x40,
|
||||
0xE3, 0x28, 0x1B, 0x0D, 0xAB, 0x32, 0x6B, 0x9A, 0x60, 0x37, 0x2F, 0xB6, 0xF4, 0xCB, 0xEA, 0xC8,
|
||||
0x65, 0xB6, 0xDC, 0x24, 0x90, 0x10, 0xFB, 0xD2, 0x42, 0x05, 0x02, 0x31, 0x00, 0x9E, 0x91, 0xF9,
|
||||
0x96, 0x8A, 0x41, 0x2C, 0x5E, 0x6B, 0xBC, 0x36, 0x05, 0x3B, 0x50, 0x11, 0x91, 0x9A, 0xFA, 0x6B,
|
||||
0x7F, 0x01, 0xF4, 0x6A, 0x7E, 0xCD, 0x98, 0x7E, 0x7D, 0xFD, 0xA8, 0xE3, 0xB2, 0x4F, 0x71, 0x91,
|
||||
0xF5, 0xE0, 0x82, 0xA5, 0xE7, 0x5A, 0xE8, 0x19, 0x09, 0xF6, 0x22, 0xBE, 0xC4, 0x30, 0x82, 0x02,
|
||||
0x01, 0x30, 0x82, 0x01, 0x62, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x41, 0x02, 0xBA, 0xF9,
|
||||
0x87, 0x65, 0x6C, 0xB8, 0x4C, 0xD9, 0xA1, 0x04, 0x1C, 0x46, 0x4F, 0xE4, 0x30, 0x0A, 0x06, 0x08,
|
||||
0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x1D, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x0C, 0x12, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73,
|
||||
0x69, 0x6E, 0x67, 0x52, 0x6F, 0x6F, 0x74, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38, 0x31,
|
||||
0x35, 0x31, 0x37, 0x32, 0x39, 0x32, 0x39, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38, 0x31, 0x35,
|
||||
0x31, 0x37, 0x33, 0x39, 0x32, 0x39, 0x5A, 0x30, 0x21, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55,
|
||||
0x04, 0x03, 0x0C, 0x16, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69,
|
||||
0x6E, 0x67, 0x50, 0x6F, 0x6C, 0x69, 0x63, 0x79, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07,
|
||||
0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62,
|
||||
0x00, 0x04, 0xF9, 0xDC, 0xB9, 0x3F, 0xA8, 0xB5, 0x2B, 0x2E, 0xA7, 0xFC, 0x88, 0xC6, 0xEF, 0x9C,
|
||||
0x36, 0x61, 0x3E, 0xFF, 0x8A, 0x5A, 0x52, 0xFF, 0x5A, 0xD0, 0x2C, 0x08, 0xD6, 0x73, 0x12, 0xF9,
|
||||
0x62, 0x1E, 0x73, 0x76, 0x83, 0x49, 0xC8, 0xDE, 0xEB, 0x29, 0xA4, 0x78, 0x2A, 0xC1, 0x30, 0x11,
|
||||
0x0B, 0x2F, 0x38, 0x00, 0xB7, 0x6B, 0x6B, 0x8E, 0x8C, 0x4B, 0x33, 0x09, 0xF1, 0xEA, 0xA4, 0x9E,
|
||||
0x10, 0x4F, 0xC3, 0xBC, 0x30, 0x16, 0x1A, 0x8B, 0xD7, 0x9C, 0x14, 0x11, 0x4E, 0x56, 0x64, 0x7E,
|
||||
0x51, 0xE7, 0xDA, 0x26, 0x40, 0xB0, 0xD0, 0xF8, 0xF2, 0xB2, 0x5D, 0x8C, 0x8B, 0x49, 0x0C, 0x4E,
|
||||
0x58, 0xB0, 0xA3, 0x63, 0x30, 0x61, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF,
|
||||
0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF,
|
||||
0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18,
|
||||
0x30, 0x16, 0x80, 0x14, 0x04, 0xA6, 0xCD, 0x4D, 0xAE, 0x9C, 0x17, 0xDB, 0xC8, 0x13, 0x57, 0x2D,
|
||||
0x72, 0x48, 0xAC, 0xBB, 0x6B, 0x1F, 0xFF, 0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04,
|
||||
0x16, 0x04, 0x14, 0x0B, 0x8A, 0xC7, 0xA8, 0x53, 0x07, 0x40, 0x74, 0x75, 0x0F, 0x85, 0xCE, 0x5D,
|
||||
0x5C, 0xC2, 0x23, 0x32, 0xC0, 0xFC, 0xC9, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
|
||||
0x04, 0x03, 0x02, 0x03, 0x81, 0x8C, 0x00, 0x30, 0x81, 0x88, 0x02, 0x42, 0x01, 0xB4, 0x75, 0x0B,
|
||||
0x2F, 0x2A, 0xAA, 0x77, 0x03, 0x08, 0xD9, 0x95, 0x13, 0x2C, 0xE8, 0x47, 0x69, 0x97, 0xD1, 0x6B,
|
||||
0xE0, 0x23, 0x94, 0xD5, 0x34, 0x8F, 0x80, 0x20, 0xE3, 0x72, 0x07, 0x7C, 0x6A, 0x52, 0xE6, 0xF2,
|
||||
0xC7, 0x85, 0xBD, 0xB6, 0x65, 0x8F, 0x61, 0x73, 0xF9, 0xE7, 0x3A, 0x31, 0x46, 0xC6, 0xF2, 0xCE,
|
||||
0xA7, 0x9E, 0xD0, 0xE2, 0xEF, 0x07, 0x59, 0xD0, 0xF1, 0xC4, 0xF6, 0x58, 0x9A, 0x16, 0x02, 0x42,
|
||||
0x00, 0x86, 0xE0, 0x25, 0xC1, 0x48, 0xD0, 0x33, 0x30, 0x55, 0xA8, 0x60, 0x44, 0xCA, 0x47, 0x04,
|
||||
0x93, 0x46, 0x81, 0xE9, 0x13, 0xE9, 0x67, 0x26, 0x23, 0x2A, 0xBD, 0xEF, 0xC4, 0xCC, 0x12, 0x99,
|
||||
0xB3, 0x9E, 0x3D, 0x78, 0xC8, 0x42, 0x06, 0x40, 0x48, 0xCA, 0x3D, 0xCC, 0xD7, 0xA2, 0x35, 0x37,
|
||||
0x76, 0x12, 0xDB, 0x9C, 0x90, 0xA4, 0xE4, 0x16, 0xAC, 0x5E, 0xD8, 0x04, 0xF1, 0x59, 0x66, 0x85,
|
||||
0xE2, 0x68, 0x30, 0x82, 0x02, 0x64, 0x30, 0x82, 0x02, 0x0A, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02,
|
||||
0x10, 0x2B, 0x7B, 0xDA, 0xCD, 0x87, 0xA0, 0xFD, 0x81, 0x49, 0x5E, 0x0E, 0xDD, 0x4F, 0x81, 0x48,
|
||||
0x2D, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x22, 0x31,
|
||||
0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B,
|
||||
0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43,
|
||||
0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30, 0x38, 0x32, 0x33, 0x31, 0x39, 0x33, 0x30, 0x30,
|
||||
0x32, 0x5A, 0x17, 0x0D, 0x33, 0x38, 0x30, 0x38, 0x32, 0x33, 0x31, 0x39, 0x34, 0x30, 0x30, 0x32,
|
||||
0x5A, 0x30, 0x27, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x1C, 0x54, 0x65,
|
||||
0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69, 0x6E, 0x67, 0x4E, 0x6F, 0x45, 0x4B,
|
||||
0x55, 0x73, 0x49, 0x6E, 0x53, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D,
|
||||
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,
|
||||
0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xA5, 0x9B, 0x95, 0xF0, 0x63,
|
||||
0x88, 0xC3, 0x74, 0x26, 0x08, 0x68, 0x25, 0xAA, 0x16, 0xBB, 0x2A, 0x15, 0xC1, 0xA2, 0xAF, 0x72,
|
||||
0x06, 0x51, 0x37, 0xE1, 0x4F, 0x6D, 0x6A, 0xFC, 0x17, 0xCE, 0x82, 0x7B, 0x79, 0xFF, 0x2A, 0x84,
|
||||
0x0F, 0xCB, 0xA9, 0x65, 0x70, 0xC9, 0xF9, 0xE7, 0x61, 0x90, 0x28, 0x03, 0x6E, 0x41, 0x25, 0xFF,
|
||||
0xC2, 0x3A, 0x60, 0x1A, 0x42, 0x37, 0x80, 0x9F, 0x6B, 0x99, 0x11, 0x5A, 0x1F, 0xAE, 0x7B, 0x3F,
|
||||
0xF3, 0x2B, 0x45, 0xDD, 0xDA, 0xC4, 0x32, 0xD7, 0xD8, 0xB5, 0x3D, 0x46, 0x0C, 0x8A, 0x11, 0xEE,
|
||||
0x94, 0x8C, 0xB5, 0x69, 0xD3, 0x91, 0x4F, 0x4E, 0xE5, 0xBB, 0x93, 0xDD, 0x1E, 0xA7, 0x20, 0x03,
|
||||
0xFD, 0xD6, 0x8F, 0x76, 0x91, 0x9A, 0x2B, 0x41, 0x91, 0xD8, 0x35, 0x7A, 0x0D, 0x80, 0xB9, 0xD4,
|
||||
0xD2, 0x56, 0xF1, 0xF9, 0xC5, 0xE6, 0xF2, 0xAE, 0x10, 0x7E, 0xD7, 0x6C, 0x40, 0x86, 0x37, 0x99,
|
||||
0x85, 0xF4, 0xCA, 0x1D, 0x6D, 0x90, 0x63, 0xF7, 0x63, 0xC6, 0x00, 0xA1, 0xA9, 0x79, 0x7D, 0x88,
|
||||
0x05, 0xA2, 0x92, 0x64, 0xA7, 0x8E, 0xA8, 0x9E, 0xC3, 0x1F, 0x63, 0xEE, 0x6C, 0xE3, 0x9B, 0xA6,
|
||||
0xD7, 0x9D, 0x9C, 0x9F, 0x0D, 0x7A, 0xF7, 0x00, 0x92, 0x16, 0xE8, 0x64, 0x36, 0x07, 0x66, 0x8E,
|
||||
0x6E, 0x51, 0x09, 0x3F, 0x2A, 0xD6, 0x6D, 0x4E, 0xCC, 0x49, 0xE1, 0xC3, 0x59, 0x63, 0xDC, 0x51,
|
||||
0xAA, 0xD1, 0xE7, 0x42, 0x2F, 0x72, 0x25, 0x46, 0x83, 0x7D, 0x23, 0xCE, 0xF7, 0x96, 0x2F, 0x04,
|
||||
0xE8, 0xAE, 0xF6, 0x19, 0x6D, 0x2D, 0xB2, 0x64, 0xDB, 0x69, 0x33, 0x96, 0x58, 0xA0, 0x6C, 0x77,
|
||||
0xF0, 0xD0, 0x5E, 0x36, 0xB1, 0x28, 0x89, 0x83, 0xB6, 0xA5, 0x13, 0x0E, 0x6B, 0x6E, 0x73, 0x2C,
|
||||
0x6F, 0xDA, 0xF9, 0x6C, 0x11, 0x4F, 0xCC, 0xF7, 0x89, 0x77, 0x83, 0x02, 0x03, 0x01, 0x00, 0x01,
|
||||
0xA3, 0x52, 0x30, 0x50, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04,
|
||||
0x03, 0x02, 0x01, 0x86, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
|
||||
0x14, 0xA4, 0x21, 0xA5, 0x99, 0x40, 0x41, 0xF7, 0x1B, 0xFF, 0x35, 0xD0, 0x40, 0x3C, 0x3E, 0x9C,
|
||||
0x7C, 0xD1, 0xCC, 0xD1, 0xD1, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14,
|
||||
0xB6, 0xAF, 0x0D, 0xC1, 0xBE, 0xD1, 0xE4, 0x21, 0x37, 0xFF, 0xAC, 0x7D, 0x2D, 0xD4, 0x51, 0x8A,
|
||||
0x61, 0x95, 0x50, 0x7F, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02,
|
||||
0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x74, 0x7D, 0xF5, 0xAF, 0xC3, 0xA7, 0x06, 0x99, 0x1F,
|
||||
0x2C, 0xAF, 0x69, 0xAA, 0x40, 0x97, 0xE9, 0xF8, 0x4C, 0xD2, 0x71, 0x17, 0x25, 0x85, 0xB7, 0xA6,
|
||||
0x97, 0x61, 0x89, 0x82, 0xED, 0xF0, 0xF6, 0x02, 0x21, 0x00, 0xA6, 0xF4, 0x59, 0x85, 0x53, 0x31,
|
||||
0xEF, 0x6F, 0x37, 0xB6, 0x8E, 0xA2, 0xDE, 0xC3, 0xFD, 0xD6, 0xFB, 0x50, 0x63, 0x4E, 0xB4, 0xBB,
|
||||
0xC1, 0xB1, 0x07, 0x82, 0x80, 0x14, 0x28, 0x6A, 0x94, 0x94, 0x31, 0x82, 0x01, 0x61, 0x30, 0x82,
|
||||
0x01, 0x5D, 0x02, 0x01, 0x01, 0x30, 0x36, 0x30, 0x22, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55,
|
||||
0x04, 0x03, 0x0C, 0x17, 0x54, 0x65, 0x73, 0x74, 0x45, 0x4B, 0x55, 0x50, 0x61, 0x72, 0x73, 0x69,
|
||||
0x6E, 0x67, 0x49, 0x73, 0x73, 0x75, 0x69, 0x6E, 0x67, 0x43, 0x41, 0x02, 0x10, 0x2B, 0x7B, 0xDA,
|
||||
0xCD, 0x87, 0xA0, 0xFD, 0x81, 0x49, 0x5E, 0x0E, 0xDD, 0x4F, 0x81, 0x48, 0x2D, 0x30, 0x0D, 0x06,
|
||||
0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0D, 0x06, 0x09,
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00, 0x39,
|
||||
0xEC, 0xA8, 0x00, 0x4F, 0x7E, 0x2C, 0x3C, 0x48, 0xDF, 0x6F, 0x6A, 0x37, 0x69, 0xA4, 0xB1, 0xEB,
|
||||
0x7D, 0xD2, 0x3B, 0xC5, 0xEE, 0x57, 0x1F, 0x8F, 0xCA, 0x60, 0x80, 0x88, 0x24, 0x29, 0xB5, 0x00,
|
||||
0x28, 0xFF, 0x8F, 0x0A, 0x1E, 0xB0, 0x9E, 0x90, 0x09, 0xF1, 0x46, 0xC1, 0x53, 0xE8, 0x27, 0x29,
|
||||
0xFA, 0xFE, 0xA3, 0x84, 0x79, 0xB2, 0x27, 0x46, 0x9B, 0xD8, 0x33, 0xBD, 0x8F, 0x41, 0x06, 0xEE,
|
||||
0xD6, 0xE7, 0x49, 0xAF, 0x48, 0xD0, 0xD4, 0xF1, 0x06, 0xCC, 0xD3, 0x26, 0x47, 0xAE, 0x03, 0x7A,
|
||||
0xA5, 0xAF, 0xDE, 0x7F, 0x57, 0x32, 0x51, 0x49, 0x8C, 0x18, 0xD2, 0x4D, 0x50, 0x27, 0xAC, 0x7C,
|
||||
0x33, 0xB8, 0xB8, 0x1C, 0xF8, 0x0C, 0x49, 0xEB, 0xF5, 0xD7, 0xA0, 0x35, 0x77, 0x61, 0xC0, 0x60,
|
||||
0xAF, 0x23, 0x8C, 0xCC, 0xB0, 0x58, 0xB3, 0x08, 0x89, 0x2B, 0xC0, 0x61, 0x0C, 0xA6, 0x40, 0x7A,
|
||||
0x37, 0x6D, 0x6D, 0x44, 0xFF, 0xF1, 0xCE, 0xDE, 0x7A, 0x0C, 0xC4, 0x51, 0x61, 0xE6, 0x72, 0x6B,
|
||||
0xA9, 0x6A, 0x7B, 0xCF, 0xAA, 0x9A, 0x28, 0x74, 0x87, 0x30, 0xBA, 0xED, 0x40, 0xF0, 0x75, 0x2B,
|
||||
0xD7, 0xE6, 0x9F, 0xDD, 0x6B, 0xB7, 0xEA, 0x08, 0x0D, 0x9F, 0xA3, 0x25, 0x27, 0xB7, 0xBF, 0x41,
|
||||
0xC2, 0x64, 0xB5, 0x6F, 0x8F, 0xB1, 0x5F, 0xE5, 0xDF, 0xCA, 0x16, 0x04, 0x61, 0xFF, 0x74, 0x25,
|
||||
0xEE, 0xF6, 0x69, 0xF1, 0x7F, 0xE5, 0x97, 0x72, 0x58, 0xD8, 0x9F, 0xA5, 0x19, 0x32, 0x46, 0x95,
|
||||
0x67, 0x63, 0x23, 0x54, 0x46, 0x05, 0x15, 0xC3, 0x3E, 0x04, 0x7E, 0x88, 0xD0, 0xB5, 0x52, 0xF0,
|
||||
0x38, 0x3C, 0x8B, 0xD4, 0x3D, 0x9A, 0x55, 0x1B, 0x14, 0xE5, 0x37, 0x8D, 0xB7, 0x6C, 0x39, 0x91,
|
||||
0x23, 0x31, 0x63, 0x89, 0x7C, 0x75, 0x02, 0x79, 0xCC, 0x95, 0x58, 0x99, 0x3A, 0xDB, 0xF5,
|
||||
};
|
524
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
Normal file
524
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
Normal file
@ -0,0 +1,524 @@
|
||||
/** @file -- Pkcs7EkuVerify.c
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
This is an test code which verifies specified
|
||||
Enhanced Key Usages (EKU)'s are present in the leaf signer
|
||||
of a PKCS7 formatted signature.
|
||||
|
||||
|
||||
A typical signing certificate chain looks like this: (Could be RSA or ECC).
|
||||
|
||||
------------------------------------------
|
||||
| | // Root of trust. ECDSA P521 curve
|
||||
| TestEKUParsingRoot | // SHA 256 Key Usage: CERT_DIGITAL_SIGNATURE_KEY_USAGE
|
||||
| | // CERT_KEY_CERT_SIGN_KEY_USAGE | CERT_CRL_SIGN_KEY_USAGE
|
||||
------------------------------------------
|
||||
^
|
||||
|
|
||||
------------------------------------------
|
||||
| | // Policy CA. Issues subordinate CAs. ECC P384 curve.
|
||||
| TestEKUParsingPolicyCA | // SHA 256 Key Usage:
|
||||
| | // CERT_KEY_CERT_SIGN_KEY_USAGE | CERT_CRL_SIGN_KEY_USAGE
|
||||
------------------------------------------
|
||||
^
|
||||
|
|
||||
------------------------------------------
|
||||
| | // Issues end-entity (leaf) signers. ECC P256 curve.
|
||||
| TestEKUParsingIssuingCA | // SHA 256 Key Usage: CERT_DIGITAL_SIGNATURE_KEY_USAGE
|
||||
| | // Enhanced Key Usage:
|
||||
------------------------------------------ // 1.3.6.1.4.1.311.76.9.21.1 (Surface firmware signing)
|
||||
^
|
||||
|
|
||||
--------------------------------------
|
||||
/ TestEKUParsingLeafSigner && / // Leaf signer, ECC P256 curve.
|
||||
/ TestEKUParsingLeafSignerPid12345 / // SHA 256 Key Usage: CERT_DIGITAL_SIGNATURE_KEY_USAGE
|
||||
/ / // Enhanced Key usages:
|
||||
-------------------------------------- // 1.3.6.1.4.1.311.76.9.21.1 (Surface firmware signing)
|
||||
// 1.3.6.1.4.1.311.76.9.21.1.N, N == Product ID.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
#include "Pkcs7EkuTestSignatures.h"
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VerifyEKUsInPkcs7Signature (
|
||||
IN CONST UINT8 *Pkcs7Signature,
|
||||
IN CONST UINT32 SignatureSize,
|
||||
IN CONST CHAR8 *RequiredEKUs[],
|
||||
IN CONST UINT32 RequiredEKUsSize,
|
||||
IN BOOLEAN RequireAllPresent
|
||||
);
|
||||
|
||||
///================================================================================================
|
||||
///================================================================================================
|
||||
///
|
||||
/// TEST CASES
|
||||
///
|
||||
///================================================================================================
|
||||
///================================================================================================
|
||||
|
||||
CONST CHAR8 FIRMWARE_SIGNER_EKU[] = "1.3.6.1.4.1.311.76.9.21.1";
|
||||
|
||||
|
||||
/**
|
||||
TestVerifyEKUsInSignature()
|
||||
|
||||
Verify that "1.3.6.1.4.1.311.76.9.21.1" (Firmware signature) is in the
|
||||
leaf signer certificate.
|
||||
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyEKUsInSignature (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(ProductionECCSignature,
|
||||
ARRAY_SIZE(ProductionECCSignature),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestVerifyEKUsInSignature()
|
||||
|
||||
|
||||
/**
|
||||
TestVerifyEKUsWith3CertsInSignature()
|
||||
|
||||
This PKCS7 signature has 3 certificates in it. (Policy CA, Issuing CA
|
||||
and leaf signer). It has one firmware signing EKU in it.
|
||||
"1.3.6.1.4.1.311.76.9.21.1"
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyEKUsWith3CertsInSignature (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignEKUsWith3CertsInSignature,
|
||||
ARRAY_SIZE(TestSignEKUsWith3CertsInSignature),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestVerifyEKUsWith3CertsInSignature()
|
||||
|
||||
/**
|
||||
TestVerifyEKUsWith2CertsInSignature()
|
||||
|
||||
This PKCS7 signature has 2 certificates in it. (Issuing CA and leaf signer).
|
||||
It has one firmware signing EKU in it. "1.3.6.1.4.1.311.76.9.21.1"
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyEKUsWith2CertsInSignature (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignEKUsWith2CertsInSignature,
|
||||
ARRAY_SIZE(TestSignEKUsWith2CertsInSignature),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestVerifyEKUsWith2CertsInSignature()
|
||||
|
||||
|
||||
/**
|
||||
TestVerifyEKUsWith1CertInSignature()
|
||||
|
||||
This PKCS7 signature only has the leaf signer in it.
|
||||
It has one firmware signing EKU in it. "1.3.6.1.4.1.311.76.9.21.1"
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyEKUsWith1CertInSignature (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignEKUsWith1CertInSignature,
|
||||
ARRAY_SIZE(TestSignEKUsWith1CertInSignature),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestVerifyEKUsWith1CertInSignature()
|
||||
|
||||
|
||||
/**
|
||||
TestVerifyEKUsWithMultipleEKUsInCert()
|
||||
|
||||
|
||||
This signature has two EKU's in it:
|
||||
"1.3.6.1.4.1.311.76.9.21.1"
|
||||
"1.3.6.1.4.1.311.76.9.21.2"
|
||||
We verify that both EKU's were present in the leaf signer.
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyEKUsWithMultipleEKUsInCert (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1",
|
||||
"1.3.6.1.4.1.311.76.9.21.1.2" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignedWithMultipleEKUsInCert,
|
||||
ARRAY_SIZE(TestSignedWithMultipleEKUsInCert),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestVerifyEKUsWithMultipleEKUsInCert()
|
||||
|
||||
|
||||
/**
|
||||
TestEkusNotPresentInSignature()
|
||||
|
||||
This test verifies that if we send an EKU that is not in the signature,
|
||||
that we get back an error.
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestEkusNotPresentInSignature (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// This EKU is not in the signature.
|
||||
//
|
||||
CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.3" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignedWithMultipleEKUsInCert,
|
||||
ARRAY_SIZE(TestSignedWithMultipleEKUsInCert),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestEkusNotPresentInSignature()
|
||||
|
||||
/**
|
||||
TestEkusNotPresentInSignature()
|
||||
|
||||
This test signature has two EKU's in it: (Product ID is 10001)
|
||||
"1.3.6.1.4.1.311.76.9.21.1"
|
||||
"1.3.6.1.4.1.311.76.9.21.1.10001"
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestProductId10001PresentInSignature(
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// These EKU's are present in the leaf signer certificate.
|
||||
//
|
||||
CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1",
|
||||
"1.3.6.1.4.1.311.76.9.21.1.10001" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
|
||||
ARRAY_SIZE(TestSignedWithProductId10001),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestProductId10001PresentInSignature()
|
||||
|
||||
|
||||
/**
|
||||
TestOnlyOneEkuInListRequired()
|
||||
|
||||
This test will check the BOOLEAN RequireAllPresent parameter in the
|
||||
call to VerifyEKUsInPkcs7Signature() behaves properly. The signature
|
||||
has two EKU's in it:
|
||||
|
||||
"1.3.6.1.4.1.311.76.9.21.1"
|
||||
"1.3.6.1.4.1.311.76.9.21.1.10001"
|
||||
|
||||
but we only pass in one of them, and set RequireAllPresent to FALSE.
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestOnlyOneEkuInListRequired(
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// This will test the flag that specifies it is OK to succeed if
|
||||
// any one of the EKU's passed in is found.
|
||||
//
|
||||
CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1.10001" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
|
||||
ARRAY_SIZE(TestSignedWithProductId10001),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
FALSE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestOnlyOneEkuInListRequired()
|
||||
|
||||
/**
|
||||
TestNoEKUsInSignature()
|
||||
|
||||
This test uses a signature that was signed with a certificate that does
|
||||
not contain any EKUs.
|
||||
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestNoEKUsInSignature(
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// This EKU is not in the certificate, so it should fail.
|
||||
//
|
||||
CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignatureWithNoEKUsPresent,
|
||||
ARRAY_SIZE(TestSignatureWithNoEKUsPresent),
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestNoEKUsInSignature()
|
||||
|
||||
|
||||
/**
|
||||
TestInvalidParameters()
|
||||
|
||||
Passes the API invalid parameters, and ensures that it does not succeed.
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestInvalidParameters(
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1" };
|
||||
|
||||
//
|
||||
// Check bad signature.
|
||||
//
|
||||
Status = VerifyEKUsInPkcs7Signature(NULL,
|
||||
0,
|
||||
(CONST CHAR8**)RequiredEKUs,
|
||||
ARRAY_SIZE(RequiredEKUs),
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_INVALID_PARAMETER);
|
||||
|
||||
//
|
||||
// Check invalid EKU's
|
||||
//
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignatureWithNoEKUsPresent,
|
||||
ARRAY_SIZE(TestSignatureWithNoEKUsPresent),
|
||||
(CONST CHAR8**)NULL,
|
||||
0,
|
||||
TRUE);
|
||||
UT_ASSERT_STATUS_EQUAL (Status, EFI_INVALID_PARAMETER);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestInvalidParameters()
|
||||
|
||||
|
||||
/**
|
||||
TestEKUSubStringFails()
|
||||
|
||||
Pass the API a sub set and super set of an EKU and ensure that they
|
||||
don't pass.
|
||||
|
||||
@param[in] Framework - Unit-test framework handle.
|
||||
@param[in] Context - Optional context pointer for this test.
|
||||
|
||||
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
|
||||
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
|
||||
**/
|
||||
static
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestEKUSubsetSupersetFails(
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// This signature has an EKU of:
|
||||
// "1.3.6.1.4.1.311.76.9.21.1.10001"
|
||||
// so ensure that
|
||||
// "1.3.6.1.4.1.311.76.9.21"
|
||||
// does not pass.
|
||||
//
|
||||
CONST CHAR8* RequiredEKUs1[] = { "1.3.6.1.4.1.311.76.9.21" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
|
||||
ARRAY_SIZE(TestSignedWithProductId10001),
|
||||
(CONST CHAR8**)RequiredEKUs1,
|
||||
ARRAY_SIZE(RequiredEKUs1),
|
||||
TRUE);
|
||||
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
//
|
||||
// This signature has an EKU of:
|
||||
// "1.3.6.1.4.1.311.76.9.21.1.10001"
|
||||
// so ensure that a super set
|
||||
// "1.3.6.1.4.1.311.76.9.21.1.10001.1"
|
||||
// does not pass.
|
||||
//
|
||||
CONST CHAR8* RequiredEKUs2[] = { "1.3.6.1.4.1.311.76.9.21.1.10001.1" };
|
||||
|
||||
Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
|
||||
ARRAY_SIZE(TestSignedWithProductId10001),
|
||||
(CONST CHAR8**)RequiredEKUs2,
|
||||
ARRAY_SIZE(RequiredEKUs2),
|
||||
TRUE);
|
||||
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}// TestEKUSubsetSupersetFails()
|
||||
|
||||
TEST_DESC mPkcs7EkuTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------Class----------------------------Function------------------------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyEKUsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsInSignature, NULL, NULL, NULL},
|
||||
{"TestVerifyEKUsWith3CertsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith3CertsInSignature, NULL, NULL, NULL},
|
||||
{"TestVerifyEKUsWith2CertsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith2CertsInSignature, NULL, NULL, NULL},
|
||||
{"TestVerifyEKUsWith1CertInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith1CertInSignature, NULL, NULL, NULL},
|
||||
{"TestVerifyEKUsWithMultipleEKUsInCert()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWithMultipleEKUsInCert, NULL, NULL, NULL},
|
||||
{"TestEkusNotPresentInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestEkusNotPresentInSignature, NULL, NULL, NULL},
|
||||
{"TestProductId10001PresentInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestProductId10001PresentInSignature, NULL, NULL, NULL},
|
||||
{"TestOnlyOneEkuInListRequired()", "CryptoPkg.BaseCryptLib.Eku", TestOnlyOneEkuInListRequired, NULL, NULL, NULL},
|
||||
{"TestNoEKUsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestNoEKUsInSignature, NULL, NULL, NULL},
|
||||
{"TestInvalidParameters()", "CryptoPkg.BaseCryptLib.Eku", TestInvalidParameters, NULL, NULL, NULL},
|
||||
{"TestEKUSubsetSupersetFails()", "CryptoPkg.BaseCryptLib.Eku", TestEKUSubsetSupersetFails, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mPkcs7EkuTestNum = ARRAY_SIZE(mPkcs7EkuTest);
|
51
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
Normal file
51
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
Normal file
@ -0,0 +1,51 @@
|
||||
/** @file
|
||||
Application for Pseudorandom Number Generator Validation.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
#define RANDOM_NUMBER_SIZE 256
|
||||
|
||||
CONST UINT8 SeedString[] = "This is the random seed for PRNG verification.";
|
||||
|
||||
UINT8 PreviousRandomBuffer[RANDOM_NUMBER_SIZE] = { 0x0 };
|
||||
|
||||
UINT8 RandomBuffer[RANDOM_NUMBER_SIZE] = { 0x0 };
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyPrngGeneration (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
BOOLEAN Status;
|
||||
|
||||
Status = RandomSeed (SeedString, sizeof (SeedString));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
for (Index = 0; Index < 10; Index ++) {
|
||||
Status = RandomBytes (RandomBuffer, RANDOM_NUMBER_SIZE);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = (CompareMem (PreviousRandomBuffer, RandomBuffer, RANDOM_NUMBER_SIZE) == 0);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
CopyMem (PreviousRandomBuffer, RandomBuffer, RANDOM_NUMBER_SIZE);
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mPrngTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------Class--------------------Function----------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyPrngGeneration()", "CryptoPkg.BaseCryptLib.Prng", TestVerifyPrngGeneration, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mPrngTestNum = ARRAY_SIZE(mPrngTest);
|
415
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
Normal file
415
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
Normal file
@ -0,0 +1,415 @@
|
||||
/** @file
|
||||
Application for RSA Key Retrieving (from PEM and X509) & Signature Validation.
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
|
||||
//
|
||||
// Password-protected PEM Key data for RSA Private Key Retrieving (encryption key is "client").
|
||||
// (Generated by OpenSSL utility).
|
||||
// $ openssl genrsa -aes256 -out TestKeyPem -passout pass:client 1024
|
||||
// password should match PemPass in this file
|
||||
// $ xxd --include TestKeyPem
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestKeyPem[] = {
|
||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
|
||||
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
|
||||
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x50, 0x72, 0x6f, 0x63,
|
||||
0x2d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x34, 0x2c, 0x45, 0x4e, 0x43,
|
||||
0x52, 0x59, 0x50, 0x54, 0x45, 0x44, 0x0a, 0x44, 0x45, 0x4b, 0x2d, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x3a, 0x20, 0x41, 0x45, 0x53, 0x2d, 0x32, 0x35, 0x36,
|
||||
0x2d, 0x43, 0x42, 0x43, 0x2c, 0x34, 0x42, 0x44, 0x31, 0x30, 0x45, 0x39,
|
||||
0x35, 0x42, 0x38, 0x33, 0x39, 0x42, 0x30, 0x44, 0x33, 0x35, 0x36, 0x31,
|
||||
0x38, 0x41, 0x44, 0x36, 0x45, 0x46, 0x44, 0x36, 0x34, 0x32, 0x34, 0x44,
|
||||
0x36, 0x0a, 0x0a, 0x42, 0x50, 0x39, 0x49, 0x32, 0x42, 0x30, 0x6c, 0x50,
|
||||
0x7a, 0x4c, 0x50, 0x50, 0x38, 0x2f, 0x4b, 0x71, 0x35, 0x34, 0x2f, 0x56,
|
||||
0x68, 0x75, 0x4b, 0x35, 0x5a, 0x63, 0x72, 0x32, 0x55, 0x6c, 0x32, 0x75,
|
||||
0x43, 0x57, 0x4a, 0x62, 0x59, 0x33, 0x50, 0x77, 0x39, 0x6e, 0x4c, 0x6d,
|
||||
0x45, 0x41, 0x6a, 0x47, 0x74, 0x4a, 0x68, 0x57, 0x46, 0x66, 0x50, 0x47,
|
||||
0x38, 0x62, 0x6d, 0x41, 0x6f, 0x73, 0x56, 0x0a, 0x47, 0x76, 0x42, 0x30,
|
||||
0x6d, 0x2b, 0x7a, 0x5a, 0x43, 0x2b, 0x30, 0x6c, 0x57, 0x6c, 0x72, 0x59,
|
||||
0x7a, 0x51, 0x4b, 0x6a, 0x57, 0x79, 0x44, 0x6e, 0x4d, 0x58, 0x72, 0x33,
|
||||
0x51, 0x39, 0x69, 0x57, 0x32, 0x4b, 0x33, 0x68, 0x4d, 0x6b, 0x71, 0x51,
|
||||
0x4c, 0x31, 0x68, 0x65, 0x71, 0x52, 0x66, 0x66, 0x74, 0x47, 0x57, 0x51,
|
||||
0x5a, 0x36, 0x78, 0x4e, 0x6a, 0x72, 0x30, 0x7a, 0x6f, 0x51, 0x59, 0x73,
|
||||
0x0a, 0x34, 0x76, 0x69, 0x55, 0x46, 0x72, 0x7a, 0x2b, 0x52, 0x76, 0x4b,
|
||||
0x43, 0x2f, 0x33, 0x69, 0x71, 0x57, 0x59, 0x78, 0x55, 0x35, 0x4c, 0x6a,
|
||||
0x45, 0x74, 0x63, 0x5a, 0x4f, 0x2b, 0x53, 0x6d, 0x39, 0x42, 0x4c, 0x62,
|
||||
0x66, 0x58, 0x49, 0x71, 0x56, 0x72, 0x53, 0x6a, 0x54, 0x79, 0x58, 0x49,
|
||||
0x39, 0x70, 0x76, 0x78, 0x6f, 0x67, 0x50, 0x39, 0x38, 0x6b, 0x2b, 0x6c,
|
||||
0x41, 0x66, 0x37, 0x47, 0x36, 0x0a, 0x75, 0x39, 0x2b, 0x30, 0x31, 0x4d,
|
||||
0x47, 0x5a, 0x69, 0x36, 0x6b, 0x53, 0x73, 0x67, 0x48, 0x57, 0x7a, 0x43,
|
||||
0x41, 0x49, 0x51, 0x75, 0x38, 0x72, 0x6a, 0x4d, 0x34, 0x65, 0x74, 0x64,
|
||||
0x50, 0x62, 0x4a, 0x49, 0x77, 0x34, 0x65, 0x47, 0x6f, 0x32, 0x45, 0x49,
|
||||
0x44, 0x45, 0x54, 0x61, 0x52, 0x70, 0x73, 0x76, 0x47, 0x6a, 0x54, 0x6f,
|
||||
0x30, 0x51, 0x56, 0x69, 0x79, 0x79, 0x4a, 0x4f, 0x48, 0x32, 0x0a, 0x61,
|
||||
0x32, 0x71, 0x69, 0x2f, 0x47, 0x7a, 0x2f, 0x64, 0x48, 0x61, 0x62, 0x68,
|
||||
0x4d, 0x4e, 0x35, 0x4e, 0x53, 0x58, 0x56, 0x4d, 0x31, 0x54, 0x2f, 0x6d,
|
||||
0x69, 0x6f, 0x74, 0x68, 0x78, 0x59, 0x72, 0x2f, 0x4a, 0x69, 0x37, 0x6d,
|
||||
0x4e, 0x45, 0x75, 0x4a, 0x57, 0x38, 0x74, 0x6d, 0x75, 0x55, 0x4b, 0x58,
|
||||
0x33, 0x66, 0x63, 0x39, 0x42, 0x39, 0x32, 0x51, 0x6e, 0x54, 0x68, 0x43,
|
||||
0x69, 0x49, 0x2f, 0x0a, 0x79, 0x4f, 0x31, 0x32, 0x4c, 0x46, 0x58, 0x38,
|
||||
0x74, 0x4b, 0x4a, 0x37, 0x4b, 0x7a, 0x6f, 0x6b, 0x36, 0x44, 0x74, 0x6d,
|
||||
0x35, 0x73, 0x41, 0x74, 0x2b, 0x65, 0x4b, 0x76, 0x6f, 0x61, 0x47, 0x62,
|
||||
0x75, 0x4a, 0x78, 0x62, 0x52, 0x63, 0x36, 0x63, 0x4d, 0x58, 0x57, 0x46,
|
||||
0x36, 0x4d, 0x72, 0x4d, 0x30, 0x53, 0x78, 0x65, 0x4e, 0x6b, 0x5a, 0x77,
|
||||
0x5a, 0x36, 0x6c, 0x62, 0x4d, 0x39, 0x63, 0x55, 0x0a, 0x6c, 0x75, 0x34,
|
||||
0x4c, 0x56, 0x64, 0x34, 0x73, 0x56, 0x4c, 0x61, 0x76, 0x68, 0x75, 0x32,
|
||||
0x58, 0x48, 0x48, 0x53, 0x56, 0x30, 0x32, 0x32, 0x6d, 0x51, 0x72, 0x73,
|
||||
0x32, 0x69, 0x68, 0x74, 0x58, 0x44, 0x2b, 0x6c, 0x4d, 0x63, 0x2f, 0x35,
|
||||
0x62, 0x54, 0x41, 0x55, 0x6b, 0x4b, 0x4f, 0x42, 0x73, 0x43, 0x69, 0x4f,
|
||||
0x4b, 0x42, 0x56, 0x2b, 0x66, 0x70, 0x49, 0x62, 0x2b, 0x6d, 0x44, 0x33,
|
||||
0x58, 0x0a, 0x39, 0x37, 0x66, 0x36, 0x54, 0x66, 0x68, 0x37, 0x4f, 0x4f,
|
||||
0x6a, 0x74, 0x44, 0x79, 0x31, 0x6f, 0x52, 0x36, 0x70, 0x68, 0x48, 0x47,
|
||||
0x6e, 0x73, 0x43, 0x78, 0x72, 0x53, 0x72, 0x64, 0x48, 0x73, 0x2f, 0x34,
|
||||
0x33, 0x72, 0x61, 0x65, 0x42, 0x78, 0x59, 0x45, 0x41, 0x42, 0x4e, 0x59,
|
||||
0x68, 0x54, 0x47, 0x57, 0x49, 0x4d, 0x4a, 0x6b, 0x50, 0x63, 0x54, 0x53,
|
||||
0x73, 0x76, 0x77, 0x46, 0x37, 0x6d, 0x0a, 0x33, 0x6c, 0x38, 0x6b, 0x44,
|
||||
0x50, 0x48, 0x43, 0x4e, 0x68, 0x6e, 0x6e, 0x42, 0x69, 0x7a, 0x36, 0x2f,
|
||||
0x43, 0x38, 0x56, 0x31, 0x37, 0x78, 0x57, 0x34, 0x50, 0x2b, 0x79, 0x71,
|
||||
0x4a, 0x78, 0x58, 0x63, 0x49, 0x53, 0x72, 0x7a, 0x57, 0x53, 0x55, 0x72,
|
||||
0x34, 0x74, 0x71, 0x6b, 0x55, 0x58, 0x43, 0x57, 0x4c, 0x43, 0x66, 0x76,
|
||||
0x57, 0x7a, 0x4e, 0x65, 0x5a, 0x34, 0x4f, 0x34, 0x34, 0x54, 0x65, 0x0a,
|
||||
0x74, 0x31, 0x59, 0x65, 0x36, 0x77, 0x2b, 0x71, 0x4f, 0x55, 0x38, 0x50,
|
||||
0x42, 0x68, 0x72, 0x65, 0x4d, 0x38, 0x75, 0x32, 0x32, 0x42, 0x4f, 0x31,
|
||||
0x65, 0x2b, 0x44, 0x7a, 0x63, 0x74, 0x6c, 0x67, 0x43, 0x43, 0x6c, 0x38,
|
||||
0x79, 0x69, 0x37, 0x6f, 0x43, 0x56, 0x74, 0x66, 0x75, 0x59, 0x2f, 0x4c,
|
||||
0x72, 0x42, 0x61, 0x31, 0x74, 0x69, 0x43, 0x41, 0x37, 0x6c, 0x34, 0x75,
|
||||
0x58, 0x6b, 0x73, 0x4c, 0x0a, 0x2b, 0x31, 0x51, 0x79, 0x69, 0x4b, 0x31,
|
||||
0x6e, 0x43, 0x4f, 0x76, 0x74, 0x30, 0x46, 0x7a, 0x71, 0x62, 0x71, 0x78,
|
||||
0x54, 0x37, 0x53, 0x35, 0x4c, 0x56, 0x33, 0x5a, 0x33, 0x74, 0x34, 0x4a,
|
||||
0x46, 0x4f, 0x50, 0x62, 0x67, 0x63, 0x7a, 0x4e, 0x6b, 0x58, 0x55, 0x2b,
|
||||
0x4f, 0x74, 0x50, 0x6b, 0x6e, 0x45, 0x45, 0x76, 0x67, 0x57, 0x64, 0x76,
|
||||
0x31, 0x4f, 0x30, 0x6d, 0x52, 0x4a, 0x50, 0x31, 0x4e, 0x0a, 0x71, 0x43,
|
||||
0x32, 0x33, 0x4a, 0x6a, 0x36, 0x38, 0x4c, 0x30, 0x46, 0x63, 0x46, 0x4c,
|
||||
0x56, 0x56, 0x59, 0x76, 0x61, 0x44, 0x53, 0x76, 0x54, 0x45, 0x64, 0x50,
|
||||
0x54, 0x34, 0x62, 0x2f, 0x7a, 0x66, 0x64, 0x36, 0x51, 0x52, 0x6b, 0x38,
|
||||
0x70, 0x4d, 0x36, 0x77, 0x66, 0x61, 0x32, 0x50, 0x63, 0x75, 0x57, 0x65,
|
||||
0x79, 0x38, 0x48, 0x38, 0x76, 0x4e, 0x4b, 0x67, 0x2f, 0x65, 0x76, 0x34,
|
||||
0x77, 0x37, 0x0a, 0x6b, 0x6f, 0x6f, 0x4e, 0x59, 0x64, 0x77, 0x59, 0x69,
|
||||
0x6c, 0x37, 0x41, 0x50, 0x76, 0x42, 0x50, 0x4d, 0x63, 0x6c, 0x51, 0x76,
|
||||
0x63, 0x64, 0x71, 0x7a, 0x52, 0x7a, 0x4a, 0x6e, 0x4a, 0x74, 0x37, 0x70,
|
||||
0x35, 0x7a, 0x69, 0x2b, 0x2b, 0x4c, 0x43, 0x59, 0x55, 0x4d, 0x3d, 0x0a,
|
||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53, 0x41,
|
||||
0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59,
|
||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
|
||||
};
|
||||
|
||||
//
|
||||
// Password for private key retrieving from encrypted PEM ("TestKeyPem").
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *PemPass = "client";
|
||||
|
||||
//
|
||||
// Test CA X509 Certificate for X509 Verification Routine (Generated by OpenSSL utility).
|
||||
// $ openssl req -x509 -days 10000 -key TestKeyPem -out TestCACert -outform DER -subj "/C=US/ST=WA/L=Seattle/O=Tianocore/OU=EDK2/CN=UEFI"
|
||||
// use password from PemPass variable in this file
|
||||
// $ xxd --include TestCACert
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCACert[] = {
|
||||
0x30, 0x82, 0x02, 0x98, 0x30, 0x82, 0x02, 0x01, 0xa0, 0x03, 0x02, 0x01,
|
||||
0x02, 0x02, 0x14, 0x39, 0xde, 0x9e, 0xce, 0x3a, 0x36, 0x11, 0x38, 0x6f,
|
||||
0x64, 0xb4, 0x69, 0xa7, 0x93, 0xdd, 0xff, 0xbd, 0x3e, 0x75, 0x6a, 0x30,
|
||||
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
|
||||
0x05, 0x00, 0x30, 0x5e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
|
||||
0x04, 0x08, 0x0c, 0x02, 0x57, 0x41, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
|
||||
0x55, 0x04, 0x07, 0x0c, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
||||
0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x09, 0x54,
|
||||
0x69, 0x61, 0x6e, 0x6f, 0x63, 0x6f, 0x72, 0x65, 0x31, 0x0d, 0x30, 0x0b,
|
||||
0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x04, 0x45, 0x44, 0x4b, 0x32, 0x31,
|
||||
0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x04, 0x55, 0x45,
|
||||
0x46, 0x49, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x36, 0x32, 0x39,
|
||||
0x32, 0x32, 0x34, 0x37, 0x33, 0x36, 0x5a, 0x17, 0x0d, 0x34, 0x37, 0x31,
|
||||
0x31, 0x31, 0x35, 0x32, 0x32, 0x34, 0x37, 0x33, 0x36, 0x5a, 0x30, 0x5e,
|
||||
0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
|
||||
0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x02,
|
||||
0x57, 0x41, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c,
|
||||
0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x31, 0x12, 0x30, 0x10,
|
||||
0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x09, 0x54, 0x69, 0x61, 0x6e, 0x6f,
|
||||
0x63, 0x6f, 0x72, 0x65, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0b, 0x0c, 0x04, 0x45, 0x44, 0x4b, 0x32, 0x31, 0x0d, 0x30, 0x0b, 0x06,
|
||||
0x03, 0x55, 0x04, 0x03, 0x0c, 0x04, 0x55, 0x45, 0x46, 0x49, 0x30, 0x81,
|
||||
0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
|
||||
0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02,
|
||||
0x81, 0x81, 0x00, 0x9f, 0xef, 0x1b, 0x46, 0x45, 0x55, 0x33, 0x4b, 0xee,
|
||||
0x95, 0x14, 0xd3, 0x5a, 0x3e, 0xd9, 0x29, 0xfb, 0xd9, 0x29, 0x4e, 0x8b,
|
||||
0xf1, 0xf5, 0x68, 0x7c, 0x58, 0x86, 0x0c, 0xda, 0xd7, 0xe0, 0xd2, 0x9a,
|
||||
0xe8, 0x37, 0x16, 0x4d, 0x54, 0x92, 0x18, 0x20, 0x4c, 0x09, 0xa1, 0xcf,
|
||||
0xe1, 0xaa, 0x7a, 0x5a, 0x64, 0x7e, 0x5c, 0xeb, 0x4e, 0x15, 0x8e, 0x40,
|
||||
0xd1, 0xcb, 0x7d, 0x01, 0x71, 0x15, 0x11, 0xd2, 0xc7, 0xdb, 0x6b, 0x00,
|
||||
0xdc, 0x02, 0xcb, 0x5a, 0x6d, 0x2b, 0x2a, 0x75, 0xb6, 0x3f, 0xec, 0xc1,
|
||||
0x9d, 0xbf, 0xda, 0xe5, 0x3a, 0x77, 0x4b, 0x21, 0x1c, 0x99, 0x42, 0x84,
|
||||
0x5e, 0x27, 0x53, 0x9b, 0xe6, 0xc1, 0xa1, 0x95, 0x58, 0xba, 0xbe, 0x62,
|
||||
0x58, 0xd5, 0x09, 0xa8, 0xe6, 0xb6, 0x1b, 0xb1, 0x18, 0x28, 0x13, 0xc7,
|
||||
0x89, 0x1c, 0x68, 0xce, 0x15, 0xaf, 0x2e, 0x68, 0xac, 0x1c, 0xf7, 0x02,
|
||||
0x03, 0x01, 0x00, 0x01, 0xa3, 0x53, 0x30, 0x51, 0x30, 0x1d, 0x06, 0x03,
|
||||
0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x50, 0xe5, 0x05, 0xa3, 0x6e,
|
||||
0x8f, 0x00, 0xf7, 0x93, 0x30, 0xe5, 0x25, 0x20, 0xdc, 0x8a, 0xc3, 0xad,
|
||||
0x14, 0x6d, 0x90, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18,
|
||||
0x30, 0x16, 0x80, 0x14, 0x50, 0xe5, 0x05, 0xa3, 0x6e, 0x8f, 0x00, 0xf7,
|
||||
0x93, 0x30, 0xe5, 0x25, 0x20, 0xdc, 0x8a, 0xc3, 0xad, 0x14, 0x6d, 0x90,
|
||||
0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05,
|
||||
0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
|
||||
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00,
|
||||
0x8e, 0xe4, 0x27, 0x42, 0x16, 0x6e, 0xbd, 0x28, 0x47, 0x09, 0x99, 0xc1,
|
||||
0x55, 0x02, 0x82, 0x1a, 0xe1, 0xd0, 0xf3, 0xef, 0x4d, 0xaf, 0x30, 0x9a,
|
||||
0x29, 0x4b, 0x74, 0x03, 0x6a, 0x95, 0x28, 0xf1, 0xbe, 0x62, 0x68, 0x9f,
|
||||
0x82, 0x59, 0x7a, 0x49, 0x91, 0xb6, 0xaf, 0x6b, 0x23, 0x30, 0xb4, 0xf4,
|
||||
0xdd, 0xfa, 0x30, 0x3f, 0xb6, 0xed, 0x74, 0x3f, 0x91, 0xe8, 0xd7, 0x84,
|
||||
0x1a, 0xf3, 0xc6, 0x3d, 0xd8, 0x59, 0x8d, 0x68, 0x6e, 0xb3, 0x66, 0x9e,
|
||||
0xe8, 0xeb, 0x1a, 0x8b, 0x1e, 0x92, 0x71, 0x73, 0x8c, 0x4f, 0x63, 0xce,
|
||||
0x71, 0x7b, 0x97, 0x3b, 0x59, 0xd2, 0x9b, 0xe4, 0xd0, 0xef, 0x31, 0x9f,
|
||||
0x0d, 0x61, 0x27, 0x97, 0x9d, 0xe8, 0xe0, 0xcd, 0x8d, 0xc1, 0x4d, 0xad,
|
||||
0xf7, 0x3a, 0x8d, 0xb8, 0x86, 0x8c, 0x23, 0x1d, 0x4c, 0x02, 0x5c, 0x53,
|
||||
0x46, 0x84, 0xb2, 0x97, 0x0c, 0xd3, 0x35, 0x6b
|
||||
};
|
||||
|
||||
//
|
||||
// X509 Cert Data for RSA Public Key Retrieving and X509 Verification (Generated by OpenSSL utility).
|
||||
// $ openssl req -new -key TestKeyPem -out TestCertCsr -subj "/C=US/ST=WA/L=Seattle/O=Tianocore/OU=EDK2CHILD/CN=UEFI"
|
||||
// $ openssl x509 -days 10000 -CA TestCACert.pem -CAkey TestKeyPem -req -out TestCert -set_serial 3432 --outform DER -in TestCertCsr
|
||||
// password should be in the PemPass variable
|
||||
// $ xxd --include TestCert
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCert[] = {
|
||||
0x30, 0x82, 0x02, 0x31, 0x30, 0x82, 0x01, 0x9a, 0x02, 0x02, 0x0d, 0x68,
|
||||
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
|
||||
0x0b, 0x05, 0x00, 0x30, 0x5e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
|
||||
0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
|
||||
0x55, 0x04, 0x08, 0x0c, 0x02, 0x57, 0x41, 0x31, 0x10, 0x30, 0x0e, 0x06,
|
||||
0x03, 0x55, 0x04, 0x07, 0x0c, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6c,
|
||||
0x65, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x09,
|
||||
0x54, 0x69, 0x61, 0x6e, 0x6f, 0x63, 0x6f, 0x72, 0x65, 0x31, 0x0d, 0x30,
|
||||
0x0b, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x04, 0x45, 0x44, 0x4b, 0x32,
|
||||
0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x04, 0x55,
|
||||
0x45, 0x46, 0x49, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x36, 0x32,
|
||||
0x39, 0x32, 0x33, 0x31, 0x35, 0x33, 0x36, 0x5a, 0x17, 0x0d, 0x34, 0x37,
|
||||
0x31, 0x31, 0x31, 0x35, 0x32, 0x33, 0x31, 0x35, 0x33, 0x36, 0x5a, 0x30,
|
||||
0x63, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c,
|
||||
0x02, 0x57, 0x41, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07,
|
||||
0x0c, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x31, 0x12, 0x30,
|
||||
0x10, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x09, 0x54, 0x69, 0x61, 0x6e,
|
||||
0x6f, 0x63, 0x6f, 0x72, 0x65, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55,
|
||||
0x04, 0x0b, 0x0c, 0x09, 0x45, 0x44, 0x4b, 0x32, 0x43, 0x48, 0x49, 0x4c,
|
||||
0x44, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x04,
|
||||
0x55, 0x45, 0x46, 0x49, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a,
|
||||
0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
|
||||
0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0x9f, 0xef, 0x1b,
|
||||
0x46, 0x45, 0x55, 0x33, 0x4b, 0xee, 0x95, 0x14, 0xd3, 0x5a, 0x3e, 0xd9,
|
||||
0x29, 0xfb, 0xd9, 0x29, 0x4e, 0x8b, 0xf1, 0xf5, 0x68, 0x7c, 0x58, 0x86,
|
||||
0x0c, 0xda, 0xd7, 0xe0, 0xd2, 0x9a, 0xe8, 0x37, 0x16, 0x4d, 0x54, 0x92,
|
||||
0x18, 0x20, 0x4c, 0x09, 0xa1, 0xcf, 0xe1, 0xaa, 0x7a, 0x5a, 0x64, 0x7e,
|
||||
0x5c, 0xeb, 0x4e, 0x15, 0x8e, 0x40, 0xd1, 0xcb, 0x7d, 0x01, 0x71, 0x15,
|
||||
0x11, 0xd2, 0xc7, 0xdb, 0x6b, 0x00, 0xdc, 0x02, 0xcb, 0x5a, 0x6d, 0x2b,
|
||||
0x2a, 0x75, 0xb6, 0x3f, 0xec, 0xc1, 0x9d, 0xbf, 0xda, 0xe5, 0x3a, 0x77,
|
||||
0x4b, 0x21, 0x1c, 0x99, 0x42, 0x84, 0x5e, 0x27, 0x53, 0x9b, 0xe6, 0xc1,
|
||||
0xa1, 0x95, 0x58, 0xba, 0xbe, 0x62, 0x58, 0xd5, 0x09, 0xa8, 0xe6, 0xb6,
|
||||
0x1b, 0xb1, 0x18, 0x28, 0x13, 0xc7, 0x89, 0x1c, 0x68, 0xce, 0x15, 0xaf,
|
||||
0x2e, 0x68, 0xac, 0x1c, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d,
|
||||
0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
|
||||
0x00, 0x03, 0x81, 0x81, 0x00, 0x0d, 0xa4, 0x18, 0xa2, 0xb6, 0x09, 0xe1,
|
||||
0x77, 0x22, 0x97, 0x46, 0x29, 0x1b, 0xd8, 0x67, 0x0a, 0xc0, 0x91, 0x36,
|
||||
0x53, 0xe1, 0x4c, 0x73, 0x1b, 0xc1, 0x90, 0x6d, 0x98, 0x46, 0x7e, 0x65,
|
||||
0x71, 0x1c, 0xf0, 0x62, 0x9f, 0x9e, 0x62, 0x0b, 0x8b, 0x73, 0x35, 0x4c,
|
||||
0x2d, 0xc3, 0x5d, 0x38, 0x22, 0xfe, 0x43, 0x0f, 0xf2, 0x57, 0x17, 0x75,
|
||||
0xa8, 0x76, 0x79, 0xab, 0x4e, 0x33, 0xa5, 0x91, 0xbd, 0x55, 0x5b, 0xc0,
|
||||
0x7e, 0xfb, 0x1d, 0xc9, 0xf3, 0x5f, 0x12, 0x6f, 0x7c, 0xdc, 0x24, 0x5a,
|
||||
0x84, 0x16, 0x28, 0x5b, 0xf9, 0xcc, 0x8b, 0xfe, 0x11, 0xe6, 0x29, 0xcf,
|
||||
0xac, 0x90, 0x66, 0xc0, 0x70, 0x25, 0xf8, 0x71, 0xdb, 0x29, 0xcb, 0x6b,
|
||||
0x10, 0xa7, 0xbe, 0x3e, 0x9d, 0x61, 0xd8, 0x04, 0xe0, 0x71, 0x63, 0x83,
|
||||
0xa3, 0xca, 0x26, 0x6d, 0x7f, 0xf3, 0xaa, 0x8e, 0xb2, 0x66, 0x98, 0x41,
|
||||
0xd6
|
||||
};
|
||||
|
||||
//
|
||||
// Message Hash for Signing & Verification Validation.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 MsgHash[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09
|
||||
};
|
||||
|
||||
//
|
||||
// Payload for PKCS#7 Signing & Verification Validation.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Payload = "Payload Data for PKCS#7 Signing";
|
||||
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyRsaCertPkcs1SignVerify (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
VOID *RsaPrivKey;
|
||||
VOID *RsaPubKey;
|
||||
UINT8 *Signature;
|
||||
UINTN SigSize;
|
||||
UINT8 *Subject;
|
||||
UINTN SubjectSize;
|
||||
RETURN_STATUS ReturnStatus;
|
||||
CHAR8 CommonName[64];
|
||||
UINTN CommonNameSize;
|
||||
CHAR8 OrgName[64];
|
||||
UINTN OrgNameSize;
|
||||
|
||||
//
|
||||
// Retrieve RSA private key from encrypted PEM data.
|
||||
//
|
||||
Status = RsaGetPrivateKeyFromPem (TestKeyPem, sizeof (TestKeyPem), PemPass, &RsaPrivKey);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Retrieve RSA public key from X509 Certificate.
|
||||
//
|
||||
RsaPubKey = NULL;
|
||||
Status = RsaGetPublicKeyFromX509 (TestCert, sizeof (TestCert), &RsaPubKey);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Generate RSA PKCS#1 Signature.
|
||||
//
|
||||
SigSize = 0;
|
||||
Status = RsaPkcs1Sign (RsaPrivKey, MsgHash, SHA1_DIGEST_SIZE, NULL, &SigSize);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
UT_ASSERT_NOT_EQUAL (SigSize, 0);
|
||||
|
||||
Signature = AllocatePool (SigSize);
|
||||
Status = RsaPkcs1Sign (RsaPrivKey, MsgHash, SHA1_DIGEST_SIZE, Signature, &SigSize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Verify RSA PKCS#1-encoded Signature.
|
||||
//
|
||||
Status = RsaPkcs1Verify (RsaPubKey, MsgHash, SHA1_DIGEST_SIZE, Signature, SigSize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// X509 Certificate Subject Retrieving.
|
||||
//
|
||||
SubjectSize = 0;
|
||||
Status = X509GetSubjectName (TestCert, sizeof (TestCert), NULL, &SubjectSize);
|
||||
Subject = (UINT8 *)AllocatePool (SubjectSize);
|
||||
Status = X509GetSubjectName (TestCert, sizeof (TestCert), Subject, &SubjectSize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Get CommonName from X509 Certificate Subject
|
||||
//
|
||||
CommonNameSize = 64;
|
||||
ZeroMem (CommonName, CommonNameSize);
|
||||
ReturnStatus = X509GetCommonName (TestCert, sizeof (TestCert), CommonName, &CommonNameSize);
|
||||
UT_ASSERT_NOT_EFI_ERROR (ReturnStatus);
|
||||
|
||||
UT_ASSERT_EQUAL (CommonNameSize, 5);
|
||||
UT_ASSERT_MEM_EQUAL (CommonName, "UEFI", 5);
|
||||
|
||||
OrgNameSize = 64;
|
||||
ZeroMem (OrgName, OrgNameSize);
|
||||
ReturnStatus = X509GetOrganizationName (TestCert, sizeof (TestCert), OrgName, &OrgNameSize);
|
||||
UT_ASSERT_NOT_EFI_ERROR (ReturnStatus);
|
||||
|
||||
UT_ASSERT_EQUAL (OrgNameSize, 10);
|
||||
UT_ASSERT_MEM_EQUAL (OrgName, "Tianocore", 10);
|
||||
|
||||
//
|
||||
// X509 Certificate Verification.
|
||||
//
|
||||
Status = X509VerifyCert (TestCert, sizeof (TestCert), TestCACert, sizeof (TestCACert));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Release Resources.
|
||||
//
|
||||
RsaFree (RsaPubKey);
|
||||
RsaFree (RsaPrivKey);
|
||||
FreePool (Signature);
|
||||
FreePool (Subject);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyPkcs7SignVerify (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
UINT8 *P7SignedData;
|
||||
UINTN P7SignedDataSize;
|
||||
UINT8 *SignCert;
|
||||
|
||||
P7SignedData = NULL;
|
||||
SignCert = NULL;
|
||||
|
||||
//
|
||||
// Construct Signer Certificate from RAW data.
|
||||
//
|
||||
Status = X509ConstructCertificate (TestCert, sizeof (TestCert), (UINT8 **) &SignCert);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_NOT_NULL (SignCert);
|
||||
|
||||
//
|
||||
// Create PKCS#7 signedData on Payload.
|
||||
// Note: Caller should release P7SignedData manually.
|
||||
//
|
||||
Status = Pkcs7Sign (
|
||||
TestKeyPem,
|
||||
sizeof (TestKeyPem),
|
||||
(CONST UINT8 *) PemPass,
|
||||
(UINT8 *) Payload,
|
||||
AsciiStrLen (Payload),
|
||||
SignCert,
|
||||
NULL,
|
||||
&P7SignedData,
|
||||
&P7SignedDataSize
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_NOT_EQUAL (P7SignedDataSize, 0);
|
||||
|
||||
Status = Pkcs7Verify (
|
||||
P7SignedData,
|
||||
P7SignedDataSize,
|
||||
TestCACert,
|
||||
sizeof (TestCACert),
|
||||
(UINT8 *) Payload,
|
||||
AsciiStrLen (Payload)
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
if (P7SignedData != NULL) {
|
||||
FreePool (P7SignedData);
|
||||
}
|
||||
if (SignCert != NULL) {
|
||||
X509Free (SignCert);
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mRsaCertTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyRsaCertPkcs1SignVerify()", "CryptoPkg.BaseCryptLib.RsaCert", TestVerifyRsaCertPkcs1SignVerify, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mRsaCertTestNum = ARRAY_SIZE(mRsaCertTest);
|
||||
|
||||
TEST_DESC mPkcs7Test[] = {
|
||||
//
|
||||
// -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyPkcs7SignVerify()", "CryptoPkg.BaseCryptLib.Pkcs7", TestVerifyPkcs7SignVerify, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mPkcs7TestNum = ARRAY_SIZE(mPkcs7Test);
|
310
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
Normal file
310
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
Normal file
@ -0,0 +1,310 @@
|
||||
/** @file
|
||||
Application for RSA Primitives Validation.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
#define RSA_MODULUS_LENGTH 512
|
||||
|
||||
//
|
||||
// RSA PKCS#1 Validation Data from OpenSSL "Fips_rsa_selftest.c"
|
||||
//
|
||||
|
||||
//
|
||||
// Public Modulus of RSA Key
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaN[] = {
|
||||
0xBB, 0xF8, 0x2F, 0x09, 0x06, 0x82, 0xCE, 0x9C, 0x23, 0x38, 0xAC, 0x2B, 0x9D, 0xA8, 0x71, 0xF7,
|
||||
0x36, 0x8D, 0x07, 0xEE, 0xD4, 0x10, 0x43, 0xA4, 0x40, 0xD6, 0xB6, 0xF0, 0x74, 0x54, 0xF5, 0x1F,
|
||||
0xB8, 0xDF, 0xBA, 0xAF, 0x03, 0x5C, 0x02, 0xAB, 0x61, 0xEA, 0x48, 0xCE, 0xEB, 0x6F, 0xCD, 0x48,
|
||||
0x76, 0xED, 0x52, 0x0D, 0x60, 0xE1, 0xEC, 0x46, 0x19, 0x71, 0x9D, 0x8A, 0x5B, 0x8B, 0x80, 0x7F,
|
||||
0xAF, 0xB8, 0xE0, 0xA3, 0xDF, 0xC7, 0x37, 0x72, 0x3E, 0xE6, 0xB4, 0xB7, 0xD9, 0x3A, 0x25, 0x84,
|
||||
0xEE, 0x6A, 0x64, 0x9D, 0x06, 0x09, 0x53, 0x74, 0x88, 0x34, 0xB2, 0x45, 0x45, 0x98, 0x39, 0x4E,
|
||||
0xE0, 0xAA, 0xB1, 0x2D, 0x7B, 0x61, 0xA5, 0x1F, 0x52, 0x7A, 0x9A, 0x41, 0xF6, 0xC1, 0x68, 0x7F,
|
||||
0xE2, 0x53, 0x72, 0x98, 0xCA, 0x2A, 0x8F, 0x59, 0x46, 0xF8, 0xE5, 0xFD, 0x09, 0x1D, 0xBD, 0xCB
|
||||
};
|
||||
|
||||
//
|
||||
// Public Exponent of RSA Key
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaE[] = { 0x11 };
|
||||
|
||||
//
|
||||
// Private Exponent of RSA Key
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaD[] = {
|
||||
0xA5, 0xDA, 0xFC, 0x53, 0x41, 0xFA, 0xF2, 0x89, 0xC4, 0xB9, 0x88, 0xDB, 0x30, 0xC1, 0xCD, 0xF8,
|
||||
0x3F, 0x31, 0x25, 0x1E, 0x06, 0x68, 0xB4, 0x27, 0x84, 0x81, 0x38, 0x01, 0x57, 0x96, 0x41, 0xB2,
|
||||
0x94, 0x10, 0xB3, 0xC7, 0x99, 0x8D, 0x6B, 0xC4, 0x65, 0x74, 0x5E, 0x5C, 0x39, 0x26, 0x69, 0xD6,
|
||||
0x87, 0x0D, 0xA2, 0xC0, 0x82, 0xA9, 0x39, 0xE3, 0x7F, 0xDC, 0xB8, 0x2E, 0xC9, 0x3E, 0xDA, 0xC9,
|
||||
0x7F, 0xF3, 0xAD, 0x59, 0x50, 0xAC, 0xCF, 0xBC, 0x11, 0x1C, 0x76, 0xF1, 0xA9, 0x52, 0x94, 0x44,
|
||||
0xE5, 0x6A, 0xAF, 0x68, 0xC5, 0x6C, 0x09, 0x2C, 0xD3, 0x8D, 0xC3, 0xBE, 0xF5, 0xD2, 0x0A, 0x93,
|
||||
0x99, 0x26, 0xED, 0x4F, 0x74, 0xA1, 0x3E, 0xDD, 0xFB, 0xE1, 0xA1, 0xCE, 0xCC, 0x48, 0x94, 0xAF,
|
||||
0x94, 0x28, 0xC2, 0xB7, 0xB8, 0x88, 0x3F, 0xE4, 0x46, 0x3A, 0x4B, 0xC8, 0x5B, 0x1C, 0xB3, 0xC1
|
||||
};
|
||||
|
||||
//
|
||||
// Known Answer Test (KAT) Data for RSA PKCS#1 Signing
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 RsaSignData[] = "OpenSSL FIPS 140-2 Public Key RSA KAT";
|
||||
|
||||
//
|
||||
// Known Signature for the above message, under SHA-1 Digest
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaPkcs1Signature[] = {
|
||||
0x71, 0xEE, 0x1A, 0xC0, 0xFE, 0x01, 0x93, 0x54, 0x79, 0x5C, 0xF2, 0x4C, 0x4A, 0xFD, 0x1A, 0x05,
|
||||
0x8F, 0x64, 0xB1, 0x6D, 0x61, 0x33, 0x8D, 0x9B, 0xE7, 0xFD, 0x60, 0xA3, 0x83, 0xB5, 0xA3, 0x51,
|
||||
0x55, 0x77, 0x90, 0xCF, 0xDC, 0x22, 0x37, 0x8E, 0xD0, 0xE1, 0xAE, 0x09, 0xE3, 0x3D, 0x1E, 0xF8,
|
||||
0x80, 0xD1, 0x8B, 0xC2, 0xEC, 0x0A, 0xD7, 0x6B, 0x88, 0x8B, 0x8B, 0xA1, 0x20, 0x22, 0xBE, 0x59,
|
||||
0x5B, 0xE0, 0x23, 0x24, 0xA1, 0x49, 0x30, 0xBA, 0xA9, 0x9E, 0xE8, 0xB1, 0x8A, 0x62, 0x16, 0xBF,
|
||||
0x4E, 0xCA, 0x2E, 0x4E, 0xBC, 0x29, 0xA8, 0x67, 0x13, 0xB7, 0x9F, 0x1D, 0x04, 0x44, 0xE5, 0x5F,
|
||||
0x35, 0x07, 0x11, 0xBC, 0xED, 0x19, 0x37, 0x21, 0xCF, 0x23, 0x48, 0x1F, 0x72, 0x05, 0xDE, 0xE6,
|
||||
0xE8, 0x7F, 0x33, 0x8A, 0x76, 0x4B, 0x2F, 0x95, 0xDF, 0xF1, 0x5F, 0x84, 0x80, 0xD9, 0x46, 0xB4
|
||||
};
|
||||
|
||||
//
|
||||
// Default public key 0x10001 = 65537
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DefaultPublicKey[] = {
|
||||
0x01, 0x00, 0x01
|
||||
};
|
||||
|
||||
VOID *mRsa;
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyRsaPreReq (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
mRsa = RsaNew ();
|
||||
|
||||
if (mRsa == NULL) {
|
||||
return UNIT_TEST_ERROR_TEST_FAILED;
|
||||
}
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
TestVerifyRsaCleanUp (
|
||||
UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
if (mRsa != NULL) {
|
||||
RsaFree (mRsa);
|
||||
mRsa = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyRsaSetGetKeyComponents (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
UINTN KeySize;
|
||||
UINT8 *KeyBuffer;
|
||||
|
||||
//
|
||||
// Set/Get RSA Key Components
|
||||
//
|
||||
|
||||
//
|
||||
// Set/Get RSA Key N
|
||||
//
|
||||
Status = RsaSetKey (mRsa, RsaKeyN, RsaN, sizeof (RsaN));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
KeySize = 0;
|
||||
Status = RsaGetKey (mRsa, RsaKeyN, NULL, &KeySize);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, sizeof (RsaN));
|
||||
|
||||
KeyBuffer = AllocatePool (KeySize);
|
||||
Status = RsaGetKey (mRsa, RsaKeyN, KeyBuffer, &KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, sizeof (RsaN));
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (KeyBuffer, RsaN, KeySize);
|
||||
|
||||
FreePool (KeyBuffer);
|
||||
|
||||
//
|
||||
// Set/Get RSA Key E
|
||||
//
|
||||
Status = RsaSetKey (mRsa, RsaKeyE, RsaE, sizeof (RsaE));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
KeySize = 0;
|
||||
Status = RsaGetKey (mRsa, RsaKeyE, NULL, &KeySize);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, sizeof (RsaE));
|
||||
|
||||
KeyBuffer = AllocatePool (KeySize);
|
||||
Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, sizeof (RsaE));
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (KeyBuffer, RsaE, KeySize);
|
||||
|
||||
FreePool (KeyBuffer);
|
||||
|
||||
//
|
||||
// Clear/Get RSA Key Components
|
||||
//
|
||||
|
||||
//
|
||||
// Clear/Get RSA Key N
|
||||
//
|
||||
Status = RsaSetKey (mRsa, RsaKeyN, NULL, 0);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
KeySize = 1;
|
||||
Status = RsaGetKey (mRsa, RsaKeyN, NULL, &KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, 0);
|
||||
|
||||
//
|
||||
// Clear/Get RSA Key E
|
||||
//
|
||||
Status = RsaSetKey (mRsa, RsaKeyE, NULL, 0);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
KeySize = 1;
|
||||
Status = RsaGetKey (mRsa, RsaKeyE, NULL, &KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, 0);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyRsaGenerateKeyComponents (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
UINTN KeySize;
|
||||
UINT8 *KeyBuffer;
|
||||
|
||||
//
|
||||
// Generate RSA Key Components
|
||||
//
|
||||
|
||||
Status = RsaGenerateKey (mRsa, RSA_MODULUS_LENGTH, NULL, 0);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
KeySize = RSA_MODULUS_LENGTH / 8;
|
||||
KeyBuffer = AllocatePool (KeySize);
|
||||
Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, 3);
|
||||
UT_ASSERT_MEM_EQUAL (KeyBuffer, DefaultPublicKey, 3);
|
||||
|
||||
KeySize = RSA_MODULUS_LENGTH / 8;
|
||||
Status = RsaGetKey (mRsa, RsaKeyN, KeyBuffer, &KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (KeySize, RSA_MODULUS_LENGTH / 8);
|
||||
|
||||
Status = RsaCheckKey (mRsa);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Check invalid RSA key components
|
||||
//
|
||||
Status = RsaSetKey (mRsa, RsaKeyN, RsaN, sizeof (RsaN));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = RsaCheckKey (mRsa);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
Status = RsaSetKey (mRsa, RsaKeyN, KeyBuffer, KeySize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = RsaCheckKey (mRsa);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = RsaSetKey (mRsa, RsaKeyE, RsaE, sizeof (RsaE));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = RsaCheckKey (mRsa);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
|
||||
FreePool (KeyBuffer);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyRsaPkcs1SignVerify (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINT8 HashValue[SHA1_DIGEST_SIZE];
|
||||
UINTN HashSize;
|
||||
UINT8 *Signature;
|
||||
UINTN SigSize;
|
||||
BOOLEAN Status;
|
||||
|
||||
//
|
||||
// SHA-1 Digest Message for PKCS#1 Signature
|
||||
//
|
||||
HashSize = SHA1_DIGEST_SIZE;
|
||||
ZeroMem (HashValue, HashSize);
|
||||
|
||||
Status = Sha1HashAll (RsaSignData, AsciiStrLen (RsaSignData), HashValue);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
//
|
||||
// Sign RSA PKCS#1-encoded Signature
|
||||
//
|
||||
|
||||
Status = RsaSetKey (mRsa, RsaKeyN, RsaN, sizeof (RsaN));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = RsaSetKey (mRsa, RsaKeyE, RsaE, sizeof (RsaE));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
Status = RsaSetKey (mRsa, RsaKeyD, RsaD, sizeof (RsaD));
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
SigSize = 0;
|
||||
Status = RsaPkcs1Sign (mRsa, HashValue, HashSize, NULL, &SigSize);
|
||||
UT_ASSERT_FALSE (Status);
|
||||
UT_ASSERT_NOT_EQUAL (SigSize, 0);
|
||||
|
||||
Signature = AllocatePool (SigSize);
|
||||
Status = RsaPkcs1Sign (mRsa, HashValue, HashSize, Signature, &SigSize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
UT_ASSERT_EQUAL (SigSize, sizeof (RsaPkcs1Signature));
|
||||
|
||||
UT_ASSERT_MEM_EQUAL (Signature, RsaPkcs1Signature, SigSize);
|
||||
|
||||
//
|
||||
// Verify RSA PKCS#1-encoded Signature
|
||||
//
|
||||
Status = RsaPkcs1Verify (mRsa, HashValue, HashSize, Signature, SigSize);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
return UNIT_TEST_PASSED;
|
||||
}
|
||||
|
||||
TEST_DESC mRsaTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------------Class----------------------Function---------------------------------Pre---------------------Post---------Context
|
||||
//
|
||||
{"TestVerifyRsaSetGetKeyComponents()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaSetGetKeyComponents, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL},
|
||||
{"TestVerifyRsaGenerateKeyComponents()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaGenerateKeyComponents, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL},
|
||||
{"TestVerifyRsaPkcs1SignVerify()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaPkcs1SignVerify, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL},
|
||||
};
|
||||
|
||||
UINTN mRsaTestNum = ARRAY_SIZE(mRsaTest);
|
335
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
Normal file
335
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
Normal file
@ -0,0 +1,335 @@
|
||||
/** @file
|
||||
Sample Implementation for RFC3161 Time Stamping Verification.
|
||||
|
||||
Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include "TestBaseCryptLib.h"
|
||||
|
||||
//
|
||||
// Sample Authenticode Data with RFC3161 time stamping signature.
|
||||
// The data retrieved from one signed sample UEFI image, which is generated by MSFT's signtool
|
||||
// utility in conjunction with RFC3161 timestamping, as the following command:
|
||||
// signtool sign /ac <xxx.cer> / f <xxx.pfx> /p <pass> /fd <digestAlg>
|
||||
// /tr http://timestamp.comodoca.com/rfc3161 sample.efi
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithTS[] = {
|
||||
0x30, 0x82, 0x0c, 0x00, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
|
||||
0x82, 0x0b, 0xf1, 0x30, 0x82, 0x0b, 0xed, 0x02, 0x01, 0x01, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x09,
|
||||
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x78, 0x06, 0x0a, 0x2b,
|
||||
0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0xa0, 0x6a, 0x30, 0x68, 0x30, 0x33, 0x06,
|
||||
0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0f, 0x30, 0x25, 0x03, 0x01, 0x00,
|
||||
0xa0, 0x20, 0xa2, 0x1e, 0x80, 0x1c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x4f, 0x00, 0x62,
|
||||
0x00, 0x73, 0x00, 0x6f, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3e, 0x00, 0x3e,
|
||||
0x00, 0x3e, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02,
|
||||
0x01, 0x05, 0x00, 0x04, 0x20, 0x1e, 0x9e, 0x74, 0x31, 0xe1, 0x3e, 0x51, 0x46, 0xab, 0xce, 0x10,
|
||||
0x0d, 0x7c, 0x38, 0x66, 0x34, 0xd4, 0xdd, 0x04, 0xa5, 0xe7, 0x75, 0x40, 0xdd, 0x99, 0x73, 0xf3,
|
||||
0x2a, 0x54, 0x3e, 0xa8, 0x18, 0xa0, 0x82, 0x01, 0xee, 0x30, 0x82, 0x01, 0xea, 0x30, 0x82, 0x01,
|
||||
0x57, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x2c, 0x65, 0xcf, 0xcf, 0xdd, 0x61, 0x7b, 0xa4,
|
||||
0x41, 0xad, 0x26, 0x1b, 0x63, 0xce, 0x91, 0x0f, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,
|
||||
0x1d, 0x05, 0x00, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08,
|
||||
0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x37,
|
||||
0x32, 0x38, 0x30, 0x37, 0x33, 0x38, 0x35, 0x39, 0x5a, 0x17, 0x0d, 0x33, 0x39, 0x31, 0x32, 0x33,
|
||||
0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x13, 0x07, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, 0x30, 0x81, 0x9f, 0x30,
|
||||
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
|
||||
0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0x94, 0xa6, 0x02, 0x15, 0x87, 0xd6, 0xbf,
|
||||
0x71, 0xe8, 0xc6, 0x68, 0xf6, 0x9f, 0x66, 0x09, 0x6c, 0xe7, 0x39, 0x52, 0xf4, 0x4e, 0xaf, 0xf5,
|
||||
0xe0, 0xba, 0x0f, 0xfd, 0xe6, 0x77, 0xa9, 0x71, 0x5b, 0x5c, 0x92, 0x50, 0x1d, 0xfd, 0x9b, 0x6e,
|
||||
0x52, 0x92, 0x9e, 0x3a, 0x75, 0x86, 0x41, 0x2a, 0x41, 0x30, 0x1b, 0x67, 0x66, 0x91, 0xde, 0x71,
|
||||
0x84, 0xe0, 0x90, 0xc3, 0x50, 0x36, 0x78, 0xb5, 0xa0, 0x1e, 0x72, 0xde, 0xe7, 0x66, 0x42, 0x4f,
|
||||
0x59, 0x5e, 0x3d, 0xf3, 0x85, 0x82, 0x0b, 0xa8, 0x26, 0x2d, 0xd9, 0xe3, 0x14, 0xda, 0x9d, 0x2e,
|
||||
0x3f, 0x53, 0x4d, 0x8d, 0x10, 0xbf, 0xa4, 0x7c, 0xe5, 0xaf, 0x3a, 0xa6, 0xaf, 0x49, 0x64, 0xb0,
|
||||
0x60, 0x17, 0x87, 0x71, 0x77, 0x59, 0x52, 0xe5, 0x5a, 0xed, 0x96, 0x7d, 0x7e, 0x5d, 0xc1, 0xef,
|
||||
0x6b, 0xfb, 0x80, 0xc5, 0x2b, 0x10, 0xfe, 0xe7, 0xd3, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x48,
|
||||
0x30, 0x46, 0x30, 0x44, 0x06, 0x03, 0x55, 0x1d, 0x01, 0x04, 0x3d, 0x30, 0x3b, 0x80, 0x10, 0x19,
|
||||
0x8d, 0x48, 0xa1, 0xb9, 0xf3, 0x5e, 0x3c, 0x13, 0xb4, 0x08, 0xb6, 0xd9, 0xf3, 0x4f, 0x0a, 0xa1,
|
||||
0x15, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08, 0x54, 0x65,
|
||||
0x73, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x82, 0x10, 0x27, 0xcb, 0x16, 0x33, 0x8b, 0xed, 0x4d, 0xa8,
|
||||
0x47, 0xf0, 0x86, 0x47, 0x10, 0xef, 0x15, 0xd9, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,
|
||||
0x1d, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x51, 0x94, 0xed, 0x7a, 0x5c, 0x0b, 0x34, 0x16, 0x9c,
|
||||
0xf4, 0x5f, 0x88, 0x16, 0xa8, 0x4b, 0x13, 0xfc, 0xa4, 0x0a, 0xc7, 0xd9, 0x20, 0xb1, 0x93, 0xc5,
|
||||
0x81, 0x4f, 0x35, 0x3a, 0x89, 0x10, 0x04, 0xc4, 0xcc, 0x10, 0x34, 0xc3, 0x15, 0x57, 0x06, 0x97,
|
||||
0xee, 0x06, 0x2f, 0xf3, 0x24, 0xa1, 0xe6, 0x3a, 0x89, 0x4d, 0xb4, 0x7b, 0x12, 0x87, 0x90, 0x8c,
|
||||
0xfc, 0x5b, 0xb0, 0xf0, 0xdd, 0xaa, 0x3a, 0x24, 0x6d, 0x55, 0x47, 0x8a, 0xf2, 0x61, 0x08, 0x7a,
|
||||
0x59, 0x5f, 0x6e, 0x7b, 0xcb, 0x34, 0xbe, 0xb6, 0x5d, 0xcb, 0x60, 0xae, 0xc4, 0xda, 0x62, 0xbb,
|
||||
0x7f, 0x17, 0x1e, 0x73, 0xd1, 0x4e, 0x9f, 0x6e, 0xd3, 0xc8, 0x35, 0x58, 0x30, 0xd2, 0x89, 0xe5,
|
||||
0x22, 0x5e, 0x86, 0xac, 0x7a, 0x56, 0xd6, 0x70, 0xdb, 0x54, 0x10, 0x6c, 0xd3, 0xd5, 0x38, 0xfb,
|
||||
0x69, 0xcb, 0x4f, 0x36, 0x83, 0xc2, 0xe8, 0x31, 0x82, 0x09, 0x69, 0x30, 0x82, 0x09, 0x65, 0x02,
|
||||
0x01, 0x01, 0x30, 0x27, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
|
||||
0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x02, 0x10, 0x2c, 0x65, 0xcf, 0xcf, 0xdd,
|
||||
0x61, 0x7b, 0xa4, 0x41, 0xad, 0x26, 0x1b, 0x63, 0xce, 0x91, 0x0f, 0x30, 0x0d, 0x06, 0x09, 0x60,
|
||||
0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0xa0, 0x5e, 0x30, 0x10, 0x06, 0x0a,
|
||||
0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0c, 0x31, 0x02, 0x30, 0x00, 0x30, 0x19,
|
||||
0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x03, 0x31, 0x0c, 0x06, 0x0a, 0x2b,
|
||||
0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0x30, 0x2f, 0x06, 0x09, 0x2a, 0x86, 0x48,
|
||||
0x86, 0xf7, 0x0d, 0x01, 0x09, 0x04, 0x31, 0x22, 0x04, 0x20, 0x97, 0x6e, 0x29, 0x47, 0xc4, 0x03,
|
||||
0x68, 0x70, 0x1c, 0x99, 0x2c, 0x61, 0xb0, 0xbc, 0xde, 0x77, 0xe1, 0xa1, 0xeb, 0x4c, 0x1c, 0xac,
|
||||
0x4c, 0x64, 0xf6, 0x43, 0x96, 0x94, 0x0b, 0xc0, 0xbb, 0x03, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
|
||||
0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x81, 0x80, 0x85, 0x93, 0xad, 0x93,
|
||||
0x92, 0x9e, 0xa4, 0x94, 0x30, 0x02, 0xe1, 0xc8, 0xcd, 0x37, 0xb2, 0xe1, 0xcb, 0xb2, 0x0f, 0x1c,
|
||||
0x67, 0xd1, 0xc9, 0xeb, 0x4d, 0x68, 0x85, 0x97, 0x5a, 0xa6, 0x0c, 0x03, 0xc7, 0x86, 0xae, 0xb3,
|
||||
0x35, 0xb4, 0x1d, 0x0e, 0x95, 0x5f, 0xed, 0x37, 0x13, 0x6b, 0x1e, 0x94, 0x80, 0xf1, 0xac, 0x55,
|
||||
0x73, 0xd1, 0x31, 0xf9, 0xad, 0x13, 0x7b, 0x26, 0xbf, 0xe7, 0x55, 0x7b, 0xb2, 0xf9, 0x21, 0x42,
|
||||
0x23, 0x64, 0xe6, 0x45, 0x03, 0x67, 0xcb, 0x42, 0xd3, 0x71, 0x3f, 0xd5, 0x29, 0x17, 0x4b, 0x49,
|
||||
0x45, 0x0e, 0x8b, 0xba, 0x1f, 0x15, 0x5a, 0x7f, 0x7b, 0x5e, 0x9b, 0x22, 0x46, 0xa7, 0x9c, 0x0d,
|
||||
0x25, 0x9c, 0x76, 0x25, 0x02, 0xc8, 0x15, 0x00, 0x51, 0xe6, 0x73, 0x39, 0xac, 0x8d, 0x41, 0x7b,
|
||||
0xc8, 0x42, 0xc9, 0xdb, 0x1b, 0x16, 0x13, 0xf6, 0x44, 0x32, 0xef, 0x17, 0xa1, 0x82, 0x08, 0x34,
|
||||
0x30, 0x82, 0x08, 0x30, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x03, 0x03, 0x01,
|
||||
0x31, 0x82, 0x08, 0x20,
|
||||
0x30, 0x82, 0x08, 0x1c, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
|
||||
0x82, 0x08, 0x0d, 0x30, 0x82, 0x08, 0x09, 0x02, 0x01, 0x03, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x05,
|
||||
0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x30, 0x81, 0xf6, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86,
|
||||
0xf7, 0x0d, 0x01, 0x09, 0x10, 0x01, 0x04, 0xa0, 0x81, 0xe6, 0x04, 0x81, 0xe3, 0x30, 0x81, 0xe0,
|
||||
0x02, 0x01, 0x01, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xb2, 0x31, 0x02, 0x01, 0x01, 0x30,
|
||||
0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xcd, 0x06,
|
||||
0xf0, 0xbd, 0x8b, 0xcd, 0x5c, 0x2e, 0x5a, 0x7c, 0x42, 0x56, 0x2c, 0x20, 0x4a, 0x15, 0xcb, 0x1d,
|
||||
0x8b, 0x0e, 0x02, 0x15, 0x00, 0xb6, 0xff, 0x47, 0x05, 0xb6, 0x2d, 0x15, 0xac, 0x3f, 0x5d, 0xd9,
|
||||
0xcf, 0x9d, 0x54, 0x35, 0x56, 0x7c, 0xc1, 0x6e, 0x8b, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x34, 0x30,
|
||||
0x37, 0x32, 0x38, 0x30, 0x38, 0x35, 0x30, 0x30, 0x33, 0x5a, 0xa0, 0x81, 0x83, 0xa4, 0x81, 0x80,
|
||||
0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31,
|
||||
0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30, 0x0e,
|
||||
0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a,
|
||||
0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20,
|
||||
0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x13, 0x1b, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x20, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72,
|
||||
0xa0, 0x82, 0x04, 0x97, 0x30, 0x82, 0x04, 0x93, 0x30, 0x82, 0x03, 0x7b, 0xa0, 0x03, 0x02, 0x01,
|
||||
0x02, 0x02, 0x10, 0x47, 0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2,
|
||||
0x87, 0x07, 0xbe, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
|
||||
0x05, 0x00, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31,
|
||||
0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c,
|
||||
0x61, 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0a, 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54,
|
||||
0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0b, 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73,
|
||||
0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06,
|
||||
0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69,
|
||||
0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30,
|
||||
0x30, 0x35, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x35, 0x30,
|
||||
0x35, 0x31, 0x30, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09,
|
||||
0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55,
|
||||
0x04, 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63,
|
||||
0x68, 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,
|
||||
0x07, 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0a, 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d,
|
||||
0x69, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1b, 0x43,
|
||||
0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x69, 0x6e, 0x67, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,
|
||||
0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,
|
||||
0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbc, 0x35, 0xa0, 0x36, 0x70,
|
||||
0x22, 0x81, 0x11, 0xc3, 0xb2, 0x83, 0xb9, 0xd3, 0x28, 0xc6, 0x36, 0xcd, 0x25, 0x6b, 0xa9, 0x7b,
|
||||
0xb2, 0x1c, 0xf6, 0x9b, 0x51, 0x9c, 0xef, 0x35, 0xf4, 0xed, 0x08, 0x8e, 0x5e, 0x38, 0x08, 0xf8,
|
||||
0x77, 0x3c, 0x0a, 0x42, 0xe0, 0xf3, 0x70, 0xdc, 0xa3, 0xd7, 0xca, 0xf5, 0x4c, 0x0b, 0xcf, 0xff,
|
||||
0x22, 0x9c, 0x0a, 0x7e, 0x68, 0xd6, 0x09, 0xa2, 0x2a, 0x84, 0x7b, 0xa6, 0x9d, 0xb4, 0xa9, 0xc1,
|
||||
0x33, 0xe2, 0xef, 0x1f, 0x17, 0x48, 0xca, 0x3a, 0xcd, 0x46, 0xe6, 0xc5, 0xaa, 0x77, 0xbd, 0xe3,
|
||||
0x77, 0x9a, 0xfa, 0x47, 0x53, 0x40, 0x28, 0x59, 0x43, 0x93, 0xf1, 0xa4, 0x81, 0xea, 0xef, 0x80,
|
||||
0xb5, 0x4f, 0xa7, 0x08, 0xce, 0xba, 0x6e, 0xbc, 0xca, 0x76, 0x0c, 0x97, 0x64, 0x59, 0x86, 0x24,
|
||||
0xbb, 0x3d, 0x82, 0x90, 0xa8, 0x55, 0xb1, 0x92, 0xd3, 0xa0, 0xa7, 0x05, 0xac, 0x9f, 0x53, 0x25,
|
||||
0x08, 0x10, 0x47, 0x99, 0xcd, 0x98, 0xde, 0x68, 0xe5, 0xb4, 0x50, 0x78, 0xa3, 0xaf, 0x01, 0xcc,
|
||||
0x59, 0x43, 0x58, 0xe4, 0x76, 0x6e, 0x7e, 0xac, 0xc7, 0xe2, 0x9e, 0x1f, 0x4f, 0xb0, 0x47, 0x2d,
|
||||
0xc8, 0x0c, 0xa3, 0x49, 0x27, 0x80, 0x75, 0x8c, 0xbb, 0x06, 0x91, 0x65, 0x0f, 0x90, 0x9b, 0xf4,
|
||||
0xba, 0xd1, 0x81, 0xc8, 0x5c, 0x6a, 0xec, 0x14, 0xe9, 0x25, 0x09, 0xbf, 0x23, 0x16, 0xf4, 0x95,
|
||||
0x46, 0x40, 0x40, 0x21, 0xbb, 0x83, 0x96, 0xfd, 0x86, 0x1f, 0x7a, 0xc8, 0x0d, 0x10, 0x8e, 0xa2,
|
||||
0xf8, 0x19, 0x07, 0x58, 0x7f, 0x9f, 0xbd, 0x37, 0x02, 0x60, 0xf2, 0xa4, 0xe9, 0x9d, 0x44, 0x3f,
|
||||
0x30, 0x05, 0xe4, 0xa7, 0x70, 0x99, 0x51, 0x9a, 0xe8, 0x17, 0xf1, 0x55, 0xca, 0xb2, 0x61, 0x89,
|
||||
0x65, 0x46, 0xa7, 0x6a, 0xf2, 0x58, 0x46, 0x7e, 0xaa, 0xa0, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01,
|
||||
0xa3, 0x81, 0xf4, 0x30, 0x81, 0xf1, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30,
|
||||
0x16, 0x80, 0x14, 0xda, 0xed, 0x64, 0x74, 0x14, 0x9c, 0x14, 0x3c, 0xab, 0xdd, 0x99, 0xa9, 0xbd,
|
||||
0x5b, 0x28, 0x4d, 0x8b, 0x3c, 0xc9, 0xd8, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,
|
||||
0x04, 0x14, 0x2e, 0x2d, 0xb0, 0x0a, 0x44, 0x4a, 0xd3, 0x87, 0xc0, 0x02, 0x07, 0xce, 0x97, 0x7d,
|
||||
0x50, 0x62, 0x20, 0xfd, 0x0f, 0x83, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,
|
||||
0x04, 0x04, 0x03, 0x02, 0x06, 0xc0, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
|
||||
0x04, 0x02, 0x30, 0x00, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c,
|
||||
0x30, 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x08, 0x30, 0x42, 0x06, 0x03,
|
||||
0x55, 0x1d, 0x1f, 0x04, 0x3b, 0x30, 0x39, 0x30, 0x37, 0xa0, 0x35, 0xa0, 0x33, 0x86, 0x31, 0x68,
|
||||
0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,
|
||||
0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52,
|
||||
0x46, 0x69, 0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x63, 0x72, 0x6c,
|
||||
0x30, 0x35, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x29, 0x30, 0x27,
|
||||
0x30, 0x25, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x19, 0x68, 0x74,
|
||||
0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,
|
||||
0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
|
||||
0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xc8, 0xfb, 0x63, 0xf8, 0x0b,
|
||||
0x75, 0x75, 0x2c, 0x3a, 0xf1, 0xf2, 0x13, 0xa7, 0x2d, 0xb6, 0xa3, 0x1a, 0x9c, 0xad, 0x01, 0x07,
|
||||
0xd3, 0x34, 0x8e, 0x77, 0xe0, 0xc2, 0x6e, 0xae, 0x02, 0x5d, 0x48, 0x4f, 0xa4, 0xd2, 0x21, 0xb6,
|
||||
0x36, 0xfd, 0x2a, 0x35, 0x43, 0x7c, 0x6b, 0xdf, 0x80, 0x87, 0x0b, 0x15, 0xf0, 0x76, 0x32, 0x00,
|
||||
0xb4, 0xce, 0xb5, 0x67, 0xa4, 0x2f, 0x2f, 0x20, 0x1b, 0x9c, 0x54, 0x9e, 0x83, 0x3f, 0x1f, 0x5f,
|
||||
0x14, 0x95, 0x62, 0x82, 0x0f, 0x22, 0x41, 0x22, 0x1f, 0x70, 0xb3, 0xf3, 0xf7, 0x42, 0xde, 0x6c,
|
||||
0x51, 0xcd, 0x4b, 0xf8, 0x21, 0xac, 0x9b, 0x3b, 0x8c, 0xb1, 0xe5, 0xe6, 0x28, 0x8f, 0xce, 0x2a,
|
||||
0x8a, 0xf9, 0xaa, 0x52, 0x4d, 0x8c, 0x5b, 0x77, 0xba, 0x4d, 0x5a, 0x58, 0xdb, 0xbb, 0x6a, 0x04,
|
||||
0xcc, 0x52, 0x1e, 0x9d, 0xe2, 0x28, 0x37, 0x0e, 0xbb, 0xe7, 0x0e, 0x91, 0xc7, 0xf8, 0xdb, 0xf1,
|
||||
0x81, 0x98, 0xeb, 0xcd, 0x37, 0xb3, 0x0e, 0xab, 0x65, 0xd3, 0x62, 0xec, 0x3a, 0xa5, 0x76, 0xeb,
|
||||
0x13, 0xa8, 0x35, 0x93, 0xc9, 0x2e, 0x0a, 0x01, 0xec, 0xc0, 0xe8, 0xcc, 0x3d, 0x7e, 0xb6, 0xeb,
|
||||
0xe2, 0xc1, 0xec, 0xd3, 0x14, 0x92, 0x82, 0x66, 0x87, 0x50, 0xdc, 0xfd, 0x50, 0x97, 0xac, 0xb3,
|
||||
0x4a, 0x76, 0x73, 0x06, 0xc4, 0x86, 0x11, 0x3a, 0xb3, 0x5f, 0x43, 0x04, 0x52, 0x6f, 0xea, 0xb3,
|
||||
0xd0, 0x74, 0x36, 0x4c, 0xca, 0xf1, 0x1b, 0x79, 0x84, 0x37, 0x70, 0x63, 0xad, 0x74, 0xb9, 0xaa,
|
||||
0x0e, 0xf3, 0x98, 0xb0, 0x86, 0x08, 0xeb, 0xdb, 0xe0, 0x1f, 0x8c, 0x10, 0xf2, 0x39, 0x64, 0x9b,
|
||||
0xae, 0x4f, 0x0a, 0x2c, 0x92, 0x8a, 0x4f, 0x18, 0xb5, 0x91, 0xe5, 0x8d, 0x1a, 0x93, 0x5f, 0x1f,
|
||||
0xae, 0xf1, 0xa6, 0xf0, 0x2e, 0x97, 0xd0, 0xd2, 0xf6, 0x2b, 0x3c, 0x31, 0x82, 0x02, 0x61, 0x30,
|
||||
0x82, 0x02, 0x5d, 0x02, 0x01, 0x01, 0x30, 0x81, 0xaa, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09,
|
||||
0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
|
||||
0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,
|
||||
0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c, 0x61, 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31,
|
||||
0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53,
|
||||
0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31,
|
||||
0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x55, 0x54, 0x4e,
|
||||
0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x02, 0x10, 0x47, 0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2,
|
||||
0x87, 0x07, 0xbe, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0xa0, 0x81,
|
||||
0x8c, 0x30, 0x1a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x03, 0x31, 0x0d,
|
||||
0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x10, 0x01, 0x04, 0x30, 0x1c, 0x06,
|
||||
0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x05, 0x31, 0x0f, 0x17, 0x0d, 0x31, 0x34,
|
||||
0x30, 0x37, 0x32, 0x38, 0x30, 0x38, 0x35, 0x30, 0x30, 0x33, 0x5a, 0x30, 0x23, 0x06, 0x09, 0x2a,
|
||||
0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x04, 0x31, 0x16, 0x04, 0x14, 0x7a, 0xad, 0x35, 0xdc,
|
||||
0x5b, 0xd6, 0x00, 0xd7, 0x44, 0xac, 0x80, 0x8f, 0x4f, 0xb6, 0xb4, 0x03, 0x62, 0x34, 0x53, 0xdc,
|
||||
0x30, 0x2b, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x10, 0x02, 0x0c, 0x31,
|
||||
0x1c, 0x30, 0x1a, 0x30, 0x18, 0x30, 0x16, 0x04, 0x14, 0x3d, 0xbb, 0x6d, 0xb5, 0x08, 0x5c, 0x6d,
|
||||
0xd5, 0xa1, 0xca, 0x7f, 0x9c, 0xf8, 0x4e, 0xcb, 0x1a, 0x39, 0x10, 0xca, 0xc8, 0x30, 0x0d, 0x06,
|
||||
0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00,
|
||||
0x73, 0x64, 0xb9, 0xa3, 0x54, 0x6f, 0x50, 0x97, 0x01, 0xa7, 0xf6, 0x0d, 0xb8, 0xce, 0x4b, 0xaa,
|
||||
0x43, 0xa2, 0x8f, 0xa3, 0xea, 0x93, 0xf2, 0xa3, 0xd0, 0x46, 0xde, 0xdd, 0x45, 0xe5, 0x94, 0x5a,
|
||||
0x45, 0xc2, 0x13, 0x1b, 0x90, 0x9b, 0xcf, 0x73, 0xcd, 0x28, 0x70, 0xf0, 0xf4, 0x54, 0xb5, 0x2d,
|
||||
0x31, 0xf9, 0xf3, 0x2d, 0x38, 0x78, 0xfe, 0x68, 0xea, 0x3c, 0xc0, 0xbe, 0x0b, 0x5a, 0x91, 0x49,
|
||||
0x63, 0xeb, 0x26, 0x32, 0x5b, 0x86, 0xcf, 0xe5, 0x8a, 0xa5, 0x9d, 0xe6, 0x4b, 0x57, 0x91, 0x8f,
|
||||
0x3c, 0xdc, 0xa6, 0x53, 0xd8, 0xdb, 0x8a, 0xfd, 0x3e, 0x7e, 0x19, 0x6f, 0x27, 0x72, 0x95, 0xc2,
|
||||
0x79, 0x73, 0xdf, 0xfb, 0x08, 0x5c, 0x5b, 0xc8, 0xb7, 0x94, 0x75, 0x88, 0x7a, 0x9a, 0x85, 0x9f,
|
||||
0x1b, 0xa3, 0x98, 0x30, 0x91, 0xee, 0xc0, 0x52, 0xd2, 0x75, 0x9c, 0xcb, 0x45, 0x0d, 0x94, 0x43,
|
||||
0x67, 0x7a, 0x49, 0x1c, 0xb1, 0x89, 0x9d, 0x6e, 0xfa, 0x87, 0xd2, 0x4d, 0x6e, 0x74, 0x90, 0xf5,
|
||||
0x80, 0x8c, 0x92, 0xda, 0xd9, 0xa1, 0x48, 0x20, 0x31, 0x02, 0x79, 0xde, 0xe3, 0xbd, 0x09, 0x04,
|
||||
0xa8, 0xd4, 0x99, 0xd7, 0x3b, 0xea, 0xf8, 0xdf, 0xb3, 0xb9, 0xd7, 0xa3, 0x36, 0xa1, 0xdb, 0xd3,
|
||||
0xec, 0x65, 0x8c, 0xb8, 0x8f, 0xfb, 0xd6, 0xef, 0x9c, 0x32, 0x3e, 0xab, 0x20, 0x74, 0xb9, 0x65,
|
||||
0x4c, 0xc6, 0x15, 0x2f, 0x31, 0x2a, 0x34, 0x3e, 0x84, 0x09, 0xb4, 0x75, 0xbc, 0xbe, 0xaf, 0xb3,
|
||||
0x9e, 0x85, 0xf1, 0xbb, 0x99, 0x1a, 0x07, 0xbd, 0x20, 0xa6, 0xed, 0xcf, 0xd1, 0xa6, 0x9a, 0x22,
|
||||
0xb2, 0x6d, 0x75, 0xf4, 0x23, 0x58, 0x13, 0x78, 0x73, 0x1a, 0xb2, 0x84, 0xde, 0xad, 0xe8, 0x6d,
|
||||
0xe6, 0xe7, 0x5c, 0xb6, 0xe6, 0x5b, 0x10, 0x37, 0x1f, 0xe3, 0x6e, 0xbd, 0x83, 0xd7, 0x51, 0xb1,
|
||||
0x00, 0x00, 0x00, 0x00, 0x0a
|
||||
};
|
||||
|
||||
//
|
||||
// The Comodo Time Stamping Signer Certificate Used for the verification of TimeStamp signature.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TSTrustedCert[] = {
|
||||
0x30, 0x82, 0x04, 0x93, 0x30, 0x82, 0x03, 0x7b, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47,
|
||||
0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2, 0x87, 0x07, 0xbe, 0x30,
|
||||
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81,
|
||||
0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b,
|
||||
0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31, 0x17, 0x30, 0x15, 0x06,
|
||||
0x03, 0x55, 0x04, 0x07, 0x13, 0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c, 0x61, 0x6b, 0x65, 0x20,
|
||||
0x43, 0x69, 0x74, 0x79, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x54,
|
||||
0x68, 0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x4e, 0x65, 0x74,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x68,
|
||||
0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,
|
||||
0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x03,
|
||||
0x13, 0x14, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73, 0x74, 0x2d,
|
||||
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, 0x30, 0x35, 0x31, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x35, 0x30, 0x35, 0x31, 0x30, 0x32,
|
||||
0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x12,
|
||||
0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x74,
|
||||
0x65, 0x72, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x61, 0x6c,
|
||||
0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x43,
|
||||
0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64,
|
||||
0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1b, 0x43, 0x4f, 0x4d, 0x4f, 0x44,
|
||||
0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x69, 0x6e, 0x67, 0x20,
|
||||
0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
|
||||
0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,
|
||||
0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbc, 0x35, 0xa0, 0x36, 0x70, 0x22, 0x81, 0x11, 0xc3,
|
||||
0xb2, 0x83, 0xb9, 0xd3, 0x28, 0xc6, 0x36, 0xcd, 0x25, 0x6b, 0xa9, 0x7b, 0xb2, 0x1c, 0xf6, 0x9b,
|
||||
0x51, 0x9c, 0xef, 0x35, 0xf4, 0xed, 0x08, 0x8e, 0x5e, 0x38, 0x08, 0xf8, 0x77, 0x3c, 0x0a, 0x42,
|
||||
0xe0, 0xf3, 0x70, 0xdc, 0xa3, 0xd7, 0xca, 0xf5, 0x4c, 0x0b, 0xcf, 0xff, 0x22, 0x9c, 0x0a, 0x7e,
|
||||
0x68, 0xd6, 0x09, 0xa2, 0x2a, 0x84, 0x7b, 0xa6, 0x9d, 0xb4, 0xa9, 0xc1, 0x33, 0xe2, 0xef, 0x1f,
|
||||
0x17, 0x48, 0xca, 0x3a, 0xcd, 0x46, 0xe6, 0xc5, 0xaa, 0x77, 0xbd, 0xe3, 0x77, 0x9a, 0xfa, 0x47,
|
||||
0x53, 0x40, 0x28, 0x59, 0x43, 0x93, 0xf1, 0xa4, 0x81, 0xea, 0xef, 0x80, 0xb5, 0x4f, 0xa7, 0x08,
|
||||
0xce, 0xba, 0x6e, 0xbc, 0xca, 0x76, 0x0c, 0x97, 0x64, 0x59, 0x86, 0x24, 0xbb, 0x3d, 0x82, 0x90,
|
||||
0xa8, 0x55, 0xb1, 0x92, 0xd3, 0xa0, 0xa7, 0x05, 0xac, 0x9f, 0x53, 0x25, 0x08, 0x10, 0x47, 0x99,
|
||||
0xcd, 0x98, 0xde, 0x68, 0xe5, 0xb4, 0x50, 0x78, 0xa3, 0xaf, 0x01, 0xcc, 0x59, 0x43, 0x58, 0xe4,
|
||||
0x76, 0x6e, 0x7e, 0xac, 0xc7, 0xe2, 0x9e, 0x1f, 0x4f, 0xb0, 0x47, 0x2d, 0xc8, 0x0c, 0xa3, 0x49,
|
||||
0x27, 0x80, 0x75, 0x8c, 0xbb, 0x06, 0x91, 0x65, 0x0f, 0x90, 0x9b, 0xf4, 0xba, 0xd1, 0x81, 0xc8,
|
||||
0x5c, 0x6a, 0xec, 0x14, 0xe9, 0x25, 0x09, 0xbf, 0x23, 0x16, 0xf4, 0x95, 0x46, 0x40, 0x40, 0x21,
|
||||
0xbb, 0x83, 0x96, 0xfd, 0x86, 0x1f, 0x7a, 0xc8, 0x0d, 0x10, 0x8e, 0xa2, 0xf8, 0x19, 0x07, 0x58,
|
||||
0x7f, 0x9f, 0xbd, 0x37, 0x02, 0x60, 0xf2, 0xa4, 0xe9, 0x9d, 0x44, 0x3f, 0x30, 0x05, 0xe4, 0xa7,
|
||||
0x70, 0x99, 0x51, 0x9a, 0xe8, 0x17, 0xf1, 0x55, 0xca, 0xb2, 0x61, 0x89, 0x65, 0x46, 0xa7, 0x6a,
|
||||
0xf2, 0x58, 0x46, 0x7e, 0xaa, 0xa0, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xf4, 0x30,
|
||||
0x81, 0xf1, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xda,
|
||||
0xed, 0x64, 0x74, 0x14, 0x9c, 0x14, 0x3c, 0xab, 0xdd, 0x99, 0xa9, 0xbd, 0x5b, 0x28, 0x4d, 0x8b,
|
||||
0x3c, 0xc9, 0xd8, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x2e, 0x2d,
|
||||
0xb0, 0x0a, 0x44, 0x4a, 0xd3, 0x87, 0xc0, 0x02, 0x07, 0xce, 0x97, 0x7d, 0x50, 0x62, 0x20, 0xfd,
|
||||
0x0f, 0x83, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,
|
||||
0x06, 0xc0, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
|
||||
0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c, 0x30, 0x0a, 0x06, 0x08,
|
||||
0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x08, 0x30, 0x42, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04,
|
||||
0x3b, 0x30, 0x39, 0x30, 0x37, 0xa0, 0x35, 0xa0, 0x33, 0x86, 0x31, 0x68, 0x74, 0x74, 0x70, 0x3a,
|
||||
0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73,
|
||||
0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x35, 0x06, 0x08,
|
||||
0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x29, 0x30, 0x27, 0x30, 0x25, 0x06, 0x08,
|
||||
0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x19, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
|
||||
0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xc8, 0xfb, 0x63, 0xf8, 0x0b, 0x75, 0x75, 0x2c, 0x3a,
|
||||
0xf1, 0xf2, 0x13, 0xa7, 0x2d, 0xb6, 0xa3, 0x1a, 0x9c, 0xad, 0x01, 0x07, 0xd3, 0x34, 0x8e, 0x77,
|
||||
0xe0, 0xc2, 0x6e, 0xae, 0x02, 0x5d, 0x48, 0x4f, 0xa4, 0xd2, 0x21, 0xb6, 0x36, 0xfd, 0x2a, 0x35,
|
||||
0x43, 0x7c, 0x6b, 0xdf, 0x80, 0x87, 0x0b, 0x15, 0xf0, 0x76, 0x32, 0x00, 0xb4, 0xce, 0xb5, 0x67,
|
||||
0xa4, 0x2f, 0x2f, 0x20, 0x1b, 0x9c, 0x54, 0x9e, 0x83, 0x3f, 0x1f, 0x5f, 0x14, 0x95, 0x62, 0x82,
|
||||
0x0f, 0x22, 0x41, 0x22, 0x1f, 0x70, 0xb3, 0xf3, 0xf7, 0x42, 0xde, 0x6c, 0x51, 0xcd, 0x4b, 0xf8,
|
||||
0x21, 0xac, 0x9b, 0x3b, 0x8c, 0xb1, 0xe5, 0xe6, 0x28, 0x8f, 0xce, 0x2a, 0x8a, 0xf9, 0xaa, 0x52,
|
||||
0x4d, 0x8c, 0x5b, 0x77, 0xba, 0x4d, 0x5a, 0x58, 0xdb, 0xbb, 0x6a, 0x04, 0xcc, 0x52, 0x1e, 0x9d,
|
||||
0xe2, 0x28, 0x37, 0x0e, 0xbb, 0xe7, 0x0e, 0x91, 0xc7, 0xf8, 0xdb, 0xf1, 0x81, 0x98, 0xeb, 0xcd,
|
||||
0x37, 0xb3, 0x0e, 0xab, 0x65, 0xd3, 0x62, 0xec, 0x3a, 0xa5, 0x76, 0xeb, 0x13, 0xa8, 0x35, 0x93,
|
||||
0xc9, 0x2e, 0x0a, 0x01, 0xec, 0xc0, 0xe8, 0xcc, 0x3d, 0x7e, 0xb6, 0xeb, 0xe2, 0xc1, 0xec, 0xd3,
|
||||
0x14, 0x92, 0x82, 0x66, 0x87, 0x50, 0xdc, 0xfd, 0x50, 0x97, 0xac, 0xb3, 0x4a, 0x76, 0x73, 0x06,
|
||||
0xc4, 0x86, 0x11, 0x3a, 0xb3, 0x5f, 0x43, 0x04, 0x52, 0x6f, 0xea, 0xb3, 0xd0, 0x74, 0x36, 0x4c,
|
||||
0xca, 0xf1, 0x1b, 0x79, 0x84, 0x37, 0x70, 0x63, 0xad, 0x74, 0xb9, 0xaa, 0x0e, 0xf3, 0x98, 0xb0,
|
||||
0x86, 0x08, 0xeb, 0xdb, 0xe0, 0x1f, 0x8c, 0x10, 0xf2, 0x39, 0x64, 0x9b, 0xae, 0x4f, 0x0a, 0x2c,
|
||||
0x92, 0x8a, 0x4f, 0x18, 0xb5, 0x91, 0xe5, 0x8d, 0x1a, 0x93, 0x5f, 0x1f, 0xae, 0xf1, 0xa6, 0xf0,
|
||||
0x2e, 0x97, 0xd0, 0xd2, 0xf6, 0x2b, 0x3c, 0x0a
|
||||
};
|
||||
|
||||
UNIT_TEST_STATUS
|
||||
EFIAPI
|
||||
TestVerifyImageTimestampVerify (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
BOOLEAN Status;
|
||||
EFI_TIME SigningTime;
|
||||
|
||||
Status = FALSE;
|
||||
|
||||
//
|
||||
// Verify RFC3161 Timestamp CounterSignature.
|
||||
//
|
||||
Status = ImageTimestampVerify (
|
||||
AuthenticodeWithTS,
|
||||
sizeof (AuthenticodeWithTS),
|
||||
TSTrustedCert,
|
||||
sizeof (TSTrustedCert),
|
||||
&SigningTime
|
||||
);
|
||||
UT_ASSERT_TRUE (Status);
|
||||
|
||||
UT_ASSERT_EQUAL (SigningTime.Year, 2014);
|
||||
UT_ASSERT_EQUAL (SigningTime.Month, 7);
|
||||
UT_ASSERT_EQUAL (SigningTime.Day, 28);
|
||||
UT_ASSERT_EQUAL (SigningTime.Hour, 8);
|
||||
UT_ASSERT_EQUAL (SigningTime.Minute, 50);
|
||||
UT_ASSERT_EQUAL (SigningTime.Second, 3);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
TEST_DESC mImageTimestampTest[] = {
|
||||
//
|
||||
// -----Description--------------------------------------Class----------------------------Function-----------------Pre---Post--Context
|
||||
//
|
||||
{"TestVerifyImageTimestampVerify()", "CryptoPkg.BaseCryptLib.ImageTimestamp", TestVerifyImageTimestampVerify, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
UINTN mImageTimestampTestNum = ARRAY_SIZE(mImageTimestampTest);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user