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
#[repr(C)]
#[derive(Copy, Clone)]
pub struct crypto_auth_hmacsha256_state {
ictx: crypto_hash_sha256_state,
octx: crypto_hash_sha256_state,
}
pub const crypto_auth_hmacsha256_BYTES: usize = 32;
pub const crypto_auth_hmacsha256_KEYBYTES: usize = 32;
extern "C" {
pub fn crypto_auth_hmacsha256_bytes() -> size_t;
pub fn crypto_auth_hmacsha256_keybytes() -> size_t;
pub fn crypto_auth_hmacsha256(a: *mut u8,
m: *const u8,
mlen: c_ulonglong,
k: *const u8)
-> c_int;
pub fn crypto_auth_hmacsha256_verify(a: *const u8,
m: *const u8,
mlen: c_ulonglong,
k: *const u8)
-> c_int;
pub fn crypto_auth_hmacsha256_init(state: *mut crypto_auth_hmacsha256_state,
key: *const u8,
keylen: size_t)
-> c_int;
pub fn crypto_auth_hmacsha256_update(state: *mut crypto_auth_hmacsha256_state,
m: *const u8,
mlen: c_ulonglong)
-> c_int;
pub fn crypto_auth_hmacsha256_final(state: *mut crypto_auth_hmacsha256_state,
a: *mut u8)
-> c_int;
}
#[test]
fn test_crypto_auth_hmacsha256_bytes() {
assert!(unsafe { crypto_auth_hmacsha256_bytes() as usize } == crypto_auth_hmacsha256_BYTES)
}
#[test]
fn test_crypto_auth_hmacsha256_keybytes() {
assert!(unsafe { crypto_auth_hmacsha256_keybytes() as usize } ==
crypto_auth_hmacsha256_KEYBYTES)
}