VirtualBox

source: vbox/trunk/include/iprt/formats/efi-signature.h

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette