blitzar_sys/
bindings.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
/* automatically generated by rust-bindgen 0.69.4 */

pub const SXT_CPU_BACKEND: u32 = 1;
pub const SXT_GPU_BACKEND: u32 = 2;
pub const SXT_CURVE_RISTRETTO255: u32 = 0;
pub const SXT_CURVE_BLS_381: u32 = 1;
pub const SXT_CURVE_BN_254: u32 = 2;
pub const SXT_CURVE_GRUMPKIN: u32 = 2;
#[doc = " config struct to hold the chosen backend"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_config {
    pub backend: ::std::os::raw::c_int,
    pub num_precomputed_generators: u64,
}
#[test]
fn bindgen_test_layout_sxt_config() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_config> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_config>(),
        16usize,
        concat!("Size of: ", stringify!(sxt_config))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_config>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_config))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).backend) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_config),
            "::",
            stringify!(backend)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).num_precomputed_generators) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_config),
            "::",
            stringify!(num_precomputed_generators)
        )
    );
}
#[doc = " encodes an element of the `ristretto255` group"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_ristretto255_compressed {
    pub ristretto_bytes: [u8; 32usize],
}
#[test]
fn bindgen_test_layout_sxt_ristretto255_compressed() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_ristretto255_compressed> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_ristretto255_compressed>(),
        32usize,
        concat!("Size of: ", stringify!(sxt_ristretto255_compressed))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_ristretto255_compressed>(),
        1usize,
        concat!("Alignment of ", stringify!(sxt_ristretto255_compressed))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).ristretto_bytes) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_ristretto255_compressed),
            "::",
            stringify!(ristretto_bytes)
        )
    );
}
#[doc = " encodes an element of the `bls12-381` `G1` group in compressed form"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_bls12_381_g1_compressed {
    pub g1_bytes: [u8; 48usize],
}
#[test]
fn bindgen_test_layout_sxt_bls12_381_g1_compressed() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_bls12_381_g1_compressed> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_bls12_381_g1_compressed>(),
        48usize,
        concat!("Size of: ", stringify!(sxt_bls12_381_g1_compressed))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_bls12_381_g1_compressed>(),
        1usize,
        concat!("Alignment of ", stringify!(sxt_bls12_381_g1_compressed))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).g1_bytes) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bls12_381_g1_compressed),
            "::",
            stringify!(g1_bytes)
        )
    );
}
#[doc = " encodes an element of the finite field for `curve25519`\n\n modulo `(2^252 + 27742317777372353535851937790883648493)`"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_curve25519_scalar {
    pub bytes: [u8; 32usize],
}
#[test]
fn bindgen_test_layout_sxt_curve25519_scalar() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_curve25519_scalar> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_curve25519_scalar>(),
        32usize,
        concat!("Size of: ", stringify!(sxt_curve25519_scalar))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_curve25519_scalar>(),
        1usize,
        concat!("Alignment of ", stringify!(sxt_curve25519_scalar))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).bytes) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_curve25519_scalar),
            "::",
            stringify!(bytes)
        )
    );
}
#[doc = " encodes a strobe-based transcript"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_transcript {
    pub bytes: [u8; 203usize],
}
#[test]
fn bindgen_test_layout_sxt_transcript() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_transcript> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_transcript>(),
        203usize,
        concat!("Size of: ", stringify!(sxt_transcript))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_transcript>(),
        1usize,
        concat!("Alignment of ", stringify!(sxt_transcript))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).bytes) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_transcript),
            "::",
            stringify!(bytes)
        )
    );
}
#[doc = " encodes an element of the `curve25519` group"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_ristretto255 {
    pub X: [u64; 5usize],
    pub Y: [u64; 5usize],
    pub Z: [u64; 5usize],
    pub T: [u64; 5usize],
}
#[test]
fn bindgen_test_layout_sxt_ristretto255() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_ristretto255> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_ristretto255>(),
        160usize,
        concat!("Size of: ", stringify!(sxt_ristretto255))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_ristretto255>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_ristretto255))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_ristretto255),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        40usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_ristretto255),
            "::",
            stringify!(Y)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Z) as usize - ptr as usize },
        80usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_ristretto255),
            "::",
            stringify!(Z)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).T) as usize - ptr as usize },
        120usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_ristretto255),
            "::",
            stringify!(T)
        )
    );
}
#[doc = " encodes an affine element of the `bls12-381` `G1` group"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_bls12_381_g1 {
    pub X: [u64; 6usize],
    pub Y: [u64; 6usize],
}
#[test]
fn bindgen_test_layout_sxt_bls12_381_g1() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_bls12_381_g1> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_bls12_381_g1>(),
        96usize,
        concat!("Size of: ", stringify!(sxt_bls12_381_g1))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_bls12_381_g1>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_bls12_381_g1))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bls12_381_g1),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        48usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bls12_381_g1),
            "::",
            stringify!(Y)
        )
    );
}
#[doc = " encodes an affine element of the `bls12-381` `G1` group in projective form"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_bls12_381_g1_p2 {
    pub X: [u64; 6usize],
    pub Y: [u64; 6usize],
    pub Z: [u64; 6usize],
}
#[test]
fn bindgen_test_layout_sxt_bls12_381_g1_p2() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_bls12_381_g1_p2> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_bls12_381_g1_p2>(),
        144usize,
        concat!("Size of: ", stringify!(sxt_bls12_381_g1_p2))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_bls12_381_g1_p2>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_bls12_381_g1_p2))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bls12_381_g1_p2),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        48usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bls12_381_g1_p2),
            "::",
            stringify!(Y)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Z) as usize - ptr as usize },
        96usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bls12_381_g1_p2),
            "::",
            stringify!(Z)
        )
    );
}
#[doc = " encodes an affine element of the `bn254` `G1` group"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_bn254_g1 {
    pub X: [u64; 4usize],
    pub Y: [u64; 4usize],
    pub infinity: u8,
}
#[test]
fn bindgen_test_layout_sxt_bn254_g1() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_bn254_g1> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_bn254_g1>(),
        72usize,
        concat!("Size of: ", stringify!(sxt_bn254_g1))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_bn254_g1>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_bn254_g1))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bn254_g1),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bn254_g1),
            "::",
            stringify!(Y)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).infinity) as usize - ptr as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bn254_g1),
            "::",
            stringify!(infinity)
        )
    );
}
#[doc = " encodes an affine element of the `bn254` `G1` group in projective form"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_bn254_g1_p2 {
    pub X: [u64; 4usize],
    pub Y: [u64; 4usize],
    pub Z: [u64; 4usize],
}
#[test]
fn bindgen_test_layout_sxt_bn254_g1_p2() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_bn254_g1_p2> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_bn254_g1_p2>(),
        96usize,
        concat!("Size of: ", stringify!(sxt_bn254_g1_p2))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_bn254_g1_p2>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_bn254_g1_p2))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bn254_g1_p2),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bn254_g1_p2),
            "::",
            stringify!(Y)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Z) as usize - ptr as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_bn254_g1_p2),
            "::",
            stringify!(Z)
        )
    );
}
#[doc = " encodes an affine element of the `grumpkin` group"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_grumpkin {
    pub X: [u64; 4usize],
    pub Y: [u64; 4usize],
    pub infinity: u8,
}
#[test]
fn bindgen_test_layout_sxt_grumpkin() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_grumpkin> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_grumpkin>(),
        72usize,
        concat!("Size of: ", stringify!(sxt_grumpkin))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_grumpkin>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_grumpkin))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_grumpkin),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_grumpkin),
            "::",
            stringify!(Y)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).infinity) as usize - ptr as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_grumpkin),
            "::",
            stringify!(infinity)
        )
    );
}
#[doc = " encodes an affine element of the `grumpkin` group in projective form"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_grumpkin_p2 {
    pub X: [u64; 4usize],
    pub Y: [u64; 4usize],
    pub Z: [u64; 4usize],
}
#[test]
fn bindgen_test_layout_sxt_grumpkin_p2() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_grumpkin_p2> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_grumpkin_p2>(),
        96usize,
        concat!("Size of: ", stringify!(sxt_grumpkin_p2))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_grumpkin_p2>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_grumpkin_p2))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).X) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_grumpkin_p2),
            "::",
            stringify!(X)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Y) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_grumpkin_p2),
            "::",
            stringify!(Y)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).Z) as usize - ptr as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_grumpkin_p2),
            "::",
            stringify!(Z)
        )
    );
}
#[doc = " describes a sequence of values"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_sequence_descriptor {
    pub element_nbytes: u8,
    pub n: u64,
    pub data: *const u8,
    pub is_signed: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_sxt_sequence_descriptor() {
    const UNINIT: ::std::mem::MaybeUninit<sxt_sequence_descriptor> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<sxt_sequence_descriptor>(),
        32usize,
        concat!("Size of: ", stringify!(sxt_sequence_descriptor))
    );
    assert_eq!(
        ::std::mem::align_of::<sxt_sequence_descriptor>(),
        8usize,
        concat!("Alignment of ", stringify!(sxt_sequence_descriptor))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).element_nbytes) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_sequence_descriptor),
            "::",
            stringify!(element_nbytes)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_sequence_descriptor),
            "::",
            stringify!(n)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_sequence_descriptor),
            "::",
            stringify!(data)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).is_signed) as usize - ptr as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(sxt_sequence_descriptor),
            "::",
            stringify!(is_signed)
        )
    );
}
#[doc = " resources for multiexponentiations with pre-specified generators"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sxt_multiexp_handle {
    _unused: [u8; 0],
}
extern "C" {
    #[doc = " Initializes the library.\n\n This should only be called once.\n\n # Arguments:\n\n - config (in): specifies which backend should be used in the computations. Those\n   available are: `SXT_GPU_BACKEND`, and `SXT_CPU_BACKEND`.\n\n # Return:\n\n - `0` on success; otherwise a nonzero error code"]
    pub fn sxt_init(config: *const sxt_config) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Compute the Pedersen commitments for sequences of values that internally generates `curve25519`\n group elements.\n\n Denote an element of a sequence by `a_ij` where `i` represents the sequence index\n and `j` represents the element index. Let `*` represent the operator for the\n ristretto255 group. Then `res[i]` encodes the ristretto255 group value\n\n ```text\n     Prod_{j=1 to n_i} g_{offset_generators + j} ^ a_ij\n ```\n\n where `n_i` represents the number of elements in sequence `i` and `g_{offset_generators + j}`\n is a group element determined by a prespecified function\n\n ```text\n     g: uint64_t -> ristretto255\n ```\n\n # Arguments:\n\n - `commitments` (out): an array of length num_sequences where the computed commitments\n                     of each sequence must be written into\n\n - `num_sequences` (in): specifies the number of sequences\n - `descriptors` (in): an array of length `num_sequences` that specifies each sequence\n - `offset_generators` (in): specifies the offset used to fetch the generators\n\n # Abnormal program termination in case of:\n\n - backend not initialized or incorrectly initialized\n - `descriptors == nullptr`\n - `commitments == nullptr`\n - `descriptor[i].element_nbytes == 0`\n - `descriptor[i].element_nbytes > 32`\n - `descriptor[i].n > 0 && descriptor[i].data == nullptr`\n\n # Considerations:\n\n - `num_sequences == 0` will skip the computation"]
    pub fn sxt_curve25519_compute_pedersen_commitments(
        commitments: *mut sxt_ristretto255_compressed,
        num_sequences: u32,
        descriptors: *const sxt_sequence_descriptor,
        offset_generators: u64,
    );
}
extern "C" {
    #[doc = " Compute the Pedersen commitments for sequences of values using `curve25519` group elements.\n\n Denote an element of a sequence by `a_ij` where `i` represents the sequence index\n and `j` represents the element index. Let `*` represent the operator for the\n ristretto255 group. Then `res[i]` encodes the ristretto255 group value.\n\n ```text\n     Prod_{j=1 to n_i} g_j ^ a_ij\n ```\n\n where `n_i` represents the number of elements in sequence `i` and `g_j` is a group\n element determined by the `generators[j]` user value given as input.\n\n # Arguments:\n\n - `commitments` (out): an array of length num_sequences where the computed commitments\n                     of each sequence must be written into\n\n - `num_sequences` (in): specifies the number of sequences\n - `descriptors` (in): an array of length `num_sequences` that specifies each sequence\n - `generators` (in): an array of length `max_num_rows` equals the maximum between all `n_i`\n\n # Abnormal program termination in case of:\n\n - backend not initialized or incorrectly initialized\n - `descriptors == nullptr`\n - `commitments == nullptr`\n - `descriptor[i].element_nbytes == 0`\n - `descriptor[i].element_nbytes > 32`\n - `descriptor[i].n > 0 && descriptor[i].data == nullptr`\n\n # Considerations:\n\n - `num_sequences == 0` will skip the computation"]
    pub fn sxt_curve25519_compute_pedersen_commitments_with_generators(
        commitments: *mut sxt_ristretto255_compressed,
        num_sequences: u32,
        descriptors: *const sxt_sequence_descriptor,
        generators: *const sxt_ristretto255,
    );
}
extern "C" {
    #[doc = " Compute the Pedersen commitments for sequences of values using `bls12-381` `G1` group elements.\n\n Denote an element of a sequence by `a_ij` where `i` represents the sequence index\n and `j` represents the element index. Let `*` represent the operator for the\n `bls12-381` `G1` group. Then `res[i]` encodes the `bls12-381` `G1` group value\n\n ```text\n     Prod_{j=1 to n_i} g_j ^ a_ij\n ```\n\n where `n_i` represents the number of elements in sequence `i` and `g_j` is a group\n element determined by the `generators[j]` user value given as input\n\n # Arguments:\n\n - `commitments` (out): an array of length num_sequences where the computed commitments\n                     of each sequence must be written into\n\n - `num_sequences` (in): specifies the number of sequences\n - `descriptors` (in): an array of length `num_sequences` that specifies each sequence\n - `generators` (in): an array of length `max_num_rows` equals the maximum between all `n_i`\n\n # Abnormal program termination in case of:\n\n - backend not initialized or incorrectly initialized\n - `descriptors == nullptr`\n - `commitments == nullptr`\n - `descriptor[i].element_nbytes == 0`\n - `descriptor[i].element_nbytes > 32`\n - `descriptor[i].n > 0 && descriptor[i].data == nullptr`\n\n # Considerations:\n\n - `num_sequences == 0` will skip the computation"]
    pub fn sxt_bls12_381_g1_compute_pedersen_commitments_with_generators(
        commitments: *mut sxt_bls12_381_g1_compressed,
        num_sequences: u32,
        descriptors: *const sxt_sequence_descriptor,
        generators: *const sxt_bls12_381_g1,
    );
}
extern "C" {
    #[doc = " Compute the Pedersen commitments for sequences of values using `bn254` `G1` group elements.\n\n Denote an element of a sequence by `a_ij` where `i` represents the sequence index\n and `j` represents the element index. Let `*` represent the operator for the\n `bn254` `G1` group. Then `res[i]` encodes the `bn254` `G1` group value\n\n ```text\n     Prod_{j=1 to n_i} g_j ^ a_ij\n ```\n\n where `n_i` represents the number of elements in sequence `i` and `g_j` is a group\n element determined by the `generators[j]` user value given as input\n\n # Arguments:\n\n - `commitments` (out): an array of length num_sequences where the computed commitments\n                     of each sequence must be written into\n\n - `num_sequences` (in): specifies the number of sequences\n - `descriptors` (in): an array of length `num_sequences` that specifies each sequence\n - `generators` (in): an array of length `max_num_rows` equals the maximum between all `n_i`\n\n # Abnormal program termination in case of:\n\n - backend not initialized or incorrectly initialized\n - `descriptors == nullptr`\n - `commitments == nullptr`\n - `descriptor[i].element_nbytes == 0`\n - `descriptor[i].element_nbytes > 32`\n - `descriptor[i].n > 0 && descriptor[i].data == nullptr`\n\n # Considerations:\n\n - `num_sequences == 0` will skip the computation"]
    pub fn sxt_bn254_g1_uncompressed_compute_pedersen_commitments_with_generators(
        commitments: *mut sxt_bn254_g1,
        num_sequences: u32,
        descriptors: *const sxt_sequence_descriptor,
        generators: *const sxt_bn254_g1,
    );
}
extern "C" {
    #[doc = " Compute the Pedersen commitments for sequences of values using `grumpkin` group elements.\n\n Denote an element of a sequence by `a_ij` where `i` represents the sequence index\n and `j` represents the element index. Let `*` represent the operator for the\n `grumpkin` curve. Then `res[i]` encodes the `grumpkin` group value\n\n ```text\n     Prod_{j=1 to n_i} g_j ^ a_ij\n ```\n\n where `n_i` represents the number of elements in sequence `i` and `g_j` is a group\n element determined by the `generators[j]` user value given as input\n\n # Arguments:\n\n - `commitments` (out): an array of length num_sequences where the computed commitments\n                     of each sequence must be written into\n\n - `num_sequences` (in): specifies the number of sequences\n - `descriptors` (in): an array of length `num_sequences` that specifies each sequence\n - `generators` (in): an array of length `max_num_rows` equals the maximum between all `n_i`\n\n # Abnormal program termination in case of:\n\n - backend not initialized or incorrectly initialized\n - `descriptors == nullptr`\n - `commitments == nullptr`\n - `descriptor[i].element_nbytes == 0`\n - `descriptor[i].element_nbytes > 32`\n - `descriptor[i].n > 0 && descriptor[i].data == nullptr`\n\n # Considerations:\n\n - `num_sequences == 0` will skip the computation"]
    pub fn sxt_grumpkin_uncompressed_compute_pedersen_commitments_with_generators(
        commitments: *mut sxt_grumpkin,
        num_sequences: u32,
        descriptors: *const sxt_sequence_descriptor,
        generators: *const sxt_grumpkin,
    );
}
extern "C" {
    #[doc = " Gets the pre-specified random generated elements used for the Pedersen commitments in the\n `sxt_curve25519_compute_pedersen_commitments` function.\n\n ```text\n sxt_ristretto255_get_generators(generators, num_generators, offset_generators) →\n     generators[0] = generate_random_ristretto(0 + offset_generators)\n     generators[1] = generate_random_ristretto(1 + offset_generators)\n     generators[2] = generate_random_ristretto(2 + offset_generators)\n       ...\n     generators[num_generators - 1] = generate_random_ristretto(num_generators - 1 +\n offset_generators)\n ```\n # Arguments:\n\n - `generators` (out): `sxt_ristretto255` pointer where the results must be written into\n - `offset_generators` (in): the offset that shifts the first element computed from `0` to\n `offset_generators`\n - `num_generators` (in): the total number of random generated elements to be computed\n\n # Return:\n\n - `0` on success; otherwise a nonzero error code\n\n # Invalid input parameters, which generate error code:\n\n - `num_generators > 0 && generators == nullptr`\n\n # Considerations:\n\n - `num_generators == 0` will skip the computation"]
    pub fn sxt_ristretto255_get_generators(
        generators: *mut sxt_ristretto255,
        offset_generators: u64,
        num_generators: u64,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Gets the `n`-th Ristretto point.\n\n The `n`-th Ristretto point is defined as:\n\n ```text\n if n == 0:\n    one_commit[0] = ristretto_identity;\n else:\n    one_commit[0] = g[0] + g[1] + ... + g[n - 1];\n ```\n\n where\n\n ```text\n struct sxt_ristretto255 ristretto_identity = {\n    {0, 0, 0, 0, 0},\n    {1, 0, 0, 0, 0},\n    {1, 0, 0, 0, 0},\n    {0, 0, 0, 0, 0},\n };\n ```\n\n and `g[i]` is the `i`-th generator provided by `sxt_ristretto255_get_generators` function at\n offset `0`.\n\n # Return:\n\n - `0` on success; otherwise a nonzero error code\n\n # Invalid input parameters, which generate error code:\n\n - `one_commit == nullptr`"]
    pub fn sxt_curve25519_get_one_commit(
        one_commit: *mut sxt_ristretto255,
        n: u64,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Creates an inner product proof.\n\n The proof is created with respect to the base `G`, provided by\n `sxt_ristretto255_get_generators(G, generators_offset, 1ull << ceil(log2(n)))`.\n\n The `verifier` transcript is passed in as a parameter so that the\n challenges depend on the *entire* transcript (including parent\n protocols).\n\n Note that we don't have any restriction to the `n` value, other than\n it has to be non-zero.\n\n # Algorithm description\n\n Initially, we compute `G` and `Q = G[np]`, where `np = 1ull << ceil(log2(n))`\n and `G` is zero-indexed.\n\n The protocol consists of `k = ceil(lg_2(n))` rounds, indexed by `j = k - 1 , ... , 0`.\n\n In the `j`-th round, the prover computes:\n\n ```text\n a_lo = {a[0], a[1], ..., a[n / 2 - 1]}\n a_hi = {a[n/2], a[n/2 + 1], ..., a[n - 1]}\n b_lo = {b[0], b[1], ..., b[n / 2 - 1]}\n b_hi = {b[n/2], b[n/2 + 1], ..., b[n - 1]}\n G_lo = {G[0], G[1], ..., G[n / 2 - 1]}\n G_hi = {G[n/2], G[n/2 + 1], ..., G[n-1]}\n\n l_vector[j] = <a_lo, G_hi> + <a_lo, b_hi> * Q\n r_vector[j] = <a_hi, G_lo> + <a_hi, b_lo> * Q\n ```\n\n Note that if the `a` or `b` length is not a power of `2`,\n then `a` or `b` is padded with zeros until it has a power of `2`.\n `G` always has a power of `2` given how it is constructed.\n\n Then the prover sends `l_vector[j]` and `r_vector[j]` to the verifier,\n and the verifier responds with a\n challenge value `u[j] <- Z_p` (finite field of order p),\n which is non-interactively simulated by\n the input strobe-based transcript:\n\n ```text\n transcript.append(\"L\", l_vector[j]);\n transcript.append(\"R\", r_vector[j]);\n\n u[j] = transcript.challenge_value(\"x\");\n ```\n\n Then the prover uses `u[j]` to compute\n\n ```text\n a = a_lo * u[j] + (u[j]^-1) * a_hi;\n b = b_lo * (u[j]^-1) + u[j] * b_hi;\n ```\n\n Then, the prover and verifier both compute\n\n ```text\n G = G_lo * (u[j]^-1) + u[j] * G_hi\n\n n = n / 2;\n ```\n\n and use these vectors (all of length `2^j`) for the next round.\n\n After the last `(j = 0)` round, the prover sends `ap_value = a[0]` to the verifier.\n\n # Arguments:\n\n - `l_vector` (out): transcript point array with length `ceil(log2(n))`\n - `r_vector` (out): transcript point array with length `ceil(log2(n))`\n - `ap_value` (out): a single scalar\n - `transcript` (in/out): a single strobe-based transcript\n - `n` (in): non-zero length for the input arrays\n - `generators_offset` (in): offset used to fetch the bases\n - `a_vector` (in): array with length `n`\n - `b_vector` (in): array with length `n`\n\n # Abnormal program termination in case of:\n\n - `transcript`, `ap_value`, `b_vector`, or `a_vector` is `nullptr`\n - `n` is zero\n - `n` is non-zero, but `l_vector` or `r_vector` is `nullptr`"]
    pub fn sxt_curve25519_prove_inner_product(
        l_vector: *mut sxt_ristretto255_compressed,
        r_vector: *mut sxt_ristretto255_compressed,
        ap_value: *mut sxt_curve25519_scalar,
        transcript: *mut sxt_transcript,
        n: u64,
        generators_offset: u64,
        a_vector: *const sxt_curve25519_scalar,
        b_vector: *const sxt_curve25519_scalar,
    );
}
extern "C" {
    #[doc = " Verifies an inner product proof.\n\n The proof is verified with respect to the base G, provided by\n `sxt_ristretto255_get_generators(G, generators_offset, 1ull << ceil(log2(n)))`.\n\n Note that we don't have any restriction to the `n` value, other than\n it has to be non-zero.\n\n # Arguments:\n\n - `transcript` (in/out): a single strobe-based transcript\n - `n` (in): non-zero length for the input arrays\n - `generators_offset` (in): offset used to fetch the bases\n - `b_vector` (in): array with length `n`, the same one used by\n `sxt_curve25519_prove_inner_product`\n - `product` (in): a single scalar, represented by `<a, b>`,\n                 the inner product of the two vectors `a` and `b` used by\n `sxt_curve25519_prove_inner_product`\n - `a_commit` (in): a single ristretto point, represented by `<a, G>` (the inner product of the\n two vectors)\n - `l_vector` (in): transcript point array with length `ceil(log2(n))`, generated by\n `sxt_curve25519_prove_inner_product`\n - `r_vector` (in): transcript point array with length `ceil(log2(n))`, generated by\n `sxt_curve25519_prove_inner_product`\n - `ap_value` (in): a single scalar, generated by `sxt_curve25519_prove_inner_product`\n\n # Return:\n\n - `1` in case the proof can be verified; otherwise, return `0`\n\n # Abnormal program termination in case of:\n\n - `transcript`, `ap_value`, `product`, `a_commit`, or `b_vector` is `nullptr`\n - `n` is zero\n - `n` is non-zero, but `l_vector` or `r_vector` is `nullptr`"]
    pub fn sxt_curve25519_verify_inner_product(
        transcript: *mut sxt_transcript,
        n: u64,
        generators_offset: u64,
        b_vector: *const sxt_curve25519_scalar,
        product: *const sxt_curve25519_scalar,
        a_commit: *const sxt_ristretto255,
        l_vector: *const sxt_ristretto255_compressed,
        r_vector: *const sxt_ristretto255_compressed,
        ap_value: *const sxt_curve25519_scalar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Create a handle for computing multiexponentiations using a fixed sequence of generators.\n\n Note: `generators` must match the type indicated by `curve_id`\n\n curve_id                        generators type\n SXT_CURVE_RISTRETTO255          struct sxt_ristretto255*\n SXT_CURVE_BLS_381               struct sxt_bls12_381_g1_p2*\n SXT_CURVE_BN_254                struct sxt_bn254_g1_p2*\n SXT_CURVE_GRUMPKIN              struct sxt_grumpkin_p2*"]
    pub fn sxt_multiexp_handle_new(
        curve_id: ::std::os::raw::c_uint,
        generators: *const ::std::os::raw::c_void,
        n: ::std::os::raw::c_uint,
    ) -> *mut sxt_multiexp_handle;
}
extern "C" {
    #[doc = " Use a serialized file to create a handle for computing multiexponentiations using a fixed\n sequence of generators.\n\n Reading the handle from a file can be significantly faster than calling\n sxt_multiexp_handle_new."]
    pub fn sxt_multiexp_handle_new_from_file(
        curve_id: ::std::os::raw::c_uint,
        filename: *const ::std::os::raw::c_char,
    ) -> *mut sxt_multiexp_handle;
}
extern "C" {
    #[doc = " Write a multiexponentiation handle to file.\n\n Use this function in combination with sxt_multiexp_handle_new_from_file."]
    pub fn sxt_multiexp_handle_write_to_file(
        handle: *const sxt_multiexp_handle,
        filename: *const ::std::os::raw::c_char,
    );
}
extern "C" {
    #[doc = " Free resources for a multiexponentiation handle"]
    pub fn sxt_multiexp_handle_free(handle: *mut sxt_multiexp_handle);
}
extern "C" {
    #[doc = " Compute a multiexponentiation using a handle to pre-specified generators.\n\n On completion `res` contains an array of size `num_outputs` for the multiexponentiation\n of the given `scalars` array.\n\n `scalars` specifies a contiguous multi-dimension `num_outputs` by `n` array laid out in\n column-major order. An entry in the array specifies the `element_num_bytes` bytes of a\n particular scalar.\n\n For example, if `g_1, g_2, ..., g_n` are the generators associated with `handle` and\n\n ```text\n      s_11, s_12, ..., s_1n\n      s_21, s_22, ..., s_2n\n ```\n\n is the scalar array (laid out in memory as `s_11, s_21, s_12, s_22, ..., s_1n, s_2n`), then `res`\n will contain the two values\n\n ```text\n      res[0] = g1^s11 g2^s12 ... gn^s1n\n      res[1] = g1^s21 g2^s22 ... gn^s2n\n ```\n\n Note: `res` must match the generator type of the curve. See `sxt_multiexp_handle_new` for\n the types."]
    pub fn sxt_fixed_multiexponentiation(
        res: *mut ::std::os::raw::c_void,
        handle: *const sxt_multiexp_handle,
        element_num_bytes: ::std::os::raw::c_uint,
        num_outputs: ::std::os::raw::c_uint,
        n: ::std::os::raw::c_uint,
        scalars: *const u8,
    );
}
extern "C" {
    #[doc = " Compute a multiexponentiation of scalars in packed format using a handle to pre-specified\n generators.\n\n On completion `res` contains an array of size `num_outputs` for the multiexponentiation\n of the given `scalars` array.\n\n An entry output_bit_table[output_index] specifies the number of scalar bits used for\n output_index.\n\n Put\n     bit_sum = sum_{output_index} output_bit_table[output_index]\n and let num_bytes denote the smallest integer greater than or equal to bit_sum that is a\n multiple of 8.\n\n\n `scalars` specifies a contiguous multi-dimension `num_bytes` by `n` array laid out in\n a packed column-major order as specified by output_bit_table. A given row determines the scalar\n exponents for generator g_i with the output scalars packed contiguously and padded with zeros.\n\n Note: `res` must match the generator type of the curve. See `sxt_multiexp_handle_new` for\n the types."]
    pub fn sxt_fixed_packed_multiexponentiation(
        res: *mut ::std::os::raw::c_void,
        handle: *const sxt_multiexp_handle,
        output_bit_table: *const ::std::os::raw::c_uint,
        num_outputs: ::std::os::raw::c_uint,
        n: ::std::os::raw::c_uint,
        scalars: *const u8,
    );
}
extern "C" {
    #[doc = " Compute a varying lengthing multiexponentiation of scalars in packed format using a handle to\n pre-specified generators.\n\n On completion `res` contains an array of size `num_outputs` for the multiexponentiation\n of the given `scalars` array.\n\n An entry output_bit_table[output_index] specifies the number of scalar bits used for\n output_index and output_lengths[output_index] specifies the length used for output_index.\n\n Note: output_lengths must be sorted in ascending order\n\n Put\n     bit_sum = sum_{output_index} output_bit_table[output_index]\n and let num_bytes denote the smallest integer greater than or equal to bit_sum that is a\n multiple of 8.\n\n Let n denote the length of the longest output. Then `scalars` specifies a contiguous\n multi-dimension `num_bytes` by `n` array laid out in a packed column-major order as specified by\n output_bit_table. A given row determines the scalar exponents for generator g_i with the output\n scalars packed contiguously and padded with zeros.\n\n Note: `res` must match the generator type of the curve. See `sxt_multiexp_handle_new` for\n the types."]
    pub fn sxt_fixed_vlen_multiexponentiation(
        res: *mut ::std::os::raw::c_void,
        handle: *const sxt_multiexp_handle,
        output_bit_table: *const ::std::os::raw::c_uint,
        output_lengths: *const ::std::os::raw::c_uint,
        num_outputs: ::std::os::raw::c_uint,
        scalars: *const u8,
    );
}