Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto migration to Openssl 3.0.15 #99

Draft
wants to merge 29 commits into
base: release/202311
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5136298
Updated submodules to 202405
kenlautner Oct 9, 2024
7b1dadc
Updated CISettings.py
kenlautner Oct 9, 2024
17505df
Update Common/MU submodule configuration
Flickdm Feb 6, 2025
5ae3a6d
Updating Submodule MU_BASECORE to point to latest commit
Flickdm Feb 6, 2025
0aa9d4d
fix bug at Pkcs7GetCertificatesList - causes failure on NewP7Data free
DorLevi95 Jan 29, 2025
9ceb140
format with uncrustify
DorLevi95 Jan 30, 2025
d1daee1
Avoid UB in TlsVersion Init
inbal2l Feb 20, 2025
c1651ec
change to howto.txt
DorLevi95 Jul 9, 2024
350e8d4
update submodule to openssl-3.0.9
DorLevi95 Jul 9, 2024
d0533af
add openssl3 configure scripts
DorLevi95 Jul 9, 2024
f39af41
cleanup openssl1.1.1 generated files and code
DorLevi95 Jul 9, 2024
affee91
update openssl*.inf files for openssl 3.0
DorLevi95 Jul 9, 2024
37212fc
update uefiasm.conf
DorLevi95 Jul 9, 2024
9b1bdf1
adapt CryptSm3 to openssl 3.0
DorLevi95 Jul 9, 2024
631e703
remove openssl deprecation warnings
DorLevi95 Jul 9, 2024
16d5eac
remove BIO_* dummy functions
DorLevi95 Jul 9, 2024
e02e79d
ERR_GET_FUNC is gone
DorLevi95 Jul 9, 2024
01a8f97
more openssl 3.0 adaptation + add stub folder
DorLevi95 Jul 9, 2024
67381db
add implemention of _ftol2_sse() to avoid build error
DorLevi95 Jul 9, 2024
d1031f4
add more dummy implementation of openssl
DorLevi95 Jul 9, 2024
7894775
add UEFI provider
DorLevi95 Jul 9, 2024
dc22b21
run configure.py to update generated files -> X64 STANDARD build succ…
Jul 9, 2024
ba3d340
Add instrinsics to support building openssl3 on IA32 windows -> IA32 …
Jul 9, 2024
cd97dc1
add missing gcc instructions for IA32 build
Jul 16, 2024
1a7b5cf
Enable memcpy sys call in RISCV64 build
DorLevi95 Aug 22, 2024
11bf55c
add define of maximum unsigned size_t
DorLevi95 Aug 22, 2024
06aff75
remove BN and EC accel for size optimization
DorLevi95 Aug 22, 2024
13ee93f
update openssl submodule 3.0.9 -> 3.0.15
DorLevi95 Jan 6, 2025
81198b0
Update generated files based on OpenSSL 3.0.15
DorLevi95 Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[submodule "MU_BASECORE"]
path = MU_BASECORE
url = https://github.com/microsoft/mu_basecore.git
branch = release/202302
branch = release/202405
[submodule "Silicon/Arm/MU_TIANO"]
path = Silicon/Arm/MU_TIANO
url = https://github.com/microsoft/mu_silicon_arm_tiano.git
branch = release/202302
branch = release/202405
[submodule "Features/MM_SUPV"]
path = Features/MM_SUPV
url = https://github.com/microsoft/mu_feature_mm_supv.git
branch = main
[submodule "OpensslPkg/Library/OpensslLib/openssl"]
path = OpensslPkg/Library/OpensslLib/openssl
url = https://github.com/openssl/openssl.git
[submodule "Common"]
path = Common
[submodule "Common/MU"]
path = Common/MU
url = https://github.com/microsoft/mu_plus.git
branch = release/202302
5 changes: 5 additions & 0 deletions .pytool/CISettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ def GetDependencies(self):
"Path": "Features/MM_SUPV",
"Url": "https://github.com/microsoft/mu_feature_mm_supv.git",
"Branch": "main"
},
{
"Path": "Common/MU",
"Url": "https://github.com/microsoft/mu_plus.git",
"Branch": "release/202405"
}
]
def GetPackagesPath(self):
Expand Down
1 change: 0 additions & 1 deletion Common
Submodule Common deleted from 5fb0d0
1 change: 1 addition & 0 deletions Common/MU
Submodule MU added at 5beccf
2 changes: 1 addition & 1 deletion Features/MM_SUPV
Submodule MM_SUPV updated 84 files
+3 −3 .azurepipelines/MuDevOpsWrapper.yml
+5 −0 .git-blame-ignore-revs
+1 −0 .gitattributes
+3 −26 .github/pull_request_template.md
+5 −1 .github/workflows/auto-approve.yml
+7 −1 .github/workflows/auto-merge.yml
+82 −17 .github/workflows/codeql.yml
+6 −1 .github/workflows/issue-assignment.yml
+6 −1 .github/workflows/label-issues.yml
+5 −1 .github/workflows/label-sync.yml
+5 −0 .github/workflows/pull-request-formatting-validator.yml
+6 −1 .github/workflows/release-draft.yml
+5 −0 .github/workflows/scheduled-maintenance.yml
+6 −1 .github/workflows/stale.yml
+5 −1 .github/workflows/triage-issues.yml
+4 −10 .pytool/CISettings.py
+52 −1 CONTRIBUTING.md
+9 −32 MmSupervisorPkg/Core/Dispatcher/Dependency.c
+6 −184 MmSupervisorPkg/Core/Dispatcher/Dispatcher.c
+147 −27 MmSupervisorPkg/Core/Handler/Mmi.c
+4 −3 MmSupervisorPkg/Core/Mem/Cet.nasm
+13 −7 MmSupervisorPkg/Core/Mem/HeapGuard.c
+58 −64 MmSupervisorPkg/Core/Mem/Mem.h
+0 −114 MmSupervisorPkg/Core/Mem/MemWrapper.c
+46 −278 MmSupervisorPkg/Core/Mem/PageTbl.c
+568 −469 MmSupervisorPkg/Core/Mem/SmmCpuMemoryManagement.c
+68 −228 MmSupervisorPkg/Core/Mem/SmmProfile.c
+50 −926 MmSupervisorPkg/Core/Misc/MemoryAttributesTable.c
+0 −75 MmSupervisorPkg/Core/Misc/Semaphore.c
+9 −2 MmSupervisorPkg/Core/Misc/SmmFuncsArch.c
+107 −0 MmSupervisorPkg/Core/Misc/SmmMpPerf.c
+83 −0 MmSupervisorPkg/Core/Misc/SmmMpPerf.h
+11 −15 MmSupervisorPkg/Core/MmSupervisorCore.c
+3 −1 MmSupervisorPkg/Core/MmSupervisorCore.h
+20 −9 MmSupervisorPkg/Core/MmSupervisorCore.inf
+26 −0 MmSupervisorPkg/Core/Relocate/Cet.inc
+429 −197 MmSupervisorPkg/Core/Relocate/Relocate.c
+21 −156 MmSupervisorPkg/Core/Relocate/Relocate.h
+24 −18 MmSupervisorPkg/Core/Relocate/SmiEntry.nasm
+0 −146 MmSupervisorPkg/Core/Relocate/SmmInit.nasm
+2 −550 MmSupervisorPkg/Core/Relocate/SmramSaveState.c
+5 −5 MmSupervisorPkg/Core/Request/UnblockMemory.c
+1 −45 MmSupervisorPkg/Core/Services/CpuService/CpuService.c
+180 −333 MmSupervisorPkg/Core/Services/MpService/MpService.c
+7 −3 MmSupervisorPkg/Core/Services/MpService/MpService.h
+14 −5 MmSupervisorPkg/Core/Services/MpService/SyncTimer.c
+6 −6 MmSupervisorPkg/Core/Telemetry/Telemetry.c
+3 −10 MmSupervisorPkg/Docs/PlatformIntegration/PlatformIntegrationSteps.md
+0 −1 MmSupervisorPkg/Docs/PlatformIntegration/SoftwareComponentOverview.md
+5 −5 MmSupervisorPkg/Drivers/MmPeiLaunchers/Common/MmIplCommon.c
+7 −7 MmSupervisorPkg/Drivers/MmPeiLaunchers/IA32/X64Loader.c
+1 −1 MmSupervisorPkg/Drivers/MmPeiLaunchers/MmDxeSupport.inf
+34 −234 MmSupervisorPkg/Drivers/MmPeiLaunchers/MmIplPei.c
+5 −2 MmSupervisorPkg/Drivers/MmPeiLaunchers/MmIplPei.inf
+1 −1 MmSupervisorPkg/Drivers/MmPeiLaunchers/MmIplX64Relay.inf
+2 −2 MmSupervisorPkg/Drivers/MmPeiLaunchers/X64/X64Entry.c
+0 −6 MmSupervisorPkg/Drivers/MmSupervisorRing3Broker/Mem/Pool.c
+13 −0 MmSupervisorPkg/Drivers/MmSupervisorRing3Broker/MmSupervisorRing3Broker.c
+3 −2 MmSupervisorPkg/Drivers/MmSupervisorRing3Broker/MmSupervisorRing3Broker.inf
+0 −2,224 MmSupervisorPkg/Drivers/StandaloneMmIpl/PiSmmIpl.c
+0 −111 MmSupervisorPkg/Drivers/StandaloneMmIpl/PiSmmIpl.inf
+1 −1 MmSupervisorPkg/Library/BaseCpuLibSysCall/BaseCpuLib.inf
+2 −4 MmSupervisorPkg/Library/BaseIoLibIntrinsicSysCall/BaseIoLibIntrinsic.inf
+220 −0 MmSupervisorPkg/Library/BaseIoLibIntrinsicSysCall/IoLibFifo.c
+0 −120 MmSupervisorPkg/Library/BaseIoLibIntrinsicSysCall/X64/IoFifo.nasm
+2 −1 MmSupervisorPkg/Library/BaseLibSysCall/BaseLib.inf
+73 −2 MmSupervisorPkg/Library/BaseLibSysCall/CheckSum.c
+1 −1 MmSupervisorPkg/Library/BaseLibSysCall/SafeString.c
+56 −16 MmSupervisorPkg/Library/BaseLibSysCall/String.c
+2 −4 MmSupervisorPkg/Library/BaseLibSysCall/X64/TdVmcall.nasm
+94 −0 MmSupervisorPkg/Library/BaseLibSysCall/X64/VmgExitSvsm.nasm
+1 −2 MmSupervisorPkg/Library/MmSupervisorMemLib/MmSupervisorCoreMemLib.inf
+1 −1 MmSupervisorPkg/Library/MmSupervisorMemLib/MmSupervisorMemLibSyscall.inf
+1 −1 MmSupervisorPkg/Library/MmSupervisorMemLib/X86StandaloneMmMemLibInternal.c
+652 −0 MmSupervisorPkg/Library/StandaloneMmCpuSyncLib/StandaloneMmCpuSyncLib.c
+36 −0 MmSupervisorPkg/Library/StandaloneMmCpuSyncLib/StandaloneMmCpuSyncLib.inf
+49 −152 MmSupervisorPkg/Library/StandaloneMmHobLibSyscall/StandaloneMmHobLibSyscall.c
+1 −1 MmSupervisorPkg/Library/StandaloneMmHobLibSyscall/StandaloneMmHobLibSyscall.inf
+8 −1 MmSupervisorPkg/MmSupervisorPkg.dec
+10 −8 MmSupervisorPkg/MmSupervisorPkg.dsc
+1 −1 MmSupervisorPkg/Test/MmSupvRequestUnitTestApp/MmSupvRequestUnitTestApp.c
+5 −4 MmSupervisorPkg/Test/MmiHandlerProfileInfo/MmiHandlerProfileInfo.c
+1 −1 MmSupervisorPkg/Test/MmiHandlerProfileInfo/MmiHandlerProfileInfo.inf
+4 −5 pip-requirements.txt
2 changes: 1 addition & 1 deletion MU_BASECORE
Submodule MU_BASECORE updated 1127 files
14 changes: 7 additions & 7 deletions OpensslPkg/Library/BaseCryptLib/Hash/CryptSm3.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include "InternalCryptLib.h"
#include "crypto/sm3.h"
#include "internal/sm3.h"

/**
Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.
Expand Down Expand Up @@ -55,7 +55,7 @@ Sm3Init (
//
// Openssl SM3 Context Initialization
//
sm3_init ((SM3_CTX *)Sm3Context);
ossl_sm3_init ((SM3_CTX *)Sm3Context);
return TRUE;
}

Expand Down Expand Up @@ -136,7 +136,7 @@ Sm3Update (
//
// Openssl SM3 Hash Update
//
sm3_update ((SM3_CTX *)Sm3Context, Data, DataSize);
ossl_sm3_update ((SM3_CTX *)Sm3Context, Data, DataSize);

return TRUE;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ Sm3Final (
//
// Openssl SM3 Hash Finalization
//
sm3_final (HashValue, (SM3_CTX *)Sm3Context);
ossl_sm3_final (HashValue, (SM3_CTX *)Sm3Context);

return TRUE;
}
Expand Down Expand Up @@ -225,11 +225,11 @@ Sm3HashAll (
//
// SM3 Hash Computation.
//
sm3_init (&Ctx);
ossl_sm3_init (&Ctx);

sm3_update (&Ctx, Data, DataSize);
ossl_sm3_update (&Ctx, Data, DataSize);

sm3_final (HashValue, &Ctx);
ossl_sm3_final (HashValue, &Ctx);

return TRUE;
}
3 changes: 3 additions & 0 deletions OpensslPkg/Library/BaseCryptLib/InternalCryptLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

#include "CrtLibSupport.h"

// TODO: remove in near future to stop using deprecated OpenSSL APIs
#define OPENSSL_NO_DEPRECATED 0

#include <openssl/opensslv.h>

#if OPENSSL_VERSION_NUMBER < 0x10100000L
Expand Down
4 changes: 3 additions & 1 deletion OpensslPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ Pkcs7GetCertificatesList (
BOOLEAN Status;
UINT8 *NewP7Data;
UINTN NewP7Length;
CONST UINT8 *Temp;
BOOLEAN Wrapped;
UINT8 Index;
PKCS7 *Pkcs7;
Expand Down Expand Up @@ -528,7 +529,8 @@ Pkcs7GetCertificatesList (
//
// Decodes PKCS#7 SignedData
//
Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **)&NewP7Data, (int)NewP7Length);
Temp = NewP7Data;
Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **)&Temp, (int)NewP7Length);
if ((Pkcs7 == NULL) || (!PKCS7_type_is_signed (Pkcs7))) {
goto _Error;
}
Expand Down
26 changes: 0 additions & 26 deletions OpensslPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,32 +484,6 @@ fwrite (
return 0;
}

//
// -- Dummy OpenSSL Support Routines --
//

int
BIO_printf (
void *bio,
const char *format,
...
)
{
return 0;
}

int
BIO_snprintf (
char *buf,
size_t n,
const char *format,
...
)
{
// Because the function does not actually print anything to buf, it returns -1 as error.
// Otherwise, the consumer may think that the buf is valid and parse the buffer.
return -1;
}

#ifdef __GNUC__

Expand Down
25 changes: 0 additions & 25 deletions OpensslPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,6 @@ sscanf (
return 0;
}

//
// -- Dummy OpenSSL Support Routines --
//

int
BIO_printf (
void *bio,
const char *format,
...
)
{
return 0;
}

int
BIO_snprintf (
char *buf,
size_t n,
const char *format,
...
)
{
return 0;
}

uid_t
getuid (
void
Expand Down
1 change: 1 addition & 0 deletions OpensslPkg/Library/Include/CrtLibSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define UINT_MAX 0xFFFFFFFF /* Maximum unsigned int value */
#define ULONG_MAX 0xFFFFFFFF /* Maximum unsigned long value */
#define CHAR_BIT 8 /* Number of bits in a char */
#define SIZE_MAX 0xFFFFFFFF /* Maximum unsigned size_t */

//
// Address families.
Expand Down
Loading