Compare commits
313 Commits
edk2-stabl
...
rebase-sta
Author | SHA1 | Date | |
---|---|---|---|
|
242dcee217 | ||
|
3f8a2a16b9 | ||
|
c24fa67677 | ||
|
cd00f3f47f | ||
|
b4f9a2237d | ||
|
9df51aa79f | ||
|
013e5c94d6 | ||
|
f04bd1e3b8 | ||
|
3e722403cd | ||
|
66c69871e7 | ||
|
c98f7f7550 | ||
|
865229bcc8 | ||
|
4ddf2448ed | ||
|
9440986d4e | ||
|
32460bb5b1 | ||
|
207b6d68a0 | ||
|
dff3d3811f | ||
|
4afb939531 | ||
|
72a9ef1c8a | ||
|
1904a64bcc | ||
|
4c4ceb2ceb | ||
|
a85336531c | ||
|
e10d83234c | ||
|
677204f941 | ||
|
cb9d711891 | ||
|
4f58e0cf99 | ||
|
024a291b3e | ||
|
319bb7223a | ||
|
7142e64841 | ||
|
284dbac43d | ||
|
558a25366d | ||
|
4b6ee06a09 | ||
|
3c0b84420f | ||
|
25996a3441 | ||
|
b82c9631da | ||
|
f3b0ee0cee | ||
|
09340de246 | ||
|
6fd2d58d5d | ||
|
b538d6a1b1 | ||
|
b04e11b4c4 | ||
|
5cbfb93abe | ||
|
952b5cf94c | ||
|
82b0358e3f | ||
|
5590cefe93 | ||
|
916f495e77 | ||
|
efc7ccf906 | ||
|
fa7fdb89a3 | ||
|
2727231b0a | ||
|
23ed7f209c | ||
|
6b3a89a9fd | ||
|
4a6400b084 | ||
|
04c36d5a1b | ||
|
6a468a8b55 | ||
|
3dfd64305b | ||
|
47f212295f | ||
|
c56ea95b28 | ||
|
9783dc01cc | ||
|
7421094136 | ||
|
42e8fa84f7 | ||
|
51fcd2023b | ||
|
af9b851732 | ||
|
987bea6525 | ||
|
1c0d4ae2c0 | ||
|
c12bbc1490 | ||
|
17f333f2a4 | ||
|
7097c97bde | ||
|
370c55b2ba | ||
|
24fa360857 | ||
|
248aa153f6 | ||
|
fecf55a66a | ||
|
f0ed194236 | ||
|
fd290ab862 | ||
|
5f783827bb | ||
|
5d4c5253e8 | ||
|
ec6e59aefe | ||
|
1699845c5f | ||
|
3a4efc98b0 | ||
|
3d87214a20 | ||
|
fcce7f77e6 | ||
|
748d57d40f | ||
|
5e31c5666d | ||
|
e942b85a21 | ||
|
0c74aa2073 | ||
|
88781ccd74 | ||
|
54a4fd9b35 | ||
|
9bc2725198 | ||
|
cf3b34c0b8 | ||
|
750d763623 | ||
|
c3f615a1bd | ||
|
d8e4c4b000 | ||
|
74db2ed3e5 | ||
|
5f391c6606 | ||
|
338fd26b8f | ||
|
094727264f | ||
|
c0dfe3ec1f | ||
|
66c24219ad | ||
|
90b6725562 | ||
|
d97f964f7c | ||
|
e3fa6986ae | ||
|
86c8d69146 | ||
|
680030a6ec | ||
|
7dd7b89058 | ||
|
f29160a896 | ||
|
506740982b | ||
|
ddc43e7a41 | ||
|
538b8944c1 | ||
|
d0906f602b | ||
|
be92e09206 | ||
|
6780b3aba0 | ||
|
1dc752d903 | ||
|
8b02ecc5f0 | ||
|
6dc09fda04 | ||
|
390b10b548 | ||
|
7dec566775 | ||
|
0afb874349 | ||
|
47001ab989 | ||
|
a010681f74 | ||
|
28fecae8a3 | ||
|
18fdffe825 | ||
|
b505f11f39 | ||
|
5a67a2efa7 | ||
|
f6bf37c171 | ||
|
ee89b59430 | ||
|
6ced1e91ef | ||
|
789727ccf3 | ||
|
d2b18e6bc2 | ||
|
30d274e354 | ||
|
c0bf953fe8 | ||
|
8ccbf075f0 | ||
|
069f9911a3 | ||
|
2b330b57db | ||
|
f40c1f2a30 | ||
|
5fe9db0f82 | ||
|
6b14ef6b28 | ||
|
4bd3b5ab13 | ||
|
5bdb091133 | ||
|
8a6471819b | ||
|
c212fec9cf | ||
|
61185f1d50 | ||
|
93fac4fd7b | ||
|
c98fbda328 | ||
|
93ff80a218 | ||
|
71aaf7a308 | ||
|
fcfdbe2987 | ||
|
b6cd5ddce9 | ||
|
32e2968a1e | ||
|
7ea05d8fe9 | ||
|
bfcf2d66c7 | ||
|
6363872629 | ||
|
0b2f97c00a | ||
|
abaf405ed9 | ||
|
392a368533 | ||
|
032830e968 | ||
|
c5fb47ddab | ||
|
78e5019071 | ||
|
7750468c37 | ||
|
439030bc37 | ||
|
cc63e04afc | ||
|
022ddb8f84 | ||
|
fecca982e3 | ||
|
18ad6485a9 | ||
|
70892b13b2 | ||
|
74f6ce6734 | ||
|
da7858117f | ||
|
b594fba4ec | ||
|
de95e919be | ||
|
31cd5ee8c0 | ||
|
5ba3602e45 | ||
|
d77efa2ebe | ||
|
0707d9296d | ||
|
e25808f501 | ||
|
98f150a954 | ||
|
963671d380 | ||
|
665789b61b | ||
|
013006e4ef | ||
|
543add1d41 | ||
|
932db9df0c | ||
|
b7f8779fe1 | ||
|
3d5352d934 | ||
|
6ddfbeb0d6 | ||
|
f1203a4099 | ||
|
c98c14576f | ||
|
503344cdbd | ||
|
89ff5da9f9 | ||
|
ee28bea4c0 | ||
|
8707f835ae | ||
|
ee249efe8c | ||
|
6fb3cc05dc | ||
|
79d4d8a81c | ||
|
2e4e41d012 | ||
|
c8f56800fd | ||
|
b0be42516e | ||
|
29114fc574 | ||
|
b387114113 | ||
|
7cc2010f46 | ||
|
b79a64d26e | ||
|
e043e3e3bf | ||
|
8f698f0a64 | ||
|
d402de2222 | ||
|
278250045b | ||
|
37f63deeef | ||
|
596f856c13 | ||
|
1fb6462c67 | ||
|
7fde22823d | ||
|
e4e1f6229c | ||
|
cf58f47623 | ||
|
4b9312de05 | ||
|
7f1ffba5de | ||
|
35f6a2780e | ||
|
a1a6da80aa | ||
|
07c49d5d40 | ||
|
3840c35e34 | ||
|
ccbbc2a5c8 | ||
|
e7486b5064 | ||
|
68461c2c37 | ||
|
bf8f16f771 | ||
|
019feb42a1 | ||
|
5572b43c67 | ||
|
308e6e0936 | ||
|
6b3a512149 | ||
|
6f67ed45e0 | ||
|
a8b80149e1 | ||
|
ddaf39263a | ||
|
ccf91b518f | ||
|
1c0db23151 | ||
|
18fc96c9a9 | ||
|
1e603ac0d8 | ||
|
063a831c66 | ||
|
f71a76ee01 | ||
|
91460083f1 | ||
|
524feaa32f | ||
|
9f9bf82209 | ||
|
1fbc121cfe | ||
|
da4aa451ba | ||
|
e60529df58 | ||
|
2a0d4a2641 | ||
|
918288ab5a | ||
|
bff9815b61 | ||
|
1ae5bee967 | ||
|
855f528199 | ||
|
970aacd191 | ||
|
3775122ede | ||
|
47723854fd | ||
|
275d0a39c4 | ||
|
318b0d714a | ||
|
49b7faba1d | ||
|
e3bd782373 | ||
|
b7a97bfac5 | ||
|
4329b5b0cd | ||
|
52e44713d2 | ||
|
fded08e744 | ||
|
371940932d | ||
|
2ec8f0c640 | ||
|
049ff6c39c | ||
|
17b2872200 | ||
|
ae1079b386 | ||
|
dcffad2491 | ||
|
d159e22913 | ||
|
dc7cfa9bab | ||
|
bac9c74080 | ||
|
adebfe121c | ||
|
13fbc16556 | ||
|
73ac735be8 | ||
|
d9a6e7b0b8 | ||
|
d4c76fa17d | ||
|
422dfaab31 | ||
|
9da786c16f | ||
|
0ce2012c6c | ||
|
1988f2df29 | ||
|
3e91e42136 | ||
|
6d571c0070 | ||
|
0bbec15b54 | ||
|
45ad13bb64 | ||
|
dae8c29dab | ||
|
e59a40b92c | ||
|
aceb3490a2 | ||
|
3ad1d7eb7b | ||
|
8757e648d1 | ||
|
9d32a02a72 | ||
|
ba9c3ceaf8 | ||
|
e7a7169446 | ||
|
74b5309da9 | ||
|
33c81c25bb | ||
|
d25421d0d8 | ||
|
5e09b5d6d7 | ||
|
c8e77454b5 | ||
|
e2c9d8eba4 | ||
|
b485230462 | ||
|
a3ee1eea96 | ||
|
1f161a7915 | ||
|
68238d4f94 | ||
|
44fdc4f398 | ||
|
d0c0e1960a | ||
|
ba96acd963 | ||
|
f881b4d129 | ||
|
bc982869dd | ||
|
8d7c48e0e7 | ||
|
6bb39cfd00 | ||
|
a7a0443751 | ||
|
796e1b82df | ||
|
65200edb3a | ||
|
bda5b4a6cf | ||
|
7f17a15564 | ||
|
b25f84d7b3 | ||
|
efca2c6cfc | ||
|
2cb466cc2c | ||
|
7fa4a984c4 | ||
|
11ad164bce | ||
|
8ccd63d14d | ||
|
c10e5703fe | ||
|
2f4b07b668 | ||
|
2ca8d55974 | ||
|
d698bcfe4f |
24
.github/ISSUE_TEMPLATE/config.yml
vendored
24
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
## @file
|
|
||||||
# GitHub issue configuration file.
|
|
||||||
#
|
|
||||||
# This file is meant to direct contributors familiar with GitHub's issue tracker
|
|
||||||
# to the external resources used by TianoCore.
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
##
|
|
||||||
|
|
||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Bugs and Feature Requests
|
|
||||||
url: https://bugzilla.tianocore.org/
|
|
||||||
about: Submit bug reports and feature requests here
|
|
||||||
- name: Reporting Security Issues
|
|
||||||
url: https://github.com/tianocore/tianocore.github.io/wiki/Reporting-Security-Issues
|
|
||||||
about: Read the wiki page that describes the process here
|
|
||||||
- name: EDK II Development Mailing List
|
|
||||||
url: https://edk2.groups.io/g/devel
|
|
||||||
about: Submit code patches and ask questions on the mailing list (devel@edk2.groups.io)
|
|
||||||
- name: EDK II Discussions
|
|
||||||
url: https://github.com/tianocore/edk2/discussions
|
|
||||||
about: You can also reach out on the Discussion section of this repository
|
|
36
.github/dependabot.yml
vendored
36
.github/dependabot.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Dependabot configuration file to enable GitHub services for managing and updating
|
|
||||||
# dependencies.
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
||||||
##
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
commit-message:
|
|
||||||
prefix: "pip"
|
|
||||||
reviewers:
|
|
||||||
- "makubacki"
|
|
||||||
- "mdkinney"
|
|
||||||
- "spbrogan"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
day: "monday"
|
|
||||||
commit-message:
|
|
||||||
prefix: "GitHub Action"
|
|
||||||
reviewers:
|
|
||||||
- "makubacki"
|
|
||||||
- "mdkinney"
|
|
||||||
- "spbrogan"
|
|
||||||
rebase-strategy: "disabled"
|
|
350
.github/workflows/codeql.yml
vendored
350
.github/workflows/codeql.yml
vendored
@@ -1,350 +0,0 @@
|
|||||||
# This workflow runs CodeQL against the repository.
|
|
||||||
#
|
|
||||||
# Results are uploaded to GitHub Code Scanning.
|
|
||||||
#
|
|
||||||
# Due to a known issue with the CodeQL extractor when building the edk2
|
|
||||||
# codebase on Linux systems, only Windows agents are used for build with
|
|
||||||
# the VS toolchain.
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '!**.c'
|
|
||||||
- '!**.h'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: windows-2019
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- Package: "ArmPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "CryptoPkg"
|
|
||||||
ArchList: "IA32"
|
|
||||||
- Package: "CryptoPkg"
|
|
||||||
ArchList: "X64"
|
|
||||||
- Package: "DynamicTablesPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "FatPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "FmpDevicePkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "IntelFsp2Pkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "IntelFsp2WrapperPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "MdeModulePkg"
|
|
||||||
ArchList: "IA32"
|
|
||||||
- Package: "MdeModulePkg"
|
|
||||||
ArchList: "X64"
|
|
||||||
- Package: "MdePkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "PcAtChipsetPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "PrmPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "SecurityPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "ShellPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "SourceLevelDebugPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "StandaloneMmPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "UefiCpuPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "UnitTestFrameworkPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
cache: 'pip'
|
|
||||||
cache-dependency-path: 'pip-requirements.txt'
|
|
||||||
|
|
||||||
- name: Use Git Long Paths on Windows
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
git config --system core.longpaths true
|
|
||||||
|
|
||||||
- name: Install/Upgrade pip Modules
|
|
||||||
run: pip install -r pip-requirements.txt --upgrade requests sarif-tools
|
|
||||||
|
|
||||||
- name: Determine CI Settings File Supported Operations
|
|
||||||
id: get_ci_file_operations
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import importlib
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
from edk2toolext.invocables.edk2_ci_setup import CiSetupSettingsManager
|
|
||||||
from edk2toolext.invocables.edk2_setup import SetupSettingsManager
|
|
||||||
|
|
||||||
# Find the repo CI Settings file
|
|
||||||
ci_settings_file = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/CISettings.py'))
|
|
||||||
|
|
||||||
# Note: At this point, submodules have not been pulled, only one CI Settings file should exist
|
|
||||||
if len(ci_settings_file) != 1 or not ci_settings_file[0].is_file():
|
|
||||||
print("::error title=Workspace Error!::Failed to find CI Settings file!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
ci_settings_file = ci_settings_file[0]
|
|
||||||
|
|
||||||
# Try Finding the Settings class in the file
|
|
||||||
module_name = 'ci_settings'
|
|
||||||
|
|
||||||
spec = importlib.util.spec_from_file_location(module_name, ci_settings_file)
|
|
||||||
module = importlib.util.module_from_spec(spec)
|
|
||||||
spec.loader.exec_module(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
settings = getattr(module, 'Settings')
|
|
||||||
except AttributeError:
|
|
||||||
print("::error title=Workspace Error!::Failed to find Settings class in CI Settings file!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Determine Which Operations Are Supported by the Settings Class
|
|
||||||
ci_setup_supported = issubclass(settings, CiSetupSettingsManager)
|
|
||||||
setup_supported = issubclass(settings, SetupSettingsManager)
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'ci_setup_supported={str(ci_setup_supported).lower()}', file=fh)
|
|
||||||
print(f'setup_supported={str(setup_supported).lower()}', file=fh)
|
|
||||||
|
|
||||||
- name: Setup
|
|
||||||
if: steps.get_ci_file_operations.outputs.setup_supported == 'true'
|
|
||||||
run: stuart_setup -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019
|
|
||||||
|
|
||||||
- name: Upload Setup Log As An Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: (success() || failure()) && steps.get_ci_file_operations.outputs.setup_supported == 'true'
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-Logs
|
|
||||||
path: |
|
|
||||||
**/SETUPLOG.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: CI Setup
|
|
||||||
if: steps.get_ci_file_operations.outputs.ci_setup_supported == 'true'
|
|
||||||
run: stuart_ci_setup -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019
|
|
||||||
|
|
||||||
- name: Upload CI Setup Log As An Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: (success() || failure()) && steps.get_ci_file_operations.outputs.ci_setup_supported == 'true'
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-Logs
|
|
||||||
path: |
|
|
||||||
**/CISETUP.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: Update
|
|
||||||
run: stuart_update -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019
|
|
||||||
|
|
||||||
- name: Upload Update Log As An Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-Logs
|
|
||||||
path: |
|
|
||||||
**/UPDATE_LOG.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: Build Tools From Source
|
|
||||||
run: python BaseTools/Edk2ToolsBuild.py -t VS2019
|
|
||||||
|
|
||||||
- name: Find CodeQL Plugin Directory
|
|
||||||
id: find_dir
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Find the plugin directory that contains the CodeQL plugin
|
|
||||||
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('BaseTools/Plugin/CodeQL'))
|
|
||||||
|
|
||||||
# This should only be found once
|
|
||||||
if len(plugin_dir) == 1:
|
|
||||||
plugin_dir = str(plugin_dir[0])
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'codeql_plugin_dir={plugin_dir}', file=fh)
|
|
||||||
else:
|
|
||||||
print("::error title=Workspace Error!::Failed to find CodeQL plugin directory!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
- name: Get CodeQL CLI Cache Data
|
|
||||||
id: cache_key_gen
|
|
||||||
env:
|
|
||||||
CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }}
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
codeql_cli_ext_dep_name = 'codeqlcli_windows_ext_dep'
|
|
||||||
codeql_plugin_file = os.path.join(os.environ['CODEQL_PLUGIN_DIR'], codeql_cli_ext_dep_name + '.yaml')
|
|
||||||
|
|
||||||
with open (codeql_plugin_file) as pf:
|
|
||||||
codeql_cli_ext_dep = yaml.safe_load(pf)
|
|
||||||
|
|
||||||
cache_key_name = codeql_cli_ext_dep['name']
|
|
||||||
cache_key_version = codeql_cli_ext_dep['version']
|
|
||||||
cache_key = f'{cache_key_name}-{cache_key_version}'
|
|
||||||
|
|
||||||
codeql_plugin_cli_ext_dep_dir = os.path.join(os.environ['CODEQL_PLUGIN_DIR'], codeql_cli_ext_dep['name'].strip() + '_extdep')
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'codeql_cli_cache_key={cache_key}', file=fh)
|
|
||||||
print(f'codeql_cli_ext_dep_dir={codeql_plugin_cli_ext_dep_dir}', file=fh)
|
|
||||||
|
|
||||||
- name: Attempt to Load CodeQL CLI From Cache
|
|
||||||
id: codeqlcli_cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ${{ steps.cache_key_gen.outputs.codeql_cli_ext_dep_dir }}
|
|
||||||
key: ${{ steps.cache_key_gen.outputs.codeql_cli_cache_key }}
|
|
||||||
|
|
||||||
- name: Download CodeQL CLI
|
|
||||||
if: steps.codeqlcli_cache.outputs.cache-hit != 'true'
|
|
||||||
run: stuart_update -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019 --codeql
|
|
||||||
|
|
||||||
- name: Remove CI Plugins Irrelevant to CodeQL
|
|
||||||
shell: python
|
|
||||||
env:
|
|
||||||
CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }}
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Only these two plugins are needed for CodeQL
|
|
||||||
plugins_to_keep = ['CompilerPlugin']
|
|
||||||
|
|
||||||
plugin_dir = Path('.pytool/Plugin').absolute()
|
|
||||||
if plugin_dir.is_dir():
|
|
||||||
for dir in plugin_dir.iterdir():
|
|
||||||
if str(dir.stem) not in plugins_to_keep:
|
|
||||||
shutil.rmtree(str(dir.absolute()), ignore_errors=True)
|
|
||||||
|
|
||||||
- name: CI Build
|
|
||||||
env:
|
|
||||||
STUART_CODEQL_PATH: ${{ steps.cache_key_gen.outputs.codeql_cli_ext_dep_dir }}
|
|
||||||
run: stuart_ci_build -c .pytool/CISettings.py -t DEBUG -p ${{ matrix.Package }} -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019 --codeql
|
|
||||||
|
|
||||||
- name: Build Cleanup
|
|
||||||
id: build_cleanup
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
dirs_to_delete = ['ia32', 'x64', 'arm', 'aarch64']
|
|
||||||
|
|
||||||
def delete_dirs(path: Path):
|
|
||||||
if path.exists() and path.is_dir():
|
|
||||||
if path.name.lower() in dirs_to_delete:
|
|
||||||
print(f'Removed {str(path)}')
|
|
||||||
shutil.rmtree(path)
|
|
||||||
return
|
|
||||||
|
|
||||||
for child_dir in path.iterdir():
|
|
||||||
delete_dirs(child_dir)
|
|
||||||
|
|
||||||
build_path = Path(os.environ['GITHUB_WORKSPACE'], 'Build')
|
|
||||||
delete_dirs(build_path)
|
|
||||||
|
|
||||||
- name: Upload Build Logs As An Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-Logs
|
|
||||||
path: |
|
|
||||||
**/BUILD_REPORT.TXT
|
|
||||||
**/OVERRIDELOG.TXT
|
|
||||||
**/BUILDLOG_*.md
|
|
||||||
**/BUILDLOG_*.txt
|
|
||||||
**/CI_*.md
|
|
||||||
**/CI_*.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: Prepare Env Data for CodeQL Upload
|
|
||||||
id: env_data
|
|
||||||
env:
|
|
||||||
PACKAGE_NAME: ${{ matrix.Package }}
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
from edk2toollib.utility_functions import RunCmd
|
|
||||||
from io import StringIO
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
package = os.environ['PACKAGE_NAME'].strip().lower()
|
|
||||||
directory_name = 'codeql-analysis-' + package + '-debug'
|
|
||||||
file_name = 'codeql-db-' + package + '-debug-0.sarif'
|
|
||||||
sarif_path = Path('Build', directory_name, file_name)
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
if sarif_path.is_file():
|
|
||||||
emacs_file_path = sarif_path.with_name(sarif_path.stem + "-emacs.txt")
|
|
||||||
out_stream_buffer = StringIO()
|
|
||||||
exit_code = RunCmd("sarif", f"emacs {sarif_path} --output {emacs_file_path} --no-autotrim",
|
|
||||||
outstream=out_stream_buffer,
|
|
||||||
logging_level=logging.NOTSET)
|
|
||||||
print(f'upload_sarif_file=true', file=fh)
|
|
||||||
print(f'emacs_file_path={emacs_file_path}', file=fh)
|
|
||||||
print(f'sarif_file_path={sarif_path}', file=fh)
|
|
||||||
else:
|
|
||||||
print(f'upload_sarif_file=false', file=fh)
|
|
||||||
|
|
||||||
- name: Upload CodeQL Results (SARIF) As An Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: steps.env_data.outputs.upload_sarif_file == 'true'
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-CodeQL-SARIF
|
|
||||||
path: |
|
|
||||||
${{ steps.env_data.outputs.emacs_file_path }}
|
|
||||||
${{ steps.env_data.outputs.sarif_file_path }}
|
|
||||||
retention-days: 14
|
|
||||||
if-no-files-found: warn
|
|
||||||
|
|
||||||
- name: Upload CodeQL Results (SARIF) To GitHub Code Scanning
|
|
||||||
uses: github/codeql-action/upload-sarif@v2
|
|
||||||
if: steps.env_data.outputs.upload_sarif_file == 'true'
|
|
||||||
with:
|
|
||||||
# Path to SARIF file relative to the root of the repository.
|
|
||||||
sarif_file: ${{ steps.env_data.outputs.sarif_file_path }}
|
|
||||||
# Optional category for the results. Used to differentiate multiple results for one commit.
|
|
||||||
# Each package is a separate category.
|
|
||||||
category: ${{ matrix.Package }}
|
|
44
.github/workflows/stale.yml
vendored
44
.github/workflows/stale.yml
vendored
@@ -1,44 +0,0 @@
|
|||||||
# This workflow warns and then closes issues and PRs that have had no activity
|
|
||||||
# for a specified amount of time.
|
|
||||||
#
|
|
||||||
# For more information, see:
|
|
||||||
# https://github.com/actions/stale
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Stale Check
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# At 23:35 on every day-of-week from Sunday through Saturday
|
|
||||||
# https://crontab.guru/#35_23_*_*_0-6
|
|
||||||
- cron: '35 23 * * 0-6'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
name: Stale
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check for Stale Items
|
|
||||||
uses: actions/stale@v8
|
|
||||||
with:
|
|
||||||
days-before-issue-close: -1
|
|
||||||
days-before-issue-stale: -1
|
|
||||||
days-before-pr-stale: 60
|
|
||||||
days-before-pr-close: 7
|
|
||||||
stale-pr-message: >
|
|
||||||
This PR has been automatically marked as stale because it has not had
|
|
||||||
activity in 60 days. It will be closed if no further activity occurs within
|
|
||||||
7 days. Thank you for your contributions.
|
|
||||||
close-pr-message: >
|
|
||||||
This pull request has been automatically been closed because it did not have any
|
|
||||||
activity in 60 days and no follow up within 7 days after being marked stale.
|
|
||||||
Thank you for your contributions.
|
|
||||||
stale-pr-label: stale
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -35,3 +35,6 @@
|
|||||||
[submodule "CryptoPkg/Library/MbedTlsLib/mbedtls"]
|
[submodule "CryptoPkg/Library/MbedTlsLib/mbedtls"]
|
||||||
path = CryptoPkg/Library/MbedTlsLib/mbedtls
|
path = CryptoPkg/Library/MbedTlsLib/mbedtls
|
||||||
url = https://github.com/ARMmbed/mbedtls
|
url = https://github.com/ARMmbed/mbedtls
|
||||||
|
[submodule "SecurityPkg/DeviceSecurity/SpdmLib/libspdm"]
|
||||||
|
path = SecurityPkg/DeviceSecurity/SpdmLib/libspdm
|
||||||
|
url = https://github.com/DMTF/libspdm.git
|
||||||
|
@@ -237,6 +237,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
|
|||||||
"MdePkg/Library/MipiSysTLib/mipisyst", False))
|
"MdePkg/Library/MipiSysTLib/mipisyst", False))
|
||||||
rs.append(RequiredSubmodule(
|
rs.append(RequiredSubmodule(
|
||||||
"CryptoPkg/Library/MbedTlsLib/mbedtls", False))
|
"CryptoPkg/Library/MbedTlsLib/mbedtls", False))
|
||||||
|
rs.append(RequiredSubmodule(
|
||||||
|
"SecurityPkg/DeviceSecurity/SpdmLib/libspdm", False))
|
||||||
return rs
|
return rs
|
||||||
|
|
||||||
def GetName(self):
|
def GetName(self):
|
||||||
|
@@ -139,11 +139,6 @@
|
|||||||
# Define if the GICv3 controller should use the GICv2 legacy
|
# Define if the GICv3 controller should use the GICv2 legacy
|
||||||
gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE|BOOLEAN|0x00000042
|
gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE|BOOLEAN|0x00000042
|
||||||
|
|
||||||
## Define the conduit to use for monitor calls.
|
|
||||||
# Default PcdMonitorConduitHvc = FALSE, conduit = SMC
|
|
||||||
# If PcdMonitorConduitHvc = TRUE, conduit = HVC
|
|
||||||
gArmTokenSpaceGuid.PcdMonitorConduitHvc|FALSE|BOOLEAN|0x00000047
|
|
||||||
|
|
||||||
# Whether to remap all unused memory NX before installing the CPU arch
|
# Whether to remap all unused memory NX before installing the CPU arch
|
||||||
# protocol driver. This is needed on platforms that map all DRAM with RWX
|
# protocol driver. This is needed on platforms that map all DRAM with RWX
|
||||||
# attributes initially, and can be disabled otherwise.
|
# attributes initially, and can be disabled otherwise.
|
||||||
@@ -317,6 +312,11 @@
|
|||||||
gArmTokenSpaceGuid.PcdSystemBiosRelease|0xFFFF|UINT16|0x30000058
|
gArmTokenSpaceGuid.PcdSystemBiosRelease|0xFFFF|UINT16|0x30000058
|
||||||
gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease|0xFFFF|UINT16|0x30000059
|
gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease|0xFFFF|UINT16|0x30000059
|
||||||
|
|
||||||
|
## Define the conduit to use for monitor calls.
|
||||||
|
# Default PcdMonitorConduitHvc = FALSE, conduit = SMC
|
||||||
|
# If PcdMonitorConduitHvc = TRUE, conduit = HVC
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc|FALSE|BOOLEAN|0x00000047
|
||||||
|
|
||||||
[PcdsFixedAtBuild.common, PcdsDynamic.common]
|
[PcdsFixedAtBuild.common, PcdsDynamic.common]
|
||||||
#
|
#
|
||||||
# ARM Architectural Timer
|
# ARM Architectural Timer
|
||||||
|
@@ -1,44 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2012 - 2021, Arm Limited. All rights reserved.<BR>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef ARM_CORTEX_A5X_H_
|
|
||||||
#define ARM_CORTEX_A5X_H_
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cortex A5x feature bit definitions
|
|
||||||
//
|
|
||||||
#define A5X_FEATURE_SMP (1 << 6)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Helper functions to access CPU Extended Control Register
|
|
||||||
//
|
|
||||||
UINT64
|
|
||||||
EFIAPI
|
|
||||||
ArmReadCpuExCr (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmWriteCpuExCr (
|
|
||||||
IN UINT64 Val
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmSetCpuExCrBit (
|
|
||||||
IN UINT64 Bits
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ArmUnsetCpuExCrBit (
|
|
||||||
IN UINT64 Bits
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif // ARM_CORTEX_A5X_H_
|
|
@@ -1,57 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2011, ARM Limited. All rights reserved.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef ARM_CORTEX_A9_H_
|
|
||||||
#define ARM_CORTEX_A9_H_
|
|
||||||
|
|
||||||
#include <Chipset/ArmV7.h>
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cortex A9 feature bit definitions
|
|
||||||
//
|
|
||||||
#define A9_FEATURE_PARITY (1<<9)
|
|
||||||
#define A9_FEATURE_AOW (1<<8)
|
|
||||||
#define A9_FEATURE_EXCL (1<<7)
|
|
||||||
#define A9_FEATURE_SMP (1<<6)
|
|
||||||
#define A9_FEATURE_FOZ (1<<3)
|
|
||||||
#define A9_FEATURE_DPREF (1<<2)
|
|
||||||
#define A9_FEATURE_HINT (1<<1)
|
|
||||||
#define A9_FEATURE_FWD (1<<0)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cortex A9 Watchdog
|
|
||||||
//
|
|
||||||
#define ARM_A9_WATCHDOG_REGION 0x600
|
|
||||||
|
|
||||||
#define ARM_A9_WATCHDOG_LOAD_REGISTER 0x20
|
|
||||||
#define ARM_A9_WATCHDOG_CONTROL_REGISTER 0x28
|
|
||||||
|
|
||||||
#define ARM_A9_WATCHDOG_WATCHDOG_MODE (1 << 3)
|
|
||||||
#define ARM_A9_WATCHDOG_TIMER_MODE (0 << 3)
|
|
||||||
#define ARM_A9_WATCHDOG_SINGLE_SHOT (0 << 1)
|
|
||||||
#define ARM_A9_WATCHDOG_AUTORELOAD (1 << 1)
|
|
||||||
#define ARM_A9_WATCHDOG_ENABLE 1
|
|
||||||
|
|
||||||
//
|
|
||||||
// SCU register offsets & masks
|
|
||||||
//
|
|
||||||
#define A9_SCU_CONTROL_OFFSET 0x0
|
|
||||||
#define A9_SCU_CONFIG_OFFSET 0x4
|
|
||||||
#define A9_SCU_INVALL_OFFSET 0xC
|
|
||||||
#define A9_SCU_FILT_START_OFFSET 0x40
|
|
||||||
#define A9_SCU_FILT_END_OFFSET 0x44
|
|
||||||
#define A9_SCU_SACR_OFFSET 0x50
|
|
||||||
#define A9_SCU_SSACR_OFFSET 0x54
|
|
||||||
|
|
||||||
UINTN
|
|
||||||
EFIAPI
|
|
||||||
ArmGetScuBaseAddress (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif // ARM_CORTEX_A9_H_
|
|
@@ -1,9 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Linaro Ltd. All rights reserved.
|
* Copyright (c) 2015, Linaro Ltd. All rights reserved.
|
||||||
|
* Copyright (c) 2024, Arm Limited. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
*
|
*
|
||||||
|
* @par Reference(s):
|
||||||
|
* - Arm Generic Interrupt Controller Architecture Specification,
|
||||||
|
* Issue H, January 2022.
|
||||||
|
* (https://developer.arm.com/documentation/ihi0069/)
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef ARM_GIC_ARCH_LIB_H_
|
#ifndef ARM_GIC_ARCH_LIB_H_
|
||||||
@@ -23,4 +29,12 @@ ArmGicGetSupportedArchRevision (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// GIC SPI and extended SPI ranges
|
||||||
|
//
|
||||||
|
#define ARM_GIC_ARCH_SPI_MIN 32
|
||||||
|
#define ARM_GIC_ARCH_SPI_MAX 1019
|
||||||
|
#define ARM_GIC_ARCH_EXT_SPI_MIN 4096
|
||||||
|
#define ARM_GIC_ARCH_EXT_SPI_MAX 5119
|
||||||
|
|
||||||
#endif // ARM_GIC_ARCH_LIB_H_
|
#endif // ARM_GIC_ARCH_LIB_H_
|
||||||
|
@@ -26,7 +26,7 @@ ArmMonitorCall (
|
|||||||
IN OUT ARM_MONITOR_ARGS *Args
|
IN OUT ARM_MONITOR_ARGS *Args
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (FeaturePcdGet (PcdMonitorConduitHvc)) {
|
if (PcdGetBool (PcdMonitorConduitHvc)) {
|
||||||
ArmCallHvc ((ARM_HVC_ARGS *)Args);
|
ArmCallHvc ((ARM_HVC_ARGS *)Args);
|
||||||
} else {
|
} else {
|
||||||
ArmCallSmc ((ARM_SMC_ARGS *)Args);
|
ArmCallSmc ((ARM_SMC_ARGS *)Args);
|
||||||
|
@@ -73,14 +73,4 @@ PeiCommonExceptionEntry (
|
|||||||
IN UINTN LR
|
IN UINTN LR
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
* Autogenerated function that calls the library constructors for all of the
|
|
||||||
* module's dependent libraries.
|
|
||||||
*/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ProcessLibraryConstructorList (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 1.30
|
||||||
BASE_NAME = ArmPlatformPrePeiCore
|
BASE_NAME = ArmPlatformPrePeiCore
|
||||||
FILE_GUID = b78d02bb-d0b5-4389-bc7f-b39ee846c784
|
FILE_GUID = b78d02bb-d0b5-4389-bc7f-b39ee846c784
|
||||||
MODULE_TYPE = SEC
|
MODULE_TYPE = SEC
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 1.30
|
||||||
BASE_NAME = ArmPlatformPrePeiCore
|
BASE_NAME = ArmPlatformPrePeiCore
|
||||||
FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b
|
FILE_GUID = 469fc080-aec1-11df-927c-0002a5d5c51b
|
||||||
MODULE_TYPE = SEC
|
MODULE_TYPE = SEC
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 1.30
|
||||||
BASE_NAME = ArmPlatformPrePiMPCore
|
BASE_NAME = ArmPlatformPrePiMPCore
|
||||||
FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8
|
FILE_GUID = d959e387-7b91-452c-90e0-a1dbac90ddb8
|
||||||
MODULE_TYPE = SEC
|
MODULE_TYPE = SEC
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 1.30
|
||||||
BASE_NAME = ArmPlatformPrePiUniCore
|
BASE_NAME = ArmPlatformPrePiUniCore
|
||||||
FILE_GUID = 3e401783-cc94-4fcd-97bc-bd35ac369d2f
|
FILE_GUID = 3e401783-cc94-4fcd-97bc-bd35ac369d2f
|
||||||
MODULE_TYPE = SEC
|
MODULE_TYPE = SEC
|
||||||
|
@@ -79,10 +79,4 @@ ArchInitialize (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ProcessLibraryConstructorList (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* _PREPI_H_ */
|
#endif /* _PREPI_H_ */
|
||||||
|
@@ -156,7 +156,9 @@
|
|||||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
||||||
!endif
|
!endif
|
||||||
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||||
RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
|
||||||
|
ArmTrngLib|ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf
|
||||||
|
ArmMonitorLib|ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# Secure Boot dependencies
|
# Secure Boot dependencies
|
||||||
@@ -266,6 +268,7 @@
|
|||||||
|
|
||||||
[LibraryClasses.ARM]
|
[LibraryClasses.ARM]
|
||||||
ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
|
ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
|
||||||
|
RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
||||||
|
|
||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
|
||||||
|
@@ -201,6 +201,9 @@
|
|||||||
[PcdsDynamicHii]
|
[PcdsDynamicHii]
|
||||||
gUefiOvmfPkgTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gOvmfVariableGuid|0x0|FALSE|NV,BS
|
gUefiOvmfPkgTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gOvmfVariableGuid|0x0|FALSE|NV,BS
|
||||||
|
|
||||||
|
[PcdsPatchableInModule.common]
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Components Section - list of all EDK II Modules needed by this Platform
|
# Components Section - list of all EDK II Modules needed by this Platform
|
||||||
|
@@ -126,8 +126,6 @@
|
|||||||
# Use MMIO for accessing RTC controller registers.
|
# Use MMIO for accessing RTC controller registers.
|
||||||
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcUseMmio|TRUE
|
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcUseMmio|TRUE
|
||||||
|
|
||||||
gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE
|
|
||||||
|
|
||||||
[PcdsFixedAtBuild.common]
|
[PcdsFixedAtBuild.common]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
|
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F
|
||||||
|
|
||||||
@@ -167,6 +165,8 @@
|
|||||||
#
|
#
|
||||||
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
|
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
|
||||||
|
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE
|
||||||
|
|
||||||
[PcdsPatchableInModule.common]
|
[PcdsPatchableInModule.common]
|
||||||
#
|
#
|
||||||
# This will be overridden in the code
|
# This will be overridden in the code
|
||||||
|
@@ -49,10 +49,10 @@
|
|||||||
|
|
||||||
!include NetworkPkg/NetworkDefines.dsc.inc
|
!include NetworkPkg/NetworkDefines.dsc.inc
|
||||||
|
|
||||||
!include ArmVirtPkg/ArmVirt.dsc.inc
|
|
||||||
|
|
||||||
!include MdePkg/MdeLibs.dsc.inc
|
!include MdePkg/MdeLibs.dsc.inc
|
||||||
|
|
||||||
|
!include ArmVirtPkg/ArmVirt.dsc.inc
|
||||||
|
|
||||||
[LibraryClasses.common]
|
[LibraryClasses.common]
|
||||||
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
||||||
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
|
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
# Virtio Support
|
# Virtio Support
|
||||||
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
||||||
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
||||||
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf
|
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioDxeLib.inf
|
||||||
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
|
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
|
||||||
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
|
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
|
||||||
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
|
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
|
||||||
@@ -124,8 +124,6 @@
|
|||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
!if $(CAVIUM_ERRATUM_27456) == TRUE
|
!if $(CAVIUM_ERRATUM_27456) == TRUE
|
||||||
GCC:*_*_AARCH64_PP_FLAGS = -DCAVIUM_ERRATUM_27456
|
GCC:*_*_AARCH64_PP_FLAGS = -DCAVIUM_ERRATUM_27456
|
||||||
!else
|
|
||||||
GCC:*_*_AARCH64_CC_XIPFLAGS ==
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
!include NetworkPkg/NetworkBuildOptions.dsc.inc
|
||||||
@@ -295,6 +293,10 @@
|
|||||||
gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
|
gEfiNetworkPkgTokenSpaceGuid.PcdIPv4PXESupport|0x01
|
||||||
gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
|
gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01
|
||||||
|
|
||||||
|
# whether to use HVC or SMC to issue monitor calls - this typically depends
|
||||||
|
# on the exception level at which the UEFI system firmware executes
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE
|
||||||
|
|
||||||
#
|
#
|
||||||
# TPM2 support
|
# TPM2 support
|
||||||
#
|
#
|
||||||
@@ -320,11 +322,7 @@
|
|||||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
|
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
|
||||||
|
|
||||||
[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
|
[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]
|
||||||
!if $(TPM2_ENABLE) == TRUE
|
|
||||||
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
|
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
|
||||||
!else
|
|
||||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
|
||||||
!endif
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
@@ -341,11 +339,11 @@
|
|||||||
ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf
|
ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf
|
||||||
ArmPkg/Drivers/CpuPei/CpuPei.inf
|
ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
|
|
||||||
!if $(TPM2_ENABLE) == TRUE
|
|
||||||
MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
|
MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
|
||||||
<LibraryClasses>
|
<LibraryClasses>
|
||||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||||
}
|
}
|
||||||
|
!if $(TPM2_ENABLE) == TRUE
|
||||||
MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
|
MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
|
||||||
<LibraryClasses>
|
<LibraryClasses>
|
||||||
ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.inf
|
ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.inf
|
||||||
@@ -434,6 +432,7 @@
|
|||||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||||
}
|
}
|
||||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||||
|
SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# Status Code Routing
|
# Status Code Routing
|
||||||
@@ -556,6 +555,11 @@
|
|||||||
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
|
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
|
||||||
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
|
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Hash2 Protocol Support
|
||||||
|
#
|
||||||
|
SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# TPM2 support
|
# TPM2 support
|
||||||
#
|
#
|
||||||
|
@@ -111,8 +111,8 @@ READ_LOCK_STATUS = TRUE
|
|||||||
INF ArmPkg/Drivers/CpuPei/CpuPei.inf
|
INF ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||||
INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
|
INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
|
||||||
|
|
||||||
!if $(TPM2_ENABLE) == TRUE
|
|
||||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||||
|
!if $(TPM2_ENABLE) == TRUE
|
||||||
INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
|
INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
|
||||||
INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
|
INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
|
||||||
INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
|
INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
|
||||||
|
@@ -75,6 +75,7 @@ READ_LOCK_STATUS = TRUE
|
|||||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
||||||
INF OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
|
INF OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
|
||||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||||
|
INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
|
# FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
|
||||||
@@ -177,6 +178,11 @@ READ_LOCK_STATUS = TRUE
|
|||||||
INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
|
INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
|
||||||
INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
|
INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Hash2 Protocol producer
|
||||||
|
#
|
||||||
|
INF SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# TPM2 support
|
# TPM2 support
|
||||||
#
|
#
|
||||||
|
@@ -46,10 +46,10 @@
|
|||||||
|
|
||||||
!include NetworkPkg/NetworkDefines.dsc.inc
|
!include NetworkPkg/NetworkDefines.dsc.inc
|
||||||
|
|
||||||
!include ArmVirtPkg/ArmVirt.dsc.inc
|
|
||||||
|
|
||||||
!include MdePkg/MdeLibs.dsc.inc
|
!include MdePkg/MdeLibs.dsc.inc
|
||||||
|
|
||||||
|
!include ArmVirtPkg/ArmVirt.dsc.inc
|
||||||
|
|
||||||
[LibraryClasses.common]
|
[LibraryClasses.common]
|
||||||
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
||||||
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
|
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
# Virtio Support
|
# Virtio Support
|
||||||
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
|
||||||
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
|
||||||
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf
|
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioDxeLib.inf
|
||||||
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
|
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
|
||||||
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
|
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
|
||||||
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
|
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
|
||||||
@@ -203,6 +203,8 @@
|
|||||||
gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
|
gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress|0x0
|
gArmTokenSpaceGuid.PcdFvBaseAddress|0x0
|
||||||
|
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE
|
||||||
|
|
||||||
[PcdsDynamicDefault.common]
|
[PcdsDynamicDefault.common]
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
|
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
|
||||||
|
|
||||||
@@ -339,6 +341,7 @@
|
|||||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||||
}
|
}
|
||||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||||
|
SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# Status Code Routing
|
# Status Code Routing
|
||||||
@@ -461,6 +464,11 @@
|
|||||||
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
|
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
|
||||||
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
|
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Hash2 Protocol Support
|
||||||
|
#
|
||||||
|
SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# ACPI Support
|
# ACPI Support
|
||||||
#
|
#
|
||||||
|
@@ -23,10 +23,10 @@
|
|||||||
SKUID_IDENTIFIER = DEFAULT
|
SKUID_IDENTIFIER = DEFAULT
|
||||||
FLASH_DEFINITION = ArmVirtPkg/ArmVirtXen.fdf
|
FLASH_DEFINITION = ArmVirtPkg/ArmVirtXen.fdf
|
||||||
|
|
||||||
!include ArmVirtPkg/ArmVirt.dsc.inc
|
|
||||||
|
|
||||||
!include MdePkg/MdeLibs.dsc.inc
|
!include MdePkg/MdeLibs.dsc.inc
|
||||||
|
|
||||||
|
!include ArmVirtPkg/ArmVirt.dsc.inc
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.inf
|
SerialPortLib|OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.inf
|
||||||
!if $(TARGET) != RELEASE
|
!if $(TARGET) != RELEASE
|
||||||
@@ -120,6 +120,8 @@
|
|||||||
gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
|
gArmTokenSpaceGuid.PcdFdBaseAddress|0x0
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress|0x0
|
gArmTokenSpaceGuid.PcdFvBaseAddress|0x0
|
||||||
|
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE
|
||||||
|
|
||||||
[PcdsDynamicDefault.common]
|
[PcdsDynamicDefault.common]
|
||||||
|
|
||||||
gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
|
gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
|
||||||
|
@@ -18,6 +18,8 @@
|
|||||||
#include <Library/FdtSerialPortAddressLib.h>
|
#include <Library/FdtSerialPortAddressLib.h>
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
|
|
||||||
|
#include <Chipset/AArch64.h>
|
||||||
|
|
||||||
#include <Guid/EarlyPL011BaseAddress.h>
|
#include <Guid/EarlyPL011BaseAddress.h>
|
||||||
#include <Guid/FdtHob.h>
|
#include <Guid/FdtHob.h>
|
||||||
|
|
||||||
@@ -224,5 +226,17 @@ PlatformPeim (
|
|||||||
|
|
||||||
BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize));
|
BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize));
|
||||||
|
|
||||||
|
#ifdef MDE_CPU_AARCH64
|
||||||
|
//
|
||||||
|
// Set the SMCCC conduit to SMC if executing at EL2, which is typically the
|
||||||
|
// exception level that services HVCs rather than the one that invokes them.
|
||||||
|
//
|
||||||
|
if (ArmReadCurrentEL () == AARCH64_EL2) {
|
||||||
|
Status = PcdSetBoolS (PcdMonitorConduitHvc, FALSE);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||||
|
gArmTokenSpaceGuid.PcdMonitorConduitHvc
|
||||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## SOMETIMES_PRODUCES
|
gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## SOMETIMES_PRODUCES
|
||||||
gUefiOvmfPkgTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
gUefiOvmfPkgTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
|
||||||
|
|
||||||
|
@@ -240,6 +240,8 @@ class PlatformBuilder(UefiBuilder, BuildSettingsManager):
|
|||||||
args += " -serial stdio"
|
args += " -serial stdio"
|
||||||
# Mount disk with startup.nsh
|
# Mount disk with startup.nsh
|
||||||
args += f" -drive file=fat:rw:{VirtualDrive},format=raw,media=disk"
|
args += f" -drive file=fat:rw:{VirtualDrive},format=raw,media=disk"
|
||||||
|
# Provides Rng services to the Guest VM
|
||||||
|
args += " -device virtio-rng-pci"
|
||||||
|
|
||||||
# Conditional Args
|
# Conditional Args
|
||||||
if (self.env.GetValue("QEMU_HEADLESS").upper() == "TRUE"):
|
if (self.env.GetValue("QEMU_HEADLESS").upper() == "TRUE"):
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 1.30
|
||||||
BASE_NAME = ArmVirtPrePiUniCoreRelocatable
|
BASE_NAME = ArmVirtPrePiUniCoreRelocatable
|
||||||
FILE_GUID = f7d9fd14-9335-4389-80c5-334d6abfcced
|
FILE_GUID = f7d9fd14-9335-4389-80c5-334d6abfcced
|
||||||
MODULE_TYPE = SEC
|
MODULE_TYPE = SEC
|
||||||
|
@@ -22,12 +22,6 @@
|
|||||||
|
|
||||||
#include "PrePi.h"
|
#include "PrePi.h"
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
ProcessLibraryConstructorList (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PrePiMain (
|
PrePiMain (
|
||||||
IN UINTN UefiMemoryBase,
|
IN UINTN UefiMemoryBase,
|
||||||
|
@@ -128,10 +128,12 @@ InstallXenArmTables (
|
|||||||
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
|
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
|
||||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtTable;
|
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtTable;
|
||||||
EFI_ACPI_DESCRIPTION_HEADER *DsdtTable;
|
EFI_ACPI_DESCRIPTION_HEADER *DsdtTable;
|
||||||
|
EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsTable;
|
||||||
|
|
||||||
XenAcpiRsdpStructurePtr = NULL;
|
XenAcpiRsdpStructurePtr = NULL;
|
||||||
FadtTable = NULL;
|
FadtTable = NULL;
|
||||||
DsdtTable = NULL;
|
DsdtTable = NULL;
|
||||||
|
FacsTable = NULL;
|
||||||
TableHandle = 0;
|
TableHandle = 0;
|
||||||
NumberOfTableEntries = 0;
|
NumberOfTableEntries = 0;
|
||||||
|
|
||||||
@@ -191,6 +193,8 @@ InstallXenArmTables (
|
|||||||
FadtTable = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)
|
FadtTable = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)
|
||||||
(UINTN)CurrentTablePointer;
|
(UINTN)CurrentTablePointer;
|
||||||
DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)FadtTable->Dsdt;
|
DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)FadtTable->Dsdt;
|
||||||
|
FacsTable = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)
|
||||||
|
(UINTN)FadtTable->FirmwareCtrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,14 +202,31 @@ InstallXenArmTables (
|
|||||||
//
|
//
|
||||||
// Install DSDT table.
|
// Install DSDT table.
|
||||||
//
|
//
|
||||||
Status = AcpiProtocol->InstallAcpiTable (
|
if (DsdtTable != NULL) {
|
||||||
AcpiProtocol,
|
Status = AcpiProtocol->InstallAcpiTable (
|
||||||
DsdtTable,
|
AcpiProtocol,
|
||||||
DsdtTable->Length,
|
DsdtTable,
|
||||||
&TableHandle
|
DsdtTable->Length,
|
||||||
);
|
&TableHandle
|
||||||
if (EFI_ERROR (Status)) {
|
);
|
||||||
return Status;
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Install FACS table.
|
||||||
|
//
|
||||||
|
if (FacsTable != NULL) {
|
||||||
|
Status = AcpiProtocol->InstallAcpiTable (
|
||||||
|
AcpiProtocol,
|
||||||
|
FacsTable,
|
||||||
|
FacsTable->Length,
|
||||||
|
&TableHandle
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
_double_star_after_invalid_regex = re.compile(r'[^/\\]\*\*')
|
_double_star_after_invalid_regex = re.compile(r'[^/\\]\*\*')
|
||||||
_double_star_first_before_invalid_regex = re.compile('^\\*\\*[^/]')
|
_double_star_first_before_invalid_regex = re.compile(r'^\\*\\*[^/]')
|
||||||
_double_star_middle_before_invalid_regex = re.compile(r'[^\\]\*\*[^/]')
|
_double_star_middle_before_invalid_regex = re.compile(r'[^\\]\*\*[^/]')
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
"scope": "codeql-ext-dep",
|
"scope": "codeql-ext-dep",
|
||||||
"type": "web",
|
"type": "web",
|
||||||
"name": "codeql_cli",
|
"name": "codeql_cli",
|
||||||
"source": "https://github.com/github/codeql-cli-binaries/releases/download/v2.12.4/codeql.zip",
|
"source": "https://github.com/github/codeql-cli-binaries/releases/download/v2.17.3/codeql.zip",
|
||||||
"version": "2.12.4",
|
"version": "2.17.3",
|
||||||
"sha256": "f682f1155d627ad97f10b1bcad97f682011986717bd3823e9cf831ed83ac96e7",
|
"sha256": "e5ac1d87ab38e405c9af5db234a338b10dffabc98a648903f1664dd2a566dfd5",
|
||||||
"compression_type": "zip",
|
"compression_type": "zip",
|
||||||
"internal_path": "/codeql/",
|
"internal_path": "/codeql/",
|
||||||
"flags": ["set_shell_var", ],
|
"flags": ["set_shell_var", ],
|
||||||
|
@@ -14,9 +14,9 @@
|
|||||||
"scope": "codeql-linux-ext-dep",
|
"scope": "codeql-linux-ext-dep",
|
||||||
"type": "web",
|
"type": "web",
|
||||||
"name": "codeql_linux_cli",
|
"name": "codeql_linux_cli",
|
||||||
"source": "https://github.com/github/codeql-cli-binaries/releases/download/v2.14.5/codeql-linux64.zip",
|
"source": "https://github.com/github/codeql-cli-binaries/releases/download/v2.17.3/codeql-linux64.zip",
|
||||||
"version": "2.14.5",
|
"version": "2.17.3",
|
||||||
"sha256": "72aa5d748ff9ab57cfd86045560683bdc4897e0fe6d9f9a2786d9394674ae733",
|
"sha256": "9fba000c4b821534d354bc16821aa066fdb1304446226ea449870e64a8ad3c7a",
|
||||||
"compression_type": "zip",
|
"compression_type": "zip",
|
||||||
"internal_path": "/codeql/",
|
"internal_path": "/codeql/",
|
||||||
"flags": ["set_shell_var", ],
|
"flags": ["set_shell_var", ],
|
||||||
|
@@ -14,9 +14,9 @@
|
|||||||
"scope": "codeql-windows-ext-dep",
|
"scope": "codeql-windows-ext-dep",
|
||||||
"type": "web",
|
"type": "web",
|
||||||
"name": "codeql_windows_cli",
|
"name": "codeql_windows_cli",
|
||||||
"source": "https://github.com/github/codeql-cli-binaries/releases/download/v2.14.5/codeql-win64.zip",
|
"source": "https://github.com/github/codeql-cli-binaries/releases/download/v2.17.3/codeql-win64.zip",
|
||||||
"version": "2.14.5",
|
"version": "2.17.3",
|
||||||
"sha256": "861fcb38365cc311efee0c3a28c77494e93c69a969885b72e53173ad473f61aa",
|
"sha256": "4c6fbf2ea2eaf0f47bf0347eacf54c6b9d6bdf7acb6b63e17f9e6f2dd83b34e7",
|
||||||
"compression_type": "zip",
|
"compression_type": "zip",
|
||||||
"internal_path": "/codeql/",
|
"internal_path": "/codeql/",
|
||||||
"flags": ["set_shell_var", ],
|
"flags": ["set_shell_var", ],
|
||||||
|
@@ -89,12 +89,12 @@ class parser_lst(object):
|
|||||||
return structs_file
|
return structs_file
|
||||||
|
|
||||||
def struct(self):#struct:{offset:name}
|
def struct(self):#struct:{offset:name}
|
||||||
unit_num = re.compile('(\d+)')
|
unit_num = re.compile(r'(\d+)')
|
||||||
offset1_re = re.compile('(\d+)\[')
|
offset1_re = re.compile(r'(\d+)\[')
|
||||||
pcdname_num_re = re.compile('\w+\[(\S+)\]')
|
pcdname_num_re = re.compile(r'\w+\[(\S+)\]')
|
||||||
pcdname_re = re.compile('\](.*)\<')
|
pcdname_re = re.compile(r'\](.*)\<')
|
||||||
pcdname2_re = re.compile('(\w+)\[')
|
pcdname2_re = re.compile(r'(\w+)\[')
|
||||||
uint_re = re.compile('\<(\S+)\>')
|
uint_re = re.compile(r'\<(\S+)\>')
|
||||||
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
|
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
|
||||||
name=name_format.findall(self.text)
|
name=name_format.findall(self.text)
|
||||||
info={}
|
info={}
|
||||||
@@ -214,8 +214,8 @@ class Config(object):
|
|||||||
|
|
||||||
#Parser .config file,return list[offset,name,guid,value,help]
|
#Parser .config file,return list[offset,name,guid,value,help]
|
||||||
def config_parser(self):
|
def config_parser(self):
|
||||||
ids_re =re.compile('_ID:(\d+)',re.S)
|
ids_re =re.compile(r'_ID:(\d+)',re.S)
|
||||||
id_re= re.compile('\s+')
|
id_re= re.compile(r'\s+')
|
||||||
info = []
|
info = []
|
||||||
info_dict={}
|
info_dict={}
|
||||||
with open(self.config, 'r') as text:
|
with open(self.config, 'r') as text:
|
||||||
@@ -435,7 +435,7 @@ class PATH(object):
|
|||||||
|
|
||||||
def header(self,struct):
|
def header(self,struct):
|
||||||
header={}
|
header={}
|
||||||
head_re = re.compile('typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S)
|
head_re = re.compile(r'typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S)
|
||||||
head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
|
head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
|
||||||
for i in list(self.lstinf.keys()):
|
for i in list(self.lstinf.keys()):
|
||||||
with open(i,'r') as lst:
|
with open(i,'r') as lst:
|
||||||
|
@@ -29,7 +29,7 @@ def Main():
|
|||||||
print ("ERROR: At least one argument is required!\n")
|
print ("ERROR: At least one argument is required!\n")
|
||||||
PARSER.print_help()
|
PARSER.print_help()
|
||||||
|
|
||||||
today = datetime.datetime.utcnow()
|
today = datetime.datetime.now(datetime.timezone.utc)
|
||||||
if ARGS.year:
|
if ARGS.year:
|
||||||
ReversedNumber = str(today.year)[::-1]
|
ReversedNumber = str(today.year)[::-1]
|
||||||
print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
|
print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
|
||||||
|
@@ -528,7 +528,7 @@ class EfiSectionHeader(BinaryItem):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
rMapEntry = re.compile('^(\w+)[ \(\w\)]* \(BaseAddress=([0-9a-fA-F]+), EntryPoint=([0-9a-fA-F]+), GUID=([0-9a-fA-F\-]+)')
|
rMapEntry = re.compile(r'^(\w+)[ \(\w\)]* \(BaseAddress=([0-9a-fA-F]+), EntryPoint=([0-9a-fA-F]+), GUID=([0-9a-fA-F\-]+)')
|
||||||
class EfiFvMapFile(object):
|
class EfiFvMapFile(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._mapentries = {}
|
self._mapentries = {}
|
||||||
|
@@ -28,6 +28,7 @@ class Verbose:
|
|||||||
|
|
||||||
class PatchCheckConf:
|
class PatchCheckConf:
|
||||||
ignore_change_id = False
|
ignore_change_id = False
|
||||||
|
ignore_multi_package = False
|
||||||
|
|
||||||
class EmailAddressCheck:
|
class EmailAddressCheck:
|
||||||
"""Checks an email address."""
|
"""Checks an email address."""
|
||||||
@@ -85,7 +86,11 @@ class EmailAddressCheck:
|
|||||||
self.error("The email address cannot contain a space: " +
|
self.error("The email address cannot contain a space: " +
|
||||||
mo.group(3))
|
mo.group(3))
|
||||||
|
|
||||||
if ' via Groups.Io' in name and mo.group(3).endswith('@groups.io'):
|
if mo.group(3) == 'devel@edk2.groups.io':
|
||||||
|
self.error("Email rewritten by lists DMARC / DKIM / SPF: " +
|
||||||
|
email)
|
||||||
|
|
||||||
|
if ' via groups.io' in name.lower() and mo.group(3).endswith('@groups.io'):
|
||||||
self.error("Email rewritten by lists DMARC / DKIM / SPF: " +
|
self.error("Email rewritten by lists DMARC / DKIM / SPF: " +
|
||||||
email)
|
email)
|
||||||
|
|
||||||
@@ -94,6 +99,7 @@ class CommitMessageCheck:
|
|||||||
|
|
||||||
def __init__(self, subject, message, author_email):
|
def __init__(self, subject, message, author_email):
|
||||||
self.ok = True
|
self.ok = True
|
||||||
|
self.ignore_multi_package = False
|
||||||
|
|
||||||
if subject is None and message is None:
|
if subject is None and message is None:
|
||||||
self.error('Commit message is missing!')
|
self.error('Commit message is missing!')
|
||||||
@@ -116,6 +122,7 @@ class CommitMessageCheck:
|
|||||||
self.check_overall_format()
|
self.check_overall_format()
|
||||||
if not PatchCheckConf.ignore_change_id:
|
if not PatchCheckConf.ignore_change_id:
|
||||||
self.check_change_id_format()
|
self.check_change_id_format()
|
||||||
|
self.check_ci_options_format()
|
||||||
self.report_message_result()
|
self.report_message_result()
|
||||||
|
|
||||||
url = 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
|
url = 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
|
||||||
@@ -198,7 +205,7 @@ class CommitMessageCheck:
|
|||||||
if s[2] != ' ':
|
if s[2] != ' ':
|
||||||
self.error("There should be a space after '" + sig + ":'")
|
self.error("There should be a space after '" + sig + ":'")
|
||||||
|
|
||||||
EmailAddressCheck(s[3], sig)
|
self.ok &= EmailAddressCheck(s[3], sig).ok
|
||||||
|
|
||||||
return sigs
|
return sigs
|
||||||
|
|
||||||
@@ -225,10 +232,12 @@ class CommitMessageCheck:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def check_misc_signatures(self):
|
def check_misc_signatures(self):
|
||||||
for sig in self.sig_types:
|
for sigtype in self.sig_types:
|
||||||
self.find_signatures(sig)
|
sigs = self.find_signatures(sigtype)
|
||||||
|
if sigtype == 'Cc' and len(sigs) == 0:
|
||||||
|
self.error('No Cc: tags for maintainers/reviewers found!')
|
||||||
|
|
||||||
cve_re = re.compile('CVE-[0-9]{4}-[0-9]{5}[^0-9]')
|
cve_re = re.compile(r'CVE-[0-9]{4}-[0-9]{5}[^0-9]')
|
||||||
|
|
||||||
def check_overall_format(self):
|
def check_overall_format(self):
|
||||||
lines = self.msg.splitlines()
|
lines = self.msg.splitlines()
|
||||||
@@ -318,6 +327,15 @@ class CommitMessageCheck:
|
|||||||
self.error('\"%s\" found in commit message:' % cid)
|
self.error('\"%s\" found in commit message:' % cid)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def check_ci_options_format(self):
|
||||||
|
cio='Continuous-integration-options:'
|
||||||
|
for line in self.msg.splitlines():
|
||||||
|
if not line.startswith(cio):
|
||||||
|
continue
|
||||||
|
options = line.split(':', 1)[1].split()
|
||||||
|
if 'PatchCheck.ignore-multi-package' in options:
|
||||||
|
self.ignore_multi_package = True
|
||||||
|
|
||||||
(START, PRE_PATCH, PATCH) = range(3)
|
(START, PRE_PATCH, PATCH) = range(3)
|
||||||
|
|
||||||
class GitDiffCheck:
|
class GitDiffCheck:
|
||||||
@@ -555,6 +573,7 @@ class CheckOnePatch:
|
|||||||
|
|
||||||
msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg, self.author_email)
|
msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg, self.author_email)
|
||||||
msg_ok = msg_check.ok
|
msg_ok = msg_check.ok
|
||||||
|
self.ignore_multi_package = msg_check.ignore_multi_package
|
||||||
|
|
||||||
diff_ok = True
|
diff_ok = True
|
||||||
if self.diff is not None:
|
if self.diff is not None:
|
||||||
@@ -665,6 +684,7 @@ class CheckGitCommits:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, rev_spec, max_count):
|
def __init__(self, rev_spec, max_count):
|
||||||
|
dec_files = self.read_dec_files_from_git()
|
||||||
commits = self.read_commit_list_from_git(rev_spec, max_count)
|
commits = self.read_commit_list_from_git(rev_spec, max_count)
|
||||||
if len(commits) == 1 and Verbose.level > Verbose.ONELINE:
|
if len(commits) == 1 and Verbose.level > Verbose.ONELINE:
|
||||||
commits = [ rev_spec ]
|
commits = [ rev_spec ]
|
||||||
@@ -680,10 +700,66 @@ class CheckGitCommits:
|
|||||||
email = self.read_committer_email_address_from_git(commit)
|
email = self.read_committer_email_address_from_git(commit)
|
||||||
self.ok &= EmailAddressCheck(email, 'Committer').ok
|
self.ok &= EmailAddressCheck(email, 'Committer').ok
|
||||||
patch = self.read_patch_from_git(commit)
|
patch = self.read_patch_from_git(commit)
|
||||||
self.ok &= CheckOnePatch(commit, patch).ok
|
check_patch = CheckOnePatch(commit, patch)
|
||||||
|
self.ok &= check_patch.ok
|
||||||
|
ignore_multi_package = check_patch.ignore_multi_package
|
||||||
|
if PatchCheckConf.ignore_multi_package:
|
||||||
|
ignore_multi_package = True
|
||||||
|
prefix = 'WARNING: ' if ignore_multi_package else ''
|
||||||
|
check_parent = self.check_parent_packages (dec_files, commit, prefix)
|
||||||
|
if not ignore_multi_package:
|
||||||
|
self.ok &= check_parent
|
||||||
|
|
||||||
if not commits:
|
if not commits:
|
||||||
print("Couldn't find commit matching: '{}'".format(rev_spec))
|
print("Couldn't find commit matching: '{}'".format(rev_spec))
|
||||||
|
|
||||||
|
def check_parent_packages(self, dec_files, commit, prefix):
|
||||||
|
ok = True
|
||||||
|
modified = self.get_parent_packages (dec_files, commit, 'AM')
|
||||||
|
if len (modified) > 1:
|
||||||
|
print("{}The commit adds/modifies files in multiple packages:".format(prefix))
|
||||||
|
print(" *", '\n * '.join(modified))
|
||||||
|
ok = False
|
||||||
|
deleted = self.get_parent_packages (dec_files, commit, 'D')
|
||||||
|
if len (deleted) > 1:
|
||||||
|
print("{}The commit deletes files from multiple packages:".format(prefix))
|
||||||
|
print(" *", '\n * '.join(deleted))
|
||||||
|
ok = False
|
||||||
|
return ok
|
||||||
|
|
||||||
|
def get_parent_packages(self, dec_files, commit, filter):
|
||||||
|
filelist = self.read_files_modified_from_git (commit, filter)
|
||||||
|
parents = set()
|
||||||
|
for file in filelist:
|
||||||
|
dec_found = False
|
||||||
|
for dec_file in dec_files:
|
||||||
|
if os.path.commonpath([dec_file, file]):
|
||||||
|
dec_found = True
|
||||||
|
parents.add(dec_file)
|
||||||
|
if not dec_found and os.path.dirname (file):
|
||||||
|
# No DEC file found and file is in a subdir
|
||||||
|
# Covers BaseTools, .github, .azurepipelines, .pytool
|
||||||
|
parents.add(file.split('/')[0])
|
||||||
|
return list(parents)
|
||||||
|
|
||||||
|
def read_dec_files_from_git(self):
|
||||||
|
# run git ls-files *.dec
|
||||||
|
out = self.run_git('ls-files', '*.dec')
|
||||||
|
# return list of .dec files
|
||||||
|
try:
|
||||||
|
return out.split()
|
||||||
|
except:
|
||||||
|
return []
|
||||||
|
|
||||||
|
def read_files_modified_from_git(self, commit, filter):
|
||||||
|
# run git diff-tree --no-commit-id --name-only -r <commit>
|
||||||
|
out = self.run_git('diff-tree', '--no-commit-id', '--name-only',
|
||||||
|
'--diff-filter=' + filter, '-r', commit)
|
||||||
|
try:
|
||||||
|
return out.split()
|
||||||
|
except:
|
||||||
|
return []
|
||||||
|
|
||||||
def read_commit_list_from_git(self, rev_spec, max_count):
|
def read_commit_list_from_git(self, rev_spec, max_count):
|
||||||
# Run git to get the commit patch
|
# Run git to get the commit patch
|
||||||
cmd = [ 'rev-list', '--abbrev-commit', '--no-walk' ]
|
cmd = [ 'rev-list', '--abbrev-commit', '--no-walk' ]
|
||||||
@@ -794,6 +870,9 @@ class PatchCheckApp:
|
|||||||
group.add_argument("--ignore-change-id",
|
group.add_argument("--ignore-change-id",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Ignore the presence of 'Change-Id:' tags in commit message")
|
help="Ignore the presence of 'Change-Id:' tags in commit message")
|
||||||
|
group.add_argument("--ignore-multi-package",
|
||||||
|
action="store_true",
|
||||||
|
help="Ignore if commit modifies files in multiple packages")
|
||||||
self.args = parser.parse_args()
|
self.args = parser.parse_args()
|
||||||
if self.args.oneline:
|
if self.args.oneline:
|
||||||
Verbose.level = Verbose.ONELINE
|
Verbose.level = Verbose.ONELINE
|
||||||
@@ -801,6 +880,8 @@ class PatchCheckApp:
|
|||||||
Verbose.level = Verbose.SILENT
|
Verbose.level = Verbose.SILENT
|
||||||
if self.args.ignore_change_id:
|
if self.args.ignore_change_id:
|
||||||
PatchCheckConf.ignore_change_id = True
|
PatchCheckConf.ignore_change_id = True
|
||||||
|
if self.args.ignore_multi_package:
|
||||||
|
PatchCheckConf.ignore_multi_package = True
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(PatchCheckApp().retval)
|
sys.exit(PatchCheckApp().retval)
|
||||||
|
@@ -1556,7 +1556,17 @@ typedef enum {
|
|||||||
EfiKeyF12,
|
EfiKeyF12,
|
||||||
EfiKeyPrint,
|
EfiKeyPrint,
|
||||||
EfiKeySLck,
|
EfiKeySLck,
|
||||||
EfiKeyPause
|
EfiKeyPause,
|
||||||
|
EfiKeyIntl0,
|
||||||
|
EfiKeyIntl1,
|
||||||
|
EfiKeyIntl2,
|
||||||
|
EfiKeyIntl3,
|
||||||
|
EfiKeyIntl4,
|
||||||
|
EfiKeyIntl5,
|
||||||
|
EfiKeyIntl6,
|
||||||
|
EfiKeyIntl7,
|
||||||
|
EfiKeyIntl8,
|
||||||
|
EfiKeyIntl9
|
||||||
} EFI_KEY;
|
} EFI_KEY;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -1371,6 +1371,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
|
|||||||
else:
|
else:
|
||||||
if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
|
if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
|
||||||
AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
|
AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
|
||||||
|
if Info.ModuleType == SUP_MODULE_SEC and Info.AutoGenVersion >= 0x0001001E:
|
||||||
|
AutoGenH.Append(("\n"
|
||||||
|
"// ProcessLibraryConstructorList() declared here because SEC has no standard entry point.\n"
|
||||||
|
"VOID\n"
|
||||||
|
"EFIAPI\n"
|
||||||
|
"ProcessLibraryConstructorList (\n"
|
||||||
|
" VOID\n"
|
||||||
|
" );\n"))
|
||||||
elif Info.ModuleType in SUP_MODULE_SET_PEI:
|
elif Info.ModuleType in SUP_MODULE_SET_PEI:
|
||||||
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
|
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
|
||||||
elif Info.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
|
elif Info.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
|
||||||
|
@@ -54,7 +54,7 @@ gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
|
|||||||
gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
|
gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
|
||||||
|
|
||||||
## Regular expressions for string identifier checking
|
## Regular expressions for string identifier checking
|
||||||
gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
|
gIdentifierPattern = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
|
||||||
## Regular expression for GUID c structure format
|
## Regular expression for GUID c structure format
|
||||||
_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
|
_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
|
||||||
r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
|
r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
|
||||||
|
@@ -1926,4 +1926,4 @@ def CopyDict(ori_dict):
|
|||||||
# Remove the c/c++ comments: // and /* */
|
# Remove the c/c++ comments: // and /* */
|
||||||
#
|
#
|
||||||
def RemoveCComments(ctext):
|
def RemoveCComments(ctext):
|
||||||
return re.sub('//.*?\n|/\\*.*?\\*/', '\n', ctext, flags=re.S)
|
return re.sub(r'//.*?\n|/\\*.*?\\*/', '\n', ctext, flags=re.S)
|
||||||
|
@@ -21,7 +21,7 @@ from CommonDataClass.Exceptions import *
|
|||||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||||
|
|
||||||
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
|
gHexVerPatt = re.compile(r'0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
|
||||||
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
|
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
|
||||||
|
|
||||||
## GetSplitValueList
|
## GetSplitValueList
|
||||||
|
@@ -1112,7 +1112,7 @@ class Check(object):
|
|||||||
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
|
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
|
||||||
for Record in RecordSet:
|
for Record in RecordSet:
|
||||||
Path = Record[1]
|
Path = Record[1]
|
||||||
Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
|
Path = Path.upper().replace('\\X64', '').replace('\\IA32', '').replace('\\EBC', '').replace('\\IPF', '').replace('\\ARM', '')
|
||||||
if Path in InfPathList:
|
if Path in InfPathList:
|
||||||
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
|
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
|
||||||
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
|
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
|
||||||
|
@@ -435,7 +435,7 @@ class Configuration(object):
|
|||||||
# test that our dict and out class still match in contents.
|
# test that our dict and out class still match in contents.
|
||||||
#
|
#
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
myconfig = Configuration("BaseTools\Source\Python\Ecc\config.ini")
|
myconfig = Configuration("BaseTools\\Source\\Python\\Ecc\\config.ini")
|
||||||
for each in myconfig.__dict__:
|
for each in myconfig.__dict__:
|
||||||
if each == "Filename":
|
if each == "Filename":
|
||||||
continue
|
continue
|
||||||
|
@@ -1841,14 +1841,14 @@ class DecParser(MetaFileParser):
|
|||||||
|
|
||||||
if EccGlobalData.gConfig.UniCheckPCDInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
|
if EccGlobalData.gConfig.UniCheckPCDInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
|
||||||
# check Description, Prompt information
|
# check Description, Prompt information
|
||||||
PatternDesc = re.compile('##\s*([\x21-\x7E\s]*)', re.S)
|
PatternDesc = re.compile(r'##\s*([\x21-\x7E\s]*)', re.S)
|
||||||
PatternPrompt = re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
|
PatternPrompt = re.compile(r'#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
|
||||||
Description = None
|
Description = None
|
||||||
Prompt = None
|
Prompt = None
|
||||||
# check @ValidRange, @ValidList and @Expression format valid
|
# check @ValidRange, @ValidList and @Expression format valid
|
||||||
ErrorCodeValid = '0x0 <= %s <= 0xFFFFFFFF'
|
ErrorCodeValid = '0x0 <= %s <= 0xFFFFFFFF'
|
||||||
PatternValidRangeIn = '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
|
PatternValidRangeIn = r'(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
|
||||||
PatternValidRng = re.compile('^' + '(NOT)?\s*' + PatternValidRangeIn + '$')
|
PatternValidRng = re.compile(r'^' + r'(NOT)?\s*' + PatternValidRangeIn + '$')
|
||||||
for Comment in self._Comments:
|
for Comment in self._Comments:
|
||||||
Comm = Comment[0].strip()
|
Comm = Comment[0].strip()
|
||||||
if not Comm:
|
if not Comm:
|
||||||
@@ -2071,7 +2071,7 @@ class UniParser(object):
|
|||||||
def CheckKeyValid(self, Key, Contents=None):
|
def CheckKeyValid(self, Key, Contents=None):
|
||||||
if not Contents:
|
if not Contents:
|
||||||
Contents = self.FileIn
|
Contents = self.FileIn
|
||||||
KeyPattern = re.compile('#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
|
KeyPattern = re.compile(r'#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
|
||||||
if KeyPattern.search(Contents):
|
if KeyPattern.search(Contents):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@@ -43,7 +43,7 @@ def GetArrayPattern():
|
|||||||
return p
|
return p
|
||||||
|
|
||||||
def GetTypedefFuncPointerPattern():
|
def GetTypedefFuncPointerPattern():
|
||||||
p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
p = re.compile(r'[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def GetDB():
|
def GetDB():
|
||||||
|
@@ -11,7 +11,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
|
|||||||
gEFI_SOURCE = ''
|
gEFI_SOURCE = ''
|
||||||
gEDK_SOURCE = ''
|
gEDK_SOURCE = ''
|
||||||
gWORKSPACE = ''
|
gWORKSPACE = ''
|
||||||
gSHELL_INF = 'Application\Shell'
|
gSHELL_INF = 'Application\\Shell'
|
||||||
gMAKE_FILE = ''
|
gMAKE_FILE = ''
|
||||||
gDSC_FILE = ''
|
gDSC_FILE = ''
|
||||||
gFV_FILE = []
|
gFV_FILE = []
|
||||||
|
@@ -54,7 +54,7 @@ def GetArrayPattern():
|
|||||||
# @return p: the pattern of function pointer
|
# @return p: the pattern of function pointer
|
||||||
#
|
#
|
||||||
def GetTypedefFuncPointerPattern():
|
def GetTypedefFuncPointerPattern():
|
||||||
p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
p = re.compile(r'[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
## GetDB() method
|
## GetDB() method
|
||||||
|
@@ -37,7 +37,7 @@ parser.add_argument("-l", "--LayoutFileName", dest="LayoutFileName", nargs='+',
|
|||||||
the file will be generated with default name (Layout_'InputFileName'.txt). \
|
the file will be generated with default name (Layout_'InputFileName'.txt). \
|
||||||
Currently supports two formats: json, txt. More formats will be added in the future")
|
Currently supports two formats: json, txt. More formats will be added in the future")
|
||||||
parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", nargs='+',
|
parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", nargs='+',
|
||||||
help="Provide the target FmmtConf.ini file path: '-c C:\Code\FmmtConf.ini' \
|
help="Provide the target FmmtConf.ini file path: '-c C:\\Code\\FmmtConf.ini' \
|
||||||
FmmtConf file saves the target guidtool used in compress/uncompress process.\
|
FmmtConf file saves the target guidtool used in compress/uncompress process.\
|
||||||
If do not provide, FMMT tool will search the inputfile folder for FmmtConf.ini firstly, if not found,\
|
If do not provide, FMMT tool will search the inputfile folder for FmmtConf.ini firstly, if not found,\
|
||||||
the FmmtConf.ini saved in FMMT tool's folder will be used as default.")
|
the FmmtConf.ini saved in FMMT tool's folder will be used as default.")
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# generate capsule
|
# generate capsule
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
||||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
@@ -78,6 +79,8 @@ class Capsule (CapsuleClassObject):
|
|||||||
Flags |= 0x00010000
|
Flags |= 0x00010000
|
||||||
elif flag == 'InitiateReset':
|
elif flag == 'InitiateReset':
|
||||||
Flags |= 0x00040000
|
Flags |= 0x00040000
|
||||||
|
if 'OEM_CAPSULE_FLAGS' in self.TokensDict:
|
||||||
|
Flags |= int(self.TokensDict['OEM_CAPSULE_FLAGS'],16)
|
||||||
Header.write(pack('=I', Flags))
|
Header.write(pack('=I', Flags))
|
||||||
#
|
#
|
||||||
# typedef struct {
|
# typedef struct {
|
||||||
|
@@ -19,6 +19,7 @@ from .GenFdsGlobalVariable import GenFdsGlobalVariable
|
|||||||
from .Ffs import SectionSuffix,FdfFvFileTypeToFileType
|
from .Ffs import SectionSuffix,FdfFvFileTypeToFileType
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
from . import Section
|
from . import Section
|
||||||
from . import RuleSimpleFile
|
from . import RuleSimpleFile
|
||||||
from . import RuleComplexFile
|
from . import RuleComplexFile
|
||||||
@@ -92,7 +93,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
|
|
||||||
if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION:
|
if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION:
|
||||||
for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
|
for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
|
||||||
if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
|
if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit() and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
|
||||||
self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
|
self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
|
||||||
|
|
||||||
StrModule = str(self.InfModule)
|
StrModule = str(self.InfModule)
|
||||||
@@ -100,7 +101,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
if StrModule in PlatformDataBase.Modules:
|
if StrModule in PlatformDataBase.Modules:
|
||||||
PlatformModule = PlatformDataBase.Modules[StrModule]
|
PlatformModule = PlatformDataBase.Modules[StrModule]
|
||||||
for LibraryClass in PlatformModule.LibraryClasses:
|
for LibraryClass in PlatformModule.LibraryClasses:
|
||||||
if LibraryClass.startswith("NULL"):
|
if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit():
|
||||||
self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
|
self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
|
||||||
|
|
||||||
DependencyList = [self.InfModule]
|
DependencyList = [self.InfModule]
|
||||||
@@ -156,7 +157,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
if len(self.InfFileName) > 1 and self.InfFileName[0] == '\\' and self.InfFileName[1] == '\\':
|
if len(self.InfFileName) > 1 and self.InfFileName[0] == '\\' and self.InfFileName[1] == '\\':
|
||||||
pass
|
pass
|
||||||
elif self.InfFileName[0] == '\\' or self.InfFileName[0] == '/' :
|
elif self.InfFileName[0] == '\\' or self.InfFileName[0] == '/' :
|
||||||
self.InfFileName = self.InfFileName[1:]
|
ws_path = Path(GenFdsGlobalVariable.WorkSpaceDir)
|
||||||
|
inf_path = Path(self.InfFileName)
|
||||||
|
if ws_path in inf_path.parents:
|
||||||
|
self.InfFileName = str(inf_path.relative_to(ws_path))
|
||||||
|
else:
|
||||||
|
self.InfFileName = self.InfFileName[1:]
|
||||||
|
|
||||||
if self.InfFileName.find('$') == -1:
|
if self.InfFileName.find('$') == -1:
|
||||||
InfPath = NormPath(self.InfFileName)
|
InfPath = NormPath(self.InfFileName)
|
||||||
|
@@ -238,7 +238,7 @@ def ParseDecPcdGenericComment (GenericComment, ContainerFile, TokenSpaceGuidCNam
|
|||||||
#
|
#
|
||||||
# To replace Macro
|
# To replace Macro
|
||||||
#
|
#
|
||||||
MACRO_PATTERN = '[\t\s]*\$\([A-Z][_A-Z0-9]*\)'
|
MACRO_PATTERN = r'[\t\s]*\$\([A-Z][_A-Z0-9]*\)'
|
||||||
MatchedStrs = re.findall(MACRO_PATTERN, Comment)
|
MatchedStrs = re.findall(MACRO_PATTERN, Comment)
|
||||||
for MatchedStr in MatchedStrs:
|
for MatchedStr in MatchedStrs:
|
||||||
if MatchedStr:
|
if MatchedStr:
|
||||||
|
@@ -66,13 +66,13 @@ class _ExprError(Exception):
|
|||||||
## _ExprBase
|
## _ExprBase
|
||||||
#
|
#
|
||||||
class _ExprBase:
|
class _ExprBase:
|
||||||
HEX_PATTERN = '[\t\s]*0[xX][a-fA-F0-9]+'
|
HEX_PATTERN = r'[\t\s]*0[xX][a-fA-F0-9]+'
|
||||||
INT_PATTERN = '[\t\s]*[0-9]+'
|
INT_PATTERN = r'[\t\s]*[0-9]+'
|
||||||
MACRO_PATTERN = '[\t\s]*\$\(([A-Z][_A-Z0-9]*)\)'
|
MACRO_PATTERN = r'[\t\s]*\$\(([A-Z][_A-Z0-9]*)\)'
|
||||||
PCD_PATTERN = \
|
PCD_PATTERN = \
|
||||||
'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*'
|
r'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*'
|
||||||
QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
|
QUOTED_PATTERN = r'[\t\s]*L?"[^"]*"'
|
||||||
BOOL_PATTERN = '[\t\s]*(true|True|TRUE|false|False|FALSE)'
|
BOOL_PATTERN = r'[\t\s]*(true|True|TRUE|false|False|FALSE)'
|
||||||
def __init__(self, Token):
|
def __init__(self, Token):
|
||||||
self.Token = Token
|
self.Token = Token
|
||||||
self.Index = 0
|
self.Index = 0
|
||||||
@@ -303,9 +303,9 @@ class _LogicalExpressionParser(_ExprBase):
|
|||||||
## _ValidRangeExpressionParser
|
## _ValidRangeExpressionParser
|
||||||
#
|
#
|
||||||
class _ValidRangeExpressionParser(_ExprBase):
|
class _ValidRangeExpressionParser(_ExprBase):
|
||||||
INT_RANGE_PATTERN = '[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
INT_RANGE_PATTERN = r'[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
||||||
HEX_RANGE_PATTERN = \
|
HEX_RANGE_PATTERN = \
|
||||||
'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
r'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
||||||
def __init__(self, Token):
|
def __init__(self, Token):
|
||||||
_ExprBase.__init__(self, Token)
|
_ExprBase.__init__(self, Token)
|
||||||
self.Parens = 0
|
self.Parens = 0
|
||||||
@@ -407,7 +407,7 @@ class _ValidRangeExpressionParser(_ExprBase):
|
|||||||
## _ValidListExpressionParser
|
## _ValidListExpressionParser
|
||||||
#
|
#
|
||||||
class _ValidListExpressionParser(_ExprBase):
|
class _ValidListExpressionParser(_ExprBase):
|
||||||
VALID_LIST_PATTERN = '(0[xX][0-9a-fA-F]+|[0-9]+)([\t\s]*,[\t\s]*(0[xX][0-9a-fA-F]+|[0-9]+))*'
|
VALID_LIST_PATTERN = r'(0[xX][0-9a-fA-F]+|[0-9]+)([\t\s]*,[\t\s]*(0[xX][0-9a-fA-F]+|[0-9]+))*'
|
||||||
def __init__(self, Token):
|
def __init__(self, Token):
|
||||||
_ExprBase.__init__(self, Token)
|
_ExprBase.__init__(self, Token)
|
||||||
self.NUM = 1
|
self.NUM = 1
|
||||||
|
@@ -69,11 +69,11 @@ def GuidStringToGuidStructureString(Guid):
|
|||||||
def CheckGuidRegFormat(GuidValue):
|
def CheckGuidRegFormat(GuidValue):
|
||||||
## Regular expression used to find out register format of GUID
|
## Regular expression used to find out register format of GUID
|
||||||
#
|
#
|
||||||
RegFormatGuidPattern = re.compile("^\s*([0-9a-fA-F]){8}-"
|
RegFormatGuidPattern = re.compile(r"^\s*([0-9a-fA-F]){8}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){12}\s*$")
|
r"([0-9a-fA-F]){12}\s*$")
|
||||||
|
|
||||||
if RegFormatGuidPattern.match(GuidValue):
|
if RegFormatGuidPattern.match(GuidValue):
|
||||||
return True
|
return True
|
||||||
@@ -837,8 +837,8 @@ def GetLibInstanceInfo(String, WorkSpace, LineNo):
|
|||||||
ST.ERR_FILE_OPEN_FAILURE,
|
ST.ERR_FILE_OPEN_FAILURE,
|
||||||
File=FullFileName)
|
File=FullFileName)
|
||||||
|
|
||||||
ReFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
|
ReFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
|
||||||
ReVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
|
ReVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
|
||||||
|
|
||||||
FileLinesList = ProcessLineExtender(FileLinesList)
|
FileLinesList = ProcessLineExtender(FileLinesList)
|
||||||
|
|
||||||
@@ -978,7 +978,7 @@ def ValidateUNIFilePath(Path):
|
|||||||
#
|
#
|
||||||
# Check if the file name is valid according to the DEC and INF specification
|
# Check if the file name is valid according to the DEC and INF specification
|
||||||
#
|
#
|
||||||
Pattern = '[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*'
|
Pattern = r'[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*'
|
||||||
FileName = Path.replace(Suffix, '')
|
FileName = Path.replace(Suffix, '')
|
||||||
InvalidCh = re.sub(Pattern, '', FileName)
|
InvalidCh = re.sub(Pattern, '', FileName)
|
||||||
if InvalidCh:
|
if InvalidCh:
|
||||||
|
@@ -23,7 +23,7 @@ from Logger import StringTable as ST
|
|||||||
#
|
#
|
||||||
# Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
# Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
||||||
#
|
#
|
||||||
gMACRO_PATTERN = re.compile("\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
gMACRO_PATTERN = re.compile(r"\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
||||||
|
|
||||||
## GetSplitValueList
|
## GetSplitValueList
|
||||||
#
|
#
|
||||||
@@ -167,7 +167,7 @@ def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None
|
|||||||
if not Flag:
|
if not Flag:
|
||||||
MacroUsed = gMACRO_PATTERN.findall(String)
|
MacroUsed = gMACRO_PATTERN.findall(String)
|
||||||
else:
|
else:
|
||||||
ReQuotedString = re.compile('\"')
|
ReQuotedString = re.compile(r'\"')
|
||||||
QuotedStringList = ReQuotedString.split(String)
|
QuotedStringList = ReQuotedString.split(String)
|
||||||
if len(QuotedStringList) >= 3:
|
if len(QuotedStringList) >= 3:
|
||||||
HaveQuotedMacroFlag = True
|
HaveQuotedMacroFlag = True
|
||||||
|
@@ -611,10 +611,10 @@ def ValidatePcdValueOnDatumType(Value, Type):
|
|||||||
|
|
||||||
elif Type == 'UINT8' or Type == 'UINT16' or Type == 'UINT32' or Type == 'UINT64':
|
elif Type == 'UINT8' or Type == 'UINT16' or Type == 'UINT32' or Type == 'UINT64':
|
||||||
|
|
||||||
ReIsValidUint8z = re.compile('^0[x|X][a-fA-F0-9]{2}$')
|
ReIsValidUint8z = re.compile(r'^0[x|X][a-fA-F0-9]{2}$')
|
||||||
ReIsValidUint16z = re.compile('^0[x|X][a-fA-F0-9]{4}$')
|
ReIsValidUint16z = re.compile(r'^0[x|X][a-fA-F0-9]{4}$')
|
||||||
ReIsValidUint32z = re.compile('^0[x|X][a-fA-F0-9]{8}$')
|
ReIsValidUint32z = re.compile(r'^0[x|X][a-fA-F0-9]{8}$')
|
||||||
ReIsValidUint64z = re.compile('^0[x|X][a-fA-F0-9]{16}$')
|
ReIsValidUint64z = re.compile(r'^0[x|X][a-fA-F0-9]{16}$')
|
||||||
|
|
||||||
if not ReIsValidUint8z.match(Value) and Type == 'UINT8':
|
if not ReIsValidUint8z.match(Value) and Type == 'UINT8':
|
||||||
return False
|
return False
|
||||||
|
@@ -25,10 +25,10 @@ from Library.ExpressionValidate import IsValidStringTest
|
|||||||
from Library.Misc import CheckGuidRegFormat
|
from Library.Misc import CheckGuidRegFormat
|
||||||
|
|
||||||
TOOL_NAME = 'DecParser'
|
TOOL_NAME = 'DecParser'
|
||||||
VERSION_PATTERN = '[0-9]+(\.[0-9]+)?'
|
VERSION_PATTERN = r'[0-9]+(\.[0-9]+)?'
|
||||||
CVAR_PATTERN = '[_a-zA-Z][a-zA-Z0-9_]*'
|
CVAR_PATTERN = r'[_a-zA-Z][a-zA-Z0-9_]*'
|
||||||
PCD_TOKEN_PATTERN = '(0[xX]0*[a-fA-F0-9]{1,8})|([0-9]+)'
|
PCD_TOKEN_PATTERN = r'(0[xX]0*[a-fA-F0-9]{1,8})|([0-9]+)'
|
||||||
MACRO_PATTERN = '[A-Z][_A-Z0-9]*'
|
MACRO_PATTERN = r'[A-Z][_A-Z0-9]*'
|
||||||
|
|
||||||
## FileContent
|
## FileContent
|
||||||
# Class to hold DEC file information
|
# Class to hold DEC file information
|
||||||
|
@@ -53,12 +53,12 @@ def GetLibInstanceInfo(String, WorkSpace, LineNo, CurrentInfFileName):
|
|||||||
#
|
#
|
||||||
# To deal with library instance specified by GUID and version
|
# To deal with library instance specified by GUID and version
|
||||||
#
|
#
|
||||||
RegFormatGuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
|
RegFormatGuidPattern = re.compile(r"\s*([0-9a-fA-F]){8}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){12}\s*")
|
r"([0-9a-fA-F]){12}\s*")
|
||||||
VersionPattern = re.compile('[\t\s]*\d+(\.\d+)?[\t\s]*')
|
VersionPattern = re.compile(r'[\t\s]*\d+(\.\d+)?[\t\s]*')
|
||||||
GuidMatchedObj = RegFormatGuidPattern.search(String)
|
GuidMatchedObj = RegFormatGuidPattern.search(String)
|
||||||
|
|
||||||
if String.upper().startswith('GUID') and GuidMatchedObj and 'Version' in String:
|
if String.upper().startswith('GUID') and GuidMatchedObj and 'Version' in String:
|
||||||
@@ -75,8 +75,8 @@ def GetLibInstanceInfo(String, WorkSpace, LineNo, CurrentInfFileName):
|
|||||||
FileLinesList = GetFileLineContent(String, WorkSpace, LineNo, OriginalString)
|
FileLinesList = GetFileLineContent(String, WorkSpace, LineNo, OriginalString)
|
||||||
|
|
||||||
|
|
||||||
ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
|
ReFindFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
|
||||||
ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
|
ReFindVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
|
||||||
|
|
||||||
for Line in FileLinesList:
|
for Line in FileLinesList:
|
||||||
if ReFindFileGuidPattern.match(Line):
|
if ReFindFileGuidPattern.match(Line):
|
||||||
@@ -106,8 +106,8 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
|
|||||||
|
|
||||||
FileLinesList = GetFileLineContent(FileNameString, WorkSpace, LineNo, '')
|
FileLinesList = GetFileLineContent(FileNameString, WorkSpace, LineNo, '')
|
||||||
|
|
||||||
RePackageHeader = re.compile('^\s*\[Packages.*\].*$')
|
RePackageHeader = re.compile(r'^\s*\[Packages.*\].*$')
|
||||||
ReDefineHeader = re.compile('^\s*\[Defines].*$')
|
ReDefineHeader = re.compile(r'^\s*\[Defines].*$')
|
||||||
|
|
||||||
PackageHederFlag = False
|
PackageHederFlag = False
|
||||||
DefineHeaderFlag = False
|
DefineHeaderFlag = False
|
||||||
@@ -255,8 +255,8 @@ def GetGuidVerFormLibInstance(Guid, Version, WorkSpace, CurrentInfFileName):
|
|||||||
FileLinesList = InfFileObj.readlines()
|
FileLinesList = InfFileObj.readlines()
|
||||||
FileLinesList = ProcessLineExtender(FileLinesList)
|
FileLinesList = ProcessLineExtender(FileLinesList)
|
||||||
|
|
||||||
ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
|
ReFindFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
|
||||||
ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
|
ReFindVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
|
||||||
|
|
||||||
for Line in FileLinesList:
|
for Line in FileLinesList:
|
||||||
if ReFindFileGuidPattern.match(Line):
|
if ReFindFileGuidPattern.match(Line):
|
||||||
|
@@ -40,7 +40,7 @@ def GetValidateArchList(LineContent):
|
|||||||
|
|
||||||
TempArch = GetSplitValueList(TempArch, '(', 1)[0]
|
TempArch = GetSplitValueList(TempArch, '(', 1)[0]
|
||||||
|
|
||||||
ArchList = re.split('\s+', TempArch)
|
ArchList = re.split(r'\s+', TempArch)
|
||||||
NewArchList = []
|
NewArchList = []
|
||||||
for Arch in ArchList:
|
for Arch in ArchList:
|
||||||
if IsValidArch(Arch):
|
if IsValidArch(Arch):
|
||||||
|
@@ -109,7 +109,7 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
|
|||||||
return Content
|
return Content
|
||||||
else:
|
else:
|
||||||
for Macro in MacroUsed:
|
for Macro in MacroUsed:
|
||||||
gQuotedMacro = re.compile(".*\".*\$\(%s\).*\".*"%(Macro))
|
gQuotedMacro = re.compile(r".*\".*\$\(%s\).*\".*"%(Macro))
|
||||||
if not gQuotedMacro.match(Content):
|
if not gQuotedMacro.match(Content):
|
||||||
#
|
#
|
||||||
# Still have MACROs can't be expanded.
|
# Still have MACROs can't be expanded.
|
||||||
@@ -130,8 +130,8 @@ def IsBinaryInf(FileLineList):
|
|||||||
if not FileLineList:
|
if not FileLineList:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
ReIsSourcesSection = re.compile("^\s*\[Sources.*\]\s.*$", re.IGNORECASE)
|
ReIsSourcesSection = re.compile(r"^\s*\[Sources.*\]\s.*$", re.IGNORECASE)
|
||||||
ReIsBinarySection = re.compile("^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)
|
ReIsBinarySection = re.compile(r"^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)
|
||||||
BinarySectionFoundFlag = False
|
BinarySectionFoundFlag = False
|
||||||
|
|
||||||
for Line in FileLineList:
|
for Line in FileLineList:
|
||||||
@@ -155,7 +155,7 @@ def IsBinaryInf(FileLineList):
|
|||||||
# @return Flag
|
# @return Flag
|
||||||
#
|
#
|
||||||
def IsLibInstanceInfo(String):
|
def IsLibInstanceInfo(String):
|
||||||
ReIsLibInstance = re.compile("^\s*##\s*@LIB_INSTANCES\s*$")
|
ReIsLibInstance = re.compile(r"^\s*##\s*@LIB_INSTANCES\s*$")
|
||||||
if ReIsLibInstance.match(String):
|
if ReIsLibInstance.match(String):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@@ -171,7 +171,7 @@ def IsLibInstanceInfo(String):
|
|||||||
# @return Flag
|
# @return Flag
|
||||||
#
|
#
|
||||||
def IsAsBuildOptionInfo(String):
|
def IsAsBuildOptionInfo(String):
|
||||||
ReIsAsBuildInstance = re.compile("^\s*##\s*@AsBuilt\s*$")
|
ReIsAsBuildInstance = re.compile(r"^\s*##\s*@AsBuilt\s*$")
|
||||||
if ReIsAsBuildInstance.match(String):
|
if ReIsAsBuildInstance.match(String):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@@ -747,12 +747,12 @@ class DecPomAlignment(PackageObject):
|
|||||||
#
|
#
|
||||||
# deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
|
# deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
|
||||||
#
|
#
|
||||||
NOTNOT_Pattern = '[\t\s]*NOT[\t\s]+NOT[\t\s]*'
|
NOTNOT_Pattern = r'[\t\s]*NOT[\t\s]+NOT[\t\s]*'
|
||||||
NOTGE_Pattern = '[\t\s]*NOT[\t\s]+GE[\t\s]*'
|
NOTGE_Pattern = r'[\t\s]*NOT[\t\s]+GE[\t\s]*'
|
||||||
NOTLE_Pattern = '[\t\s]*NOT[\t\s]+LE[\t\s]*'
|
NOTLE_Pattern = r'[\t\s]*NOT[\t\s]+LE[\t\s]*'
|
||||||
NOTGT_Pattern = '[\t\s]*NOT[\t\s]+GT[\t\s]*'
|
NOTGT_Pattern = r'[\t\s]*NOT[\t\s]+GT[\t\s]*'
|
||||||
NOTLT_Pattern = '[\t\s]*NOT[\t\s]+LT[\t\s]*'
|
NOTLT_Pattern = r'[\t\s]*NOT[\t\s]+LT[\t\s]*'
|
||||||
NOTEQ_Pattern = '[\t\s]*NOT[\t\s]+EQ[\t\s]*'
|
NOTEQ_Pattern = r'[\t\s]*NOT[\t\s]+EQ[\t\s]*'
|
||||||
ReplaceValue = re.compile(NOTNOT_Pattern).sub('', ReplaceValue)
|
ReplaceValue = re.compile(NOTNOT_Pattern).sub('', ReplaceValue)
|
||||||
ReplaceValue = re.compile(NOTLT_Pattern).sub('x >= ', ReplaceValue)
|
ReplaceValue = re.compile(NOTLT_Pattern).sub('x >= ', ReplaceValue)
|
||||||
ReplaceValue = re.compile(NOTGT_Pattern).sub('x <= ', ReplaceValue)
|
ReplaceValue = re.compile(NOTGT_Pattern).sub('x <= ', ReplaceValue)
|
||||||
@@ -785,7 +785,7 @@ class DecPomAlignment(PackageObject):
|
|||||||
if ReplaceValue.find('!') >= 0 and ReplaceValue[ReplaceValue.index('!') + 1] != '=':
|
if ReplaceValue.find('!') >= 0 and ReplaceValue[ReplaceValue.index('!') + 1] != '=':
|
||||||
ReplaceValue = ReplaceValue.replace('!', ' not ')
|
ReplaceValue = ReplaceValue.replace('!', ' not ')
|
||||||
if '.' in ReplaceValue:
|
if '.' in ReplaceValue:
|
||||||
Pattern = '[a-zA-Z0-9]{1,}\.[a-zA-Z0-9]{1,}'
|
Pattern = r'[a-zA-Z0-9]{1,}\.[a-zA-Z0-9]{1,}'
|
||||||
MatchedList = re.findall(Pattern, ReplaceValue)
|
MatchedList = re.findall(Pattern, ReplaceValue)
|
||||||
for MatchedItem in MatchedList:
|
for MatchedItem in MatchedList:
|
||||||
if MatchedItem not in self.PcdDefaultValueDict:
|
if MatchedItem not in self.PcdDefaultValueDict:
|
||||||
@@ -814,7 +814,7 @@ class DecPomAlignment(PackageObject):
|
|||||||
#
|
#
|
||||||
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
||||||
#
|
#
|
||||||
QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
|
QUOTED_PATTERN = r'[\t\s]*L?"[^"]*"'
|
||||||
QuotedMatchedObj = re.search(QUOTED_PATTERN, Expression)
|
QuotedMatchedObj = re.search(QUOTED_PATTERN, Expression)
|
||||||
if QuotedMatchedObj:
|
if QuotedMatchedObj:
|
||||||
MatchedStr = QuotedMatchedObj.group().strip()
|
MatchedStr = QuotedMatchedObj.group().strip()
|
||||||
@@ -847,7 +847,7 @@ class DecPomAlignment(PackageObject):
|
|||||||
#
|
#
|
||||||
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
||||||
#
|
#
|
||||||
QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
|
QUOTED_PATTERN = r'[\t\s]*L?"[^"]*"'
|
||||||
QuotedMatchedObj = re.search(QUOTED_PATTERN, DefaultValue)
|
QuotedMatchedObj = re.search(QUOTED_PATTERN, DefaultValue)
|
||||||
if QuotedMatchedObj:
|
if QuotedMatchedObj:
|
||||||
MatchedStr = QuotedMatchedObj.group().strip()
|
MatchedStr = QuotedMatchedObj.group().strip()
|
||||||
|
@@ -200,9 +200,9 @@ def ValidateRegValues(Key, Value):
|
|||||||
('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}'
|
('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}'
|
||||||
'-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}',
|
'-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}',
|
||||||
ST.ERR_GUID_VALUE % Value),
|
ST.ERR_GUID_VALUE % Value),
|
||||||
'Version' : ('[0-9]+(\.[0-9]+)?', ST.ERR_VERSION_VALUE % \
|
'Version' : (r'[0-9]+(\.[0-9]+)?', ST.ERR_VERSION_VALUE % \
|
||||||
(Key, Value)),
|
(Key, Value)),
|
||||||
'XmlSpecification' : ('1\.1', ST.ERR_VERSION_XMLSPEC % Value)
|
'XmlSpecification' : (r'1\.1', ST.ERR_VERSION_XMLSPEC % Value)
|
||||||
}
|
}
|
||||||
if Key not in ValidateMap:
|
if Key not in ValidateMap:
|
||||||
return True, ''
|
return True, ''
|
||||||
|
@@ -100,11 +100,11 @@ class PcdErrorXml(object):
|
|||||||
def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
|
def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
|
||||||
if self.Expression:
|
if self.Expression:
|
||||||
pass
|
pass
|
||||||
INT_RANGE_PATTERN1 = '[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
INT_RANGE_PATTERN1 = r'[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
||||||
INT_RANGE_PATTERN2 = '[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
INT_RANGE_PATTERN2 = r'[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
||||||
HEX_RANGE_PATTERN1 = \
|
HEX_RANGE_PATTERN1 = \
|
||||||
'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
r'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
||||||
HEX_RANGE_PATTERN2 = '[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][a-fA-F0-9]+[\t\s]*'
|
HEX_RANGE_PATTERN2 = r'[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][a-fA-F0-9]+[\t\s]*'
|
||||||
IntMatch1 = re.compile(INT_RANGE_PATTERN1)
|
IntMatch1 = re.compile(INT_RANGE_PATTERN1)
|
||||||
IntMatch2 = re.compile(INT_RANGE_PATTERN2)
|
IntMatch2 = re.compile(INT_RANGE_PATTERN2)
|
||||||
HexMatch1 = re.compile(HEX_RANGE_PATTERN1)
|
HexMatch1 = re.compile(HEX_RANGE_PATTERN1)
|
||||||
@@ -158,18 +158,18 @@ class PcdErrorXml(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
PCD_PATTERN = \
|
PCD_PATTERN = \
|
||||||
'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
|
r'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
|
||||||
IntPattern1 = \
|
IntPattern1 = \
|
||||||
'[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+\d+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
r'[\t\s]*\([\t\s]*'+PCD_PATTERN+r'[\t\s]+GE[\t\s]+\d+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
||||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
|
PCD_PATTERN+r'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
|
||||||
IntPattern1 = IntPattern1.replace(' ', '')
|
IntPattern1 = IntPattern1.replace(' ', '')
|
||||||
IntPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
IntPattern2 = r'[\t\s]*'+PCD_PATTERN+r'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
||||||
|
|
||||||
HexPattern1 = \
|
HexPattern1 = \
|
||||||
'[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
r'[\t\s]*\([\t\s]*'+PCD_PATTERN+r'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
||||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
|
PCD_PATTERN+r'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
|
||||||
HexPattern1 = HexPattern1.replace(' ', '')
|
HexPattern1 = HexPattern1.replace(' ', '')
|
||||||
HexPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
|
HexPattern2 = r'[\t\s]*'+PCD_PATTERN+r'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Do the Hex1 conversion
|
# Do the Hex1 conversion
|
||||||
@@ -180,7 +180,7 @@ class PcdErrorXml(object):
|
|||||||
#
|
#
|
||||||
# To match items on both sides of '-'
|
# To match items on both sides of '-'
|
||||||
#
|
#
|
||||||
RangeItemList = re.compile('[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
|
RangeItemList = re.compile(r'[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
|
||||||
if RangeItemList and len(RangeItemList) == 2:
|
if RangeItemList and len(RangeItemList) == 2:
|
||||||
HexRangeDict[HexMatchedItem] = RangeItemList
|
HexRangeDict[HexMatchedItem] = RangeItemList
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ class PcdErrorXml(object):
|
|||||||
#
|
#
|
||||||
# To match items on both sides of '-'
|
# To match items on both sides of '-'
|
||||||
#
|
#
|
||||||
RangeItemList = re.compile('[\t\s]*\d+[\t\s]*').findall(MatchedItem)
|
RangeItemList = re.compile(r'[\t\s]*\d+[\t\s]*').findall(MatchedItem)
|
||||||
if RangeItemList and len(RangeItemList) == 2:
|
if RangeItemList and len(RangeItemList) == 2:
|
||||||
IntRangeDict[MatchedItem] = RangeItemList
|
IntRangeDict[MatchedItem] = RangeItemList
|
||||||
|
|
||||||
|
@@ -281,33 +281,33 @@ class DistributionPackageXml(object):
|
|||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
#
|
#
|
||||||
# Remove <SupArchList> COMMON </SupArchList>
|
# Remove <SupArchList> COMMON </SupArchList>
|
||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*COMMON[\s\r\n]*'
|
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*COMMON[\s\r\n]*'
|
||||||
'</SupArchList>[\s\r\n]*', '', XmlContent)
|
r'</SupArchList>[\s\r\n]*', '', XmlContent)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove <SupArchList> common </SupArchList>
|
# Remove <SupArchList> common </SupArchList>
|
||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*'
|
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*'
|
||||||
'common[\s\r\n]*</SupArchList>[\s\r\n]*', '', XmlContent)
|
r'common[\s\r\n]*</SupArchList>[\s\r\n]*', '', XmlContent)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove SupModList="COMMON" or "common"
|
# Remove SupModList="COMMON" or "common"
|
||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
|
|
||||||
return XmlContent
|
return XmlContent
|
||||||
|
|
||||||
|
@@ -3033,7 +3033,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
StructuredPcdsData["OBJECTS"][include_file] = os.path.getmtime(include_file)
|
StructuredPcdsData["OBJECTS"][include_file] = os.path.getmtime(include_file)
|
||||||
MakeApp += "$(OBJECTS) : %s\n" % include_file
|
MakeApp += "$(OBJECTS) : %s\n" % include_file
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source\C\Common\PcdValueCommon.c"))
|
PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source\\C\\Common\\PcdValueCommon.c"))
|
||||||
MakeApp = MakeApp + '%s\\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)
|
MakeApp = MakeApp + '%s\\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)
|
||||||
MakeApp = MakeApp + '\tcopy /y %s $@\n' % (PcdValueCommonPath)
|
MakeApp = MakeApp + '\tcopy /y %s $@\n' % (PcdValueCommonPath)
|
||||||
else:
|
else:
|
||||||
|
@@ -102,12 +102,12 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||||||
#
|
#
|
||||||
if Module.ModuleType != SUP_MODULE_USER_DEFINED:
|
if Module.ModuleType != SUP_MODULE_USER_DEFINED:
|
||||||
for LibraryClass in Platform.LibraryClasses.GetKeys():
|
for LibraryClass in Platform.LibraryClasses.GetKeys():
|
||||||
if LibraryClass.startswith("NULL") and Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
|
if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit() and Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
|
||||||
Module.LibraryClasses[LibraryClass] = Platform.LibraryClasses[LibraryClass, Module.ModuleType]
|
Module.LibraryClasses[LibraryClass] = Platform.LibraryClasses[LibraryClass, Module.ModuleType]
|
||||||
|
|
||||||
# add forced library instances (specified in module overrides)
|
# add forced library instances (specified in module overrides)
|
||||||
for LibraryClass in Platform.Modules[str(Module)].LibraryClasses:
|
for LibraryClass in Platform.Modules[str(Module)].LibraryClasses:
|
||||||
if LibraryClass.startswith("NULL"):
|
if LibraryClass.startswith("NULL") and LibraryClass[4:].isdigit():
|
||||||
Module.LibraryClasses[LibraryClass] = Platform.Modules[str(Module)].LibraryClasses[LibraryClass]
|
Module.LibraryClasses[LibraryClass] = Platform.Modules[str(Module)].LibraryClasses[LibraryClass]
|
||||||
|
|
||||||
# EdkII module
|
# EdkII module
|
||||||
@@ -123,6 +123,8 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||||||
while len(LibraryConsumerList) > 0:
|
while len(LibraryConsumerList) > 0:
|
||||||
M = LibraryConsumerList.pop()
|
M = LibraryConsumerList.pop()
|
||||||
for LibraryClassName in M.LibraryClasses:
|
for LibraryClassName in M.LibraryClasses:
|
||||||
|
if LibraryClassName.startswith("NULL") and LibraryClassName[4:].isdigit() and bool(M.LibraryClass):
|
||||||
|
continue
|
||||||
if LibraryClassName not in LibraryInstance:
|
if LibraryClassName not in LibraryInstance:
|
||||||
# override library instance for this module
|
# override library instance for this module
|
||||||
LibraryPath = Platform.Modules[str(Module)].LibraryClasses.get(LibraryClassName,Platform.LibraryClasses[LibraryClassName, ModuleType])
|
LibraryPath = Platform.Modules[str(Module)].LibraryClasses.get(LibraryClassName,Platform.LibraryClasses[LibraryClassName, ModuleType])
|
||||||
@@ -139,7 +141,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||||||
|
|
||||||
LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
|
LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
|
||||||
# for those forced library instance (NULL library), add a fake library class
|
# for those forced library instance (NULL library), add a fake library class
|
||||||
if LibraryClassName.startswith("NULL"):
|
if LibraryClassName.startswith("NULL") and LibraryClassName[4:].isdigit():
|
||||||
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
|
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
|
||||||
elif LibraryModule.LibraryClass is None \
|
elif LibraryModule.LibraryClass is None \
|
||||||
or len(LibraryModule.LibraryClass) == 0 \
|
or len(LibraryModule.LibraryClass) == 0 \
|
||||||
|
@@ -3589,6 +3589,131 @@ CryptoServicePkcs1v2Encrypt (
|
|||||||
return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs1v2Encrypt, Pkcs1v2Encrypt, (PublicKey, PublicKeySize, InData, InDataSize, PrngSeed, PrngSeedSize, EncryptedData, EncryptedDataSize), FALSE);
|
return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs1v2Encrypt, Pkcs1v2Encrypt, (PublicKey, PublicKeySize, InData, InDataSize, PrngSeed, PrngSeedSize, EncryptedData, EncryptedDataSize), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CryptoServiceRsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return CALL_BASECRYPTLIB (Rsa.Services.RsaOaepEncrypt, RsaOaepEncrypt, (RsaContext, InData, InDataSize, PrngSeed, PrngSeedSize, DigestLen, EncryptedData, EncryptedDataSize), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CryptoServicePkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs1v2Decrypt, Pkcs1v2Decrypt, (PrivateKey, PrivateKeySize, EncryptedData, EncryptedDataSize, OutData, OutDataSize), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CryptoServiceRsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return CALL_BASECRYPTLIB (Rsa.Services.RsaOaepDecrypt, RsaOaepDecrypt, (RsaContext, EncryptedData, EncryptedDataSize, DigestLen, OutData, OutDataSize), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
||||||
Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
||||||
@@ -6987,5 +7112,8 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
|
|||||||
CryptoServiceX509VerifyCertChain,
|
CryptoServiceX509VerifyCertChain,
|
||||||
CryptoServiceX509GetCertFromCertChain,
|
CryptoServiceX509GetCertFromCertChain,
|
||||||
CryptoServiceAsn1GetTag,
|
CryptoServiceAsn1GetTag,
|
||||||
CryptoServiceX509GetExtendedBasicConstraints
|
CryptoServiceX509GetExtendedBasicConstraints,
|
||||||
|
CryptoServicePkcs1v2Decrypt,
|
||||||
|
CryptoServiceRsaOaepEncrypt,
|
||||||
|
CryptoServiceRsaOaepDecrypt,
|
||||||
};
|
};
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
functionality enabling.
|
functionality enabling.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -2147,6 +2148,122 @@ Pkcs1v2Encrypt (
|
|||||||
OUT UINTN *EncryptedDataSize
|
OUT UINTN *EncryptedDataSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The 3rd parameter of Pkcs7GetSigners will return all embedded
|
The 3rd parameter of Pkcs7GetSigners will return all embedded
|
||||||
X.509 certificate in one given PKCS7 signature. The format is:
|
X.509 certificate in one given PKCS7 signature. The format is:
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
* Sha1 family
|
* Sha1 family
|
||||||
|
|
||||||
Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -124,6 +125,7 @@ typedef struct {
|
|||||||
UINT8 Pkcs7GetCertificatesList : 1;
|
UINT8 Pkcs7GetCertificatesList : 1;
|
||||||
UINT8 AuthenticodeVerify : 1;
|
UINT8 AuthenticodeVerify : 1;
|
||||||
UINT8 ImageTimestampVerify : 1;
|
UINT8 ImageTimestampVerify : 1;
|
||||||
|
UINT8 Pkcs1v2Decrypt : 1;
|
||||||
} Services;
|
} Services;
|
||||||
UINT32 Family;
|
UINT32 Family;
|
||||||
} Pkcs;
|
} Pkcs;
|
||||||
@@ -158,6 +160,8 @@ typedef struct {
|
|||||||
UINT8 Pkcs1Verify : 1;
|
UINT8 Pkcs1Verify : 1;
|
||||||
UINT8 GetPrivateKeyFromPem : 1;
|
UINT8 GetPrivateKeyFromPem : 1;
|
||||||
UINT8 GetPublicKeyFromX509 : 1;
|
UINT8 GetPublicKeyFromX509 : 1;
|
||||||
|
UINT8 RsaOaepEncrypt : 1;
|
||||||
|
UINT8 RsaOaepDecrypt : 1;
|
||||||
} Services;
|
} Services;
|
||||||
UINT32 Family;
|
UINT32 Family;
|
||||||
} Rsa;
|
} Rsa;
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
Copyright (C) 2016 Microsoft Corporation. All Rights Reserved.
|
Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -14,6 +14,37 @@
|
|||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve a pointer to EVP message digest object.
|
||||||
|
|
||||||
|
@param[in] DigestLen Length of the message digest.
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
const
|
||||||
|
EVP_MD *
|
||||||
|
GetEvpMD (
|
||||||
|
IN UINT16 DigestLen
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (DigestLen) {
|
||||||
|
case SHA1_DIGEST_SIZE:
|
||||||
|
return EVP_sha1 ();
|
||||||
|
break;
|
||||||
|
case SHA256_DIGEST_SIZE:
|
||||||
|
return EVP_sha256 ();
|
||||||
|
break;
|
||||||
|
case SHA384_DIGEST_SIZE:
|
||||||
|
return EVP_sha384 ();
|
||||||
|
break;
|
||||||
|
case SHA512_DIGEST_SIZE:
|
||||||
|
return EVP_sha512 ();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
encrypted message in a newly allocated buffer.
|
encrypted message in a newly allocated buffer.
|
||||||
@@ -26,15 +57,20 @@
|
|||||||
- Data size is too large for the provided key size (max size is a function of key size
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
and hash digest size).
|
and hash digest size).
|
||||||
|
|
||||||
@param[in] PublicKey A pointer to the DER-encoded X509 certificate that
|
@param[in] Pkey A pointer to an EVP_PKEY struct that
|
||||||
will be used to encrypt the data.
|
will be used to encrypt the data.
|
||||||
@param[in] PublicKeySize Size of the X509 cert buffer.
|
|
||||||
@param[in] InData Data to be encrypted.
|
@param[in] InData Data to be encrypted.
|
||||||
@param[in] InDataSize Size of the data buffer.
|
@param[in] InDataSize Size of the data buffer.
|
||||||
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
to be used when initializing the PRNG. NULL otherwise.
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
0 otherwise.
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
message.
|
message.
|
||||||
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
@@ -45,50 +81,35 @@
|
|||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Pkcs1v2Encrypt (
|
InternalPkcs1v2Encrypt (
|
||||||
IN CONST UINT8 *PublicKey,
|
EVP_PKEY *Pkey,
|
||||||
IN UINTN PublicKeySize,
|
|
||||||
IN UINT8 *InData,
|
IN UINT8 *InData,
|
||||||
IN UINTN InDataSize,
|
IN UINTN InDataSize,
|
||||||
IN CONST UINT8 *PrngSeed OPTIONAL,
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
IN UINTN PrngSeedSize OPTIONAL,
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
OUT UINT8 **EncryptedData,
|
OUT UINT8 **EncryptedData,
|
||||||
OUT UINTN *EncryptedDataSize
|
OUT UINTN *EncryptedDataSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
CONST UINT8 *TempPointer;
|
|
||||||
X509 *CertData;
|
|
||||||
EVP_PKEY *InternalPublicKey;
|
|
||||||
EVP_PKEY_CTX *PkeyCtx;
|
EVP_PKEY_CTX *PkeyCtx;
|
||||||
UINT8 *OutData;
|
UINT8 *OutData;
|
||||||
UINTN OutDataSize;
|
UINTN OutDataSize;
|
||||||
|
CONST EVP_MD *HashAlg;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check input parameters.
|
// Check input parameters.
|
||||||
//
|
//
|
||||||
if ((PublicKey == NULL) || (InData == NULL) ||
|
if ((Pkey == NULL) || (InData == NULL) ||
|
||||||
(EncryptedData == NULL) || (EncryptedDataSize == NULL))
|
(EncryptedData == NULL) || (EncryptedDataSize == NULL))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check public key size.
|
|
||||||
//
|
|
||||||
if (PublicKeySize > 0xFFFFFFFF) {
|
|
||||||
//
|
|
||||||
// Public key size is too large for implementation.
|
|
||||||
//
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*EncryptedData = NULL;
|
*EncryptedData = NULL;
|
||||||
*EncryptedDataSize = 0;
|
*EncryptedDataSize = 0;
|
||||||
Result = FALSE;
|
Result = FALSE;
|
||||||
TempPointer = NULL;
|
|
||||||
CertData = NULL;
|
|
||||||
InternalPublicKey = NULL;
|
|
||||||
PkeyCtx = NULL;
|
PkeyCtx = NULL;
|
||||||
OutData = NULL;
|
OutData = NULL;
|
||||||
OutDataSize = 0;
|
OutDataSize = 0;
|
||||||
@@ -104,34 +125,10 @@ Pkcs1v2Encrypt (
|
|||||||
RandomSeed (NULL, 0);
|
RandomSeed (NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Parse the X509 cert and extract the public key.
|
|
||||||
//
|
|
||||||
TempPointer = PublicKey;
|
|
||||||
CertData = d2i_X509 (&CertData, &TempPointer, (UINT32)PublicKeySize);
|
|
||||||
if (CertData == NULL) {
|
|
||||||
//
|
|
||||||
// Fail to parse X509 cert.
|
|
||||||
//
|
|
||||||
goto _Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Extract the public key from the x509 cert in a format that
|
|
||||||
// OpenSSL can use.
|
|
||||||
//
|
|
||||||
InternalPublicKey = X509_get_pubkey (CertData);
|
|
||||||
if (InternalPublicKey == NULL) {
|
|
||||||
//
|
|
||||||
// Fail to extract public key.
|
|
||||||
//
|
|
||||||
goto _Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create a context for the public key operation.
|
// Create a context for the public key operation.
|
||||||
//
|
//
|
||||||
PkeyCtx = EVP_PKEY_CTX_new (InternalPublicKey, NULL);
|
PkeyCtx = EVP_PKEY_CTX_new (Pkey, NULL);
|
||||||
if (PkeyCtx == NULL) {
|
if (PkeyCtx == NULL) {
|
||||||
//
|
//
|
||||||
// Fail to create contex.
|
// Fail to create contex.
|
||||||
@@ -151,6 +148,21 @@ Pkcs1v2Encrypt (
|
|||||||
goto _Exit;
|
goto _Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DigestLen != 0) {
|
||||||
|
HashAlg = GetEvpMD (DigestLen);
|
||||||
|
if (HashAlg == NULL) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP_PKEY_CTX_set_rsa_oaep_md (PkeyCtx, HashAlg) <= 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP_PKEY_CTX_set_rsa_mgf1_md (PkeyCtx, HashAlg) <= 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the required buffer length for malloc'ing.
|
// Determine the required buffer length for malloc'ing.
|
||||||
//
|
//
|
||||||
@@ -196,17 +208,507 @@ _Exit:
|
|||||||
//
|
//
|
||||||
// Release Resources
|
// Release Resources
|
||||||
//
|
//
|
||||||
if (CertData != NULL) {
|
|
||||||
X509_free (CertData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InternalPublicKey != NULL) {
|
|
||||||
EVP_PKEY_free (InternalPublicKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PkeyCtx != NULL) {
|
if (PkeyCtx != NULL) {
|
||||||
EVP_PKEY_CTX_free (PkeyCtx);
|
EVP_PKEY_CTX_free (PkeyCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to parse X509 certificate.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] PublicKey A pointer to the DER-encoded X509 certificate that
|
||||||
|
will be used to encrypt the data.
|
||||||
|
@param[in] PublicKeySize Size of the X509 cert buffer.
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Encrypt (
|
||||||
|
IN CONST UINT8 *PublicKey,
|
||||||
|
IN UINTN PublicKeySize,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Result;
|
||||||
|
CONST UINT8 *TempPointer;
|
||||||
|
X509 *CertData;
|
||||||
|
EVP_PKEY *Pkey;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check input parameters.
|
||||||
|
//
|
||||||
|
if ((PublicKey == NULL) || (InData == NULL) ||
|
||||||
|
(EncryptedData == NULL) || (EncryptedDataSize == NULL))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check public key size.
|
||||||
|
//
|
||||||
|
if (PublicKeySize > 0xFFFFFFFF) {
|
||||||
|
//
|
||||||
|
// Public key size is too large for implementation.
|
||||||
|
//
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*EncryptedData = NULL;
|
||||||
|
*EncryptedDataSize = 0;
|
||||||
|
Result = FALSE;
|
||||||
|
TempPointer = NULL;
|
||||||
|
CertData = NULL;
|
||||||
|
Pkey = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parse the X509 cert and extract the public key.
|
||||||
|
//
|
||||||
|
TempPointer = PublicKey;
|
||||||
|
CertData = d2i_X509 (&CertData, &TempPointer, (UINT32)PublicKeySize);
|
||||||
|
if (CertData == NULL) {
|
||||||
|
//
|
||||||
|
// Fail to parse X509 cert.
|
||||||
|
//
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract the public key from the x509 cert in a format that
|
||||||
|
// OpenSSL can use.
|
||||||
|
//
|
||||||
|
Pkey = X509_get_pubkey (CertData);
|
||||||
|
if (Pkey == NULL) {
|
||||||
|
//
|
||||||
|
// Fail to extract public key.
|
||||||
|
//
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = InternalPkcs1v2Encrypt (Pkey, InData, InDataSize, PrngSeed, PrngSeedSize, 0, EncryptedData, EncryptedDataSize);
|
||||||
|
|
||||||
|
_Exit:
|
||||||
|
//
|
||||||
|
// Release Resources
|
||||||
|
//
|
||||||
|
if (CertData != NULL) {
|
||||||
|
X509_free (CertData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Pkey != NULL) {
|
||||||
|
EVP_PKEY_free (Pkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Result;
|
||||||
|
EVP_PKEY *Pkey;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check input parameters.
|
||||||
|
//
|
||||||
|
if (((RsaContext == NULL) || (InData == NULL)) ||
|
||||||
|
(EncryptedData == NULL) || (EncryptedDataSize == NULL))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*EncryptedData = NULL;
|
||||||
|
*EncryptedDataSize = 0;
|
||||||
|
Result = FALSE;
|
||||||
|
Pkey = NULL;
|
||||||
|
|
||||||
|
Pkey = EVP_PKEY_new ();
|
||||||
|
if (Pkey == NULL) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP_PKEY_set1_RSA (Pkey, (RSA *)RsaContext) == 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = InternalPkcs1v2Encrypt (Pkey, InData, InDataSize, PrngSeed, PrngSeedSize, DigestLen, EncryptedData, EncryptedDataSize);
|
||||||
|
|
||||||
|
_Exit:
|
||||||
|
//
|
||||||
|
// Release Resources
|
||||||
|
//
|
||||||
|
if (Pkey != NULL) {
|
||||||
|
EVP_PKEY_free (Pkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] Pkey A pointer to an EVP_PKEY which will decrypt that data.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
InternalPkcs1v2Decrypt (
|
||||||
|
EVP_PKEY *Pkey,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Result;
|
||||||
|
EVP_PKEY_CTX *PkeyCtx;
|
||||||
|
UINT8 *TempData;
|
||||||
|
UINTN TempDataSize;
|
||||||
|
INTN ReturnCode;
|
||||||
|
CONST EVP_MD *HashAlg;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check input parameters.
|
||||||
|
//
|
||||||
|
if ((Pkey == NULL) || (EncryptedData == NULL) ||
|
||||||
|
(OutData == NULL) || (OutDataSize == NULL))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = FALSE;
|
||||||
|
PkeyCtx = NULL;
|
||||||
|
TempData = NULL;
|
||||||
|
TempDataSize = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a context for the decryption operation.
|
||||||
|
//
|
||||||
|
PkeyCtx = EVP_PKEY_CTX_new (Pkey, NULL);
|
||||||
|
if (PkeyCtx == NULL) {
|
||||||
|
//
|
||||||
|
// Fail to create contex.
|
||||||
|
//
|
||||||
|
DEBUG ((DEBUG_ERROR, "[%a] EVP_PKEY_CTK_new() failed\n", __func__));
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the context and set the desired padding.
|
||||||
|
//
|
||||||
|
if ((EVP_PKEY_decrypt_init (PkeyCtx) <= 0) ||
|
||||||
|
(EVP_PKEY_CTX_set_rsa_padding (PkeyCtx, RSA_PKCS1_OAEP_PADDING) <= 0))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Fail to initialize the context.
|
||||||
|
//
|
||||||
|
DEBUG ((DEBUG_ERROR, "[%a] EVP_PKEY_decrypt_init() failed\n", __func__));
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DigestLen != 0) {
|
||||||
|
HashAlg = GetEvpMD (DigestLen);
|
||||||
|
if (HashAlg == NULL) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP_PKEY_CTX_set_rsa_oaep_md (PkeyCtx, HashAlg) <= 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP_PKEY_CTX_set_rsa_mgf1_md (PkeyCtx, HashAlg) <= 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Determine the required buffer length for malloc'ing.
|
||||||
|
//
|
||||||
|
ReturnCode = EVP_PKEY_decrypt (PkeyCtx, NULL, &TempDataSize, EncryptedData, EncryptedDataSize);
|
||||||
|
if (ReturnCode <= 0) {
|
||||||
|
//
|
||||||
|
// Fail to determine output buffer size.
|
||||||
|
//
|
||||||
|
DEBUG ((DEBUG_ERROR, "[%a] EVP_PKEY_decrypt() failed to determine output buffer size (rc=%d)\n", __func__, ReturnCode));
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate a buffer for the output data.
|
||||||
|
//
|
||||||
|
TempData = AllocatePool (TempDataSize);
|
||||||
|
if (TempData == NULL) {
|
||||||
|
//
|
||||||
|
// Fail to allocate the output buffer.
|
||||||
|
//
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Decrypt Data.
|
||||||
|
//
|
||||||
|
ReturnCode = EVP_PKEY_decrypt (PkeyCtx, TempData, &TempDataSize, EncryptedData, EncryptedDataSize);
|
||||||
|
if (ReturnCode <= 0) {
|
||||||
|
//
|
||||||
|
// Fail to decrypt data, need to free the output buffer.
|
||||||
|
//
|
||||||
|
FreePool (TempData);
|
||||||
|
TempData = NULL;
|
||||||
|
TempDataSize = 0;
|
||||||
|
|
||||||
|
DEBUG ((DEBUG_ERROR, "[%a] EVP_PKEY_decrypt(TempData) failed to decrypt (rc=%d)\n", __func__, ReturnCode));
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Decrypt done.
|
||||||
|
//
|
||||||
|
*OutData = TempData;
|
||||||
|
*OutDataSize = TempDataSize;
|
||||||
|
Result = TRUE;
|
||||||
|
|
||||||
|
_Exit:
|
||||||
|
if (PkeyCtx != NULL) {
|
||||||
|
EVP_PKEY_CTX_free (PkeyCtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Result;
|
||||||
|
EVP_PKEY *Pkey;
|
||||||
|
CONST UINT8 *TempPointer;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check input parameters.
|
||||||
|
//
|
||||||
|
if ((PrivateKey == NULL) || (EncryptedData == NULL) ||
|
||||||
|
(OutData == NULL) || (OutDataSize == NULL))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = FALSE;
|
||||||
|
Pkey = NULL;
|
||||||
|
TempPointer = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parse the private key.
|
||||||
|
//
|
||||||
|
TempPointer = PrivateKey;
|
||||||
|
Pkey = d2i_PrivateKey (EVP_PKEY_RSA, &Pkey, &TempPointer, (UINT32)PrivateKeySize);
|
||||||
|
if (Pkey == NULL) {
|
||||||
|
//
|
||||||
|
// Fail to parse private key.
|
||||||
|
//
|
||||||
|
DEBUG ((DEBUG_ERROR, "[%a] d2i_PrivateKey() failed\n", __func__));
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = InternalPkcs1v2Decrypt (Pkey, EncryptedData, EncryptedDataSize, 0, OutData, OutDataSize);
|
||||||
|
|
||||||
|
_Exit:
|
||||||
|
if (Pkey != NULL) {
|
||||||
|
EVP_PKEY_free (Pkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Result;
|
||||||
|
EVP_PKEY *Pkey;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check input parameters.
|
||||||
|
//
|
||||||
|
if ((RsaContext == NULL) || (EncryptedData == NULL) ||
|
||||||
|
(OutData == NULL) || (OutDataSize == NULL))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = FALSE;
|
||||||
|
Pkey = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a context for the decryption operation.
|
||||||
|
//
|
||||||
|
|
||||||
|
Pkey = EVP_PKEY_new ();
|
||||||
|
if (Pkey == NULL) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EVP_PKEY_set1_RSA (Pkey, (RSA *)RsaContext) == 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = InternalPkcs1v2Decrypt (Pkey, EncryptedData, EncryptedDataSize, DigestLen, OutData, OutDataSize);
|
||||||
|
|
||||||
|
_Exit:
|
||||||
|
if (Pkey != NULL) {
|
||||||
|
EVP_PKEY_free (Pkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
Copyright (C) 2016 Microsoft Corporation. All Rights Reserved.
|
Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -48,3 +48,131 @@ Pkcs1v2Encrypt (
|
|||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "InternalCryptLib.h"
|
#include "InternalCryptLib.h"
|
||||||
#include <mbedtls/md5.h>
|
#include <mbedtls/md5.h>
|
||||||
#include <mbedtls/compat-2.x.h>
|
|
||||||
|
|
||||||
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ Md5Init (
|
|||||||
|
|
||||||
mbedtls_md5_init (Md5Context);
|
mbedtls_md5_init (Md5Context);
|
||||||
|
|
||||||
Ret = mbedtls_md5_starts_ret (Md5Context);
|
Ret = mbedtls_md5_starts (Md5Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -129,7 +128,7 @@ Md5Update (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_md5_update_ret (Md5Context, Data, DataSize);
|
Ret = mbedtls_md5_update (Md5Context, Data, DataSize);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -170,7 +169,7 @@ Md5Final (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_md5_finish_ret (Md5Context, HashValue);
|
Ret = mbedtls_md5_finish (Md5Context, HashValue);
|
||||||
mbedtls_md5_free (Md5Context);
|
mbedtls_md5_free (Md5Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -215,7 +214,7 @@ Md5HashAll (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_md5_ret (Data, DataSize, HashValue);
|
Ret = mbedtls_md5 (Data, DataSize, HashValue);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "InternalCryptLib.h"
|
#include "InternalCryptLib.h"
|
||||||
#include <mbedtls/sha1.h>
|
#include <mbedtls/sha1.h>
|
||||||
#include <mbedtls/compat-2.x.h>
|
|
||||||
|
|
||||||
#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
|
#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ Sha1Init (
|
|||||||
|
|
||||||
mbedtls_sha1_init (Sha1Context);
|
mbedtls_sha1_init (Sha1Context);
|
||||||
|
|
||||||
Ret = mbedtls_sha1_starts_ret (Sha1Context);
|
Ret = mbedtls_sha1_starts (Sha1Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -129,7 +128,7 @@ Sha1Update (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha1_update_ret (Sha1Context, Data, DataSize);
|
Ret = mbedtls_sha1_update (Sha1Context, Data, DataSize);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -170,7 +169,7 @@ Sha1Final (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha1_finish_ret (Sha1Context, HashValue);
|
Ret = mbedtls_sha1_finish (Sha1Context, HashValue);
|
||||||
mbedtls_sha1_free (Sha1Context);
|
mbedtls_sha1_free (Sha1Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -215,7 +214,7 @@ Sha1HashAll (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha1_ret (Data, DataSize, HashValue);
|
Ret = mbedtls_sha1 (Data, DataSize, HashValue);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "InternalCryptLib.h"
|
#include "InternalCryptLib.h"
|
||||||
#include <mbedtls/sha256.h>
|
#include <mbedtls/sha256.h>
|
||||||
#include <mbedtls/compat-2.x.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
|
Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.
|
||||||
@@ -51,7 +50,7 @@ Sha256Init (
|
|||||||
|
|
||||||
mbedtls_sha256_init (Sha256Context);
|
mbedtls_sha256_init (Sha256Context);
|
||||||
|
|
||||||
Ret = mbedtls_sha256_starts_ret (Sha256Context, FALSE);
|
Ret = mbedtls_sha256_starts (Sha256Context, FALSE);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -124,7 +123,7 @@ Sha256Update (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha256_update_ret (Sha256Context, Data, DataSize);
|
Ret = mbedtls_sha256_update (Sha256Context, Data, DataSize);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -165,7 +164,7 @@ Sha256Final (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha256_finish_ret (Sha256Context, HashValue);
|
Ret = mbedtls_sha256_finish (Sha256Context, HashValue);
|
||||||
mbedtls_sha256_free (Sha256Context);
|
mbedtls_sha256_free (Sha256Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -210,7 +209,7 @@ Sha256HashAll (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha256_ret (Data, DataSize, HashValue, FALSE);
|
Ret = mbedtls_sha256 (Data, DataSize, HashValue, FALSE);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "InternalCryptLib.h"
|
#include "InternalCryptLib.h"
|
||||||
#include <mbedtls/sha512.h>
|
#include <mbedtls/sha512.h>
|
||||||
#include <mbedtls/compat-2.x.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
|
Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.
|
||||||
@@ -51,7 +50,7 @@ Sha384Init (
|
|||||||
|
|
||||||
mbedtls_sha512_init (Sha384Context);
|
mbedtls_sha512_init (Sha384Context);
|
||||||
|
|
||||||
Ret = mbedtls_sha512_starts_ret (Sha384Context, TRUE);
|
Ret = mbedtls_sha512_starts (Sha384Context, TRUE);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -126,7 +125,7 @@ Sha384Update (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha512_update_ret (Sha384Context, Data, DataSize);
|
Ret = mbedtls_sha512_update (Sha384Context, Data, DataSize);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -167,7 +166,7 @@ Sha384Final (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha512_finish_ret (Sha384Context, HashValue);
|
Ret = mbedtls_sha512_finish (Sha384Context, HashValue);
|
||||||
mbedtls_sha512_free (Sha384Context);
|
mbedtls_sha512_free (Sha384Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -212,7 +211,7 @@ Sha384HashAll (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha512_ret (Data, DataSize, HashValue, TRUE);
|
Ret = mbedtls_sha512 (Data, DataSize, HashValue, TRUE);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -261,7 +260,7 @@ Sha512Init (
|
|||||||
|
|
||||||
mbedtls_sha512_init (Sha512Context);
|
mbedtls_sha512_init (Sha512Context);
|
||||||
|
|
||||||
Ret = mbedtls_sha512_starts_ret (Sha512Context, FALSE);
|
Ret = mbedtls_sha512_starts (Sha512Context, FALSE);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -336,7 +335,7 @@ Sha512Update (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha512_update_ret (Sha512Context, Data, DataSize);
|
Ret = mbedtls_sha512_update (Sha512Context, Data, DataSize);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -377,7 +376,7 @@ Sha512Final (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha512_finish_ret (Sha512Context, HashValue);
|
Ret = mbedtls_sha512_finish (Sha512Context, HashValue);
|
||||||
mbedtls_sha512_free (Sha512Context);
|
mbedtls_sha512_free (Sha512Context);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -422,7 +421,7 @@ Sha512HashAll (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = mbedtls_sha512_ret (Data, DataSize, HashValue, FALSE);
|
Ret = mbedtls_sha512 (Data, DataSize, HashValue, FALSE);
|
||||||
if (Ret != 0) {
|
if (Ret != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -38,10 +39,8 @@ Pkcs1v2Encrypt (
|
|||||||
IN UINTN PublicKeySize,
|
IN UINTN PublicKeySize,
|
||||||
IN UINT8 *InData,
|
IN UINT8 *InData,
|
||||||
IN UINTN InDataSize,
|
IN UINTN InDataSize,
|
||||||
IN CONST UINT8 *PrngSeed,
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
OPTIONAL
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
IN UINTN PrngSeedSize,
|
|
||||||
OPTIONAL
|
|
||||||
OUT UINT8 **EncryptedData,
|
OUT UINT8 **EncryptedData,
|
||||||
OUT UINTN *EncryptedDataSize
|
OUT UINTN *EncryptedDataSize
|
||||||
)
|
)
|
||||||
@@ -49,3 +48,131 @@ Pkcs1v2Encrypt (
|
|||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
@@ -11,6 +11,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "InternalCryptLib.h"
|
#include "InternalCryptLib.h"
|
||||||
#include <mbedtls/rsa.h>
|
#include <mbedtls/rsa.h>
|
||||||
|
#include <mbedtls/sha256.h>
|
||||||
|
#include <mbedtls/sha512.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.
|
Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.
|
||||||
@@ -43,11 +45,8 @@ RsaPssVerify (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
INT32 Ret;
|
INT32 Ret;
|
||||||
mbedtls_md_type_t md_alg;
|
mbedtls_md_type_t MdAlg;
|
||||||
UINT8 HashValue[SHA512_DIGEST_SIZE];
|
UINT8 HashValue[SHA512_DIGEST_SIZE];
|
||||||
BOOLEAN Status;
|
|
||||||
UINTN ShaCtxSize;
|
|
||||||
VOID *ShaCtx;
|
|
||||||
mbedtls_rsa_context *RsaKey;
|
mbedtls_rsa_context *RsaKey;
|
||||||
|
|
||||||
if (RsaContext == NULL) {
|
if (RsaContext == NULL) {
|
||||||
@@ -75,78 +74,27 @@ RsaPssVerify (
|
|||||||
|
|
||||||
switch (DigestLen) {
|
switch (DigestLen) {
|
||||||
case SHA256_DIGEST_SIZE:
|
case SHA256_DIGEST_SIZE:
|
||||||
md_alg = MBEDTLS_MD_SHA256;
|
MdAlg = MBEDTLS_MD_SHA256;
|
||||||
ShaCtxSize = Sha256GetContextSize ();
|
if (mbedtls_sha256 (Message, MsgSize, HashValue, FALSE) != 0) {
|
||||||
ShaCtx = AllocateZeroPool (ShaCtxSize);
|
|
||||||
|
|
||||||
Status = Sha256Init (ShaCtx);
|
|
||||||
if (!Status) {
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Sha256Update (ShaCtx, Message, MsgSize);
|
|
||||||
if (!Status) {
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = Sha256Final (ShaCtx, HashValue);
|
|
||||||
if (!Status) {
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHA384_DIGEST_SIZE:
|
case SHA384_DIGEST_SIZE:
|
||||||
md_alg = MBEDTLS_MD_SHA384;
|
MdAlg = MBEDTLS_MD_SHA384;
|
||||||
ShaCtxSize = Sha384GetContextSize ();
|
if (mbedtls_sha512 (Message, MsgSize, HashValue, TRUE) != 0) {
|
||||||
ShaCtx = AllocateZeroPool (ShaCtxSize);
|
|
||||||
|
|
||||||
Status = Sha384Init (ShaCtx);
|
|
||||||
if (!Status) {
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Sha384Update (ShaCtx, Message, MsgSize);
|
|
||||||
if (!Status) {
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = Sha384Final (ShaCtx, HashValue);
|
|
||||||
if (!Status) {
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHA512_DIGEST_SIZE:
|
case SHA512_DIGEST_SIZE:
|
||||||
md_alg = MBEDTLS_MD_SHA512;
|
MdAlg = MBEDTLS_MD_SHA512;
|
||||||
ShaCtxSize = Sha512GetContextSize ();
|
if (mbedtls_sha512 (Message, MsgSize, HashValue, FALSE) != 0) {
|
||||||
ShaCtx = AllocateZeroPool (ShaCtxSize);
|
|
||||||
|
|
||||||
Status = Sha512Init (ShaCtx);
|
|
||||||
if (!Status) {
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Sha512Update (ShaCtx, Message, MsgSize);
|
|
||||||
if (!Status) {
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = Sha512Final (ShaCtx, HashValue);
|
|
||||||
if (!Status) {
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (ShaCtx);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -157,11 +105,11 @@ RsaPssVerify (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_rsa_set_padding (RsaContext, MBEDTLS_RSA_PKCS_V21, md_alg);
|
mbedtls_rsa_set_padding (RsaContext, MBEDTLS_RSA_PKCS_V21, MdAlg);
|
||||||
|
|
||||||
Ret = mbedtls_rsa_rsassa_pss_verify (
|
Ret = mbedtls_rsa_rsassa_pss_verify (
|
||||||
RsaContext,
|
RsaContext,
|
||||||
md_alg,
|
MdAlg,
|
||||||
(UINT32)DigestLen,
|
(UINT32)DigestLen,
|
||||||
HashValue,
|
HashValue,
|
||||||
Signature
|
Signature
|
||||||
|
@@ -377,8 +377,7 @@ EFIAPI
|
|||||||
X509GetSerialNumber (
|
X509GetSerialNumber (
|
||||||
IN CONST UINT8 *Cert,
|
IN CONST UINT8 *Cert,
|
||||||
IN UINTN CertSize,
|
IN UINTN CertSize,
|
||||||
OUT UINT8 *SerialNumber,
|
OUT UINT8 *SerialNumber OPTIONAL,
|
||||||
OPTIONAL
|
|
||||||
IN OUT UINTN *SerialNumberSize
|
IN OUT UINTN *SerialNumberSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -441,8 +440,7 @@ EFIAPI
|
|||||||
X509GetSignatureAlgorithm (
|
X509GetSignatureAlgorithm (
|
||||||
IN CONST UINT8 *Cert,
|
IN CONST UINT8 *Cert,
|
||||||
IN UINTN CertSize,
|
IN UINTN CertSize,
|
||||||
OUT UINT8 *Oid,
|
OUT UINT8 *Oid OPTIONAL,
|
||||||
OPTIONAL
|
|
||||||
IN OUT UINTN *OidSize
|
IN OUT UINTN *OidSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
Copyright (C) 2016 Microsoft Corporation. All Rights Reserved.
|
Copyright (C) Microsoft Corporation. All Rights Reserved.
|
||||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -48,3 +48,131 @@ Pkcs1v2Encrypt (
|
|||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ASSERT (FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
@@ -2825,6 +2825,119 @@ Pkcs1v2Encrypt (
|
|||||||
CALL_CRYPTO_SERVICE (Pkcs1v2Encrypt, (PublicKey, PublicKeySize, InData, InDataSize, PrngSeed, PrngSeedSize, EncryptedData, EncryptedDataSize), FALSE);
|
CALL_CRYPTO_SERVICE (Pkcs1v2Encrypt, (PublicKey, PublicKeySize, InData, InDataSize, PrngSeed, PrngSeedSize, EncryptedData, EncryptedDataSize), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
Pkcs1v2Decrypt (
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CALL_CRYPTO_SERVICE (Pkcs1v2Decrypt, (PrivateKey, PrivateKeySize, EncryptedData, EncryptedDataSize, OutData, OutDataSize), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepEncrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CALL_CRYPTO_SERVICE (RsaOaepEncrypt, (RsaContext, InData, InDataSize, PrngSeed, PrngSeedSize, DigestLen, EncryptedData, EncryptedDataSize), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
RsaOaepDecrypt (
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CALL_CRYPTO_SERVICE (RsaOaepDecrypt, (RsaContext, EncryptedData, EncryptedDataSize, DigestLen, OutData, OutDataSize), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
||||||
Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
||||||
@@ -2850,6 +2963,7 @@ Pkcs1v2Encrypt (
|
|||||||
@retval FALSE Error occurs during the operation.
|
@retval FALSE Error occurs during the operation.
|
||||||
@retval FALSE This interface is not supported.
|
@retval FALSE This interface is not supported.
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
/// the EDK II Crypto Protocol is extended, this version define must be
|
/// the EDK II Crypto Protocol is extended, this version define must be
|
||||||
/// increased.
|
/// increased.
|
||||||
///
|
///
|
||||||
#define EDKII_CRYPTO_VERSION 16
|
#define EDKII_CRYPTO_VERSION 17
|
||||||
|
|
||||||
///
|
///
|
||||||
/// EDK II Crypto Protocol forward declaration
|
/// EDK II Crypto Protocol forward declaration
|
||||||
@@ -688,6 +688,110 @@ BOOLEAN
|
|||||||
OUT UINTN *EncryptedDataSize
|
OUT UINTN *EncryptedDataSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
@param[in] PrivateKey A pointer to the DER-encoded private key.
|
||||||
|
@param[in] PrivateKeySize Size of the private key buffer.
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
(EFIAPI *EDKII_CRYPTO_PKCS1V2_DECRYPT)(
|
||||||
|
IN CONST UINT8 *PrivateKey,
|
||||||
|
IN UINTN PrivateKeySize,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
encrypted message in a newly allocated buffer.
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- X509 key size does not match any known key size.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
- Data size is too large for the provided key size (max size is a function of key size
|
||||||
|
and hash digest size).
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a public key using RsaSetKey().
|
||||||
|
@param[in] InData Data to be encrypted.
|
||||||
|
@param[in] InDataSize Size of the data buffer.
|
||||||
|
@param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer
|
||||||
|
to be used when initializing the PRNG. NULL otherwise.
|
||||||
|
@param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.
|
||||||
|
0 otherwise.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] EncryptedData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] EncryptedDataSize Size of the encrypted message buffer.
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
(EFIAPI *EDKII_CRYPTO_RSA_OAEP_ENCRYPT)(
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *InData,
|
||||||
|
IN UINTN InDataSize,
|
||||||
|
IN CONST UINT8 *PrngSeed OPTIONAL,
|
||||||
|
IN UINTN PrngSeedSize OPTIONAL,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **EncryptedData,
|
||||||
|
OUT UINTN *EncryptedDataSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Decrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
|
||||||
|
decrypted message in a newly allocated buffer.
|
||||||
|
Things that can cause a failure include:
|
||||||
|
- Fail to parse private key.
|
||||||
|
- Fail to allocate an intermediate buffer.
|
||||||
|
- Null pointer provided for a non-optional parameter.
|
||||||
|
@param[in] RsaContext A pointer to an RSA context created by RsaNew() and
|
||||||
|
provisioned with a private key using RsaSetKey().
|
||||||
|
@param[in] EncryptedData Data to be decrypted.
|
||||||
|
@param[in] EncryptedDataSize Size of the encrypted buffer.
|
||||||
|
@param[in] DigestLen [Optional] If provided, size of the hash used:
|
||||||
|
SHA1_DIGEST_SIZE
|
||||||
|
SHA256_DIGEST_SIZE
|
||||||
|
SHA384_DIGEST_SIZE
|
||||||
|
SHA512_DIGEST_SIZE
|
||||||
|
0 to use default (SHA1)
|
||||||
|
@param[out] OutData Pointer to an allocated buffer containing the encrypted
|
||||||
|
message.
|
||||||
|
@param[out] OutDataSize Size of the encrypted message buffer.
|
||||||
|
@retval TRUE Encryption was successful.
|
||||||
|
@retval FALSE Encryption failed.
|
||||||
|
**/
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
(EFIAPI *EDKII_CRYPTO_RSA_OAEP_DECRYPT)(
|
||||||
|
IN VOID *RsaContext,
|
||||||
|
IN UINT8 *EncryptedData,
|
||||||
|
IN UINTN EncryptedDataSize,
|
||||||
|
IN UINT16 DigestLen OPTIONAL,
|
||||||
|
OUT UINT8 **OutData,
|
||||||
|
OUT UINTN *OutDataSize
|
||||||
|
);
|
||||||
|
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
// PKCS5
|
// PKCS5
|
||||||
|
|
||||||
@@ -5603,6 +5707,9 @@ struct _EDKII_CRYPTO_PROTOCOL {
|
|||||||
EDKII_CRYPTO_X509_GET_CERT_FROM_CERT_CHAIN X509GetCertFromCertChain;
|
EDKII_CRYPTO_X509_GET_CERT_FROM_CERT_CHAIN X509GetCertFromCertChain;
|
||||||
EDKII_CRYPTO_ASN1_GET_TAG Asn1GetTag;
|
EDKII_CRYPTO_ASN1_GET_TAG Asn1GetTag;
|
||||||
EDKII_CRYPTO_X509_GET_EXTENDED_BASIC_CONSTRAINTS X509GetExtendedBasicConstraints;
|
EDKII_CRYPTO_X509_GET_EXTENDED_BASIC_CONSTRAINTS X509GetExtendedBasicConstraints;
|
||||||
|
EDKII_CRYPTO_PKCS1V2_DECRYPT Pkcs1v2Decrypt;
|
||||||
|
EDKII_CRYPTO_RSA_OAEP_ENCRYPT RsaOaepEncrypt;
|
||||||
|
EDKII_CRYPTO_RSA_OAEP_DECRYPT RsaOaepDecrypt;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GUID gEdkiiCryptoProtocolGuid;
|
extern GUID gEdkiiCryptoProtocolGuid;
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This is a unit test for RSA OAEP encrypt.
|
This is a unit test for RSA OAEP encrypt/decrypt.
|
||||||
|
|
||||||
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "TestBaseCryptLib.h"
|
#include "TestBaseCryptLib.h"
|
||||||
|
|
||||||
CONST UINT8 RandSeed[] = "This is the random seed for PRNG verification.";
|
STATIC CONST UINT8 RandSeed[] = "This is the random seed for PRNG verification.";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Self signed X509 certificate
|
// Self signed X509 certificate
|
||||||
// CN = ca.self
|
// CN = ca.self
|
||||||
// O = Intel
|
// O = Intel
|
||||||
//
|
//
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 SelfTestCert[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 SelfTestCert[] = {
|
||||||
0x30, 0x82, 0x03, 0x90, 0x30, 0x82, 0x02, 0x78, 0x02, 0x09, 0x00, 0xE4, 0xDF, 0x47, 0x80, 0xEF,
|
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,
|
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,
|
0x05, 0x00, 0x30, 0x81, 0x89, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||||
@@ -75,7 +76,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 SelfTestCert[] = {
|
|||||||
0x5B, 0x64, 0x81, 0x13,
|
0x5B, 0x64, 0x81, 0x13,
|
||||||
};
|
};
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 PrivateKey[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 PrivateKey[] = {
|
||||||
0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBC, 0xE4, 0x67, 0xDC,
|
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,
|
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,
|
0x58, 0x34, 0x07, 0x03, 0x6D, 0x39, 0xB3, 0x67, 0x46, 0x4C, 0xBC, 0xA0, 0xFA, 0x4E, 0x64, 0x23,
|
||||||
@@ -153,114 +154,442 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 PrivateKey[] = {
|
|||||||
0x86, 0x10, 0x09, 0x88, 0x6C, 0x35, 0x60, 0xF2,
|
0x86, 0x10, 0x09, 0x88, 0x6C, 0x35, 0x60, 0xF2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The following RSA key componets were extracted from the above private key with openssl.
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 RsaN[] = {
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 RsaE[] = {
|
||||||
|
0x01, 0x00, 0x01
|
||||||
|
};
|
||||||
|
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 RsaD[] = {
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
// test case = "123\0"
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 Msg1230[] = {
|
||||||
|
0x31, 0x32, 0x33, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ciphertext of the test case using RSAES-OAEP2048 with SHA1 MD/BGF1 created with openssl.
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 Ct1230RsaesOaepMdSha1Mgf1Sha1[] = {
|
||||||
|
0x88, 0x5d, 0xf3, 0x00, 0x66, 0x77, 0x91, 0x94, 0x5c, 0x8d, 0x45, 0xb6, 0xb2, 0x24, 0x26, 0x26,
|
||||||
|
0x37, 0xbe, 0xe0, 0x87, 0x4f, 0x50, 0xbf, 0x88, 0xde, 0x5d, 0xe9, 0xe0, 0xb2, 0x7e, 0x66, 0xfa,
|
||||||
|
0x6c, 0xfd, 0x0d, 0x19, 0x48, 0x41, 0xfe, 0x7a, 0x86, 0xa8, 0x28, 0xc2, 0x01, 0xcf, 0x76, 0xd7,
|
||||||
|
0xea, 0xab, 0x6d, 0xc3, 0x5e, 0x2c, 0x36, 0x04, 0xc0, 0x54, 0xc2, 0x68, 0x67, 0xe7, 0x04, 0x27,
|
||||||
|
0x56, 0xbe, 0x53, 0xb5, 0x80, 0x94, 0xd8, 0xde, 0x8c, 0x75, 0x69, 0x42, 0xba, 0x55, 0xd6, 0x2c,
|
||||||
|
0xda, 0x22, 0xe6, 0x09, 0xf6, 0x90, 0x27, 0x4b, 0x10, 0x54, 0x40, 0xa0, 0x74, 0x31, 0xdb, 0x5f,
|
||||||
|
0x80, 0x06, 0xc7, 0x67, 0x96, 0xe8, 0x45, 0xea, 0x7f, 0x72, 0x18, 0x24, 0xe8, 0x0d, 0x46, 0xc2,
|
||||||
|
0xa0, 0x83, 0xca, 0x71, 0xca, 0x91, 0x4b, 0x89, 0x80, 0x61, 0x01, 0x8e, 0xcf, 0xa1, 0x68, 0x81,
|
||||||
|
0x2d, 0xf2, 0x08, 0xd2, 0x02, 0x9e, 0xc0, 0xa4, 0x91, 0x71, 0x90, 0x84, 0x2f, 0x4e, 0x18, 0x37,
|
||||||
|
0x9b, 0x61, 0x0b, 0xf5, 0x88, 0xf7, 0x6b, 0x87, 0xb9, 0x4e, 0x31, 0xda, 0xf3, 0xb5, 0xe2, 0x60,
|
||||||
|
0x4d, 0xd9, 0x52, 0x99, 0x6b, 0x19, 0x98, 0xa2, 0x28, 0xaa, 0xeb, 0x5a, 0x33, 0xef, 0xf1, 0x4e,
|
||||||
|
0x29, 0x86, 0xbf, 0x70, 0x08, 0xfd, 0x34, 0x8a, 0x8c, 0x6d, 0xef, 0xc4, 0xa1, 0xfe, 0xdf, 0x4d,
|
||||||
|
0xeb, 0xf0, 0x2c, 0x4c, 0xf5, 0xb3, 0xe8, 0xf8, 0xc3, 0x45, 0xc7, 0x6b, 0x59, 0x1c, 0x9b, 0xd9,
|
||||||
|
0x52, 0xdf, 0x65, 0x87, 0x18, 0xd2, 0x6d, 0xff, 0x8b, 0x98, 0x2a, 0x97, 0xeb, 0x93, 0xea, 0x6a,
|
||||||
|
0x23, 0x23, 0xc6, 0x32, 0xf5, 0xea, 0x45, 0xe3, 0x99, 0xa0, 0x4d, 0x4b, 0x8f, 0xf8, 0x1d, 0xad,
|
||||||
|
0xa9, 0x97, 0xa2, 0xd6, 0xaf, 0x5e, 0x11, 0xf7, 0x5f, 0x28, 0xfb, 0x38, 0x80, 0x38, 0x50, 0xc4,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ciphertext of the test case using RSAES-OAEP2048 with SHA256 MD/BGF1 created with openssl.
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC CONST UINT8 Ct1230RsaesOaep2048MdSha256Mgf1Sha256[] = {
|
||||||
|
0xa7, 0x20, 0xa9, 0x31, 0xb5, 0xad, 0x83, 0x0a, 0x07, 0xee, 0x36, 0x46, 0xa5, 0x78, 0x3a, 0xda,
|
||||||
|
0x9d, 0xdf, 0xe6, 0x05, 0x0f, 0x7c, 0x46, 0xfe, 0x5f, 0xd6, 0x58, 0x16, 0xb6, 0xaa, 0x82, 0x7c,
|
||||||
|
0x58, 0x8a, 0x52, 0x14, 0x12, 0x29, 0x6f, 0x62, 0x80, 0xa7, 0x61, 0xfe, 0x29, 0x72, 0x6f, 0x73,
|
||||||
|
0xf6, 0x2f, 0x54, 0x38, 0x58, 0x7b, 0xbd, 0xa1, 0x2f, 0x9d, 0x12, 0x83, 0x72, 0xbc, 0x3d, 0x29,
|
||||||
|
0x65, 0x39, 0xcb, 0x93, 0x95, 0x3e, 0x73, 0xc9, 0x6f, 0xb9, 0xe8, 0xd5, 0x8b, 0x91, 0x0d, 0x87,
|
||||||
|
0x7e, 0x22, 0xb5, 0x93, 0x3d, 0xa8, 0x4a, 0xd9, 0x1a, 0x13, 0xf7, 0xf4, 0x7f, 0x16, 0x42, 0xfe,
|
||||||
|
0x63, 0x10, 0x7e, 0xa1, 0xe5, 0x04, 0xcf, 0xed, 0x93, 0x2d, 0x16, 0x3b, 0x79, 0x1f, 0x53, 0x41,
|
||||||
|
0xe3, 0xca, 0x69, 0x18, 0x6a, 0xe5, 0xec, 0x9a, 0xce, 0xbc, 0x47, 0xf6, 0x77, 0x9a, 0x5c, 0xea,
|
||||||
|
0xac, 0x7e, 0x28, 0xeb, 0x1e, 0xfe, 0x75, 0xa6, 0xbf, 0x1e, 0xfd, 0x1c, 0x63, 0x69, 0x47, 0x04,
|
||||||
|
0xaf, 0x69, 0x7e, 0x1c, 0xa1, 0x7f, 0x00, 0xcf, 0xec, 0x16, 0x34, 0xd9, 0xde, 0x91, 0x0e, 0x0f,
|
||||||
|
0x0b, 0x1e, 0x66, 0xc3, 0x41, 0x88, 0x43, 0xbe, 0xa3, 0x2a, 0x7c, 0x87, 0xff, 0xc0, 0x67, 0xdc,
|
||||||
|
0xc7, 0xeb, 0x28, 0x07, 0x00, 0x72, 0x85, 0x17, 0xca, 0x05, 0x9f, 0x29, 0x6b, 0xad, 0xc6, 0xae,
|
||||||
|
0x1c, 0x4a, 0xf2, 0xfe, 0x97, 0xc7, 0x6e, 0x4b, 0xbf, 0xfd, 0x46, 0xbe, 0xf8, 0x76, 0xc9, 0x70,
|
||||||
|
0x58, 0x3a, 0x73, 0xcc, 0x34, 0xda, 0xfe, 0x5b, 0x6d, 0x98, 0x74, 0x95, 0x85, 0xc7, 0xc9, 0x84,
|
||||||
|
0x02, 0xa8, 0x97, 0x13, 0xa3, 0x83, 0xcb, 0x28, 0x3d, 0xbb, 0x2b, 0x3b, 0x45, 0xf1, 0x6e, 0xc5,
|
||||||
|
0x37, 0x23, 0x21, 0xe6, 0x74, 0x2d, 0x48, 0x19, 0x97, 0xaf, 0xee, 0x3d, 0x9b, 0xd0, 0x05, 0xc7
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _OAEP_ENC_DEC_TEST_CONTEXT OAEP_ENC_DEC_TEST_CONTEXT;
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
(EFIAPI *OAEP_TEST_ENCRYPT)(
|
||||||
|
IN OAEP_ENC_DEC_TEST_CONTEXT *TestContext,
|
||||||
|
IN CONST UINT8 *ClearText,
|
||||||
|
IN UINTN ClearTextSize,
|
||||||
|
IN CONST UINT8 *PrngSeed,
|
||||||
|
IN UINTN PrngSeedSize,
|
||||||
|
IN UINT16 DigestLen,
|
||||||
|
OUT UINT8 **CipherText,
|
||||||
|
OUT UINTN *CipherTextSize
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef
|
||||||
|
BOOLEAN
|
||||||
|
(EFIAPI *OAEP_TEST_DECRYPT)(
|
||||||
|
IN OAEP_ENC_DEC_TEST_CONTEXT *TestContext,
|
||||||
|
IN CONST UINT8 *CipherText,
|
||||||
|
IN UINTN CipherTextSize,
|
||||||
|
IN UINT16 DigestLen,
|
||||||
|
OUT UINT8 **ClearText,
|
||||||
|
OUT UINTN *ClearTextSize
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef struct _OAEP_ENC_DEC_TEST_CONTEXT {
|
||||||
|
CONST UINT8 *SelfTestCert;
|
||||||
|
UINTN SelfTestCertSize;
|
||||||
|
CONST UINT8 *PrivateKey;
|
||||||
|
UINTN PrivateKeySize;
|
||||||
|
CONST UINT8 *RsaN;
|
||||||
|
UINTN RsaNSize;
|
||||||
|
CONST UINT8 *RsaE;
|
||||||
|
UINTN RsaESize;
|
||||||
|
CONST UINT8 *RsaD;
|
||||||
|
UINTN RsaDSize;
|
||||||
|
CONST UINT8 *PrngSeed;
|
||||||
|
UINTN PrngSeedSize;
|
||||||
|
CONST UINT8 *ClearText;
|
||||||
|
UINTN ClearTextSize;
|
||||||
|
CONST UINT8 *CipherText;
|
||||||
|
UINTN CipherTextSize;
|
||||||
|
UINT16 DigestLen;
|
||||||
|
OAEP_TEST_ENCRYPT Encrypt;
|
||||||
|
OAEP_TEST_DECRYPT Decrypt;
|
||||||
|
UNIT_TEST_STATUS Expect;
|
||||||
|
} OAEP_ENC_DEC_TEST_CONTEXT;
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CallPkcs1v2Encrypt (
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx,
|
||||||
|
CONST UINT8 *ClearText,
|
||||||
|
UINTN ClearTextSize,
|
||||||
|
CONST UINT8 *PrngSeed,
|
||||||
|
UINTN PrngSeedSize,
|
||||||
|
UINT16 DigestLen,
|
||||||
|
UINT8 **CipherText,
|
||||||
|
UINTN *CipherTextSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Status;
|
||||||
|
|
||||||
|
Status = Pkcs1v2Encrypt (
|
||||||
|
TestCtx->SelfTestCert,
|
||||||
|
TestCtx->SelfTestCertSize,
|
||||||
|
(UINT8 *)ClearText,
|
||||||
|
ClearTextSize,
|
||||||
|
PrngSeed,
|
||||||
|
PrngSeedSize,
|
||||||
|
CipherText,
|
||||||
|
CipherTextSize
|
||||||
|
);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CallPkcs1v2Decrypt (
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx,
|
||||||
|
CONST UINT8 *CipherText,
|
||||||
|
UINTN CipherTextSize,
|
||||||
|
UINT16 DigestLen,
|
||||||
|
UINT8 **ClearText,
|
||||||
|
UINTN *ClearTextSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Status;
|
||||||
|
|
||||||
|
Status = Pkcs1v2Decrypt (
|
||||||
|
TestCtx->PrivateKey,
|
||||||
|
TestCtx->PrivateKeySize,
|
||||||
|
(UINT8 *)CipherText,
|
||||||
|
CipherTextSize,
|
||||||
|
ClearText,
|
||||||
|
ClearTextSize
|
||||||
|
);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CallRsaOaepEncrypt (
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx,
|
||||||
|
CONST UINT8 *ClearText,
|
||||||
|
UINTN ClearTextSize,
|
||||||
|
CONST UINT8 *RandSeedIn,
|
||||||
|
UINTN RandSeedSizeIn,
|
||||||
|
UINT16 DigestLen,
|
||||||
|
UINT8 **CipherText,
|
||||||
|
UINTN *CipherTextSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VOID *RsaContext = NULL;
|
||||||
|
BOOLEAN Status;
|
||||||
|
|
||||||
|
RsaContext = RsaNew ();
|
||||||
|
UT_ASSERT_FALSE (RsaContext == NULL);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyN, TestCtx->RsaN, TestCtx->RsaNSize);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyE, TestCtx->RsaE, TestCtx->RsaESize);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaOaepEncrypt (
|
||||||
|
RsaContext,
|
||||||
|
(UINT8 *)ClearText,
|
||||||
|
ClearTextSize,
|
||||||
|
RandSeedIn,
|
||||||
|
RandSeedSizeIn,
|
||||||
|
DigestLen,
|
||||||
|
CipherText,
|
||||||
|
CipherTextSize
|
||||||
|
);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
CallRsaOaepDecrypt (
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx,
|
||||||
|
CONST UINT8 *CipherText,
|
||||||
|
UINTN CipherTextSize,
|
||||||
|
UINT16 DigestLen,
|
||||||
|
UINT8 **ClearText,
|
||||||
|
UINTN *ClearTextSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VOID *RsaContext = NULL;
|
||||||
|
BOOLEAN Status;
|
||||||
|
|
||||||
|
RsaContext = RsaNew ();
|
||||||
|
UT_ASSERT_FALSE (RsaContext == NULL);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyN, TestCtx->RsaN, TestCtx->RsaNSize);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyE, TestCtx->RsaE, TestCtx->RsaESize);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyD, TestCtx->RsaD, TestCtx->RsaDSize);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaOaepDecrypt (
|
||||||
|
RsaContext,
|
||||||
|
(UINT8 *)CipherText,
|
||||||
|
CipherTextSize,
|
||||||
|
DigestLen,
|
||||||
|
ClearText,
|
||||||
|
ClearTextSize
|
||||||
|
);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
TestVerifyOaepEncrypt (
|
TestVerifyEncrypt (
|
||||||
|
IN UNIT_TEST_CONTEXT Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Status;
|
||||||
|
UINT8 *OutBuffer = NULL;
|
||||||
|
UINTN OutBufferSize = 0;
|
||||||
|
UINT8 *OutBuffer2 = NULL;
|
||||||
|
UINTN OutBuffer2Size = 0;
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx;
|
||||||
|
|
||||||
|
TestCtx = (OAEP_ENC_DEC_TEST_CONTEXT *)Context;
|
||||||
|
|
||||||
|
Status = TestCtx->Encrypt (
|
||||||
|
TestCtx,
|
||||||
|
TestCtx->ClearText,
|
||||||
|
TestCtx->ClearTextSize,
|
||||||
|
TestCtx->PrngSeed,
|
||||||
|
TestCtx->PrngSeedSize,
|
||||||
|
TestCtx->DigestLen,
|
||||||
|
&OutBuffer,
|
||||||
|
&OutBufferSize
|
||||||
|
);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = TestCtx->Encrypt (
|
||||||
|
TestCtx,
|
||||||
|
TestCtx->ClearText,
|
||||||
|
TestCtx->ClearTextSize,
|
||||||
|
TestCtx->PrngSeed,
|
||||||
|
TestCtx->PrngSeedSize,
|
||||||
|
TestCtx->DigestLen,
|
||||||
|
&OutBuffer2,
|
||||||
|
&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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return UNIT_TEST_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_STATUS
|
||||||
|
EFIAPI
|
||||||
|
TestVerifyDecrypt (
|
||||||
|
IN UNIT_TEST_CONTEXT Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Status;
|
||||||
|
UINT8 *OutBuffer = NULL;
|
||||||
|
UINTN OutBufferSize = 0;
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx;
|
||||||
|
|
||||||
|
TestCtx = Context;
|
||||||
|
|
||||||
|
Status = TestCtx->Decrypt (
|
||||||
|
TestCtx,
|
||||||
|
TestCtx->CipherText,
|
||||||
|
TestCtx->CipherTextSize,
|
||||||
|
TestCtx->DigestLen,
|
||||||
|
&OutBuffer,
|
||||||
|
&OutBufferSize
|
||||||
|
);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
UT_ASSERT_TRUE (CompareMem (OutBuffer, TestCtx->ClearText, OutBufferSize >= TestCtx->ClearTextSize ? OutBufferSize : TestCtx->ClearTextSize) == 0);
|
||||||
|
UT_ASSERT_TRUE (OutBufferSize == TestCtx->ClearTextSize);
|
||||||
|
|
||||||
|
if (OutBuffer) {
|
||||||
|
FreePool (OutBuffer);
|
||||||
|
OutBuffer = NULL;
|
||||||
|
OutBufferSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return UNIT_TEST_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_STATUS
|
||||||
|
EFIAPI
|
||||||
|
TestVerifyEncryptDecrypt (
|
||||||
|
IN UNIT_TEST_CONTEXT Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN Status;
|
||||||
|
UINT8 *ClearText = NULL;
|
||||||
|
UINTN ClearTextSize = 0;
|
||||||
|
UINT8 *CipherText = NULL;
|
||||||
|
UINTN CipherTextSize = 0;
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT *TestCtx;
|
||||||
|
|
||||||
|
TestCtx = Context;
|
||||||
|
|
||||||
|
Status = TestCtx->Encrypt (
|
||||||
|
TestCtx,
|
||||||
|
TestCtx->ClearText,
|
||||||
|
TestCtx->ClearTextSize,
|
||||||
|
TestCtx->PrngSeed,
|
||||||
|
TestCtx->PrngSeedSize,
|
||||||
|
TestCtx->DigestLen,
|
||||||
|
&CipherText,
|
||||||
|
&CipherTextSize
|
||||||
|
);
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = TestCtx->Decrypt (
|
||||||
|
TestCtx,
|
||||||
|
CipherText,
|
||||||
|
CipherTextSize,
|
||||||
|
TestCtx->DigestLen,
|
||||||
|
&ClearText,
|
||||||
|
&ClearTextSize
|
||||||
|
);
|
||||||
|
|
||||||
|
if (TestCtx->Expect == UNIT_TEST_PASSED) {
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
} else {
|
||||||
|
UT_ASSERT_FALSE (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TestCtx->Expect == UNIT_TEST_PASSED) {
|
||||||
|
UT_ASSERT_TRUE (CompareMem (ClearText, TestCtx->ClearText, ClearTextSize >= TestCtx->ClearTextSize ? ClearTextSize : TestCtx->ClearTextSize) == 0);
|
||||||
|
UT_ASSERT_TRUE (ClearTextSize == TestCtx->ClearTextSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CipherText) {
|
||||||
|
FreePool (CipherText);
|
||||||
|
CipherText = NULL;
|
||||||
|
CipherTextSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClearText) {
|
||||||
|
FreePool (ClearText);
|
||||||
|
ClearText = NULL;
|
||||||
|
ClearTextSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return UNIT_TEST_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_STATUS
|
||||||
|
EFIAPI
|
||||||
|
TestVerifyPkcs1v2EncryptInterface (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN Status;
|
BOOLEAN Status;
|
||||||
UINT8 File[4];
|
|
||||||
UINT8 *OutBuffer;
|
UINT8 *OutBuffer;
|
||||||
UINTN OutBufferSize;
|
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 (
|
Status = Pkcs1v2Encrypt (
|
||||||
NULL,
|
NULL,
|
||||||
(UINTN)sizeof (SelfTestCert),
|
(UINTN)sizeof (SelfTestCert),
|
||||||
File,
|
(UINT8 *)Msg1230,
|
||||||
(UINTN)4,
|
(UINTN)4,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
@@ -272,7 +601,7 @@ TestVerifyOaepEncrypt (
|
|||||||
Status = Pkcs1v2Encrypt (
|
Status = Pkcs1v2Encrypt (
|
||||||
SelfTestCert,
|
SelfTestCert,
|
||||||
(UINTN)sizeof (SelfTestCert),
|
(UINTN)sizeof (SelfTestCert),
|
||||||
File,
|
(UINT8 *)Msg1230,
|
||||||
(UINTN)4,
|
(UINTN)4,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
@@ -284,7 +613,7 @@ TestVerifyOaepEncrypt (
|
|||||||
Status = Pkcs1v2Encrypt (
|
Status = Pkcs1v2Encrypt (
|
||||||
SelfTestCert,
|
SelfTestCert,
|
||||||
(UINTN)sizeof (SelfTestCert),
|
(UINTN)sizeof (SelfTestCert),
|
||||||
File,
|
(UINT8 *)Msg1230,
|
||||||
(UINTN)4,
|
(UINTN)4,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
@@ -296,11 +625,298 @@ TestVerifyOaepEncrypt (
|
|||||||
return UNIT_TEST_PASSED;
|
return UNIT_TEST_PASSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNIT_TEST_STATUS
|
||||||
|
EFIAPI
|
||||||
|
TestVerifyRsaOaepEncryptInterface (
|
||||||
|
IN UNIT_TEST_CONTEXT Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VOID *RsaContext = NULL;
|
||||||
|
BOOLEAN Status;
|
||||||
|
UINT8 *OutBuffer;
|
||||||
|
UINTN OutBufferSize;
|
||||||
|
|
||||||
|
RsaContext = RsaNew ();
|
||||||
|
UT_ASSERT_FALSE (RsaContext == NULL);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyN, RsaN, sizeof (RsaN));
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaSetKey (RsaContext, RsaKeyE, RsaE, sizeof (RsaE));
|
||||||
|
UT_ASSERT_TRUE (Status);
|
||||||
|
|
||||||
|
Status = RsaOaepEncrypt (
|
||||||
|
NULL,
|
||||||
|
(UINT8 *)Msg1230,
|
||||||
|
(UINTN)4,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
&OutBuffer,
|
||||||
|
(UINTN *)&OutBufferSize
|
||||||
|
);
|
||||||
|
UT_ASSERT_FALSE (Status);
|
||||||
|
|
||||||
|
Status = RsaOaepEncrypt (
|
||||||
|
RsaContext,
|
||||||
|
(UINT8 *)Msg1230,
|
||||||
|
(UINTN)4,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
(UINT8 **)NULL,
|
||||||
|
(UINTN *)&OutBufferSize
|
||||||
|
);
|
||||||
|
UT_ASSERT_FALSE (Status);
|
||||||
|
|
||||||
|
Status = RsaOaepEncrypt (
|
||||||
|
RsaContext,
|
||||||
|
(UINT8 *)Msg1230,
|
||||||
|
(UINTN)4,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
&OutBuffer,
|
||||||
|
(UINTN *)NULL
|
||||||
|
);
|
||||||
|
UT_ASSERT_FALSE (Status);
|
||||||
|
|
||||||
|
return UNIT_TEST_PASSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyPkcs1v2Msg1230 = {
|
||||||
|
.SelfTestCert = SelfTestCert,
|
||||||
|
.SelfTestCertSize = sizeof (SelfTestCert),
|
||||||
|
.PrivateKey = PrivateKey,
|
||||||
|
.PrivateKeySize = sizeof (PrivateKey),
|
||||||
|
.RsaN = NULL,
|
||||||
|
.RsaNSize = 0,
|
||||||
|
.RsaE = NULL,
|
||||||
|
.RsaESize = 0,
|
||||||
|
.RsaD = NULL,
|
||||||
|
.RsaDSize = 0,
|
||||||
|
.PrngSeed = NULL,
|
||||||
|
.PrngSeedSize = 0,
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallPkcs1v2Encrypt,
|
||||||
|
.Decrypt = CallPkcs1v2Decrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyPkcs1v2Msg1230PrngSeed = {
|
||||||
|
.SelfTestCert = SelfTestCert,
|
||||||
|
.SelfTestCertSize = sizeof (SelfTestCert),
|
||||||
|
.PrivateKey = PrivateKey,
|
||||||
|
.PrivateKeySize = sizeof (PrivateKey),
|
||||||
|
.RsaN = NULL,
|
||||||
|
.RsaNSize = 0,
|
||||||
|
.RsaE = NULL,
|
||||||
|
.RsaESize = 0,
|
||||||
|
.RsaD = NULL,
|
||||||
|
.RsaDSize = 0,
|
||||||
|
.PrngSeed = RandSeed,
|
||||||
|
.PrngSeedSize = sizeof (RandSeed),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallPkcs1v2Encrypt,
|
||||||
|
.Decrypt = CallPkcs1v2Decrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaOaepMsg1230 = {
|
||||||
|
.SelfTestCert = NULL,
|
||||||
|
.SelfTestCertSize = 0,
|
||||||
|
.PrivateKey = NULL,
|
||||||
|
.PrivateKeySize = 0,
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.PrngSeed = NULL,
|
||||||
|
.PrngSeedSize = 0,
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallRsaOaepEncrypt,
|
||||||
|
.Decrypt = CallRsaOaepDecrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaOaepMsg1230PrngSeed = {
|
||||||
|
.SelfTestCert = NULL,
|
||||||
|
.SelfTestCertSize = 0,
|
||||||
|
.PrivateKey = NULL,
|
||||||
|
.PrivateKeySize = 0,
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.PrngSeed = RandSeed,
|
||||||
|
.PrngSeedSize = sizeof (RandSeed),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallRsaOaepEncrypt,
|
||||||
|
.Decrypt = CallRsaOaepDecrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyPkcs1v2EncryptRsaOaepDecrypt = {
|
||||||
|
.SelfTestCert = SelfTestCert,
|
||||||
|
.SelfTestCertSize = sizeof (SelfTestCert),
|
||||||
|
.PrivateKey = PrivateKey,
|
||||||
|
.PrivateKeySize = sizeof (PrivateKey),
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallPkcs1v2Encrypt,
|
||||||
|
.Decrypt = CallRsaOaepDecrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaOaepEncryptPkcs1v2Decrypt = {
|
||||||
|
.SelfTestCert = SelfTestCert,
|
||||||
|
.SelfTestCertSize = sizeof (SelfTestCert),
|
||||||
|
.PrivateKey = PrivateKey,
|
||||||
|
.PrivateKeySize = sizeof (PrivateKey),
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallRsaOaepEncrypt,
|
||||||
|
.Decrypt = CallPkcs1v2Decrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaesOaep2048MdDefaultBgf1Default = {
|
||||||
|
.SelfTestCert = NULL,
|
||||||
|
.SelfTestCertSize = 0,
|
||||||
|
.PrivateKey = NULL,
|
||||||
|
.PrivateKeySize = 0,
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = 0,
|
||||||
|
.Encrypt = CallRsaOaepEncrypt,
|
||||||
|
.Decrypt = CallRsaOaepDecrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 = {
|
||||||
|
.SelfTestCert = NULL,
|
||||||
|
.SelfTestCertSize = 0,
|
||||||
|
.PrivateKey = NULL,
|
||||||
|
.PrivateKeySize = 0,
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaepMdSha1Mgf1Sha1,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaepMdSha1Mgf1Sha1),
|
||||||
|
.DigestLen = SHA1_DIGEST_SIZE,
|
||||||
|
.Encrypt = CallRsaOaepEncrypt,
|
||||||
|
.Decrypt = CallRsaOaepDecrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
|
OAEP_ENC_DEC_TEST_CONTEXT mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 = {
|
||||||
|
.SelfTestCert = NULL,
|
||||||
|
.SelfTestCertSize = 0,
|
||||||
|
.PrivateKey = NULL,
|
||||||
|
.PrivateKeySize = 0,
|
||||||
|
.RsaN = RsaN,
|
||||||
|
.RsaNSize = sizeof (RsaN),
|
||||||
|
.RsaE = RsaE,
|
||||||
|
.RsaESize = sizeof (RsaE),
|
||||||
|
.RsaD = RsaD,
|
||||||
|
.RsaDSize = sizeof (RsaD),
|
||||||
|
.ClearText = Msg1230,
|
||||||
|
.ClearTextSize = sizeof (Msg1230),
|
||||||
|
.CipherText = Ct1230RsaesOaep2048MdSha256Mgf1Sha256,
|
||||||
|
.CipherTextSize = sizeof (Ct1230RsaesOaep2048MdSha256Mgf1Sha256),
|
||||||
|
.DigestLen = SHA256_DIGEST_SIZE,
|
||||||
|
.Encrypt = CallRsaOaepEncrypt,
|
||||||
|
.Decrypt = CallRsaOaepDecrypt,
|
||||||
|
.Expect = UNIT_TEST_PASSED
|
||||||
|
};
|
||||||
|
|
||||||
TEST_DESC mOaepTest[] = {
|
TEST_DESC mOaepTest[] = {
|
||||||
//
|
//
|
||||||
// -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
|
// -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
|
||||||
//
|
//
|
||||||
{ "TestVerifyOaepEncrypt()", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt", TestVerifyOaepEncrypt, NULL, NULL, NULL },
|
// Pkcs1v2Encrypt / Decrypt
|
||||||
|
{ "Pkcs1v2Encrypt (Interface)", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt.Interface", TestVerifyPkcs1v2EncryptInterface, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
|
||||||
|
{ "Pkcs1v2Encrypt (NoSeed)", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt.NoSeed", TestVerifyEncrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
|
||||||
|
{ "Pkcs1v2Encrypt (Seeded)", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt.Seeded", TestVerifyEncrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230PrngSeed },
|
||||||
|
{ "Pkcs1v2Decrypt", "CryptoPkg.BaseCryptLib.Pkcs1v2Decrypt", TestVerifyDecrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
|
||||||
|
{ "Pkcs1v2EncryptDecrypt", "CryptoPkg.BaseCryptLib.Pkcs1v2EncryptDecrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyPkcs1v2Msg1230 },
|
||||||
|
|
||||||
|
// RsaOaepEncrypt / Decrypt
|
||||||
|
{ "RsaOaepEncrypt (Interface)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.Interface", TestVerifyRsaOaepEncryptInterface, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
|
||||||
|
{ "RsaOaepEncrypt (NoSeed)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.NoSeed", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
|
||||||
|
{ "RsaOaepEncrypt (Seeded)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.Seeded", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230PrngSeed },
|
||||||
|
{ "RsaOaepDecrypt", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
|
||||||
|
{ "RsaOaepEncryptDecrypt", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaOaepMsg1230 },
|
||||||
|
|
||||||
|
// Mix interfaces
|
||||||
|
{ "RsaOaepEncryptPkcs1v2Decrypt", "CryptoPkg.BaseCryptLib.RsaOaepEncryptPkcs1v2Decrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaOaepEncryptPkcs1v2Decrypt },
|
||||||
|
{ "Pkcs1v2EncryptRsaOaepDecrypt", "CryptoPkg.BaseCryptLib.Pkcs1v2EncryptRsaOaepDecrypt", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyPkcs1v2EncryptRsaOaepDecrypt },
|
||||||
|
|
||||||
|
// Message digest default / MGF1 default (SHA1)
|
||||||
|
{ "RsaOaepEncrypt (MdDefaultMgf1Default)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.MdDefaultMgf1Default", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdDefaultBgf1Default },
|
||||||
|
{ "RsaOaepDecrypt (MdDefaultMgf1Default)", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt.MdDefaultMgf1Default", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdDefaultBgf1Default },
|
||||||
|
{ "RsaOaepEncryptDecrypt (MdDefaultMgf1Default)", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecrypt.MdDefaultMgf1Default", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdDefaultBgf1Default },
|
||||||
|
|
||||||
|
// Message digest SHA1 / MGF1 SHA1
|
||||||
|
{ "RsaOaepEncrypt (MdSha1Bgf1Sha1", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.MdSha1Bgf1Sha1", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 },
|
||||||
|
{ "RsaOaepDecrypt (MdSha1Bgf1Sha1)", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt.MdSha1Bgf1Sha1", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 },
|
||||||
|
{ "RsaOaepEncryptDecrypt (MdSha1Bgf1Sha1)", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecrypt.MdSha1Bgf1Sha1", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha1Mgf1Sha1 },
|
||||||
|
|
||||||
|
// Message digest SHA256 / MGF1 SHA256
|
||||||
|
{ "RsaOaepEncrypt (MdSha256Bgf1Sha256)", "CryptoPkg.BaseCryptLib.RsaOaepEncrypt.MdSha256Bgf1Sha256", TestVerifyEncrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 },
|
||||||
|
{ "RsaOaepDecrypt (MdSha256Bgf1Sha256)", "CryptoPkg.BaseCryptLib.RsaOaepDecrypt.MdSha256Bgf1Sha256", TestVerifyDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 },
|
||||||
|
{ "RsaOaepEncryptDecrypt (MdSha256Bgf1Sha256)", "CryptoPkg.BaseCryptLib.RsaOaepEncryptDecryptMdSha256Bgf1Sha256", TestVerifyEncryptDecrypt, NULL, NULL, &mTestVerifyRsaesOaep2048MdSha256Mgf1Sha256 },
|
||||||
};
|
};
|
||||||
|
|
||||||
UINTN mOaepTestNum = ARRAY_SIZE (mOaepTest);
|
UINTN mOaepTestNum = ARRAY_SIZE (mOaepTest);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.<BR>
|
Copyright (c) 2017 - 2024, Arm Limited. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@@ -317,7 +317,10 @@ typedef struct CmArmSerialPortInfo {
|
|||||||
/// The physical base address for the serial port
|
/// The physical base address for the serial port
|
||||||
UINT64 BaseAddress;
|
UINT64 BaseAddress;
|
||||||
|
|
||||||
/// The serial port interrupt
|
/** The serial port interrupt.
|
||||||
|
0 indicates that the serial port does not
|
||||||
|
have an interrupt wired.
|
||||||
|
*/
|
||||||
UINT32 Interrupt;
|
UINT32 Interrupt;
|
||||||
|
|
||||||
/// The serial port baud rate
|
/// The serial port baud rate
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
AML Lib.
|
AML Lib.
|
||||||
|
|
||||||
Copyright (c) 2019 - 2023, Arm Limited. All rights reserved.<BR>
|
Copyright (c) 2019 - 2023, Arm Limited. All rights reserved.<BR>
|
||||||
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
@@ -1743,6 +1743,45 @@ AmlAddNameStringToNamedPackage (
|
|||||||
IN AML_OBJECT_NODE_HANDLE NamedNode
|
IN AML_OBJECT_NODE_HANDLE NamedNode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** Add an integer value to the named package node.
|
||||||
|
|
||||||
|
AmlCodeGenNamePackage ("_CID", NULL, &PackageNode);
|
||||||
|
AmlGetEisaIdFromString ("PNP0A03", &EisaId);
|
||||||
|
AmlAddIntegerToNamedPackage (EisaId, NameNode);
|
||||||
|
AmlGetEisaIdFromString ("PNP0A08", &EisaId);
|
||||||
|
AmlAddIntegerToNamedPackage (EisaId, NameNode);
|
||||||
|
|
||||||
|
equivalent of the following ASL code:
|
||||||
|
Name (_CID, Package (0x02) // _CID: Compatible ID
|
||||||
|
{
|
||||||
|
EisaId ("PNP0A03"),
|
||||||
|
EisaId ("PNP0A08")
|
||||||
|
})
|
||||||
|
|
||||||
|
The package is added at the tail of the list of the input package node
|
||||||
|
name:
|
||||||
|
Name ("NamePackageNode", Package () {
|
||||||
|
[Pre-existing package entries],
|
||||||
|
[Newly created integer entry]
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ingroup CodeGenApis
|
||||||
|
|
||||||
|
@param [in] Integer Integer value that need to be added to package node.
|
||||||
|
@param [in, out] NameNode Package named node to add the object to.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success.
|
||||||
|
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||||
|
@retval Others Error occurred during the operation.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
AmlAddIntegerToNamedPackage (
|
||||||
|
IN UINT32 Integer,
|
||||||
|
IN OUT AML_OBJECT_NODE_HANDLE NameNode
|
||||||
|
);
|
||||||
|
|
||||||
/** AML code generation to invoke/call another method.
|
/** AML code generation to invoke/call another method.
|
||||||
|
|
||||||
This method is a subset implementation of MethodInvocation
|
This method is a subset implementation of MethodInvocation
|
||||||
|
@@ -1072,6 +1072,7 @@ CreateAmlProcessorContainer (
|
|||||||
@param [in] IsLeaf The ProcNode is a leaf.
|
@param [in] IsLeaf The ProcNode is a leaf.
|
||||||
@param [in] NodeToken NodeToken of the ProcNode.
|
@param [in] NodeToken NodeToken of the ProcNode.
|
||||||
@param [in] ParentNodeToken Parent NodeToken of the ProcNode.
|
@param [in] ParentNodeToken Parent NodeToken of the ProcNode.
|
||||||
|
@param [in] PackageNodeSeen A parent of the ProcNode has the physical package flag set.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
@retval EFI_SUCCESS Success.
|
||||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||||
@@ -1083,23 +1084,24 @@ CheckProcNode (
|
|||||||
UINT32 NodeFlags,
|
UINT32 NodeFlags,
|
||||||
BOOLEAN IsLeaf,
|
BOOLEAN IsLeaf,
|
||||||
CM_OBJECT_TOKEN NodeToken,
|
CM_OBJECT_TOKEN NodeToken,
|
||||||
CM_OBJECT_TOKEN ParentNodeToken
|
CM_OBJECT_TOKEN ParentNodeToken,
|
||||||
|
BOOLEAN PackageNodeSeen
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN InvalidFlags;
|
BOOLEAN InvalidFlags;
|
||||||
BOOLEAN HasPhysicalPackageBit;
|
BOOLEAN HasPhysicalPackageBit;
|
||||||
BOOLEAN IsTopLevelNode;
|
|
||||||
|
|
||||||
HasPhysicalPackageBit = (NodeFlags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
|
HasPhysicalPackageBit = (NodeFlags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
|
||||||
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
|
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
|
||||||
IsTopLevelNode = (ParentNodeToken == CM_NULL_TOKEN);
|
|
||||||
|
|
||||||
// A top-level node is a Physical Package and conversely.
|
// Only one Physical Package flag is allowed in the hierarchy
|
||||||
InvalidFlags = HasPhysicalPackageBit ^ IsTopLevelNode;
|
InvalidFlags = HasPhysicalPackageBit && PackageNodeSeen;
|
||||||
|
|
||||||
// Check Leaf specific flags.
|
// Check Leaf specific flags.
|
||||||
if (IsLeaf) {
|
if (IsLeaf) {
|
||||||
InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != PPTT_LEAF_MASK);
|
InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != PPTT_LEAF_MASK);
|
||||||
|
// Must have Physical Package flag somewhere in the hierarchy
|
||||||
|
InvalidFlags |= !(HasPhysicalPackageBit || PackageNodeSeen);
|
||||||
} else {
|
} else {
|
||||||
InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != 0);
|
InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != 0);
|
||||||
}
|
}
|
||||||
@@ -1130,6 +1132,7 @@ CheckProcNode (
|
|||||||
node to.
|
node to.
|
||||||
@param [in,out] ProcContainerIndex Pointer to the current processor container
|
@param [in,out] ProcContainerIndex Pointer to the current processor container
|
||||||
index to be used as UID.
|
index to be used as UID.
|
||||||
|
@param [in] PackageNodeSeen A parent of the ProcNode has the physical package flag set.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success.
|
@retval EFI_SUCCESS Success.
|
||||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||||
@@ -1143,7 +1146,8 @@ CreateAmlCpuTopologyTree (
|
|||||||
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
|
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
|
||||||
IN CM_OBJECT_TOKEN NodeToken,
|
IN CM_OBJECT_TOKEN NodeToken,
|
||||||
IN AML_NODE_HANDLE ParentNode,
|
IN AML_NODE_HANDLE ParentNode,
|
||||||
IN OUT UINT32 *ProcContainerIndex
|
IN OUT UINT32 *ProcContainerIndex,
|
||||||
|
IN BOOLEAN PackageNodeSeen
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@@ -1153,6 +1157,7 @@ CreateAmlCpuTopologyTree (
|
|||||||
AML_OBJECT_NODE_HANDLE ProcContainerNode;
|
AML_OBJECT_NODE_HANDLE ProcContainerNode;
|
||||||
UINT32 Uid;
|
UINT32 Uid;
|
||||||
UINT16 Name;
|
UINT16 Name;
|
||||||
|
BOOLEAN HasPhysicalPackageBit;
|
||||||
|
|
||||||
ASSERT (Generator != NULL);
|
ASSERT (Generator != NULL);
|
||||||
ASSERT (Generator->ProcNodeList != NULL);
|
ASSERT (Generator->ProcNodeList != NULL);
|
||||||
@@ -1175,7 +1180,8 @@ CreateAmlCpuTopologyTree (
|
|||||||
Generator->ProcNodeList[Index].Flags,
|
Generator->ProcNodeList[Index].Flags,
|
||||||
TRUE,
|
TRUE,
|
||||||
Generator->ProcNodeList[Index].Token,
|
Generator->ProcNodeList[Index].Token,
|
||||||
NodeToken
|
NodeToken,
|
||||||
|
PackageNodeSeen
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
@@ -1208,7 +1214,8 @@ CreateAmlCpuTopologyTree (
|
|||||||
Generator->ProcNodeList[Index].Flags,
|
Generator->ProcNodeList[Index].Flags,
|
||||||
FALSE,
|
FALSE,
|
||||||
Generator->ProcNodeList[Index].Token,
|
Generator->ProcNodeList[Index].Token,
|
||||||
NodeToken
|
NodeToken,
|
||||||
|
PackageNodeSeen
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
@@ -1249,13 +1256,17 @@ CreateAmlCpuTopologyTree (
|
|||||||
ProcContainerName++;
|
ProcContainerName++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HasPhysicalPackageBit = (Generator->ProcNodeList[Index].Flags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
|
||||||
|
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
|
||||||
|
|
||||||
// Recursively continue creating an AML tree.
|
// Recursively continue creating an AML tree.
|
||||||
Status = CreateAmlCpuTopologyTree (
|
Status = CreateAmlCpuTopologyTree (
|
||||||
Generator,
|
Generator,
|
||||||
CfgMgrProtocol,
|
CfgMgrProtocol,
|
||||||
Generator->ProcNodeList[Index].Token,
|
Generator->ProcNodeList[Index].Token,
|
||||||
ProcContainerNode,
|
ProcContainerNode,
|
||||||
ProcContainerIndex
|
ProcContainerIndex,
|
||||||
|
(PackageNodeSeen || HasPhysicalPackageBit)
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
@@ -1311,7 +1322,8 @@ CreateTopologyFromProcHierarchy (
|
|||||||
CfgMgrProtocol,
|
CfgMgrProtocol,
|
||||||
CM_NULL_TOKEN,
|
CM_NULL_TOKEN,
|
||||||
ScopeNode,
|
ScopeNode,
|
||||||
&ProcContainerIndex
|
&ProcContainerIndex,
|
||||||
|
FALSE
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ASSERT (0);
|
ASSERT (0);
|
||||||
|
@@ -3871,6 +3871,73 @@ exit_handler:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Add an integer value to the named package node.
|
||||||
|
|
||||||
|
AmlCodeGenNamePackage ("_CID", NULL, &PackageNode);
|
||||||
|
AmlGetEisaIdFromString ("PNP0A03", &EisaId);
|
||||||
|
AmlAddIntegerToNamedPackage (EisaId, NameNode);
|
||||||
|
AmlGetEisaIdFromString ("PNP0A08", &EisaId);
|
||||||
|
AmlAddIntegerToNamedPackage (EisaId, NameNode);
|
||||||
|
|
||||||
|
equivalent of the following ASL code:
|
||||||
|
Name (_CID, Package (0x02) // _CID: Compatible ID
|
||||||
|
{
|
||||||
|
EisaId ("PNP0A03"),
|
||||||
|
EisaId ("PNP0A08")
|
||||||
|
})
|
||||||
|
|
||||||
|
The package is added at the tail of the list of the input package node
|
||||||
|
name:
|
||||||
|
Name ("NamePackageNode", Package () {
|
||||||
|
[Pre-existing package entries],
|
||||||
|
[Newly created integer entry]
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ingroup CodeGenApis
|
||||||
|
|
||||||
|
@param [in] Integer Integer value that need to be added to package node.
|
||||||
|
@param [in, out] NameNode Package named node to add the object to.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success.
|
||||||
|
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||||
|
@retval Others Error occurred during the operation.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
AmlAddIntegerToNamedPackage (
|
||||||
|
IN UINT32 Integer,
|
||||||
|
IN OUT AML_OBJECT_NODE_HANDLE NameNode
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
AML_OBJECT_NODE *PackageNode;
|
||||||
|
|
||||||
|
if (NameNode == NULL) {
|
||||||
|
ASSERT_EFI_ERROR (FALSE);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||||
|
NameNode,
|
||||||
|
EAmlParseIndexTerm1
|
||||||
|
);
|
||||||
|
if ((PackageNode == NULL) ||
|
||||||
|
(AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) ||
|
||||||
|
(!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))
|
||||||
|
{
|
||||||
|
ASSERT_EFI_ERROR (FALSE);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = AmlAddRegisterOrIntegerToPackage (NULL, Integer, PackageNode);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/** AML code generation to invoke/call another method.
|
/** AML code generation to invoke/call another method.
|
||||||
|
|
||||||
This method is a subset implementation of MethodInvocation
|
This method is a subset implementation of MethodInvocation
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
SSDT Serial Port Fixup Library.
|
SSDT Serial Port Fixup Library.
|
||||||
|
|
||||||
Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
|
Copyright (c) 2019 - 2024, Arm Limited. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
- Arm Server Base Boot Requirements (SBBR), s4.2.1.8 "SPCR".
|
- Arm Server Base Boot Requirements (SBBR), s4.2.1.8 "SPCR".
|
||||||
- Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.
|
- Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.
|
||||||
- ACPI for Arm Components 1.0 - 2020
|
- ACPI for Arm Components 1.0 - 2020
|
||||||
|
- Arm Generic Interrupt Controller Architecture Specification,
|
||||||
|
Issue H, January 2022.
|
||||||
|
(https://developer.arm.com/documentation/ihi0069/)
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <IndustryStandard/DebugPort2Table.h>
|
#include <IndustryStandard/DebugPort2Table.h>
|
||||||
@@ -27,6 +30,10 @@
|
|||||||
#include <Library/AmlLib/AmlLib.h>
|
#include <Library/AmlLib/AmlLib.h>
|
||||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||||
|
|
||||||
|
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||||
|
#include <Library/ArmGicArchLib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/** C array containing the compiled AML template.
|
/** C array containing the compiled AML template.
|
||||||
This symbol is defined in the auto generated C file
|
This symbol is defined in the auto generated C file
|
||||||
containing the AML bytecode array.
|
containing the AML bytecode array.
|
||||||
@@ -100,6 +107,26 @@ ValidateSerialPortInfo (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||||
|
// If an interrupt is not wired to the serial port, the Configuration
|
||||||
|
// Manager specifies the interrupt as 0.
|
||||||
|
// Any other value must be within the SPI or extended SPI range.
|
||||||
|
if ((SerialPortInfo->Interrupt != 0) &&
|
||||||
|
!(((SerialPortInfo->Interrupt >= ARM_GIC_ARCH_SPI_MIN) &&
|
||||||
|
(SerialPortInfo->Interrupt <= ARM_GIC_ARCH_SPI_MAX)) ||
|
||||||
|
((SerialPortInfo->Interrupt >= ARM_GIC_ARCH_EXT_SPI_MIN) &&
|
||||||
|
(SerialPortInfo->Interrupt <= ARM_GIC_ARCH_EXT_SPI_MAX))))
|
||||||
|
{
|
||||||
|
DEBUG ((
|
||||||
|
DEBUG_ERROR,
|
||||||
|
"ERROR: Invalid UART port interrupt ID. Interrupt = %lu\n",
|
||||||
|
SerialPortInfo->Interrupt
|
||||||
|
));
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "UART Configuration:\n"));
|
DEBUG ((DEBUG_INFO, "UART Configuration:\n"));
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
@@ -270,7 +297,6 @@ FixupCrs (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
AML_OBJECT_NODE_HANDLE NameOpCrsNode;
|
AML_OBJECT_NODE_HANDLE NameOpCrsNode;
|
||||||
AML_DATA_NODE_HANDLE QWordRdNode;
|
AML_DATA_NODE_HANDLE QWordRdNode;
|
||||||
AML_DATA_NODE_HANDLE InterruptRdNode;
|
|
||||||
|
|
||||||
// Get the "_CRS" object defined by the "Name ()" statement.
|
// Get the "_CRS" object defined by the "Name ()" statement.
|
||||||
Status = AmlFindNode (
|
Status = AmlFindNode (
|
||||||
@@ -303,20 +329,22 @@ FixupCrs (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Interrupt node.
|
// Generate an interrupt node as the second Resource Data element in the
|
||||||
// It is the second Resource Data element in the NameOpCrsNode's
|
// NameOpCrsNode, if the interrupt for the serial-port is a valid SPI from
|
||||||
// variable list of arguments.
|
// Table 2-1 in Arm Generic Interrupt Controller Architecture Specification.
|
||||||
Status = AmlNameOpGetNextRdNode (QWordRdNode, &InterruptRdNode);
|
Status = AmlCodeGenRdInterrupt (
|
||||||
if (EFI_ERROR (Status)) {
|
TRUE, // Resource Consumer
|
||||||
return Status;
|
FALSE, // Level Triggered
|
||||||
}
|
FALSE, // Active High
|
||||||
|
FALSE, // Exclusive
|
||||||
|
(UINT32 *)&SerialPortInfo->Interrupt,
|
||||||
|
1,
|
||||||
|
NameOpCrsNode,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
if (InterruptRdNode == NULL) {
|
return Status;
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the interrupt number.
|
|
||||||
return AmlUpdateRdInterrupt (InterruptRdNode, SerialPortInfo->Interrupt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Fixup the Serial Port device name.
|
/** Fixup the Serial Port device name.
|
||||||
|
@@ -18,12 +18,15 @@
|
|||||||
SsdtSerialPortFixupLib.c
|
SsdtSerialPortFixupLib.c
|
||||||
SsdtSerialPortTemplate.asl
|
SsdtSerialPortTemplate.asl
|
||||||
|
|
||||||
[Packages]
|
[Packages.common]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
EmbeddedPkg/EmbeddedPkg.dec
|
EmbeddedPkg/EmbeddedPkg.dec
|
||||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||||
|
|
||||||
|
[Packages.ARM, Packages.AARCH64]
|
||||||
|
ArmPkg/ArmPkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
AcpiHelperLib
|
AcpiHelperLib
|
||||||
AmlLib
|
AmlLib
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
SSDT Serial Template
|
SSDT Serial Template
|
||||||
|
|
||||||
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
|
Copyright (c) 2019 - 2024, Arm Limited. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
@par Glossary:
|
@par Glossary:
|
||||||
- {template} - Data fixed up using AML Fixup APIs.
|
- {template} - Data fixed up using AML Fixup APIs.
|
||||||
|
- {codegen} - Data generated using AML Codegen APIs.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", 2, "ARMLTD", "SERIAL", 1) {
|
DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", 2, "ARMLTD", "SERIAL", 1) {
|
||||||
@@ -43,17 +44,21 @@ DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", 2, "ARMLTD", "SERIAL", 1)
|
|||||||
, // MemoryRangeType
|
, // MemoryRangeType
|
||||||
// TranslationType
|
// TranslationType
|
||||||
) // QWordMemory
|
) // QWordMemory
|
||||||
Interrupt (
|
|
||||||
ResourceConsumer, // ResourceUsage
|
// The Interrupt information is generated using AmlCodegen.
|
||||||
Level, // EdgeLevel
|
//
|
||||||
ActiveHigh, // ActiveLevel
|
// Interrupt ( // {codegen}
|
||||||
Exclusive, // Shared
|
// ResourceConsumer, // ResourceUsage
|
||||||
, // ResourceSourceIndex
|
// Level, // EdgeLevel
|
||||||
, // ResourceSource
|
// ActiveHigh, // ActiveLevel
|
||||||
// DescriptorName
|
// Exclusive, // Shared
|
||||||
) {
|
// , // ResourceSourceIndex
|
||||||
0xA5 // {template}
|
// , // ResourceSource
|
||||||
} // Interrupt
|
// // DescriptorName
|
||||||
|
// ) {
|
||||||
|
// <IRQ> // <spi>
|
||||||
|
// } // Interrupt
|
||||||
|
|
||||||
}) // Name
|
}) // Name
|
||||||
} // Device
|
} // Device
|
||||||
} // Scope (_SB)
|
} // Scope (_SB)
|
||||||
|
@@ -70,7 +70,7 @@ NonCoherentIoMmuSetAttribute (
|
|||||||
IN UINT64 IoMmuAccess
|
IN UINT64 IoMmuAccess
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -694,11 +694,12 @@ KeyboardReadKeyStrokeWorker (
|
|||||||
/**
|
/**
|
||||||
Read out the scan code of the key that has just been stroked.
|
Read out the scan code of the key that has just been stroked.
|
||||||
|
|
||||||
@param This Pointer of simple text Protocol.
|
@param This Pointer of simple text Protocol.
|
||||||
@param Key Pointer for store the key that read out.
|
@param Key Pointer for store the key that read out.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The key is read out successfully.
|
@retval EFI_SUCCESS The key is read out successfully.
|
||||||
@retval other The key reading failed.
|
@retval other The key reading failed.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@@ -752,6 +753,7 @@ VirtualKeyboardReadKeyStroke (
|
|||||||
@retval EFI_DEVICE_ERROR The keystroke information was not returned
|
@retval EFI_DEVICE_ERROR The keystroke information was not returned
|
||||||
due to hardware errors.
|
due to hardware errors.
|
||||||
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@@ -496,11 +496,12 @@ KeyNotifyProcessHandler (
|
|||||||
/**
|
/**
|
||||||
Read out the scan code of the key that has just been stroked.
|
Read out the scan code of the key that has just been stroked.
|
||||||
|
|
||||||
@param This Pointer of simple text Protocol.
|
@param This Pointer of simple text Protocol.
|
||||||
@param Key Pointer for store the key that read out.
|
@param Key Pointer for store the key that read out.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The key is read out successfully.
|
@retval EFI_SUCCESS The key is read out successfully.
|
||||||
@retval other The key reading failed.
|
@retval other The key reading failed.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@@ -523,6 +524,7 @@ VirtualKeyboardReadKeyStroke (
|
|||||||
@retval EFI_DEVICE_ERROR The keystroke information was not returned due to
|
@retval EFI_DEVICE_ERROR The keystroke information was not returned due to
|
||||||
hardware errors.
|
hardware errors.
|
||||||
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@@ -1,79 +1,22 @@
|
|||||||
;
|
;
|
||||||
|
; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
|
||||||
; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
|
; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
;
|
;
|
||||||
|
|
||||||
LOCAL &maxmem &systbl &memsize
|
PARAMETERS &systbl
|
||||||
|
|
||||||
&memsize=0x20000000 ; default to 512MB
|
gosub FindDebugInfo &systbl
|
||||||
|
|
||||||
gosub FindSystemTable &memsize
|
|
||||||
ENTRY &systbl
|
|
||||||
|
|
||||||
if &systbl!=0
|
|
||||||
(
|
|
||||||
print "found system table at &systbl"
|
|
||||||
gosub FindDebugInfo &systbl
|
|
||||||
)
|
|
||||||
else
|
|
||||||
(
|
|
||||||
print "ERROR: system table not found, check memory size"
|
|
||||||
)
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
FindSystemTable:
|
|
||||||
LOCAL &TopOfRam &offset
|
|
||||||
ENTRY &TopOfRam
|
|
||||||
|
|
||||||
print "FindSystemTable"
|
|
||||||
print "top of mem is &TopOfRam$"
|
|
||||||
|
|
||||||
&offset=&TopOfRam
|
|
||||||
|
|
||||||
; align to highest 4MB boundary
|
|
||||||
&offset=&offset&0xFFC00000
|
|
||||||
|
|
||||||
; start at top and look on 4MB boundaries for system table ptr structure
|
|
||||||
while &offset>0
|
|
||||||
(
|
|
||||||
; low signature match
|
|
||||||
if Data.Long(a:&offset)==0x20494249
|
|
||||||
(
|
|
||||||
; high signature match
|
|
||||||
if Data.Long(a:&offset+4)==0x54535953
|
|
||||||
(
|
|
||||||
; less than 4GB?
|
|
||||||
if Data.Long(a:&offset+0x0c)==0
|
|
||||||
(
|
|
||||||
; less than top of ram?
|
|
||||||
if Data.Long(a:&offset+8)<&TopOfRam
|
|
||||||
(
|
|
||||||
return Data.Long(a:&offset+8)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if &offset<0x400000
|
|
||||||
(
|
|
||||||
return 0
|
|
||||||
)
|
|
||||||
&offset=&offset-0x400000
|
|
||||||
)
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
FindDebugInfo:
|
FindDebugInfo:
|
||||||
LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
|
LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
|
||||||
ENTRY &SystemTable
|
ENTRY &SystemTable
|
||||||
|
|
||||||
print "FindDebugInfo"
|
|
||||||
|
|
||||||
&dbgentries=0
|
&dbgentries=0
|
||||||
&CfgTableEntries=Data.Long(a:&SystemTable+0x40)
|
&CfgTableEntries=Data.Long(a:&SystemTable+0x68)
|
||||||
&ConfigTable=Data.Long(a:&SystemTable+0x44)
|
&ConfigTable=Data.Long(a:&SystemTable+0x70)
|
||||||
|
|
||||||
print "config table is at &ConfigTable (&CfgTableEntries entries)"
|
print "config table is at &ConfigTable (&CfgTableEntries entries)"
|
||||||
|
|
||||||
@@ -82,7 +25,7 @@ FindDebugInfo:
|
|||||||
&i=0
|
&i=0
|
||||||
while &i<&CfgTableEntries
|
while &i<&CfgTableEntries
|
||||||
(
|
(
|
||||||
&offset=&ConfigTable+(&i*0x14)
|
&offset=&ConfigTable+(&i*0x18)
|
||||||
if Data.Long(a:&offset)==0x49152E77
|
if Data.Long(a:&offset)==0x49152E77
|
||||||
(
|
(
|
||||||
if Data.Long(a:&offset+4)==0x47641ADA
|
if Data.Long(a:&offset+4)==0x47641ADA
|
||||||
@@ -120,8 +63,10 @@ FindDebugInfo:
|
|||||||
(
|
(
|
||||||
if Data.Long(a:&dbginfo)==1 ; normal debug info type
|
if Data.Long(a:&dbginfo)==1 ; normal debug info type
|
||||||
(
|
(
|
||||||
&loadedimg=Data.Long(a:&dbginfo+4)
|
&loadedimg=Data.Long(a:&dbginfo+8)
|
||||||
do EfiProcessPeImage Data.Long(a:&loadedimg+0x20)
|
&imagebaseptr=&loadedimg+0x40
|
||||||
|
&imagebase=Data.Long(a:&imagebaseptr)
|
||||||
|
do ~~~~/EfiProcessPeImage.cmm "&imagebase"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
&i=&i+1
|
&i=&i+1
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
;
|
;
|
||||||
|
; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
|
||||||
; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
|
; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
|
||||||
;
|
;
|
||||||
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
@@ -10,11 +11,11 @@
|
|||||||
&imgstart=&imgstart
|
&imgstart=&imgstart
|
||||||
print "PE32 image found at &imgstart"
|
print "PE32 image found at &imgstart"
|
||||||
|
|
||||||
; offset from dos hdr to PE file hdr
|
; offset from dos hdr to PE file hdr (i.e. 'PE\0\0' signature)
|
||||||
&filehdrstart=&imgstart+Data.Long(c:&imgstart+0x3C)
|
&filehdrstart=&imgstart+Data.Long(c:&imgstart+0x3C)
|
||||||
|
|
||||||
; offset to debug dir in PE hdrs
|
; offset to debug dir in PE hdrs
|
||||||
&debugdirentryrva=Data.Long(c:&filehdrstart+0xA8)
|
&debugdirentryrva=Data.Long(c:&imgstart+0xf10)
|
||||||
if &debugdirentryrva==0
|
if &debugdirentryrva==0
|
||||||
(
|
(
|
||||||
print "no debug dir for image at &imgstart"
|
print "no debug dir for image at &imgstart"
|
||||||
@@ -62,7 +63,7 @@
|
|||||||
&elfbase=&baseofdata;
|
&elfbase=&baseofdata;
|
||||||
)
|
)
|
||||||
|
|
||||||
print "found path &elfpath"
|
print "found path &elfpath with address &elfbase"
|
||||||
ON ERROR GOSUB
|
ON ERROR GOSUB
|
||||||
return
|
return
|
||||||
data.load.elf &elfpath &elfbase /NOCODE /NOCLEAR
|
data.load.elf &elfpath &elfbase /NOCODE /NOCLEAR
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
# DXE Phase Debug
|
# DXE Phase Debug
|
||||||
Update the memsize variable in EfiLoadDxe.cmm for the actual amount of memory
|
Allow your system to boot to the point that the DXE
|
||||||
available in your system. Allow your system to boot to the point that the DXE
|
|
||||||
core is initialized (so that the System Table and Debug Information table is
|
core is initialized (so that the System Table and Debug Information table is
|
||||||
present in memory) and execute this script (using the toolbar button or
|
present in memory) and execute this script (using the toolbar button or
|
||||||
'do EfiLoadDxe' from the command area). It will scan memory for the debug info
|
'do EfiLoadDxe "0xGST_ADDRESS"' from the command area). 'GST_ADDRESS' is the
|
||||||
table and load modules in it.
|
address of the EFI_SYSTEM_TABLE, and can be found by the global `gST`.
|
||||||
|
The script will scan memory for the debug info table and load modules in it.
|
||||||
|
|
||||||
# SEC/PEI Phase Debug
|
# SEC/PEI Phase Debug
|
||||||
There is no way to autodetect where these images reside so you must pass an
|
There is no way to autodetect where these images reside so you must pass an
|
||||||
|
@@ -156,6 +156,7 @@ EmuGopSimpleTextInReset (
|
|||||||
@retval EFI_NOT_READY There was no keystroke data available.
|
@retval EFI_NOT_READY There was no keystroke data available.
|
||||||
@retval EFI_DEVICE_ERROR The keystroke information was not returned due to
|
@retval EFI_DEVICE_ERROR The keystroke information was not returned due to
|
||||||
hardware errors.
|
hardware errors.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@@ -339,6 +340,7 @@ EmuGopSimpleTextInExResetEx (
|
|||||||
EFI_DEVICE_ERROR The keystroke
|
EFI_DEVICE_ERROR The keystroke
|
||||||
information was not returned due to
|
information was not returned due to
|
||||||
hardware errors.
|
hardware errors.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@@ -127,11 +127,12 @@
|
|||||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||||
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
||||||
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
|
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
|
||||||
|
|
||||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
|
||||||
RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
||||||
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
||||||
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
|
||||||
|
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
|
||||||
|
|
||||||
|
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||||
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
|
PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
|
||||||
AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
|
AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
|
||||||
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
|
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
|
||||||
@@ -278,6 +279,27 @@
|
|||||||
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishRestExServiceDevicePath.DevicePath|{DEVICE_PATH("MAC(000000000000,0x1)")}
|
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishRestExServiceDevicePath.DevicePath|{DEVICE_PATH("MAC(000000000000,0x1)")}
|
||||||
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishRestExServiceAccessModeInBand|False
|
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishRestExServiceAccessModeInBand|False
|
||||||
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDiscoverAccessModeInBand|False
|
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDiscoverAccessModeInBand|False
|
||||||
|
|
||||||
|
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfSecureBootDisabled|False
|
||||||
|
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfExitbootService|False
|
||||||
|
|
||||||
|
gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported|False
|
||||||
|
|
||||||
|
#
|
||||||
|
# Redfish Debug enablement
|
||||||
|
#
|
||||||
|
# 0x0000000000000001 RedfishPlatformConfigDxe driver debug enabled.
|
||||||
|
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory|0
|
||||||
|
# 0x00000001 x-uefi-redfish string database message enabled
|
||||||
|
# 0x00000002 Debug Message for dumping formset
|
||||||
|
# 0x00000004 Debug Message for x-uefi-redfish searching result
|
||||||
|
# 0x00000008 Debug Message for x-uefi-redfish Regular Expression searching result
|
||||||
|
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigDebugProperty|0
|
||||||
|
|
||||||
|
# Redfish Platform Configure DXE driver feature enablement
|
||||||
|
# 0x00000001 Enable building Redfish Attribute Registry menu path.
|
||||||
|
# 0x00000002 Allow supressed HII option to be exposed on Redfish.
|
||||||
|
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigFeatureProperty|0
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
[PcdsDynamicDefault.common.DEFAULT]
|
[PcdsDynamicDefault.common.DEFAULT]
|
||||||
@@ -377,6 +399,15 @@
|
|||||||
EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
|
EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
|
||||||
EmulatorPkg/TimerDxe/Timer.inf
|
EmulatorPkg/TimerDxe/Timer.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rng Protocol producer
|
||||||
|
#
|
||||||
|
SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
|
||||||
|
#
|
||||||
|
# Hash2 Protocol producer
|
||||||
|
#
|
||||||
|
SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
|
||||||
|
|
||||||
!if $(SECURE_BOOT_ENABLE) == TRUE
|
!if $(SECURE_BOOT_ENABLE) == TRUE
|
||||||
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
|
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
|
||||||
!endif
|
!endif
|
||||||
|
@@ -193,6 +193,16 @@ INF RuleOverride = UI MdeModulePkg/Application/UiApp/UiApp.inf
|
|||||||
INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
|
INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
|
||||||
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
|
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rng Protocol producer
|
||||||
|
#
|
||||||
|
INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Hash2 Protocol producer
|
||||||
|
#
|
||||||
|
INF SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# Secure Boot Key Enroll
|
# Secure Boot Key Enroll
|
||||||
#
|
#
|
||||||
@@ -320,4 +330,3 @@ INF ShellPkg/Application/Shell/Shell.inf
|
|||||||
UI STRING="$(MODULE_NAME)" Optional
|
UI STRING="$(MODULE_NAME)" Optional
|
||||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user