| 1 |
|
| 2 |
|
| 3 |
#ifndef _CBFS_GLUE_H_ |
| 4 |
#define _CBFS_GLUE_H_ |
| 5 |
|
| 6 |
#include <commonlib/region.h> |
| 7 |
#include <console/console.h> |
| 8 |
#include <security/vboot/misc.h> |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#define CBFS_ENABLE_HASHING (CONFIG(CBFS_VERIFICATION) && \ |
| 22 |
(CONFIG(TOCTOU_SAFETY) || ENV_INITIAL_STAGE || \ |
| 23 |
(CONFIG(VBOOT_CBFS_INTEGRATION) && \ |
| 24 |
(verification_should_run() || \ |
| 25 |
(verstage_should_load() && \ |
| 26 |
CONFIG(VBOOT_RETURN_FROM_VERSTAGE)))))) |
| 27 |
#define CBFS_HASH_HWCRYPTO vboot_hwcrypto_allowed() |
| 28 |
|
| 29 |
#define ERROR(...) printk(BIOS_ERR, "CBFS ERROR: " __VA_ARGS__) |
| 30 |
#define LOG(...) printk(BIOS_INFO, "CBFS: " __VA_ARGS__) |
| 31 |
#define DEBUG(...) do { \ |
| 32 |
if (CONFIG(DEBUG_CBFS)) \ |
| 33 |
printk(BIOS_SPEW, "CBFS DEBUG: " __VA_ARGS__); \ |
| 34 |
} while (0) |
| 35 |
|
| 36 |
typedef const struct region_device *cbfs_dev_t; |
| 37 |
|
| 38 |
static inline ssize_t cbfs_dev_read(cbfs_dev_t dev, void *buffer, size_t offset, size_t size) |
| 39 |
{ |
| 40 |
return rdev_readat(dev, buffer, offset, size); |
| 41 |
} |
| 42 |
|
| 43 |
static inline size_t cbfs_dev_size(cbfs_dev_t dev) |
| 44 |
{ |
| 45 |
return region_device_sz(dev); |
| 46 |
} |
| 47 |
|
| 48 |
#endif |