LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
Repro.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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_REPRO_H
17#define LIEF_PE_REPRO_H
18#include <ostream>
19#include <vector>
20
22#include "LIEF/visibility.h"
24#include "LIEF/span.hpp"
25
26namespace LIEF {
27namespace PE {
28
29class Builder;
30class Parser;
31
37class LIEF_API Repro : public Debug {
38
39 friend class Builder;
40 friend class Parser;
41
42 public:
44 Debug{Debug::TYPES::REPRO} {}
45
46 Repro(std::vector<uint8_t> hash) :
47 Debug{Debug::TYPES::REPRO},
48 hash_{std::move(hash)} {}
49
50 Repro(const details::pe_debug& dbg, std::vector<uint8_t> hash, Section* sec) :
51 Debug{dbg, sec},
52 hash_{std::move(hash)} {}
53
54 Repro(const details::pe_debug& dbg, Section* sec) :
55 Debug{dbg, sec} {}
56
57 Repro(const Repro& other) = default;
58 Repro& operator=(const Repro& other) = default;
59
60 Repro(Repro&&) = default;
61 Repro& operator=(Repro&& other) = default;
62
65 return hash_;
66 }
67
69 return hash_;
70 }
71
72 void hash(std::vector<uint8_t> h) {
73 hash_ = std::move(h);
74 }
75
76 std::unique_ptr<Debug> clone() const override {
77 return std::unique_ptr<Debug>(new Repro(*this));
78 }
79
80 static bool classof(const Debug* debug) {
81 return debug->type() == Debug::TYPES::REPRO;
82 }
83
84 void accept(Visitor& visitor) const override;
85
86 std::string to_string() const override;
87
88 ~Repro() override = default;
89
90 protected:
91 std::vector<uint8_t> hash_;
92};
93
94} // Namespace PE
95} // Namespace LIEF
96
97#endif
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
Debug()=default
TYPES
The entry types.
Definition debug/Debug.hpp:46
@ REPRO
PE determinism or reproducibility information.
Definition debug/Debug.hpp:94
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:52
span< uint8_t > hash()
Definition Repro.hpp:68
Repro & operator=(Repro &&other)=default
Repro(Repro &&)=default
void hash(std::vector< uint8_t > h)
Definition Repro.hpp:72
void accept(Visitor &visitor) const override
friend class Builder
Definition Repro.hpp:39
std::string to_string() const override
Repro(std::vector< uint8_t > hash)
Definition Repro.hpp:46
static bool classof(const Debug *debug)
Definition Repro.hpp:80
~Repro() override=default
Repro(const Repro &other)=default
Repro(const details::pe_debug &dbg, Section *sec)
Definition Repro.hpp:54
friend class Parser
Definition Repro.hpp:40
span< const uint8_t > hash() const
The hash associated with the reproducible build.
Definition Repro.hpp:64
Repro()
Definition Repro.hpp:43
Repro & operator=(const Repro &other)=default
Repro(const details::pe_debug &dbg, std::vector< uint8_t > hash, Section *sec)
Definition Repro.hpp:50
std::unique_ptr< Debug > clone() const override
Definition Repro.hpp:76
Class which represents a PE section.
Definition PE/Section.hpp:47
Definition Visitor.hpp:212
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:41
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:45