1 | /* $Id: efi-signature.h 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT, EFI signature database definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2021-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef IPRT_INCLUDED_formats_efi_signature_h
|
---|
28 | #define IPRT_INCLUDED_formats_efi_signature_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <iprt/types.h>
|
---|
34 | #include <iprt/assertcompile.h>
|
---|
35 | #include <iprt/formats/efi-common.h>
|
---|
36 |
|
---|
37 |
|
---|
38 | /*
|
---|
39 | * Definitions come from the UEFI 2.6 specification, chapter 30.4.1
|
---|
40 | */
|
---|
41 |
|
---|
42 | /** The GUID used for setting and retrieving variables from the variable store. */
|
---|
43 | #define EFI_IMAGE_SECURITY_DATABASE_GUID \
|
---|
44 | { 0xd719b2cb, 0x3d3a, 0x4596, { 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f }}
|
---|
45 |
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Signature entry data.
|
---|
49 | */
|
---|
50 | typedef struct EFI_SIGNATURE_DATA
|
---|
51 | {
|
---|
52 | /** The GUID of the owner of the signature. */
|
---|
53 | EFI_GUID GuidOwner;
|
---|
54 | /** The signature data follows (size varies depending on the signature type). */
|
---|
55 | } EFI_SIGNATURE_DATA;
|
---|
56 | AssertCompileSize(EFI_SIGNATURE_DATA, 16);
|
---|
57 | /** Pointer to a signature entry. */
|
---|
58 | typedef EFI_SIGNATURE_DATA *PEFI_SIGNATURE_DATA;
|
---|
59 | /** Pointer to a const signature entry. */
|
---|
60 | typedef const EFI_SIGNATURE_DATA *PCEFI_SIGNATURE_DATA;
|
---|
61 |
|
---|
62 | /** Microsoft's GUID for signatures. */
|
---|
63 | #define EFI_SIGNATURE_OWNER_GUID_MICROSOFT \
|
---|
64 | { 0x77fa9abd, 0x0359, 0x4d32, { 0xbd, 0x60, 0x28, 0xf4, 0xe7, 0x8f, 0x78, 0x4b }}
|
---|
65 |
|
---|
66 | /** VirtualBox's GUID for signatures. */
|
---|
67 | #define EFI_SIGNATURE_OWNER_GUID_VBOX \
|
---|
68 | { 0x9400896a, 0x146c, 0x4f4c, { 0x96, 0x47, 0x2c, 0x73, 0x62, 0x0c, 0xa8, 0x94 }}
|
---|
69 |
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Signature list header.
|
---|
73 | */
|
---|
74 | typedef struct EFI_SIGNATURE_LIST
|
---|
75 | {
|
---|
76 | /** The signature type stored in this list. */
|
---|
77 | EFI_GUID GuidSigType;
|
---|
78 | /** Size of the signature list in bytes. */
|
---|
79 | uint32_t cbSigLst;
|
---|
80 | /** Size of the optional signature header following this header in bytes. */
|
---|
81 | uint32_t cbSigHdr;
|
---|
82 | /** Size of each signature entry in bytes, must be at least the size of EFI_SIGNATURE_DATA. */
|
---|
83 | uint32_t cbSig;
|
---|
84 | // uint8_t abSigHdr[];
|
---|
85 | // EFI_SIGNATURE_DATA aSigs[];
|
---|
86 | } EFI_SIGNATURE_LIST;
|
---|
87 | AssertCompileSize(EFI_SIGNATURE_LIST, 28);
|
---|
88 | /** Pointer to a signature list header. */
|
---|
89 | typedef EFI_SIGNATURE_LIST *PEFI_SIGNATURE_LIST;
|
---|
90 | /** Pointer to a const signature list header. */
|
---|
91 | typedef const EFI_SIGNATURE_LIST *PCEFI_SIGNATURE_LIST;
|
---|
92 |
|
---|
93 | /** Signature contains a SHA256 hash. */
|
---|
94 | #define EFI_SIGNATURE_TYPE_GUID_SHA256 \
|
---|
95 | { 0xc1c41626, 0x504c, 0x4092, { 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28 }}
|
---|
96 | /** Size of a SHA256 signature entry (GUID + 32 bytes for the hash). */
|
---|
97 | #define EFI_SIGNATURE_TYPE_SZ_SHA256 UINT32_C(48)
|
---|
98 |
|
---|
99 | /** Signature contains a RSA2048 key. */
|
---|
100 | #define EFI_SIGNATURE_TYPE_GUID_RSA2048 \
|
---|
101 | { 0x3c5766e8, 0x269c, 0x4e34, { 0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85, 0xb3, 0xb6 }}
|
---|
102 | /** Size of a RSA2048 signature entry (GUID + 256 for the key). */
|
---|
103 | #define EFI_SIGNATURE_TYPE_SZ_RSA2048 UINT32_C(272)
|
---|
104 |
|
---|
105 | /** Signature contains a RSA2048 signature of a SHA256 hash. */
|
---|
106 | #define EFI_SIGNATURE_TYPE_GUID_RSA2048_SHA256 \
|
---|
107 | { 0xe2b36190, 0x879b, 0x4a3d, { 0xad, 0x8d, 0xf2, 0xe7, 0xbb, 0xa3, 0x27, 0x84 }}
|
---|
108 | /** Size of a RSA2048 signature entry (GUID + 256 for the key). */
|
---|
109 | #define EFI_SIGNATURE_TYPE_SZ_RSA2048_SHA256 UINT32_C(272)
|
---|
110 |
|
---|
111 | /** Signature contains a SHA1 hash. */
|
---|
112 | #define EFI_SIGNATURE_TYPE_GUID_SHA1 \
|
---|
113 | { 0x826ca512, 0xcf10, 0x4ac9, { 0xb1, 0x87, 0xbe, 0x01, 0x49, 0x66, 0x31, 0xbd }}
|
---|
114 | /** Size of a SHA1 signature entry (GUID + 20 bytes for the hash). */
|
---|
115 | #define EFI_SIGNATURE_TYPE_SZ_SHA1 UINT32_C(36)
|
---|
116 |
|
---|
117 | /** Signature contains a RSA2048 signature of a SHA1 hash. */
|
---|
118 | #define EFI_SIGNATURE_TYPE_GUID_RSA2048_SHA1 \
|
---|
119 | { 0x67f8444f, 0x8743, 0x48f1, { 0xa3, 0x28, 0x1e, 0xaa, 0xb8, 0x73, 0x60, 0x80 }}
|
---|
120 | /** Size of a RSA2048 signature entry (GUID + 256 for the key). */
|
---|
121 | #define EFI_SIGNATURE_TYPE_SZ_RSA2048_SHA1 UINT32_C(272)
|
---|
122 |
|
---|
123 | /** Signature contains a DER encoded X.509 certificate (size varies with each certificate). */
|
---|
124 | #define EFI_SIGNATURE_TYPE_GUID_X509 \
|
---|
125 | { 0xa5c059a1, 0x94e4, 0x4aa7, { 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72 }}
|
---|
126 |
|
---|
127 | #endif /* !IPRT_INCLUDED_formats_efi_signature_h */
|
---|
128 |
|
---|