blob: 678e69001b9eeaf19fdd59247deac157aed53d68 [file] [log] [blame]
AKASHI Takahirofea4c842022-07-05 14:48:11 +09001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* PE Binary parser bits
3 *
4 * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <crypto/pkcs7.h>
9#ifndef __UBOOT__
10#include <crypto/hash_info.h>
11#endif
Raymond Mao08f80c82024-10-03 14:50:35 -070012#if CONFIG_IS_ENABLED(MBEDTLS_LIB_X509)
13#include <mbedtls/asn1.h>
14#include <mbedtls/oid.h>
15#endif
AKASHI Takahirofea4c842022-07-05 14:48:11 +090016
17struct pefile_context {
18#ifndef __UBOOT__
19 unsigned header_size;
20 unsigned image_checksum_offset;
21 unsigned cert_dirent_offset;
22 unsigned n_data_dirents;
23 unsigned n_sections;
24 unsigned certs_size;
25 unsigned sig_offset;
26 unsigned sig_len;
27 const struct section_header *secs;
28#endif
29
30 /* PKCS#7 MS Individual Code Signing content */
31 const void *digest; /* Digest */
32 unsigned digest_len; /* Digest length */
33 const char *digest_algo; /* Digest algorithm */
34};
35
36#ifndef __UBOOT__
37#define kenter(FMT, ...) \
38 pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
39#define kleave(FMT, ...) \
40 pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
41#endif
42
43/*
44 * mscode_parser.c
45 */
46extern int mscode_parse(void *_ctx, const void *content_data, size_t data_len,
47 size_t asn1hdrlen);