^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* PE Binary parser bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <crypto/pkcs7.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <crypto/hash_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct pefile_context {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) unsigned header_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) unsigned image_checksum_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) unsigned cert_dirent_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) unsigned n_data_dirents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned n_sections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned certs_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned sig_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned sig_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) const struct section_header *secs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* PKCS#7 MS Individual Code Signing content */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) const void *digest; /* Digest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned digest_len; /* Digest length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) const char *digest_algo; /* Digest algorithm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define kenter(FMT, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define kleave(FMT, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * mscode_parser.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern int mscode_parse(void *_ctx, const void *content_data, size_t data_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) size_t asn1hdrlen);