mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-05-08 20:43:38 +02:00
chipsec-1.10.4.ebuild
This commit is contained in:
parent
f7faa647b3
commit
8c0c6c3aba
9 changed files with 974 additions and 2 deletions
|
|
@ -7,11 +7,11 @@ EAPI=8
|
|||
DISTUTILS_USE_PEP517=poetry
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
|
||||
inherit distutils-r1
|
||||
inherit distutils-r1 pypi
|
||||
|
||||
DESCRIPTION=""
|
||||
HOMEPAGE=""
|
||||
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
|
||||
#SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
|
||||
|
||||
LICENSE=""
|
||||
SLOT="0"
|
||||
|
|
|
|||
1
dev-util/chipsec/Manifest
Normal file
1
dev-util/chipsec/Manifest
Normal file
|
|
@ -0,0 +1 @@
|
|||
DIST chipsec-1.10.4.tar.gz 1006573 BLAKE2B 37fd423200a8bcdaeb8f66ea505d86872c8e863a5149f6c9778cd97f545f4406433a5145af191c23711990acb22e437373bd7ed28ef2b848d77073210b8b66d2 SHA512 dc5e70dfd18273ebcf7eee22061acc87f28a949dd4ebf629235973578e55ec75d7b53a87b7d2176b5143c8dd983ef007bacc3d4a1264dc828c5bf536f415e687
|
||||
33
dev-util/chipsec/chipsec-1.10.4.ebuild
Normal file
33
dev-util/chipsec/chipsec-1.10.4.ebuild
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
# https://projects.gentoo.org/python/guide/distutils.html#pep-517-build-systems
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
|
||||
inherit distutils-r1 pypi
|
||||
|
||||
DESCRIPTION="Platform Security Assessment Framework"
|
||||
HOMEPAGE="https://github.com/chipsec/chipsec"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 ~x86"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND="app-arch/brotli[${PYTHON_USEDEP}]"
|
||||
DEPEND="${RDEPEND}"
|
||||
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
||||
|
||||
#distutils_enable_tests pytest
|
||||
|
||||
src_prepare(){
|
||||
# https://github.com/chipsec/chipsec/issues/1755
|
||||
sed -i "/data_files/d" setup.py || die
|
||||
|
||||
# https://github.com/chipsec/chipsec/pull/1743
|
||||
cp -r "${FILESDIR}/Include" ./chipsec_tools/compression/ || die
|
||||
eapply_user
|
||||
}
|
||||
308
dev-util/chipsec/files/Include/Common/BaseTypes.h
Normal file
308
dev-util/chipsec/files/Include/Common/BaseTypes.h
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
/** @file
|
||||
Processor or Compiler specific defines for all supported processors.
|
||||
|
||||
This file is stand alone self consistent set of definitions.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __BASE_TYPES_H__
|
||||
#define __BASE_TYPES_H__
|
||||
|
||||
//
|
||||
// Include processor specific binding
|
||||
//
|
||||
#include <ProcessorBind.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
//
|
||||
// Modifiers to abstract standard types to aid in debug of problems
|
||||
//
|
||||
#define CONST const
|
||||
#define STATIC static
|
||||
#define VOID void
|
||||
|
||||
//
|
||||
// Modifiers for Data Types used to self document code.
|
||||
// This concept is borrowed for UEFI specification.
|
||||
//
|
||||
#ifndef IN
|
||||
//
|
||||
// Some other environments use this construct, so #ifndef to prevent
|
||||
// multiple definition.
|
||||
//
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
#endif
|
||||
|
||||
//
|
||||
// Constants. They may exist in other build structures, so #ifndef them.
|
||||
//
|
||||
#ifndef TRUE
|
||||
//
|
||||
// BugBug: UEFI specification claims 1 and 0. We are concerned about the
|
||||
// compiler portability so we did it this way.
|
||||
//
|
||||
#define TRUE ((BOOLEAN)(1==1))
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE ((BOOLEAN)(0==1))
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((VOID *) 0)
|
||||
#endif
|
||||
|
||||
//
|
||||
// Support for variable length argument lists using the ANSI standard.
|
||||
//
|
||||
// Since we are using the ANSI standard we used the standard naming and
|
||||
// did not follow the coding convention
|
||||
//
|
||||
// VA_LIST - typedef for argument list.
|
||||
// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
|
||||
// VA_END (VA_LIST Marker) - Clear Marker
|
||||
// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from
|
||||
// the ... list. You must know the size and pass it in this macro.
|
||||
//
|
||||
// example:
|
||||
//
|
||||
// UINTN
|
||||
// ExampleVarArg (
|
||||
// IN UINTN NumberOfArgs,
|
||||
// ...
|
||||
// )
|
||||
// {
|
||||
// VA_LIST Marker;
|
||||
// UINTN Index;
|
||||
// UINTN Result;
|
||||
//
|
||||
// //
|
||||
// // Initialize the Marker
|
||||
// //
|
||||
// VA_START (Marker, NumberOfArgs);
|
||||
// for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) {
|
||||
// //
|
||||
// // The ... list is a series of UINTN values, so average them up.
|
||||
// //
|
||||
// Result += VA_ARG (Marker, UINTN);
|
||||
// }
|
||||
//
|
||||
// VA_END (Marker);
|
||||
// return Result
|
||||
// }
|
||||
//
|
||||
|
||||
#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
|
||||
|
||||
//
|
||||
// Also support coding convention rules for var arg macros
|
||||
//
|
||||
#ifndef VA_START
|
||||
|
||||
// typedef CHAR8 *VA_LIST;
|
||||
// #define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
|
||||
// #define VA_ARG(ap, t) (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
|
||||
// #define VA_END(ap) (ap = (VA_LIST) 0)
|
||||
// Use the native arguments for tools.
|
||||
#define VA_START va_start
|
||||
#define VA_ARG va_arg
|
||||
#define VA_END va_end
|
||||
#define VA_LIST va_list
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
///
|
||||
/// 128 bit buffer containing a unique identifier value.
|
||||
/// Unless otherwise specified, aligned on a 64 bit boundary.
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Data1;
|
||||
UINT16 Data2;
|
||||
UINT16 Data3;
|
||||
UINT8 Data4[8];
|
||||
} GUID;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// 4-byte buffer. An IPv4 internet protocol address.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Addr[4];
|
||||
} IPv4_ADDRESS;
|
||||
|
||||
///
|
||||
/// 16-byte buffer. An IPv6 internet protocol address.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Addr[16];
|
||||
} IPv6_ADDRESS;
|
||||
|
||||
//
|
||||
// Macro that returns the byte offset of a field in a data structure.
|
||||
//
|
||||
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
|
||||
|
||||
///
|
||||
/// _CR - returns a pointer to the structure
|
||||
/// from one of its elements.
|
||||
///
|
||||
#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
|
||||
|
||||
///
|
||||
/// ALIGN_POINTER - aligns a pointer to the lowest boundary
|
||||
///
|
||||
#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
|
||||
|
||||
///
|
||||
/// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor
|
||||
///
|
||||
#define ALIGN_VARIABLE(Value, Adjustment) \
|
||||
Adjustment = 0U; \
|
||||
if ((UINTN) (Value) % sizeof (UINTN)) { \
|
||||
(Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \
|
||||
} \
|
||||
(Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
|
||||
|
||||
//
|
||||
// Return the maximum of two operands.
|
||||
// This macro returns the maximum of two operand specified by a and b.
|
||||
// Both a and b must be the same numerical types, signed or unsigned.
|
||||
//
|
||||
#define MAX(a, b) \
|
||||
(((a) > (b)) ? (a) : (b))
|
||||
|
||||
|
||||
//
|
||||
// Return the minimum of two operands.
|
||||
// This macro returns the minimal of two operand specified by a and b.
|
||||
// Both a and b must be the same numerical types, signed or unsigned.
|
||||
//
|
||||
#define MIN(a, b) \
|
||||
(((a) < (b)) ? (a) : (b))
|
||||
|
||||
|
||||
//
|
||||
// EFI Error Codes common to all execution phases
|
||||
//
|
||||
|
||||
typedef UINTN RETURN_STATUS;
|
||||
|
||||
///
|
||||
/// Set the upper bit to indicate EFI Error.
|
||||
///
|
||||
#define ENCODE_ERROR(a) ((RETURN_STATUS)(MAX_BIT | (a)))
|
||||
|
||||
#define ENCODE_WARNING(a) ((RETURN_STATUS)(a))
|
||||
#define RETURN_ERROR(a) (((INTN)(RETURN_STATUS)(a)) < 0)
|
||||
|
||||
#define RETURN_SUCCESS 0
|
||||
#define RETURN_LOAD_ERROR ENCODE_ERROR (1)
|
||||
#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)
|
||||
#define RETURN_UNSUPPORTED ENCODE_ERROR (3)
|
||||
#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)
|
||||
#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)
|
||||
#define RETURN_NOT_READY ENCODE_ERROR (6)
|
||||
#define RETURN_DEVICE_ERROR ENCODE_ERROR (7)
|
||||
#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)
|
||||
#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)
|
||||
#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)
|
||||
#define RETURN_VOLUME_FULL ENCODE_ERROR (11)
|
||||
#define RETURN_NO_MEDIA ENCODE_ERROR (12)
|
||||
#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)
|
||||
#define RETURN_NOT_FOUND ENCODE_ERROR (14)
|
||||
#define RETURN_ACCESS_DENIED ENCODE_ERROR (15)
|
||||
#define RETURN_NO_RESPONSE ENCODE_ERROR (16)
|
||||
#define RETURN_NO_MAPPING ENCODE_ERROR (17)
|
||||
#define RETURN_TIMEOUT ENCODE_ERROR (18)
|
||||
#define RETURN_NOT_STARTED ENCODE_ERROR (19)
|
||||
#define RETURN_ALREADY_STARTED ENCODE_ERROR (20)
|
||||
#define RETURN_ABORTED ENCODE_ERROR (21)
|
||||
#define RETURN_ICMP_ERROR ENCODE_ERROR (22)
|
||||
#define RETURN_TFTP_ERROR ENCODE_ERROR (23)
|
||||
#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)
|
||||
#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)
|
||||
#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)
|
||||
#define RETURN_CRC_ERROR ENCODE_ERROR (27)
|
||||
#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
|
||||
#define RETURN_END_OF_FILE ENCODE_ERROR (31)
|
||||
|
||||
#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
|
||||
#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
|
||||
#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)
|
||||
#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
|
||||
|
||||
typedef UINT64 PHYSICAL_ADDRESS;
|
||||
|
||||
#define BIT0 0x00000001
|
||||
#define BIT1 0x00000002
|
||||
#define BIT2 0x00000004
|
||||
#define BIT3 0x00000008
|
||||
#define BIT4 0x00000010
|
||||
#define BIT5 0x00000020
|
||||
#define BIT6 0x00000040
|
||||
#define BIT7 0x00000080
|
||||
#define BIT8 0x00000100
|
||||
#define BIT9 0x00000200
|
||||
#define BIT10 0x00000400
|
||||
#define BIT11 0x00000800
|
||||
#define BIT12 0x00001000
|
||||
#define BIT13 0x00002000
|
||||
#define BIT14 0x00004000
|
||||
#define BIT15 0x00008000
|
||||
#define BIT16 0x00010000
|
||||
#define BIT17 0x00020000
|
||||
#define BIT18 0x00040000
|
||||
#define BIT19 0x00080000
|
||||
#define BIT20 0x00100000
|
||||
#define BIT21 0x00200000
|
||||
#define BIT22 0x00400000
|
||||
#define BIT23 0x00800000
|
||||
#define BIT24 0x01000000
|
||||
#define BIT25 0x02000000
|
||||
#define BIT26 0x04000000
|
||||
#define BIT27 0x08000000
|
||||
#define BIT28 0x10000000
|
||||
#define BIT29 0x20000000
|
||||
#define BIT30 0x40000000
|
||||
#define BIT31 0x80000000
|
||||
#define BIT32 0x0000000100000000ULL
|
||||
#define BIT33 0x0000000200000000ULL
|
||||
#define BIT34 0x0000000400000000ULL
|
||||
#define BIT35 0x0000000800000000ULL
|
||||
#define BIT36 0x0000001000000000ULL
|
||||
#define BIT37 0x0000002000000000ULL
|
||||
#define BIT38 0x0000004000000000ULL
|
||||
#define BIT39 0x0000008000000000ULL
|
||||
#define BIT40 0x0000010000000000ULL
|
||||
#define BIT41 0x0000020000000000ULL
|
||||
#define BIT42 0x0000040000000000ULL
|
||||
#define BIT43 0x0000080000000000ULL
|
||||
#define BIT44 0x0000100000000000ULL
|
||||
#define BIT45 0x0000200000000000ULL
|
||||
#define BIT46 0x0000400000000000ULL
|
||||
#define BIT47 0x0000800000000000ULL
|
||||
#define BIT48 0x0001000000000000ULL
|
||||
#define BIT49 0x0002000000000000ULL
|
||||
#define BIT50 0x0004000000000000ULL
|
||||
#define BIT51 0x0008000000000000ULL
|
||||
#define BIT52 0x0010000000000000ULL
|
||||
#define BIT53 0x0020000000000000ULL
|
||||
#define BIT54 0x0040000000000000ULL
|
||||
#define BIT55 0x0080000000000000ULL
|
||||
#define BIT56 0x0100000000000000ULL
|
||||
#define BIT57 0x0200000000000000ULL
|
||||
#define BIT58 0x0400000000000000ULL
|
||||
#define BIT59 0x0800000000000000ULL
|
||||
#define BIT60 0x1000000000000000ULL
|
||||
#define BIT61 0x2000000000000000ULL
|
||||
#define BIT62 0x4000000000000000ULL
|
||||
#define BIT63 0x8000000000000000ULL
|
||||
|
||||
#endif
|
||||
9
dev-util/chipsec/files/Include/Common/BuildVersion.h
Normal file
9
dev-util/chipsec/files/Include/Common/BuildVersion.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/** @file
|
||||
This file is for build version number auto generation
|
||||
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#define __BUILD_VERSION "Developer Build based on Revision: Unknown"
|
||||
168
dev-util/chipsec/files/Include/Common/UefiBaseTypes.h
Normal file
168
dev-util/chipsec/files/Include/Common/UefiBaseTypes.h
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/** @file
|
||||
Defines data types and constants introduced in UEFI.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __UEFI_BASETYPE_H__
|
||||
#define __UEFI_BASETYPE_H__
|
||||
|
||||
#include <Common/BaseTypes.h>
|
||||
|
||||
//
|
||||
// Basical data type definitions introduced in UEFI.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Data1;
|
||||
UINT16 Data2;
|
||||
UINT16 Data3;
|
||||
UINT8 Data4[8];
|
||||
} EFI_GUID;
|
||||
|
||||
typedef RETURN_STATUS EFI_STATUS;
|
||||
typedef VOID *EFI_HANDLE;
|
||||
|
||||
typedef VOID *EFI_EVENT;
|
||||
|
||||
typedef UINTN EFI_TPL;
|
||||
|
||||
|
||||
typedef UINT64 EFI_LBA;
|
||||
|
||||
|
||||
typedef UINT16 STRING_REF;
|
||||
|
||||
typedef UINT64 EFI_PHYSICAL_ADDRESS;
|
||||
typedef UINT64 EFI_VIRTUAL_ADDRESS;
|
||||
|
||||
//
|
||||
// EFI Time Abstraction:
|
||||
// Year: 2000 - 20XX
|
||||
// Month: 1 - 12
|
||||
// Day: 1 - 31
|
||||
// Hour: 0 - 23
|
||||
// Minute: 0 - 59
|
||||
// Second: 0 - 59
|
||||
// Nanosecond: 0 - 999,999,999
|
||||
// TimeZone: -1440 to 1440 or 2047
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Year;
|
||||
UINT8 Month;
|
||||
UINT8 Day;
|
||||
UINT8 Hour;
|
||||
UINT8 Minute;
|
||||
UINT8 Second;
|
||||
UINT8 Pad1;
|
||||
UINT32 Nanosecond;
|
||||
INT16 TimeZone;
|
||||
UINT8 Daylight;
|
||||
UINT8 Pad2;
|
||||
} EFI_TIME;
|
||||
|
||||
|
||||
//
|
||||
// Networking Definitions
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Addr[4];
|
||||
} EFI_IPv4_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[16];
|
||||
} EFI_IPv6_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[32];
|
||||
} EFI_MAC_ADDRESS;
|
||||
|
||||
typedef union {
|
||||
UINT32 Addr[4];
|
||||
EFI_IPv4_ADDRESS v4;
|
||||
EFI_IPv6_ADDRESS v6;
|
||||
} EFI_IP_ADDRESS;
|
||||
|
||||
|
||||
//
|
||||
// Enumeration of EFI_STATUS.
|
||||
//
|
||||
#define EFI_SUCCESS RETURN_SUCCESS
|
||||
#define EFI_LOAD_ERROR RETURN_LOAD_ERROR
|
||||
#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
|
||||
#define EFI_UNSUPPORTED RETURN_UNSUPPORTED
|
||||
#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE
|
||||
#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL
|
||||
#define EFI_NOT_READY RETURN_NOT_READY
|
||||
#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR
|
||||
#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED
|
||||
#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES
|
||||
#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED
|
||||
#define EFI_VOLUME_FULL RETURN_VOLUME_FULL
|
||||
#define EFI_NO_MEDIA RETURN_NO_MEDIA
|
||||
#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
|
||||
#define EFI_NOT_FOUND RETURN_NOT_FOUND
|
||||
#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
|
||||
#define EFI_NO_RESPONSE RETURN_NO_RESPONSE
|
||||
#define EFI_NO_MAPPING RETURN_NO_MAPPING
|
||||
#define EFI_TIMEOUT RETURN_TIMEOUT
|
||||
#define EFI_NOT_STARTED RETURN_NOT_STARTED
|
||||
#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED
|
||||
#define EFI_ABORTED RETURN_ABORTED
|
||||
#define EFI_ICMP_ERROR RETURN_ICMP_ERROR
|
||||
#define EFI_TFTP_ERROR RETURN_TFTP_ERROR
|
||||
#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR
|
||||
#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION
|
||||
#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION
|
||||
#define EFI_CRC_ERROR RETURN_CRC_ERROR
|
||||
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
|
||||
#define EFI_END_OF_FILE RETURN_END_OF_FILE
|
||||
|
||||
#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
|
||||
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
|
||||
#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE
|
||||
#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
|
||||
|
||||
|
||||
#define NULL_HANDLE ((VOID *) 0)
|
||||
|
||||
//
|
||||
// Define macro to encode the status code.
|
||||
//
|
||||
#define EFIERR(_a) ENCODE_ERROR(_a)
|
||||
|
||||
#define EFI_ERROR(A) RETURN_ERROR(A)
|
||||
|
||||
//
|
||||
// Define macros to build data structure signatures from characters.
|
||||
//
|
||||
#define SIGNATURE_16(A, B) ((A) | (B << 8))
|
||||
#define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
|
||||
#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
|
||||
(SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
|
||||
|
||||
|
||||
//
|
||||
// Returns the byte offset to a field within a structure
|
||||
//
|
||||
#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
|
||||
|
||||
//
|
||||
// The EFI memory allocation functions work in units of EFI_PAGEs that are
|
||||
// 4K. This should in no way be confused with the page size of the processor.
|
||||
// An EFI_PAGE is just the quanta of memory in EFI.
|
||||
//
|
||||
#define EFI_PAGE_SIZE 0x1000
|
||||
#define EFI_PAGE_MASK 0xFFF
|
||||
#define EFI_PAGE_SHIFT 12
|
||||
|
||||
#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))
|
||||
|
||||
#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)
|
||||
|
||||
|
||||
#define EFI_MAX_BIT MAX_BIT
|
||||
|
||||
#endif
|
||||
111
dev-util/chipsec/files/Include/Compress.h
Normal file
111
dev-util/chipsec/files/Include/Compress.h
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/** CHIPSEC: Platform Security Assessment Framework
|
||||
Copyright (c) 2019, Intel Corporation
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; Version 2.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Contact information:
|
||||
chipsec@intel.com
|
||||
|
||||
This file incorporates work covered by the following copyright and permission notice
|
||||
**/
|
||||
|
||||
/** @file
|
||||
Header file for compression routine.
|
||||
Providing both EFI and Tiano Compress algorithms.
|
||||
|
||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _COMPRESS_H_
|
||||
#define _COMPRESS_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Tiano compression routine.
|
||||
|
||||
--*/
|
||||
EFI_STATUS
|
||||
TianoCompress (
|
||||
IN UINT8 *SrcBuffer,
|
||||
IN UINT32 SrcSize,
|
||||
IN UINT8 *DstBuffer,
|
||||
IN OUT UINT32 *DstSize
|
||||
)
|
||||
;
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Efi compression routine.
|
||||
|
||||
--*/
|
||||
EFI_STATUS
|
||||
EfiCompress (
|
||||
IN UINT8 *SrcBuffer,
|
||||
IN UINT32 SrcSize,
|
||||
IN UINT8 *DstBuffer,
|
||||
IN OUT UINT32 *DstSize
|
||||
)
|
||||
;
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The compression routine.
|
||||
|
||||
Arguments:
|
||||
|
||||
SrcBuffer - The buffer storing the source data
|
||||
SrcSize - The size of source data
|
||||
DstBuffer - The buffer to store the compressed data
|
||||
DstSize - On input, the size of DstBuffer; On output,
|
||||
the size of the actual compressed data.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
|
||||
DstSize contains the size needed.
|
||||
EFI_SUCCESS - Compression is successful.
|
||||
EFI_OUT_OF_RESOURCES - No resource to complete function.
|
||||
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
|
||||
|
||||
--*/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*COMPRESS_FUNCTION) (
|
||||
IN UINT8 *SrcBuffer,
|
||||
IN UINT32 SrcSize,
|
||||
IN UINT8 *DstBuffer,
|
||||
IN OUT UINT32 *DstSize
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
Pack (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
OUT VOID **Destination,
|
||||
OUT UINT32 *DstSize,
|
||||
IN UINTN Algorithm
|
||||
);
|
||||
|
||||
#endif
|
||||
159
dev-util/chipsec/files/Include/Decompress.h
Normal file
159
dev-util/chipsec/files/Include/Decompress.h
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
/** @file
|
||||
Header file for compression routine
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_DECOMPRESS_H
|
||||
#define _EFI_DECOMPRESS_H
|
||||
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
|
||||
EFI_STATUS
|
||||
EfiGetInfo (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
OUT UINT32 *DstSize,
|
||||
OUT UINT32 *ScratchSize
|
||||
);
|
||||
/**
|
||||
|
||||
Routine Description:
|
||||
|
||||
The implementation Efi Decompress GetInfo().
|
||||
|
||||
Arguments:
|
||||
|
||||
Source - The source buffer containing the compressed data.
|
||||
SrcSize - The size of source buffer
|
||||
DstSize - The size of destination buffer.
|
||||
ScratchSize - The size of scratch buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
|
||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
EfiDecompress (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
IN OUT VOID *Destination,
|
||||
IN UINT32 DstSize,
|
||||
IN OUT VOID *Scratch,
|
||||
IN UINT32 ScratchSize
|
||||
);
|
||||
/**
|
||||
|
||||
Routine Description:
|
||||
|
||||
The implementation of Efi Decompress().
|
||||
|
||||
Arguments:
|
||||
|
||||
Source - The source buffer containing the compressed data.
|
||||
SrcSize - The size of source buffer
|
||||
Destination - The destination buffer to store the decompressed data
|
||||
DstSize - The size of destination buffer.
|
||||
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||
ScratchSize - The size of scratch buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Decompression is successful
|
||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
TianoGetInfo (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
OUT UINT32 *DstSize,
|
||||
OUT UINT32 *ScratchSize
|
||||
);
|
||||
/**
|
||||
|
||||
Routine Description:
|
||||
|
||||
The implementation Tiano Decompress GetInfo().
|
||||
|
||||
Arguments:
|
||||
|
||||
Source - The source buffer containing the compressed data.
|
||||
SrcSize - The size of source buffer
|
||||
DstSize - The size of destination buffer.
|
||||
ScratchSize - The size of scratch buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
|
||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
TianoDecompress (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
IN OUT VOID *Destination,
|
||||
IN UINT32 DstSize,
|
||||
IN OUT VOID *Scratch,
|
||||
IN UINT32 ScratchSize
|
||||
);
|
||||
/**
|
||||
|
||||
Routine Description:
|
||||
|
||||
The implementation of Tiano Decompress().
|
||||
|
||||
Arguments:
|
||||
|
||||
Source - The source buffer containing the compressed data.
|
||||
SrcSize - The size of source buffer
|
||||
Destination - The destination buffer to store the decompressed data
|
||||
DstSize - The size of destination buffer.
|
||||
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||
ScratchSize - The size of scratch buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Decompression is successful
|
||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||
|
||||
**/
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*GETINFO_FUNCTION) (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
OUT UINT32 *DstSize,
|
||||
OUT UINT32 *ScratchSize
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*DECOMPRESS_FUNCTION) (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
IN OUT VOID *Destination,
|
||||
IN UINT32 DstSize,
|
||||
IN OUT VOID *Scratch,
|
||||
IN UINT32 ScratchSize
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
Extract (
|
||||
IN VOID *Source,
|
||||
IN UINT32 SrcSize,
|
||||
OUT VOID **Destination,
|
||||
OUT UINT32 *DstSize,
|
||||
IN UINTN Algorithm
|
||||
);
|
||||
|
||||
#endif
|
||||
183
dev-util/chipsec/files/Include/X64/ProcessorBind.h
Normal file
183
dev-util/chipsec/files/Include/X64/ProcessorBind.h
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
/** @file
|
||||
Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
//
|
||||
// Define the processor type so other code can make processor based choices
|
||||
//
|
||||
#define MDE_CPU_X64
|
||||
|
||||
|
||||
//
|
||||
// Make sure we are useing the correct packing rules per EFI specification
|
||||
//
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
|
||||
#if _MSC_EXTENSIONS
|
||||
|
||||
//
|
||||
// Disable warning that make it impossible to compile at /W4
|
||||
// This only works for Microsoft* tools
|
||||
//
|
||||
|
||||
//
|
||||
// Disabling bitfield type checking warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4214 )
|
||||
|
||||
//
|
||||
// Disabling the unreferenced formal parameter warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4100 )
|
||||
|
||||
//
|
||||
// Disable slightly different base types warning as CHAR8 * can not be set
|
||||
// to a constant string.
|
||||
//
|
||||
#pragma warning ( disable : 4057 )
|
||||
|
||||
//
|
||||
// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
|
||||
//
|
||||
#pragma warning ( disable : 4127 )
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
|
||||
//
|
||||
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
|
||||
//
|
||||
|
||||
#if _MSC_EXTENSIONS
|
||||
|
||||
|
||||
//
|
||||
// use Microsoft C compiler dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef char INT8;
|
||||
#else
|
||||
#ifdef _EFI_P64
|
||||
//
|
||||
// P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
|
||||
// are 32-bits
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef unsigned short UINT16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef char INT8;
|
||||
#else
|
||||
//
|
||||
// Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
|
||||
//
|
||||
typedef unsigned long UINT64;
|
||||
typedef long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef char INT8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define UINT8_MAX 0xff
|
||||
|
||||
#else
|
||||
//
|
||||
// Use ANSI C 2000 stdint.h integer width declarations
|
||||
//
|
||||
#include <stdint.h>
|
||||
typedef uint8_t BOOLEAN;
|
||||
typedef int8_t INT8;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int16_t INT16;
|
||||
typedef uint16_t UINT16;
|
||||
typedef int32_t INT32;
|
||||
typedef uint32_t UINT32;
|
||||
typedef int64_t INT64;
|
||||
typedef uint64_t UINT64;
|
||||
typedef char CHAR8;
|
||||
typedef uint16_t CHAR16;
|
||||
|
||||
#endif
|
||||
|
||||
typedef UINT64 UINTN;
|
||||
typedef INT64 INTN;
|
||||
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
//
|
||||
#define MAX_BIT 0x8000000000000000ULL
|
||||
#define MAX_2_BITS 0xC000000000000000ULL
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
// use the correct C calling convention. All protocol member functions and
|
||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||
//
|
||||
#if _MSC_EXTENSIONS
|
||||
///
|
||||
/// Define the standard calling convention regardless of optimization level.
|
||||
/// __cdecl is Microsoft* specific C extension.
|
||||
///
|
||||
#define EFIAPI __cdecl
|
||||
#elif __GNUC__
|
||||
///
|
||||
/// Define the standard calling convention regardless of optimization level.
|
||||
/// efidecl is an extension to GCC that supports the differnece between x64
|
||||
/// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and
|
||||
/// EFIAPI makes sure the right ABI is used for public interfaces.
|
||||
/// eficecl is a work in progress and we do not yet have the compiler
|
||||
///
|
||||
#define EFIAPI
|
||||
#else
|
||||
#define EFIAPI
|
||||
#endif
|
||||
|
||||
//
|
||||
// The Microsoft* C compiler can removed references to unreferenced data items
|
||||
// if the /OPT:REF linker option is used. We defined a macro as this is a
|
||||
// a non standard extension
|
||||
//
|
||||
#if _MSC_EXTENSIONS
|
||||
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
|
||||
#else
|
||||
#define GLOBAL_REMOVE_IF_UNREFERENCED
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in a new issue