TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeImageVerificationLib.h
Go to the documentation of this file.
1
10#ifndef __IMAGEVERIFICATIONLIB_H__
11#define __IMAGEVERIFICATIONLIB_H__
12
14#include <Library/DebugLib.h>
18#include <Library/UefiLib.h>
19#include <Library/BaseLib.h>
22#include <Library/PcdLib.h>
25#include <Library/PeCoffLib.h>
27#include <Protocol/DevicePath.h>
28#include <Protocol/BlockIo.h>
34
35#define EFI_CERT_TYPE_RSA2048_SHA256_SIZE 256
36#define EFI_CERT_TYPE_RSA2048_SIZE 256
37#define MAX_NOTIFY_STRING_LEN 64
38#define TWO_BYTE_ENCODE 0x82
39
40#define ALIGNMENT_SIZE 8
41#define ALIGN_SIZE(a) (((a) % ALIGNMENT_SIZE) ? ALIGNMENT_SIZE - ((a) % ALIGNMENT_SIZE) : 0)
42
43//
44// Image type definitions
45//
46#define IMAGE_UNKNOWN 0x00000000
47#define IMAGE_FROM_FV 0x00000001
48#define IMAGE_FROM_OPTION_ROM 0x00000002
49#define IMAGE_FROM_REMOVABLE_MEDIA 0x00000003
50#define IMAGE_FROM_FIXED_MEDIA 0x00000004
51
52//
53// Authorization policy bit definition
54//
55#define ALWAYS_EXECUTE 0x00000000
56#define NEVER_EXECUTE 0x00000001
57#define ALLOW_EXECUTE_ON_SECURITY_VIOLATION 0x00000002
58#define DEFER_EXECUTE_ON_SECURITY_VIOLATION 0x00000003
59#define DENY_EXECUTE_ON_SECURITY_VIOLATION 0x00000004
60#define QUERY_USER_ON_SECURITY_VIOLATION 0x00000005
61
62//
63// Support hash types
64//
65#define HASHALG_SHA1 0x00000000
66#define HASHALG_SHA224 0x00000001
67#define HASHALG_SHA256 0x00000002
68#define HASHALG_SHA384 0x00000003
69#define HASHALG_SHA512 0x00000004
70#define HASHALG_MAX 0x00000005
71
72//
73// Set max digest size as SHA512 Output (64 bytes) by far
74//
75#define MAX_DIGEST_SIZE SHA512_DIGEST_SIZE
76//
77//
78// PKCS7 Certificate definition
79//
80typedef struct {
82 UINT8 CertData[1];
84
91typedef
93(EFIAPI *HASH_GET_CONTEXT_SIZE)(
94 VOID
95 );
96
109typedef
110BOOLEAN
111(EFIAPI *HASH_INIT)(
112 IN OUT VOID *HashContext
113 );
114
130typedef
131BOOLEAN
132(EFIAPI *HASH_UPDATE)(
133 IN OUT VOID *HashContext,
134 IN CONST VOID *Data,
135 IN UINTN DataLength
136 );
137
153typedef
154BOOLEAN
155(EFIAPI *HASH_FINAL)(
156 IN OUT VOID *HashContext,
157 OUT UINT8 *HashValue
158 );
159
160//
161// Hash Algorithm Table
162//
163typedef struct {
164 //
165 // Name for Hash Algorithm
166 //
167 CHAR16 *Name;
168 //
169 // Digest Length
170 //
172 //
173 // Hash Algorithm OID ASN.1 Value
174 //
175 UINT8 *OidValue;
176 //
177 // Length of Hash OID Value
178 //
180 //
181 // Pointer to Hash GetContentSize function
182 //
184 //
185 // Pointer to Hash Init function
186 //
188 //
189 // Pointer to Hash Update function
190 //
192 //
193 // Pointer to Hash Final function
194 //
196} HASH_TABLE;
197
198#endif
UINT64 UINTN
BOOLEAN(EFIAPI * HASH_UPDATE)(IN OUT VOID *HashContext, IN CONST VOID *Data, IN UINTN DataLength)
BOOLEAN(EFIAPI * HASH_INIT)(IN OUT VOID *HashContext)
UINTN(EFIAPI * HASH_GET_CONTEXT_SIZE)(VOID)
BOOLEAN(EFIAPI * HASH_FINAL)(IN OUT VOID *HashContext, OUT UINT8 *HashValue)
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
HASH_FINAL HashFinal
Pointer to Hash Final function.
UINTN DigestLength
Digest Length.
UINTN OidLength
Length of Hash OID Value.
CHAR16 * Name
Name for Hash Algorithm.
HASH_UPDATE HashUpdate
Pointer to Hash Update function.
UINT8 * OidValue
Hash Algorithm OID ASN.1 Value.
HASH_GET_CONTEXT_SIZE GetContextSize
Pointer to Hash GetContentSize function.
HASH_INIT HashInit
Pointer to Hash Init function.