HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
configuration.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
31 #pragma once
32 
33 #include "hal_core/defines.h"
36 
37 #include <set>
38 #include <thread>
39 #include <vector>
40 
41 namespace hal
42 {
43  class Netlist;
44  class Gate;
45 
46  namespace module_identification
47  {
55  {
62 
66  Configuration();
67 
72 
76  std::vector<std::vector<Gate*>> m_known_registers = {};
77 
81  std::vector<module_identification::CandidateType> m_types_to_check = all_checkable_candidate_types;
82 
87 
92 
96  std::vector<std::vector<Gate*>> m_already_classified_candidates = {};
97 
101  std::vector<std::set<Gate*>> m_blocked_base_candidates = {};
102 
107 
114  Configuration& with_known_registers(const std::vector<std::vector<Gate*>>& registers);
115 
122  Configuration& with_max_thread_count(const u32& max_thread_count);
123 
130  Configuration& with_max_control_signals(const u32& max_control_signals);
131 
139 
146  Configuration& with_types_to_check(const std::vector<module_identification::CandidateType>& types_to_check);
147 
156  Configuration& with_already_classified_candidates(const std::vector<std::vector<Gate*>>& already_classified_candidates);
157 
164  Configuration& with_blocked_base_candidates(const std::vector<std::set<Gate*>>& blocked_base_candidates);
165  };
166  } // namespace module_identification
167 } // namespace hal
This file contains the enumeration and constants for the candidate types used in the module identific...
uint32_t u32
Definition: defines.h:41
This file contains the enum class for multithreading strategies in the module identification process.
const std::vector< CandidateType > all_checkable_candidate_types
A list of all candidate types that are selectable to be checked.
MultithreadingPriority
Specifies the strategy for multithreading in the module identification process.
@ memory_priority
Prioritize memory efficiency in multithreading.
Definition: defines.h:45
Configuration for the module identification analysis.
Definition: configuration.h:55
Configuration()
Constructs an empty configuration.
Configuration & with_multithreading_priority(const MultithreadingPriority &priority)
Set the multithreading priority type.
Configuration & with_types_to_check(const std::vector< module_identification::CandidateType > &types_to_check)
Set the candidate types to be checked.
Netlist * m_netlist
The netlist to be analyzed.
Definition: configuration.h:71
Configuration & with_already_classified_candidates(const std::vector< std::vector< Gate * >> &already_classified_candidates)
Add gates to be ignored during processing.
std::vector< std::set< Gate * > > m_blocked_base_candidates
Base candidates to block during analysis.
std::vector< module_identification::CandidateType > m_types_to_check
CandidateTypes that shall be checked. Defaults to all checkable candidate types.
Definition: configuration.h:81
std::vector< std::vector< Gate * > > m_known_registers
A vector handling possibly known registers.
Definition: configuration.h:76
u32 m_max_control_signals
Maximum number of control signals to be tested. Defaults to 3.
Definition: configuration.h:91
Configuration & with_known_registers(const std::vector< std::vector< Gate * >> &registers)
Set the known registers for prioritization.
Configuration & with_blocked_base_candidates(const std::vector< std::set< Gate * >> &blocked_base_candidates)
Add base candidates to be blocked during analysis.
std::vector< std::vector< Gate * > > m_already_classified_candidates
Gates to ignore during processing.
Definition: configuration.h:96
Configuration & with_max_control_signals(const u32 &max_control_signals)
Set the maximum number of control signals to be tested.
Configuration & with_max_thread_count(const u32 &max_thread_count)
Set the maximum number of threads.
MultithreadingPriority m_multithreading_priority
Choose which MultithreadingPriority to use for the analysis. Defaults to memory priority.
u32 m_max_thread_count
Maximum number of concurrent threads created during execution. Defaults to 1.
Definition: configuration.h:86