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