OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OpenCoreVault.c
Go to the documentation of this file.
1
15#include <Library/OcMainLib.h>
16
17typedef struct {
19 UINT64 Data[(2 * (2048 / OC_CHAR_BIT)) / sizeof (UINT64)];
21
22typedef struct {
23 CHAR8 StartMagic[16];
25 CHAR8 EndMagic[16];
27
28BASE_ALIGNAS (16)
29STATIC
32 .StartMagic = { '=', 'B', 'E', 'G', 'I', 'N', ' ', 'O', 'C', ' ', 'V', 'A', 'U', 'L', 'T', '=' },
33 .EndMagic = { '=', '=', 'E', 'N', 'D', ' ', 'O', 'C', ' ', 'V', 'A', 'U', 'L', 'T', '=', '=' }
34};
35
38 VOID
39 )
40{
41 UINT32 Index;
42 BOOLEAN AllZero;
43
45 sizeof (OC_RSA_PUBLIC_KEY_2048) == 528,
46 "sizeof(OC_RSA_PUBLIC_KEY_2048)"
47 );
49 sizeof (OC_BUILTIN_VAULT_KEY) == sizeof (OC_RSA_PUBLIC_KEY_2048) + 32,
50 "sizeof(OC_BUILTIN_VAULT_KEY)"
51 );
52
53 //
54 // TODO: Perhaps try to get the key from firmware too?
55 //
56
57 AllZero = TRUE;
58 for (Index = 0; Index < sizeof (OC_RSA_PUBLIC_KEY); ++Index) {
59 if (((UINT8 *)&mOpenCoreVaultKey.VaultKey)[Index] != 0) {
60 AllZero = FALSE;
61 break;
62 }
63 }
64
65 if (!AllZero) {
67 }
68
69 return NULL;
70}
SMBIOS_STRUCTURE Hdr
Definition AppleSmBios.h:51
STATIC_ASSERT(BYTES_PER_PIXEL==sizeof(UINT32), "Non 4-byte pixels are unsupported!")
#define OC_CHAR_BIT
Definition OcMiscLib.h:25
STATIC OC_BUILTIN_VAULT_KEY mOpenCoreVaultKey
OC_RSA_PUBLIC_KEY * OcGetVaultKey(VOID)
OC_RSA_PUBLIC_KEY_2048 VaultKey