mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-10-31 03:58:17 +00:00 
			
		
		
		
	Previous patch has introduced MbedTLS porting layer for mscode parser, here to adjust the header and makefiles accordingly. Adding _LEGACY Kconfig for legacy mscode implementation. Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0-or-later */
 | |
| /* PE Binary parser bits
 | |
|  *
 | |
|  * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
 | |
|  * Written by David Howells (dhowells@redhat.com)
 | |
|  */
 | |
| 
 | |
| #include <crypto/pkcs7.h>
 | |
| #ifndef __UBOOT__
 | |
| #include <crypto/hash_info.h>
 | |
| #endif
 | |
| #if CONFIG_IS_ENABLED(MBEDTLS_LIB_X509)
 | |
| #include <mbedtls/asn1.h>
 | |
| #include <mbedtls/oid.h>
 | |
| #endif
 | |
| 
 | |
| struct pefile_context {
 | |
| #ifndef __UBOOT__
 | |
| 	unsigned	header_size;
 | |
| 	unsigned	image_checksum_offset;
 | |
| 	unsigned	cert_dirent_offset;
 | |
| 	unsigned	n_data_dirents;
 | |
| 	unsigned	n_sections;
 | |
| 	unsigned	certs_size;
 | |
| 	unsigned	sig_offset;
 | |
| 	unsigned	sig_len;
 | |
| 	const struct section_header *secs;
 | |
| #endif
 | |
| 
 | |
| 	/* PKCS#7 MS Individual Code Signing content */
 | |
| 	const void	*digest;		/* Digest */
 | |
| 	unsigned	digest_len;		/* Digest length */
 | |
| 	const char	*digest_algo;		/* Digest algorithm */
 | |
| };
 | |
| 
 | |
| #ifndef __UBOOT__
 | |
| #define kenter(FMT, ...)					\
 | |
| 	pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
 | |
| #define kleave(FMT, ...) \
 | |
| 	pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
 | |
| #endif
 | |
| 
 | |
| /*
 | |
|  * mscode_parser.c
 | |
|  */
 | |
| extern int mscode_parse(void *_ctx, const void *content_data, size_t data_len,
 | |
| 			size_t asn1hdrlen);
 |