提交 6f25d6c9 编写于 作者: V vit9696

Utilities: Port DiskImage to utilities

上级 98ac7e10
...@@ -45,9 +45,9 @@ typedef struct OC_APPLE_CHUNKLIST_CONTEXT_ { ...@@ -45,9 +45,9 @@ typedef struct OC_APPLE_CHUNKLIST_CONTEXT_ {
**/ **/
BOOLEAN BOOLEAN
OcAppleChunklistInitializeContext ( OcAppleChunklistInitializeContext (
OUT OC_APPLE_CHUNKLIST_CONTEXT *Context, OUT OC_APPLE_CHUNKLIST_CONTEXT *Context,
IN VOID *Buffer, IN OUT VOID *Buffer,
IN UINT32 BufferSize IN UINT32 BufferSize
); );
BOOLEAN BOOLEAN
......
...@@ -33,31 +33,31 @@ ...@@ -33,31 +33,31 @@
// Chunklist chunk. // Chunklist chunk.
// //
typedef struct APPLE_CHUNKLIST_CHUNK_ { typedef struct APPLE_CHUNKLIST_CHUNK_ {
UINT32 Length; UINT32 Length;
UINT8 Checksum[APPLE_CHUNKLIST_CHECKSUM_LENGTH]; UINT8 Checksum[APPLE_CHUNKLIST_CHECKSUM_LENGTH];
} APPLE_CHUNKLIST_CHUNK; } APPLE_CHUNKLIST_CHUNK;
// //
// Chunklist signature. // Chunklist signature.
// //
typedef struct APPLE_CHUNKLIST_SIG_ { typedef struct APPLE_CHUNKLIST_SIG_ {
UINT8 Signature[APPLE_CHUNKLIST_SIG_LENGTH]; UINT8 Signature[APPLE_CHUNKLIST_SIG_LENGTH];
} APPLE_CHUNKLIST_SIG; } APPLE_CHUNKLIST_SIG;
// //
// Chunklist header. // Chunklist header.
// //
typedef struct { typedef struct {
UINT32 Magic; UINT32 Magic;
UINT32 Length; UINT32 Length;
UINT8 FileVersion; UINT8 FileVersion;
UINT8 ChunkMethod; UINT8 ChunkMethod;
UINT8 SigMethod; UINT8 SigMethod;
UINT8 Unused; UINT8 Unused;
UINT64 ChunkCount; UINT64 ChunkCount;
UINT64 ChunkOffset; UINT64 ChunkOffset;
UINT64 SigOffset; UINT64 SigOffset;
} APPLE_CHUNKLIST_HEADER; } APPLE_CHUNKLIST_HEADER;
#pragma pack(pop) #pragma pack(pop)
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
BOOLEAN BOOLEAN
OcAppleChunklistInitializeContext ( OcAppleChunklistInitializeContext (
OUT OC_APPLE_CHUNKLIST_CONTEXT *Context, OUT OC_APPLE_CHUNKLIST_CONTEXT *Context,
IN VOID *Buffer, IN OUT VOID *Buffer,
IN UINT32 BufferSize IN UINT32 BufferSize
) )
{ {
APPLE_CHUNKLIST_HEADER *ChunklistHeader; APPLE_CHUNKLIST_HEADER *ChunklistHeader;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <Uefi.h> #include <Uefi.h>
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h> #include <Library/UefiApplicationEntryPoint.h>
#include <Library/OcCryptoLib.h>
extern const UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize; extern const UINT32 _gPcd_FixedAtBuild_PcdUefiLibMaxPrintBufferSize;
extern const BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport; extern const BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport;
...@@ -28,3 +29,6 @@ extern const BOOLEAN _gPcd_FixedAtBuild_PcdVerifyNodeInList; ...@@ -28,3 +29,6 @@ extern const BOOLEAN _gPcd_FixedAtBuild_PcdVerifyNodeInList;
#define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength #define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength
#define _PCD_GET_MODE_32_PcdMaximumLinkedListLength _gPcd_FixedAtBuild_PcdMaximumLinkedListLength #define _PCD_GET_MODE_32_PcdMaximumLinkedListLength _gPcd_FixedAtBuild_PcdMaximumLinkedListLength
#define _PCD_GET_MODE_BOOL_PcdVerifyNodeInList _gPcd_FixedAtBuild_PcdVerifyNodeInList #define _PCD_GET_MODE_BOOL_PcdVerifyNodeInList _gPcd_FixedAtBuild_PcdVerifyNodeInList
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedRsaModuli (512U | 256U)
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedSigHashTypes \
(1U << OcSigHashTypeSha256) | (1U << OcSigHashTypeSha384) | (1U << OcSigHashTypeSha512)
...@@ -53,7 +53,7 @@ endif ...@@ -53,7 +53,7 @@ endif
# Skip including UDK when suggesting STANDALONE mode. # Skip including UDK when suggesting STANDALONE mode.
# #
ifneq ($(STANDALONE),1) ifneq ($(STANDALONE),1)
CFLAGS += -D NO_MSABI_VA_FUNCS CFLAGS += -D NO_MSABI_VA_FUNCS -D OC_TARGET_DEBUG
CFLAGS += -I$(UDK_PATH)/MdePkg/Include -I$(UDK_PATH)/MdePkg/Include/Library -I$(UDK_PATH)/MdePkg/Include/$(UDK_ARCH) CFLAGS += -I$(UDK_PATH)/MdePkg/Include -I$(UDK_PATH)/MdePkg/Include/Library -I$(UDK_PATH)/MdePkg/Include/$(UDK_ARCH)
CFLAGS += -I$(UDK_PATH)/UefiCpuPkg/Include CFLAGS += -I$(UDK_PATH)/UefiCpuPkg/Include
# #
......
...@@ -18,6 +18,3 @@ VPATH = ../../Library/OcCryptoLib:$\ ...@@ -18,6 +18,3 @@ VPATH = ../../Library/OcCryptoLib:$\
../../Library/OcCryptoLib/IA32:$\ ../../Library/OcCryptoLib/IA32:$\
../../Library/OcAppleKeysLib ../../Library/OcAppleKeysLib
include ../../User/Makefile include ../../User/Makefile
RsaDigitalSign.o:
$(CC) $(CFLAGS) -include OcCryptoConfig.h ../../Library/OcCryptoLib/RsaDigitalSign.c -o $@
#ifndef OC_CRYPTO_CONFIG_H
#define OC_CRYPTO_CONFIG_H
#include <Library/OcCryptoLib.h>
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedSigHashTypes \
(1U << OcSigHashTypeSha256) | (1U << OcSigHashTypeSha384) | (1U << OcSigHashTypeSha512)
#define _PCD_GET_MODE_16_PcdOcCryptoAllowedRsaModuli (512U | 256U)
#endif // OC_CRYPTO_CONFIG_H
/** @file
Copyright (c) 2018, vit9696. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#include "../Include/Uefi.h" #include "../Include/Uefi.h"
#include <Library/OcAppleChunklistLib.h> #include <Library/OcAppleChunklistLib.h>
...@@ -5,6 +10,13 @@ ...@@ -5,6 +10,13 @@
#include <Library/OcAppleRamDiskLib.h> #include <Library/OcAppleRamDiskLib.h>
#include <Library/OcAppleKeysLib.h> #include <Library/OcAppleKeysLib.h>
#include <Library/OcCompressionLib.h> #include <Library/OcCompressionLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/** /**
......
/** @file
Copyright (c) 2020, vit9696. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
**/
#include <Library/DebugLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcFileLib.h>
EFI_MEMORY_DESCRIPTOR *
OcGetCurrentMemoryMap (
OUT UINTN *MemoryMapSize,
OUT UINTN *DescriptorSize,
OUT UINTN *MapKey OPTIONAL,
OUT UINT32 *DescriptorVersion OPTIONAL,
OUT UINTN *OriginalMemoryMapSize OPTIONAL,
IN BOOLEAN IncludeSplitSpace
)
{
ASSERT (FALSE);
return NULL;
}
EFI_STATUS
GetFileSize (
IN EFI_FILE_PROTOCOL *File,
OUT UINT32 *Size
)
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
## @file
# Copyright (c) 2020, vit9696. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
##
PRODUCT = DiskImage$(SUFFIX)
OBJS = DiskImage.o \
FileDummy.o \
OcAppleChunklistLib.o \
OcAppleDiskImageLib.o \
OcAppleDiskImageLibInternal.o \
OcXmlLib.o \
Sha2.o \
BigNumWordMul64.o \
BigNumPrimitives.o \
BigNumMontgomery.o \
RsaDigitalSign.o \
SecureMem.o \
OcAppleKeysLib.o \
OcAsciiLib.o \
OcAppleRamDiskLib.o \
adler32.o \
compress.o \
crc32.o \
deflate.o \
infback.o \
inffast.o \
inflate.o \
inftrees.o \
trees.o \
uncompr.o \
zlib_uefi.o
VPATH = ../../Library/OcAppleChunklistLib:$\
../../Library/OcAppleDiskImageLib:$\
../../Library/OcAppleRamDiskLib:$\
../../Library/OcXmlLib:$\
../../Library/OcCryptoLib:$\
../../Library/OcCryptoLib/IA32:$\
../../Library/OcAppleKeysLib:$\
../../Library/OcStringLib:$\
../../Library/OcFileLib:$\
../../Library/OcCompressionLib/zlib
include ../../User/Makefile
...@@ -5,6 +5,7 @@ buildutil() { ...@@ -5,6 +5,7 @@ buildutil() {
"AppleEfiSignTool" "AppleEfiSignTool"
"ConfigValidity" "ConfigValidity"
"EfiResTool" "EfiResTool"
"DiskImage"
"disklabel" "disklabel"
"HelloWorld" "HelloWorld"
"icnspack" "icnspack"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册