loader: verity-hash.h fixups
o Add some comments. o Change image buffer type to (const void *). o Add new macro VERITY_CMDLINE_LENGTH. Signed-off-by: Geoff Levand <geoff@infradead.org>
This commit is contained in:
parent
57fca7d1a3
commit
c9bd29e124
1 changed files with 17 additions and 4 deletions
|
@ -1,13 +1,26 @@
|
|||
/* CoreOS verity hash */
|
||||
|
||||
#define VERITY_ARG " verity.usrhash="
|
||||
#define VERITY_ARG_LENGTH (sizeof (VERITY_ARG) - 1)
|
||||
#define VERITY_HASH_OFFSET 0x40
|
||||
#define VERITY_HASH_LENGTH 64
|
||||
#define VERITY_CMDLINE_LENGTH ((VERITY_ARG_LENGTH)+(VERITY_HASH_LENGTH))
|
||||
#define VERITY_HASH_OFFSET 0x40
|
||||
|
||||
static inline void grub_pass_verity_hash(struct linux_kernel_header *lh,
|
||||
|
||||
/**
|
||||
* grub_pass_verity_hash - Reads the CoreOS verity hash value from a well known
|
||||
* kernel image offset and adds a kernel command line argument for it.
|
||||
*
|
||||
* @pImage: Kernel image buffer.
|
||||
* @cmdline: Kernel command line buffer.
|
||||
* @cmdline_max_len: Kernel command line buffer length.
|
||||
*/
|
||||
|
||||
static inline void grub_pass_verity_hash(const void *pImage,
|
||||
char *cmdline,
|
||||
grub_size_t cmdline_max_len)
|
||||
{
|
||||
char *buf = (char *)lh;
|
||||
const char *buf = pImage;
|
||||
grub_size_t cmdline_len;
|
||||
int i;
|
||||
|
||||
|
@ -19,7 +32,7 @@ static inline void grub_pass_verity_hash(struct linux_kernel_header *lh,
|
|||
}
|
||||
|
||||
cmdline_len = grub_strlen(cmdline);
|
||||
if (cmdline_len + VERITY_ARG_LENGTH + VERITY_HASH_LENGTH > cmdline_max_len)
|
||||
if (cmdline_len + VERITY_CMDLINE_LENGTH > cmdline_max_len)
|
||||
return;
|
||||
|
||||
grub_memcpy (cmdline + cmdline_len, VERITY_ARG, VERITY_ARG_LENGTH);
|
||||
|
|
Loading…
Reference in a new issue