1use crate::ffi_types::{c_char, c_int};
2
3use crate::rng::botan_rng_t;
4
5pub enum botan_mp_struct {}
6pub type botan_mp_t = *mut botan_mp_struct;
7
8extern "C" {
9
10 pub fn botan_mp_init(mp: *mut botan_mp_t) -> c_int;
11 pub fn botan_mp_destroy(mp: botan_mp_t) -> c_int;
12 pub fn botan_mp_to_hex(mp: botan_mp_t, out: *mut c_char) -> c_int;
13 pub fn botan_mp_to_str(
14 mp: botan_mp_t,
15 base: u8,
16 out: *mut c_char,
17 out_len: *mut usize,
18 ) -> c_int;
19 pub fn botan_mp_clear(mp: botan_mp_t) -> c_int;
20 pub fn botan_mp_set_from_int(mp: botan_mp_t, initial_value: c_int) -> c_int;
21 pub fn botan_mp_set_from_mp(dest: botan_mp_t, source: botan_mp_t) -> c_int;
22 pub fn botan_mp_set_from_str(dest: botan_mp_t, str: *const c_char) -> c_int;
23
24 pub fn botan_mp_set_from_radix_str(dest: botan_mp_t, str: *const c_char, radix: usize)
25 -> c_int;
26 pub fn botan_mp_num_bits(n: botan_mp_t, bits: *mut usize) -> c_int;
27 pub fn botan_mp_num_bytes(n: botan_mp_t, bytes: *mut usize) -> c_int;
28 pub fn botan_mp_to_bin(mp: botan_mp_t, vec: *mut u8) -> c_int;
29 pub fn botan_mp_from_bin(mp: botan_mp_t, vec: *const u8, vec_len: usize) -> c_int;
30 pub fn botan_mp_to_uint32(mp: botan_mp_t, val: *mut u32) -> c_int;
31 pub fn botan_mp_is_positive(mp: botan_mp_t) -> c_int;
32 pub fn botan_mp_is_negative(mp: botan_mp_t) -> c_int;
33 pub fn botan_mp_flip_sign(mp: botan_mp_t) -> c_int;
34 pub fn botan_mp_is_zero(mp: botan_mp_t) -> c_int;
35 pub fn botan_mp_is_odd(mp: botan_mp_t) -> c_int;
36 pub fn botan_mp_is_even(mp: botan_mp_t) -> c_int;
37 pub fn botan_mp_add(result: botan_mp_t, x: botan_mp_t, y: botan_mp_t) -> c_int;
38 pub fn botan_mp_sub(result: botan_mp_t, x: botan_mp_t, y: botan_mp_t) -> c_int;
39 pub fn botan_mp_add_u32(result: botan_mp_t, x: botan_mp_t, y: u32) -> c_int;
40 pub fn botan_mp_sub_u32(result: botan_mp_t, x: botan_mp_t, y: u32) -> c_int;
41 pub fn botan_mp_mul(result: botan_mp_t, x: botan_mp_t, y: botan_mp_t) -> c_int;
42 pub fn botan_mp_div(
43 quotient: botan_mp_t,
44 remainder: botan_mp_t,
45 x: botan_mp_t,
46 y: botan_mp_t,
47 ) -> c_int;
48 pub fn botan_mp_mod_mul(
49 result: botan_mp_t,
50 x: botan_mp_t,
51 y: botan_mp_t,
52 mod_: botan_mp_t,
53 ) -> c_int;
54 pub fn botan_mp_equal(x: botan_mp_t, y: botan_mp_t) -> c_int;
55 pub fn botan_mp_cmp(result: *mut c_int, x: botan_mp_t, y: botan_mp_t) -> c_int;
56 pub fn botan_mp_swap(x: botan_mp_t, y: botan_mp_t) -> c_int;
57 pub fn botan_mp_powmod(
58 out: botan_mp_t,
59 base: botan_mp_t,
60 exponent: botan_mp_t,
61 modulus: botan_mp_t,
62 ) -> c_int;
63 pub fn botan_mp_lshift(out: botan_mp_t, in_: botan_mp_t, shift: usize) -> c_int;
64 pub fn botan_mp_rshift(out: botan_mp_t, in_: botan_mp_t, shift: usize) -> c_int;
65 pub fn botan_mp_mod_inverse(out: botan_mp_t, in_: botan_mp_t, modulus: botan_mp_t) -> c_int;
66 pub fn botan_mp_rand_bits(rand_out: botan_mp_t, rng: botan_rng_t, bits: usize) -> c_int;
67 pub fn botan_mp_rand_range(
68 rand_out: botan_mp_t,
69 rng: botan_rng_t,
70 lower_bound: botan_mp_t,
71 upper_bound: botan_mp_t,
72 ) -> c_int;
73 pub fn botan_mp_gcd(out: botan_mp_t, x: botan_mp_t, y: botan_mp_t) -> c_int;
74 pub fn botan_mp_is_prime(n: botan_mp_t, rng: botan_rng_t, test_prob: usize) -> c_int;
75 pub fn botan_mp_get_bit(n: botan_mp_t, bit: usize) -> c_int;
76 pub fn botan_mp_set_bit(n: botan_mp_t, bit: usize) -> c_int;
77 pub fn botan_mp_clear_bit(n: botan_mp_t, bit: usize) -> c_int;
78
79}