1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#[macro_use]
extern crate static_assertions;
extern crate array_init;
extern crate byteorder;
extern crate openssl;


macro_rules! safe_div {
    ($a:expr, $b:expr) => {
        if $b > 0 { $a / $b } else { 0 }
    };
}

macro_rules! ceil_div {
    ($a:expr, $b:expr) => { ($a+$b-1)/$b };
}

macro_rules! bits_to_bytes {
    ($a:expr) => { ceil_div!($a, 8) }
}

macro_rules! array_xor_in_place {
    ($a:expr, $b:expr) => {
        for (x, y) in $a.iter_mut().zip($b.iter()) {
            *x ^= *y;
        }
    };
}

macro_rules! u8_to_u16 {
    ($a:expr) => {
        (($a[1] as u16) << 8) + $a[0] as u16
    }
}


mod tiny_keccak;
mod drbg;
mod pack;
mod r5_core;
mod r5_hash;
mod r5_cpa_pke;
mod xef;

pub mod types;
pub mod nist_rng;
pub mod parameters;

#[cfg(feature = "kem")]
pub mod kem;

#[cfg(feature = "pke")]
pub mod pke;