UEFITool/common/peimage.cpp
Nikolaj Schlej 934ce1f3f8 Kaitai-based Intel ACM and BootGuard parsers
As the first step towards automated parsing, this change set replaces outdated BootGuard-related parsers with shiny new KaitaiStruct-based ones.
It also does the following:
- improves Intel FIT definitions by using the relevant specification
- adds sha1, sha384, sha512 and sm3 digest implementations
- updates LZMA SDK to v22.01
- moves GUIDs out of include files to prevent multiple instantiations
- enforces C++11
- adds Kaitai-based parsers for Intel FIT, BootGuard v1 and BootGuard v2 structures
- makes many small refactorings here, there and everywhere
2022-09-10 13:14:29 +02:00

35 lines
1.7 KiB
C++

/* peimage.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#include "peimage.h"
UString machineTypeToUString(UINT16 machineType)
{
switch (machineType) {
case EFI_IMAGE_FILE_MACHINE_AMD64: return UString("x86-64");
case EFI_IMAGE_FILE_MACHINE_ARM: return UString("ARM");
case EFI_IMAGE_FILE_MACHINE_ARMNT: return UString("ARMv7");
case EFI_IMAGE_FILE_MACHINE_APPLE_ARM: return UString("Apple ARM");
case EFI_IMAGE_FILE_MACHINE_AARCH64: return UString("AArch64");
case EFI_IMAGE_FILE_MACHINE_EBC: return UString("EBC");
case EFI_IMAGE_FILE_MACHINE_I386: return UString("x86");
case EFI_IMAGE_FILE_MACHINE_IA64: return UString("IA64");
case EFI_IMAGE_FILE_MACHINE_POWERPC: return UString("PowerPC");
case EFI_IMAGE_FILE_MACHINE_POWERPCFP: return UString("PowerPC FP");
case EFI_IMAGE_FILE_MACHINE_THUMB: return UString("ARM Thumb");
case EFI_IMAGE_FILE_MACHINE_RISCV32: return UString("RISC-V 32-bit");
case EFI_IMAGE_FILE_MACHINE_RISCV64: return UString("RISC-V 64-bit");
case EFI_IMAGE_FILE_MACHINE_RISCV128: return UString("RISC-V 128-bit");
}
return usprintf("Unknown %04Xh", machineType);
}