HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::hawkeye::RoundCandidate Class Reference

A round candidate constructed from a previously discovered register candidate. More...

#include </home/runner/work/hal/hal/plugins/hawkeye/include/hawkeye/round_candidate.h>

Collaboration diagram for hal::hawkeye::RoundCandidate:
Collaboration graph

Public Member Functions

 RoundCandidate ()=default
 Default constructor for RoundCandidate. More...
 
 ~RoundCandidate ()=default
 Default destructor for RoundCandidate. More...
 
Netlistget_netlist () const
 Get the netlist of the round candidate. The netlist is a partial copy of the netlist of the register candidate. More...
 
graph_algorithm::NetlistGraphget_graph () const
 Get the netlist graph of the round candidate. More...
 
u32 get_size () const
 Get the size of the candidate, i.e., the width of its registers. More...
 
const std::set< Gate * > & get_input_reg () const
 Get the candidate's input register. More...
 
const std::set< Gate * > & get_output_reg () const
 Get the candidate's output register. More...
 
const std::set< Gate * > & get_state_logic () const
 Get the candidate's combinational logic computing the next state. More...
 
const std::set< Net * > & get_state_inputs () const
 Get the candidate's state inputs to the logic computing the next state. More...
 
const std::set< Net * > & get_control_inputs () const
 Get the candidate's control inputs to the logic computing the next state. More...
 
const std::set< Net * > & get_other_inputs () const
 Get the candidate's other inputs to the logic computing the next state. More...
 
const std::set< Net * > & get_state_outputs () const
 Get the candidate's state outputs from the logic computing the next state. More...
 
const std::map< Gate *, std::set< Gate * > > & get_input_ffs_of_gate () const
 Get a map from each combinational gate of the round function to all the input flip-flops it depends on. More...
 
const std::map< u32, std::set< Gate * > > & get_longest_distance_to_gate () const
 Get a map from an integer distance to all gates that are reachable within at most that distance when starting at any input flip-flop. More...
 

Static Public Member Functions

static Result< std::unique_ptr< RoundCandidate > > from_register_candidate (RegisterCandidate *candidate)
 Compute a round candidate from a previously identified register candidate. More...
 

Detailed Description

A round candidate constructed from a previously discovered register candidate.

This class holds all information belonging to a round candidate. Round candidates are constructed from register candidates by copying the sub-circuit consisting of the input and (if pipelined) output registers as well as the next-state/round-function logic in between these registers. For round-based implementations, commonly only a single register exists that acts as an input and output register at the same time. In such cases, this register is considered to be the input register of the round function and an exact copy of the register will be appended to the round function outputs so that input and output register are guaranteed to be distinct.

Definition at line 52 of file round_candidate.h.

Constructor & Destructor Documentation

◆ RoundCandidate()

hal::hawkeye::RoundCandidate::RoundCandidate ( )
default

Default constructor for RoundCandidate.

◆ ~RoundCandidate()

hal::hawkeye::RoundCandidate::~RoundCandidate ( )
default

Default destructor for RoundCandidate.

Member Function Documentation

◆ from_register_candidate()

Result< std::unique_ptr< RoundCandidate > > hal::hawkeye::RoundCandidate::from_register_candidate ( RegisterCandidate candidate)
static

Compute a round candidate from a previously identified register candidate.

The netlist of this candidate will be a partial copy of the original netlist, comprising only the gates belonging to the registers and the logic computing the next state. In case of a round-based implementation, the output register will be a copy of the input register. All data structures of the round candidate will be initialized in the process.

Parameters
[in]candidate- The register candidate.
Returns
The round candidate on success, an error otherwise.

Definition at line 53 of file round_candidate.cpp.

References hal::combinational, hal::netlist_factory::create_netlist(), hal::data, ERR, hal::ff, hal::graph_algorithm::NetlistGraph::from_netlist(), hal::Endpoint::get_gate(), hal::Netlist::get_gate_library(), hal::hawkeye::RegisterCandidate::get_input_reg(), hal::hawkeye::RegisterCandidate::get_netlist(), hal::hawkeye::RegisterCandidate::get_output_reg(), hal::hawkeye::RegisterCandidate::get_size(), hal::BasePin< T >::get_type(), log_info, and OK.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_control_inputs()

const std::set< Net * > & hal::hawkeye::RoundCandidate::get_control_inputs ( ) const

Get the candidate's control inputs to the logic computing the next state.

Returns
The control inputs of the candidate.

Definition at line 377 of file round_candidate.cpp.

Referenced by hal::hawkeye::identify_sbox(), and hal::PYBIND11_PLUGIN().

◆ get_graph()

graph_algorithm::NetlistGraph * hal::hawkeye::RoundCandidate::get_graph ( ) const

Get the netlist graph of the round candidate.

Returns
The netlist graph of the candidate.

Definition at line 347 of file round_candidate.cpp.

Referenced by hal::hawkeye::locate_sboxes(), and hal::PYBIND11_PLUGIN().

◆ get_input_ffs_of_gate()

const std::map< Gate *, std::set< Gate * > > & hal::hawkeye::RoundCandidate::get_input_ffs_of_gate ( ) const

Get a map from each combinational gate of the round function to all the input flip-flops it depends on.

Returns
A map from gates to sets of input flip-flops.

Definition at line 392 of file round_candidate.cpp.

Referenced by hal::hawkeye::locate_sboxes(), and hal::PYBIND11_PLUGIN().

◆ get_input_reg()

const std::set< Gate * > & hal::hawkeye::RoundCandidate::get_input_reg ( ) const

Get the candidate's input register.

Returns
The input register of the candidate.

Definition at line 357 of file round_candidate.cpp.

Referenced by hal::hawkeye::identify_sbox(), hal::hawkeye::locate_sboxes(), and hal::PYBIND11_PLUGIN().

◆ get_longest_distance_to_gate()

const std::map< u32, std::set< Gate * > > & hal::hawkeye::RoundCandidate::get_longest_distance_to_gate ( ) const

Get a map from an integer distance to all gates that are reachable within at most that distance when starting at any input flip-flop.

Returns
A map from longest distance to a set of gates being reachable in at most that distance.

Definition at line 397 of file round_candidate.cpp.

Referenced by hal::hawkeye::locate_sboxes(), and hal::PYBIND11_PLUGIN().

◆ get_netlist()

Netlist * hal::hawkeye::RoundCandidate::get_netlist ( ) const

Get the netlist of the round candidate. The netlist is a partial copy of the netlist of the register candidate.

Returns
The netlist of the candidate.

Definition at line 342 of file round_candidate.cpp.

Referenced by hal::hawkeye::identify_sbox(), hal::hawkeye::locate_sboxes(), and hal::PYBIND11_PLUGIN().

◆ get_other_inputs()

const std::set< Net * > & hal::hawkeye::RoundCandidate::get_other_inputs ( ) const

Get the candidate's other inputs to the logic computing the next state.

Returns
The other inputs of the candidate.

Definition at line 382 of file round_candidate.cpp.

Referenced by hal::hawkeye::identify_sbox(), and hal::PYBIND11_PLUGIN().

◆ get_output_reg()

const std::set< Gate * > & hal::hawkeye::RoundCandidate::get_output_reg ( ) const

Get the candidate's output register.

Returns
The output register of the candidate.

Definition at line 362 of file round_candidate.cpp.

Referenced by hal::hawkeye::locate_sboxes(), and hal::PYBIND11_PLUGIN().

◆ get_size()

u32 hal::hawkeye::RoundCandidate::get_size ( ) const

Get the size of the candidate, i.e., the width of its registers.

Returns
The size of the candidate.

Definition at line 352 of file round_candidate.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_state_inputs()

const std::set< Net * > & hal::hawkeye::RoundCandidate::get_state_inputs ( ) const

Get the candidate's state inputs to the logic computing the next state.

Returns
The state inputs of the candidate.

Definition at line 372 of file round_candidate.cpp.

Referenced by hal::hawkeye::identify_sbox(), and hal::PYBIND11_PLUGIN().

◆ get_state_logic()

const std::set< Gate * > & hal::hawkeye::RoundCandidate::get_state_logic ( ) const

Get the candidate's combinational logic computing the next state.

Returns
The state logic of the candidate.

Definition at line 367 of file round_candidate.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_state_outputs()

const std::set< Net * > & hal::hawkeye::RoundCandidate::get_state_outputs ( ) const

Get the candidate's state outputs from the logic computing the next state.

Returns
The state outputs of the candidate.

Definition at line 387 of file round_candidate.cpp.

Referenced by hal::PYBIND11_PLUGIN().


The documentation for this class was generated from the following files: