futility/updater_archive.c
/*
 * Applies a key file to firmware image.
 * Returns 0 on success, otherwise failure.
 */
Applies a key file to firmware image.
Returns 0 on success, otherwise failure.
Applies a key file to firmware image . Returns 0 on success otherwise failure .
static int apply_key_file(
		struct firmware_image *image, const char *path,
		struct archive *archive, const char *section_name,
		int (*apply)(struct firmware_image *image, const char *section,
			     const uint8_t *data, uint32_t len))
{
	int r = 0;
	uint8_t *data = NULL;
	uint32_t len;
	r = archive_read_file(archive, path, &data, &len, NULL);
	if (r == 0) {
		VB2_DEBUG("Loaded file: %s\n", path);
		r = apply(image, section_name, data, len);
		if (r)
			ERROR("Failed applying %s to %s\n", path, section_name);
	} else {
		ERROR("Failed reading: %s\n", path);
	}
	free(data);
	return r;
}
static int apply_key_file ( struct firmware_image * image , const char * path , struct archive * archive , const char * section_name , int ( * apply ) ( struct firmware_image * image , const char * section , const uint8_t * data , uint32_t len ) ) { int r = 0 ; uint8_t * data = NULL ; uint32_t len ; r = archive_read_file ( archive , path , & data , & len , NULL ) ; if ( r == 0 ) { VB2_DEBUG ( " \n " , path ) ; r = apply ( image , section_name , data , len ) ; if ( r ) ERROR ( " \n " , path , section_name ) ; } else { ERROR ( " \n " , path ) ; } free ( data ) ; return r ; }
Applies a key file to firmware image.
Applies a key file to firmware image .