Trait aligned_cmov::CMov

source ·
pub trait CMov: Sized {
    // Required method
    fn cmov(&mut self, condition: Choice, src: &Self);
}
Expand description

CMov represents types that can be (obliviously) conditionally moved.

“Conditional move” means: if condition { *dest = *src } The interesting case is when this must be side-channel resistant and the condition cannot be leaked over CPU side-channels.

This API is object-oriented, and we take self = dest. This is good in rust because then you don’t have to name the type to call the function.

These are the types that we can hope to support with ORAM, and this API allows ORAM to be written in a generic way.

Note: Types that own dynamic memory cannot be CMov by design. They also cannot be in an ORAM, by design. If your type has nontrivial Drop it is likely not reasonable to CMov it or put it in an ORAM.

Required Methods§

source

fn cmov(&mut self, condition: Choice, src: &Self)

Implementations on Foreign Types§

source§

impl CMov for bool

source§

fn cmov(&mut self, condition: Choice, src: &bool)

source§

impl CMov for i64

source§

fn cmov(&mut self, condition: Choice, src: &i64)

source§

impl CMov for i32

source§

fn cmov(&mut self, condition: Choice, src: &i32)

source§

impl CMov for usize

source§

fn cmov(&mut self, condition: Choice, src: &usize)

source§

impl CMov for u32

source§

fn cmov(&mut self, condition: Choice, src: &u32)

source§

impl CMov for u64

source§

fn cmov(&mut self, condition: Choice, src: &u64)

Implementors§