oblivious.sc

oblivious.sc

Module with functions for oblivious tasks.

Functions:

matrixLookup

Function for obliviously looking up an element in the input matrix.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

mat

- a 2-dimensional matrix of supported type

rowIndex

- an uint type scalar for specifying the row in the input matrix

colIndex

- an uint type scalar for specifying the column in the input matrix

returns the element from the input matrix specified by rowIndex and colIndex

None

Function Overloads

D bool matrixLookup(D bool[[2]] mat, D uint rowIndex, D uint columnIndex)

D uint8 matrixLookup(D uint8[[2]] mat, D uint rowIndex, D uint columnIndex)

D uint16 matrixLookup(D uint16[[2]] mat, D uint rowIndex, D uint columnIndex)

D uint32 matrixLookup(D uint32[[2]] mat, D uint rowIndex, D uint columnIndex)

D uint matrixLookup(D uint[[2]] mat, D uint rowIndex, D uint columnIndex)

D int8 matrixLookup(D int8[[2]] mat, D uint rowIndex, D uint columnIndex)

D int16 matrixLookup(D int16[[2]] mat, D uint rowIndex, D uint columnIndex)

D int32 matrixLookup(D int32[[2]] mat, D uint rowIndex, D uint columnIndex)

D int matrixLookup(D int[[2]] mat, D uint rowIndex, D uint columnIndex)

D float32 matrixLookup(D float32[[2]] mat, D uint rowIndex, D uint columnIndex)

D float64 matrixLookup(D float64[[2]] mat, D uint rowIndex, D uint columnIndex)

matrixLookupColumn

Function for obliviously looking up a column in a matrix.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

mat

- a 2-dimensional matrix of supported type

colIndex

- an uint type scalar for specifying the column of the input matrix to look up

returns the column from the input matrix specified by colIndex

None

Function Overloads

D bool matrixLookupColumn(D bool[[2]] mat, D uint colIndex)

D uint8 matrixLookupColumn(D uint8[[2]] mat, D uint colIndex)

D uint16 matrixLookupColumn(D uint16[[2]] mat, D uint colIndex)

D uint32 matrixLookupColumn(D uint32[[2]] mat, D uint colIndex)

D uint matrixLookupColumn(D uint[[2]] mat, D uint colIndex)

D int8 matrixLookupColumn(D int8[[2]] mat, D uint colIndex)

D int16 matrixLookupColumn(D int16[[2]] mat, D uint colIndex)

D int32 matrixLookupColumn(D int32[[2]] mat, D uint colIndex)

D int matrixLookupColumn(D int[[2]] mat, D uint colIndex)

D float32 matrixLookupColumn(D float32[[2]] mat, D uint colIndex)

D float64 matrixLookupColumn(D float64[[2]] mat, D uint colIndex)

matrixLookupRow

Function for obliviously looking up a row in a matrix.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

mat

- a 2-dimensional matrix of supported type

rowIndex

- an uint type scalar for specifying the row of the input matrix to look up

returns the row from the input matrix specified by rowIndex

None

Function Overloads

D bool matrixLookupRow(D bool[[2]] mat, D uint rowIndex)

D uint8 matrixLookupRow(D uint8[[2]] mat, D uint rowIndex)

D uint16 matrixLookupRow(D uint16[[2]] mat, D uint rowIndex)

D uint32 matrixLookupRow(D uint32[[2]] mat, D uint rowIndex)

D uint matrixLookupRow(D uint[[2]] mat, D uint rowIndex)

D int8 matrixLookupRow(D int8[[2]] mat, D uint rowIndex)

D int16 matrixLookupRow(D int16[[2]] mat, D uint rowIndex)

D int32 matrixLookupRow(D int32[[2]] mat, D uint rowIndex)

D int matrixLookupRow(D int[[2]] mat, D uint rowIndex)

D float32 matrixLookupRow(D float32[[2]] mat, D uint rowIndex)

D float64 matrixLookupRow(D float64[[2]] mat, D uint rowIndex)

matrixUpdate

Function for obliviously updating a value in the input matrix.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int

Parameters

mat

- a matrix of supported type

rowIndex

- an uint type scalar for specifying the row in the input matrix

colIndex

- an uint type scalar for specifying the column in the input matrix

newValue

- a new scalar value

returns a matrix where the element at row rowIndex and column colIndex has been replaced with newValue

None

Function Overloads

D bool matrixUpdate(D bool[[2]] mat, D uint rowIndex, D uint columnIndex, D bool newValue)

D uint8 matrixUpdate(D uint8[[2]] mat, D uint rowIndex, D uint columnIndex, D uint8 newValue)

D uint16 matrixUpdate(D uint16[[2]] mat, D uint rowIndex, D uint columnIndex, D uint16 newValue)

D uint32 matrixUpdate(D uint32[[2]] mat, D uint rowIndex, D uint columnIndex, D uint32 newValue)

D uint matrixUpdate(D uint[[2]] mat, D uint rowIndex, D uint columnIndex, D uint newValue)

D int8 matrixUpdate(D int8[[2]] mat, D uint rowIndex, D uint columnIndex, D int8 newValue)

D int16 matrixUpdate(D int16[[2]] mat, D uint rowIndex, D uint columnIndex, D int16 newValue)

D int32 matrixUpdate(D int32[[2]] mat, D uint rowIndex, D uint columnIndex, D int32 newValue)

D int matrixUpdate(D int[[2]] mat, D uint rowIndex, D uint columnIndex, D int newValue)

matrixUpdateColumn

Function for obliviously updating a column in the input matrix.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int

Parameters

mat

- a matrix of supported type

colIndex

- an uint type scalar for specifying the column to replace

newCol

- a vector with new values

returns a matrix where the column at colIndex has been replaced with newCol

None

Function Overloads

D bool matrixUpdateColumn(D bool[[2]] mat, D uint colIndex, D bool[[1]] newCol)

D uint8 matrixUpdateColumn(D uint8[[2]] mat, D uint colIndex, D uint8[[1]] newCol)

D uint16 matrixUpdateColumn(D uint16[[2]] mat, D uint colIndex, D uint16[[1]] newCol)

D uint32 matrixUpdateColumn(D uint32[[2]] mat, D uint colIndex, D uint32[[1]] newCol)

D uint matrixUpdateColumn(D uint[[2]] mat, D uint colIndex, D uint[[1]] newCol)

D int8 matrixUpdateColumn(D int8[[2]] mat, D uint colIndex, D int8[[1]] newCol)

D int16 matrixUpdateColumn(D int16[[2]] mat, D uint colIndex, D int16[[1]] newCol)

D int32 matrixUpdateColumn(D int32[[2]] mat, D uint colIndex, D int32[[1]] newCol)

D int matrixUpdateColumn(D int[[2]] mat, D uint colIndex, D int[[1]] newCol)

matrixUpdateRow

Function for obliviously updating a row in the input matrix.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int

Parameters

mat

- a matrix of supported type

rowIndex

- an uint type scalar for specifying the row to replace

newRow

- a vector with new values

returns a matrix where the row at rowIndex has been replaced with newRow

None

Function Overloads

D bool matrixUpdateRow(D bool[[2]] mat, D uint rowIndex, D bool[[1]] newRow)

D uint8 matrixUpdateRow(D uint8[[2]] mat, D uint rowIndex, D uint8[[1]] newRow)

D uint16 matrixUpdateRow(D uint16[[2]] mat, D uint rowIndex, D uint16[[1]] newRow)

D uint32 matrixUpdateRow(D uint32[[2]] mat, D uint rowIndex, D uint32[[1]] newRow)

D uint matrixUpdateRow(D uint[[2]] mat, D uint rowIndex, D uint[[1]] newRow)

D int8 matrixUpdateRow(D int8[[2]] mat, D uint rowIndex, D int8[[1]] newRow)

D int16 matrixUpdateRow(D int16[[2]] mat, D uint rowIndex, D int16[[1]] newRow)

D int32 matrixUpdateRow(D int32[[2]] mat, D uint rowIndex, D int32[[1]] newRow)

D int matrixUpdateRow(D int[[2]] mat, D uint rowIndex, D int[[1]] newRow)

vectorLookup

Function for obliviously looking up an element in a vector.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

vec

- a 1-dimensional vector of supported type

index

- an uint type scalar for specifying the position in the vector to look up

returns the element in the vector specified by index

None

Function Overloads

D bool vectorLookup(D bool[[1]] vec, D uint index)

D uint8 vectorLookup(D uint8[[1]] vec, D uint index)

D uint16 vectorLookup(D uint16[[1]] vec, D uint index)

D uint32 vectorLookup(D uint32[[1]] vec, D uint index)

D uint vectorLookup(D uint[[1]] vec, D uint index)

D int8 vectorLookup(D int8[[1]] vec, D uint index)

D int16 vectorLookup(D int16[[1]] vec, D uint index)

D int32 vectorLookup(D int32[[1]] vec, D uint index)

D int vectorLookup(D int[[1]] vec, D uint index)

D float32 vectorLookup(D float32[[1]] vec, D uint index)

D float64 vectorLookup(D float64[[1]] vec, D uint index)

vectorUpdate

Function for obliviously updating an element in the input vector.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int

Parameters

vec

- a 1-dimensional vector of supported type

index

- an uint type scalar for specifying the element to replace

newValue

- a scalar value of the same type as the input vector

returns a vector with the value at position index replaced by newValue

None

Function Overloads

D bool vectorUpdate(D bool[[1]] vec, D uint index, D bool newValue)

D int8 vectorUpdate(D int8[[1]] vec, D uint index, D int8 newValue)

D int16 vectorUpdate(D int16[[1]] vec, D uint index, D int16 newValue)

D int32 vectorUpdate(D int32[[1]] vec, D uint index, D int32 newValue)

D int64 vectorUpdate(D int64[[1]] vec, D uint index, D int64 newValue)

D uint8 vectorUpdate(D uint8[[1]] vec, D uint index, D uint8 newValue)

D uint16 vectorUpdate(D uint16[[1]] vec, D uint index, D uint16 newValue)

D uint32 vectorUpdate(D uint32[[1]] vec, D uint index, D uint32 newValue)

D uint vectorUpdate(D uint64[[1]] vec, D uint index, D uint64 newValue)

choose

Function for obliviously choosing one of the inputs.

Functions:

D - all protection domains

returns one of the input arrays that was obliviously chosen with the condition

None

choose(multiple conditions)

Function for obliviously choosing pointwise from the inputs.

Detailed Description

D - all protection domains

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

cond

- a boolean array

first

- values for true case

second

- values for false case

pointwise check if cond at a certain position is true or false. if true the element of first at that position is returned else the element of second at that position is returned

None

Function Overloads

D bool choose(D bool[[N]] cond, D bool[[N]] first, D bool[[N]] second)

D uint8 choose(D bool[[N]] cond, D uint8[[N]] first, D uint8[[N]] second)

D uint16 choose(D bool[[N]] cond, D uint16[[N]] first, D uint16[[N]] second)

D uint32 choose(D bool[[N]] cond, D uint32[[N]] first, D uint32[[N]] second)

D uint choose(D bool[[N]] cond, D uint[[N]] first, D uint[[N]] second)

D int8 choose(D bool[[N]] cond, D int8[[N]] first, D int8[[N]] second)

D int16 choose(D bool[[N]] cond, D int16[[N]] first, D int16[[N]] second)

D int32 choose(D bool[[N]] cond, D int32[[N]] first, D int32[[N]] second)

D int choose(D bool[[N]] cond, D int[[N]] first, D int[[N]] second)

choose(single condition)

Function for obliviously choosing one of the inputs.

Detailed Description

D - all protection domains

T - any data type

Parameters

cond

- a boolean scalar

first

- values for true case

second

- values for false case

one of the input arrays that was obliviously chosen with the condition. if true, array first is returned else second is returned

None

Function Overloads

D T choose(bool cond, D T[[N]] first, D T[[N]] second)

D bool choose(D bool cond, D bool[[N]] first, D bool[[N]] second)

D uint8 choose(D bool cond, D uint8[[N]] first, D uint8[[N]] second)

D uint16 choose(D bool cond, D uint16[[N]] first, D uint16[[N]] second)

D uint32 choose(D bool cond, D uint32[[N]] first, D uint32[[N]] second)

D uint choose(D bool cond, D uint[[N]] first, D uint[[N]] second)

D int8 choose(D bool cond, D int8[[N]] first, D int8[[N]] second)

D int16 choose(D bool cond, D int16[[N]] first, D int16[[N]] second)

D int32 choose(D bool cond, D int32[[N]] first, D int32[[N]] second)

D int choose(D bool cond, D int[[N]] first, D int[[N]] second)

D float32 choose(D bool cond, D float32[[N]] first, D float32[[N]] second)

D float64 choose(D bool cond, D float64[[N]] first, D float64[[N]] second)