forked from Intel-BMC/intel-pfr-signing-utility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.h
131 lines (119 loc) · 3.01 KB
/
args.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
// Copyright (c) 2020 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
#pragma once
#include <stdint.h>
#include <stddef.h>
#define EXPECT_VERSION 1
#define CANCELLATION_BIT 0x100
#define EC_POINT_MAX 48
#define EC_POINT_384 48
#define EC_POINT_256 32
// CLI Stuff
#define CLI_CONFIG "-c"
#define CLI_OUTPUT "-o"
#define CLI_PARSE "-p"
#define CLI_VERBOSE "-v"
// Hash Algorithms
#define HASH_SHA1_STR "SHA1"
#define HASH_SHA256_STR "SHA256"
#define HASH_SHA384_STR "SHA384"
#define HASH_SHA512_STR "SHA512"
// Element Defs
#define ELEMENT_BLOCKSIGN "BLOCKSIGN"
#define ELEMENT_VERSION "VERSION"
#define ELEMENT_BLOCK1 "BLOCK1"
#define ELEMENT_BLOCK0 "BLOCK0"
#define ELEMENT_B0SIG "B0_SIG"
#define ELEMENT_SIGMAGIC "SIGMAGIC"
#define ELEMENT_MAGIC "MAGIC"
#define ELEMENT_PCTYPE "PCTYPE"
#define ELEMENT_RKEY "RKEY"
#define ELEMENT_CSKEY "CSKEY"
#define ELEMENT_PERMISSIONS "PERMISSIONS"
#define ELEMENT_KEYID "KEYID"
#define ELEMENT_PUBKEY "PUBKEY"
#define ELEMENT_CURVEMAGIC "CURVEMAGIC"
#define ELEMENT_HASHALG "HASHALG"
#define ELEMENT_SIGNKEY "SIGNKEY"
#define ELEMENT_SCRIPT "SCRIPT"
#define ELEMENT_PADDING "PADDING"
#define ELEMENT_BLOCKPAD "BLOCKPAD"
#define ELEMENT_ALIGN "ALIGN"
#define ELEMENT_CPLD "CPLD"
#define ELEMENT_BYTESWAP "SWAPBYTES"
#define ELEMENT_CPLDSVN "SVN"
#define ELEMENT_CPLDOEMDATA "OEMDATA"
#define OEM_DATA_SIZE 16
#define OEM_HEX_MIN_LEN 3
#define OEM_HEX_MAX_LEN 34
// True False Tags
#define TAG_TRUE "TRUE"
#define TAG_FALSE "FALSE"
typedef struct _B1_RK
{
uint32_t magic;
uint32_t curve_magic;
char *pubkey;
int32_t permissions;
int32_t keyid;
} B1_RK;
typedef struct _B1_CSK
{
uint32_t magic;
uint32_t curve_magic;
char *script_file;
char *sign_key;
char *pubkey;
uint16_t hashalg;
uint32_t sig_magic;
int32_t permissions;
int32_t keyid;
} B1_CSK;
typedef struct _B0_SIG
{
uint32_t magic;
uint32_t sig_magic;
uint16_t hashalg;
char *script_file; // script to call for external
char *sign_key;
} B0_SIG;
typedef struct _B1_ARGUMENTS
{
uint32_t magic;
B1_RK root_key;
B1_CSK cskey;
B0_SIG b0sig;
} B1_ARGUMENTS;
typedef struct _B0_ARGUMENTS
{
uint32_t magic;
uint32_t pctype;
} B0_ARGUMENTS;
typedef struct _ARGUMENTS
{
uint8_t swapbytes;
uint32_t svn;
uint8_t *oemData;
uint8_t version;
uint8_t verbose;
uint8_t parse;
size_t align;
uint32_t blockpad;
char *inputBinary;
char *outputBinary;
B0_ARGUMENTS b0_args;
B1_ARGUMENTS b1_args;
} ARGUMENTS;