/ crates / crypton-bits-sys / src / bindings.rs
bindings.rs
  1  /* automatically generated by rust-bindgen 0.72.1 */
  2  
  3  #[repr(C)]
  4  pub struct __BindgenUnionField<T>(::core::marker::PhantomData<T>);
  5  impl<T> __BindgenUnionField<T> {
  6      #[inline]
  7      pub const fn new() -> Self {
  8          __BindgenUnionField(::core::marker::PhantomData)
  9      }
 10      #[inline]
 11      pub unsafe fn as_ref(&self) -> &T {
 12          ::core::mem::transmute(self)
 13      }
 14      #[inline]
 15      pub unsafe fn as_mut(&mut self) -> &mut T {
 16          ::core::mem::transmute(self)
 17      }
 18  }
 19  impl<T> ::core::default::Default for __BindgenUnionField<T> {
 20      #[inline]
 21      fn default() -> Self {
 22          Self::new()
 23      }
 24  }
 25  impl<T> ::core::clone::Clone for __BindgenUnionField<T> {
 26      #[inline]
 27      fn clone(&self) -> Self {
 28          *self
 29      }
 30  }
 31  impl<T> ::core::marker::Copy for __BindgenUnionField<T> {}
 32  impl<T> ::core::fmt::Debug for __BindgenUnionField<T> {
 33      fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
 34          fmt.write_str("__BindgenUnionField")
 35      }
 36  }
 37  impl<T> ::core::hash::Hash for __BindgenUnionField<T> {
 38      fn hash<H: ::core::hash::Hasher>(&self, _state: &mut H) {}
 39  }
 40  impl<T> ::core::cmp::PartialEq for __BindgenUnionField<T> {
 41      fn eq(&self, _other: &__BindgenUnionField<T>) -> bool {
 42          true
 43      }
 44  }
 45  impl<T> ::core::cmp::Eq for __BindgenUnionField<T> {}
 46  #[repr(C)]
 47  pub struct block {
 48      pub q: __BindgenUnionField<[u64; 8usize]>,
 49      pub d: __BindgenUnionField<[u32; 16usize]>,
 50      pub b: __BindgenUnionField<[u8; 64usize]>,
 51      pub bindgen_union_field: [u64; 8usize],
 52  }
 53  pub type crypton_salsa_state = block;
 54  #[repr(C)]
 55  pub struct crypton_salsa_context {
 56      pub st: crypton_salsa_state,
 57      pub prev: [u8; 64usize],
 58      pub prev_ofs: u8,
 59      pub prev_len: u8,
 60      pub nb_rounds: u8,
 61  }
 62  unsafe extern "C" {
 63      pub fn crypton_salsa_core_xor(rounds: ::core::ffi::c_int, out: *mut block, in_: *mut block);
 64  }
 65  unsafe extern "C" {
 66      pub fn crypton_salsa_init_core(
 67          st: *mut crypton_salsa_state,
 68          keylen: u32,
 69          key: *const u8,
 70          ivlen: u32,
 71          iv: *const u8,
 72      );
 73  }
 74  unsafe extern "C" {
 75      pub fn crypton_salsa_init(
 76          ctx: *mut crypton_salsa_context,
 77          nb_rounds: u8,
 78          keylen: u32,
 79          key: *const u8,
 80          ivlen: u32,
 81          iv: *const u8,
 82      );
 83  }
 84  unsafe extern "C" {
 85      pub fn crypton_salsa_combine(
 86          dst: *mut u8,
 87          st: *mut crypton_salsa_context,
 88          src: *const u8,
 89          bytes: u32,
 90      );
 91  }
 92  unsafe extern "C" {
 93      pub fn crypton_salsa_generate(dst: *mut u8, st: *mut crypton_salsa_context, bytes: u32);
 94  }
 95  unsafe extern "C" {
 96      pub fn crypton_xsalsa_init(
 97          ctx: *mut crypton_salsa_context,
 98          nb_rounds: u8,
 99          keylen: u32,
100          key: *const u8,
101          ivlen: u32,
102          iv: *const u8,
103      );
104  }
105  unsafe extern "C" {
106      pub fn crypton_xsalsa_derive(ctx: *mut crypton_salsa_context, ivlen: u32, iv: *const u8);
107  }
108  #[repr(C)]
109  pub struct poly1305_ctx {
110      pub r: [u32; 5usize],
111      pub h: [u32; 5usize],
112      pub pad: [u32; 4usize],
113      pub index: u32,
114      pub buf: [u8; 16usize],
115  }
116  pub type poly1305_mac = [u8; 16usize];
117  pub type poly1305_key = [u8; 32usize];
118  unsafe extern "C" {
119      pub fn crypton_poly1305_init(ctx: *mut poly1305_ctx, key: *mut poly1305_key);
120  }
121  unsafe extern "C" {
122      pub fn crypton_poly1305_update(ctx: *mut poly1305_ctx, data: *mut u8, length: u32);
123  }
124  unsafe extern "C" {
125      pub fn crypton_poly1305_finalize(mac: *mut u8, ctx: *mut poly1305_ctx);
126  }