1 /*
2  * Copyright (C) 2019-2022 Intel Corporation.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef SEED_H_
8 #define SEED_H_
9 
10 #define BOOTLOADER_SEED_MAX_ENTRIES     10U
11 #define BUP_MKHI_BOOTLOADER_SEED_LEN    64U
12 #define MAX_SEED_ARG_SIZE		1024U
13 
14 /* Structure of seed info */
15 struct seed_info {
16 	uint8_t cse_svn;
17 	uint8_t bios_svn;
18 	uint8_t padding[2];
19 	uint8_t seed[BUP_MKHI_BOOTLOADER_SEED_LEN];
20 };
21 
22 /* Structure of physical seed */
23 struct physical_seed {
24 	struct seed_info seed_list[BOOTLOADER_SEED_MAX_ENTRIES];
25 	uint32_t num_seeds;
26 	uint32_t pad;
27 };
28 
29 void init_seed(void);
30 
31 void fill_seed_arg(char *cmd_dst, size_t cmd_sz);
32 
33 bool derive_virtual_seed(struct seed_info *seed_list, uint32_t *num_seeds,
34 			 const uint8_t *salt, size_t salt_len, const uint8_t *info, size_t info_len);
35 
36 bool derive_attkb_enc_key(uint8_t *out_key);
37 
38 #endif /* SEED_H_ */
39