From 45720abe43b63a4270e210f2e67a7c4dc176273d Mon Sep 17 00:00:00 2001 From: zodf0055980 Date: Wed, 21 Aug 2024 15:18:08 +0800 Subject: [PATCH] SecurityPkg: Fix exponent unmarshaled as 16 bits According issue #5536, exponent is 32 bits but is unmarshaled as 16 bits. Signed-off-by: zodf0055980 --- SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c index 335957d6cedc..888979e96923 100644 --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c @@ -252,7 +252,7 @@ Tpm2ReadPublic ( OutPublic->publicArea.parameters.rsaDetail.keyBits = SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); Buffer += sizeof (UINT16); - OutPublic->publicArea.parameters.rsaDetail.exponent = SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + OutPublic->publicArea.parameters.rsaDetail.exponent = SwapBytes32 (ReadUnaligned32 ((UINT32 *)Buffer)); Buffer += sizeof (UINT32); break; case TPM_ALG_ECC: