summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* ArmPkg/ArmTrngLib: Remove ASSERTs in ArmTrngLibConstructor()Pierre Gondois2022-11-261-5/+0
| | | | | | | | Remove ASSERTs in ArmTrngLibConstructor() that prevent from booting on DEBUG builds. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* pip-requirements.txt: Update to edk2-pytool-extensions 0.20.0edk2-stable202211Michael Kubacki2022-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Updates edk2-pytool-extensions to pick up a major version release: 0.19.1 to 0.20.0 changes: - .vscode/settings.json: Enable flake8 linting - Add Pydocstyle - Move dependabot.yml location - Fix typos in robot files - Pydocstyle Updates - Plugin Loader Updates - edk2_stuart_pr_eval: Improve robustness of path comparisons - edk2_pr_eval.py: Build all packages on file change outside package - Allow build wrappers Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* pip-requirements.txt: Update to edk2-pytool-library 0.12.1Michael Kubacki2022-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Updates edk2-pytool-library to pick up a minor bug fix release: 0.12.0 to 0.12.1 changes: - path_utilities.py: Prevent path case modification in GetContainingModules() That change prevents the case of paths from being set to lower case when returned from the function to avoid impacting case-sensitive callers. Release notes: https://github.com/tianocore/edk2-pytool-library/releases/tag/v0.12.1 Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* ArmPkg/ArmTrngLib: Remove ASSERT in GetArmTrngVersion()Pierre Gondois2022-11-161-1/+0
| | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4150 GetArmTrngVersion() is used to check the presence of an Arm Trng. If not found, an ASSERT prevents from booting in DEBUG builds. Remove this ASSERT. Reported-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* Maintainers: Update the VmgExitLib to CcExitLibMin M Xu2022-11-141-1/+1
| | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123 VmgExitLib is renamed as CcExitLib. The related section in Maintainers.txt should be updated as well. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
* OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLibMin M Xu2022-11-1415-117/+117
| | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123 APIs which are defined in CcExitLib.h are added with the CcExit prefix. This is to make the APIs' name more meaningful. This change impacts OvmfPkg/UefiCpuPkg. Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
* OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLibMin M Xu2022-11-1449-141/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123 VmgExitLib once was designed to provide interfaces to support #VC handler and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is introduced, this library is updated to support #VE as well. Now the name of VmgExitLib cannot reflect what the lib does. This patch renames VmgExitLib to CcExitLib (Cc means Confidential Computing). This is a simple renaming and there is no logic changes. After renaming all the VmgExitLib related codes are updated with CcExitLib. These changes are in OvmfPkg/UefiCpuPkg/UefiPayloadPkg. Cc: Guo Dong <guo.dong@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Cc: James Lu <james.lu@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: James Lu <james.lu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
* UefiCpuPkg/ResetVector:Add Option to reserve 4K region at 4GBDuggapu, Chinni B2022-11-111-1/+9
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4140 Some implementations may need to keep the initial Reset code to be separated out from rest of the code.This request is to add padding at lower 4K region below 4 GB which will result having only few jmp instructions and data at that region. Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Duggapu Chinni B <chinni.b.duggapu@intel.com>
* MdePkg/Test: Add port of BaseSafeIntLib unit tests to GoogleTestMichael D Kinney2022-11-116-0/+3179
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml outputMichael D Kinney2022-11-111-2/+5
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 Set environment variable GTEST_OUTPUT to specify the output format of XML and the output file name. Both CMOCKA_XML_FILE and GTEST_OUTPUT are set for each host based unit test to support both cmocka unit tests and gtest unit tests. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* .pytool: Add googletest submodule to CISettings.pyMichael D Kinney2022-11-111-0/+2
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
* UnitTestFrameworkPkg/Library/CmockaLib: Generate symbol informationMichael D Kinney2022-11-111-1/+1
| | | | | | | | | Add /Zi to CC_FLAGS in CmockaLib.inf to enable symbol information Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
* UnitTestFrameworkPkg: Add googletest submodule and GoogleTestLibMichael D Kinney2022-11-1113-31/+610
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 Add submodule for googletest and add GoogleTestLib that is required for GoogleTest based unit tests. Add GoogleTest documentation to Readme.md along with a port of the sample unit test to the GoogleTest style. A few typos in Readme.md are also fixed. Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg/Include/Library: Undefine _ASSERT() if already definedMichael D Kinney2022-11-111-0/+3
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 When unit testing is enabled, make sure _ASSERT() is not already defined by the host environment before defining _ASSERT(). This avoids conflicts with VS20xx builds of GoogleTest based unit tests. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg/Include: Update Base.h to improve C++ compatibilityMichael D Kinney2022-11-111-2/+10
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 * Map NULL to nullptr or __null when c++ compiler is used. * Map STATIC_ASSERT to static_assert when a c++ compiler is used. * Typecast RETURN_SUCCESS to type RETURN_STATUS to match type used by all return error/warning status codes. C++ has stricter type checking and found this inconsistency. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* IntelFsp2Pkg: Improvement of supporting null UPD pointer in FSP-TKuo, Ted2022-11-115-46/+55
| | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4114 1.Use xmm5 slot 1 and xmm6 slot 3 to save ucode status and UPD pointer respectively in TempRamInitApi in IA32 FspSecCoreT. 2.Correct inappropriate description in the return value of AsmGetFspInfoHeader. 3.Replace hardcoded offset value 0x1C with FSP_HEADER_IMGBASE_OFFSET in FspHeler.nasm. Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Ashraf Ali S <ashraf.ali.s@intel.com> Cc: Chinni B Duggapu <chinni.b.duggapu@intel.com> Signed-off-by: Ted Kuo <ted.kuo@intel.com> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
* ArmPkg/ArmTrngLib: Fix incorrect GUID reference in DEBUG() outputArd Biesheuvel2022-11-111-1/+1
| | | | | | | | | ArmTrngLib crashes when run in DEBUG mode due to the fact that it passed the [truncated] GUID value to a DEBUG() print statement instead of a pointer to the GUID which is what the %g conversion expects. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* .github/workflows: Update CodeQL to install Python 3.10.6Michael D Kinney2022-11-111-0/+5
| | | | | | | | Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
* ShellPkg:Improved Smbios Type9 data under smbiosviewSainadh Nagolu2022-11-112-6/+13
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4135 Added spec version check while publishing new Type9 fields, added Slot Pitch field which was missing and corrected the publishing order as per Smbios spec. Cc: Vasudevan S <vasudevans@ami.com> Cc: Sundaresan S <sundaresans@ami.com> Signed-off-by: Sainadh Nagolu <sainadhn@ami.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* pip-requirements.txt: Update edk2-pytool-library to 0.12.0Michael D Kinney2022-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4146 Update edk2-pytool-library to version 0.12.0 that adds support for the environment variable PYTOOL_TEMPORARILY_IGNORE_NESTED_EDK_PACKAGES that can be set to true to ignore nested packages instead of breaking the build with an exception. Nested packages are not allowed by the edk2 specifications. This environment variable allows pytools to run with reduced functionality if nested packages are present giving downstream consumers of edk2 that use pytools time to resolve the use of nested packages and restore all features of pytools. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* edk2.qls: Allow error severity results and add new queriesMichael Kubacki2022-11-092-2/+3
| | | | | | | | | | | | | | | | | | The query cpp/conditionallyuninitializedvariable was initially enabled with the CodeQL code because work was in progress on those changes. The results were filtered out so CodeQL passed so we could verify the CodeQL workflow without impacting CI results. This change allows error severity messages and substitutes that query with two queries that do not return failures. This allows these queries to find future problems and prepares the CodeQL workflow to catch future failures as queries are enabled. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools: Fix wrong type of arguments to formatting functionsMichael Kubacki2022-11-095-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issues found with the cpp/wrong-type-format-argument CodeQL rule in BaseTools. Reference: https://cwe.mitre.org/data/definitions/686.html The following CodeQL errors are resolved: 1. Check failure on line 1115 in BaseTools/Source/C/EfiRom/EfiRom.c - This argument should be of type 'int' but is of type 'char *'. - This argument should be of type 'int' but is of type 'signed char *'. 2. Check failure on line 359 in BaseTools/Source/C/GenFw/Elf32Convert.c - This argument should be of type 'CHAR8 *' but is of type 'unsigned int'. 3. Check failure on line 1841 in BaseTools/Source/C/GenFw/Elf64Convert.c - This argument should be of type 'unsigned int' but is of type 'unsigned long long'. 4. Check failure on line 1871 in BaseTools/Source/C/GenFw/Elf64Convert.c - This argument should be of type 'unsigned int' but is of type 'unsigned long long'. 5. Check failure on line 2400 in BaseTools/Source/C/GenFv/GenFvInternalLib.c - This argument should be of type 'unsigned long long' but is of type 'unsigned int'. 6. Check failure on line 1099 in BaseTools/Source/C/GenFw/Elf64Convert.c - This argument should be of type 'CHAR8 *' but is of type 'unsigned int'. 7. Check failure on line 1098 in BaseTools/Source/C/GenSec/GenSec.c - This argument should be of type 'CHAR8 *' but is of type 'char **'. 8. Check failure on line 911 in BaseTools/Source/C/GenSec/GenSec.c - This argument should be of type 'CHAR8 *' but is of type 'char **'. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools/Source/C: Use /Z7 instead of /Zi for host toolsMichael D Kinney2022-11-085-14/+12
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4139 Update ms.common and *.mak files to use /Z7 instead of /Zi to embed symbol information in obj files for host tools built with VS compilers. This prevents vcxxx.pdb files from being generated in the root of the local edk2 repository or in BaseTools directories. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* PrmPkg/PrmSsdtInstallDxe: Update PRMT Device CID to PNP0C02.Wei6 Xu2022-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4141 PRMT device is an unknown device in Device Manager if there is no Windows Driver installed for it. It will cause WHQL Signed Driver test failure. To complete WHQL certification, update PRMT Device CID to PNP0C02. In this way, PRMT Device will be a Motherboard Resources when no real driver is loaded (default), but will be shown as the actual device name when a legitimate Windows Driver is loaded. Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
* .github: Add initial CodeQL config and workflow filesMichael Kubacki2022-11-083-0/+133
| | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4115 Adds initial support for enabling CodeQL Code Scanning in this repository per the RFC: https://github.com/tianocore/edk2/discussions/3258 Adds the following new files: - .github/workflows/codql-analysis.yml - The main GitHub workflow file used to setup CodeQL in the repo. - .github/codeql/codeql-config.yml - The main CodeQL configuration file used to customize the queries and other resources the repo is using for CodeQL. - edk2.qls - A query set of queries to run for CodeQL. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* Maintainers.txt: Add .github maintainers and reviewersMichael Kubacki2022-11-081-0/+6
| | | | | | | | | | | | Adds the maintainers and reviewers for the new .github directory being added to hold GitHub workflows files. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* CryptoPkg: Sha1 functions causing build errorsJudah Vang2022-11-081-1/+13
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3991 Fix build issue when DiSABLE_SHA1_DEPRECATED_INTERFACES is defined. Percolate the #ifndef DiSABLE_SHA1_DEPRECATED_INTERFACES to all the Sha1 functions. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Nishant C Mistry <nishant.c.mistry@intel.com> Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Nishant C Mistry <nishant.c.mistry@intel.com> Signed-off-by: Judah Vang <judah.vang@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* PrmPkg: Use UnitTestFrameworkPkg UEFI BS libraryMichael Kubacki2022-11-0713-3725/+0
| | | | | | | | | | | Updates PrmPkg to use UnitTestUefiBootServicesTableLib from UnitTestFrameworkPkg instead of UefiBootServicesTableLibUnitTest in PrmPkg. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* UnitTestFrameworkPkg: Add UnitTestUefiBootServicesTableLibMichael Kubacki2022-11-0713-0/+3720
| | | | | | | | | | | | | | | | | | | | | | | | This library supports a Boot Services table library implementation that allows code dependent upon UefiBootServicesTableLib to operate in an isolated execution environment such as within the context of a host-based unit test framework. The unit test should initialize the Boot Services database with any required elements (e.g. protocols, events, handles, etc.) prior to the services being invoked by code under test. It is strongly recommended to clean any global databases (e.g. protocol, event, handles, etc.) after every unit test so the tests execute in a predictable manner from a clean state. This library is being moved here from PrmPkg so it can be made more generally available to other packages and improved upon for others use. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* CryptoPkg/Readme.md: typo and grammar fixesLaszlo Ersek2022-11-071-23/+23
| | | | | | | | | | | | | | | | | | Commit 244ce33bdd2f ("CryptoPkg: Add Readme.md", 2022-10-24) had added the long-awaited documentation on the dynamic crypto services. Fix some of the typos and arguable grammar errors in "Readme.md". A few light clarifications are also snuck in. Cc: Christopher Zurcher <christopher.zurcher@microsoft.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Christopher Zurcher <christopher.zurcher@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* MdePkg/BaseLib: Fix out-of-bounds reads in SafeStringPedro Falcato2022-11-071-4/+21
| | | | | | | | | | | | | | | | | | There was a OOB access in *StrHexTo* functions, when passed strings like "XDEADBEEF". OpenCore folks established an ASAN-equipped project to fuzz Ext4Dxe, which was able to catch these (mostly harmless) issues. Cc: Vitaly Cheptsov <vit9696@protonmail.com> Cc: Marvin H?user <mhaeuser@posteo.de> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <Jiewen.yao@Intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* ArmVirtPkg: Kvmtool: Add RNG support using Arm TRNG interfaceSami Mujawar2022-11-062-0/+15
| | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) The EFI_RNG_PROTOCOL published by RngDxe has been updated to implement the EFI_RNG_ALGORITHM_RAW using the Arm TRNG interface to provide access to entropy. Therefore, enable EFI_RNG_PROTOCOL for the Kvmtool guest/virtual firmware. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* SecurityPkg/RngDxe: Add Arm support of RngDxePierre Gondois2022-11-065-64/+133
| | | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) Add RngDxe support for Arm. This implementation uses the ArmTrngLib to support the RawAlgorithm and doens't support the RNDR instruction. To re-use the RngGetRNG(), RngGetInfo() and FreeAvailableAlgorithms() functions, create Arm/AArch64 files which implement the arch specific function GetAvailableAlgorithms(). Indeed, FEAT_RNG instruction is not supported on Arm. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Rename AArch64/RngDxe.cPierre Gondois2022-11-062-1/+1
| | | | | | | | | To re-use the AArch64/RngDxe.c for an Arm implementation, rename AArch64/RngDxe.c to ArmRngDxe.c. Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithmPierre Gondois2022-11-061-0/+10
| | | | | | | | | PcdCpuRngSupportedAlgorithm should allow to identify the the algorithm used by the RNDR CPU instruction to generate a random number. Add a debug warning if the Pcd is not set. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through ArmTrngLibSami Mujawar2022-11-064-4/+103
| | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) RawAlgorithm is used to provide access to entropy that is suitable for cryptographic applications. Therefore, add RawAlgorithm support that provides access to entropy using the ArmTrngLib. Also remove unused UefiBootServicesTableLib library inclusion and Status variable. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Check before advertising Cpu Rng algoPierre Gondois2022-11-065-9/+172
| | | | | | | | | | | | | | | | | | | | | RngGetBytes() relies on the RngLib. The RngLib might use the RNDR instruction if the FEAT_RNG feature is present. RngGetInfo and RngGetRNG both must check that RngGetBytes() is working before advertising/using it. To do so, allocate an array storing the available algorithms. The Rng algorithm at the lowest index will be the default Rng algorithm. The array is shared between RngGetInfo and RngGetRNG. This array is allocated when the driver is loaded, and freed when unloaded. This patch also prevents from having PcdCpuRngSupportedAlgorithm let to a zero GUID, but let the possibility to have no valid Rng algorithm in such case. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Documentation/include/parameter cleanupPierre Gondois2022-11-063-5/+3
| | | | | | | | | | | | | This patch: -Update RngGetBytes() documentation to align the function definition and declaration. -Improve input parameter checking. Even though 'This' it is not used, the parameter should always point to the current EFI_RNG_PROTOCOL. -Removes TimerLib inclusion as unused. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms()Pierre Gondois2022-11-064-82/+33
| | | | | | | | | | | | | | | | | RngGetInfo() is one of the 2 functions of the EFI_RNG_PROTOCOL. RngGetInfo() is currently a mere wrapper around ArchGetSupportedRngAlgorithms() which is implemented differently depending on the architecture used. RngGetInfo() does nothing more than calling ArchGetSupportedRngAlgorithms(). So remove it, and let RngGetInfo() be implemented differently according to the architecture. This follows the implementation of the other function of the EFI_RNG_PROTOCOL, RngGetRNG(). Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256GuidPierre Gondois2022-11-061-5/+2
| | | | | | | | | | | | | | gEfiRngAlgorithmSp80090Ctr256Guid was used as the default algorithm in RngGetRNG(). The commit below set the default algorithm to PcdCpuRngSupportedAlgorithm, which is a zero GUID by default. As the Pcd value is not defined for any platform in the edk2-platfoms repository, assume it was an error and go back to the first version, using gEfiRngAlgorithmSp80090Ctr256Guid. Fixes: 4e5ecdbac8bd ("SecurityPkg: Add support for RngDxe on AARCH64") Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic nameSami Mujawar2022-11-065-50/+37
| | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) Rename RdRandGenerateEntropy() to GenerateEntropy() to provide a common interface to generate entropy on other architectures. GenerateEntropy() is intended to generate high quality entropy. Also move the definition to RngDxeInternals.h Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com>
* ArmPkg/ArmTrngLib: Add Arm TRNG librarySami Mujawar2022-11-064-0/+468
| | | | | | | | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) The Arm True Random Number Generator Firmware, Interface 1.0, Platform Design Document (https://developer.arm.com/documentation/den0098/latest/) defines an interface between an Operating System (OS) executing at EL1 and Firmware (FW) exposing a conditioned entropy source that is provided by a TRNG back end. The conditioned entropy, that is provided by the Arm TRNG interface, is commonly used to seed deterministic random number generators. This patch adds an ArmTrngLib library that implements the Arm TRNG interface. Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg: Add FID definitions for Arm TRNGSami Mujawar2022-11-061-2/+107
| | | | | | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) The Arm True Random Number Generator Firmware, Interface 1.0, Platform Design Document (https://developer.arm.com/documentation/den0098/latest/) defines an interface between an Operating System (OS) executing at EL1 and Firmware (FW) exposing a conditioned entropy source that is provided by a TRNG back end. New function IDs have been defined by the specification for accessing the TRNG services. Therefore, add these definitions to the Arm standard SMC header. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG LibrarySami Mujawar2022-11-065-0/+165
| | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) The Arm True Random Number Generator (TRNG) library defines an interface to access the entropy source on a platform. On platforms that do not have access to an entropy source, a NULL instance of the TRNG library may be useful to satisfy the build dependency. Therefore, add a NULL instance of the Arm TRNG library. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg/ArmTrngLib: Definition for Arm TRNG library class interfaceSami Mujawar2022-11-062-0/+111
| | | | | | | | | | | | | | | | | | | | Bugzilla: 3668 (https://bugzilla.tianocore.org/show_bug.cgi?id=3668) The NIST Special Publications 800-90A, 800-90B and 800-90C provide recommendations for random number generation. The NIST 800-90C, Recommendation for Random Bit Generator (RBG) Constructions, defines the GetEntropy() interface that is used to access the entropy source. The GetEntropy() interface is further used by Deterministic Random Bit Generators (DRBG) to generate random numbers. The Arm True Random Number Generator (TRNG) library defines an interface to access the entropy source on a platform, following the 'Arm True Random Number Generator Firmware Interface' specification. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* ArmPkg/ArmHvcLibNull: Add NULL instance of ArmHvcLibPierre Gondois2022-11-063-0/+52
| | | | | | | Add a Null instance of ArmHvcLib in case of library dependencies. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* ArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dscPierre Gondois2022-11-061-2/+2
| | | | | | | | Sort the section containing HVC/SMC libraries prior to adding new libraries in this specific section. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* ArmPkg/ArmMonitorLib: Add ArmMonitorLibPierre Gondois2022-11-063-0/+64
| | | | | | | | | | The ArmMonitorLib provides an abstract interface to issue an HyperVisor Call (HVC) or System Monitor Call (SMC) depending on the default conduit. The PcdMonitorConduitHvc PCD allows to select the default conduit. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library classPierre Gondois2022-11-062-0/+47
| | | | | | | | | | | | | The ArmMonitorLib provides an abstract interface to issue an HyperVisor Call (HVC) or System Monitor Call (SMC) depending on the default conduit. The PcdMonitorConduitHvc PCD allows to select the default conduit. The new library relies on the ArmHvcLib and ArmSmcLib libraries. A Null instance of these libraries can be used for the unused conduit. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* ArmPkg: PCD to select conduit for monitor callsSami Mujawar2022-11-061-1/+6
| | | | | | | | | | | | Define a PCD 'PcdMonitorConduitHvc' to select the conduit to use for monitor calls. PcdMonitorConduitHvc is defined as FALSE by default, meaning the SMC conduit is enabled as default. Adding PcdMonitorConduitHvc allows selection of HVC conduit to be used by virtual firmware implementations. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>