shared3p_oblivious_ram.sc
shared3p_oblivious_ram.sc
Module with functions for oblivious array lookup and write (ORAM)
Functions:
These functions are useful for obliviously reading or writing by several secret indices or when reading from or writing to several vectors by secret indices.
Note that both reading and writing consist of two functions: "prepare" (oramPrepareRead / oramPrepareWrite) and the actual action (oramPerformRead / oramPerformWrite). The prepare*
functions are slower, but only require the secret indices vector, not the actual data vector to read from or write to. Therefore, a single prepare*
function can be used to invoke several read/write functions (using the same seed).
If you want to obliviously read/write only a few values, use *Lookup
and *Update
functions from the oblivious module instead.
oramPerformRead
Obliviously reads values from source vector indicated by the indices vector.
Detailed Description
D - shared3p protection domain |
Supported types - uint8 / uint16 / uint32 / uint64 / int8 / int16 / int32 / int64 |
Parameters
src |
- vector to read from |
shuffleSeed |
- random seed (32 bytes), has to be the same as used for oramPrepareRead |
sortperm |
- sorting permutation, output of oramPrepareRead |
Returns a new vector |
Given that size(src) = m and size(indices) = n then oramPrepareRead works in Ο((m+n)log(m+n)) and oramPerformRead in Ο(m+n) time. |
None |
Function Overloads
D uint8 oramPerformRead(D uint8[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D uint16 oramPerformRead(D uint16[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D uint32 oramPerformRead(D uint32[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D uint64 oramPerformRead(D uint64[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D int8 oramPerformRead(D int8[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D int16 oramPerformRead(D int16[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D int32 oramPerformRead(D int32[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
D int64 oramPerformRead(D int64[[1]] src, D uint8[[1]] shuffleSeed, uint[[1]] sortperm)
oramPerformWrite
Obliviously replaces (some) values in the original values vector with those contained in the replacement values vector.
Detailed Description
D - shared3p protection domain |
Supported types - uint8 / uint16 / uint32 / uint64 / int8 / int16 / int32 / int64 |
Parameters
arr |
- original values vector |
vals |
- replacement values vector |
shuffleSeed1 |
- random seed (32 bytes), has to be the same as used for oramPrepareWrite |
shuffleSeed2 |
- random seed (32 bytes), has to be the same as used for oramPrepareWrite |
sigmatau |
- sorting permutation, output of oramPrepareWrite |
Returns a copy of |
Given that size(arr) = m and size(indices) = n then oramPrepareWrite works in Ο((m+n)log(m+n)) and oramPerformWrite in Ο(m+n) time. |
None |
Function Overloads
D uint8 oramPerformWrite(D uint8[[1]] arr, D uint8[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D uint16 oramPerformWrite(D uint16[[1]] arr, D uint16[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D uint32 oramPerformWrite(D uint32[[1]] arr, D uint32[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D uint64 oramPerformWrite(D uint64[[1]] arr, D uint64[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D int8 oramPerformWrite(D int8[[1]] arr, D int8[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D int16 oramPerformWrite(D int16[[1]] arr, D int16[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D int32 oramPerformWrite(D int32[[1]] arr, D int32[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
D int64 oramPerformWrite(D int64[[1]] arr, D int64[[1]] vals, D uint8[[1]] shuffleSeed1, D uint8[[1]] shuffleSeed2, uint[[1]] sigmatau)
oramPrepareRead
Prepares a sort permutation for oblivious read function oramPerformRead.
Detailed Description
D - shared3p protection domain |
See supported types for oramPerformRead |
Parameters
srcLen |
- length of the vector to read from |
indices |
- indices (in the src vector) to read from |
shuffleSeed |
- random seed (32 bytes) |
sorting permutation, used as |
Note that the output sorting permutation is a public value. Based on its input data, oramPrepareRead computes a secret permutation that is represented as combination of a public output permutation and a secret |
None |
oramPrepareWrite
Prepares a sort permutation for oblivious write function oramPerformWrite.
Detailed Description
D - shared3p protection domain |
See supported types for oramPerformWrite |
Parameters
arrLen |
- length of the original values vector ( |
indices |
- vector specifying where to write the corresponding value from the replacement values vector ( |
shuffleSeed1 |
- random seed (32 bytes) |
shuffleSeed2 |
- random seed (32 bytes) |
sorting permutation, used as |
Note that the output sorting permutation is a public value. Based on its input data, oramPrepareWrite computes a secret permutation that is represented as combination of a public output permutation and secret |
None |