verifiers: File type for fine-grained signature-verification controlling
Let's provide file type info to the I/O layer. This way verifiers framework and its users will be able to differentiate files and verify only required ones. This is preparatory patch. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com> Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
This commit is contained in:
		
							parent
							
								
									e1bc2b23f1
								
							
						
					
					
						commit
						aebe31c375
					
				
					 70 changed files with 292 additions and 221 deletions
				
			
		|  | @ -88,11 +88,11 @@ grub_bufio_open (grub_file_t io, grub_size_t size) | |||
| } | ||||
| 
 | ||||
| grub_file_t | ||||
| grub_buffile_open (const char *name, grub_size_t size) | ||||
| grub_buffile_open (const char *name, enum grub_file_type type, grub_size_t size) | ||||
| { | ||||
|   grub_file_t io, file; | ||||
| 
 | ||||
|   io = grub_file_open (name); | ||||
|   io = grub_file_open (name, type); | ||||
|   if (! io) | ||||
|     return 0; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1156,11 +1156,14 @@ initialize_tables (grub_gzio_t gzio) | |||
|    even if IO does not contain data compressed by gzip, return a valid file | ||||
|    object. Note that this function won't close IO, even if an error occurs.  */ | ||||
| static grub_file_t | ||||
| grub_gzio_open (grub_file_t io, const char *name __attribute__ ((unused))) | ||||
| grub_gzio_open (grub_file_t io, enum grub_file_type type) | ||||
| { | ||||
|   grub_file_t file; | ||||
|   grub_gzio_t gzio = 0; | ||||
| 
 | ||||
|   if (type & GRUB_FILE_TYPE_NO_DECOMPRESS) | ||||
|     return io; | ||||
| 
 | ||||
|   file = (grub_file_t) grub_zalloc (sizeof (*file)); | ||||
|   if (! file) | ||||
|     return 0; | ||||
|  |  | |||
|  | @ -407,12 +407,14 @@ CORRUPTED: | |||
| } | ||||
| 
 | ||||
| static grub_file_t | ||||
| grub_lzopio_open (grub_file_t io, | ||||
| 		  const char *name __attribute__ ((unused))) | ||||
| grub_lzopio_open (grub_file_t io, enum grub_file_type type) | ||||
| { | ||||
|   grub_file_t file; | ||||
|   grub_lzopio_t lzopio; | ||||
| 
 | ||||
|   if (type & GRUB_FILE_TYPE_NO_DECOMPRESS) | ||||
|     return io; | ||||
| 
 | ||||
|   file = (grub_file_t) grub_zalloc (sizeof (*file)); | ||||
|   if (!file) | ||||
|     return 0; | ||||
|  |  | |||
|  | @ -69,7 +69,8 @@ grub_file_offset_close (grub_file_t file) | |||
| } | ||||
| 
 | ||||
| grub_file_t | ||||
| grub_file_offset_open (grub_file_t parent, grub_off_t start, grub_off_t size) | ||||
| grub_file_offset_open (grub_file_t parent, enum grub_file_type type, | ||||
| 		       grub_off_t start, grub_off_t size) | ||||
| { | ||||
|   struct grub_offset_file *off_data; | ||||
|   grub_file_t off_file, last_off_file; | ||||
|  | @ -95,10 +96,10 @@ grub_file_offset_open (grub_file_t parent, grub_off_t start, grub_off_t size) | |||
|   last_off_file = NULL; | ||||
|   for (filter = GRUB_FILE_FILTER_COMPRESSION_FIRST; | ||||
|        off_file && filter <= GRUB_FILE_FILTER_COMPRESSION_LAST; filter++) | ||||
|     if (grub_file_filters_enabled[filter]) | ||||
|     if (grub_file_filters[filter]) | ||||
|       { | ||||
| 	last_off_file = off_file; | ||||
| 	off_file = grub_file_filters_enabled[filter] (off_file, parent->name); | ||||
| 	off_file = grub_file_filters[filter] (off_file, type); | ||||
|       } | ||||
| 
 | ||||
|   if (!off_file) | ||||
|  |  | |||
|  | @ -169,12 +169,14 @@ ERROR: | |||
| } | ||||
| 
 | ||||
| static grub_file_t | ||||
| grub_xzio_open (grub_file_t io, | ||||
| 		const char *name __attribute__ ((unused))) | ||||
| grub_xzio_open (grub_file_t io, enum grub_file_type type) | ||||
| { | ||||
|   grub_file_t file; | ||||
|   grub_xzio_t xzio; | ||||
| 
 | ||||
|   if (type & GRUB_FILE_TYPE_NO_DECOMPRESS) | ||||
|     return io; | ||||
| 
 | ||||
|   file = (grub_file_t) grub_zalloc (sizeof (*file)); | ||||
|   if (!file) | ||||
|     return 0; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue