Line data Source code
1 : // Auto-generated file.
2 :
3 : import 'dart:ffi';
4 :
5 : import 'package:ffi/ffi.dart';
6 :
7 : import 'ffi_base.dart';
8 :
9 2 : final olm_inbound_group_session_size =
10 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
11 : 'olm_inbound_group_session_size');
12 :
13 3 : final olm_inbound_group_session = libolm.lookupFunction<
14 : Pointer<NativeType> Function(Pointer<Uint8> memory),
15 : Pointer<NativeType> Function(
16 : Pointer<Uint8> memory)>('olm_inbound_group_session');
17 :
18 3 : final olm_inbound_group_session_last_error = libolm.lookupFunction<
19 : Pointer<Utf8> Function(Pointer<NativeType> session),
20 : Pointer<Utf8> Function(
21 : Pointer<NativeType> session)>('olm_inbound_group_session_last_error');
22 :
23 1 : int olm_clear_inbound_group_session(Pointer<NativeType> session) {
24 2 : int result = _olm_clear_inbound_group_session_unchecked(session);
25 3 : if (result == olm_error())
26 0 : throw_olm(olm_inbound_group_session_last_error(session));
27 : return result;
28 : }
29 :
30 3 : final _olm_clear_inbound_group_session_unchecked = libolm.lookupFunction<
31 : IntPtr Function(Pointer<NativeType> session),
32 : int Function(
33 : Pointer<NativeType> session)>('olm_clear_inbound_group_session');
34 :
35 1 : int olm_pickle_inbound_group_session_length(Pointer<NativeType> session) {
36 2 : int result = _olm_pickle_inbound_group_session_length_unchecked(session);
37 3 : if (result == olm_error())
38 0 : throw_olm(olm_inbound_group_session_last_error(session));
39 : return result;
40 : }
41 :
42 2 : final _olm_pickle_inbound_group_session_length_unchecked =
43 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> session),
44 : int Function(Pointer<NativeType> session)>(
45 : 'olm_pickle_inbound_group_session_length');
46 :
47 1 : int olm_pickle_inbound_group_session(
48 : Pointer<NativeType> session,
49 : Pointer<Uint8> key,
50 : int key_length,
51 : Pointer<Uint8> pickled,
52 : int pickled_length) {
53 2 : int result = _olm_pickle_inbound_group_session_unchecked(
54 : session, key, key_length, pickled, pickled_length);
55 3 : if (result == olm_error())
56 0 : throw_olm(olm_inbound_group_session_last_error(session));
57 : return result;
58 : }
59 :
60 3 : final _olm_pickle_inbound_group_session_unchecked = libolm.lookupFunction<
61 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
62 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
63 : int Function(
64 : Pointer<NativeType> session,
65 : Pointer<Uint8> key,
66 : int key_length,
67 : Pointer<Uint8> pickled,
68 : int pickled_length)>('olm_pickle_inbound_group_session');
69 :
70 1 : int olm_unpickle_inbound_group_session(
71 : Pointer<NativeType> session,
72 : Pointer<Uint8> key,
73 : int key_length,
74 : Pointer<Uint8> pickled,
75 : int pickled_length) {
76 2 : int result = _olm_unpickle_inbound_group_session_unchecked(
77 : session, key, key_length, pickled, pickled_length);
78 3 : if (result == olm_error())
79 3 : throw_olm(olm_inbound_group_session_last_error(session));
80 : return result;
81 : }
82 :
83 3 : final _olm_unpickle_inbound_group_session_unchecked = libolm.lookupFunction<
84 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
85 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
86 : int Function(
87 : Pointer<NativeType> session,
88 : Pointer<Uint8> key,
89 : int key_length,
90 : Pointer<Uint8> pickled,
91 : int pickled_length)>('olm_unpickle_inbound_group_session');
92 :
93 1 : int olm_init_inbound_group_session(Pointer<NativeType> session,
94 : Pointer<Uint8> session_key, int session_key_length) {
95 2 : int result = _olm_init_inbound_group_session_unchecked(
96 : session, session_key, session_key_length);
97 3 : if (result == olm_error())
98 0 : throw_olm(olm_inbound_group_session_last_error(session));
99 : return result;
100 : }
101 :
102 3 : final _olm_init_inbound_group_session_unchecked = libolm.lookupFunction<
103 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> session_key,
104 : IntPtr session_key_length),
105 : int Function(Pointer<NativeType> session, Pointer<Uint8> session_key,
106 : int session_key_length)>('olm_init_inbound_group_session');
107 :
108 1 : int olm_import_inbound_group_session(Pointer<NativeType> session,
109 : Pointer<Uint8> session_key, int session_key_length) {
110 2 : int result = _olm_import_inbound_group_session_unchecked(
111 : session, session_key, session_key_length);
112 3 : if (result == olm_error())
113 3 : throw_olm(olm_inbound_group_session_last_error(session));
114 : return result;
115 : }
116 :
117 3 : final _olm_import_inbound_group_session_unchecked = libolm.lookupFunction<
118 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> session_key,
119 : IntPtr session_key_length),
120 : int Function(Pointer<NativeType> session, Pointer<Uint8> session_key,
121 : int session_key_length)>('olm_import_inbound_group_session');
122 :
123 1 : int olm_group_decrypt_max_plaintext_length(
124 : Pointer<NativeType> session, Pointer<Uint8> message, int message_length) {
125 2 : int result = _olm_group_decrypt_max_plaintext_length_unchecked(
126 : session, message, message_length);
127 3 : if (result == olm_error())
128 0 : throw_olm(olm_inbound_group_session_last_error(session));
129 : return result;
130 : }
131 :
132 3 : final _olm_group_decrypt_max_plaintext_length_unchecked = libolm.lookupFunction<
133 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> message,
134 : IntPtr message_length),
135 : int Function(Pointer<NativeType> session, Pointer<Uint8> message,
136 : int message_length)>('olm_group_decrypt_max_plaintext_length');
137 :
138 1 : int olm_group_decrypt(
139 : Pointer<NativeType> session,
140 : Pointer<Uint8> message,
141 : int message_length,
142 : Pointer<Uint8> plaintext,
143 : int max_plaintext_length,
144 : Pointer<Uint32> message_index) {
145 2 : int result = _olm_group_decrypt_unchecked(session, message, message_length,
146 : plaintext, max_plaintext_length, message_index);
147 3 : if (result == olm_error())
148 0 : throw_olm(olm_inbound_group_session_last_error(session));
149 : return result;
150 : }
151 :
152 3 : final _olm_group_decrypt_unchecked = libolm.lookupFunction<
153 : IntPtr Function(
154 : Pointer<NativeType> session,
155 : Pointer<Uint8> message,
156 : IntPtr message_length,
157 : Pointer<Uint8> plaintext,
158 : IntPtr max_plaintext_length,
159 : Pointer<Uint32> message_index),
160 : int Function(
161 : Pointer<NativeType> session,
162 : Pointer<Uint8> message,
163 : int message_length,
164 : Pointer<Uint8> plaintext,
165 : int max_plaintext_length,
166 : Pointer<Uint32> message_index)>('olm_group_decrypt');
167 :
168 1 : int olm_inbound_group_session_id_length(Pointer<NativeType> session) {
169 2 : int result = _olm_inbound_group_session_id_length_unchecked(session);
170 3 : if (result == olm_error())
171 0 : throw_olm(olm_inbound_group_session_last_error(session));
172 : return result;
173 : }
174 :
175 3 : final _olm_inbound_group_session_id_length_unchecked = libolm.lookupFunction<
176 : IntPtr Function(Pointer<NativeType> session),
177 : int Function(
178 : Pointer<NativeType> session)>('olm_inbound_group_session_id_length');
179 :
180 1 : int olm_inbound_group_session_id(
181 : Pointer<NativeType> session, Pointer<Uint8> id, int id_length) {
182 2 : int result = _olm_inbound_group_session_id_unchecked(session, id, id_length);
183 3 : if (result == olm_error())
184 0 : throw_olm(olm_inbound_group_session_last_error(session));
185 : return result;
186 : }
187 :
188 3 : final _olm_inbound_group_session_id_unchecked = libolm.lookupFunction<
189 : IntPtr Function(
190 : Pointer<NativeType> session, Pointer<Uint8> id, IntPtr id_length),
191 : int Function(Pointer<NativeType> session, Pointer<Uint8> id,
192 : int id_length)>('olm_inbound_group_session_id');
193 :
194 3 : final olm_inbound_group_session_first_known_index = libolm.lookupFunction<
195 : Uint32 Function(Pointer<NativeType> session),
196 : int Function(Pointer<NativeType> session)>(
197 : 'olm_inbound_group_session_first_known_index');
198 :
199 0 : final olm_inbound_group_session_is_verified = libolm.lookupFunction<
200 : Int32 Function(Pointer<NativeType> session),
201 : int Function(
202 : Pointer<NativeType> session)>('olm_inbound_group_session_is_verified');
203 :
204 1 : int olm_export_inbound_group_session_length(Pointer<NativeType> session) {
205 2 : int result = _olm_export_inbound_group_session_length_unchecked(session);
206 3 : if (result == olm_error())
207 0 : throw_olm(olm_inbound_group_session_last_error(session));
208 : return result;
209 : }
210 :
211 2 : final _olm_export_inbound_group_session_length_unchecked =
212 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> session),
213 : int Function(Pointer<NativeType> session)>(
214 : 'olm_export_inbound_group_session_length');
215 :
216 1 : int olm_export_inbound_group_session(Pointer<NativeType> session,
217 : Pointer<Uint8> key, int key_length, int message_index) {
218 2 : int result = _olm_export_inbound_group_session_unchecked(
219 : session, key, key_length, message_index);
220 3 : if (result == olm_error())
221 0 : throw_olm(olm_inbound_group_session_last_error(session));
222 : return result;
223 : }
224 :
225 3 : final _olm_export_inbound_group_session_unchecked = libolm.lookupFunction<
226 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
227 : IntPtr key_length, Uint32 message_index),
228 : int Function(Pointer<NativeType> session, Pointer<Uint8> key,
229 : int key_length, int message_index)>('olm_export_inbound_group_session');
230 :
231 2 : final olm_outbound_group_session_size =
232 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
233 : 'olm_outbound_group_session_size');
234 :
235 3 : final olm_outbound_group_session = libolm.lookupFunction<
236 : Pointer<NativeType> Function(Pointer<Uint8> memory),
237 : Pointer<NativeType> Function(
238 : Pointer<Uint8> memory)>('olm_outbound_group_session');
239 :
240 3 : final olm_outbound_group_session_last_error = libolm.lookupFunction<
241 : Pointer<Utf8> Function(Pointer<NativeType> session),
242 : Pointer<Utf8> Function(
243 : Pointer<NativeType> session)>('olm_outbound_group_session_last_error');
244 :
245 1 : int olm_clear_outbound_group_session(Pointer<NativeType> session) {
246 2 : int result = _olm_clear_outbound_group_session_unchecked(session);
247 3 : if (result == olm_error())
248 0 : throw_olm(olm_outbound_group_session_last_error(session));
249 : return result;
250 : }
251 :
252 3 : final _olm_clear_outbound_group_session_unchecked = libolm.lookupFunction<
253 : IntPtr Function(Pointer<NativeType> session),
254 : int Function(
255 : Pointer<NativeType> session)>('olm_clear_outbound_group_session');
256 :
257 1 : int olm_pickle_outbound_group_session_length(Pointer<NativeType> session) {
258 2 : int result = _olm_pickle_outbound_group_session_length_unchecked(session);
259 3 : if (result == olm_error())
260 0 : throw_olm(olm_outbound_group_session_last_error(session));
261 : return result;
262 : }
263 :
264 2 : final _olm_pickle_outbound_group_session_length_unchecked =
265 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> session),
266 : int Function(Pointer<NativeType> session)>(
267 : 'olm_pickle_outbound_group_session_length');
268 :
269 1 : int olm_pickle_outbound_group_session(
270 : Pointer<NativeType> session,
271 : Pointer<Uint8> key,
272 : int key_length,
273 : Pointer<Uint8> pickled,
274 : int pickled_length) {
275 2 : int result = _olm_pickle_outbound_group_session_unchecked(
276 : session, key, key_length, pickled, pickled_length);
277 3 : if (result == olm_error())
278 0 : throw_olm(olm_outbound_group_session_last_error(session));
279 : return result;
280 : }
281 :
282 3 : final _olm_pickle_outbound_group_session_unchecked = libolm.lookupFunction<
283 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
284 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
285 : int Function(
286 : Pointer<NativeType> session,
287 : Pointer<Uint8> key,
288 : int key_length,
289 : Pointer<Uint8> pickled,
290 : int pickled_length)>('olm_pickle_outbound_group_session');
291 :
292 1 : int olm_unpickle_outbound_group_session(
293 : Pointer<NativeType> session,
294 : Pointer<Uint8> key,
295 : int key_length,
296 : Pointer<Uint8> pickled,
297 : int pickled_length) {
298 2 : int result = _olm_unpickle_outbound_group_session_unchecked(
299 : session, key, key_length, pickled, pickled_length);
300 3 : if (result == olm_error())
301 3 : throw_olm(olm_outbound_group_session_last_error(session));
302 : return result;
303 : }
304 :
305 3 : final _olm_unpickle_outbound_group_session_unchecked = libolm.lookupFunction<
306 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
307 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
308 : int Function(
309 : Pointer<NativeType> session,
310 : Pointer<Uint8> key,
311 : int key_length,
312 : Pointer<Uint8> pickled,
313 : int pickled_length)>('olm_unpickle_outbound_group_session');
314 :
315 1 : int olm_init_outbound_group_session_random_length(Pointer<NativeType> session) {
316 : int result =
317 2 : _olm_init_outbound_group_session_random_length_unchecked(session);
318 3 : if (result == olm_error())
319 0 : throw_olm(olm_outbound_group_session_last_error(session));
320 : return result;
321 : }
322 :
323 2 : final _olm_init_outbound_group_session_random_length_unchecked =
324 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> session),
325 : int Function(Pointer<NativeType> session)>(
326 : 'olm_init_outbound_group_session_random_length');
327 :
328 1 : int olm_init_outbound_group_session(
329 : Pointer<NativeType> session, Pointer<Uint8> random, int random_length) {
330 2 : int result = _olm_init_outbound_group_session_unchecked(
331 : session, random, random_length);
332 3 : if (result == olm_error())
333 0 : throw_olm(olm_outbound_group_session_last_error(session));
334 : return result;
335 : }
336 :
337 3 : final _olm_init_outbound_group_session_unchecked = libolm.lookupFunction<
338 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> random,
339 : IntPtr random_length),
340 : int Function(Pointer<NativeType> session, Pointer<Uint8> random,
341 : int random_length)>('olm_init_outbound_group_session');
342 :
343 1 : int olm_group_encrypt_message_length(
344 : Pointer<NativeType> session, int plaintext_length) {
345 : int result =
346 2 : _olm_group_encrypt_message_length_unchecked(session, plaintext_length);
347 3 : if (result == olm_error())
348 0 : throw_olm(olm_outbound_group_session_last_error(session));
349 : return result;
350 : }
351 :
352 3 : final _olm_group_encrypt_message_length_unchecked = libolm.lookupFunction<
353 : IntPtr Function(Pointer<NativeType> session, IntPtr plaintext_length),
354 : int Function(Pointer<NativeType> session,
355 : int plaintext_length)>('olm_group_encrypt_message_length');
356 :
357 1 : int olm_group_encrypt(Pointer<NativeType> session, Pointer<Uint8> plaintext,
358 : int plaintext_length, Pointer<Uint8> message, int message_length) {
359 2 : int result = _olm_group_encrypt_unchecked(
360 : session, plaintext, plaintext_length, message, message_length);
361 3 : if (result == olm_error())
362 0 : throw_olm(olm_outbound_group_session_last_error(session));
363 : return result;
364 : }
365 :
366 3 : final _olm_group_encrypt_unchecked = libolm.lookupFunction<
367 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> plaintext,
368 : IntPtr plaintext_length, Pointer<Uint8> message, IntPtr message_length),
369 : int Function(
370 : Pointer<NativeType> session,
371 : Pointer<Uint8> plaintext,
372 : int plaintext_length,
373 : Pointer<Uint8> message,
374 : int message_length)>('olm_group_encrypt');
375 :
376 1 : int olm_outbound_group_session_id_length(Pointer<NativeType> session) {
377 2 : int result = _olm_outbound_group_session_id_length_unchecked(session);
378 3 : if (result == olm_error())
379 0 : throw_olm(olm_outbound_group_session_last_error(session));
380 : return result;
381 : }
382 :
383 3 : final _olm_outbound_group_session_id_length_unchecked = libolm.lookupFunction<
384 : IntPtr Function(Pointer<NativeType> session),
385 : int Function(
386 : Pointer<NativeType> session)>('olm_outbound_group_session_id_length');
387 :
388 1 : int olm_outbound_group_session_id(
389 : Pointer<NativeType> session, Pointer<Uint8> id, int id_length) {
390 2 : int result = _olm_outbound_group_session_id_unchecked(session, id, id_length);
391 3 : if (result == olm_error())
392 0 : throw_olm(olm_outbound_group_session_last_error(session));
393 : return result;
394 : }
395 :
396 3 : final _olm_outbound_group_session_id_unchecked = libolm.lookupFunction<
397 : IntPtr Function(
398 : Pointer<NativeType> session, Pointer<Uint8> id, IntPtr id_length),
399 : int Function(Pointer<NativeType> session, Pointer<Uint8> id,
400 : int id_length)>('olm_outbound_group_session_id');
401 :
402 3 : final olm_outbound_group_session_message_index = libolm.lookupFunction<
403 : Uint32 Function(Pointer<NativeType> session),
404 : int Function(Pointer<NativeType> session)>(
405 : 'olm_outbound_group_session_message_index');
406 :
407 1 : int olm_outbound_group_session_key_length(Pointer<NativeType> session) {
408 2 : int result = _olm_outbound_group_session_key_length_unchecked(session);
409 3 : if (result == olm_error())
410 0 : throw_olm(olm_outbound_group_session_last_error(session));
411 : return result;
412 : }
413 :
414 3 : final _olm_outbound_group_session_key_length_unchecked = libolm.lookupFunction<
415 : IntPtr Function(Pointer<NativeType> session),
416 : int Function(
417 : Pointer<NativeType> session)>('olm_outbound_group_session_key_length');
418 :
419 1 : int olm_outbound_group_session_key(
420 : Pointer<NativeType> session, Pointer<Uint8> key, int key_length) {
421 : int result =
422 2 : _olm_outbound_group_session_key_unchecked(session, key, key_length);
423 3 : if (result == olm_error())
424 0 : throw_olm(olm_outbound_group_session_last_error(session));
425 : return result;
426 : }
427 :
428 3 : final _olm_outbound_group_session_key_unchecked = libolm.lookupFunction<
429 : IntPtr Function(
430 : Pointer<NativeType> session, Pointer<Uint8> key, IntPtr key_length),
431 : int Function(Pointer<NativeType> session, Pointer<Uint8> key,
432 : int key_length)>('olm_outbound_group_session_key');
433 :
434 3 : final olm_get_library_version = libolm.lookupFunction<
435 : Void Function(
436 : Pointer<Uint8> major, Pointer<Uint8> minor, Pointer<Uint8> patch),
437 : void Function(Pointer<Uint8> major, Pointer<Uint8> minor,
438 : Pointer<Uint8> patch)>('olm_get_library_version');
439 :
440 3 : final olm_account_size = libolm
441 : .lookupFunction<IntPtr Function(), int Function()>('olm_account_size');
442 :
443 3 : final olm_session_size = libolm
444 : .lookupFunction<IntPtr Function(), int Function()>('olm_session_size');
445 :
446 3 : final olm_utility_size = libolm
447 : .lookupFunction<IntPtr Function(), int Function()>('olm_utility_size');
448 :
449 3 : final olm_account = libolm.lookupFunction<
450 : Pointer<NativeType> Function(Pointer<Uint8> memory),
451 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_account');
452 :
453 3 : final olm_session = libolm.lookupFunction<
454 : Pointer<NativeType> Function(Pointer<Uint8> memory),
455 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_session');
456 :
457 3 : final olm_utility = libolm.lookupFunction<
458 : Pointer<NativeType> Function(Pointer<Uint8> memory),
459 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_utility');
460 :
461 2 : final olm_error =
462 1 : libolm.lookupFunction<IntPtr Function(), int Function()>('olm_error');
463 :
464 3 : final olm_account_last_error = libolm.lookupFunction<
465 : Pointer<Utf8> Function(Pointer<NativeType> account),
466 : Pointer<Utf8> Function(
467 : Pointer<NativeType> account)>('olm_account_last_error');
468 :
469 3 : final olm_session_last_error = libolm.lookupFunction<
470 : Pointer<Utf8> Function(Pointer<NativeType> session),
471 : Pointer<Utf8> Function(
472 : Pointer<NativeType> session)>('olm_session_last_error');
473 :
474 3 : final olm_utility_last_error = libolm.lookupFunction<
475 : Pointer<Utf8> Function(Pointer<NativeType> utility),
476 : Pointer<Utf8> Function(
477 : Pointer<NativeType> utility)>('olm_utility_last_error');
478 :
479 1 : int olm_clear_account(Pointer<NativeType> account) {
480 2 : int result = _olm_clear_account_unchecked(account);
481 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
482 : return result;
483 : }
484 :
485 3 : final _olm_clear_account_unchecked = libolm.lookupFunction<
486 : IntPtr Function(Pointer<NativeType> account),
487 : int Function(Pointer<NativeType> account)>('olm_clear_account');
488 :
489 1 : int olm_clear_session(Pointer<NativeType> session) {
490 2 : int result = _olm_clear_session_unchecked(session);
491 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
492 : return result;
493 : }
494 :
495 3 : final _olm_clear_session_unchecked = libolm.lookupFunction<
496 : IntPtr Function(Pointer<NativeType> session),
497 : int Function(Pointer<NativeType> session)>('olm_clear_session');
498 :
499 1 : int olm_clear_utility(Pointer<NativeType> utility) {
500 2 : int result = _olm_clear_utility_unchecked(utility);
501 3 : if (result == olm_error()) throw_olm(olm_utility_last_error(utility));
502 : return result;
503 : }
504 :
505 3 : final _olm_clear_utility_unchecked = libolm.lookupFunction<
506 : IntPtr Function(Pointer<NativeType> utility),
507 : int Function(Pointer<NativeType> utility)>('olm_clear_utility');
508 :
509 1 : int olm_pickle_account_length(Pointer<NativeType> account) {
510 2 : int result = _olm_pickle_account_length_unchecked(account);
511 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
512 : return result;
513 : }
514 :
515 3 : final _olm_pickle_account_length_unchecked = libolm.lookupFunction<
516 : IntPtr Function(Pointer<NativeType> account),
517 : int Function(Pointer<NativeType> account)>('olm_pickle_account_length');
518 :
519 1 : int olm_pickle_session_length(Pointer<NativeType> session) {
520 2 : int result = _olm_pickle_session_length_unchecked(session);
521 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
522 : return result;
523 : }
524 :
525 3 : final _olm_pickle_session_length_unchecked = libolm.lookupFunction<
526 : IntPtr Function(Pointer<NativeType> session),
527 : int Function(Pointer<NativeType> session)>('olm_pickle_session_length');
528 :
529 1 : int olm_pickle_account(Pointer<NativeType> account, Pointer<Uint8> key,
530 : int key_length, Pointer<Uint8> pickled, int pickled_length) {
531 2 : int result = _olm_pickle_account_unchecked(
532 : account, key, key_length, pickled, pickled_length);
533 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
534 : return result;
535 : }
536 :
537 3 : final _olm_pickle_account_unchecked = libolm.lookupFunction<
538 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> key,
539 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
540 : int Function(
541 : Pointer<NativeType> account,
542 : Pointer<Uint8> key,
543 : int key_length,
544 : Pointer<Uint8> pickled,
545 : int pickled_length)>('olm_pickle_account');
546 :
547 1 : int olm_pickle_session(Pointer<NativeType> session, Pointer<Uint8> key,
548 : int key_length, Pointer<Uint8> pickled, int pickled_length) {
549 2 : int result = _olm_pickle_session_unchecked(
550 : session, key, key_length, pickled, pickled_length);
551 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
552 : return result;
553 : }
554 :
555 3 : final _olm_pickle_session_unchecked = libolm.lookupFunction<
556 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
557 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
558 : int Function(
559 : Pointer<NativeType> session,
560 : Pointer<Uint8> key,
561 : int key_length,
562 : Pointer<Uint8> pickled,
563 : int pickled_length)>('olm_pickle_session');
564 :
565 1 : int olm_unpickle_account(Pointer<NativeType> account, Pointer<Uint8> key,
566 : int key_length, Pointer<Uint8> pickled, int pickled_length) {
567 2 : int result = _olm_unpickle_account_unchecked(
568 : account, key, key_length, pickled, pickled_length);
569 6 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
570 : return result;
571 : }
572 :
573 3 : final _olm_unpickle_account_unchecked = libolm.lookupFunction<
574 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> key,
575 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
576 : int Function(
577 : Pointer<NativeType> account,
578 : Pointer<Uint8> key,
579 : int key_length,
580 : Pointer<Uint8> pickled,
581 : int pickled_length)>('olm_unpickle_account');
582 :
583 1 : int olm_unpickle_session(Pointer<NativeType> session, Pointer<Uint8> key,
584 : int key_length, Pointer<Uint8> pickled, int pickled_length) {
585 2 : int result = _olm_unpickle_session_unchecked(
586 : session, key, key_length, pickled, pickled_length);
587 6 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
588 : return result;
589 : }
590 :
591 3 : final _olm_unpickle_session_unchecked = libolm.lookupFunction<
592 : IntPtr Function(Pointer<NativeType> session, Pointer<Uint8> key,
593 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
594 : int Function(
595 : Pointer<NativeType> session,
596 : Pointer<Uint8> key,
597 : int key_length,
598 : Pointer<Uint8> pickled,
599 : int pickled_length)>('olm_unpickle_session');
600 :
601 1 : int olm_create_account_random_length(Pointer<NativeType> account) {
602 2 : int result = _olm_create_account_random_length_unchecked(account);
603 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
604 : return result;
605 : }
606 :
607 3 : final _olm_create_account_random_length_unchecked = libolm.lookupFunction<
608 : IntPtr Function(Pointer<NativeType> account),
609 : int Function(
610 : Pointer<NativeType> account)>('olm_create_account_random_length');
611 :
612 1 : int olm_create_account(
613 : Pointer<NativeType> account, Pointer<Uint8> random, int random_length) {
614 2 : int result = _olm_create_account_unchecked(account, random, random_length);
615 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
616 : return result;
617 : }
618 :
619 3 : final _olm_create_account_unchecked = libolm.lookupFunction<
620 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> random,
621 : IntPtr random_length),
622 : int Function(Pointer<NativeType> account, Pointer<Uint8> random,
623 : int random_length)>('olm_create_account');
624 :
625 1 : int olm_account_identity_keys_length(Pointer<NativeType> account) {
626 2 : int result = _olm_account_identity_keys_length_unchecked(account);
627 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
628 : return result;
629 : }
630 :
631 3 : final _olm_account_identity_keys_length_unchecked = libolm.lookupFunction<
632 : IntPtr Function(Pointer<NativeType> account),
633 : int Function(
634 : Pointer<NativeType> account)>('olm_account_identity_keys_length');
635 :
636 1 : int olm_account_identity_keys(Pointer<NativeType> account,
637 : Pointer<Uint8> identity_keys, int identity_key_length) {
638 2 : int result = _olm_account_identity_keys_unchecked(
639 : account, identity_keys, identity_key_length);
640 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
641 : return result;
642 : }
643 :
644 3 : final _olm_account_identity_keys_unchecked = libolm.lookupFunction<
645 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> identity_keys,
646 : IntPtr identity_key_length),
647 : int Function(Pointer<NativeType> account, Pointer<Uint8> identity_keys,
648 : int identity_key_length)>('olm_account_identity_keys');
649 :
650 1 : int olm_account_signature_length(Pointer<NativeType> account) {
651 2 : int result = _olm_account_signature_length_unchecked(account);
652 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
653 : return result;
654 : }
655 :
656 3 : final _olm_account_signature_length_unchecked = libolm.lookupFunction<
657 : IntPtr Function(Pointer<NativeType> account),
658 : int Function(Pointer<NativeType> account)>('olm_account_signature_length');
659 :
660 1 : int olm_account_sign(Pointer<NativeType> account, Pointer<Uint8> message,
661 : int message_length, Pointer<Uint8> signature, int signature_length) {
662 2 : int result = _olm_account_sign_unchecked(
663 : account, message, message_length, signature, signature_length);
664 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
665 : return result;
666 : }
667 :
668 3 : final _olm_account_sign_unchecked = libolm.lookupFunction<
669 : IntPtr Function(
670 : Pointer<NativeType> account,
671 : Pointer<Uint8> message,
672 : IntPtr message_length,
673 : Pointer<Uint8> signature,
674 : IntPtr signature_length),
675 : int Function(
676 : Pointer<NativeType> account,
677 : Pointer<Uint8> message,
678 : int message_length,
679 : Pointer<Uint8> signature,
680 : int signature_length)>('olm_account_sign');
681 :
682 1 : int olm_account_one_time_keys_length(Pointer<NativeType> account) {
683 2 : int result = _olm_account_one_time_keys_length_unchecked(account);
684 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
685 : return result;
686 : }
687 :
688 3 : final _olm_account_one_time_keys_length_unchecked = libolm.lookupFunction<
689 : IntPtr Function(Pointer<NativeType> account),
690 : int Function(
691 : Pointer<NativeType> account)>('olm_account_one_time_keys_length');
692 :
693 1 : int olm_account_one_time_keys(Pointer<NativeType> account,
694 : Pointer<Uint8> one_time_keys, int one_time_keys_length) {
695 2 : int result = _olm_account_one_time_keys_unchecked(
696 : account, one_time_keys, one_time_keys_length);
697 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
698 : return result;
699 : }
700 :
701 3 : final _olm_account_one_time_keys_unchecked = libolm.lookupFunction<
702 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> one_time_keys,
703 : IntPtr one_time_keys_length),
704 : int Function(Pointer<NativeType> account, Pointer<Uint8> one_time_keys,
705 : int one_time_keys_length)>('olm_account_one_time_keys');
706 :
707 1 : int olm_account_mark_keys_as_published(Pointer<NativeType> account) {
708 2 : int result = _olm_account_mark_keys_as_published_unchecked(account);
709 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
710 : return result;
711 : }
712 :
713 3 : final _olm_account_mark_keys_as_published_unchecked = libolm.lookupFunction<
714 : IntPtr Function(Pointer<NativeType> account),
715 : int Function(
716 : Pointer<NativeType> account)>('olm_account_mark_keys_as_published');
717 :
718 1 : int olm_account_max_number_of_one_time_keys(Pointer<NativeType> account) {
719 2 : int result = _olm_account_max_number_of_one_time_keys_unchecked(account);
720 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
721 : return result;
722 : }
723 :
724 2 : final _olm_account_max_number_of_one_time_keys_unchecked =
725 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> account),
726 : int Function(Pointer<NativeType> account)>(
727 : 'olm_account_max_number_of_one_time_keys');
728 :
729 1 : int olm_account_generate_one_time_keys_random_length(
730 : Pointer<NativeType> account, int number_of_keys) {
731 2 : int result = _olm_account_generate_one_time_keys_random_length_unchecked(
732 : account, number_of_keys);
733 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
734 : return result;
735 : }
736 :
737 2 : final _olm_account_generate_one_time_keys_random_length_unchecked =
738 1 : libolm.lookupFunction<
739 : IntPtr Function(Pointer<NativeType> account, IntPtr number_of_keys),
740 : int Function(Pointer<NativeType> account, int number_of_keys)>(
741 : 'olm_account_generate_one_time_keys_random_length');
742 :
743 1 : int olm_account_generate_one_time_keys(Pointer<NativeType> account,
744 : int number_of_keys, Pointer<Uint8> random, int random_length) {
745 2 : int result = _olm_account_generate_one_time_keys_unchecked(
746 : account, number_of_keys, random, random_length);
747 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
748 : return result;
749 : }
750 :
751 3 : final _olm_account_generate_one_time_keys_unchecked = libolm.lookupFunction<
752 : IntPtr Function(Pointer<NativeType> account, IntPtr number_of_keys,
753 : Pointer<Uint8> random, IntPtr random_length),
754 : int Function(
755 : Pointer<NativeType> account,
756 : int number_of_keys,
757 : Pointer<Uint8> random,
758 : int random_length)>('olm_account_generate_one_time_keys');
759 :
760 1 : int olm_account_generate_fallback_key_random_length(
761 : Pointer<NativeType> account) {
762 : int result =
763 2 : _olm_account_generate_fallback_key_random_length_unchecked(account);
764 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
765 : return result;
766 : }
767 :
768 2 : final _olm_account_generate_fallback_key_random_length_unchecked =
769 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> account),
770 : int Function(Pointer<NativeType> account)>(
771 : 'olm_account_generate_fallback_key_random_length');
772 :
773 1 : int olm_account_generate_fallback_key(
774 : Pointer<NativeType> account, Pointer<Uint8> random, int random_length) {
775 2 : int result = _olm_account_generate_fallback_key_unchecked(
776 : account, random, random_length);
777 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
778 : return result;
779 : }
780 :
781 3 : final _olm_account_generate_fallback_key_unchecked = libolm.lookupFunction<
782 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> random,
783 : IntPtr random_length),
784 : int Function(Pointer<NativeType> account, Pointer<Uint8> random,
785 : int random_length)>('olm_account_generate_fallback_key');
786 :
787 1 : int olm_account_fallback_key_length(Pointer<NativeType> account) {
788 2 : int result = _olm_account_fallback_key_length_unchecked(account);
789 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
790 : return result;
791 : }
792 :
793 3 : final _olm_account_fallback_key_length_unchecked = libolm.lookupFunction<
794 : IntPtr Function(Pointer<NativeType> account),
795 : int Function(
796 : Pointer<NativeType> account)>('olm_account_fallback_key_length');
797 :
798 1 : int olm_account_fallback_key(Pointer<NativeType> account,
799 : Pointer<Uint8> fallback_key, int fallback_key_size) {
800 2 : int result = _olm_account_fallback_key_unchecked(
801 : account, fallback_key, fallback_key_size);
802 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
803 : return result;
804 : }
805 :
806 3 : final _olm_account_fallback_key_unchecked = libolm.lookupFunction<
807 : IntPtr Function(Pointer<NativeType> account, Pointer<Uint8> fallback_key,
808 : IntPtr fallback_key_size),
809 : int Function(Pointer<NativeType> account, Pointer<Uint8> fallback_key,
810 : int fallback_key_size)>('olm_account_fallback_key');
811 :
812 1 : int olm_account_unpublished_fallback_key_length(Pointer<NativeType> account) {
813 2 : int result = _olm_account_unpublished_fallback_key_length_unchecked(account);
814 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
815 : return result;
816 : }
817 :
818 2 : final _olm_account_unpublished_fallback_key_length_unchecked =
819 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> account),
820 : int Function(Pointer<NativeType> account)>(
821 : 'olm_account_unpublished_fallback_key_length');
822 :
823 1 : int olm_account_unpublished_fallback_key(
824 : Pointer<NativeType> account,
825 : Pointer<Uint8> unpublished_fallback_key,
826 : int unpublished_fallback_key_size) {
827 2 : int result = _olm_account_unpublished_fallback_key_unchecked(
828 : account, unpublished_fallback_key, unpublished_fallback_key_size);
829 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
830 : return result;
831 : }
832 :
833 3 : final _olm_account_unpublished_fallback_key_unchecked = libolm.lookupFunction<
834 : IntPtr Function(
835 : Pointer<NativeType> account,
836 : Pointer<Uint8> unpublished_fallback_key,
837 : IntPtr unpublished_fallback_key_size),
838 : int Function(
839 : Pointer<NativeType> account,
840 : Pointer<Uint8> unpublished_fallback_key,
841 : int unpublished_fallback_key_size)>(
842 : 'olm_account_unpublished_fallback_key');
843 :
844 1 : int olm_create_outbound_session_random_length(Pointer<NativeType> session) {
845 2 : int result = _olm_create_outbound_session_random_length_unchecked(session);
846 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
847 : return result;
848 : }
849 :
850 2 : final _olm_create_outbound_session_random_length_unchecked =
851 1 : libolm.lookupFunction<IntPtr Function(Pointer<NativeType> session),
852 : int Function(Pointer<NativeType> session)>(
853 : 'olm_create_outbound_session_random_length');
854 :
855 1 : int olm_create_outbound_session(
856 : Pointer<NativeType> session,
857 : Pointer<NativeType> account,
858 : Pointer<Uint8> their_identity_key,
859 : int their_identity_key_length,
860 : Pointer<Uint8> their_one_time_key,
861 : int their_one_time_key_length,
862 : Pointer<Uint8> random,
863 : int random_length) {
864 2 : int result = _olm_create_outbound_session_unchecked(
865 : session,
866 : account,
867 : their_identity_key,
868 : their_identity_key_length,
869 : their_one_time_key,
870 : their_one_time_key_length,
871 : random,
872 : random_length);
873 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
874 : return result;
875 : }
876 :
877 3 : final _olm_create_outbound_session_unchecked = libolm.lookupFunction<
878 : IntPtr Function(
879 : Pointer<NativeType> session,
880 : Pointer<NativeType> account,
881 : Pointer<Uint8> their_identity_key,
882 : IntPtr their_identity_key_length,
883 : Pointer<Uint8> their_one_time_key,
884 : IntPtr their_one_time_key_length,
885 : Pointer<Uint8> random,
886 : IntPtr random_length),
887 : int Function(
888 : Pointer<NativeType> session,
889 : Pointer<NativeType> account,
890 : Pointer<Uint8> their_identity_key,
891 : int their_identity_key_length,
892 : Pointer<Uint8> their_one_time_key,
893 : int their_one_time_key_length,
894 : Pointer<Uint8> random,
895 : int random_length)>('olm_create_outbound_session');
896 :
897 1 : int olm_create_inbound_session(
898 : Pointer<NativeType> session,
899 : Pointer<NativeType> account,
900 : Pointer<Uint8> one_time_key_message,
901 : int message_length) {
902 2 : int result = _olm_create_inbound_session_unchecked(
903 : session, account, one_time_key_message, message_length);
904 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
905 : return result;
906 : }
907 :
908 3 : final _olm_create_inbound_session_unchecked = libolm.lookupFunction<
909 : IntPtr Function(Pointer<NativeType> session, Pointer<NativeType> account,
910 : Pointer<Uint8> one_time_key_message, IntPtr message_length),
911 : int Function(
912 : Pointer<NativeType> session,
913 : Pointer<NativeType> account,
914 : Pointer<Uint8> one_time_key_message,
915 : int message_length)>('olm_create_inbound_session');
916 :
917 1 : int olm_create_inbound_session_from(
918 : Pointer<NativeType> session,
919 : Pointer<NativeType> account,
920 : Pointer<Uint8> their_identity_key,
921 : int their_identity_key_length,
922 : Pointer<Uint8> one_time_key_message,
923 : int message_length) {
924 2 : int result = _olm_create_inbound_session_from_unchecked(
925 : session,
926 : account,
927 : their_identity_key,
928 : their_identity_key_length,
929 : one_time_key_message,
930 : message_length);
931 6 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
932 : return result;
933 : }
934 :
935 3 : final _olm_create_inbound_session_from_unchecked = libolm.lookupFunction<
936 : IntPtr Function(
937 : Pointer<NativeType> session,
938 : Pointer<NativeType> account,
939 : Pointer<Uint8> their_identity_key,
940 : IntPtr their_identity_key_length,
941 : Pointer<Uint8> one_time_key_message,
942 : IntPtr message_length),
943 : int Function(
944 : Pointer<NativeType> session,
945 : Pointer<NativeType> account,
946 : Pointer<Uint8> their_identity_key,
947 : int their_identity_key_length,
948 : Pointer<Uint8> one_time_key_message,
949 : int message_length)>('olm_create_inbound_session_from');
950 :
951 1 : int olm_session_id_length(Pointer<NativeType> session) {
952 2 : int result = _olm_session_id_length_unchecked(session);
953 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
954 : return result;
955 : }
956 :
957 3 : final _olm_session_id_length_unchecked = libolm.lookupFunction<
958 : IntPtr Function(Pointer<NativeType> session),
959 : int Function(Pointer<NativeType> session)>('olm_session_id_length');
960 :
961 1 : int olm_session_id(
962 : Pointer<NativeType> session, Pointer<Uint8> id, int id_length) {
963 2 : int result = _olm_session_id_unchecked(session, id, id_length);
964 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
965 : return result;
966 : }
967 :
968 3 : final _olm_session_id_unchecked = libolm.lookupFunction<
969 : IntPtr Function(
970 : Pointer<NativeType> session, Pointer<Uint8> id, IntPtr id_length),
971 : int Function(Pointer<NativeType> session, Pointer<Uint8> id,
972 : int id_length)>('olm_session_id');
973 :
974 3 : final olm_session_has_received_message = libolm.lookupFunction<
975 : Int32 Function(Pointer<NativeType> session),
976 : int Function(
977 : Pointer<NativeType> session)>('olm_session_has_received_message');
978 :
979 0 : final olm_session_describe = libolm.lookupFunction<
980 : Void Function(
981 : Pointer<NativeType> session, Pointer<Utf8> buf, IntPtr buflen),
982 : void Function(Pointer<NativeType> session, Pointer<Utf8> buf,
983 : int buflen)>('olm_session_describe');
984 :
985 1 : int olm_matches_inbound_session(Pointer<NativeType> session,
986 : Pointer<Uint8> one_time_key_message, int message_length) {
987 2 : int result = _olm_matches_inbound_session_unchecked(
988 : session, one_time_key_message, message_length);
989 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
990 : return result;
991 : }
992 :
993 3 : final _olm_matches_inbound_session_unchecked = libolm.lookupFunction<
994 : IntPtr Function(Pointer<NativeType> session,
995 : Pointer<Uint8> one_time_key_message, IntPtr message_length),
996 : int Function(
997 : Pointer<NativeType> session,
998 : Pointer<Uint8> one_time_key_message,
999 : int message_length)>('olm_matches_inbound_session');
1000 :
1001 1 : int olm_matches_inbound_session_from(
1002 : Pointer<NativeType> session,
1003 : Pointer<Uint8> their_identity_key,
1004 : int their_identity_key_length,
1005 : Pointer<Uint8> one_time_key_message,
1006 : int message_length) {
1007 2 : int result = _olm_matches_inbound_session_from_unchecked(
1008 : session,
1009 : their_identity_key,
1010 : their_identity_key_length,
1011 : one_time_key_message,
1012 : message_length);
1013 6 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1014 : return result;
1015 : }
1016 :
1017 3 : final _olm_matches_inbound_session_from_unchecked = libolm.lookupFunction<
1018 : IntPtr Function(
1019 : Pointer<NativeType> session,
1020 : Pointer<Uint8> their_identity_key,
1021 : IntPtr their_identity_key_length,
1022 : Pointer<Uint8> one_time_key_message,
1023 : IntPtr message_length),
1024 : int Function(
1025 : Pointer<NativeType> session,
1026 : Pointer<Uint8> their_identity_key,
1027 : int their_identity_key_length,
1028 : Pointer<Uint8> one_time_key_message,
1029 : int message_length)>('olm_matches_inbound_session_from');
1030 :
1031 1 : int olm_remove_one_time_keys(
1032 : Pointer<NativeType> account, Pointer<NativeType> session) {
1033 2 : int result = _olm_remove_one_time_keys_unchecked(account, session);
1034 3 : if (result == olm_error()) throw_olm(olm_account_last_error(account));
1035 : return result;
1036 : }
1037 :
1038 3 : final _olm_remove_one_time_keys_unchecked = libolm.lookupFunction<
1039 : IntPtr Function(Pointer<NativeType> account, Pointer<NativeType> session),
1040 : int Function(Pointer<NativeType> account,
1041 : Pointer<NativeType> session)>('olm_remove_one_time_keys');
1042 :
1043 1 : int olm_encrypt_message_type(Pointer<NativeType> session) {
1044 2 : int result = _olm_encrypt_message_type_unchecked(session);
1045 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1046 : return result;
1047 : }
1048 :
1049 3 : final _olm_encrypt_message_type_unchecked = libolm.lookupFunction<
1050 : IntPtr Function(Pointer<NativeType> session),
1051 : int Function(Pointer<NativeType> session)>('olm_encrypt_message_type');
1052 :
1053 1 : int olm_encrypt_random_length(Pointer<NativeType> session) {
1054 2 : int result = _olm_encrypt_random_length_unchecked(session);
1055 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1056 : return result;
1057 : }
1058 :
1059 3 : final _olm_encrypt_random_length_unchecked = libolm.lookupFunction<
1060 : IntPtr Function(Pointer<NativeType> session),
1061 : int Function(Pointer<NativeType> session)>('olm_encrypt_random_length');
1062 :
1063 1 : int olm_encrypt_message_length(
1064 : Pointer<NativeType> session, int plaintext_length) {
1065 2 : int result = _olm_encrypt_message_length_unchecked(session, plaintext_length);
1066 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1067 : return result;
1068 : }
1069 :
1070 3 : final _olm_encrypt_message_length_unchecked = libolm.lookupFunction<
1071 : IntPtr Function(Pointer<NativeType> session, IntPtr plaintext_length),
1072 : int Function(Pointer<NativeType> session,
1073 : int plaintext_length)>('olm_encrypt_message_length');
1074 :
1075 1 : int olm_encrypt(
1076 : Pointer<NativeType> session,
1077 : Pointer<Uint8> plaintext,
1078 : int plaintext_length,
1079 : Pointer<Uint8> random,
1080 : int random_length,
1081 : Pointer<Uint8> message,
1082 : int message_length) {
1083 2 : int result = _olm_encrypt_unchecked(session, plaintext, plaintext_length,
1084 : random, random_length, message, message_length);
1085 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1086 : return result;
1087 : }
1088 :
1089 3 : final _olm_encrypt_unchecked = libolm.lookupFunction<
1090 : IntPtr Function(
1091 : Pointer<NativeType> session,
1092 : Pointer<Uint8> plaintext,
1093 : IntPtr plaintext_length,
1094 : Pointer<Uint8> random,
1095 : IntPtr random_length,
1096 : Pointer<Uint8> message,
1097 : IntPtr message_length),
1098 : int Function(
1099 : Pointer<NativeType> session,
1100 : Pointer<Uint8> plaintext,
1101 : int plaintext_length,
1102 : Pointer<Uint8> random,
1103 : int random_length,
1104 : Pointer<Uint8> message,
1105 : int message_length)>('olm_encrypt');
1106 :
1107 1 : int olm_decrypt_max_plaintext_length(Pointer<NativeType> session,
1108 : int message_type, Pointer<Uint8> message, int message_length) {
1109 2 : int result = _olm_decrypt_max_plaintext_length_unchecked(
1110 : session, message_type, message, message_length);
1111 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1112 : return result;
1113 : }
1114 :
1115 3 : final _olm_decrypt_max_plaintext_length_unchecked = libolm.lookupFunction<
1116 : IntPtr Function(Pointer<NativeType> session, IntPtr message_type,
1117 : Pointer<Uint8> message, IntPtr message_length),
1118 : int Function(
1119 : Pointer<NativeType> session,
1120 : int message_type,
1121 : Pointer<Uint8> message,
1122 : int message_length)>('olm_decrypt_max_plaintext_length');
1123 :
1124 1 : int olm_decrypt(
1125 : Pointer<NativeType> session,
1126 : int message_type,
1127 : Pointer<Uint8> message,
1128 : int message_length,
1129 : Pointer<Uint8> plaintext,
1130 : int max_plaintext_length) {
1131 2 : int result = _olm_decrypt_unchecked(session, message_type, message,
1132 : message_length, plaintext, max_plaintext_length);
1133 3 : if (result == olm_error()) throw_olm(olm_session_last_error(session));
1134 : return result;
1135 : }
1136 :
1137 3 : final _olm_decrypt_unchecked = libolm.lookupFunction<
1138 : IntPtr Function(
1139 : Pointer<NativeType> session,
1140 : IntPtr message_type,
1141 : Pointer<Uint8> message,
1142 : IntPtr message_length,
1143 : Pointer<Uint8> plaintext,
1144 : IntPtr max_plaintext_length),
1145 : int Function(
1146 : Pointer<NativeType> session,
1147 : int message_type,
1148 : Pointer<Uint8> message,
1149 : int message_length,
1150 : Pointer<Uint8> plaintext,
1151 : int max_plaintext_length)>('olm_decrypt');
1152 :
1153 1 : int olm_sha256_length(Pointer<NativeType> utility) {
1154 2 : int result = _olm_sha256_length_unchecked(utility);
1155 3 : if (result == olm_error()) throw_olm(olm_utility_last_error(utility));
1156 : return result;
1157 : }
1158 :
1159 3 : final _olm_sha256_length_unchecked = libolm.lookupFunction<
1160 : IntPtr Function(Pointer<NativeType> utility),
1161 : int Function(Pointer<NativeType> utility)>('olm_sha256_length');
1162 :
1163 1 : int olm_sha256(Pointer<NativeType> utility, Pointer<Uint8> input,
1164 : int input_length, Pointer<Uint8> output, int output_length) {
1165 2 : int result = _olm_sha256_unchecked(
1166 : utility, input, input_length, output, output_length);
1167 3 : if (result == olm_error()) throw_olm(olm_utility_last_error(utility));
1168 : return result;
1169 : }
1170 :
1171 3 : final _olm_sha256_unchecked = libolm.lookupFunction<
1172 : IntPtr Function(Pointer<NativeType> utility, Pointer<Uint8> input,
1173 : IntPtr input_length, Pointer<Uint8> output, IntPtr output_length),
1174 : int Function(
1175 : Pointer<NativeType> utility,
1176 : Pointer<Uint8> input,
1177 : int input_length,
1178 : Pointer<Uint8> output,
1179 : int output_length)>('olm_sha256');
1180 :
1181 1 : int olm_ed25519_verify(
1182 : Pointer<NativeType> utility,
1183 : Pointer<Uint8> key,
1184 : int key_length,
1185 : Pointer<Uint8> message,
1186 : int message_length,
1187 : Pointer<Uint8> signature,
1188 : int signature_length) {
1189 2 : int result = _olm_ed25519_verify_unchecked(utility, key, key_length, message,
1190 : message_length, signature, signature_length);
1191 6 : if (result == olm_error()) throw_olm(olm_utility_last_error(utility));
1192 : return result;
1193 : }
1194 :
1195 3 : final _olm_ed25519_verify_unchecked = libolm.lookupFunction<
1196 : IntPtr Function(
1197 : Pointer<NativeType> utility,
1198 : Pointer<Uint8> key,
1199 : IntPtr key_length,
1200 : Pointer<Uint8> message,
1201 : IntPtr message_length,
1202 : Pointer<Uint8> signature,
1203 : IntPtr signature_length),
1204 : int Function(
1205 : Pointer<NativeType> utility,
1206 : Pointer<Uint8> key,
1207 : int key_length,
1208 : Pointer<Uint8> message,
1209 : int message_length,
1210 : Pointer<Uint8> signature,
1211 : int signature_length)>('olm_ed25519_verify');
1212 :
1213 3 : final olm_sas_last_error = libolm.lookupFunction<
1214 : Pointer<Utf8> Function(Pointer<NativeType> sas),
1215 : Pointer<Utf8> Function(Pointer<NativeType> sas)>('olm_sas_last_error');
1216 :
1217 2 : final olm_sas_size =
1218 1 : libolm.lookupFunction<IntPtr Function(), int Function()>('olm_sas_size');
1219 :
1220 3 : final olm_sas = libolm.lookupFunction<
1221 : Pointer<NativeType> Function(Pointer<Uint8> memory),
1222 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_sas');
1223 :
1224 1 : int olm_clear_sas(Pointer<NativeType> sas) {
1225 2 : int result = _olm_clear_sas_unchecked(sas);
1226 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1227 : return result;
1228 : }
1229 :
1230 3 : final _olm_clear_sas_unchecked = libolm.lookupFunction<
1231 : IntPtr Function(Pointer<NativeType> sas),
1232 : int Function(Pointer<NativeType> sas)>('olm_clear_sas');
1233 :
1234 1 : int olm_create_sas_random_length(Pointer<NativeType> sas) {
1235 2 : int result = _olm_create_sas_random_length_unchecked(sas);
1236 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1237 : return result;
1238 : }
1239 :
1240 3 : final _olm_create_sas_random_length_unchecked = libolm.lookupFunction<
1241 : IntPtr Function(Pointer<NativeType> sas),
1242 : int Function(Pointer<NativeType> sas)>('olm_create_sas_random_length');
1243 :
1244 1 : int olm_create_sas(
1245 : Pointer<NativeType> sas, Pointer<Uint8> random, int random_length) {
1246 2 : int result = _olm_create_sas_unchecked(sas, random, random_length);
1247 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1248 : return result;
1249 : }
1250 :
1251 3 : final _olm_create_sas_unchecked = libolm.lookupFunction<
1252 : IntPtr Function(
1253 : Pointer<NativeType> sas, Pointer<Uint8> random, IntPtr random_length),
1254 : int Function(Pointer<NativeType> sas, Pointer<Uint8> random,
1255 : int random_length)>('olm_create_sas');
1256 :
1257 1 : int olm_sas_pubkey_length(Pointer<NativeType> sas) {
1258 2 : int result = _olm_sas_pubkey_length_unchecked(sas);
1259 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1260 : return result;
1261 : }
1262 :
1263 3 : final _olm_sas_pubkey_length_unchecked = libolm.lookupFunction<
1264 : IntPtr Function(Pointer<NativeType> sas),
1265 : int Function(Pointer<NativeType> sas)>('olm_sas_pubkey_length');
1266 :
1267 1 : int olm_sas_get_pubkey(
1268 : Pointer<NativeType> sas, Pointer<Uint8> pubkey, int pubkey_length) {
1269 2 : int result = _olm_sas_get_pubkey_unchecked(sas, pubkey, pubkey_length);
1270 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1271 : return result;
1272 : }
1273 :
1274 3 : final _olm_sas_get_pubkey_unchecked = libolm.lookupFunction<
1275 : IntPtr Function(
1276 : Pointer<NativeType> sas, Pointer<Uint8> pubkey, IntPtr pubkey_length),
1277 : int Function(Pointer<NativeType> sas, Pointer<Uint8> pubkey,
1278 : int pubkey_length)>('olm_sas_get_pubkey');
1279 :
1280 1 : int olm_sas_set_their_key(
1281 : Pointer<NativeType> sas, Pointer<Uint8> their_key, int their_key_length) {
1282 : int result =
1283 2 : _olm_sas_set_their_key_unchecked(sas, their_key, their_key_length);
1284 6 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1285 : return result;
1286 : }
1287 :
1288 3 : final _olm_sas_set_their_key_unchecked = libolm.lookupFunction<
1289 : IntPtr Function(Pointer<NativeType> sas, Pointer<Uint8> their_key,
1290 : IntPtr their_key_length),
1291 : int Function(Pointer<NativeType> sas, Pointer<Uint8> their_key,
1292 : int their_key_length)>('olm_sas_set_their_key');
1293 :
1294 0 : final olm_sas_is_their_key_set = libolm.lookupFunction<
1295 : Int32 Function(Pointer<NativeType> sas),
1296 : int Function(Pointer<NativeType> sas)>('olm_sas_is_their_key_set');
1297 :
1298 1 : int olm_sas_generate_bytes(Pointer<NativeType> sas, Pointer<Uint8> info,
1299 : int info_length, Pointer<Uint8> output, int output_length) {
1300 2 : int result = _olm_sas_generate_bytes_unchecked(
1301 : sas, info, info_length, output, output_length);
1302 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1303 : return result;
1304 : }
1305 :
1306 3 : final _olm_sas_generate_bytes_unchecked = libolm.lookupFunction<
1307 : IntPtr Function(Pointer<NativeType> sas, Pointer<Uint8> info,
1308 : IntPtr info_length, Pointer<Uint8> output, IntPtr output_length),
1309 : int Function(Pointer<NativeType> sas, Pointer<Uint8> info, int info_length,
1310 : Pointer<Uint8> output, int output_length)>('olm_sas_generate_bytes');
1311 :
1312 1 : int olm_sas_mac_length(Pointer<NativeType> sas) {
1313 2 : int result = _olm_sas_mac_length_unchecked(sas);
1314 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1315 : return result;
1316 : }
1317 :
1318 3 : final _olm_sas_mac_length_unchecked = libolm.lookupFunction<
1319 : IntPtr Function(Pointer<NativeType> sas),
1320 : int Function(Pointer<NativeType> sas)>('olm_sas_mac_length');
1321 :
1322 1 : int olm_sas_calculate_mac(
1323 : Pointer<NativeType> sas,
1324 : Pointer<Uint8> input,
1325 : int input_length,
1326 : Pointer<Uint8> info,
1327 : int info_length,
1328 : Pointer<Uint8> mac,
1329 : int mac_length) {
1330 2 : int result = _olm_sas_calculate_mac_unchecked(
1331 : sas, input, input_length, info, info_length, mac, mac_length);
1332 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1333 : return result;
1334 : }
1335 :
1336 3 : final _olm_sas_calculate_mac_unchecked = libolm.lookupFunction<
1337 : IntPtr Function(
1338 : Pointer<NativeType> sas,
1339 : Pointer<Uint8> input,
1340 : IntPtr input_length,
1341 : Pointer<Uint8> info,
1342 : IntPtr info_length,
1343 : Pointer<Uint8> mac,
1344 : IntPtr mac_length),
1345 : int Function(
1346 : Pointer<NativeType> sas,
1347 : Pointer<Uint8> input,
1348 : int input_length,
1349 : Pointer<Uint8> info,
1350 : int info_length,
1351 : Pointer<Uint8> mac,
1352 : int mac_length)>('olm_sas_calculate_mac');
1353 :
1354 1 : int olm_sas_calculate_mac_long_kdf(
1355 : Pointer<NativeType> sas,
1356 : Pointer<Uint8> input,
1357 : int input_length,
1358 : Pointer<Uint8> info,
1359 : int info_length,
1360 : Pointer<Uint8> mac,
1361 : int mac_length) {
1362 2 : int result = _olm_sas_calculate_mac_long_kdf_unchecked(
1363 : sas, input, input_length, info, info_length, mac, mac_length);
1364 3 : if (result == olm_error()) throw_olm(olm_sas_last_error(sas));
1365 : return result;
1366 : }
1367 :
1368 3 : final _olm_sas_calculate_mac_long_kdf_unchecked = libolm.lookupFunction<
1369 : IntPtr Function(
1370 : Pointer<NativeType> sas,
1371 : Pointer<Uint8> input,
1372 : IntPtr input_length,
1373 : Pointer<Uint8> info,
1374 : IntPtr info_length,
1375 : Pointer<Uint8> mac,
1376 : IntPtr mac_length),
1377 : int Function(
1378 : Pointer<NativeType> sas,
1379 : Pointer<Uint8> input,
1380 : int input_length,
1381 : Pointer<Uint8> info,
1382 : int info_length,
1383 : Pointer<Uint8> mac,
1384 : int mac_length)>('olm_sas_calculate_mac_long_kdf');
1385 :
1386 2 : final olm_pk_encryption_size =
1387 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1388 : 'olm_pk_encryption_size');
1389 :
1390 3 : final olm_pk_encryption = libolm.lookupFunction<
1391 : Pointer<NativeType> Function(Pointer<Uint8> memory),
1392 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_pk_encryption');
1393 :
1394 3 : final olm_pk_encryption_last_error = libolm.lookupFunction<
1395 : Pointer<Utf8> Function(Pointer<NativeType> encryption),
1396 : Pointer<Utf8> Function(
1397 : Pointer<NativeType> encryption)>('olm_pk_encryption_last_error');
1398 :
1399 1 : int olm_clear_pk_encryption(Pointer<NativeType> encryption) {
1400 2 : int result = _olm_clear_pk_encryption_unchecked(encryption);
1401 3 : if (result == olm_error())
1402 0 : throw_olm(olm_pk_encryption_last_error(encryption));
1403 : return result;
1404 : }
1405 :
1406 3 : final _olm_clear_pk_encryption_unchecked = libolm.lookupFunction<
1407 : IntPtr Function(Pointer<NativeType> encryption),
1408 : int Function(Pointer<NativeType> encryption)>('olm_clear_pk_encryption');
1409 :
1410 1 : int olm_pk_encryption_set_recipient_key(Pointer<NativeType> encryption,
1411 : Pointer<Uint8> public_key, int public_key_length) {
1412 2 : int result = _olm_pk_encryption_set_recipient_key_unchecked(
1413 : encryption, public_key, public_key_length);
1414 3 : if (result == olm_error())
1415 3 : throw_olm(olm_pk_encryption_last_error(encryption));
1416 : return result;
1417 : }
1418 :
1419 3 : final _olm_pk_encryption_set_recipient_key_unchecked = libolm.lookupFunction<
1420 : IntPtr Function(Pointer<NativeType> encryption, Pointer<Uint8> public_key,
1421 : IntPtr public_key_length),
1422 : int Function(Pointer<NativeType> encryption, Pointer<Uint8> public_key,
1423 : int public_key_length)>('olm_pk_encryption_set_recipient_key');
1424 :
1425 1 : int olm_pk_ciphertext_length(
1426 : Pointer<NativeType> encryption, int plaintext_length) {
1427 : int result =
1428 2 : _olm_pk_ciphertext_length_unchecked(encryption, plaintext_length);
1429 3 : if (result == olm_error())
1430 0 : throw_olm(olm_pk_encryption_last_error(encryption));
1431 : return result;
1432 : }
1433 :
1434 3 : final _olm_pk_ciphertext_length_unchecked = libolm.lookupFunction<
1435 : IntPtr Function(Pointer<NativeType> encryption, IntPtr plaintext_length),
1436 : int Function(Pointer<NativeType> encryption,
1437 : int plaintext_length)>('olm_pk_ciphertext_length');
1438 :
1439 1 : int olm_pk_mac_length(Pointer<NativeType> encryption) {
1440 2 : int result = _olm_pk_mac_length_unchecked(encryption);
1441 3 : if (result == olm_error())
1442 0 : throw_olm(olm_pk_encryption_last_error(encryption));
1443 : return result;
1444 : }
1445 :
1446 3 : final _olm_pk_mac_length_unchecked = libolm.lookupFunction<
1447 : IntPtr Function(Pointer<NativeType> encryption),
1448 : int Function(Pointer<NativeType> encryption)>('olm_pk_mac_length');
1449 :
1450 3 : final olm_pk_key_length = libolm
1451 : .lookupFunction<IntPtr Function(), int Function()>('olm_pk_key_length');
1452 :
1453 1 : int olm_pk_encrypt_random_length(Pointer<NativeType> encryption) {
1454 2 : int result = _olm_pk_encrypt_random_length_unchecked(encryption);
1455 3 : if (result == olm_error())
1456 0 : throw_olm(olm_pk_encryption_last_error(encryption));
1457 : return result;
1458 : }
1459 :
1460 3 : final _olm_pk_encrypt_random_length_unchecked = libolm.lookupFunction<
1461 : IntPtr Function(Pointer<NativeType> encryption),
1462 : int Function(
1463 : Pointer<NativeType> encryption)>('olm_pk_encrypt_random_length');
1464 :
1465 1 : int olm_pk_encrypt(
1466 : Pointer<NativeType> encryption,
1467 : Pointer<Uint8> plaintext,
1468 : int plaintext_length,
1469 : Pointer<Uint8> ciphertext,
1470 : int ciphertext_length,
1471 : Pointer<Uint8> mac,
1472 : int mac_length,
1473 : Pointer<Uint8> ephemeral_key,
1474 : int ephemeral_key_size,
1475 : Pointer<Uint8> random,
1476 : int random_length) {
1477 2 : int result = _olm_pk_encrypt_unchecked(
1478 : encryption,
1479 : plaintext,
1480 : plaintext_length,
1481 : ciphertext,
1482 : ciphertext_length,
1483 : mac,
1484 : mac_length,
1485 : ephemeral_key,
1486 : ephemeral_key_size,
1487 : random,
1488 : random_length);
1489 3 : if (result == olm_error())
1490 0 : throw_olm(olm_pk_encryption_last_error(encryption));
1491 : return result;
1492 : }
1493 :
1494 3 : final _olm_pk_encrypt_unchecked = libolm.lookupFunction<
1495 : IntPtr Function(
1496 : Pointer<NativeType> encryption,
1497 : Pointer<Uint8> plaintext,
1498 : IntPtr plaintext_length,
1499 : Pointer<Uint8> ciphertext,
1500 : IntPtr ciphertext_length,
1501 : Pointer<Uint8> mac,
1502 : IntPtr mac_length,
1503 : Pointer<Uint8> ephemeral_key,
1504 : IntPtr ephemeral_key_size,
1505 : Pointer<Uint8> random,
1506 : IntPtr random_length),
1507 : int Function(
1508 : Pointer<NativeType> encryption,
1509 : Pointer<Uint8> plaintext,
1510 : int plaintext_length,
1511 : Pointer<Uint8> ciphertext,
1512 : int ciphertext_length,
1513 : Pointer<Uint8> mac,
1514 : int mac_length,
1515 : Pointer<Uint8> ephemeral_key,
1516 : int ephemeral_key_size,
1517 : Pointer<Uint8> random,
1518 : int random_length)>('olm_pk_encrypt');
1519 :
1520 2 : final olm_pk_decryption_size =
1521 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1522 : 'olm_pk_decryption_size');
1523 :
1524 3 : final olm_pk_decryption = libolm.lookupFunction<
1525 : Pointer<NativeType> Function(Pointer<Uint8> memory),
1526 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_pk_decryption');
1527 :
1528 3 : final olm_pk_decryption_last_error = libolm.lookupFunction<
1529 : Pointer<Utf8> Function(Pointer<NativeType> decryption),
1530 : Pointer<Utf8> Function(
1531 : Pointer<NativeType> decryption)>('olm_pk_decryption_last_error');
1532 :
1533 1 : int olm_clear_pk_decryption(Pointer<NativeType> decryption) {
1534 2 : int result = _olm_clear_pk_decryption_unchecked(decryption);
1535 3 : if (result == olm_error())
1536 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1537 : return result;
1538 : }
1539 :
1540 3 : final _olm_clear_pk_decryption_unchecked = libolm.lookupFunction<
1541 : IntPtr Function(Pointer<NativeType> decryption),
1542 : int Function(Pointer<NativeType> decryption)>('olm_clear_pk_decryption');
1543 :
1544 2 : final olm_pk_private_key_length =
1545 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1546 : 'olm_pk_private_key_length');
1547 :
1548 0 : final olm_pk_generate_key_random_length =
1549 0 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1550 : 'olm_pk_generate_key_random_length');
1551 :
1552 1 : int olm_pk_key_from_private(
1553 : Pointer<NativeType> decryption,
1554 : Pointer<Uint8> pubkey,
1555 : int pubkey_length,
1556 : Pointer<Uint8> privkey,
1557 : int privkey_length) {
1558 2 : int result = _olm_pk_key_from_private_unchecked(
1559 : decryption, pubkey, pubkey_length, privkey, privkey_length);
1560 3 : if (result == olm_error())
1561 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1562 : return result;
1563 : }
1564 :
1565 3 : final _olm_pk_key_from_private_unchecked = libolm.lookupFunction<
1566 : IntPtr Function(Pointer<NativeType> decryption, Pointer<Uint8> pubkey,
1567 : IntPtr pubkey_length, Pointer<Uint8> privkey, IntPtr privkey_length),
1568 : int Function(
1569 : Pointer<NativeType> decryption,
1570 : Pointer<Uint8> pubkey,
1571 : int pubkey_length,
1572 : Pointer<Uint8> privkey,
1573 : int privkey_length)>('olm_pk_key_from_private');
1574 :
1575 0 : int olm_pk_generate_key(Pointer<NativeType> decryption, Pointer<Uint8> pubkey,
1576 : int pubkey_length, Pointer<Uint8> privkey, int privkey_length) {
1577 0 : int result = _olm_pk_generate_key_unchecked(
1578 : decryption, pubkey, pubkey_length, privkey, privkey_length);
1579 0 : if (result == olm_error())
1580 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1581 : return result;
1582 : }
1583 :
1584 0 : final _olm_pk_generate_key_unchecked = libolm.lookupFunction<
1585 : IntPtr Function(Pointer<NativeType> decryption, Pointer<Uint8> pubkey,
1586 : IntPtr pubkey_length, Pointer<Uint8> privkey, IntPtr privkey_length),
1587 : int Function(
1588 : Pointer<NativeType> decryption,
1589 : Pointer<Uint8> pubkey,
1590 : int pubkey_length,
1591 : Pointer<Uint8> privkey,
1592 : int privkey_length)>('olm_pk_generate_key');
1593 :
1594 1 : int olm_pickle_pk_decryption_length(Pointer<NativeType> decryption) {
1595 2 : int result = _olm_pickle_pk_decryption_length_unchecked(decryption);
1596 3 : if (result == olm_error())
1597 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1598 : return result;
1599 : }
1600 :
1601 3 : final _olm_pickle_pk_decryption_length_unchecked = libolm.lookupFunction<
1602 : IntPtr Function(Pointer<NativeType> decryption),
1603 : int Function(
1604 : Pointer<NativeType> decryption)>('olm_pickle_pk_decryption_length');
1605 :
1606 1 : int olm_pickle_pk_decryption(Pointer<NativeType> decryption, Pointer<Uint8> key,
1607 : int key_length, Pointer<Uint8> pickled, int pickled_length) {
1608 2 : int result = _olm_pickle_pk_decryption_unchecked(
1609 : decryption, key, key_length, pickled, pickled_length);
1610 3 : if (result == olm_error())
1611 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1612 : return result;
1613 : }
1614 :
1615 3 : final _olm_pickle_pk_decryption_unchecked = libolm.lookupFunction<
1616 : IntPtr Function(Pointer<NativeType> decryption, Pointer<Uint8> key,
1617 : IntPtr key_length, Pointer<Uint8> pickled, IntPtr pickled_length),
1618 : int Function(
1619 : Pointer<NativeType> decryption,
1620 : Pointer<Uint8> key,
1621 : int key_length,
1622 : Pointer<Uint8> pickled,
1623 : int pickled_length)>('olm_pickle_pk_decryption');
1624 :
1625 1 : int olm_unpickle_pk_decryption(
1626 : Pointer<NativeType> decryption,
1627 : Pointer<Uint8> key,
1628 : int key_length,
1629 : Pointer<Uint8> pickled,
1630 : int pickled_length,
1631 : Pointer<Uint8> pubkey,
1632 : int pubkey_length) {
1633 2 : int result = _olm_unpickle_pk_decryption_unchecked(decryption, key,
1634 : key_length, pickled, pickled_length, pubkey, pubkey_length);
1635 3 : if (result == olm_error())
1636 3 : throw_olm(olm_pk_decryption_last_error(decryption));
1637 : return result;
1638 : }
1639 :
1640 3 : final _olm_unpickle_pk_decryption_unchecked = libolm.lookupFunction<
1641 : IntPtr Function(
1642 : Pointer<NativeType> decryption,
1643 : Pointer<Uint8> key,
1644 : IntPtr key_length,
1645 : Pointer<Uint8> pickled,
1646 : IntPtr pickled_length,
1647 : Pointer<Uint8> pubkey,
1648 : IntPtr pubkey_length),
1649 : int Function(
1650 : Pointer<NativeType> decryption,
1651 : Pointer<Uint8> key,
1652 : int key_length,
1653 : Pointer<Uint8> pickled,
1654 : int pickled_length,
1655 : Pointer<Uint8> pubkey,
1656 : int pubkey_length)>('olm_unpickle_pk_decryption');
1657 :
1658 1 : int olm_pk_max_plaintext_length(
1659 : Pointer<NativeType> decryption, int ciphertext_length) {
1660 : int result =
1661 2 : _olm_pk_max_plaintext_length_unchecked(decryption, ciphertext_length);
1662 3 : if (result == olm_error())
1663 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1664 : return result;
1665 : }
1666 :
1667 3 : final _olm_pk_max_plaintext_length_unchecked = libolm.lookupFunction<
1668 : IntPtr Function(Pointer<NativeType> decryption, IntPtr ciphertext_length),
1669 : int Function(Pointer<NativeType> decryption,
1670 : int ciphertext_length)>('olm_pk_max_plaintext_length');
1671 :
1672 1 : int olm_pk_decrypt(
1673 : Pointer<NativeType> decryption,
1674 : Pointer<Uint8> ephemeral_key,
1675 : int ephemeral_key_length,
1676 : Pointer<Uint8> mac,
1677 : int mac_length,
1678 : Pointer<Uint8> ciphertext,
1679 : int ciphertext_length,
1680 : Pointer<Uint8> plaintext,
1681 : int max_plaintext_length) {
1682 2 : int result = _olm_pk_decrypt_unchecked(
1683 : decryption,
1684 : ephemeral_key,
1685 : ephemeral_key_length,
1686 : mac,
1687 : mac_length,
1688 : ciphertext,
1689 : ciphertext_length,
1690 : plaintext,
1691 : max_plaintext_length);
1692 3 : if (result == olm_error())
1693 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1694 : return result;
1695 : }
1696 :
1697 3 : final _olm_pk_decrypt_unchecked = libolm.lookupFunction<
1698 : IntPtr Function(
1699 : Pointer<NativeType> decryption,
1700 : Pointer<Uint8> ephemeral_key,
1701 : IntPtr ephemeral_key_length,
1702 : Pointer<Uint8> mac,
1703 : IntPtr mac_length,
1704 : Pointer<Uint8> ciphertext,
1705 : IntPtr ciphertext_length,
1706 : Pointer<Uint8> plaintext,
1707 : IntPtr max_plaintext_length),
1708 : int Function(
1709 : Pointer<NativeType> decryption,
1710 : Pointer<Uint8> ephemeral_key,
1711 : int ephemeral_key_length,
1712 : Pointer<Uint8> mac,
1713 : int mac_length,
1714 : Pointer<Uint8> ciphertext,
1715 : int ciphertext_length,
1716 : Pointer<Uint8> plaintext,
1717 : int max_plaintext_length)>('olm_pk_decrypt');
1718 :
1719 1 : int olm_pk_get_private_key(Pointer<NativeType> decryption,
1720 : Pointer<Uint8> private_key, int private_key_length) {
1721 2 : int result = _olm_pk_get_private_key_unchecked(
1722 : decryption, private_key, private_key_length);
1723 3 : if (result == olm_error())
1724 0 : throw_olm(olm_pk_decryption_last_error(decryption));
1725 : return result;
1726 : }
1727 :
1728 3 : final _olm_pk_get_private_key_unchecked = libolm.lookupFunction<
1729 : IntPtr Function(Pointer<NativeType> decryption, Pointer<Uint8> private_key,
1730 : IntPtr private_key_length),
1731 : int Function(Pointer<NativeType> decryption, Pointer<Uint8> private_key,
1732 : int private_key_length)>('olm_pk_get_private_key');
1733 :
1734 3 : final olm_pk_signing_size = libolm
1735 : .lookupFunction<IntPtr Function(), int Function()>('olm_pk_signing_size');
1736 :
1737 3 : final olm_pk_signing = libolm.lookupFunction<
1738 : Pointer<NativeType> Function(Pointer<Uint8> memory),
1739 : Pointer<NativeType> Function(Pointer<Uint8> memory)>('olm_pk_signing');
1740 :
1741 3 : final olm_pk_signing_last_error = libolm.lookupFunction<
1742 : Pointer<Utf8> Function(Pointer<NativeType> sign),
1743 : Pointer<Utf8> Function(
1744 : Pointer<NativeType> sign)>('olm_pk_signing_last_error');
1745 :
1746 1 : int olm_clear_pk_signing(Pointer<NativeType> sign) {
1747 2 : int result = _olm_clear_pk_signing_unchecked(sign);
1748 3 : if (result == olm_error()) throw_olm(olm_pk_signing_last_error(sign));
1749 : return result;
1750 : }
1751 :
1752 3 : final _olm_clear_pk_signing_unchecked = libolm.lookupFunction<
1753 : IntPtr Function(Pointer<NativeType> sign),
1754 : int Function(Pointer<NativeType> sign)>('olm_clear_pk_signing');
1755 :
1756 1 : int olm_pk_signing_key_from_seed(
1757 : Pointer<NativeType> sign,
1758 : Pointer<Uint8> pubkey,
1759 : int pubkey_length,
1760 : Pointer<Uint8> seed,
1761 : int seed_length) {
1762 2 : int result = _olm_pk_signing_key_from_seed_unchecked(
1763 : sign, pubkey, pubkey_length, seed, seed_length);
1764 6 : if (result == olm_error()) throw_olm(olm_pk_signing_last_error(sign));
1765 : return result;
1766 : }
1767 :
1768 3 : final _olm_pk_signing_key_from_seed_unchecked = libolm.lookupFunction<
1769 : IntPtr Function(Pointer<NativeType> sign, Pointer<Uint8> pubkey,
1770 : IntPtr pubkey_length, Pointer<Uint8> seed, IntPtr seed_length),
1771 : int Function(
1772 : Pointer<NativeType> sign,
1773 : Pointer<Uint8> pubkey,
1774 : int pubkey_length,
1775 : Pointer<Uint8> seed,
1776 : int seed_length)>('olm_pk_signing_key_from_seed');
1777 :
1778 2 : final olm_pk_signing_seed_length =
1779 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1780 : 'olm_pk_signing_seed_length');
1781 :
1782 2 : final olm_pk_signing_public_key_length =
1783 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1784 : 'olm_pk_signing_public_key_length');
1785 :
1786 2 : final olm_pk_signature_length =
1787 1 : libolm.lookupFunction<IntPtr Function(), int Function()>(
1788 : 'olm_pk_signature_length');
1789 :
1790 1 : int olm_pk_sign(Pointer<NativeType> sign, Pointer<Uint8> message,
1791 : int message_length, Pointer<Uint8> signature, int signature_length) {
1792 2 : int result = _olm_pk_sign_unchecked(
1793 : sign, message, message_length, signature, signature_length);
1794 3 : if (result == olm_error()) throw_olm(olm_pk_signing_last_error(sign));
1795 : return result;
1796 : }
1797 :
1798 3 : final _olm_pk_sign_unchecked = libolm.lookupFunction<
1799 : IntPtr Function(
1800 : Pointer<NativeType> sign,
1801 : Pointer<Uint8> message,
1802 : IntPtr message_length,
1803 : Pointer<Uint8> signature,
1804 : IntPtr signature_length),
1805 : int Function(
1806 : Pointer<NativeType> sign,
1807 : Pointer<Uint8> message,
1808 : int message_length,
1809 : Pointer<Uint8> signature,
1810 : int signature_length)>('olm_pk_sign');
|