coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
metadata_hash.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only */
2
3
#ifndef _COMMONLIB_BSD_METADATA_HASH_H_
4
#define _COMMONLIB_BSD_METADATA_HASH_H_
5
6
#include <
stdint.h
>
7
#include <vb2_sha.h>
8
9
/* This structure is embedded somewhere in the (uncompressed) bootblock. */
10
struct
metadata_hash_anchor
{
11
uint8_t
magic
[8];
12
struct
vb2_hash
cbfs_hash
;
13
/* NOTE: This is just reserving space. sizeof(struct vb2_hash) may change between
14
configurations/versions and cannot be relied upon, so the FMAP hash must be placed
15
right after the actual data for the particular CBFS hash algorithm used ends. */
16
uint8_t
reserved_space_for_fmap_hash
[VB2_MAX_DIGEST_SIZE];
17
}
__packed
;
18
19
/* Always use this function to figure out the actual location of the FMAP hash. It always uses
20
the same algorithm as the CBFS hash. */
21
static
inline
uint8_t
*
metadata_hash_anchor_fmap_hash
(
struct
metadata_hash_anchor
*anchor)
22
{
23
return
anchor->
cbfs_hash
.raw + vb2_digest_size(anchor->
cbfs_hash
.algo);
24
}
25
26
/*
27
* Do not use this constant anywhere else in coreboot code to ensure the bit pattern really only
28
* appears once in the CBFS image. The only coreboot file allowed to use this is
29
* src/lib/metadata_anchor.c to define the actual anchor data structure. It is defined here so
30
* that it can be shared with cbfstool (which may use it freely).
31
*/
32
#define DO_NOT_USE_METADATA_HASH_ANCHOR_MAGIC_DO_NOT_USE "\xadMdtHsh\x15"
33
34
#endif
/* _COMMONLIB_BSD_MASTER_HASH_H_ */
__packed
struct metadata_hash_anchor __packed
metadata_hash_anchor_fmap_hash
static uint8_t * metadata_hash_anchor_fmap_hash(struct metadata_hash_anchor *anchor)
Definition:
metadata_hash.h:21
stdint.h
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
metadata_hash_anchor
Definition:
metadata_hash.h:10
metadata_hash_anchor::cbfs_hash
struct vb2_hash cbfs_hash
Definition:
metadata_hash.h:12
metadata_hash_anchor::magic
uint8_t magic[8]
Definition:
metadata_hash.h:11
metadata_hash_anchor::reserved_space_for_fmap_hash
uint8_t reserved_space_for_fmap_hash[VB2_MAX_DIGEST_SIZE]
Definition:
metadata_hash.h:16
src
commonlib
bsd
include
commonlib
bsd
metadata_hash.h
Generated by
1.9.1