pub trait ORAM<ValueSize: ArrayLength<u8>> {
    // Required methods
    fn len(&self) -> u64;
    fn stash_size(&self) -> usize;
    fn access<T, F: FnOnce(&mut A64Bytes<ValueSize>) -> T>(
        &mut self,
        index: u64,
        func: F
    ) -> T;

    // Provided methods
    fn read(&mut self, index: u64) -> A64Bytes<ValueSize> { ... }
    fn write(
        &mut self,
        index: u64,
        new_val: &A64Bytes<ValueSize>
    ) -> A64Bytes<ValueSize> { ... }
}
Expand description

An Oblivious RAM – that is, an array like [A8Bytes; N] which supports access queries without memory access patterns revealing what indices were queried. (Here, N is a runtime parameter set at construction time.)

The ValueSize parameter indicates the number of bytes in a stored value.

The key-type here is always u64 even if it “could” be smaller. We think that if keys are actually stored as u32 or u16 in some of the recursive position maps, that conversion can happen at a different layer of the system.

TODO: Should there be, perhaps, a separate trait for “resizable” ORAMs? We don’t have a good way for the OMAP to take advantage of that right now.

Required Methods§

source

fn len(&self) -> u64

Get the number of values logically in the ORAM. This is also one more than the largest index that can be legally accessed.

source

fn stash_size(&self) -> usize

Get the number of values in the ORAM’s stash for diagnostics. In prod, this number should be viewed as secret and not revealed.

source

fn access<T, F: FnOnce(&mut A64Bytes<ValueSize>) -> T>( &mut self, index: u64, func: F ) -> T

Access the ORAM at a position, calling a lambda with the recovered value, and returning the result of the lambda. This cannot fail, but will panic if index is out of bounds.

This is the lowest-level API that we offer for getting data from the ORAM.

Provided Methods§

source

fn read(&mut self, index: u64) -> A64Bytes<ValueSize>

High-level helper – when you only need to read and don’t need to write a new value, this is simpler than using access. In most ORAM there will not be a significantly faster implementation of this.

source

fn write( &mut self, index: u64, new_val: &A64Bytes<ValueSize> ) -> A64Bytes<ValueSize>

High-level helper – when you need to write a value and want the previous value, but you don’t need to see the previous value when deciding what to write, this is simpler than using access. In most ORAM there will not be a significantly faster implementation of this.

Implementors§

source§

impl<ValueSize: ArrayLength<u8>> ORAM<ValueSize> for LinearScanningORAM<ValueSize>