botan_sys/
cipher.rs

1use crate::ffi_types::{c_char, c_int};
2
3pub enum botan_cipher_struct {}
4pub type botan_cipher_t = *mut botan_cipher_struct;
5
6extern "C" {
7    pub fn botan_cipher_init(cipher: *mut botan_cipher_t, name: *const c_char, flags: u32)
8        -> c_int;
9    pub fn botan_cipher_valid_nonce_length(cipher: botan_cipher_t, nl: usize) -> c_int;
10    pub fn botan_cipher_get_tag_length(cipher: botan_cipher_t, tag_size: *mut usize) -> c_int;
11    pub fn botan_cipher_get_default_nonce_length(cipher: botan_cipher_t, nl: *mut usize) -> c_int;
12    pub fn botan_cipher_get_update_granularity(cipher: botan_cipher_t, ug: *mut usize) -> c_int;
13
14    #[cfg(feature = "botan3")]
15    pub fn botan_cipher_get_ideal_update_granularity(
16        cipher: botan_cipher_t,
17        ug: *mut usize,
18    ) -> c_int;
19
20    pub fn botan_cipher_query_keylen(
21        cipher: botan_cipher_t,
22        out_minimum_keylength: *mut usize,
23        out_maximum_keylength: *mut usize,
24    ) -> c_int;
25
26    pub fn botan_cipher_get_keyspec(
27        cipher: botan_cipher_t,
28        min_keylen: *mut usize,
29        max_keylen: *mut usize,
30        mod_keylen: *mut usize,
31    ) -> c_int;
32
33    pub fn botan_cipher_set_key(cipher: botan_cipher_t, key: *const u8, key_len: usize) -> c_int;
34    pub fn botan_cipher_set_associated_data(
35        cipher: botan_cipher_t,
36        ad: *const u8,
37        ad_len: usize,
38    ) -> c_int;
39    pub fn botan_cipher_start(cipher: botan_cipher_t, nonce: *const u8, nonce_len: usize) -> c_int;
40    pub fn botan_cipher_update(
41        cipher: botan_cipher_t,
42        flags: u32,
43        output: *mut u8,
44        output_size: usize,
45        output_written: *mut usize,
46        input_bytes: *const u8,
47        input_size: usize,
48        input_consumed: *mut usize,
49    ) -> c_int;
50
51    pub fn botan_cipher_name(
52        cipher: botan_cipher_t,
53        name: *mut c_char,
54        name_len: *mut usize,
55    ) -> c_int;
56
57    pub fn botan_cipher_output_length(
58        cipher: botan_cipher_t,
59        inlen: usize,
60        outlen: *mut usize,
61    ) -> c_int;
62
63    pub fn botan_cipher_clear(cipher: botan_cipher_t) -> c_int;
64    pub fn botan_cipher_destroy(cipher: botan_cipher_t) -> c_int;
65
66}