* gnu/packages/bootloaders.scm (u-boot): Update to 2022.01. [native-inputs]: Add gnutls, tinfo, libuuid. (u-boot-qemu-riscv64-smode): Drop custom patches. * gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh patch. * gnu/packages/patches/u-boot-riscv64-fix-extlinux.patch: Remove patch, applied upstream. * gnu/local.mk (dist_patch_DATA): Update with removed patches. Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
		
			
				
	
	
		
			139 lines
		
	
	
	
		
			3.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			139 lines
		
	
	
	
		
			3.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From: Vagrant Cascadian <vagrant@debian.org>
 | |
| Date: Fri, 22 Oct 2021 17:34:53 -0700
 | |
| Subject: [PATCH] Revert "tools: kwbimage: Do not hide usage of secure header
 | |
|  under CONFIG_ARMADA_38X"
 | |
| 
 | |
| This reverts commit b4f3cc2c42d97967a3a3c8796c340f6b07ecccac.
 | |
| 
 | |
| diff --git a/tools/kwbimage.c b/tools/kwbimage.c
 | |
| index 94b7685392..eec599b0ee 100644
 | |
| --- a/tools/kwbimage.c
 | |
| +++ b/tools/kwbimage.c
 | |
| @@ -19,6 +19,7 @@
 | |
|  #include <stdint.h>
 | |
|  #include "kwbimage.h"
 | |
|  
 | |
| +#ifdef CONFIG_KWB_SECURE
 | |
|  #include <openssl/bn.h>
 | |
|  #include <openssl/rsa.h>
 | |
|  #include <openssl/pem.h>
 | |
| @@ -44,6 +45,7 @@ void EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
 | |
|  	EVP_MD_CTX_reset(ctx);
 | |
|  }
 | |
|  #endif
 | |
| +#endif
 | |
|  
 | |
|  /* fls - find last (most-significant) bit set in 4-bit integer */
 | |
|  static inline int fls4(int num)
 | |
| @@ -62,7 +64,9 @@ static inline int fls4(int num)
 | |
|  
 | |
|  static struct image_cfg_element *image_cfg;
 | |
|  static int cfgn;
 | |
| +#ifdef CONFIG_KWB_SECURE
 | |
|  static int verbose_mode;
 | |
| +#endif
 | |
|  
 | |
|  struct boot_mode {
 | |
|  	unsigned int id;
 | |
| @@ -278,6 +282,8 @@ image_count_options(unsigned int optiontype)
 | |
|  	return count;
 | |
|  }
 | |
|  
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
| +
 | |
|  static int image_get_csk_index(void)
 | |
|  {
 | |
|  	struct image_cfg_element *e;
 | |
| @@ -288,6 +294,7 @@ static int image_get_csk_index(void)
 | |
|  
 | |
|  	return e->csk_idx;
 | |
|  }
 | |
| +#endif
 | |
|  
 | |
|  static bool image_get_spezialized_img(void)
 | |
|  {
 | |
| @@ -432,6 +439,7 @@ static uint8_t baudrate_to_option(unsigned int baudrate)
 | |
|  	}
 | |
|  }
 | |
|  
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
|  static void kwb_msg(const char *fmt, ...)
 | |
|  {
 | |
|  	if (verbose_mode) {
 | |
| @@ -926,6 +934,7 @@ static int kwb_dump_fuse_cmds(struct secure_hdr_v1 *sec_hdr)
 | |
|  done:
 | |
|  	return ret;
 | |
|  }
 | |
| +#endif
 | |
|  
 | |
|  static size_t image_headersz_align(size_t headersz, uint8_t blockid)
 | |
|  {
 | |
| @@ -1079,11 +1088,13 @@ static size_t image_headersz_v1(int *hasext)
 | |
|  	 */
 | |
|  	headersz = sizeof(struct main_hdr_v1);
 | |
|  
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
|  	if (image_get_csk_index() >= 0) {
 | |
|  		headersz += sizeof(struct secure_hdr_v1);
 | |
|  		if (hasext)
 | |
|  			*hasext = 1;
 | |
|  	}
 | |
| +#endif
 | |
|  
 | |
|  	cpu_sheeva = image_is_cpu_sheeva();
 | |
|  
 | |
| @@ -1270,6 +1281,7 @@ err_close:
 | |
|  	return -1;
 | |
|  }
 | |
|  
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
|  static int export_pub_kak_hash(RSA *kak, struct secure_hdr_v1 *secure_hdr)
 | |
|  {
 | |
|  	FILE *hashf;
 | |
| @@ -1382,6 +1394,7 @@ static int add_secure_header_v1(struct image_tool_params *params, uint8_t *ptr,
 | |
|  
 | |
|  	return 0;
 | |
|  }
 | |
| +#endif
 | |
|  
 | |
|  static void finish_register_set_header_v1(uint8_t **cur, uint8_t **next_ext,
 | |
|  					  struct register_set_hdr_v1 *register_set_hdr,
 | |
| @@ -1406,7 +1419,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 | |
|  	struct main_hdr_v1 *main_hdr;
 | |
|  	struct opt_hdr_v1 *ohdr;
 | |
|  	struct register_set_hdr_v1 *register_set_hdr;
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
|  	struct secure_hdr_v1 *secure_hdr = NULL;
 | |
| +#endif
 | |
|  	size_t headersz;
 | |
|  	uint8_t *image, *cur;
 | |
|  	int hasext = 0;
 | |
| @@ -1491,6 +1506,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 | |
|  	if (main_hdr->blockid == IBR_HDR_PEX_ID)
 | |
|  		main_hdr->srcaddr = cpu_to_le32(0xFFFFFFFF);
 | |
|  
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
|  	if (image_get_csk_index() >= 0) {
 | |
|  		/*
 | |
|  		 * only reserve the space here; we fill the header later since
 | |
| @@ -1501,7 +1517,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 | |
|  		*next_ext = 1;
 | |
|  		next_ext = &secure_hdr->next;
 | |
|  	}
 | |
| -
 | |
| +#endif
 | |
|  	datai = 0;
 | |
|  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
 | |
|  		e = &image_cfg[cfgi];
 | |
| @@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 | |
|  					      &datai, delay);
 | |
|  	}
 | |
|  
 | |
| +#if defined(CONFIG_KWB_SECURE)
 | |
|  	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
 | |
|  					       headersz, image, secure_hdr))
 | |
|  		return NULL;
 | |
| +#endif
 | |
|  
 | |
|  	*imagesz = headersz;
 | |
|  
 |