LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
PE/hash.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_HASH_H
17#define LIEF_PE_HASH_H
18
19#include "LIEF/visibility.h"
20#include "LIEF/hash.hpp"
21
22namespace LIEF {
23namespace PE {
24
25class Binary;
26class DosHeader;
27class RichHeader;
28class RichEntry;
29class Header;
30class OptionalHeader;
31class DataDirectory;
32class Section;
33class Relocation;
34class RelocationEntry;
35class Export;
36class ExportEntry;
37class TLS;
38class Symbol;
39class Debug;
40class CodeView;
41class CodeViewPDB;
42class Import;
43class ImportEntry;
44class DelayImport;
46class ResourceNode;
47class ResourceData;
50class ResourceVersion;
53class ResourceIcon;
58class Signature;
59class x509;
60class SignerInfo;
61class ContentInfo;
62class Attribute;
63class ContentType;
64class GenericType;
65class MsCounterSign;
72class SpcSpOpusInfo;
75class CodeIntegrity;
77class Pogo;
78class PogoEntry;
79class Repro;
80class LIEF_API Hash : public LIEF::Hash {
84 public:
85 static LIEF::Hash::value_type hash(const Object& obj);
86
87 public:
88 using LIEF::Hash::Hash;
89 using LIEF::Hash::hash;
92
93 public:
94 void visit(const Binary& Binary) override;
95 void visit(const DosHeader& dos_header) override;
96 void visit(const RichHeader& rich_header) override;
97 void visit(const RichEntry& rich_entry) override;
98 void visit(const Header& header) override;
99 void visit(const OptionalHeader& optional_header) override;
100 void visit(const DataDirectory& data_directory) override;
101 void visit(const Section& section) override;
102 void visit(const Relocation& relocation) override;
103 void visit(const RelocationEntry& relocation_entry) override;
104 void visit(const Export& export_) override;
105 void visit(const ExportEntry& export_entry) override;
106 void visit(const TLS& tls) override;
107 void visit(const Symbol& Symbol) override;
108 void visit(const Debug& debug) override;
109 void visit(const CodeView& cv) override;
110 void visit(const CodeViewPDB& cvpdb) override;
111 void visit(const Import& import) override;
112 void visit(const ImportEntry& import_entry) override;
113 void visit(const DelayImport& import) override;
114 void visit(const DelayImportEntry& import_entry) override;
115 void visit(const ResourceNode& resource_node) override;
116 void visit(const ResourceData& resource_data) override;
117 void visit(const ResourceDirectory& resource_directory) override;
118 void visit(const ResourcesManager& resources_manager) override;
119 void visit(const ResourceVersion& resource_version) override;
120 void visit(const ResourceStringFileInfo& resource_sfi) override;
121 void visit(const ResourceVarFileInfo& resource_vfi) override;
122 void visit(const ResourceIcon& resource_icon) override;
123 void visit(const ResourceDialogExtended& dialog) override;
124 void visit(const ResourceDialogRegular& dialog) override;
125 void visit(const ResourceStringTable& string_table) override;
126 void visit(const ResourceAccelerator& acc) override;
127 void visit(const Signature& signature) override;
128 void visit(const x509& x509) override;
129 void visit(const SignerInfo& signerinfo) override;
130 void visit(const ContentInfo& contentinfo) override;
131 void visit(const GenericContent& content) override;
132 void visit(const SpcIndirectData& content) override;
133 void visit(const Attribute& attr) override;
134 void visit(const ContentType& attr) override;
135 void visit(const GenericType& attr) override;
136 void visit(const MsCounterSign& attr) override;
137 void visit(const MsSpcNestedSignature& attr) override;
138 void visit(const MsSpcStatementType& attr) override;
139 void visit(const MsManifestBinaryID& attr) override;
140 void visit(const PKCS9AtSequenceNumber& attr) override;
141 void visit(const PKCS9CounterSignature& attr) override;
142 void visit(const PKCS9MessageDigest& attr) override;
143 void visit(const PKCS9SigningTime& attr) override;
144 void visit(const SpcSpOpusInfo& attr) override;
145 void visit(const SpcRelaxedPeMarkerCheck& attr) override;
146 void visit(const SigningCertificateV2& attr) override;
147 void visit(const CodeIntegrity& code_integrity) override;
148 void visit(const LoadConfiguration& config) override;
149 void visit(const Pogo& pogo) override;
150 void visit(const PogoEntry& entry) override;
151 void visit(const Repro& entry) override;
152
153 ~Hash() override;
154};
155
156}
157}
158
159#endif
size_t value_type
Definition hash.hpp:33
static value_type hash(const Object &obj)
Definition hash.hpp:127
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:56
Definition CodeIntegrity.hpp:31
CodeView PDB specialization.
Definition CodeViewPDB.hpp:35
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:42
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:40
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:83
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 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 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 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 ResourceDialogExtended &dialog) override
Method to visit a LIEF::PE::ResourceDialogExtended.
void visit(const ResourceNode &resource_node) override
Method to visit a LIEF::PE::ResourceNode.
~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 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 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 MsSpcNestedSignature &attr) override
Method to visit a LIEF::PE::MsSpcNestedSignature.
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 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 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 ResourceDialogRegular &dialog) override
Method to visit a LIEF::PE::ResourceDialogRegular.
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
This class represents the load configuration data associated with the IMAGE_LOAD_CONFIG_DIRECTORY.
Definition LoadConfiguration.hpp:46
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:42
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:33
Implementation for the new extended dialogbox format.
Definition ResourceDialogExtended.hpp:32
Implementation for a regular/legacy dialog box.
Definition ResourceDialogRegular.hpp:33
Definition ResourceDirectory.hpp:33
Definition ResourceIcon.hpp:37
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:45
Representation of the StringFileInfo structure.
Definition ResourceStringFileInfo.hpp:40
This class represents the StringTable structure. This structure can be seen as a dictionary of key,...
Definition ResourceStringTable.hpp:34
Representation of the VarFileInfo structure.
Definition ResourceVarFileInfo.hpp:39
Representation of the data associated with the RT_VERSION entry.
Definition ResourceVersion.hpp:37
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-COFF symbol.
Definition PE/Symbol.hpp:50
Class which represents the PE Thread Local Storage.
Definition TLS.hpp:43
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