Skip to content

Commit

Permalink
User: Defined PcdImageProtectionPolicy for ImageTool in audk, adopted…
Browse files Browse the repository at this point in the history
… new API.
  • Loading branch information
MikhailKrichanov committed Nov 23, 2023
1 parent 9cdf82a commit 43c4931
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Legacy/BootPlatform/EfiLdr/PeLoader.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ EfiLdrLoadImage (
&ImageContext,
FHand,
BufferSize,
UEFI_IMAGE_SOURCE_NON_FV
UEFI_IMAGE_SOURCE_NON_FV,
UefiImageOriginFv
);
if (EFI_ERROR (Status)) {
return Status;
Expand Down
3 changes: 2 additions & 1 deletion Library/OcBootManagementLib/ImageLoader.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ OcImageLoaderLoad (
&ImageContext,
SourceBuffer,
(UINT32)SourceSize,
UEFI_IMAGE_SOURCE_FV
UEFI_IMAGE_SOURCE_FV,
UefiImageOriginFv
);
if (EFI_ERROR (ImageStatus)) {
DEBUG ((DEBUG_INFO, "OCB: PeCoff init failure - %r\n", ImageStatus));
Expand Down
6 changes: 4 additions & 2 deletions Library/OcPeCoffExtLib/OcPeCoffExtLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ PeCoffVerifyAppleSignature (
ImageStatus = PeCoffInitializeContext (
&ImageContext,
PeImage,
*ImageSize
*ImageSize,
UefiImageOriginFv
);
if (EFI_ERROR (ImageStatus)) {
DEBUG ((DEBUG_INFO, "OCPE: PeCoff verify init failure - %r\n", ImageStatus));
Expand Down Expand Up @@ -561,7 +562,8 @@ PeCoffGetApfsDriverVersion (
ImageStatus = PeCoffInitializeContext (
&ImageContext,
DriverBuffer,
DriverSize
DriverSize,
UefiImageOriginFv
);
if (EFI_ERROR (ImageStatus)) {
DEBUG ((DEBUG_INFO, "OCPE: PeCoff apfs init failure - %r\n", ImageStatus));
Expand Down
2 changes: 2 additions & 0 deletions User/Include/UserPcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ extern BOOLEAN _gPcd_FeatureFlag_PcdFatReadOnlyMode;
extern UINT32 _gPcd_BinaryPatch_PcdSerialRegisterStride;
extern UINT8 _gPcd_FixedAtBuild_PcdUefiImageFormatSupportNonFv;
extern UINT8 _gPcd_FixedAtBuild_PcdUefiImageFormatSupportFv;
extern UINT32 _gPcd_FixedAtBuild_PcdImageProtectionPolicy;

#define _PCD_GET_MODE_32_PcdUefiLibMaxPrintBufferSize _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize
#define _PCD_GET_MODE_BOOL_PcdUgaConsumeSupport _gPcd_FixedAtBuild_PcdUgaConsumeSupport
Expand Down Expand Up @@ -105,5 +106,6 @@ extern UINT8 _gPcd_FixedAtBuild_PcdUefiImageFormatSupportFv;
#define _PCD_GET_MODE_32_PcdImageLoaderRelocTypePolicy _gPcd_FixedAtBuild_PcdImageLoaderRelocTypePolicy
#define _PCD_GET_MODE_8_PcdUefiImageFormatSupportNonFv _gPcd_FixedAtBuild_PcdUefiImageFormatSupportNonFv
#define _PCD_GET_MODE_8_PcdUefiImageFormatSupportFv _gPcd_FixedAtBuild_PcdUefiImageFormatSupportFv
#define _PCD_GET_MODE_32_PcdImageProtectionPolicy _gPcd_FixedAtBuild_PcdImageProtectionPolicy

#endif // OC_USER_PCD_H
1 change: 1 addition & 0 deletions User/Library/UserPcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ BOOLEAN _gPcd_FeatureFlag_PcdFatReadOnlyMode = _PCD_VALU
UINT32 _gPcd_BinaryPatch_PcdSerialRegisterStride = 0;
UINT8 _gPcd_FixedAtBuild_PcdUefiImageFormatSupportNonFv = 0x00;
UINT8 _gPcd_FixedAtBuild_PcdUefiImageFormatSupportFv = 0x03;
UINT32 _gPcd_FixedAtBuild_PcdImageProtectionPolicy = 0x00;
3 changes: 2 additions & 1 deletion Utilities/AppleEfiSignTool/AppleEfiSignTool.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ VerifySignatureAndApfs (
ContextStatus = PeCoffInitializeContext (
&Context,
Image,
ImageSize
ImageSize,
UefiImageOriginFv
);
}

Expand Down
2 changes: 1 addition & 1 deletion Utilities/TestPeCoff/PeCoff.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ PeCoffTestLoadFull (
UINT32 DestinationAlignment;
UINT8 HashContext;

Status = PeCoffInitializeContext (&Context, FileBuffer, FileSize);
Status = PeCoffInitializeContext (&Context, FileBuffer, FileSize, UefiImageOriginFv);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
Expand Down

1 comment on commit 43c4931

@vumanhcuongUET
Copy link

@vumanhcuongUET vumanhcuongUET commented on 43c4931 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My laptop can't see mac os disk after update this commit.
What should I do ?
@MikhailKrichanov

Please sign in to comment.