LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
PE/hash.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 * Copyright 2017 - 2021 K. Nakagawa
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef LIEF_PE_HASH_H
18#define LIEF_PE_HASH_H
19
20#include "LIEF/visibility.h"
21#include "LIEF/hash.hpp"
22
23namespace LIEF {
24namespace PE {
25
26class Binary;
27class DosHeader;
28class RichHeader;
29class RichEntry;
30class Header;
31class OptionalHeader;
32class DataDirectory;
33class Section;
34class Relocation;
35class RelocationEntry;
36class Export;
37class ExportEntry;
38class TLS;
39class Symbol;
40class Debug;
41class CodeView;
42class CodeViewPDB;
43class Import;
44class ImportEntry;
45class DelayImport;
47class ResourceNode;
48class ResourceData;
51class ResourceVersion;
55class LangCodeItem;
56class ResourceIcon;
57class ResourceDialog;
61class Signature;
62class x509;
63class SignerInfo;
64class ContentInfo;
65class Attribute;
66class ContentType;
67class GenericType;
68class MsCounterSign;
75class SpcSpOpusInfo;
78class CodeIntegrity;
92class Pogo;
93class PogoEntry;
94class Repro;
95class LIEF_API Hash : public LIEF::Hash {
99 public:
100 static LIEF::Hash::value_type hash(const Object& obj);
101
102 public:
103 using LIEF::Hash::Hash;
104 using LIEF::Hash::hash;
105 using LIEF::Hash::visit;
107
108 public:
109 void visit(const Binary& Binary) override;
110 void visit(const DosHeader& dos_header) override;
111 void visit(const RichHeader& rich_header) override;
112 void visit(const RichEntry& rich_entry) override;
113 void visit(const Header& header) override;
114 void visit(const OptionalHeader& optional_header) override;
115 void visit(const DataDirectory& data_directory) override;
116 void visit(const Section& section) override;
117 void visit(const Relocation& relocation) override;
118 void visit(const RelocationEntry& relocation_entry) override;
119 void visit(const Export& export_) override;
120 void visit(const ExportEntry& export_entry) override;
121 void visit(const TLS& tls) override;
122 void visit(const Symbol& Symbol) override;
123 void visit(const Debug& debug) override;
124 void visit(const CodeView& cv) override;
125 void visit(const CodeViewPDB& cvpdb) override;
126 void visit(const Import& import) override;
127 void visit(const ImportEntry& import_entry) override;
128 void visit(const DelayImport& import) override;
129 void visit(const DelayImportEntry& import_entry) override;
130 void visit(const ResourceNode& resource_node) override;
131 void visit(const ResourceData& resource_data) override;
132 void visit(const ResourceDirectory& resource_directory) override;
133 void visit(const ResourcesManager& resources_manager) override;
134 void visit(const ResourceVersion& resource_version) override;
135 void visit(const ResourceStringFileInfo& resource_sfi) override;
136 void visit(const ResourceFixedFileInfo& resource_ffi) override;
137 void visit(const ResourceVarFileInfo& resource_vfi) override;
138 void visit(const LangCodeItem& resource_lci) override;
139 void visit(const ResourceIcon& resource_icon) override;
140 void visit(const ResourceDialog& dialog) override;
141 void visit(const ResourceDialogItem& dialog_item) override;
142 void visit(const ResourceStringTable& string_table) override;
143 void visit(const ResourceAccelerator& acc) override;
144 void visit(const Signature& signature) override;
145 void visit(const x509& x509) override;
146 void visit(const SignerInfo& signerinfo) override;
147 void visit(const ContentInfo& contentinfo) override;
148 void visit(const GenericContent& content) override;
149 void visit(const SpcIndirectData& content) override;
150 void visit(const Attribute& attr) override;
151 void visit(const ContentType& attr) override;
152 void visit(const GenericType& attr) override;
153 void visit(const MsCounterSign& attr) override;
154 void visit(const MsSpcNestedSignature& attr) override;
155 void visit(const MsSpcStatementType& attr) override;
156 void visit(const MsManifestBinaryID& attr) override;
157 void visit(const PKCS9AtSequenceNumber& attr) override;
158 void visit(const PKCS9CounterSignature& attr) override;
159 void visit(const PKCS9MessageDigest& attr) override;
160 void visit(const PKCS9SigningTime& attr) override;
161 void visit(const SpcSpOpusInfo& attr) override;
162 void visit(const SpcRelaxedPeMarkerCheck& attr) override;
163 void visit(const SigningCertificateV2& attr) override;
164 void visit(const CodeIntegrity& code_integrity) override;
165 void visit(const LoadConfiguration& config) override;
166 void visit(const LoadConfigurationV0& config) override;
167 void visit(const LoadConfigurationV1& config) override;
168 void visit(const LoadConfigurationV2& config) override;
169 void visit(const LoadConfigurationV3& config) override;
170 void visit(const LoadConfigurationV4& config) override;
171 void visit(const LoadConfigurationV5& config) override;
172 void visit(const LoadConfigurationV6& config) override;
173 void visit(const LoadConfigurationV7& config) override;
174 void visit(const LoadConfigurationV8& config) override;
175 void visit(const LoadConfigurationV9& config) override;
176 void visit(const LoadConfigurationV10& config) override;
177 void visit(const LoadConfigurationV11& config) override;
178
179 void visit(const Pogo& pogo) override;
180 void visit(const PogoEntry& entry) override;
181 void visit(const Repro& entry) override;
182
183 ~Hash() override;
184};
185
186}
187}
188
189#endif
size_t value_type
Definition hash.hpp:33
static value_type hash(const Object &obj)
Definition hash.hpp:119
virtual void visit(const Object &)
virtual Hash & process(const Object &obj)
Interface over PKCS #7 attribute.
Definition PE/signature/Attribute.hpp:29
Class which represents a PE binary This is the main interface to manage and modify a PE executable.
Definition PE/Binary.hpp:52
Definition CodeIntegrity.hpp:30
CodeView PDB specialization.
Definition CodeViewPDB.hpp:34
Interface for the (generic) Debug CodeView (IMAGE_DEBUG_TYPE_CODEVIEW)
Definition CodeView.hpp:26
Definition ContentInfo.hpp:78
Interface over the structure described by the OID 1.2.840.113549.1.9.3 (PKCS #9)
Definition ContentType.hpp:37
Class that represents a PE data directory entry.
Definition DataDirectory.hpp:38
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:38
Class that represents an entry (i.e. an import) in the delay import table (DelayImport).
Definition DelayImportEntry.hpp:38
Class that represents a PE delayed import.
Definition DelayImport.hpp:36
Class which represents the DosHeader, the first structure presents at the beginning of a PE file.
Definition DosHeader.hpp:38
Class which represents a PE Export entry (cf. PE::Export)
Definition ExportEntry.hpp:33
Class which represents a PE Export.
Definition Export.hpp:38
Interface over an attribute for which the internal structure is not supported by LIEF.
Definition GenericType.hpp:31
Class which implements a visitor to compute a deterministic hash for LIEF PE objects.
Definition PE/hash.hpp:98
void visit(const LoadConfigurationV9 &config) override
Method to visit a LIEF::PE::LoadConfigurationV9.
void visit(const SigningCertificateV2 &attr) override
Method to visit a LIEF::PE::SigningCertificateV2.
void visit(const DelayImport &import) override
Method to visit a LIEF::PE::DelayImport.
void visit(const Repro &entry) override
Method to visit a LIEF::PE::Repro.
void visit(const Attribute &attr) override
Method to visit a LIEF::PE::Attribute.
void visit(const ResourceData &resource_data) override
Method to visit a LIEF::PE::ResourceData.
void visit(const MsSpcStatementType &attr) override
Method to visit a LIEF::PE::MsSpcStatementType.
void visit(const ResourceIcon &resource_icon) override
Method to visit a LIEF::PE::ResourceIcon.
void visit(const Header &header) override
Method to visit a LIEF::PE::Header.
void visit(const ResourceDialog &dialog) override
Method to visit a LIEF::PE::ResourceDialog.
void visit(const LoadConfigurationV4 &config) override
Method to visit a LIEF::PE::LoadConfigurationV4.
void visit(const ResourceVarFileInfo &resource_vfi) override
Method to visit a LIEF::PE::ResourceVarFileInfo.
void visit(const x509 &x509) override
Method to visit a LIEF::PE::x509.
void visit(const MsManifestBinaryID &attr) override
Method to visit a LIEF::PE::MsManifestBinaryID.
void visit(const ResourceDirectory &resource_directory) override
Method to visit a LIEF::PE::ResourceDirectory.
void visit(const LoadConfigurationV11 &config) override
Method to visit a LIEF::PE::LoadConfigurationV11.
void visit(const Binary &Binary) override
Method to visit a LIEF::PE::Binary.
void visit(const TLS &tls) override
Method to visit a LIEF::PE::TLS.
void visit(const RelocationEntry &relocation_entry) override
Method to visit a LIEF::PE::RelocationEntry.
void visit(const ContentType &attr) override
Method to visit a LIEF::PE::ContentType.
void visit(const ResourceDialogItem &dialog_item) override
Method to visit a LIEF::PE::ResourceDialogItem.
void visit(const LangCodeItem &resource_lci) override
Method to visit a LIEF::PE::LangCodeItem.
void visit(const PKCS9MessageDigest &attr) override
Method to visit a LIEF::PE::PKCS9MessageDigest.
void visit(const GenericType &attr) override
Method to visit a LIEF::PE::GenericType.
void visit(const PogoEntry &entry) override
Method to visit a LIEF::PE::PogoEntry.
void visit(const LoadConfigurationV5 &config) override
Method to visit a LIEF::PE::LoadConfigurationV5.
void visit(const ResourceNode &resource_node) override
Method to visit a LIEF::PE::ResourceNode.
void visit(const LoadConfigurationV2 &config) override
Method to visit a LIEF::PE::LoadConfigurationV2.
~Hash() override
void visit(const ContentInfo &contentinfo) override
Method to visit a LIEF::PE::ContentInfo.
void visit(const RichHeader &rich_header) override
Method to visit a LIEF::PE:RichHeader.
void visit(const ResourceAccelerator &acc) override
Method to visit a LIEF::PE::ResourceAccelerator.
void visit(const SpcRelaxedPeMarkerCheck &attr) override
Method to visit a LIEF::PE::SpcRelaxedPeMarkerCheck.
void visit(const DataDirectory &data_directory) override
Method to visit a LIEF::PE::DataDirectory.
void visit(const LoadConfigurationV1 &config) override
Method to visit a LIEF::PE::LoadConfigurationV1.
void visit(const PKCS9CounterSignature &attr) override
Method to visit a LIEF::PE::PKCS9CounterSignature.
void visit(const CodeIntegrity &code_integrity) override
Method to visit a LIEF::PE::CodeIntegrity.
void visit(const SpcSpOpusInfo &attr) override
Method to visit a LIEF::PE::SpcSpOpusInfo.
void visit(const PKCS9AtSequenceNumber &attr) override
Method to visit a LIEF::PE::PKCS9AtSequenceNumber.
void visit(const Export &export_) override
Method to visit a LIEF::PE::Export.
void visit(const Debug &debug) override
Method to visit a LIEF::PE::Debug.
void visit(const ResourcesManager &resources_manager) override
Method to visit a LIEF::PE::ResourceVersion.
void visit(const ResourceFixedFileInfo &resource_ffi) override
Method to visit a LIEF::PE::ResourceFixedFileInfo.
void visit(const LoadConfigurationV8 &config) override
Method to visit a LIEF::PE::LoadConfigurationV8.
void visit(const ImportEntry &import_entry) override
Method to visit a LIEF::PE::ImportEntry.
void visit(const DelayImportEntry &import_entry) override
Method to visit a LIEF::PE::DelayImportEntry.
void visit(const MsCounterSign &attr) override
Method to visit a LIEF::PE::MsCounterSign.
void visit(const LoadConfigurationV10 &config) override
Method to visit a LIEF::PE::LoadConfigurationV10.
void visit(const MsSpcNestedSignature &attr) override
Method to visit a LIEF::PE::MsSpcNestedSignature.
void visit(const LoadConfigurationV7 &config) override
Method to visit a LIEF::PE::LoadConfigurationV7.
void visit(const PKCS9SigningTime &attr) override
Method to visit a LIEF::PE::PKCS9SigningTime.
void visit(const Symbol &Symbol) override
Method to visit a LIEF::PE::Symbol.
void visit(const ResourceStringFileInfo &resource_sfi) override
Method to visit a LIEF::PE::ResourceStringFileInfo.
void visit(const Import &import) override
Method to visit a LIEF::PE::Import.
void visit(const Section &section) override
Method to visit a LIEF::PE::Section.
void visit(const CodeView &cv) override
Method to visit a LIEF::PE::CodeView.
void visit(const LoadConfigurationV3 &config) override
Method to visit a LIEF::PE::LoadConfigurationV3.
void visit(const LoadConfigurationV0 &config) override
Method to visit a LIEF::PE::LoadConfigurationV0.
void visit(const RichEntry &rich_entry) override
Method to visit a LIEF::PE:RichEntry.
void visit(const CodeViewPDB &cvpdb) override
Method to visit a LIEF::PE::CodeViewPDB.
void visit(const SignerInfo &signerinfo) override
Method to visit a LIEF::PE::SignerInfo.
void visit(const Pogo &pogo) override
Method to visit a LIEF::PE::Pogo.
void visit(const ExportEntry &export_entry) override
Method to visit a LIEF::PE::ExportEntry.
void visit(const ResourceStringTable &string_table) override
Method to visit a LIEF::PE::ResourceStringTable.
void visit(const LoadConfiguration &config) override
Method to visit a LIEF::PE::LoadConfiguration.
void visit(const GenericContent &content) override
Method to visit a LIEF::PE::GenericContent.
void visit(const ResourceVersion &resource_version) override
Method to visit a LIEF::PE::ResourceVersion.
void visit(const LoadConfigurationV6 &config) override
Method to visit a LIEF::PE::LoadConfigurationV6.
void visit(const Relocation &relocation) override
Method to visit a LIEF::PE::Relocation.
void visit(const Signature &signature) override
Method to visit a LIEF::PE::Signature.
void visit(const OptionalHeader &optional_header) override
Method to visit a LIEF::PE::OptionalHeader.
void visit(const DosHeader &dos_header) override
Method to visit a LIEF::PE::DosHeader.
static LIEF::Hash::value_type hash(const Object &obj)
void visit(const SpcIndirectData &content) override
Method to visit a LIEF::PE::SpcIndirectData.
Class that represents the PE header (which follows the DosHeader)
Definition PE/Header.hpp:36
Class that represents an entry (i.e. an import) in the import table (Import).
Definition ImportEntry.hpp:36
Class that represents a PE import.
Definition Import.hpp:39
Class which represents the childs of the ResourceStringFileInfo.
Definition LangCodeItem.hpp:37
LoadConfiguration enhanced with SEH.
Definition LoadConfigurationV0.hpp:32
Definition LoadConfigurationV10.hpp:32
Definition LoadConfigurationV11.hpp:32
LoadConfiguration enhanced with Control Flow Guard.
Definition LoadConfigurationV1.hpp:36
LoadConfiguration enhanced with code integrity.
Definition LoadConfigurationV2.hpp:34
LoadConfiguration with Control Flow Guard improved.
Definition LoadConfigurationV3.hpp:32
Load Configuration enhanced with.
Definition LoadConfigurationV4.hpp:35
Load Configuration enhanced with Return Flow Guard.
Definition LoadConfigurationV5.hpp:32
Load Configuration enhanced with Hotpatch and improved RFG.
Definition LoadConfigurationV6.hpp:33
Definition LoadConfigurationV7.hpp:32
Definition LoadConfigurationV8.hpp:33
Definition LoadConfigurationV9.hpp:31
Class that represents the default PE's LoadConfiguration
Definition LoadConfiguration.hpp:35
This class exposes the MS Counter Signature attribute.
Definition MsCounterSign.hpp:32
Interface over the structure described by the OID 1.3.6.1.4.1.311.2.4.1
Definition MsSpcNestedSignature.hpp:36
Interface over the structure described by the OID 1.3.6.1.4.1.311.2.1.11
Definition MsSpcStatementType.hpp:34
Class which represents the PE OptionalHeader structure.
Definition OptionalHeader.hpp:42
Interface over the structure described by the OID 1.2.840.113549.1.9.25.4 (PKCS #9)
Definition PKCS9AtSequenceNumber.hpp:43
Interface over the structure described by the OID 1.2.840.113549.1.9.6 (PKCS #9)
Definition PKCS9CounterSignature.hpp:38
Interface over the structure described by the OID 1.2.840.113549.1.9.4 (PKCS #9)
Definition PKCS9MessageDigest.hpp:46
Interface over the structure described by the OID 1.2.840.113549.1.9.5 (PKCS #9)
Definition PKCS9SigningTime.hpp:42
Definition PogoEntry.hpp:30
This class represents a Profile Guided Optimization entry from the debug directory (IMAGE_DEBUG_TYPE_...
Definition Pogo.hpp:33
Class which represents an entry of the PE relocation table.
Definition RelocationEntry.hpp:36
Class which represents the Base Relocation Block We usually find this structure in the ....
Definition PE/Relocation.hpp:37
This class represents a reproducible build entry from the debug directory. (IMAGE_DEBUG_TYPE_REPRO)....
Definition Repro.hpp:36
Definition ResourceAccelerator.hpp:38
Class which represents a Data Node in the PE resources tree.
Definition ResourceData.hpp:32
This class represents an item in the ResourceDialog.
Definition ResourceDialogItem.hpp:40
Representation of a dialog box.
Definition ResourceDialog.hpp:47
Definition ResourceDirectory.hpp:33
Representation of VS_FIXEDFILEINFO Structure.
Definition ResourceFixedFileInfo.hpp:36
Definition ResourceIcon.hpp:39
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:36
Representation of the StringFileInfo structure.
Definition ResourceStringFileInfo.hpp:38
Definition ResourceStringTable.hpp:28
This object describes information about languages supported by the application.
Definition ResourceVarFileInfo.hpp:36
Representation of the data associated with the RT_VERSION entry.
Definition ResourceVersion.hpp:38
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
Class which represents an entry associated to the RichHeader.
Definition RichEntry.hpp:28
Class which represents the not-so-documented rich header.
Definition RichHeader.hpp:37
Class which represents a PE section.
Definition PE/Section.hpp:43
Main interface for the PKCS #7 signature scheme.
Definition Signature.hpp:39
Definition SignerInfo.hpp:54
SigningCertificateV2 ::= SEQUENCE { certs SEQUENCE OF ESSCertIDv2, policies SEQUENCE OF PolicyInforma...
Definition SigningCertificateV2.hpp:44
Definition SpcRelaxedPeMarkerCheck.hpp:25
Interface over the structure described by the OID 1.3.6.1.4.1.311.2.1.12
Definition SpcSpOpusInfo.hpp:39
Class that represents a PE symbol.
Definition PE/Symbol.hpp:40
Class which represents the PE Thread Local Storage.
Definition TLS.hpp:42
Interface over a x509 certificate.
Definition x509.hpp:43
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41