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
3#include <cinttypes>
4#include <vector>
5#include <bits/stdc++.h>
6#include "Util/Util.hpp"
7
8#define Max_Name_Length 10000
9
10#define FullOne 0xffffffffffffffff
11#define GroupInput 0x8000000000000000
12#define RandomInput 0x4000000000000000
13#define SameInput 0x2000000000000000
14#define GroupInMask 0xf000000000000000
15
16#define CellType_Gate 0
17#define CellType_Reg 1
18
19#define Operation_AND 0
20#define Operation_OR 1
21#define Operation_XOR 2
22#define Operation_NOT 3
23
24#define SignalType_input 0
25#define SignalType_output 1
26#define SignalType_wire 2
27
28#define Task_find_module_type 0
29#define Task_find_module_name 1
30#define Task_find_open_bracket 2
31#define Task_find_point 3
32#define Task_find_IO_port 4
33#define Task_find_signal_name 5
34#define Task_find_close_bracket 6
35#define Task_find_comma 7
36#define Task_find_assign_signal_name1 8
37#define Task_find_equal 9
38#define Task_find_assign_signal_name2 10
39
40namespace Hardware
41{
43 {
44 unsigned char NumberOfClauses;
47 unsigned char **OperandsInClause;
48 };
49
51 {
53 unsigned char NumberOfCases;
54 char **Cases;
56 char **Inputs;
58 char **Outputs;
59 char **Expresions;
62 };
63
69 {
73 };
74
76 {
77 int Type;
78 char *Name;
80 short Depth;
82 int *Inputs;
84 int *Outputs;
86 char Deleted;
87 };
88
90 {
91 char* Name;
92 char Type;
93 short Depth;
94 int Output;
96 int* Inputs;
98 char Deleted;
99 };
100
106 {
109 int* Inputs = NULL;
110 int* Outputs = NULL;
114
117 int* Gates = NULL;
118 int* Regs = NULL;
120 int NumberOfRegs = 0;
122
123 short MaxDepth = 0;
124 int** CellsInDepth = NULL;
126 };
127
133 {
136
142 unsigned int ProbeStepSize;
143 int** Group_Values = NULL;
145
149
151 int* AlwaysRandomInputs = NULL;
152
155 int** InitialSim_Inputs = NULL;
156 uint64_t** InitialSim_Values = NULL;
157
161 uint64_t* EndSimCondition_Values = NULL;
163
166 int** OutputSignals = NULL;
167 int** ExpectedOutputValues = NULL;
168
169 int TestOrder = 0;
174 int* TestClockCycles = NULL;
175 uint64_t NumberOfSimulations = 0;
178
179 // By default, we set the allowed false-positive probability to 10^-5
180 // If necessary, please change the false-positive probability here.
181 // Important: Give probability as negative logarithmic value
182 double AlphaThreshold = 5.0;
183
184 // By default, we set the allowed false-negative probability to 10^-5
185 // If necessary, please change the false-negative probability here.
186 double BetaThreshold = 0.00001;
187
188 // In statistics an effect size of 0.1 is denoted as a "small effect size"
190
191 bool WaveformSimulation = false;
192 };
193
199 {
201 int* Probes = NULL;
202 };
203
209 {
211 int* Probes = NULL;
212 char** ProbeName = NULL;
213
215 };
216
222 {
223 uint64_t* OneIn64 = NULL;
224 uint64_t* ZeroIn64 = NULL;
225 uint64_t* SignalValues = NULL;
226 uint64_t* RegValues = NULL;
227 uint64_t** GroupValues = NULL;
228 uint64_t** SelectedGroupValues = NULL;
229 uint64_t* LastInitialSimValues = NULL;
230 };
231
237 {
240
242 char** ProbeName = NULL;
244
249
250 int TestOrder = 0;
254 int* TestClockCycles = NULL;
255
257 uint64_t NumberOfSimulations = 0;
261
262 int* SelectedGroups = NULL;
263 char*** ProbeValues;
264 };
265
271 {
272 unsigned int Probe;
273 unsigned int Cycle;
274
282
289 ProbePositionStruct(unsigned int, unsigned int);
290 };
291
299 {
300 std::vector<unsigned int> Standard;
301 std::vector<unsigned int> Extension;
303
309 ProbingSetStruct(unsigned int);
310
316 ProbingSetStruct(std::vector<unsigned int>&);
317
328
337 };
338
344 {
345 unsigned int Probe = 0;
346 unsigned int Cycle = 0;
347 unsigned int NumberOfProbeSets = 0;
348 unsigned int* ProbeSetIndexes = NULL;
349 };
350
356 {
357 std::vector<double> SumOverGroup;
358 std::vector<Hardware::ProbingSetStruct> ProbingSet;
359 std::vector<std::vector<int>> TempProbeValue;
360 std::vector<std::vector<Util::TableEntryStruct>> TableEntries;
363
364 std::vector<Hardware::ProbePositionStruct> StandardProbes;
365 std::vector<Hardware::ProbePositionStruct> ExtendedProbes;
366
373
380 int GetNumberOfStandardProbes(unsigned int);
381
390
399
408
417 };
418}
unsigned char NumberOfCases
Definition: Definitions.hpp:53
Hardware::OperationStruct * Operations
Definition: Definitions.hpp:60
Defines a hardware circuit.
short MaxDepth
The maximum circuit depth.
int NumberOfRegs
The number of registers in the circuit.
Hardware::SignalStruct ** Signals
The circuit signals.
int ** CellsInDepth
The indices of cells with a specific depth.
int * Outputs
The indices of all primary output signals.
int * NumberOfCellsInDepth
The number of cells with a specific depth.
int * Gates
The indices of all gates.
Hardware::CellStruct ** Cells
The circuit cells.
int NumberOfCells
The number of cells in the circuit.
int NumberOfGates
The indices of all regs.
int NumberOfOutputs
Number of primary outputs.
int * Inputs
The indices of all primary input signals.
int NumberOfInputs
Number of primary inputs.
int NumberOfSignals
The total number of signals in the circuit.
Defines an already extended probe, i.e. a set of glitch extended probes.
int * Probes
A list of glitch-extended probes.
int NumberOfProbes
The number of glitch-extended probes.
Defines a cell library.
Definition: Definitions.hpp:69
int NumberOfCellTypes
The number of different cell types in the library.
Definition: Definitions.hpp:70
Hardware::CellTypeStruct ** CellTypes
The different cell types in the library.
Definition: Definitions.hpp:71
unsigned char * NumberOfOperandsInClause
Definition: Definitions.hpp:46
unsigned char ** OperandsInClause
Definition: Definitions.hpp:47
unsigned char NumberOfClauses
Definition: Definitions.hpp:44
Defines a single probe.
ProbePositionStruct(unsigned int, unsigned int)
Initializes a single probe with a specific position and clock cycle.
unsigned int Cycle
The clock cycle in which the signal driven by a wire is recorded.
ProbePositionStruct()
Initializes a new probe.
unsigned int Probe
The position of a probe, i.e. the probed signal, given by the index of the signal.
Defines a probing set, i.e. a set of standard probes with their corresponding glitch extensions.
Hardware::GlitchExtendedProbesStruct * GlitchExtendedProbes
A list of glitch-extensions per standard probe.
char ** ProbeName
A list of the standard probe names.
int NumberOfProbes
The number of standard probes.
int * Probes
A list of the standard probe indices.
Defines a probing set.
bool Covers(Hardware::ProbingSetStruct &)
Checks if the probing set covers another probing set.
ProbingSetStruct(unsigned int)
Initializes a probing set with a single standard probe.
ProbingSetStruct(std::vector< unsigned int > &)
Initializes a probing set with a list of standard probes.
std::vector< unsigned int > Extension
The extensions of the standard probes, i.e. glitch- and transition-extended probes.
Util::ContingencyTableStruct ContingencyTable
The contingency table storing the occurences of values probed by the extended probes.
std::vector< unsigned int > Standard
The standard probes placed by an adversary.
int FindEntry(Util::TableEntryStruct &, unsigned int)
Checks if the contingency table contains a particular entry.
Defines the settings of the evaluation procedure.
int Max_No_ReportEntries
The maximum number of entries in the report.
char CompactDistributions
Decision whether the evaluation should be performed in compact or normal mode.
int ** OutputSignals
The simulated output signals (unshared).
int TestTransitional
Decision whether transitional leakage is included.
int TestMultivariate
Decision whether univariate or multivariate adversaries should be considered.
int ** Group_Values
The values assigned to the user-defined groups.
int NumberOfTestClockCycles
The number of clock cycles in which the adversary can place probes.
int InitialSim_NumberOfInputs
The number of inputs which are assigned to initialize the simulation.
int * TestClockCycles
The particular clock cycles the adversary can target.
char * ModuleName
The name of the top module.
int * EndSimCondition_Signals
The indices of the single-bit signals terminating the simulation.
int EndSim_NumberOfWaitCycles
Number of cycles to wait after each simulation.
uint64_t NumberOfStepSimulationsToWrite
The number of simulations before a report is written.
unsigned int ProbeStepSize
The number of probing sets to evaluate per execution step.
uint64_t NumberOfStepSimulations
The number of simulations before the simulations are evaluated.
int TestOrder
The security order to test.
char MinimizeProbeSets
Decision whether the number of probing sets should be minimized before the evaluation.
int EndSimCondition_NumberOfSignals
The bit width of the signal which terminates the simulation.
uint64_t ** InitialSim_Values
The signal values during the initialization cycles.
int InitialSim_NumberOfClockCycles
The number of clock cycles to initialize the simulation.
int ClockSignal
The index of the clock signal.
int NumberOfOutputSignals
The bit width of the shared output.
int NumberOfGroups
The number of user-defined groups.
uint64_t NumberOfSimulations
The total number of simulations.
int NumberOfGroupValues
The size of the group values, i.e. their bit length.
int Max_no_of_Threads
The maximum number of threads PROLEAD can use for parallelism.
int Max_No_ClockCycles
The maximum number of clock cycles to simulate.
int * MaxNumberOfSharesGroupValues
The number of shares per input bit.
int ** ExpectedOutputValues
The expected unshared output given by the user.
int * AlwaysRandomInputs
Indices of the fresh random input signals.
int NumberOfAlwaysRandomInputs
Number of fresh random inputs.
int EndSimCondition_ClockCycles
The number of clock cycles after which the simulation terminates.
int ** InitialSim_Inputs
The indices of the initialization signals.
int MaxDistanceMultivariet
The maximum distance in time, i.e. clock cycles, for multivariate adversaries.
char RemoveProbingSets
Decision whether probing sets achieving a sufficient confidence level should be removed.
int NumberOfOutputShares
The number of output shares.
uint64_t * EndSimCondition_Values
The values the signals have to reach to terminate the simulation.
Defines the shared state of a simulation.
Defines all settings regarding simulations.
Hardware::GlitchExtendedProbesStruct * GlitchExtendedProbes
The glitch-extended probes belonging to the standard probes.
uint64_t NumberOfStepSimulationsToWrite
The number of simulations after which reports are written.
int NumberOfProbes
The total number of standard probes.
uint64_t NumberOfProcessedSimulations
The number of currently processed simulations.
int * SelectedGroups
The chosen group for each simulation.
int NumberOfTestClockCycles
Number of clock cycles in which standard probes can record.
uint64_t NumberOfStepSimulations
The number of simulations per step. After each step the contingency tables are updated.
uint64_t NumberOfSimulations
The total number of simulations.
int NumberOfGroups
The number of user-defined groups.
int NumberOfAllGlitchExtendedProbes
The total number of glitch-extended probes.
char ** ProbeName
The names of the standard probes, i.e. the name of the probed wire.
char *** ProbeValues
The simulated states of all wires during different simulations and clock cycles.
int NumberOfClockCycles
Number of clock cycles to simulate, i.e. the duration of one simulation.
char * EvaluationResultFolderName
Name and path of the generated reports.
int TestMultivariate
Decision regarding univariate and multivariate attackers.
int TestOrder
The security order to test.
int * TestClockCycles
The list of clock cycles to test.
int TestTransitional
Decision regarding transitional leakage.
char ** GlitchExtendedProbeName
The names of the glitch-extended probes, i.e. the name of the probed wire.
Defines all settings belonging to the test prodecure.
std::vector< std::vector< Util::TableEntryStruct > > TableEntries
A list of table entries which will be added to the contingency tables in normal mode.
Hardware::ProbePositionStruct GetExtendedProbe(unsigned int, unsigned int)
Gives a particular (glitch or transition)-extended probe inside a probing set.
int GetNumberOfStandardProbes(unsigned int)
Computes the number of standard probes in a probing set.
std::vector< Hardware::ProbePositionStruct > ExtendedProbes
A list of all glitch-extended probes.
std::vector< double > SumOverGroup
Stores the number of simulations per group.
Hardware::UniqueProbeStruct ** UniqueProbe
Hardware::ProbePositionStruct GetStandardProbe(Hardware::ProbingSetStruct &, unsigned int)
Gives a particular standard probe inside a probing set.
Hardware::ProbePositionStruct GetExtendedProbe(Hardware::ProbingSetStruct &, unsigned int)
Gives a particular (glitch or transition)-extended probe inside a probing set.
Hardware::ProbePositionStruct GetStandardProbe(unsigned int, unsigned int)
Gives a particular standard probe inside a probing set.
TestStruct(Hardware::SimulationStruct &)
Initializes the test settings.
std::vector< Hardware::ProbingSetStruct > ProbingSet
A list of all probing sets to evaluate.
std::vector< std::vector< int > > TempProbeValue
A list of table entries which will be added to the contingency tables in compact mode.
std::vector< Hardware::ProbePositionStruct > StandardProbes
A list of all standard probes.
Defines a unique probe for the compact mode.
unsigned int Probe
The position of a probe, i.e. the probed signal, given by the index of the signal.
unsigned int NumberOfProbeSets
The number of probing sets in which this standard probe occurs.
unsigned int Cycle
The clock cycle in which the signal driven by a wire is recorded.
unsigned int * ProbeSetIndexes
The indices of all probing sets in which this standard probe occurs.
Defines a contingency table.
Definition: Util.hpp:58
Defines one entry of a contingency table.
Definition: Util.hpp:22