Crate consistenttime [] [src]

Consistent Time

The goal of this crate is to offer constant time functions which most cryptographic computing protocols require to prevent side channelling timing attacks.

These algorithms are not implemented to be efficient. But to take the same number of processor cycles if their outcome is true, or false. The reference used for this crate is Go-Lang's crypto/subtile Which implements a handful of constant time algorithms.

I took the liberity of generalizing them out to all unsigned sizes supported by Rust-Lang. Everything inside of this crate is defined as a macro. This makes writing the extremely repetive code for all types a lot easier.

Functions

ct_copy_u16

Constant Time Copy

ct_copy_u32

Constant Time Copy

ct_copy_u64

Constant Time Copy

ct_copy_u8

Constant Time Copy

ct_copy_usize

Constant Time Copy

ct_select_u16

Constant Time Selection.

ct_select_u32

Constant Time Selection.

ct_select_u64

Constant Time Selection.

ct_select_u8

Constant Time Selection.

ct_select_usize

Constant Time Selection.

ct_u16_eq

Returns 1usize if x==y, otherwise returns 0usize

ct_u16_slice_eq

Compares two slices. Returns 1usize if x==y, and 0usize if x!=y. Will always return 0 if lens are not equal

ct_u32_eq

Returns 1usize if x==y, otherwise returns 0usize

ct_u32_slice_eq

Compares two slices. Returns 1usize if x==y, and 0usize if x!=y. Will always return 0 if lens are not equal

ct_u64_eq

Returns 1usize if x==y, otherwise returns 0usize

ct_u64_slice_eq

Compares two slices. Returns 1usize if x==y, and 0usize if x!=y. Will always return 0 if lens are not equal

ct_u8_eq

Returns 1usize if x==y, otherwise returns 0usize

ct_u8_slice_eq

Compares two slices. Returns 1usize if x==y, and 0usize if x!=y. Will always return 0 if lens are not equal

ct_usize_eq

Returns 1usize if x==y, otherwise returns 0usize

ct_usize_slice_eq

Compares two slices. Returns 1usize if x==y, and 0usize if x!=y. Will always return 0 if lens are not equal