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
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
// Copyright 2020 Johannes Hayeß
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
// See the License for the specific language governing permissions and
// limitations under the License.

//! This is an intermediate crate that exposes the C API of `libolm` to Rust. If you want to start building things with `libolm` from Rust, check out [`olm-rs`](https://crates.io/crates/olm-rs).
//!
//! ## Supported Platforms
//!
//! - Android
//! - Linux
//! - macOS
//! - Windows
//! - FreeBSD
//! - WebAssembly
//!
//! ## Building
//!
//! This library can either be built by statically or dynamically linking against `libolm`:
//!
//! ### Static
//!
//! This is the default and requires no further action. `libolm` is built locally and then linked against statically.
//!
//! #### Build dependencies
//!
//! - `libstdc++`/`libc++`
//! - cmake
//! - GNU make or a compatible variant (WebAssembly only)
//! - Emscripten (WebAssembly only)
//!
//! ### Dynamic
//!
//! For linking against `libolm` dynamically, first make sure that you have the library in your link path.
//! Then build this library with the `OLM_LINK_VARIANT` environment variable set to `dylib`.
//!
//! For example, building your project using `olm-sys` as a dependency would look like this:
//!
//! ```bash
//! $ OLM_LINK_VARIANT=dylib cargo build
//! ```
//!
//! ### Cross compiling for Android
//!
//! To enable cross compilation for Android set the environment variable
//! `ANDROID_NDK` to the location of your NDK installation, for example:
//!
//! ```bash
//! $ ANRDOID_NDK=/home/user/Android/Sdk/ndk/22.0.7026061/
//! ```
//!
//! The linker needs to be set to an target specific one as well, for example for
//! `aarch64-linux-android` set this into your cargo config:
//!
//! ```
//! [target.aarch64-linux-android]
//! ar = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/ar"
//! linker = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang"
//! ```
//!
//! After both of these are set, compilation should work as usual using cargo:
//!
//! ```bash
//! $ ANDROID_NDK=~/Android/Sdk/ndk/22.0.7026061 cargo build --target aarch64-linux-android
//! ```

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
/* automatically generated by rust-bindgen 0.57.0 */

pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC2X: u32 = 0;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 31;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
pub const _BITS_TYPES_H: u32 = 1;
pub const __TIMESIZE: u32 = 64;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub type wchar_t = ::std::os::raw::c_int;
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
    pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
    pub __bindgen_padding_0: u64,
    pub __clang_max_align_nonce2: u128,
}
#[test]
fn bindgen_test_layout_max_align_t() {
    assert_eq!(
        ::std::mem::size_of::<max_align_t>(),
        32usize,
        concat!("Size of: ", stringify!(max_align_t))
    );
    assert_eq!(
        ::std::mem::align_of::<max_align_t>(),
        16usize,
        concat!("Alignment of ", stringify!(max_align_t))
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce1 as *const _ as usize
        },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(max_align_t),
            "::",
            stringify!(__clang_max_align_nonce1)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce2 as *const _ as usize
        },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(max_align_t),
            "::",
            stringify!(__clang_max_align_nonce2)
        )
    );
}
pub type __u_char = ::std::os::raw::c_uchar;
pub type __u_short = ::std::os::raw::c_ushort;
pub type __u_int = ::std::os::raw::c_uint;
pub type __u_long = ::std::os::raw::c_ulong;
pub type __int8_t = ::std::os::raw::c_schar;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __int16_t = ::std::os::raw::c_short;
pub type __uint16_t = ::std::os::raw::c_ushort;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = ::std::os::raw::c_long;
pub type __u_quad_t = ::std::os::raw::c_ulong;
pub type __intmax_t = ::std::os::raw::c_long;
pub type __uintmax_t = ::std::os::raw::c_ulong;
pub type __dev_t = ::std::os::raw::c_ulong;
pub type __uid_t = ::std::os::raw::c_uint;
pub type __gid_t = ::std::os::raw::c_uint;
pub type __ino_t = ::std::os::raw::c_ulong;
pub type __ino64_t = ::std::os::raw::c_ulong;
pub type __mode_t = ::std::os::raw::c_uint;
pub type __nlink_t = ::std::os::raw::c_ulong;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
pub type __pid_t = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __fsid_t {
    pub __val: [::std::os::raw::c_int; 2usize],
}
#[test]
fn bindgen_test_layout___fsid_t() {
    assert_eq!(
        ::std::mem::size_of::<__fsid_t>(),
        8usize,
        concat!("Size of: ", stringify!(__fsid_t))
    );
    assert_eq!(
        ::std::mem::align_of::<__fsid_t>(),
        4usize,
        concat!("Alignment of ", stringify!(__fsid_t))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<__fsid_t>())).__val as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(__fsid_t),
            "::",
            stringify!(__val)
        )
    );
}
pub type __clock_t = ::std::os::raw::c_long;
pub type __rlim_t = ::std::os::raw::c_ulong;
pub type __rlim64_t = ::std::os::raw::c_ulong;
pub type __id_t = ::std::os::raw::c_uint;
pub type __time_t = ::std::os::raw::c_long;
pub type __useconds_t = ::std::os::raw::c_uint;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __daddr_t = ::std::os::raw::c_int;
pub type __key_t = ::std::os::raw::c_int;
pub type __clockid_t = ::std::os::raw::c_int;
pub type __timer_t = *mut ::std::os::raw::c_void;
pub type __blksize_t = ::std::os::raw::c_long;
pub type __blkcnt_t = ::std::os::raw::c_long;
pub type __blkcnt64_t = ::std::os::raw::c_long;
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
pub type __fsword_t = ::std::os::raw::c_long;
pub type __ssize_t = ::std::os::raw::c_long;
pub type __syscall_slong_t = ::std::os::raw::c_long;
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut ::std::os::raw::c_char;
pub type __intptr_t = ::std::os::raw::c_long;
pub type __socklen_t = ::std::os::raw::c_uint;
pub type __sig_atomic_t = ::std::os::raw::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = ::std::os::raw::c_schar;
pub type int_fast16_t = ::std::os::raw::c_long;
pub type int_fast32_t = ::std::os::raw::c_long;
pub type int_fast64_t = ::std::os::raw::c_long;
pub type uint_fast8_t = ::std::os::raw::c_uchar;
pub type uint_fast16_t = ::std::os::raw::c_ulong;
pub type uint_fast32_t = ::std::os::raw::c_ulong;
pub type uint_fast64_t = ::std::os::raw::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmInboundGroupSession {
    _unused: [u8; 0],
}
extern "C" {
    #[doc = " get the size of an inbound group session, in bytes."]
    pub fn olm_inbound_group_session_size() -> usize;
}
extern "C" {
    #[doc = " Initialise an inbound group session object using the supplied memory"]
    #[doc = " The supplied memory should be at least olm_inbound_group_session_size()"]
    #[doc = " bytes."]
    pub fn olm_inbound_group_session(
        memory: *mut ::std::os::raw::c_void,
    ) -> *mut OlmInboundGroupSession;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to a"]
    #[doc = " group session"]
    pub fn olm_inbound_group_session_last_error(
        session: *const OlmInboundGroupSession,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Clears the memory used to back this group session"]
    pub fn olm_clear_inbound_group_session(session: *mut OlmInboundGroupSession) -> usize;
}
extern "C" {
    #[doc = " Returns the number of bytes needed to store an inbound group session"]
    pub fn olm_pickle_inbound_group_session_length(session: *const OlmInboundGroupSession)
        -> usize;
}
extern "C" {
    #[doc = " Stores a group session as a base64 string. Encrypts the session using the"]
    #[doc = " supplied key. Returns the length of the session on success."]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure. If the pickle output buffer"]
    #[doc = " is smaller than olm_pickle_inbound_group_session_length() then"]
    #[doc = " olm_inbound_group_session_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\""]
    pub fn olm_pickle_inbound_group_session(
        session: *mut OlmInboundGroupSession,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Loads a group session from a pickled base64 string. Decrypts the session"]
    #[doc = " using the supplied key."]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure. If the key doesn't match the one used to"]
    #[doc = " encrypt the account then olm_inbound_group_session_last_error() will be"]
    #[doc = " \"BAD_ACCOUNT_KEY\". If the base64 couldn't be decoded then"]
    #[doc = " olm_inbound_group_session_last_error() will be \"INVALID_BASE64\". The input"]
    #[doc = " pickled buffer is destroyed"]
    pub fn olm_unpickle_inbound_group_session(
        session: *mut OlmInboundGroupSession,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Start a new inbound group session, from a key exported from"]
    #[doc = " olm_outbound_group_session_key"]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure. On failure last_error will be set with an"]
    #[doc = " error code. The last_error will be:"]
    #[doc = ""]
    #[doc = "  * OLM_INVALID_BASE64  if the session_key is not valid base64"]
    #[doc = "  * OLM_BAD_SESSION_KEY if the session_key is invalid"]
    pub fn olm_init_inbound_group_session(
        session: *mut OlmInboundGroupSession,
        session_key: *const u8,
        session_key_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Import an inbound group session, from a previous export."]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure. On failure last_error will be set with an"]
    #[doc = " error code. The last_error will be:"]
    #[doc = ""]
    #[doc = "  * OLM_INVALID_BASE64  if the session_key is not valid base64"]
    #[doc = "  * OLM_BAD_SESSION_KEY if the session_key is invalid"]
    pub fn olm_import_inbound_group_session(
        session: *mut OlmInboundGroupSession,
        session_key: *const u8,
        session_key_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get an upper bound on the number of bytes of plain-text the decrypt method"]
    #[doc = " will write for a given input message length. The actual size could be"]
    #[doc = " different due to padding."]
    #[doc = ""]
    #[doc = " The input message buffer is destroyed."]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure."]
    pub fn olm_group_decrypt_max_plaintext_length(
        session: *mut OlmInboundGroupSession,
        message: *mut u8,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Decrypt a message."]
    #[doc = ""]
    #[doc = " The input message buffer is destroyed."]
    #[doc = ""]
    #[doc = " Returns the length of the decrypted plain-text, or olm_error() on failure."]
    #[doc = ""]
    #[doc = " On failure last_error will be set with an error code. The last_error will"]
    #[doc = " be:"]
    #[doc = "   * OLM_OUTPUT_BUFFER_TOO_SMALL if the plain-text buffer is too small"]
    #[doc = "   * OLM_INVALID_BASE64 if the message is not valid base-64"]
    #[doc = "   * OLM_BAD_MESSAGE_VERSION if the message was encrypted with an unsupported"]
    #[doc = "     version of the protocol"]
    #[doc = "   * OLM_BAD_MESSAGE_FORMAT if the message headers could not be decoded"]
    #[doc = "   * OLM_BAD_MESSAGE_MAC    if the message could not be verified"]
    #[doc = "   * OLM_UNKNOWN_MESSAGE_INDEX  if we do not have a session key corresponding to the"]
    #[doc = "     message's index (ie, it was sent before the session key was shared with"]
    #[doc = "     us)"]
    pub fn olm_group_decrypt(
        session: *mut OlmInboundGroupSession,
        message: *mut u8,
        message_length: usize,
        plaintext: *mut u8,
        max_plaintext_length: usize,
        message_index: *mut u32,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the number of bytes returned by olm_inbound_group_session_id()"]
    pub fn olm_inbound_group_session_id_length(session: *const OlmInboundGroupSession) -> usize;
}
extern "C" {
    #[doc = " Get a base64-encoded identifier for this session."]
    #[doc = ""]
    #[doc = " Returns the length of the session id on success or olm_error() on"]
    #[doc = " failure. On failure last_error will be set with an error code. The"]
    #[doc = " last_error will be OUTPUT_BUFFER_TOO_SMALL if the id buffer was too"]
    #[doc = " small."]
    pub fn olm_inbound_group_session_id(
        session: *mut OlmInboundGroupSession,
        id: *mut u8,
        id_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the first message index we know how to decrypt."]
    pub fn olm_inbound_group_session_first_known_index(
        session: *const OlmInboundGroupSession,
    ) -> u32;
}
extern "C" {
    #[doc = " Check if the session has been verified as a valid session."]
    #[doc = ""]
    #[doc = " (A session is verified either because the original session share was signed,"]
    #[doc = " or because we have subsequently successfully decrypted a message.)"]
    #[doc = ""]
    #[doc = " This is mainly intended for the unit tests, currently."]
    pub fn olm_inbound_group_session_is_verified(
        session: *const OlmInboundGroupSession,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Get the number of bytes returned by olm_export_inbound_group_session()"]
    pub fn olm_export_inbound_group_session_length(session: *const OlmInboundGroupSession)
        -> usize;
}
extern "C" {
    #[doc = " Export the base64-encoded ratchet key for this session, at the given index,"]
    #[doc = " in a format which can be used by olm_import_inbound_group_session"]
    #[doc = ""]
    #[doc = " Returns the length of the ratchet key on success or olm_error() on"]
    #[doc = " failure. On failure last_error will be set with an error code. The"]
    #[doc = " last_error will be:"]
    #[doc = "   * OUTPUT_BUFFER_TOO_SMALL if the buffer was too small"]
    #[doc = "   * OLM_UNKNOWN_MESSAGE_INDEX  if we do not have a session key corresponding to the"]
    #[doc = "     given index (ie, it was sent before the session key was shared with"]
    #[doc = "     us)"]
    pub fn olm_export_inbound_group_session(
        session: *mut OlmInboundGroupSession,
        key: *mut u8,
        key_length: usize,
        message_index: u32,
    ) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmOutboundGroupSession {
    _unused: [u8; 0],
}
extern "C" {
    #[doc = " get the size of an outbound group session, in bytes."]
    pub fn olm_outbound_group_session_size() -> usize;
}
extern "C" {
    #[doc = " Initialise an outbound group session object using the supplied memory"]
    #[doc = " The supplied memory should be at least olm_outbound_group_session_size()"]
    #[doc = " bytes."]
    pub fn olm_outbound_group_session(
        memory: *mut ::std::os::raw::c_void,
    ) -> *mut OlmOutboundGroupSession;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to a"]
    #[doc = " group session"]
    pub fn olm_outbound_group_session_last_error(
        session: *const OlmOutboundGroupSession,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Clears the memory used to back this group session"]
    pub fn olm_clear_outbound_group_session(session: *mut OlmOutboundGroupSession) -> usize;
}
extern "C" {
    #[doc = " Returns the number of bytes needed to store an outbound group session"]
    pub fn olm_pickle_outbound_group_session_length(
        session: *const OlmOutboundGroupSession,
    ) -> usize;
}
extern "C" {
    #[doc = " Stores a group session as a base64 string. Encrypts the session using the"]
    #[doc = " supplied key. Returns the length of the session on success."]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure. If the pickle output buffer"]
    #[doc = " is smaller than olm_pickle_outbound_group_session_length() then"]
    #[doc = " olm_outbound_group_session_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\""]
    pub fn olm_pickle_outbound_group_session(
        session: *mut OlmOutboundGroupSession,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Loads a group session from a pickled base64 string. Decrypts the session"]
    #[doc = " using the supplied key."]
    #[doc = ""]
    #[doc = " Returns olm_error() on failure. If the key doesn't match the one used to"]
    #[doc = " encrypt the account then olm_outbound_group_session_last_error() will be"]
    #[doc = " \"BAD_ACCOUNT_KEY\". If the base64 couldn't be decoded then"]
    #[doc = " olm_outbound_group_session_last_error() will be \"INVALID_BASE64\". The input"]
    #[doc = " pickled buffer is destroyed"]
    pub fn olm_unpickle_outbound_group_session(
        session: *mut OlmOutboundGroupSession,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to create an outbound group session"]
    pub fn olm_init_outbound_group_session_random_length(
        session: *const OlmOutboundGroupSession,
    ) -> usize;
}
extern "C" {
    #[doc = " Start a new outbound group session. Returns olm_error() on failure. On"]
    #[doc = " failure last_error will be set with an error code. The last_error will be"]
    #[doc = " NOT_ENOUGH_RANDOM if the number of random bytes was too small."]
    pub fn olm_init_outbound_group_session(
        session: *mut OlmOutboundGroupSession,
        random: *mut u8,
        random_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The number of bytes that will be created by encrypting a message"]
    pub fn olm_group_encrypt_message_length(
        session: *mut OlmOutboundGroupSession,
        plaintext_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Encrypt some plain-text. Returns the length of the encrypted message or"]
    #[doc = " olm_error() on failure. On failure last_error will be set with an"]
    #[doc = " error code. The last_error will be OUTPUT_BUFFER_TOO_SMALL if the output"]
    #[doc = " buffer is too small."]
    pub fn olm_group_encrypt(
        session: *mut OlmOutboundGroupSession,
        plaintext: *const u8,
        plaintext_length: usize,
        message: *mut u8,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the number of bytes returned by olm_outbound_group_session_id()"]
    pub fn olm_outbound_group_session_id_length(session: *const OlmOutboundGroupSession) -> usize;
}
extern "C" {
    #[doc = " Get a base64-encoded identifier for this session."]
    #[doc = ""]
    #[doc = " Returns the length of the session id on success or olm_error() on"]
    #[doc = " failure. On failure last_error will be set with an error code. The"]
    #[doc = " last_error will be OUTPUT_BUFFER_TOO_SMALL if the id buffer was too"]
    #[doc = " small."]
    pub fn olm_outbound_group_session_id(
        session: *mut OlmOutboundGroupSession,
        id: *mut u8,
        id_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the current message index for this session."]
    #[doc = ""]
    #[doc = " Each message is sent with an increasing index; this returns the index for"]
    #[doc = " the next message."]
    pub fn olm_outbound_group_session_message_index(session: *mut OlmOutboundGroupSession) -> u32;
}
extern "C" {
    #[doc = " Get the number of bytes returned by olm_outbound_group_session_key()"]
    pub fn olm_outbound_group_session_key_length(session: *const OlmOutboundGroupSession) -> usize;
}
extern "C" {
    #[doc = " Get the base64-encoded current ratchet key for this session."]
    #[doc = ""]
    #[doc = " Each message is sent with a different ratchet key. This function returns the"]
    #[doc = " ratchet key that will be used for the next message."]
    #[doc = ""]
    #[doc = " Returns the length of the ratchet key on success or olm_error() on"]
    #[doc = " failure. On failure last_error will be set with an error code. The"]
    #[doc = " last_error will be OUTPUT_BUFFER_TOO_SMALL if the buffer was too small."]
    pub fn olm_outbound_group_session_key(
        session: *mut OlmOutboundGroupSession,
        key: *mut u8,
        key_length: usize,
    ) -> usize;
}
pub const OLM_MESSAGE_TYPE_PRE_KEY: usize = 0;
pub const OLM_MESSAGE_TYPE_MESSAGE: usize = 1;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmAccount {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmSession {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmUtility {
    _unused: [u8; 0],
}
extern "C" {
    #[doc = " Get the version number of the library."]
    #[doc = " Arguments will be updated if non-null."]
    pub fn olm_get_library_version(major: *mut u8, minor: *mut u8, patch: *mut u8);
}
extern "C" {
    #[doc = " The size of an account object in bytes"]
    pub fn olm_account_size() -> usize;
}
extern "C" {
    #[doc = " The size of a session object in bytes"]
    pub fn olm_session_size() -> usize;
}
extern "C" {
    #[doc = " The size of a utility object in bytes"]
    pub fn olm_utility_size() -> usize;
}
extern "C" {
    #[doc = " Initialise an account object using the supplied memory"]
    #[doc = "  The supplied memory must be at least olm_account_size() bytes"]
    pub fn olm_account(memory: *mut ::std::os::raw::c_void) -> *mut OlmAccount;
}
extern "C" {
    #[doc = " Initialise a session object using the supplied memory"]
    #[doc = "  The supplied memory must be at least olm_session_size() bytes"]
    pub fn olm_session(memory: *mut ::std::os::raw::c_void) -> *mut OlmSession;
}
extern "C" {
    #[doc = " Initialise a utility object using the supplied memory"]
    #[doc = "  The supplied memory must be at least olm_utility_size() bytes"]
    pub fn olm_utility(memory: *mut ::std::os::raw::c_void) -> *mut OlmUtility;
}
extern "C" {
    #[doc = " The value that olm will return from a function if there was an error"]
    pub fn olm_error() -> usize;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to an"]
    #[doc = " account"]
    pub fn olm_account_last_error(account: *mut OlmAccount) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to a"]
    #[doc = " session"]
    pub fn olm_session_last_error(session: *mut OlmSession) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to a"]
    #[doc = " utility"]
    pub fn olm_utility_last_error(utility: *mut OlmUtility) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Clears the memory used to back this account"]
    pub fn olm_clear_account(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Clears the memory used to back this session"]
    pub fn olm_clear_session(session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " Clears the memory used to back this utility"]
    pub fn olm_clear_utility(utility: *mut OlmUtility) -> usize;
}
extern "C" {
    #[doc = " Returns the number of bytes needed to store an account"]
    pub fn olm_pickle_account_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Returns the number of bytes needed to store a session"]
    pub fn olm_pickle_session_length(session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " Stores an account as a base64 string. Encrypts the account using the"]
    #[doc = " supplied key. Returns the length of the pickled account on success."]
    #[doc = " Returns olm_error() on failure. If the pickle output buffer"]
    #[doc = " is smaller than olm_pickle_account_length() then"]
    #[doc = " olm_account_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\""]
    pub fn olm_pickle_account(
        account: *mut OlmAccount,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Stores a session as a base64 string. Encrypts the session using the"]
    #[doc = " supplied key. Returns the length of the pickled session on success."]
    #[doc = " Returns olm_error() on failure. If the pickle output buffer"]
    #[doc = " is smaller than olm_pickle_session_length() then"]
    #[doc = " olm_session_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\""]
    pub fn olm_pickle_session(
        session: *mut OlmSession,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Loads an account from a pickled base64 string. Decrypts the account using"]
    #[doc = " the supplied key. Returns olm_error() on failure. If the key doesn't"]
    #[doc = " match the one used to encrypt the account then olm_account_last_error()"]
    #[doc = " will be \"BAD_ACCOUNT_KEY\". If the base64 couldn't be decoded then"]
    #[doc = " olm_account_last_error() will be \"INVALID_BASE64\". The input pickled"]
    #[doc = " buffer is destroyed"]
    pub fn olm_unpickle_account(
        account: *mut OlmAccount,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Loads a session from a pickled base64 string. Decrypts the session using"]
    #[doc = " the supplied key. Returns olm_error() on failure. If the key doesn't"]
    #[doc = " match the one used to encrypt the account then olm_session_last_error()"]
    #[doc = " will be \"BAD_ACCOUNT_KEY\". If the base64 couldn't be decoded then"]
    #[doc = " olm_session_last_error() will be \"INVALID_BASE64\". The input pickled"]
    #[doc = " buffer is destroyed"]
    pub fn olm_unpickle_session(
        session: *mut OlmSession,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to create an account."]
    pub fn olm_create_account_random_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Creates a new account. Returns olm_error() on failure. If there weren't"]
    #[doc = " enough random bytes then olm_account_last_error() will be"]
    #[doc = " \"NOT_ENOUGH_RANDOM\""]
    pub fn olm_create_account(
        account: *mut OlmAccount,
        random: *mut ::std::os::raw::c_void,
        random_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The size of the output buffer needed to hold the identity keys"]
    pub fn olm_account_identity_keys_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Writes the public parts of the identity keys for the account into the"]
    #[doc = " identity_keys output buffer. Returns olm_error() on failure. If the"]
    #[doc = " identity_keys buffer was too small then olm_account_last_error() will be"]
    #[doc = " \"OUTPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_account_identity_keys(
        account: *mut OlmAccount,
        identity_keys: *mut ::std::os::raw::c_void,
        identity_key_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The length of an ed25519 signature encoded as base64."]
    pub fn olm_account_signature_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Signs a message with the ed25519 key for this account. Returns olm_error()"]
    #[doc = " on failure. If the signature buffer was too small then"]
    #[doc = " olm_account_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\""]
    pub fn olm_account_sign(
        account: *mut OlmAccount,
        message: *const ::std::os::raw::c_void,
        message_length: usize,
        signature: *mut ::std::os::raw::c_void,
        signature_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The size of the output buffer needed to hold the one time keys"]
    pub fn olm_account_one_time_keys_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Writes the public parts of the unpublished one time keys for the account"]
    #[doc = " into the one_time_keys output buffer."]
    #[doc = " <p>"]
    #[doc = " The returned data is a JSON-formatted object with the single property"]
    #[doc = " <tt>curve25519</tt>, which is itself an object mapping key id to"]
    #[doc = " base64-encoded Curve25519 key. For example:"]
    #[doc = " <pre>"]
    #[doc = " {"]
    #[doc = "     curve25519: {"]
    #[doc = "         \"AAAAAA\": \"wo76WcYtb0Vk/pBOdmduiGJ0wIEjW4IBMbbQn7aSnTo\","]
    #[doc = "         \"AAAAAB\": \"LRvjo46L1X2vx69sS9QNFD29HWulxrmW11Up5AfAjgU\""]
    #[doc = "     }"]
    #[doc = " }"]
    #[doc = " </pre>"]
    #[doc = " Returns olm_error() on failure."]
    #[doc = " <p>"]
    #[doc = " If the one_time_keys buffer was too small then olm_account_last_error()"]
    #[doc = " will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_account_one_time_keys(
        account: *mut OlmAccount,
        one_time_keys: *mut ::std::os::raw::c_void,
        one_time_keys_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Marks the current set of one time keys as being published."]
    pub fn olm_account_mark_keys_as_published(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " The largest number of one time keys this account can store."]
    pub fn olm_account_max_number_of_one_time_keys(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to generate a given number of new one"]
    #[doc = " time keys."]
    pub fn olm_account_generate_one_time_keys_random_length(
        account: *mut OlmAccount,
        number_of_keys: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Generates a number of new one time keys. If the total number of keys stored"]
    #[doc = " by this account exceeds max_number_of_one_time_keys() then the old keys are"]
    #[doc = " discarded. Returns olm_error() on error. If the number of random bytes is"]
    #[doc = " too small then olm_account_last_error() will be \"NOT_ENOUGH_RANDOM\"."]
    pub fn olm_account_generate_one_time_keys(
        account: *mut OlmAccount,
        number_of_keys: usize,
        random: *mut ::std::os::raw::c_void,
        random_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to generate a fallback key."]
    pub fn olm_account_generate_fallback_key_random_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    #[doc = " Generates a new fallback key. Only one previous fallback key is"]
    #[doc = " stored. Returns olm_error() on error. If the number of random bytes is too"]
    #[doc = " small then olm_account_last_error() will be \"NOT_ENOUGH_RANDOM\"."]
    pub fn olm_account_generate_fallback_key(
        account: *mut OlmAccount,
        random: *mut ::std::os::raw::c_void,
        random_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The number of bytes needed to hold the fallback key as returned by"]
    #[doc = " olm_account_fallback_key."]
    pub fn olm_account_fallback_key_length(account: *mut OlmAccount) -> usize;
}
extern "C" {
    pub fn olm_account_fallback_key(
        account: *mut OlmAccount,
        fallback_key: *mut ::std::os::raw::c_void,
        fallback_key_size: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to create an outbound session"]
    pub fn olm_create_outbound_session_random_length(session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " Creates a new out-bound session for sending messages to a given identity_key"]
    #[doc = " and one_time_key. Returns olm_error() on failure. If the keys couldn't be"]
    #[doc = " decoded as base64 then olm_session_last_error() will be \"INVALID_BASE64\""]
    #[doc = " If there weren't enough random bytes then olm_session_last_error() will"]
    #[doc = " be \"NOT_ENOUGH_RANDOM\"."]
    pub fn olm_create_outbound_session(
        session: *mut OlmSession,
        account: *mut OlmAccount,
        their_identity_key: *const ::std::os::raw::c_void,
        their_identity_key_length: usize,
        their_one_time_key: *const ::std::os::raw::c_void,
        their_one_time_key_length: usize,
        random: *mut ::std::os::raw::c_void,
        random_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Create a new in-bound session for sending/receiving messages from an"]
    #[doc = " incoming PRE_KEY message. Returns olm_error() on failure. If the base64"]
    #[doc = " couldn't be decoded then olm_session_last_error will be \"INVALID_BASE64\"."]
    #[doc = " If the message was for an unsupported protocol version then"]
    #[doc = " olm_session_last_error() will be \"BAD_MESSAGE_VERSION\". If the message"]
    #[doc = " couldn't be decoded then then olm_session_last_error() will be"]
    #[doc = " \"BAD_MESSAGE_FORMAT\". If the message refers to an unknown one time"]
    #[doc = " key then olm_session_last_error() will be \"BAD_MESSAGE_KEY_ID\"."]
    pub fn olm_create_inbound_session(
        session: *mut OlmSession,
        account: *mut OlmAccount,
        one_time_key_message: *mut ::std::os::raw::c_void,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Create a new in-bound session for sending/receiving messages from an"]
    #[doc = " incoming PRE_KEY message. Returns olm_error() on failure. If the base64"]
    #[doc = " couldn't be decoded then olm_session_last_error will be \"INVALID_BASE64\"."]
    #[doc = " If the message was for an unsupported protocol version then"]
    #[doc = " olm_session_last_error() will be \"BAD_MESSAGE_VERSION\". If the message"]
    #[doc = " couldn't be decoded then then olm_session_last_error() will be"]
    #[doc = " \"BAD_MESSAGE_FORMAT\". If the message refers to an unknown one time"]
    #[doc = " key then olm_session_last_error() will be \"BAD_MESSAGE_KEY_ID\"."]
    pub fn olm_create_inbound_session_from(
        session: *mut OlmSession,
        account: *mut OlmAccount,
        their_identity_key: *const ::std::os::raw::c_void,
        their_identity_key_length: usize,
        one_time_key_message: *mut ::std::os::raw::c_void,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The length of the buffer needed to return the id for this session."]
    pub fn olm_session_id_length(session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " An identifier for this session. Will be the same for both ends of the"]
    #[doc = " conversation. If the id buffer is too small then olm_session_last_error()"]
    #[doc = " will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_session_id(
        session: *mut OlmSession,
        id: *mut ::std::os::raw::c_void,
        id_length: usize,
    ) -> usize;
}
extern "C" {
    pub fn olm_session_has_received_message(session: *mut OlmSession) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Write a null-terminated string describing the internal state of an olm"]
    #[doc = " session to the buffer provided for debugging and logging purposes."]
    pub fn olm_session_describe(
        session: *mut OlmSession,
        buf: *mut ::std::os::raw::c_char,
        buflen: usize,
    );
}
extern "C" {
    #[doc = " Checks if the PRE_KEY message is for this in-bound session. This can happen"]
    #[doc = " if multiple messages are sent to this account before this account sends a"]
    #[doc = " message in reply. The one_time_key_message buffer is destroyed. Returns 1 if"]
    #[doc = " the session matches. Returns 0 if the session does not match. Returns"]
    #[doc = " olm_error() on failure. If the base64 couldn't be decoded then"]
    #[doc = " olm_session_last_error will be \"INVALID_BASE64\".  If the message was for an"]
    #[doc = " unsupported protocol version then olm_session_last_error() will be"]
    #[doc = " \"BAD_MESSAGE_VERSION\". If the message couldn't be decoded then then"]
    #[doc = " olm_session_last_error() will be \"BAD_MESSAGE_FORMAT\"."]
    pub fn olm_matches_inbound_session(
        session: *mut OlmSession,
        one_time_key_message: *mut ::std::os::raw::c_void,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Checks if the PRE_KEY message is for this in-bound session. This can happen"]
    #[doc = " if multiple messages are sent to this account before this account sends a"]
    #[doc = " message in reply. The one_time_key_message buffer is destroyed. Returns 1 if"]
    #[doc = " the session matches. Returns 0 if the session does not match. Returns"]
    #[doc = " olm_error() on failure. If the base64 couldn't be decoded then"]
    #[doc = " olm_session_last_error will be \"INVALID_BASE64\".  If the message was for an"]
    #[doc = " unsupported protocol version then olm_session_last_error() will be"]
    #[doc = " \"BAD_MESSAGE_VERSION\". If the message couldn't be decoded then then"]
    #[doc = " olm_session_last_error() will be \"BAD_MESSAGE_FORMAT\"."]
    pub fn olm_matches_inbound_session_from(
        session: *mut OlmSession,
        their_identity_key: *const ::std::os::raw::c_void,
        their_identity_key_length: usize,
        one_time_key_message: *mut ::std::os::raw::c_void,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Removes the one time keys that the session used from the account. Returns"]
    #[doc = " olm_error() on failure. If the account doesn't have any matching one time"]
    #[doc = " keys then olm_account_last_error() will be \"BAD_MESSAGE_KEY_ID\"."]
    pub fn olm_remove_one_time_keys(account: *mut OlmAccount, session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " The type of the next message that olm_encrypt() will return. Returns"]
    #[doc = " OLM_MESSAGE_TYPE_PRE_KEY if the message will be a PRE_KEY message."]
    #[doc = " Returns OLM_MESSAGE_TYPE_MESSAGE if the message will be a normal message."]
    #[doc = " Returns olm_error on failure."]
    pub fn olm_encrypt_message_type(session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to encrypt the next message."]
    pub fn olm_encrypt_random_length(session: *mut OlmSession) -> usize;
}
extern "C" {
    #[doc = " The size of the next message in bytes for the given number of plain-text"]
    #[doc = " bytes."]
    pub fn olm_encrypt_message_length(session: *mut OlmSession, plaintext_length: usize) -> usize;
}
extern "C" {
    #[doc = " Encrypts a message using the session. Returns the length of the message in"]
    #[doc = " bytes on success. Writes the message as base64 into the message buffer."]
    #[doc = " Returns olm_error() on failure. If the message buffer is too small then"]
    #[doc = " olm_session_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\". If there"]
    #[doc = " weren't enough random bytes then olm_session_last_error() will be"]
    #[doc = " \"NOT_ENOUGH_RANDOM\"."]
    pub fn olm_encrypt(
        session: *mut OlmSession,
        plaintext: *const ::std::os::raw::c_void,
        plaintext_length: usize,
        random: *mut ::std::os::raw::c_void,
        random_length: usize,
        message: *mut ::std::os::raw::c_void,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The maximum number of bytes of plain-text a given message could decode to."]
    #[doc = " The actual size could be different due to padding. The input message buffer"]
    #[doc = " is destroyed. Returns olm_error() on failure. If the message base64"]
    #[doc = " couldn't be decoded then olm_session_last_error() will be"]
    #[doc = " \"INVALID_BASE64\". If the message is for an unsupported version of the"]
    #[doc = " protocol then olm_session_last_error() will be \"BAD_MESSAGE_VERSION\"."]
    #[doc = " If the message couldn't be decoded then olm_session_last_error() will be"]
    #[doc = " \"BAD_MESSAGE_FORMAT\"."]
    pub fn olm_decrypt_max_plaintext_length(
        session: *mut OlmSession,
        message_type: usize,
        message: *mut ::std::os::raw::c_void,
        message_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Decrypts a message using the session. The input message buffer is destroyed."]
    #[doc = " Returns the length of the plain-text on success. Returns olm_error() on"]
    #[doc = " failure. If the plain-text buffer is smaller than"]
    #[doc = " olm_decrypt_max_plaintext_length() then olm_session_last_error()"]
    #[doc = " will be \"OUTPUT_BUFFER_TOO_SMALL\". If the base64 couldn't be decoded then"]
    #[doc = " olm_session_last_error() will be \"INVALID_BASE64\". If the message is for"]
    #[doc = " an unsupported version of the protocol then olm_session_last_error() will"]
    #[doc = " be \"BAD_MESSAGE_VERSION\". If the message couldn't be decoded then"]
    #[doc = " olm_session_last_error() will be BAD_MESSAGE_FORMAT\"."]
    #[doc = " If the MAC on the message was invalid then olm_session_last_error() will"]
    #[doc = " be \"BAD_MESSAGE_MAC\"."]
    pub fn olm_decrypt(
        session: *mut OlmSession,
        message_type: usize,
        message: *mut ::std::os::raw::c_void,
        message_length: usize,
        plaintext: *mut ::std::os::raw::c_void,
        max_plaintext_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The length of the buffer needed to hold the SHA-256 hash."]
    pub fn olm_sha256_length(utility: *mut OlmUtility) -> usize;
}
extern "C" {
    #[doc = " Calculates the SHA-256 hash of the input and encodes it as base64. If the"]
    #[doc = " output buffer is smaller than olm_sha256_length() then"]
    #[doc = " olm_utility_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_sha256(
        utility: *mut OlmUtility,
        input: *const ::std::os::raw::c_void,
        input_length: usize,
        output: *mut ::std::os::raw::c_void,
        output_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Verify an ed25519 signature. If the key was too small then"]
    #[doc = " olm_utility_last_error() will be \"INVALID_BASE64\". If the signature was invalid"]
    #[doc = " then olm_utility_last_error() will be \"BAD_MESSAGE_MAC\"."]
    pub fn olm_ed25519_verify(
        utility: *mut OlmUtility,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        message: *const ::std::os::raw::c_void,
        message_length: usize,
        signature: *mut ::std::os::raw::c_void,
        signature_length: usize,
    ) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmSAS {
    _unused: [u8; 0],
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to an"]
    #[doc = " SAS object."]
    pub fn olm_sas_last_error(sas: *mut OlmSAS) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " The size of an SAS object in bytes."]
    pub fn olm_sas_size() -> usize;
}
extern "C" {
    #[doc = " Initialize an SAS object using the supplied memory."]
    #[doc = " The supplied memory must be at least `olm_sas_size()` bytes."]
    pub fn olm_sas(memory: *mut ::std::os::raw::c_void) -> *mut OlmSAS;
}
extern "C" {
    #[doc = " Clears the memory used to back an SAS object."]
    pub fn olm_clear_sas(sas: *mut OlmSAS) -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to create an SAS object."]
    pub fn olm_create_sas_random_length(sas: *mut OlmSAS) -> usize;
}
extern "C" {
    #[doc = " Creates a new SAS object."]
    #[doc = ""]
    #[doc = " @param[in] sas the SAS object to create, initialized by `olm_sas()`."]
    #[doc = " @param[in] random array of random bytes.  The contents of the buffer may be"]
    #[doc = "     overwritten."]
    #[doc = " @param[in] random_length the number of random bytes provided.  Must be at"]
    #[doc = "    least `olm_create_sas_random_length()`."]
    #[doc = ""]
    #[doc = " @return `olm_error()` on failure.  If there weren't enough random bytes then"]
    #[doc = " `olm_sas_last_error()` will be `NOT_ENOUGH_RANDOM`."]
    pub fn olm_create_sas(
        sas: *mut OlmSAS,
        random: *mut ::std::os::raw::c_void,
        random_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The size of a public key in bytes."]
    pub fn olm_sas_pubkey_length(sas: *mut OlmSAS) -> usize;
}
extern "C" {
    #[doc = " Get the public key for the SAS object."]
    #[doc = ""]
    #[doc = " @param[in] sas the SAS object."]
    #[doc = " @param[out] pubkey buffer to store the public key."]
    #[doc = " @param[in] pubkey_length the size of the `pubkey` buffer.  Must be at least"]
    #[doc = "   `olm_sas_pubkey_length()`."]
    #[doc = ""]
    #[doc = " @return `olm_error()` on failure.  If the `pubkey` buffer is too small, then"]
    #[doc = " `olm_sas_last_error()` will be `OUTPUT_BUFFER_TOO_SMALL`."]
    pub fn olm_sas_get_pubkey(
        sas: *mut OlmSAS,
        pubkey: *mut ::std::os::raw::c_void,
        pubkey_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Sets the public key of other user."]
    #[doc = ""]
    #[doc = " @param[in] sas the SAS object."]
    #[doc = " @param[in] their_key the other user's public key.  The contents of the"]
    #[doc = "     buffer will be overwritten."]
    #[doc = " @param[in] their_key_length the size of the `their_key` buffer."]
    #[doc = ""]
    #[doc = " @return `olm_error()` on failure.  If the `their_key` buffer is too small,"]
    #[doc = " then `olm_sas_last_error()` will be `INPUT_BUFFER_TOO_SMALL`."]
    pub fn olm_sas_set_their_key(
        sas: *mut OlmSAS,
        their_key: *mut ::std::os::raw::c_void,
        their_key_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Checks if their key was set."]
    #[doc = ""]
    #[doc = " @param[in] sas the SAS object."]
    #[doc = ""]
    pub fn olm_sas_is_their_key_set(sas: *mut OlmSAS) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Generate bytes to use for the short authentication string."]
    #[doc = ""]
    #[doc = " @param[in] sas the SAS object."]
    #[doc = " @param[in] info extra information to mix in when generating the bytes, as"]
    #[doc = "     per the Matrix spec."]
    #[doc = " @param[in] info_length the length of the `info` parameter."]
    #[doc = " @param[out] output the output buffer."]
    #[doc = " @param[in] output_length the size of the output buffer.  For hex-based SAS"]
    #[doc = "     as in the Matrix spec, this will be 5."]
    #[doc = ""]
    #[doc = " @return `olm_error()` on failure. If their key wasn't set then"]
    #[doc = " `olm_sas_last_error()` will be `SAS_THEIR_KEY_NOT_SET`."]
    pub fn olm_sas_generate_bytes(
        sas: *mut OlmSAS,
        info: *const ::std::os::raw::c_void,
        info_length: usize,
        output: *mut ::std::os::raw::c_void,
        output_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The size of the message authentication code generated by"]
    #[doc = " olm_sas_calculate_mac()`."]
    pub fn olm_sas_mac_length(sas: *mut OlmSAS) -> usize;
}
extern "C" {
    #[doc = " Generate a message authentication code (MAC) based on the shared secret."]
    #[doc = ""]
    #[doc = " @param[in] sas the SAS object."]
    #[doc = " @param[in] input the message to produce the authentication code for."]
    #[doc = " @param[in] input_length the length of the message."]
    #[doc = " @param[in] info extra information to mix in when generating the MAC, as per"]
    #[doc = "     the Matrix spec."]
    #[doc = " @param[in] info_length the length of the `info` parameter."]
    #[doc = " @param[out] mac the buffer in which to store the MAC."]
    #[doc = " @param[in] mac_length the size of the `mac` buffer.  Must be at least"]
    #[doc = " `olm_sas_mac_length()`"]
    #[doc = ""]
    #[doc = " @return `olm_error()` on failure.  If the `mac` buffer is too small, then"]
    #[doc = " `olm_sas_last_error()` will be `OUTPUT_BUFFER_TOO_SMALL`."]
    pub fn olm_sas_calculate_mac(
        sas: *mut OlmSAS,
        input: *const ::std::os::raw::c_void,
        input_length: usize,
        info: *const ::std::os::raw::c_void,
        info_length: usize,
        mac: *mut ::std::os::raw::c_void,
        mac_length: usize,
    ) -> usize;
}
extern "C" {
    pub fn olm_sas_calculate_mac_long_kdf(
        sas: *mut OlmSAS,
        input: *const ::std::os::raw::c_void,
        input_length: usize,
        info: *const ::std::os::raw::c_void,
        info_length: usize,
        mac: *mut ::std::os::raw::c_void,
        mac_length: usize,
    ) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmPkEncryption {
    _unused: [u8; 0],
}
extern "C" {
    pub fn olm_pk_encryption_size() -> usize;
}
extern "C" {
    #[doc = " Initialise an encryption object using the supplied memory"]
    #[doc = "  The supplied memory must be at least olm_pk_encryption_size() bytes"]
    pub fn olm_pk_encryption(memory: *mut ::std::os::raw::c_void) -> *mut OlmPkEncryption;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to an"]
    #[doc = " encryption object"]
    pub fn olm_pk_encryption_last_error(
        encryption: *mut OlmPkEncryption,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Clears the memory used to back this encryption object"]
    pub fn olm_clear_pk_encryption(encryption: *mut OlmPkEncryption) -> usize;
}
extern "C" {
    #[doc = " Set the recipient's public key for encrypting to"]
    pub fn olm_pk_encryption_set_recipient_key(
        encryption: *mut OlmPkEncryption,
        public_key: *const ::std::os::raw::c_void,
        public_key_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the length of the ciphertext that will correspond to a plaintext of the"]
    #[doc = " given length."]
    pub fn olm_pk_ciphertext_length(
        encryption: *mut OlmPkEncryption,
        plaintext_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the length of the message authentication code."]
    pub fn olm_pk_mac_length(encryption: *mut OlmPkEncryption) -> usize;
}
extern "C" {
    #[doc = " Get the length of a public or ephemeral key"]
    pub fn olm_pk_key_length() -> usize;
}
extern "C" {
    #[doc = " The number of random bytes needed to encrypt a message."]
    pub fn olm_pk_encrypt_random_length(encryption: *mut OlmPkEncryption) -> usize;
}
extern "C" {
    #[doc = " Encrypt a plaintext for the recipient set using"]
    #[doc = " olm_pk_encryption_set_recipient_key. Writes to the ciphertext, mac, and"]
    #[doc = " ephemeral_key buffers, whose values should be sent to the recipient. mac is"]
    #[doc = " a Message Authentication Code to ensure that the data is received and"]
    #[doc = " decrypted properly. ephemeral_key is the public part of the ephemeral key"]
    #[doc = " used (together with the recipient's key) to generate a symmetric encryption"]
    #[doc = " key. Returns olm_error() on failure. If the ciphertext, mac, or"]
    #[doc = " ephemeral_key buffers were too small then olm_pk_encryption_last_error()"]
    #[doc = " will be \"OUTPUT_BUFFER_TOO_SMALL\". If there weren't enough random bytes then"]
    #[doc = " olm_pk_encryption_last_error() will be \"OLM_INPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_pk_encrypt(
        encryption: *mut OlmPkEncryption,
        plaintext: *const ::std::os::raw::c_void,
        plaintext_length: usize,
        ciphertext: *mut ::std::os::raw::c_void,
        ciphertext_length: usize,
        mac: *mut ::std::os::raw::c_void,
        mac_length: usize,
        ephemeral_key: *mut ::std::os::raw::c_void,
        ephemeral_key_size: usize,
        random: *const ::std::os::raw::c_void,
        random_length: usize,
    ) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmPkDecryption {
    _unused: [u8; 0],
}
extern "C" {
    pub fn olm_pk_decryption_size() -> usize;
}
extern "C" {
    #[doc = " Initialise a decryption object using the supplied memory"]
    #[doc = "  The supplied memory must be at least olm_pk_decryption_size() bytes"]
    pub fn olm_pk_decryption(memory: *mut ::std::os::raw::c_void) -> *mut OlmPkDecryption;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to a"]
    #[doc = " decription object"]
    pub fn olm_pk_decryption_last_error(
        decryption: *mut OlmPkDecryption,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Clears the memory used to back this decryption object"]
    pub fn olm_clear_pk_decryption(decryption: *mut OlmPkDecryption) -> usize;
}
extern "C" {
    #[doc = " Get the number of bytes required to store an olm private key"]
    pub fn olm_pk_private_key_length() -> usize;
}
extern "C" {
    #[doc = " DEPRECATED: Use olm_pk_private_key_length()"]
    pub fn olm_pk_generate_key_random_length() -> usize;
}
extern "C" {
    #[doc = " Initialise the key from the private part of a key as returned by"]
    #[doc = " olm_pk_get_private_key(). The associated public key will be written to the"]
    #[doc = " pubkey buffer. Returns olm_error() on failure. If the pubkey buffer is too"]
    #[doc = " small then olm_pk_decryption_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    #[doc = " If the private key was not long enough then olm_pk_decryption_last_error()"]
    #[doc = " will be \"OLM_INPUT_BUFFER_TOO_SMALL\"."]
    #[doc = ""]
    #[doc = " Note that the pubkey is a base64 encoded string, but the private key is"]
    #[doc = " an unencoded byte array"]
    pub fn olm_pk_key_from_private(
        decryption: *mut OlmPkDecryption,
        pubkey: *mut ::std::os::raw::c_void,
        pubkey_length: usize,
        privkey: *const ::std::os::raw::c_void,
        privkey_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " DEPRECATED: Use olm_pk_key_from_private"]
    pub fn olm_pk_generate_key(
        decryption: *mut OlmPkDecryption,
        pubkey: *mut ::std::os::raw::c_void,
        pubkey_length: usize,
        privkey: *const ::std::os::raw::c_void,
        privkey_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Returns the number of bytes needed to store a decryption object."]
    pub fn olm_pickle_pk_decryption_length(decryption: *mut OlmPkDecryption) -> usize;
}
extern "C" {
    #[doc = " Stores decryption object as a base64 string. Encrypts the object using the"]
    #[doc = " supplied key. Returns the length of the pickled object on success."]
    #[doc = " Returns olm_error() on failure. If the pickle output buffer"]
    #[doc = " is smaller than olm_pickle_pk_decryption_length() then"]
    #[doc = " olm_pk_decryption_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\""]
    pub fn olm_pickle_pk_decryption(
        decryption: *mut OlmPkDecryption,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Loads a decryption object from a pickled base64 string. The associated"]
    #[doc = " public key will be written to the pubkey buffer. Decrypts the object using"]
    #[doc = " the supplied key. Returns olm_error() on failure. If the key doesn't"]
    #[doc = " match the one used to encrypt the account then olm_pk_decryption_last_error()"]
    #[doc = " will be \"BAD_ACCOUNT_KEY\". If the base64 couldn't be decoded then"]
    #[doc = " olm_pk_decryption_last_error() will be \"INVALID_BASE64\". The input pickled"]
    #[doc = " buffer is destroyed"]
    pub fn olm_unpickle_pk_decryption(
        decryption: *mut OlmPkDecryption,
        key: *const ::std::os::raw::c_void,
        key_length: usize,
        pickled: *mut ::std::os::raw::c_void,
        pickled_length: usize,
        pubkey: *mut ::std::os::raw::c_void,
        pubkey_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the length of the plaintext that will correspond to a ciphertext of the"]
    #[doc = " given length."]
    pub fn olm_pk_max_plaintext_length(
        decryption: *mut OlmPkDecryption,
        ciphertext_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Decrypt a ciphertext. The input ciphertext buffer is destroyed. See the"]
    #[doc = " olm_pk_encrypt function for descriptions of the ephemeral_key and mac"]
    #[doc = " arguments. Returns the length of the plaintext on success. Returns"]
    #[doc = " olm_error() on failure. If the plaintext buffer is too small then"]
    #[doc = " olm_pk_encryption_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_pk_decrypt(
        decryption: *mut OlmPkDecryption,
        ephemeral_key: *const ::std::os::raw::c_void,
        ephemeral_key_length: usize,
        mac: *const ::std::os::raw::c_void,
        mac_length: usize,
        ciphertext: *mut ::std::os::raw::c_void,
        ciphertext_length: usize,
        plaintext: *mut ::std::os::raw::c_void,
        max_plaintext_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " Get the private key for an OlmDecryption object as an unencoded byte array"]
    #[doc = " private_key must be a pointer to a buffer of at least"]
    #[doc = " olm_pk_private_key_length() bytes and this length must be passed in"]
    #[doc = " private_key_length. If the given buffer is too small, returns olm_error()"]
    #[doc = " and olm_pk_encryption_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    #[doc = " Returns the number of bytes written."]
    pub fn olm_pk_get_private_key(
        decryption: *mut OlmPkDecryption,
        private_key: *mut ::std::os::raw::c_void,
        private_key_length: usize,
    ) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OlmPkSigning {
    _unused: [u8; 0],
}
extern "C" {
    pub fn olm_pk_signing_size() -> usize;
}
extern "C" {
    #[doc = " Initialise a signing object using the supplied memory"]
    #[doc = "  The supplied memory must be at least olm_pk_signing_size() bytes"]
    pub fn olm_pk_signing(memory: *mut ::std::os::raw::c_void) -> *mut OlmPkSigning;
}
extern "C" {
    #[doc = " A null terminated string describing the most recent error to happen to a"]
    #[doc = " signing object"]
    pub fn olm_pk_signing_last_error(sign: *mut OlmPkSigning) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Clears the memory used to back this signing object"]
    pub fn olm_clear_pk_signing(sign: *mut OlmPkSigning) -> usize;
}
extern "C" {
    #[doc = " Initialise the signing object with a public/private keypair from a seed. The"]
    #[doc = " associated public key will be written to the pubkey buffer. Returns"]
    #[doc = " olm_error() on failure. If the public key buffer is too small then"]
    #[doc = " olm_pk_signing_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\".  If the seed"]
    #[doc = " buffer is too small then olm_pk_signing_last_error() will be"]
    #[doc = " \"INPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_pk_signing_key_from_seed(
        sign: *mut OlmPkSigning,
        pubkey: *mut ::std::os::raw::c_void,
        pubkey_length: usize,
        seed: *const ::std::os::raw::c_void,
        seed_length: usize,
    ) -> usize;
}
extern "C" {
    #[doc = " The size required for the seed for initialising a signing object."]
    pub fn olm_pk_signing_seed_length() -> usize;
}
extern "C" {
    #[doc = " The size of the public key of a signing object."]
    pub fn olm_pk_signing_public_key_length() -> usize;
}
extern "C" {
    #[doc = " The size of a signature created by a signing object."]
    pub fn olm_pk_signature_length() -> usize;
}
extern "C" {
    #[doc = " Sign a message. The signature will be written to the signature"]
    #[doc = " buffer. Returns olm_error() on failure. If the signature buffer is too"]
    #[doc = " small, olm_pk_signing_last_error() will be \"OUTPUT_BUFFER_TOO_SMALL\"."]
    pub fn olm_pk_sign(
        sign: *mut OlmPkSigning,
        message: *const u8,
        message_length: usize,
        signature: *mut u8,
        signature_length: usize,
    ) -> usize;
}