PROLEAD
A Probing-Based Leakage Detection Tool for Hardware and Software
Loading...
Searching...
No Matches
Definitions.hpp
Go to the documentation of this file.
1#pragma once
2#include <stdint.h>
3#include <vector>
4#include <unordered_map>
5
8#include "Util/Util.hpp"
9
10#define Max_Num_Register 17
11#define Max_Name_Length 10000
12
13namespace Software{
14
20 {
22 int* Probes = NULL;
23 char** ProbeName = NULL;
24 };
25
31 {
37 int** Group_Values = NULL;
39
40 int Hardware = 0;
41
42 int ClockSignal = 0;
45
47 int* AlwaysRandomInputs = NULL;
48
51 int** InitialSim_Inputs = NULL;
52 char** InitialSim_InputName = NULL;
53 std::unordered_map<std::string, uint32_t> InitialSim_PositionInEmulatorRam;
54 int* InitialSim_InputsLength = NULL; // A list that contains the length of each input
55 uint64_t** InitialSim_Values = NULL;
56 uint8_t* InitialSim_IsInitialized = NULL; //< List of identifiers if input is array or variable and if the input has a fixed value or not.
57
61 uint64_t* EndSimCondition_Values = NULL;
63
64 int TestOrder = 0;
69 int* TestClockCycles = NULL;
70 uint64_t NumberOfSimulations = 0;
73
74
80 {
83 };
84
90 {
91 std::string name;
92 std::vector<mulator::u8> bytes;
94 };
95
96
102 std::vector<CodeSection> binary; //< A list that contains all information of the binary
103 std::vector<mulator::u32> halt_addresses;
104 std::vector<mulator::u32> symbol_addresses;
105 std::unordered_map<mulator::u32, std::string> symbol_names;
111
114 std::string compilerFlags;
115 std::vector<std::string> externalBinaryInformation;
116 std::string externalMake; //< Decision if the binary is directly provided or needs to be generated by PROLEAD
117 };
118
120 {
122 uint8_t RegisterBit;
123 uint32_t ClockCycle;
124 uint8_t ProbeValue;
125 ExtendedProbesStruct(uint8_t RegNr, uint8_t RegBit, uint32_t Clk, uint8_t Val);
126 };
127
133 {
134
136 uint64_t ProbeInfo;
137 uint64_t SpecialInfo;
138 };
139
145 std::vector<uint32_t> RegisterLatestValue;
146 std::vector<uint32_t> RegisterLatestClockCycle;
150 std::vector<uint32_t> VerticalLatestClockCycle;
152 };
153
154
160 {
163
165 int TestOrder = 0;
169 std::vector<int> TestClockCycles;
170
173
174 };
175
176
182 uint32_t NumberOfGroups;
183 uint32_t GlobalCycleStart = 0;
184 uint32_t GlobalCycleEnd = 0;
185 std::vector<uint32_t> CycleStart;
186 std::vector<uint32_t> CycleEnd;
188 uint32_t NumberOfCycleSplits = 0;
189 std::vector<int> SelectedGroups;
190 std::vector<std::vector<::Software::ProbesStruct>> StandardProbesPerSimulation; //[simulation], [number of probes]
191 std::vector<int> TestClockCycles;
194 int TestOrder = 0;
197 std::vector<std::vector<uint32_t>> StartRAM_EndRAM_EmulatorInputs; //[#inputs][start addr in ram, end addr in ram]
198
199 // By default, we set the allowed false-positive probability to 10^-5
200 // If necessary, please change the false-positive probability here.
201 // Important: Give probability as negative logarithmic value
202 double AlphaThreshold = 5.0;
203
204 // By default, we set the allowed false-negative probability to 10^-5
205 // If necessary, please change the false-negative probability here.
206 double BetaThreshold = 0.00001;
207 double EffectSize = 0.1;
208 };
209
215 {
216 std::vector<std::vector<uint8_t>> NormalProbesIncluded;
217 std::vector<std::vector<uint8_t>> HorizontalBitsIncluded;
218 std::vector<std::vector<std::tuple<uint8_t, uint8_t>>> VerticalProbesIncluded;
219 std::vector<std::vector<uint8_t>> FullVerticalProbesIncluded;
220 std::vector<uint8_t> MemoryProbesIncluded;
222 std::vector<std::vector<uint8_t>> PipelineForwardingProbesIncluded;
223 std::vector<std::vector<uint8_t>> FULLHRProbesIncluded;
224
230
231
232 std::vector<bool> HorizontalProbesExcluded;
233
234 std::vector<std::vector<uint32_t>> VerticalProbesSize;
235 std::vector<std::vector<uint32_t>> FullHorizontalProbesSize;
238
239
240 std::vector<uint8_t> FullVerticalRelevantBits;
241 std::vector<uint8_t> PipelineForwardingRelevantBits;
242
244 };
245
251 {
252 std::vector<uint32_t> BytelengthOfParams;
253 std::vector<std::vector<uint8_t>> ByteValuesOfParams;
254 std::vector<uint8_t> VariableOrArrayParams; //if variable -> input written into register, else written into memory with register containing memory address
255 std::vector<uint32_t> StartaddrInRAM;
256 };
257
265 {
267 std::vector<::Software::ProbesStruct> StandardProbe;
269
270 ProbingSetStruct(std::vector<::Software::ProbesStruct>& Probe);
272 ProbingSetStruct(uint32_t TestOrder);
273 };
274
280 {
281 std::vector<::Software::ProbesStruct> Combination;
282 std::vector<bool> CombinationBitmask;
283 std::vector<::Software::ProbingSetStruct> GlobalProbingSets;
284 std::vector<uint32_t> NumberOfSets; //[NumberOfStepSimulation]
285 std::vector<std::vector<::Software::ProbingSetStruct>> ProbingSet; //[NumberOfStepSimulation][]
286
287 void Reset();
288 };
289
290}
291//***************************************************************************************
292
void FreeAllocatedMemory(Software::SharedDataStruct *SharedData, Software::SettingsStruct *Settings, ::Software::SimulationStruct *Simulation, Software::ProbesStruct *Probes)
uint32_t u32
Definition: types.h:12
Defines a probe that will be used in the preparation step.
Definition: Definitions.hpp:20
int * Probes
A list of probe indices.
Definition: Definitions.hpp:22
int NumberOfProbes
The number of probes.
Definition: Definitions.hpp:21
char ** ProbeName
A list of probe names.
Definition: Definitions.hpp:23
ExtendedProbesStruct(uint8_t RegNr, uint8_t RegBit, uint32_t Clk, uint8_t Val)
Defines a struct that track meta information for probes.
uint32_t FullVerticalProbesSize
Contains probe size of full vertical probe.
std::vector< uint8_t > MemoryProbesIncluded
stores bit position of a memory word that will be probed
std::vector< std::vector< uint32_t > > FullHorizontalProbesSize
Contains probe size of each register for full horizontal probe.
bool ProbeFullVertical
Decision if full vertical should be probed.
std::vector< std::vector< uint8_t > > FULLHRProbesIncluded
Store the probes which are not excluded in a horizontal probe.
std::vector< bool > HorizontalProbesExcluded
Decision which bits should be probed in a horizontal probe.
std::vector< std::vector< std::tuple< uint8_t, uint8_t > > > VerticalProbesIncluded
Store the probes which are not excluded in a vertical probe.
std::vector< std::vector< uint8_t > > HorizontalBitsIncluded
Store the probes which are not excluded in a horizontal probe.
bool ProbeMemory
Decision if memory should be probed.
std::vector< std::vector< uint8_t > > NormalProbesIncluded
stores bit position of every register that will be probed
std::vector< uint8_t > FullVerticalRelevantBits
std::vector< uint8_t > MemoryShadowRegisterProbesIncluded
stores bit position of the shadow memory register that will be probed
std::vector< std::vector< uint8_t > > PipelineForwardingProbesIncluded
[32][] one pipeline probe contains included register of i-th bit with a depth of #PipelineSize
bool ProbePipelineForwarding
Decision if pipeline forwarding should be probed.
std::vector< std::vector< uint32_t > > VerticalProbesSize
Contains probe size of each register for vertical probe.
std::vector< uint8_t > PipelineForwardingRelevantBits
uint32_t PipelineForwardingProbesSize
Contains probe size of pipeline forwarding probe
std::vector< std::vector< uint8_t > > FullVerticalProbesIncluded
[32][] one vertical probe contains included register of i-th bit
bool ProbeMemoryShadowRegister
Decision if memory shadow register should be probed.
bool ProbeFullHorizontal
Decision if full horizontal should be probed.
Defines a struct that tracks metadata during the simulation.
uint32_t StoreMemoryLatestClockCycle
Cycle that last used a store memory instruction.
std::vector< uint32_t > VerticalLatestClockCycle
std::vector< uint32_t > RegisterLatestValue
List of previous values for each register.
uint32_t MemoryLatestClockCycle
Cycle that last used a memory instruction.
uint32_t LoadMemoryLatestClockCycle
Cycle that last used a load memory instruction.
std::vector< uint32_t > RegisterLatestClockCycle
List of cycles where each register was used last.
Defines how every probe during simulation looks like.
uint64_t ProbeInfo
Uniquly identifies a probe, (Cycle | Dependency | ID | RegNr1 | RegNr2 | Bit | ExtensionSize)
uint64_t TransitionCycles
Contains previous cycle where probed register was used last.
uint64_t SpecialInfo
Contains information that might change depending on type of probe.
Defines a probing set.
ProbingSetStruct(uint32_t TestOrder)
Util::ContingencyTableStruct ContingencyTable
The contingency table storing the occurences of values probed by the extended probes.
std::vector<::Software::ProbesStruct > StandardProbe
The standard probes placed by an adversary.
ProbingSetStruct(::Software::ProbesStruct &Probe)
ProbingSetStruct(std::vector<::Software::ProbesStruct > &Probe)
Defines how the Emulator models the code section.
Definition: Definitions.hpp:90
std::string name
each section consists of a corresponding name
Definition: Definitions.hpp:91
std::vector< mulator::u8 > bytes
each section contains
Definition: Definitions.hpp:92
Defines how the Emulator models the memory.
Definition: Definitions.hpp:80
Defines all settings regarding software simulations.
Definition: Definitions.hpp:31
int ClockSignal
The index of the clock signal.
Definition: Definitions.hpp:42
int ** InitialSim_Inputs
The indices of the initialization signals.
Definition: Definitions.hpp:51
std::vector< mulator::u32 > halt_addresses
int * MaxNumberOfSharesGroupValues
The number of shares per input bit.
Definition: Definitions.hpp:38
uint64_t NumberOfStepSimulationsToWrite
The number of simulations before a report is written.
Definition: Definitions.hpp:72
int NumberOfAlwaysRandomInputs
Number of fresh random inputs.
Definition: Definitions.hpp:46
int Max_No_ClockCycles
The maximum number of clock cycles to simulate.
Definition: Definitions.hpp:43
uint8_t * InitialSim_IsInitialized
Definition: Definitions.hpp:56
uint64_t * EndSimCondition_Values
The values the signals have to reach to terminate the simulation.
Definition: Definitions.hpp:61
int Max_No_ReportEntries
The maximum number of entries in the report.
Definition: Definitions.hpp:44
uint32_t NumberOfPipelineStages
number of pipeline stages provided by the user
std::vector< mulator::u32 > symbol_addresses
char ** InitialSim_InputName
A list of input names to create a link for the emulator.
Definition: Definitions.hpp:52
std::vector< CodeSection > binary
mulator::u32 randomness_end_addr
end address of emulator internal randomness section
int NumberOfGroups
The number of user-defined groups.
Definition: Definitions.hpp:33
int * TestClockCycles
The particular clock cycles the adversary can target.
Definition: Definitions.hpp:69
mulator::u32 randomness_start_addr
start address of emulator internal randomness section
std::string compilerFlags
compiler flags that will be parsed to tell the compiler how to compile
char MinimizeProbeSets
Decision whether the number of probing sets should be minimized before the evaluation.
Definition: Definitions.hpp:36
int Max_no_of_Threads
The maximum number of threads PROLEAD can use for parallelism.
Definition: Definitions.hpp:32
int ** Group_Values
The values assigned to the user-defined groups.
Definition: Definitions.hpp:37
int * EndSimCondition_Signals
The indices of the single-bit signals terminating the simulation.
Definition: Definitions.hpp:60
int EndSim_NumberOfWaitCycles
Number of cycles to wait after each simulation.
Definition: Definitions.hpp:62
int InitialSim_NumberOfClockCycles
The number of clock cycles to initialize the simulation.
Definition: Definitions.hpp:50
int NumberOfTestClockCycles
The number of clock cycles in which the adversary can place probes.
Definition: Definitions.hpp:68
int TestTransitional
Decision whether transitional leakage is included.
Definition: Definitions.hpp:67
std::unordered_map< mulator::u32, std::string > symbol_names
int TestOrder
The security order to test.
Definition: Definitions.hpp:64
uint64_t ** InitialSim_Values
The signal values during the initialization cycles.
Definition: Definitions.hpp:55
mulator::u32 length_occupied_ram
int MaxDistanceMultivariet
The maximum distance in time, i.e. clock cycles, for multivariate adversaries.
Definition: Definitions.hpp:66
mulator::u32 main_address
start address of main function
mulator::u32 start_address
address of cipher where PROLEAD starts to evaluate
int TestMultivariate
Decision whether univariate or multivariate adversaries should be considered.
Definition: Definitions.hpp:65
uint64_t NumberOfSimulations
The total number of simulations.
Definition: Definitions.hpp:70
int InitialSim_NumberOfInputs
The number of inputs which are assigned to initialize the simulation.
Definition: Definitions.hpp:49
int * AlwaysRandomInputs
Indices of the fresh random input signals.
Definition: Definitions.hpp:47
int EndSimCondition_ClockCycles
The number of clock cycles after which the simulation terminates.
Definition: Definitions.hpp:58
std::unordered_map< std::string, uint32_t > InitialSim_PositionInEmulatorRam
Definition: Definitions.hpp:53
std::vector< std::string > externalBinaryInformation
contains path to binary, disassembled file and .map file in case of directly provided binary
MemoryRange ram
RAM memory region for emulator.
Definition: Definitions.hpp:99
std::string funcContainingCipher
name of function containing cipher to search in disassembled file
int EndSimCondition_NumberOfSignals
The bit width of the signal which terminates the simulation.
Definition: Definitions.hpp:59
MemoryRange flash
Flash memory region for emulator.
Definition: Definitions.hpp:98
int NumberOfGroupValues
The size of the group values, i.e. their bit length.
Definition: Definitions.hpp:34
char CompactDistributions
Decision whether the evaluation should be performed in compact or normal mode.
Definition: Definitions.hpp:35
mulator::Architecture arch
ISA version of the binary.
Definition: Definitions.hpp:97
uint64_t NumberOfStepSimulations
The number of simulations before the simulations are evaluated.
Definition: Definitions.hpp:71
mulator::u32 randomness_segment_length
length of emulator internal randomness section
Defines the shared state of a simulation.
std::vector< uint8_t > VariableOrArrayParams
std::vector< uint32_t > StartaddrInRAM
address of shared data in RAM
std::vector< std::vector< uint8_t > > ByteValuesOfParams
values of shared data in byte size
std::vector< uint32_t > BytelengthOfParams
length of shared data in bytes
Defines a struct that tracks necessary information for simulation.
std::vector< int > TestClockCycles
List that contains the index of every clock cycle that should be tested.
uint64_t NumberOfProcessedSimulations
The number of currently processed simulations.
int NumberOfGroups
The number of user-defined groups.
int TestTransitional
Decision regarding transitional leakage.
int NumberOfTestClockCycles
Number of clock cycles in which standard probes can record.
int TestMultivariate
Decision regarding univariate and multivariate attackers.
char * EvaluationResultFolderName
Name and path of the generated reports.
int TestOrder
The security order to test.
int NumberOfProbes
The total number of standard probes.
Defines all settings belonging to the test prodecure.
std::vector<::Software::ProbesStruct > Combination
std::vector< std::vector<::Software::ProbingSetStruct > > ProbingSet
std::vector< bool > CombinationBitmask
std::vector< uint32_t > NumberOfSets
std::vector<::Software::ProbingSetStruct > GlobalProbingSets
Defines a struct that tracks necessary information for thread simulation.
int TestOrder
The security order to test.
std::vector< std::vector< uint32_t > > StartRAM_EndRAM_EmulatorInputs
std::vector< int > SelectedGroups
// [0...NumberOfStepSimulations-1]
std::vector< uint32_t > CycleStart
uint32_t NumberOfTestClockCycles
Number of clock cycles in which standard probes can record.
uint32_t NumberOfGroups
The number of user-defined groups.
std::vector< int > TestClockCycles
//assign only needed TestClockCycles for specific thread to vector
int TestMultivariate
Decision regarding univariate and multivariate attackers.
std::string EvaluationResultFolderName
Name and path of the generated reports.
int TestTransitional
Decision regarding transitional leakage.
std::vector< uint32_t > CycleEnd
uint32_t NumberOfStepSimulations
The number of simulations before the simulations are evaluated.
std::vector< std::vector<::Software::ProbesStruct > > StandardProbesPerSimulation
Defines a contingency table.
Definition: Util.hpp:58