botan_sys/
otp.rs

1use crate::ffi_types::{c_char, c_int};
2
3pub enum botan_hotp_struct {}
4pub type botan_hotp_t = *mut botan_hotp_struct;
5
6pub enum botan_totp_struct {}
7pub type botan_totp_t = *mut botan_totp_struct;
8
9extern "C" {
10
11    pub fn botan_hotp_init(
12        hotp: *mut botan_hotp_t,
13        key: *const u8,
14        key_len: usize,
15        hash_algo: *const c_char,
16        digits: usize,
17    ) -> c_int;
18
19    pub fn botan_hotp_destroy(hotp: botan_hotp_t) -> c_int;
20
21    pub fn botan_hotp_generate(hotp: botan_hotp_t, hotp_code: *mut u32, hotp_counter: u64)
22        -> c_int;
23
24    pub fn botan_hotp_check(
25        hotp: botan_hotp_t,
26        next_counter: *mut u64,
27        hotp_code: u32,
28        hotp_counter: u64,
29        resync_range: usize,
30    ) -> c_int;
31
32    pub fn botan_totp_init(
33        totp: *mut botan_totp_t,
34        key: *const u8,
35        key_len: usize,
36        hash_algo: *const c_char,
37        digits: usize,
38        time_step: usize,
39    ) -> c_int;
40
41    pub fn botan_totp_destroy(totp: botan_totp_t) -> c_int;
42
43    pub fn botan_totp_generate(totp: botan_totp_t, totp_code: *mut u32, timestamp: u64) -> c_int;
44
45    pub fn botan_totp_check(
46        totp: botan_totp_t,
47        totp_code: u32,
48        timestamp: u64,
49        acceptable_drift: usize,
50    ) -> c_int;
51
52}