AKASHI Takahiro | fea4c84 | 2022-07-05 14:48:11 +0900 | [diff] [blame] | 1 | /* 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 Mao | 08f80c8 | 2024-10-03 14:50:35 -0700 | [diff] [blame] | 12 | #if CONFIG_IS_ENABLED(MBEDTLS_LIB_X509) |
| 13 | #include <mbedtls/asn1.h> |
| 14 | #include <mbedtls/oid.h> |
| 15 | #endif |
AKASHI Takahiro | fea4c84 | 2022-07-05 14:48:11 +0900 | [diff] [blame] | 16 | |
| 17 | struct 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 | */ |
| 46 | extern int mscode_parse(void *_ctx, const void *content_data, size_t data_len, |
| 47 | size_t asn1hdrlen); |