xref: /aosp_15_r20/external/vboot_reference/firmware/2lib/include/2id.h (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1*8617a60dSAndroid Build Coastguard Worker /* Copyright 2015 The ChromiumOS Authors
2*8617a60dSAndroid Build Coastguard Worker  * Use of this source code is governed by a BSD-style license that can be
3*8617a60dSAndroid Build Coastguard Worker  * found in the LICENSE file.
4*8617a60dSAndroid Build Coastguard Worker  *
5*8617a60dSAndroid Build Coastguard Worker  * Key ID, used to quickly match keys with signatures. There's not a standard
6*8617a60dSAndroid Build Coastguard Worker  * fingerprint for private keys, so we're using the sha1sum of the public key
7*8617a60dSAndroid Build Coastguard Worker  * in our keyb format. Pretty much anything would work as long as it's
8*8617a60dSAndroid Build Coastguard Worker  * resistant to collisions and easy to compare.
9*8617a60dSAndroid Build Coastguard Worker  */
10*8617a60dSAndroid Build Coastguard Worker 
11*8617a60dSAndroid Build Coastguard Worker #ifndef VBOOT_REFERENCE_2ID_H_
12*8617a60dSAndroid Build Coastguard Worker #define VBOOT_REFERENCE_2ID_H_
13*8617a60dSAndroid Build Coastguard Worker 
14*8617a60dSAndroid Build Coastguard Worker #include <stdint.h>
15*8617a60dSAndroid Build Coastguard Worker 
16*8617a60dSAndroid Build Coastguard Worker #ifdef __cplusplus
17*8617a60dSAndroid Build Coastguard Worker extern "C" {
18*8617a60dSAndroid Build Coastguard Worker #endif  /* __cplusplus */
19*8617a60dSAndroid Build Coastguard Worker 
20*8617a60dSAndroid Build Coastguard Worker #define VB2_ID_NUM_BYTES 20
21*8617a60dSAndroid Build Coastguard Worker 
22*8617a60dSAndroid Build Coastguard Worker struct vb2_id {
23*8617a60dSAndroid Build Coastguard Worker 	uint8_t raw[VB2_ID_NUM_BYTES];
24*8617a60dSAndroid Build Coastguard Worker } __attribute__((packed));
25*8617a60dSAndroid Build Coastguard Worker 
26*8617a60dSAndroid Build Coastguard Worker #define EXPECTED_ID_SIZE VB2_ID_NUM_BYTES
27*8617a60dSAndroid Build Coastguard Worker 
28*8617a60dSAndroid Build Coastguard Worker /* IDs to use for "keys" with sig_alg==VB2_SIG_NONE */
29*8617a60dSAndroid Build Coastguard Worker #define VB2_ID_NONE_SHA1   {{0x00, 0x01,}}
30*8617a60dSAndroid Build Coastguard Worker #define VB2_ID_NONE_SHA256 {{0x02, 0x56,}}
31*8617a60dSAndroid Build Coastguard Worker #define VB2_ID_NONE_SHA512 {{0x05, 0x12,}}
32*8617a60dSAndroid Build Coastguard Worker 
33*8617a60dSAndroid Build Coastguard Worker #ifdef __cplusplus
34*8617a60dSAndroid Build Coastguard Worker }
35*8617a60dSAndroid Build Coastguard Worker #endif  /* __cplusplus */
36*8617a60dSAndroid Build Coastguard Worker 
37*8617a60dSAndroid Build Coastguard Worker #endif  /* VBOOT_REFERENCE_2ID_H_ */
38