libsodium_sys/src/
crypto_core_salsa20.rs

1// crypto_core_salsa20.h
2
3pub const crypto_core_salsa20_OUTPUTBYTES: usize = 64;
4pub const crypto_core_salsa20_INPUTBYTES: usize = 16;
5pub const crypto_core_salsa20_KEYBYTES: usize = 32;
6pub const crypto_core_salsa20_CONSTBYTES: usize = 16;
7
8extern {
9    pub fn crypto_core_salsa20_outputbytes() -> size_t;
10    pub fn crypto_core_salsa20_inputbytes() -> size_t;
11    pub fn crypto_core_salsa20_keybytes() -> size_t;
12    pub fn crypto_core_salsa20_constbytes() -> size_t;
13
14    pub fn crypto_core_salsa20(
15        out: *mut [u8; crypto_core_salsa20_OUTPUTBYTES],
16        in_: *const [u8; crypto_core_salsa20_INPUTBYTES],
17        k: *const [u8; crypto_core_salsa20_KEYBYTES],
18        c: *const [u8; crypto_core_salsa20_CONSTBYTES]) -> c_int;
19}
20
21#[test]
22fn test_crypto_core_salsa20_outputbytes() {
23    assert!(unsafe {
24        crypto_core_salsa20_outputbytes() as usize
25    } == crypto_core_salsa20_OUTPUTBYTES)
26}
27
28#[test]
29fn test_crypto_core_salsa20_inputbytes() {
30    assert!(unsafe {
31        crypto_core_salsa20_inputbytes() as usize
32    } == crypto_core_salsa20_INPUTBYTES)
33}
34
35#[test]
36fn test_crypto_core_salsa20_keybytes() {
37    assert!(unsafe {
38        crypto_core_salsa20_keybytes() as usize
39    } == crypto_core_salsa20_KEYBYTES)
40}
41
42#[test]
43fn test_crypto_core_salsa20_constbytes() {
44    assert!(unsafe {
45        crypto_core_salsa20_constbytes() as usize
46    } == crypto_core_salsa20_CONSTBYTES)
47}