1#[cfg(botan_ffi_20250506)]
2use crate::ffi_types::{botan_view_bin_fn, botan_view_ctx, botan_view_str_fn, c_char, c_int};
3#[cfg(botan_ffi_20250506)]
4use crate::{botan_asn1_oid_t, botan_mp_t};
5
6#[cfg(botan_ffi_20260506)]
7use crate::rng::botan_rng_t;
8
9#[cfg(botan_ffi_20250506)]
10pub enum botan_ec_group_struct {}
11
12#[cfg(botan_ffi_20250506)]
13pub type botan_ec_group_t = *mut botan_ec_group_struct;
14
15#[cfg(botan_ffi_20260506)]
16pub enum botan_ec_scalar_struct {}
17#[cfg(botan_ffi_20260506)]
18pub type botan_ec_scalar_t = *mut botan_ec_scalar_struct;
19
20#[cfg(botan_ffi_20260506)]
21pub enum botan_ec_point_struct {}
22#[cfg(botan_ffi_20260506)]
23pub type botan_ec_point_t = *mut botan_ec_point_struct;
24
25#[cfg(botan_ffi_20250506)]
26unsafe extern "C" {
27 pub fn botan_ec_group_destroy(bc: botan_ec_group_t) -> c_int;
28
29 pub fn botan_ec_group_supports_application_specific_group(res: *mut c_int) -> c_int;
30
31 pub fn botan_ec_group_supports_named_group(name: *const c_char, res: *mut c_int) -> c_int;
32
33 pub fn botan_ec_group_from_params(
34 group: *mut botan_ec_group_t,
35 oid: botan_asn1_oid_t,
36 p: botan_mp_t,
37 a: botan_mp_t,
38 b: botan_mp_t,
39 g_x: botan_mp_t,
40 g_y: botan_mp_t,
41 order: botan_mp_t,
42 ) -> c_int;
43
44 pub fn botan_ec_group_from_ber(
45 group: *mut botan_ec_group_t,
46 ber: *const u8,
47 ber_len: usize,
48 ) -> c_int;
49 pub fn botan_ec_group_from_pem(group: *mut botan_ec_group_t, pem: *const c_char) -> c_int;
50 pub fn botan_ec_group_from_oid(group: *mut botan_ec_group_t, oid: botan_asn1_oid_t) -> c_int;
51 pub fn botan_ec_group_from_name(group: *mut botan_ec_group_t, name: *const c_char) -> c_int;
52
53 pub fn botan_ec_group_view_der(
54 group: botan_ec_group_t,
55 ctx: botan_view_ctx,
56 view: botan_view_bin_fn,
57 ) -> c_int;
58 pub fn botan_ec_group_view_pem(
59 group: botan_ec_group_t,
60 ctx: botan_view_ctx,
61 view: botan_view_str_fn,
62 ) -> c_int;
63 pub fn botan_ec_group_get_curve_oid(
64 oid: *mut botan_asn1_oid_t,
65 group: botan_ec_group_t,
66 ) -> c_int;
67 pub fn botan_ec_group_get_p(p: *mut botan_mp_t, group: botan_ec_group_t) -> c_int;
68
69 pub fn botan_ec_group_get_a(a: *mut botan_mp_t, group: botan_ec_group_t) -> c_int;
70
71 pub fn botan_ec_group_get_b(b: *mut botan_mp_t, group: botan_ec_group_t) -> c_int;
72
73 pub fn botan_ec_group_get_g_x(g_x: *mut botan_mp_t, group: botan_ec_group_t) -> c_int;
74
75 pub fn botan_ec_group_get_g_y(g_y: *mut botan_mp_t, group: botan_ec_group_t) -> c_int;
76
77 pub fn botan_ec_group_get_order(order: *mut botan_mp_t, group: botan_ec_group_t) -> c_int;
78
79 pub fn botan_ec_group_equal(group1: botan_ec_group_t, group2: botan_ec_group_t) -> c_int;
80
81 #[cfg(botan_ffi_20260303)]
82 pub fn botan_ec_group_unregister(oid: botan_asn1_oid_t) -> c_int;
83}
84
85#[cfg(botan_ffi_20260506)]
86unsafe extern "C" {
87 pub fn botan_ec_scalar_destroy(ec_scalar: botan_ec_scalar_t) -> c_int;
88
89 pub fn botan_ec_scalar_random(
90 ec_scalar: *mut botan_ec_scalar_t,
91 ec_group: botan_ec_group_t,
92 rng: botan_rng_t,
93 ) -> c_int;
94
95 pub fn botan_ec_scalar_from_mp(
96 ec_scalar: *mut botan_ec_scalar_t,
97 ec_group: botan_ec_group_t,
98 mp: botan_mp_t,
99 ) -> c_int;
100
101 pub fn botan_ec_scalar_to_mp(ec_scalar: botan_ec_scalar_t, mp: *mut botan_mp_t) -> c_int;
102
103 pub fn botan_ec_point_destroy(ec_point: botan_ec_point_t) -> c_int;
104
105 pub fn botan_ec_point_identity(
106 ec_point: *mut botan_ec_point_t,
107 ec_group: botan_ec_group_t,
108 ) -> c_int;
109
110 pub fn botan_ec_point_generator(
111 ec_point: *mut botan_ec_point_t,
112 ec_group: botan_ec_group_t,
113 ) -> c_int;
114
115 pub fn botan_ec_point_from_xy(
116 ec_point: *mut botan_ec_point_t,
117 ec_group: botan_ec_group_t,
118 x: botan_mp_t,
119 y: botan_mp_t,
120 ) -> c_int;
121
122 pub fn botan_ec_point_from_bytes(
123 ec_point: *mut botan_ec_point_t,
124 ec_group: botan_ec_group_t,
125 bytes: *const u8,
126 bytes_len: usize,
127 ) -> c_int;
128
129 pub fn botan_ec_point_view_x_bytes(
130 ec_point: botan_ec_point_t,
131 ctx: botan_view_ctx,
132 view: botan_view_bin_fn,
133 ) -> c_int;
134
135 pub fn botan_ec_point_view_y_bytes(
136 ec_point: botan_ec_point_t,
137 ctx: botan_view_ctx,
138 view: botan_view_bin_fn,
139 ) -> c_int;
140
141 pub fn botan_ec_point_view_xy_bytes(
142 ec_point: botan_ec_point_t,
143 ctx: botan_view_ctx,
144 view: botan_view_bin_fn,
145 ) -> c_int;
146
147 pub fn botan_ec_point_view_uncompressed(
148 ec_point: botan_ec_point_t,
149 ctx: botan_view_ctx,
150 view: botan_view_bin_fn,
151 ) -> c_int;
152
153 pub fn botan_ec_point_view_compressed(
154 ec_point: botan_ec_point_t,
155 ctx: botan_view_ctx,
156 view: botan_view_bin_fn,
157 ) -> c_int;
158
159 pub fn botan_ec_point_is_identity(ec_point: botan_ec_point_t) -> c_int;
160
161 pub fn botan_ec_point_equal(x: botan_ec_point_t, y: botan_ec_point_t) -> c_int;
162
163 pub fn botan_ec_point_negate(
164 result: *mut botan_ec_point_t,
165 ec_point: botan_ec_point_t,
166 ) -> c_int;
167
168 pub fn botan_ec_point_add(
169 result: *mut botan_ec_point_t,
170 x: botan_ec_point_t,
171 y: botan_ec_point_t,
172 ) -> c_int;
173
174 pub fn botan_ec_point_mul(
175 result: *mut botan_ec_point_t,
176 ec_point: botan_ec_point_t,
177 ec_scalar: botan_ec_scalar_t,
178 rng: botan_rng_t,
179 ) -> c_int;
180}