futility/updater_archive.c
/*
 * Changes the rootkey in firmware GBB to given new key.
 * Returns 0 on success, otherwise failure.
 */
Changes the rootkey in firmware GBB to given new key.
Returns 0 on success, otherwise failure.
Changes the rootkey in firmware GBB to given new key . Returns 0 on success otherwise failure .
static int change_gbb_rootkey(struct firmware_image *image,
			      const char *section_name,
			      const uint8_t *rootkey, uint32_t rootkey_len)
{
	const struct vb2_gbb_header *gbb = find_gbb(image);
	uint8_t *gbb_rootkey;
	if (!gbb) {
		ERROR("Cannot find GBB in image %s.\n", image->file_name);
		return -1;
	}
	if (gbb->rootkey_size < rootkey_len) {
		ERROR("New root key (%u bytes) larger than GBB (%u bytes).\n",
		      rootkey_len, gbb->rootkey_size);
		return -1;
	}
	gbb_rootkey = (uint8_t *)gbb + gbb->rootkey_offset;
	memset(gbb_rootkey, 0, gbb->rootkey_size);
	memcpy(gbb_rootkey, rootkey, rootkey_len);
	return 0;
}
static int change_gbb_rootkey ( struct firmware_image * image , const char * section_name , const uint8_t * rootkey , uint32_t rootkey_len ) { const struct vb2_gbb_header * gbb = find_gbb ( image ) ; uint8_t * gbb_rootkey ; if ( ! gbb ) { ERROR ( " \n " , image -> file_name ) ; return -1 ; } if ( gbb -> rootkey_size < rootkey_len ) { ERROR ( " \n " , rootkey_len , gbb -> rootkey_size ) ; return -1 ; } gbb_rootkey = ( uint8_t * ) gbb + gbb -> rootkey_offset ; memset ( gbb_rootkey , 0 , gbb -> rootkey_size ) ; memcpy ( gbb_rootkey , rootkey , rootkey_len ) ; return 0 ; }
Changes the rootkey in firmware GBB to given new key.
Changes the rootkey in firmware GBB to given new key .
/* See cmd_gbb_utility: root key must be first cleared with zero. */