Commit Graph

32685 Commits

Author SHA1 Message Date
Mikhail Krichanov 666a6ab2d3 MdeModulePkg/DebugSupportDxe: Adds callback function prototypes in caller
Adds EFI_EXCEPTION_CALLBACK and EFI_PERIODIC_CALLBACK casts to
RegisteredCallback call in InterruptDistributionHub to suppress
deprecated non-prototype LLVM 15 warning

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 13:42:14 +03:00
Savva Mitrofanov a3fbdbd7b4 MdeModulePkg/CapsuleOnDiskLoadPei: Removes unused Index variable
Removes unused Index local variable in RetrieveRelocatedCapsule to
suppress compiler warning in LLVM 15

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 13:42:14 +03:00
Savva Mitrofanov 8591f002ce NetworkPkg/WifiConnectionManagerDxe: Removes unused variable
Removes unused variable in WifiMgrRefreshNetworkList routine to correct
build

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 13:42:14 +03:00
Savva Mitrofanov a97e04fad0 CryptoPkg/BaseCryptLib: Removes unused variable in CryptX509
Removes unused local variable in X509ConstructCertificateStackV

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 13:42:14 +03:00
Mikhail Krichanov 6cac70a99a MdeModulePkg/RegularExpressionDxe: Corrects onigurama build with LLVM 15
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 13:42:14 +03:00
Savva Mitrofanov bcd8e61383 MdeModulePkg/VarCheckHiiLib: Remove unused variable FfsIndex
Corrects compiler warning due to unused variable in VarCheckHiiGenFromFv

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:55:02 +03:00
Savva Mitrofanov 4e98b06fab MdeModulePkg/SmbiosMeasurementDxe: Removes unused local variable
Removes unused local variable Size in GetSmbiosStringById

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:55:02 +03:00
Savva Mitrofanov 1a35fd886d MdeModulePkg/BrotliCustomDecompressLib: Correct BrotliDecompress
We need to pass DestSize as pointer, because we assign this output var
to TotalOut value inside BrotliDecompress routine

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:55:02 +03:00
Savva Mitrofanov b97a76470a .gitignore: Add compile_flags.txt
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:55:02 +03:00
Mikhail Krichanov 443162427a Build: Fixed missing HII for X64, IA32 CLANGDWARF DEBUG, NOOPT. 2024-07-22 12:55:02 +03:00
Mikhail Krichanov 621dd83262 MdePkg/X64/ProcessorBind.h: Fixes CLANGDWARF X64 compilation
Corrects typedef redefinition, in particular for openssl e_os2.h

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:54:00 +03:00
Savva Mitrofanov 75bdb2a996 UefiCpuPkg/CpuExceptionHandlerLib: Increase mBuffer size
Add missing GDT alignment into mBuffer to prevent possible memory
corruption on ALIGN_POINTER operation on NewGdtTable
in ArchExceptionHandler

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:45:14 +03:00
Savva Mitrofanov f47aa892ca RedfishPkg/BaseUcs2Utf8Lib: Fix out of bounds shift in UTF8ToUCS2Char
Missing masks leads to shift out of bounds. Also there is no need to
construct CHAR16 using cast to CHAR8 buffer, better to use native endian
by assigning data directly into Ucs2Char variable

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
2024-07-22 12:45:14 +03:00
Savva Mitrofanov 34ed115cd4 MdePkg/BasePcdLibNull: Remove ASSERT from LibPcdGetSize, LibPcdGetExSize
GetSize routines should return zero size when checking Token existence

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
2024-07-22 12:45:14 +03:00
Vitaly Cheptsov d3f7ec83dc OvmfPkg/DxePciLibI440FxQ34: Add UefiBootServicesTableLib dependency
In case PlatformBootManagerLib does not have PciLib dependency,
we need to explicitly depend on UefiBootServicesTableLib.
Otherwise UefiBootServicesTableLib may not be constructed before
DxePciLibI440FxQ35, which uses a constructor-less PcdLib that directly
accesses gBS.

This can be viewed as a bug in the current implementation of BaseTools,
namely GetModuleLibInstances. This function drops all constructor-less
dependencies from the dependency resolution list to avoid dependency
cycles, which at the same time causes issues like above.

To properly fix the issue one should go over each library with
constructors and for each its dependency without constructors add all
the secondary dependencies that do have constructors. While doable,
it may cause considerable performance issues and is thus not done
in this patch.

Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
2024-07-22 12:45:14 +03:00
Savva Mitrofanov f4400b241e UefiPayloadPkg/PchSmiDispatchSmm: Add missing EFIAPI modifiers
Added missing EFIAPI modifier to SmmSwDispatcher function which passed into gSmst->SmiHandlerRegister routine.

Signed-off-by: Savva Mitrofanov <sk.mitrofanov@ispras.ru>
Reviewed-by: Vitaly Cheptsov <cheptsov@ispras.ru>
2024-07-22 12:45:14 +03:00
Vitaly Cheptsov ad7e33255b BaseTools: Allow .text relocations in CLANGDWARF toolchain
UefiCpuPkg modules like ExceptionHandlerAsm.nasm require relocations
to .text or PIC as they use instructions like mov or bt against
external symbols:

1. mov     rax, ASM_PFX(CommonInterruptEntry)
2. mov     rax, HookAfterStubHeaderEnd
3. bt      [ASM_PFX(mErrorCodeFlag)], ecx
4. mov     [rcx + (@VectorNum - HookAfterStubHeaderBegin)], al

It is not easily possible to rewrite 3/4 cases without involving
more registers or more commands, and EDK II has never targeted
read-only .text at load time, only at runtime.

Change the defaults to let OVMF compile by CLANGDWARF as per:
https://lists.llvm.org/pipermail/llvm-dev/2017-March/111441.html

Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
2024-07-22 12:45:14 +03:00
Goldfish64 30df4e18b8 OvmfPkg/SioBusDxe: Add PS/2 mouse support
SioBusDxe by default does not create a device for PS/2 mice, this patch adds that device.
2024-07-22 12:38:35 +03:00
Vitaly Cheptsov 482644d333 ShellPkg: Add support for input with separately reported modifiers
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2510

Some firmwares:
- Report Shift modifier even when they report upper-case unicode letter.
- Report Ctrl modifier with "shifted" UniChar (i.e. X - 'A' + 1).

This change provides support for these firmwares preserving the compatibility
with the previous input handling.

Signed-off-by: Michael Belyaev <usrsse2@icloud.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
2024-07-22 12:38:35 +03:00
Mikhail Krichanov d66be6b532 CryptoPkg/OpensslLib: Fix build for XCODE5 compiler on macOS
REF: https://edk2.groups.io/g/devel/message/88179

A build of CryptoPkg with XCODE5 on macOS is now trying to include
Availability.h, which isn't found. Seems the problem is in condition
logic inside openssl/include/crypto/rand.h

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:38:34 +03:00
Mikhail Krichanov 80c73c3923 MdePkg: DebugLib: Compilation fix for clang-13
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3704

build -a X64 -t CLANG38 -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc
results in
UDK/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c:1284:31:
error: variable 'Status' set but not used
[-Werror,-Wunused-but-set-variable]

Signed-off-by: Mikhail Krichanov <krichanov@ispras.ru>

MdePkg/DebugLib(PerformanceLib): Fix "unused-but-set-variable" warning

The current definitions of DEBUG_CODE_BEGIN() and DEBUG_CODE_END() use
the local
variable __DebugCodeLocal as an attempt to track parity. If
DEBUG_CODE_END() is
used without a preceding DEBUG_CODE_BEGIN(), __DebugCodeLocal will not
have been
declared and a compilation error will be issued. The mutations of the
variable
are not used to track nesting or such. As the value of this variable is
never
actually used, recent Clang versions issue a "unused-but-set-variable"
warning
for it.

To solve this, re-define __DebugCodeLocal as a BOOLEAN that is always
FALSE and
use it in a do-while loop condition as done explicitly in many places.
Like the
previous solution, DEBUG_CODE_END() cannot be used without
DEBUG_CODE_BEGIN(),
as __DebugCodeLocal will be not have been defined.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2024-07-22 12:37:00 +03:00
Mikhail Krichanov 23bcb9c881 Ext4Pkg: Various improvements based on Sydr fuzzing results.
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 12:30:43 +03:00
Mikhail Krichanov 0ca8d0738a Ext4Pkg: Add EDK II Ext4 package
Adds a Pedro Falcato's UEFI EXT4 filesystem driver that implements the 
EFI_FILE_PROTOCOL and EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
    
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2024-07-22 11:46:22 +03:00
Ard Biesheuvel 3e722403cd ArmVirtPkg/ArmVirtQemu: Add RngDxe driver
Add the RngDxe driver to the build, backed by either RNDR or TRNG, one
of which is expected to be available in most cases:
- RNDR is implemented by the 'max' CPU that QEMU implements in TCG mode
- TRNG is implemented by the KVM hypervisor, which backs QEMU's 'host'
  CPU

Other TCG modes (e.g., the 'cortex-a*' CPUs) implement neither, which
should prevent the RngDxe driver from dispatching entirely, resulting
in the same situation as before.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Ard Biesheuvel 66c69871e7 ArmVirtPkg: Reverse inclusion order of MdeLibs.inc and ArmVirt.dsc.inc
MdeLibs.inc sets default library class resolutions which are much more
general than the ones that might be specified in ArmVirt.dsc.inc. So the
latter should be included *after* MdeLibs.inc to ensure that its
definitions take precedence.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Ard Biesheuvel c98f7f7550 ArmVirtPkg: Use dynamic PCD to set the SMCCC conduit
On ARM systems, whether SMC or HVC instructions need to be used to issue
monitor calls is typically dependent on the exception level, but there
are also cases where EL1 might use SMC instructions, so there is no hard
and fast rule.

For ArmVirtQemu, this does depend strictly on the exception level, so
set the default to HVC (for EL1 execution) and override it to SMC when
booted at EL2.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Ard Biesheuvel 865229bcc8 ArmVirtPkg/ArmVirtQemu: Permit the use of dynamic PCDs in PEI
Currently, only TPM2 builds enable the PCD PEIM, which is a prerequisite
for being able to use dynamic PCDs already at the PEI stage. This
facility will be used for other reasons too so move those pieces out of
code block that are conditional on TPM2_ENABLE

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Ard Biesheuvel 4ddf2448ed MdePkg/BaseRngLib AARCH64: Remove overzealous ASSERT()
BaseRngLib on AARCH64 will discover whether or not RNDR instructions are
supported, by inspecting the ISAR0 identification register, and setting
a global boolean accordingly. This boolean is used in subsequent
execution to decide whether or not to issue the instruction.

The same discovery code also ASSERT()s that RNDR instructions are
implemented, which is unnecessary, and breaks execution on systems that
incorporate the library but don't implement the instruction (or fail to
expose it to the exception level that the firmware executes at).

So drop the ASSERT().

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-05-24 15:48:52 +00:00
Flickdm 9440986d4e ArmVirtPkg: Move PcdMonitorConduitHvc
This moves the PcdMonitorConduitHvc from PcdsFeatureFlag.Common to
PcdsFixedAtBuild.Common

This is a follow on to the previous commit:
ArmPkg: Allow SMC/HVC monitor conduit to be specified at runtime

ArmVirtQemu may execute at EL2, in which case monitor calls are
generally made using SMC instructions instead of HVC instructions.

Whether or not this is the case can only be decided at runtime, and so
the associated PCD needs to be settable at runtime, if the platform
definition chooses so. This implies a boolean PCD, given that a feature
PCD is build-time configurable only.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Ard Biesheuvel 32460bb5b1 ArmPkg: Allow SMC/HVC monitor conduit to be specified at runtime
ArmVirtQemu may execute at EL2, in which case monitor calls are
generally made using SMC instructions instead of HVC instructions.

Whether or not this is the case can only be decided at runtime, and so
the associated PCD needs to be settable at runtime, if the platform
definition chooses so. This implies a boolean PCD, given that a feature
PCD is build-time configurable only.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Doug Flick 207b6d68a0 NetworkPkg: Update the PxeBcDhcp6GoogleTest due to underlying changes
This patch updates the PxeBcDhcp6GoogleTest due to the changes in the
underlying code. The changes are as follows:
 - Random now comes from the RngLib Protocol
 - The TCP ISN is now generated by the hash function

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2024-05-24 15:48:52 +00:00
Doug Flick dff3d3811f MdePkg: Add MockHash2 Protocol for testing
This commit adds a new MockHash2 protocol to the MdePkg. This allows
the unit tests to pick up the new protocol and use it for testing.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-05-24 15:48:52 +00:00
Doug Flick 4afb939531 MdePkg: Adds Protocol for MockRng
This patch adds a protocol for MockRng. This protocol is used to
mock the Rng protocol for testing purposes.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-05-24 15:48:52 +00:00
Doug Flick 72a9ef1c8a MdePkg: Add MockUefiBootServicesTableLib
This commit adds a mock library for UefiBootServicesTableLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-05-24 15:48:52 +00:00
Doug Flick 1904a64bcc NetworkPkg TcpDxe: SECURITY PATCH CVE-2023-45236
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4541
REF: https://www.rfc-editor.org/rfc/rfc1948.txt
REF: https://www.rfc-editor.org/rfc/rfc6528.txt
REF: https://www.rfc-editor.org/rfc/rfc9293.txt

Bug Overview:
PixieFail Bug #8
CVE-2023-45236
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
CWE-200 Exposure of Sensitive Information to an Unauthorized Actor

Updates TCP ISN generation to use a cryptographic hash of the
connection's identifying parameters and a secret key.
This prevents an attacker from guessing the ISN used for some other
connection.

This is follows the guidance in RFC 1948, RFC 6528, and RFC 9293.

RFC: 9293 Section 3.4.1.  Initial Sequence Number Selection

   A TCP implementation MUST use the above type of "clock" for clock-
   driven selection of initial sequence numbers (MUST-8), and SHOULD
   generate its initial sequence numbers with the expression:

   ISN = M + F(localip, localport, remoteip, remoteport, secretkey)

   where M is the 4 microsecond timer, and F() is a pseudorandom
   function (PRF) of the connection's identifying parameters ("localip,
   localport, remoteip, remoteport") and a secret key ("secretkey")
   (SHLD-1).  F() MUST NOT be computable from the outside (MUST-9), or
   an attacker could still guess at sequence numbers from the ISN used
   for some other connection.  The PRF could be implemented as a
   cryptographic hash of the concatenation of the TCP connection
   parameters and some secret data.  For discussion of the selection of
   a specific hash algorithm and management of the secret key data,
   please see Section 3 of [42].

   For each connection there is a send sequence number and a receive
   sequence number.  The initial send sequence number (ISS) is chosen by
   the data sending TCP peer, and the initial receive sequence number
   (IRS) is learned during the connection-establishing procedure.

   For a connection to be established or initialized, the two TCP peers
   must synchronize on each other's initial sequence numbers.  This is
   done in an exchange of connection-establishing segments carrying a
   control bit called "SYN" (for synchronize) and the initial sequence
   numbers.  As a shorthand, segments carrying the SYN bit are also
   called "SYNs".  Hence, the solution requires a suitable mechanism for
   picking an initial sequence number and a slightly involved handshake
   to exchange the ISNs.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2024-05-24 15:48:52 +00:00
Doug Flick 4c4ceb2ceb NetworkPkg: SECURITY PATCH CVE-2023-45237
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4542

Bug Overview:
PixieFail Bug #9
CVE-2023-45237
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)

Use of a Weak PseudoRandom Number Generator

Change Overview:

Updates all Instances of NET_RANDOM (NetRandomInitSeed ()) to either

>
> EFI_STATUS
> EFIAPI
> PseudoRandomU32 (
>  OUT UINT32  *Output
>  );
>

or (depending on the use case)

>
> EFI_STATUS
> EFIAPI
> PseudoRandom (
>  OUT  VOID   *Output,
>  IN   UINTN  OutputLength
>  );
>

This is because the use of

Example:

The following code snippet PseudoRandomU32 () function is used:

>
> UINT32         Random;
>
> Status = PseudoRandomU32 (&Random);
> if (EFI_ERROR (Status)) {
>   DEBUG ((DEBUG_ERROR, "%a failed to generate random number: %r\n",
__func__, Status));
>   return Status;
> }
>

This also introduces a new PCD to enable/disable the use of the
secure implementation of algorithms for PseudoRandom () and
instead depend on the default implementation. This may be required for
some platforms where the UEFI Spec defined algorithms are not available.

>
> PcdEnforceSecureRngAlgorithms
>

If the platform does not have any one of the UEFI defined
secure RNG algorithms then the driver will assert.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2024-05-24 15:48:52 +00:00
Flickdm a85336531c SecurityPkg RngDxe: Remove incorrect limitation on GetRng
Removed from gEfiRngAlgorithmRaw an incorrect assumption that
Raw cannot return less than 256 bits. The DRNG Algorithms
should always use a 256 bit seed as per nist standards
however a caller is free to request less than 256 bits.
>
>     //
>    // When a DRBG is used on the output of a entropy source,
>    // its security level must be at least 256 bits according to UEFI
Spec.
>    //
>    if (RNGValueLength < 32) {
>      return EFI_INVALID_PARAMETER;
>    }
>

AARCH64 platforms do not have this limitation and this brings both
implementations into alignment with each other and the spec.

Cc: Jiewen Yao <jiewen.yao@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewe Yao <Jiewen.yao@intel.com>
2024-05-24 15:48:52 +00:00
Flickdm e10d83234c ArmVirtPkg: Add Hash2DxeCrypto to ArmVirtPkg
This patch adds Hash2DxeCrypto to ArmVirtPkg. The Hash2DxeCrypto is
used to provide the hashing protocol services.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Flickdm 677204f941 ArmVirtPkg PlatformCI: Support virtio-rng-pci
This patch adds "virtio-rng-pci" to the PlatformBuildLib.py
This adds Rng services to the guest VM

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Doug Flick cb9d711891 OvmfPkg: Add Hash2DxeCrypto to OvmfPkg
This patch adds Hash2DxeCrypto to OvmfPkg. The Hash2DxeCrypto is
used to provide the hashing protocol services.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Flickdm 4f58e0cf99 OvmfPkg PlatformCI: Support virtio-rng-pci
This patch adds "virtio-rng-pci" to the PlatformBuildLib.py
This adds Rng services to the guest VM

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Doug Flick 024a291b3e EmulatorPkg: Add Hash2DxeCrypto to EmulatorPkg
This patch adds Hash2DxeCrypto to EmulatorPkg. The Hash2DxeCrypto is
used to provide the hashing protocol services.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
2024-05-24 15:48:52 +00:00
Flickdm 319bb7223a EmulatorPkg: Add RngDxe to EmulatorPkg
This patch adds RngDxe to EmulatorPkg. The RngDxe is used to provide
random number generation services to the UEFI firmware.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2024-05-24 15:48:52 +00:00
Michael Kubacki 7142e64841 CodeQL: Update from 2.16.1 to 2.17.3
This fixes an issue where the CodeQL queries currently fetched in the
pipeline are incompatible with the current executable used.

Update to pick up functional and security fixes. See the following
comparison for detailed differences:

https://github.com/github/codeql-cli-binaries/compare/v2.16.1...v2.17.3

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Joey Vagedes <joey.vagedes@gmail.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-05-21 02:24:08 +00:00
Shanmugavel Pakkirisamy 284dbac43d MdeModulePkg: Potential UINT32 overflow in S3 ResumeCount
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4677

Attacker able to modify physical memory and ResumeCount.
System will crash/DoS when ResumeCount reaches its MAX_UINT32.

Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Signed-off-by: Pakkirisamy ShanmugavelX <shanmugavelx.pakkirisamy@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-05-17 05:33:52 +00:00
Shun Cheng Liu 558a25366d MdePkg/BaseLib: Fix AARCH64 compilation error
Declare InternalAssertJumpBuffer as EXTERN

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Shun Cheng Liu <adam.liu@tw.synaptics.com>
Reviewed-by: levi.yun <yeoreum.yun@arm.com>
2024-05-15 01:13:18 +00:00
Ray Ni 4b6ee06a09 MdePkg: Add MmUnblockMemoryLib to MdeLibs.dsc
MdeLibs.dsc.inc included some default libraries provided by MdePkg.
Platform can include MdeLibs.dsc.inc file to avoid some potential
incompatible changes to platform dsc file in future.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-05-10 03:46:27 +00:00
Abdul Lateef Attar 3c0b84420f DynamicTablesPkg: Adds integer to the AML package node
Adds an AmlAddIntegerToNamedPackage() API to generate AML code,
which adds an integer value to the package node.

Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-05-10 08:47:52 +08:00
praveensankarn 25996a3441 MdePkg: Updated SpcrTable structure for Revision_4
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4656

In SPCR table, 4 structure members have been added newly as per SPCR
table Revision 4, which has to be added in
MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h.

Signed-off-by: Praveen Sankar N <praveensankarn@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Cc: Felix Polyudov <Felixp@ami.com>
Cc: Srinivasan Mani <srinivasanm@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Cc: Rabisha R <rabishar@ami.com>
2024-05-09 15:08:55 +08:00
Sachin Ganesh b82c9631da OvmfPkg: Use newly defined Unaccepted Memory Type
EFI_RESOURCE_MEMORY_UNACCEPTED has been officially defined in the PI
1.8 specification. So all temporary solutions have been replaced with
the actual definition.

Cc: Felix Polyudov <felixp@ami.com>
Cc: Dhanaraj V <vdhanaraj@ami.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
2024-05-08 11:34:49 +00:00