tinydtls-sys 0.2.0+tinydtls-9d6cf54

Raw bindings to the TinyDTLS library.
Documentation
Build #2345133 2025-07-24 02:41:33
# rustc version
rustc 1.90.0-nightly (ace633090 2025-07-23)# docs.rs version
docsrs 0.6.0 (4b4a3779 2025-07-22)# build log
[INFO] running `Command { std: "docker" "create" "-v" "/home/cratesfyi/workspace/builds/tinydtls-sys-0.2.0+tinydtls-9d6cf54/target:/opt/rustwide/target:rw,Z" "-v" "/home/cratesfyi/workspace/builds/tinydtls-sys-0.2.0+tinydtls-9d6cf54/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/cratesfyi/workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/cratesfyi/workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "DOCS_RS=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "6442450944" "--cpus" "6" "--user" "1001:1001" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:cf8efcab8866f2cf4285301c7418e2f4f2a9b088c91ba69c40d5b659f81557f7" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "--config" "build.rustdocflags=[\"--cfg\", \"docsrs\", \"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--resource-suffix\", \"-20250723-1.90.0-nightly-ace633090\", \"--static-root-path\", \"/-/rustdoc.static/\", \"--cap-lints\", \"warn\", \"--extern-html-root-takes-precedence\"]" "--offline" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/x86_64-unknown-linux-gnu\"" "-Zrustdoc-scrape-examples" "-j6" "--target" "x86_64-unknown-linux-gnu", kill_on_drop: false }`
[INFO] [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
[INFO] [stdout] 1533532be42790a12cf21bb7e4cdcfcbecfa15c7c170ba38570408363751571b
[INFO] running `Command { std: "docker" "start" "-a" "1533532be42790a12cf21bb7e4cdcfcbecfa15c7c170ba38570408363751571b", kill_on_drop: false }`
[INFO] [stderr] warning: target filter specified, but no targets matched; this is a no-op
[INFO] [stderr]    Compiling tinydtls-sys v0.2.0+tinydtls-9d6cf54 (/opt/rustwide/workdir)
[INFO] [stderr]  Documenting tinydtls-sys v0.2.0+tinydtls-9d6cf54 (/opt/rustwide/workdir)
[INFO] [stderr] warning: this URL is not a hyperlink
[INFO] [stderr]  --> /opt/rustwide/target/x86_64-unknown-linux-gnu/debug/build/tinydtls-sys-e70f2fd25396d6cd/out/bindings.rs:3:12917
[INFO] [stderr]   |
[INFO] [stderr] 3 | ...the HashAlgorithm defined in\n <a href=\"http://tools.ietf.org/html/rfc5246#section-7.4.1.4.1\"\n >Section 7.4.1.4.1 of RFC 5246</a>."...
[INFO] [stderr]   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr]   |
[INFO] [stderr]   = note: bare URLs are not automatically turned into clickable links
[INFO] [stderr]   = note: `#[warn(rustdoc::bare_urls)]` on by default
[INFO] [stderr] help: use an automatic link instead
[INFO] [stderr]   |
[INFO] [stderr] 3 | # [repr (C)] # [derive (Copy , Clone , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd)] pub struct __BindgenBitfieldUnit < Storage > { storage : Storage , } impl < Storage > __BindgenBitfieldUnit < Storage > { # [inline] pub const fn new (storage : Storage) -> Self { Self { storage } } } impl < Storage > __BindgenBitfieldUnit < Storage > where Storage : AsRef < [u8] > + AsMut < [u8] >, { # [inline] pub fn get_bit (& self , index : usize) -> bool { debug_assert ! (index / 8 < self . storage . as_ref () . len ()) ; let byte_index = index / 8 ; let byte = self . storage . as_ref () [byte_index] ; let bit_index = if cfg ! (target_endian = "big") { 7 - (index % 8) } else { index % 8 } ; let mask = 1 << bit_index ; byte & mask == mask } # [inline] pub fn set_bit (& mut self , index : usize , val : bool) { debug_assert ! (index / 8 < self . storage . as_ref () . len ()) ; let byte_index = index / 8 ; let byte = & mut self . storage . as_mut () [byte_index] ; let bit_index = if cfg ! (target_endian = "big") { 7 - (index % 8) } else { index % 8 } ; let mask = 1 << bit_index ; if val { * byte |= mask ; } else { * byte &= ! mask ; } } # [inline] pub fn get (& self , bit_offset : usize , bit_width : u8) -> u64 { debug_assert ! (bit_width <= 64) ; debug_assert ! (bit_offset / 8 < self . storage . as_ref () . len ()) ; debug_assert ! ((bit_offset + (bit_width as usize)) / 8 <= self . storage . as_ref () . len ()) ; let mut val = 0 ; for i in 0 .. (bit_width as usize) { if self . get_bit (i + bit_offset) { let index = if cfg ! (target_endian = "big") { bit_width as usize - 1 - i } else { i } ; val |= 1 << index ; } } val } # [inline] pub fn set (& mut self , bit_offset : usize , bit_width : u8 , val : u64) { debug_assert ! (bit_width <= 64) ; debug_assert ! (bit_offset / 8 < self . storage . as_ref () . len ()) ; debug_assert ! ((bit_offset + (bit_width as usize)) / 8 <= self . storage . as_ref () . len ()) ; for i in 0 .. (bit_width as usize) { let mask = 1 << i ; let val_bit_is_set = val & mask == mask ; let index = if cfg ! (target_endian = "big") { bit_width as usize - 1 - i } else { i } ; self . set_bit (index + bit_offset , val_bit_is_set) ; } } } # [repr (C)] # [derive (Default)] pub struct __IncompleteArrayField < T > (:: std :: marker :: PhantomData < T > , [T ; 0]) ; impl < T > __IncompleteArrayField < T > { # [inline] pub const fn new () -> Self { __IncompleteArrayField (:: std :: marker :: PhantomData , []) } # [inline] pub fn as_ptr (& self) -> * const T { self as * const _ as * const T } # [inline] pub fn as_mut_ptr (& mut self) -> * mut T { self as * mut _ as * mut T } # [inline] pub unsafe fn as_slice (& self , len : usize) -> & [T] { :: std :: slice :: from_raw_parts (self . as_ptr () , len) } # [inline] pub unsafe fn as_mut_slice (& mut self , len : usize) -> & mut [T] { :: std :: slice :: from_raw_parts_mut (self . as_mut_ptr () , len) } } impl < T > :: std :: fmt :: Debug for __IncompleteArrayField < T > { fn fmt (& self , fmt : & mut :: std :: fmt :: Formatter < '_ >) -> :: std :: fmt :: Result { fmt . write_str ("__IncompleteArrayField") } } # [repr (C)] pub struct __BindgenUnionField < T > (:: std :: marker :: PhantomData < T >) ; impl < T > __BindgenUnionField < T > { # [inline] pub const fn new () -> Self { __BindgenUnionField (:: std :: marker :: PhantomData) } # [inline] pub unsafe fn as_ref (& self) -> & T { :: std :: mem :: transmute (self) } # [inline] pub unsafe fn as_mut (& mut self) -> & mut T { :: std :: mem :: transmute (self) } } impl < T > :: std :: default :: Default for __BindgenUnionField < T > { # [inline] fn default () -> Self { Self :: new () } } impl < T > :: std :: clone :: Clone for __BindgenUnionField < T > { # [inline] fn clone (& self) -> Self { * self } } impl < T > :: std :: marker :: Copy for __BindgenUnionField < T > { } impl < T > :: std :: fmt :: Debug for __BindgenUnionField < T > { fn fmt (& self , fmt : & mut :: std :: fmt :: Formatter < '_ >) -> :: std :: fmt :: Result { fmt . write_str ("__BindgenUnionField") } } impl < T > :: std :: hash :: Hash for __BindgenUnionField < T > { fn hash < H : :: std :: hash :: Hasher > (& self , _state : & mut H) { } } impl < T > :: std :: cmp :: PartialEq for __BindgenUnionField < T > { fn eq (& self , _other : & __BindgenUnionField < T >) -> bool { true } } impl < T > :: std :: cmp :: Eq for __BindgenUnionField < T > { } pub const WITH_POSIX : u32 = 1 ; pub const DTLS_ECC : u32 = 1 ; pub const DTLS_PSK : u32 = 1 ; pub const PACKAGE_BUGREPORT : & [u8 ; 1] = b"\0" ; pub const PACKAGE_NAME : & [u8 ; 9] = b"tinydtls\0" ; pub const PACKAGE_STRING : & [u8 ; 15] = b"tinydtls 0.8.6\0" ; pub const PACKAGE_TARNAME : & [u8 ; 9] = b"tinydtls\0" ; pub const PACKAGE_URL : & [u8 ; 51] = b"https://projects.eclipse.org/projects/iot.tinydtls\0" ; pub const PACKAGE_VERSION : & [u8 ; 6] = b"0.8.6\0" ; pub const DTLSv12 : u32 = 1 ; pub const WITH_SHA256 : u32 = 1 ; pub const DTLS_MAX_BUF : u32 = 1400 ; pub const DTLS_DEFAULT_MAX_RETRANSMIT : u32 = 7 ; pub const TLS_EXT_ELLIPTIC_CURVES : u32 = 10 ; pub const TLS_EXT_EC_POINT_FORMATS : u32 = 11 ; pub const TLS_EXT_SIG_HASH_ALGO : u32 = 13 ; pub const TLS_EXT_CLIENT_CERTIFICATE_TYPE : u32 = 19 ; pub const TLS_EXT_SERVER_CERTIFICATE_TYPE : u32 = 20 ; pub const TLS_EXT_ENCRYPT_THEN_MAC : u32 = 22 ; pub const TLS_EXT_EXTENDED_MASTER_SECRET : u32 = 23 ; pub const TLS_EXT_RENEGOTIATION_INFO : u32 = 65281 ; pub const TLS_CERT_TYPE_RAW_PUBLIC_KEY : u32 = 2 ; pub const TLS_EXT_ELLIPTIC_CURVES_SECP256R1 : u32 = 23 ; pub const TLS_EXT_EC_POINT_FORMATS_UNCOMPRESSED : u32 = 0 ; pub const TLS_EC_CURVE_TYPE_NAMED_CURVE : u32 = 3 ; pub const TLS_CLIENT_CERTIFICATE_TYPE_ECDSA_SIGN : u32 = 64 ; pub const TLS_EXT_SIG_HASH_ALGO_SHA256 : u32 = 4 ; pub const TLS_EXT_SIG_HASH_ALGO_ECDSA : u32 = 3 ; pub const DTLS_SHA256_BLOCK_LENGTH : u32 = 64 ; pub const DTLS_SHA256_DIGEST_LENGTH : u32 = 32 ; pub const DTLS_SHA256_DIGEST_STRING_LENGTH : u32 = 65 ; pub const DTLS_SHA384_BLOCK_LENGTH : u32 = 128 ; pub const DTLS_SHA384_DIGEST_LENGTH : u32 = 48 ; pub const DTLS_SHA384_DIGEST_STRING_LENGTH : u32 = 97 ; pub const DTLS_SHA512_BLOCK_LENGTH : u32 = 128 ; pub const DTLS_SHA512_DIGEST_LENGTH : u32 = 64 ; pub const DTLS_SHA512_DIGEST_STRING_LENGTH : u32 = 129 ; pub const DTLS_HMAC_BLOCKSIZE : u32 = 64 ; pub const DTLS_HMAC_DIGEST_SIZE : u32 = 32 ; pub const DTLS_HMAC_MAX : u32 = 64 ; pub const DTLS_CCM_BLOCKSIZE : u32 = 16 ; pub const DTLS_CCM_MAX : u32 = 16 ; pub const DTLS_CCM_NONCE_SIZE : u32 = 12 ; pub const DTLS_MAC_KEY_LENGTH : u32 = 0 ; pub const DTLS_KEY_LENGTH : u32 = 16 ; pub const DTLS_BLK_LENGTH : u32 = 16 ; pub const DTLS_MAC_LENGTH : u32 = 32 ; pub const DTLS_IV_LENGTH : u32 = 4 ; pub const DTLS_MASTER_SECRET_LENGTH : u32 = 48 ; pub const DTLS_RANDOM_LENGTH : u32 = 32 ; pub const DTLS_CIPHER_INDEX_NULL : u32 = 0 ; pub const DTLS_MAX_CIPHER_SUITES : u32 = 4 ; pub const DTLS_PSK_MAX_CLIENT_IDENTITY_LEN : u32 = 32 ; pub const DTLS_PSK_MAX_KEY_LEN : u32 = 16 ; pub const DTLS_EC_KEY_SIZE : u32 = 32 ; pub const DTLS_EVENT_CONNECT : u32 = 476 ; pub const DTLS_EVENT_CONNECTED : u32 = 478 ; pub const CLOCK_SECOND : u32 = 1000 ; pub const DTLS_TICKS_PER_SECOND : u32 = 1000 ; pub const DTLS_VERSION : u32 = 65277 ; pub const DTLS_COOKIE_SECRET_LENGTH : u32 = 12 ; pub const DTLS_COOKIE_LENGTH : u32 = 16 ; pub const DTLS_CT_CHANGE_CIPHER_SPEC : u32 = 20 ; pub const DTLS_CT_ALERT : u32 = 21 ; pub const DTLS_CT_HANDSHAKE : u32 = 22 ; pub const DTLS_CT_APPLICATION_DATA : u32 = 23 ; pub const DTLS_HT_HELLO_REQUEST : u32 = 0 ; pub const DTLS_HT_CLIENT_HELLO : u32 = 1 ; pub const DTLS_HT_SERVER_HELLO : u32 = 2 ; pub const DTLS_HT_HELLO_VERIFY_REQUEST : u32 = 3 ; pub const DTLS_HT_CERTIFICATE : u32 = 11 ; pub const DTLS_HT_SERVER_KEY_EXCHANGE : u32 = 12 ; pub const DTLS_HT_CERTIFICATE_REQUEST : u32 = 13 ; pub const DTLS_HT_SERVER_HELLO_DONE : u32 = 14 ; pub const DTLS_HT_CERTIFICATE_VERIFY : u32 = 15 ; pub const DTLS_HT_CLIENT_KEY_EXCHANGE : u32 = 16 ; pub const DTLS_HT_FINISHED : u32 = 20 ; pub const DTLS_HT_NO_OPTIONAL_MESSAGE : i32 = - 1 ; pub type __uint8_t = :: std :: os :: raw :: c_uchar ; pub type __uint32_t = :: std :: os :: raw :: c_uint ; pub type __uint64_t = :: std :: os :: raw :: c_ulong ; pub type u_int8_t = __uint8_t ; pub type u_int32_t = __uint32_t ; pub type u_int64_t = __uint64_t ; pub type uint8 = :: std :: os :: raw :: c_uchar ; pub type uint16 = [:: std :: os :: raw :: c_uchar ; 2usize] ; pub type uint24 = [:: std :: os :: raw :: c_uchar ; 3usize] ; pub type uint32 = [:: std :: os :: raw :: c_uchar ; 4usize] ; pub type uint48 = [:: std :: os :: raw :: c_uchar ; 6usize] ; # [repr (u32)] # [non_exhaustive] # [doc = " Known cipher suites."] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_cipher_t { # [doc = "< NULL cipher"] TLS_NULL_WITH_NULL_NULL = 0 , # [doc = "< see RFC 5746"] TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 255 , # [doc = "< see RFC 6655"] TLS_PSK_WITH_AES_128_CCM = 49316 , # [doc = "< see RFC 6655"] TLS_PSK_WITH_AES_128_CCM_8 = 49320 , # [doc = "< see RFC 7251"] TLS_ECDHE_ECDSA_WITH_AES_128_CCM = 49324 , # [doc = "< see RFC 7251"] TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 = 49326 , } # [repr (u32)] # [non_exhaustive] # [doc = " Known compression suites."] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_compression_t { TLS_COMPRESSION_NULL = 0 , } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct _dtls_sha256_ctx { pub state : [u_int32_t ; 8usize] , pub bitcount : u_int64_t , pub buffer : [u_int8_t ; 64usize] , } # [test] fn bindgen_test_layout__dtls_sha256_ctx () { const UNINIT : :: std :: mem :: MaybeUninit < _dtls_sha256_ctx > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < _dtls_sha256_ctx > () , 104usize , concat ! ("Size of: " , stringify ! (_dtls_sha256_ctx))) ; assert_eq ! (:: std :: mem :: align_of :: < _dtls_sha256_ctx > () , 8usize , concat ! ("Alignment of " , stringify ! (_dtls_sha256_ctx))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . state) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (_dtls_sha256_ctx) , "::" , stringify ! (state))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . bitcount) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (_dtls_sha256_ctx) , "::" , stringify ! (bitcount))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . buffer) as usize - ptr as usize } , 40usize , concat ! ("Offset of field: " , stringify ! (_dtls_sha256_ctx) , "::" , stringify ! (buffer))) ; } pub type dtls_sha256_ctx = _dtls_sha256_ctx ; # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct _dtls_sha512_ctx { pub state : [u_int64_t ; 8usize] , pub bitcount : [u_int64_t ; 2usize] , pub buffer : [u_int8_t ; 128usize] , } # [test] fn bindgen_test_layout__dtls_sha512_ctx () { const UNINIT : :: std :: mem :: MaybeUninit < _dtls_sha512_ctx > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < _dtls_sha512_ctx > () , 208usize , concat ! ("Size of: " , stringify ! (_dtls_sha512_ctx))) ; assert_eq ! (:: std :: mem :: align_of :: < _dtls_sha512_ctx > () , 8usize , concat ! ("Alignment of " , stringify ! (_dtls_sha512_ctx))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . state) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (_dtls_sha512_ctx) , "::" , stringify ! (state))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . bitcount) as usize - ptr as usize } , 64usize , concat ! ("Offset of field: " , stringify ! (_dtls_sha512_ctx) , "::" , stringify ! (bitcount))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . buffer) as usize - ptr as usize } , 80usize , concat ! ("Offset of field: " , stringify ! (_dtls_sha512_ctx) , "::" , stringify ! (buffer))) ; } pub type dtls_sha512_ctx = _dtls_sha512_ctx ; pub type dtls_sha384_ctx = dtls_sha512_ctx ; extern "C" { pub fn dtls_sha256_init (arg1 : * mut dtls_sha256_ctx) ; } extern "C" { pub fn dtls_sha256_update (arg1 : * mut dtls_sha256_ctx , arg2 : * const u_int8_t , arg3 : usize) ; } extern "C" { pub fn dtls_sha256_final (arg1 : * mut u_int8_t , arg2 : * mut dtls_sha256_ctx) ; } extern "C" { pub fn dtls_sha256_end (arg1 : * mut dtls_sha256_ctx , arg2 : * mut :: std :: os :: raw :: c_char) -> * mut :: std :: os :: raw :: c_char ; } extern "C" { pub fn dtls_sha256_data (arg1 : * const u_int8_t , arg2 : usize , arg3 : * mut :: std :: os :: raw :: c_char) -> * mut :: std :: os :: raw :: c_char ; } pub type dtls_hash_ctx = dtls_sha256_ctx ; pub type dtls_hash_t = * mut dtls_hash_ctx ; # [repr (u32)] # [non_exhaustive] # [doc = " List of known hash functions for use in dtls_hmac_init(). The\n identifiers are the same as the HashAlgorithm defined in\n <a href=\"<http://tools.ietf.org/html/rfc5246#section-7.4.1.4.1>\"\n >Section 7.4.1.4.1 of RFC 5246</a>."] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_hashfunc_t { HASH_NONE = 0 , HASH_MD5 = 1 , HASH_SHA1 = 2 , HASH_SHA224 = 3 , HASH_SHA256 = 4 , HASH_SHA384 = 5 , HASH_SHA512 = 6 , } # [doc = " Context for HMAC generation. This object is initialized with\n dtls_hmac_init() and must be passed to dtls_hmac_update() and\n dtls_hmac_finalize(). Once, finalized, the component \\c H is\n invalid and must be initialized again with dtls_hmac_init() before\n the structure can be used again."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_hmac_context_t { # [doc = "< ipad and opad storage"] pub pad : [:: std :: os :: raw :: c_uchar ; 64usize] , # [doc = "< context for hash function"] pub data : dtls_hash_ctx , } # [test] fn bindgen_test_layout_dtls_hmac_context_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_hmac_context_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_hmac_context_t > () , 168usize , concat ! ("Size of: " , stringify ! (dtls_hmac_context_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_hmac_context_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_hmac_context_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . pad) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_hmac_context_t) , "::" , stringify ! (pad))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . data) as usize - ptr as usize } , 64usize , concat ! ("Offset of field: " , stringify ! (dtls_hmac_context_t) , "::" , stringify ! (data))) ; } extern "C" { # [doc = " Initializes an existing HMAC context.\n\n @param ctx The HMAC context to initialize.\n @param key    The secret key.\n @param klen   The length of @p key."] pub fn dtls_hmac_init (ctx : * mut dtls_hmac_context_t , key : * const :: std :: os :: raw :: c_uchar , klen : usize) ; } extern "C" { # [doc = " Updates the HMAC context with data from \\p input.\n\n \\param ctx    The HMAC context.\n \\param input  The input data.\n \\param ilen   Size of \\p input."] pub fn dtls_hmac_update (ctx : * mut dtls_hmac_context_t , input : * const :: std :: os :: raw :: c_uchar , ilen : usize) ; } extern "C" { # [doc = " Completes the HMAC generation and writes the result to the given\n output parameter \\c result. The buffer must be large enough to hold\n the message digest created by the actual hash function. If in\n doubt, use \\c DTLS_HMAC_MAX. The function returns the number of\n bytes written to \\c result.\n\n \\param ctx    The HMAC context.\n \\param result Output parameter where the MAC is written to.\n \\return Length of the MAC written to \\p result."] pub fn dtls_hmac_finalize (ctx : * mut dtls_hmac_context_t , result : * mut :: std :: os :: raw :: c_uchar) -> :: std :: os :: raw :: c_int ; } # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_state_t { DTLS_STATE_INIT = 0 , DTLS_STATE_WAIT_CLIENTHELLO = 1 , DTLS_STATE_WAIT_CLIENTCERTIFICATE = 2 , DTLS_STATE_WAIT_CLIENTKEYEXCHANGE = 3 , DTLS_STATE_WAIT_CERTIFICATEVERIFY = 4 , DTLS_STATE_WAIT_CHANGECIPHERSPEC = 5 , DTLS_STATE_WAIT_FINISHED = 6 , DTLS_STATE_FINISHED = 7 , DTLS_STATE_CLIENTHELLO = 8 , DTLS_STATE_WAIT_SERVERCERTIFICATE = 9 , DTLS_STATE_WAIT_SERVERKEYEXCHANGE = 10 , DTLS_STATE_WAIT_SERVERHELLODONE = 11 , DTLS_STATE_CONNECTED = 12 , DTLS_STATE_CLOSING = 13 , DTLS_STATE_CLOSED = 14 , } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_hs_state_t { # [doc = "< send handshake message sequence number counter"] pub mseq_s : u16 , # [doc = "< received handshake message sequence number counter"] pub mseq_r : u16 , # [doc = "< handshake's current read epoch"] pub read_epoch : u16 , pub hs_hash : dtls_hash_ctx , pub ext_hash : dtls_hash_ctx , } # [test] fn bindgen_test_layout_dtls_hs_state_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_hs_state_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_hs_state_t > () , 216usize , concat ! ("Size of: " , stringify ! (dtls_hs_state_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_hs_state_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_hs_state_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . mseq_s) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_hs_state_t) , "::" , stringify ! (mseq_s))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . mseq_r) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (dtls_hs_state_t) , "::" , stringify ! (mseq_r))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . read_epoch) as usize - ptr as usize } , 4usize , concat ! ("Offset of field: " , stringify ! (dtls_hs_state_t) , "::" , stringify ! (read_epoch))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hs_hash) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (dtls_hs_state_t) , "::" , stringify ! (hs_hash))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ext_hash) as usize - ptr as usize } , 112usize , concat ! ("Offset of field: " , stringify ! (dtls_hs_state_t) , "::" , stringify ! (ext_hash))) ; } # [repr (C)] pub struct session_t { # [doc = "< size of addr"] pub size : socklen_t , pub addr : session_t__bindgen_ty_1 , pub ifindex : :: std :: os :: raw :: c_int , } # [repr (C)] pub struct session_t__bindgen_ty_1 { pub sa : __BindgenUnionField < sockaddr > , pub st : __BindgenUnionField < sockaddr_storage > , pub sin : __BindgenUnionField < sockaddr_in > , pub sin6 : __BindgenUnionField < sockaddr_in6 > , pub bindgen_union_field : [u64 ; 16usize] , } # [test] fn bindgen_test_layout_session_t__bindgen_ty_1 () { const UNINIT : :: std :: mem :: MaybeUninit < session_t__bindgen_ty_1 > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < session_t__bindgen_ty_1 > () , 128usize , concat ! ("Size of: " , stringify ! (session_t__bindgen_ty_1))) ; assert_eq ! (:: std :: mem :: align_of :: < session_t__bindgen_ty_1 > () , 8usize , concat ! ("Alignment of " , stringify ! (session_t__bindgen_ty_1))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . sa) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (session_t__bindgen_ty_1) , "::" , stringify ! (sa))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . st) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (session_t__bindgen_ty_1) , "::" , stringify ! (st))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . sin) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (session_t__bindgen_ty_1) , "::" , stringify ! (sin))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . sin6) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (session_t__bindgen_ty_1) , "::" , stringify ! (sin6))) ; } # [test] fn bindgen_test_layout_session_t () { const UNINIT : :: std :: mem :: MaybeUninit < session_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < session_t > () , 144usize , concat ! ("Size of: " , stringify ! (session_t))) ; assert_eq ! (:: std :: mem :: align_of :: < session_t > () , 8usize , concat ! ("Alignment of " , stringify ! (session_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . size) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (session_t) , "::" , stringify ! (size))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . addr) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (session_t) , "::" , stringify ! (addr))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ifindex) as usize - ptr as usize } , 136usize , concat ! ("Offset of field: " , stringify ! (session_t) , "::" , stringify ! (ifindex))) ; } extern "C" { # [doc = " Resets the given session_t object @p sess to its default\n values.  In particular, the member rlen must be initialized to the\n available size for storing addresses.\n\n @param sess The session_t object to initialize."] pub fn dtls_session_init (sess : * mut session_t) ; } extern "C" { # [doc = " Creates a new ::session_t for the given address.\n\n @param addr Address which should be stored in the ::session_t.\n @param addrlen Length of the @p addr.\n @return The new session or @c NULL on error."] pub fn dtls_new_session (addr : * mut sockaddr , addrlen : socklen_t) -> * mut session_t ; } extern "C" { # [doc = " Frees memory allocated for a session using ::dtls_new_session.\n\n @param sess Pointer to a session for which allocated memory should be\n     freed."] pub fn dtls_free_session (sess : * mut session_t) ; } extern "C" { # [doc = " Extracts the address of the given ::session_t.\n\n @param sess Session to extract address for.\n @param addrlen Pointer to memory location where the address\n     length should be stored.\n @return The address or @c NULL if @p sess was @c NULL."] pub fn dtls_session_addr (sess : * mut session_t , addrlen : * mut socklen_t) -> * mut sockaddr ; } extern "C" { # [doc = " Compares the given session objects. This function returns @c 0\n when @p a and @p b differ, @c 1 otherwise."] pub fn dtls_session_equals (a : * const session_t , b : * const session_t) -> :: std :: os :: raw :: c_int ; } pub type aes_u32 = u32 ; # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct rijndael_ctx { pub Nr : :: std :: os :: raw :: c_int , pub ek : [aes_u32 ; 44usize] , } # [test] fn bindgen_test_layout_rijndael_ctx () { const UNINIT : :: std :: mem :: MaybeUninit < rijndael_ctx > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < rijndael_ctx > () , 180usize , concat ! ("Size of: " , stringify ! (rijndael_ctx))) ; assert_eq ! (:: std :: mem :: align_of :: < rijndael_ctx > () , 4usize , concat ! ("Alignment of " , stringify ! (rijndael_ctx))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . Nr) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rijndael_ctx) , "::" , stringify ! (Nr))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ek) as usize - ptr as usize } , 4usize , concat ! ("Offset of field: " , stringify ! (rijndael_ctx) , "::" , stringify ! (ek))) ; } extern "C" { # [doc = " Authenticates and encrypts a message using AES in CCM mode. Please\n see also RFC 3610 for the meaning of \\p M, \\p L, \\p lm and \\p la.\n\n \\param ctx The initialized rijndael_ctx object to be used for AES operations.\n \\param M   The number of authentication octets.\n \\param L   The number of bytes used to encode the message length.\n \\param nonce The nonce value to use. You must provide \\c DTLS_CCM_BLOCKSIZE\n            nonce octets, although only the first \\c 16 - \\p L - 1 are used.\n \\param msg The message to encrypt. The first \\p la octets are additional\n            authentication data that will be cleartext. Note that the\n            encryption operation modifies the contents of \\p msg and adds\n            \\p M bytes MAC. Therefore, the buffer must be at least\n            \\p lm + \\p M bytes large.\n \\param lm  The actual length of \\p msg.\n \\param aad A pointer to the additional authentication data (can be \\c NULL if\n            \\p la is zero).\n \\param la  The number of additional authentication octets (may be zero).\n \\return FIXME"] pub fn dtls_ccm_encrypt_message (ctx : * mut rijndael_ctx , M : usize , L : usize , nonce : * const :: std :: os :: raw :: c_uchar , msg : * mut :: std :: os :: raw :: c_uchar , lm : usize , aad : * const :: std :: os :: raw :: c_uchar , la : usize) -> :: std :: os :: raw :: c_long ; } extern "C" { pub fn dtls_ccm_decrypt_message (ctx : * mut rijndael_ctx , M : usize , L : usize , nonce : * const :: std :: os :: raw :: c_uchar , msg : * mut :: std :: os :: raw :: c_uchar , lm : usize , aad : * const :: std :: os :: raw :: c_uchar , la : usize) -> :: std :: os :: raw :: c_long ; } # [doc = " Type of index in cipher parameter table"] pub type dtls_cipher_index_t = u8 ; # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_crypto_alg { AES128 = 0 , } # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_ecdh_curve { DTLS_ECDH_CURVE_SECP256R1 = 0 , } # [doc = " Crypto context for TLS_PSK_WITH_AES_128_CCM_8 cipher suite."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct aes128_ccm_t { # [doc = "< AES-128 encryption context"] pub ctx : rijndael_ctx , # [doc = "< length of MAC tag (=M)"] pub tag_length : u8 , # [doc = "< number of bytes in length\n   field (= L)"] pub l : u8 , } # [test] fn bindgen_test_layout_aes128_ccm_t () { const UNINIT : :: std :: mem :: MaybeUninit < aes128_ccm_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < aes128_ccm_t > () , 184usize , concat ! ("Size of: " , stringify ! (aes128_ccm_t))) ; assert_eq ! (:: std :: mem :: align_of :: < aes128_ccm_t > () , 4usize , concat ! ("Alignment of " , stringify ! (aes128_ccm_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ctx) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (aes128_ccm_t) , "::" , stringify ! (ctx))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . tag_length) as usize - ptr as usize } , 180usize , concat ! ("Offset of field: " , stringify ! (aes128_ccm_t) , "::" , stringify ! (tag_length))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . l) as usize - ptr as usize } , 181usize , concat ! ("Offset of field: " , stringify ! (aes128_ccm_t) , "::" , stringify ! (l))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_cipher_context_t { # [doc = "< The crypto context"] pub data : aes128_ccm_t , } # [test] fn bindgen_test_layout_dtls_cipher_context_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_cipher_context_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_cipher_context_t > () , 184usize , concat ! ("Size of: " , stringify ! (dtls_cipher_context_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_cipher_context_t > () , 4usize , concat ! ("Alignment of " , stringify ! (dtls_cipher_context_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . data) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_cipher_context_t) , "::" , stringify ! (data))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_handshake_parameters_ecdsa_t { pub own_eph_priv : [uint8 ; 32usize] , pub other_eph_pub_x : [uint8 ; 32usize] , pub other_eph_pub_y : [uint8 ; 32usize] , pub other_pub_x : [uint8 ; 32usize] , pub other_pub_y : [uint8 ; 32usize] , } # [test] fn bindgen_test_layout_dtls_handshake_parameters_ecdsa_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_parameters_ecdsa_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_parameters_ecdsa_t > () , 160usize , concat ! ("Size of: " , stringify ! (dtls_handshake_parameters_ecdsa_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_parameters_ecdsa_t > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_parameters_ecdsa_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . own_eph_priv) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_ecdsa_t) , "::" , stringify ! (own_eph_priv))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . other_eph_pub_x) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_ecdsa_t) , "::" , stringify ! (other_eph_pub_x))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . other_eph_pub_y) as usize - ptr as usize } , 64usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_ecdsa_t) , "::" , stringify ! (other_eph_pub_y))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . other_pub_x) as usize - ptr as usize } , 96usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_ecdsa_t) , "::" , stringify ! (other_pub_x))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . other_pub_y) as usize - ptr as usize } , 128usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_ecdsa_t) , "::" , stringify ! (other_pub_y))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_handshake_parameters_psk_t { pub id_length : u16 , pub identity : [:: std :: os :: raw :: c_uchar ; 32usize] , } # [test] fn bindgen_test_layout_dtls_handshake_parameters_psk_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_parameters_psk_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_parameters_psk_t > () , 34usize , concat ! ("Size of: " , stringify ! (dtls_handshake_parameters_psk_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_parameters_psk_t > () , 2usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_parameters_psk_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . id_length) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_psk_t) , "::" , stringify ! (id_length))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . identity) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_psk_t) , "::" , stringify ! (identity))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct seqnum_t { # [doc = "< current read sequence number"] pub cseq : u64 , # [doc = " bitfield of already received sequence numbers.\n B0 := cseqn, B1 := cseqn -1, ..., B63 := cseqn - 63\n Initially 0, set to 1 (B0) with the first received message of the epoch,\n or -1 (B0..B63) with a verified ClientHello (server-side only)"] pub bitfield : u64 , } # [test] fn bindgen_test_layout_seqnum_t () { const UNINIT : :: std :: mem :: MaybeUninit < seqnum_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < seqnum_t > () , 16usize , concat ! ("Size of: " , stringify ! (seqnum_t))) ; assert_eq ! (:: std :: mem :: align_of :: < seqnum_t > () , 8usize , concat ! ("Alignment of " , stringify ! (seqnum_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cseq) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (seqnum_t) , "::" , stringify ! (cseq))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . bitfield) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (seqnum_t) , "::" , stringify ! (bitfield))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_security_parameters_t { # [doc = "< compression method"] pub compression : dtls_compression_t , # [doc = "< internal index for cipher_suite_params, DTLS_CIPHER_INDEX_NULL for TLS_NULL_WITH_NULL_NULL"] pub cipher_index : dtls_cipher_index_t , # [doc = "< counter for cipher state changes"] pub epoch : u16 , # [doc = "< sequence number of last record sent"] pub rseq : u64 , # [doc = " The key block generated from PRF applied to client and server\n random bytes. The actual size is given by the selected cipher and\n can be calculated using dtls_kb_size(). Use \\c dtls_kb_ macros to\n access the components of the key block."] pub key_block : [uint8 ; 40usize] , # [doc = "<sequence number of last record received"] pub cseq : seqnum_t , } # [test] fn bindgen_test_layout_dtls_security_parameters_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_security_parameters_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_security_parameters_t > () , 72usize , concat ! ("Size of: " , stringify ! (dtls_security_parameters_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_security_parameters_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_security_parameters_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . compression) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_security_parameters_t) , "::" , stringify ! (compression))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cipher_index) as usize - ptr as usize } , 4usize , concat ! ("Offset of field: " , stringify ! (dtls_security_parameters_t) , "::" , stringify ! (cipher_index))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . epoch) as usize - ptr as usize } , 6usize , concat ! ("Offset of field: " , stringify ! (dtls_security_parameters_t) , "::" , stringify ! (epoch))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . rseq) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (dtls_security_parameters_t) , "::" , stringify ! (rseq))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . key_block) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (dtls_security_parameters_t) , "::" , stringify ! (key_block))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cseq) as usize - ptr as usize } , 56usize , concat ! ("Offset of field: " , stringify ! (dtls_security_parameters_t) , "::" , stringify ! (cseq))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct netq_t { _unused : [u8 ; 0] , } # [doc = " Set of user parameters used by the handshake."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_user_parameters_t { # [doc = " The list of cipher suites.\n The list must be terminated by TLS_NULL_WITH_NULL_NULL."] pub cipher_suites : [dtls_cipher_t ; 5usize] , pub _bitfield_align_1 : [u8 ; 0] , pub _bitfield_1 : __BindgenBitfieldUnit < [u8 ; 1usize] > , pub __bindgen_padding_0 : [u8 ; 3usize] , } # [test] fn bindgen_test_layout_dtls_user_parameters_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_user_parameters_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_user_parameters_t > () , 24usize , concat ! ("Size of: " , stringify ! (dtls_user_parameters_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_user_parameters_t > () , 4usize , concat ! ("Alignment of " , stringify ! (dtls_user_parameters_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cipher_suites) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_user_parameters_t) , "::" , stringify ! (cipher_suites))) ; } impl dtls_user_parameters_t { # [inline] pub fn force_extended_master_secret (& self) -> :: std :: os :: raw :: c_uint { unsafe { :: std :: mem :: transmute (self . _bitfield_1 . get (0usize , 1u8) as u32) } } # [inline] pub fn set_force_extended_master_secret (& mut self , val : :: std :: os :: raw :: c_uint) { unsafe { let val : u32 = :: std :: mem :: transmute (val) ; self . _bitfield_1 . set (0usize , 1u8 , val as u64) } } # [inline] pub fn force_renegotiation_info (& self) -> :: std :: os :: raw :: c_uint { unsafe { :: std :: mem :: transmute (self . _bitfield_1 . get (1usize , 1u8) as u32) } } # [inline] pub fn set_force_renegotiation_info (& mut self , val : :: std :: os :: raw :: c_uint) { unsafe { let val : u32 = :: std :: mem :: transmute (val) ; self . _bitfield_1 . set (1usize , 1u8 , val as u64) } } # [inline] pub fn new_bitfield_1 (force_extended_master_secret : :: std :: os :: raw :: c_uint , force_renegotiation_info : :: std :: os :: raw :: c_uint) -> __BindgenBitfieldUnit < [u8 ; 1usize] > { let mut __bindgen_bitfield_unit : __BindgenBitfieldUnit < [u8 ; 1usize] > = Default :: default () ; __bindgen_bitfield_unit . set (0usize , 1u8 , { let force_extended_master_secret : u32 = unsafe { :: std :: mem :: transmute (force_extended_master_secret) } ; force_extended_master_secret as u64 }) ; __bindgen_bitfield_unit . set (1usize , 1u8 , { let force_renegotiation_info : u32 = unsafe { :: std :: mem :: transmute (force_renegotiation_info) } ; force_renegotiation_info as u64 }) ; __bindgen_bitfield_unit } } # [repr (C)] # [derive (Copy , Clone)] pub struct dtls_handshake_parameters_t { pub tmp : dtls_handshake_parameters_t__bindgen_ty_1 , # [doc = "< the packets to reorder"] pub reorder_queue : * mut netq_t , # [doc = "< handshake protocol status"] pub hs_state : dtls_hs_state_t , # [doc = "< compression method"] pub compression : dtls_compression_t , # [doc = "< user parameters"] pub user_parameters : dtls_user_parameters_t , # [doc = "< internal index for cipher_suite_params, DTLS_CIPHER_INDEX_NULL for TLS_NULL_WITH_NULL_NULL"] pub cipher_index : dtls_cipher_index_t , pub _bitfield_align_1 : [u8 ; 0] , pub _bitfield_1 : __BindgenBitfieldUnit < [u8 ; 1usize] > , pub keyx : dtls_handshake_parameters_t__bindgen_ty_2 , } # [repr (C)] # [derive (Copy , Clone)] pub union dtls_handshake_parameters_t__bindgen_ty_1 { pub random : dtls_handshake_parameters_t__bindgen_ty_1_random_t , # [doc = " the session's master secret"] pub master_secret : [uint8 ; 48usize] , } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_handshake_parameters_t__bindgen_ty_1_random_t { # [doc = "< client random gmt and bytes"] pub client : [uint8 ; 32usize] , # [doc = "< server random gmt and bytes"] pub server : [uint8 ; 32usize] , } # [test] fn bindgen_test_layout_dtls_handshake_parameters_t__bindgen_ty_1_random_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_parameters_t__bindgen_ty_1_random_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_parameters_t__bindgen_ty_1_random_t > () , 64usize , concat ! ("Size of: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1_random_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_parameters_t__bindgen_ty_1_random_t > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1_random_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . client) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1_random_t) , "::" , stringify ! (client))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . server) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1_random_t) , "::" , stringify ! (server))) ; } # [test] fn bindgen_test_layout_dtls_handshake_parameters_t__bindgen_ty_1 () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_parameters_t__bindgen_ty_1 > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_parameters_t__bindgen_ty_1 > () , 64usize , concat ! ("Size of: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_parameters_t__bindgen_ty_1 > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . random) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1) , "::" , stringify ! (random))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . master_secret) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_1) , "::" , stringify ! (master_secret))) ; } # [repr (C)] # [derive (Copy , Clone)] pub union dtls_handshake_parameters_t__bindgen_ty_2 { pub ecdsa : dtls_handshake_parameters_ecdsa_t , pub psk : dtls_handshake_parameters_psk_t , } # [test] fn bindgen_test_layout_dtls_handshake_parameters_t__bindgen_ty_2 () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_parameters_t__bindgen_ty_2 > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_parameters_t__bindgen_ty_2 > () , 160usize , concat ! ("Size of: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_2))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_parameters_t__bindgen_ty_2 > () , 2usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_2))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ecdsa) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_2) , "::" , stringify ! (ecdsa))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . psk) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t__bindgen_ty_2) , "::" , stringify ! (psk))) ; } # [test] fn bindgen_test_layout_dtls_handshake_parameters_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_parameters_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_parameters_t > () , 480usize , concat ! ("Size of: " , stringify ! (dtls_handshake_parameters_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_parameters_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_parameters_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . tmp) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (tmp))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . reorder_queue) as usize - ptr as usize } , 64usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (reorder_queue))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hs_state) as usize - ptr as usize } , 72usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (hs_state))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . compression) as usize - ptr as usize } , 288usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (compression))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . user_parameters) as usize - ptr as usize } , 292usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (user_parameters))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cipher_index) as usize - ptr as usize } , 316usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (cipher_index))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . keyx) as usize - ptr as usize } , 318usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_parameters_t) , "::" , stringify ! (keyx))) ; } impl dtls_handshake_parameters_t { # [inline] pub fn do_client_auth (& self) -> :: std :: os :: raw :: c_uint { unsafe { :: std :: mem :: transmute (self . _bitfield_1 . get (0usize , 1u8) as u32) } } # [inline] pub fn set_do_client_auth (& mut self , val : :: std :: os :: raw :: c_uint) { unsafe { let val : u32 = :: std :: mem :: transmute (val) ; self . _bitfield_1 . set (0usize , 1u8 , val as u64) } } # [inline] pub fn extended_master_secret (& self) -> :: std :: os :: raw :: c_uint { unsafe { :: std :: mem :: transmute (self . _bitfield_1 . get (1usize , 1u8) as u32) } } # [inline] pub fn set_extended_master_secret (& mut self , val : :: std :: os :: raw :: c_uint) { unsafe { let val : u32 = :: std :: mem :: transmute (val) ; self . _bitfield_1 . set (1usize , 1u8 , val as u64) } } # [inline] pub fn renegotiation_info (& self) -> :: std :: os :: raw :: c_uint { unsafe { :: std :: mem :: transmute (self . _bitfield_1 . get (2usize , 1u8) as u32) } } # [inline] pub fn set_renegotiation_info (& mut self , val : :: std :: os :: raw :: c_uint) { unsafe { let val : u32 = :: std :: mem :: transmute (val) ; self . _bitfield_1 . set (2usize , 1u8 , val as u64) } } # [inline] pub fn new_bitfield_1 (do_client_auth : :: std :: os :: raw :: c_uint , extended_master_secret : :: std :: os :: raw :: c_uint , renegotiation_info : :: std :: os :: raw :: c_uint) -> __BindgenBitfieldUnit < [u8 ; 1usize] > { let mut __bindgen_bitfield_unit : __BindgenBitfieldUnit < [u8 ; 1usize] > = Default :: default () ; __bindgen_bitfield_unit . set (0usize , 1u8 , { let do_client_auth : u32 = unsafe { :: std :: mem :: transmute (do_client_auth) } ; do_client_auth as u64 }) ; __bindgen_bitfield_unit . set (1usize , 1u8 , { let extended_master_secret : u32 = unsafe { :: std :: mem :: transmute (extended_master_secret) } ; extended_master_secret as u64 }) ; __bindgen_bitfield_unit . set (2usize , 1u8 , { let renegotiation_info : u32 = unsafe { :: std :: mem :: transmute (renegotiation_info) } ; renegotiation_info as u64 }) ; __bindgen_bitfield_unit } } extern "C" { # [doc = " Expands the secret and key to a block of DTLS_HMAC_MAX\n size according to the algorithm specified in section 5 of\n RFC 4346.\n\n \\param h       Identifier of the hash function to use.\n \\param key     The secret.\n \\param keylen  Length of \\p key.\n \\param label    The label.\n \\param labellen Length of \\p label.\n \\param random1 The random pt 1.\n \\param random1len Length of \\p random1.\n \\param random2 The random pt 2.\n \\param random2len Length of \\p random2.\n \\param buf     Output buffer where the result is XORed into\n \\param buflen  The available space for \\p buf\n\n \\return The actual number of bytes written to \\p buf or 0\n on error."] pub fn dtls_p_hash (h : dtls_hashfunc_t , key : * const :: std :: os :: raw :: c_uchar , keylen : usize , label : * const :: std :: os :: raw :: c_uchar , labellen : usize , random1 : * const :: std :: os :: raw :: c_uchar , random1len : usize , random2 : * const :: std :: os :: raw :: c_uchar , random2len : usize , buf : * mut :: std :: os :: raw :: c_uchar , buflen : usize) -> usize ; } extern "C" { # [doc = " This function implements the TLS PRF for DTLS_VERSION. For version\n 1.0, the PRF is P_MD5 ^ P_SHA1 while version 1.2 uses\n P_SHA256. Currently, the actual PRF is selected at compile time."] pub fn dtls_prf (key : * const :: std :: os :: raw :: c_uchar , keylen : usize , label : * const :: std :: os :: raw :: c_uchar , labellen : usize , random1 : * const :: std :: os :: raw :: c_uchar , random1len : usize , random2 : * const :: std :: os :: raw :: c_uchar , random2len : usize , buf : * mut :: std :: os :: raw :: c_uchar , buflen : usize) -> usize ; } extern "C" { # [doc = " Calculates MAC for record + cleartext packet and places the result\n in \\p buf. The given \\p hmac_ctx must be initialized with the HMAC\n function to use and the proper secret. As the DTLS mac calculation\n requires data from the record header, \\p record must point to a\n buffer of at least \\c sizeof(dtls_record_header_t) bytes. Usually,\n the remaining packet will be encrypted, therefore, the cleartext\n is passed separately in \\p packet.\n\n \\param hmac_ctx  The HMAC context to use for MAC calculation.\n \\param record    The record header.\n \\param packet    Cleartext payload to apply the MAC to.\n \\param length    Size of \\p packet.\n \\param buf       A result buffer that is large enough to hold\n                  the generated digest."] pub fn dtls_mac (hmac_ctx : * mut dtls_hmac_context_t , record : * const :: std :: os :: raw :: c_uchar , packet : * const :: std :: os :: raw :: c_uchar , length : usize , buf : * mut :: std :: os :: raw :: c_uchar) ; } # [doc = " Represents AEAD parameters for dtls_encrypt_params()."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_ccm_params_t { # [doc = "< must be exactly 15 - l bytes"] pub nonce : * const u8 , # [doc = "< the MAC tag length (M)"] pub tag_length : u8 , # [doc = "< number of bytes in the length\n   field (L)"] pub l : u8 , } # [test] fn bindgen_test_layout_dtls_ccm_params_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_ccm_params_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_ccm_params_t > () , 16usize , concat ! ("Size of: " , stringify ! (dtls_ccm_params_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_ccm_params_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_ccm_params_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . nonce) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_ccm_params_t) , "::" , stringify ! (nonce))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . tag_length) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (dtls_ccm_params_t) , "::" , stringify ! (tag_length))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . l) as usize - ptr as usize } , 9usize , concat ! ("Offset of field: " , stringify ! (dtls_ccm_params_t) , "::" , stringify ! (l))) ; } extern "C" { # [doc = " Encrypts the specified \\p src of given \\p length, writing the\n result to \\p buf. The cipher implementation may add more data to\n the result buffer such as an initialization vector or padding\n (e.g. for block ciphers in CBC mode). The caller therefore must\n ensure that \\p buf provides sufficient storage to hold the result.\n Usually this means ( 2 + \\p length / blocksize ) * blocksize.  The\n function returns a value less than zero on error or otherwise the\n number of bytes written. The provided \\p src and \\p buf may overlap.\n\n \\param params AEAD parameters: Nonce, M and L.\n \\param src    The data to encrypt.\n \\param length The actual size of of \\p src.\n \\param buf    The result buffer. \\p src and \\p buf must not\n               overlap.\n \\param key     The key to use\n \\param keylen  The length of the key\n \\param aad    additional data for AEAD ciphers\n \\param aad_length actual size of @p aad\n \\return The number of encrypted bytes on success, less than zero\n         otherwise."] pub fn dtls_encrypt_params (params : * const dtls_ccm_params_t , src : * const :: std :: os :: raw :: c_uchar , length : usize , buf : * mut :: std :: os :: raw :: c_uchar , key : * const :: std :: os :: raw :: c_uchar , keylen : usize , aad : * const :: std :: os :: raw :: c_uchar , aad_length : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Encrypts the specified \\p src of given \\p length, writing the\n result to \\p buf. The cipher implementation may add more data to\n the result buffer such as an initialization vector or padding\n (e.g. for block ciphers in CBC mode). The caller therefore must\n ensure that \\p buf provides sufficient storage to hold the result.\n Usually this means ( 2 + \\p length / blocksize ) * blocksize.  The\n function returns a value less than zero on error or otherwise the\n number of bytes written. The provided \\p src and \\p buf may overlap.\n\n \\param src    The data to encrypt.\n \\param length The actual size of of \\p src.\n \\param buf    The result buffer.\n \\param nonce  The nonce used for encryption. Must be exactly 13\n               bytes, because L is set to 2.\n \\param key    The key to use\n \\param keylen The length of the key\n \\param aad    additional data for AEAD ciphers\n \\param aad_length actual size of @p aad\n\n \\return The number of encrypted bytes on success, less than zero\n         otherwise.\n\n \\deprecated dtls_encrypt() always sets M=8, L=2. Use\n             dtls_encrypt_params() instead."] pub fn dtls_encrypt (src : * const :: std :: os :: raw :: c_uchar , length : usize , buf : * mut :: std :: os :: raw :: c_uchar , nonce : * const :: std :: os :: raw :: c_uchar , key : * const :: std :: os :: raw :: c_uchar , keylen : usize , aad : * const :: std :: os :: raw :: c_uchar , aad_length : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Decrypts the given buffer \\p src of given \\p length, writing the\n result to \\p buf. The function returns \\c -1 in case of an error,\n or the number of bytes written. Note that for block ciphers, \\p\n length must be a multiple of the cipher's block size. A return\n value between \\c 0 and the actual length indicates that only \\c n-1\n block have been processed. The provided \\p src and \\p buf may overlap.\n\n \\param params AEAD parameters: Nonce, M and L.\n \\param src     The input buffer to decrypt.\n \\param length  The length of the input buffer.\n \\param buf     The result buffer.\n \\param key     The key to use\n \\param keylen  The length of the key\n \\param aad     additional authentication data for AEAD ciphers\n \\param aad_length actual size of @p aad\n\n \\return Less than zero on error, the number of decrypted bytes\n         otherwise."] pub fn dtls_decrypt_params (params : * const dtls_ccm_params_t , src : * const :: std :: os :: raw :: c_uchar , length : usize , buf : * mut :: std :: os :: raw :: c_uchar , key : * const :: std :: os :: raw :: c_uchar , keylen : usize , aad : * const :: std :: os :: raw :: c_uchar , aad_length : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Decrypts the given buffer \\p src of given \\p length, writing the\n result to \\p buf. The function returns \\c -1 in case of an error,\n or the number of bytes written. Note that for block ciphers, \\p\n length must be a multiple of the cipher's block size. A return\n value between \\c 0 and the actual length indicates that only \\c n-1\n block have been processed. The provided \\p src and \\p buf may overlap.\n\n \\param src     The buffer to decrypt.\n \\param length  The length of the input buffer.\n \\param buf     The result buffer.\n \\param nonce  The nonce used for encryption. Must be exactly 13\n               bytes, because L is set to 2.\n \\param key     The key to use\n \\param keylen  The key to use\n \\param a_data  additional authentication data for AEAD ciphers\n \\param a_data_length actual size of @p aad\n \\return Less than zero on error, the number of decrypted bytes\n         otherwise.\n\n \\deprecated dtls_decrypt() always sets M=8, L=2. Use\n             dtls_decrypt_params() instead."] pub fn dtls_decrypt (src : * const :: std :: os :: raw :: c_uchar , length : usize , buf : * mut :: std :: os :: raw :: c_uchar , nonce : * const :: std :: os :: raw :: c_uchar , key : * const :: std :: os :: raw :: c_uchar , keylen : usize , a_data : * const :: std :: os :: raw :: c_uchar , a_data_length : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Generates pre_master_sercet from given PSK and fills the result\n according to the \"plain PSK\" case in section 2 of RFC 4279.\n Diffie-Hellman and RSA key exchange are currently not supported.\n\n @param key    The shared key.\n @param keylen Length of @p key in bytes.\n @param result The derived pre master secret.\n @param result_len The length of derived pre master secret.\n @return The actual length of @p result."] pub fn dtls_psk_pre_master_secret (key : * mut :: std :: os :: raw :: c_uchar , keylen : usize , result : * mut :: std :: os :: raw :: c_uchar , result_len : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { pub fn dtls_ecdh_pre_master_secret (priv_key : * mut :: std :: os :: raw :: c_uchar , pub_key_x : * mut :: std :: os :: raw :: c_uchar , pub_key_y : * mut :: std :: os :: raw :: c_uchar , key_size : usize , result : * mut :: std :: os :: raw :: c_uchar , result_len : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { pub fn dtls_ecdsa_generate_key (priv_key : * mut :: std :: os :: raw :: c_uchar , pub_key_x : * mut :: std :: os :: raw :: c_uchar , pub_key_y : * mut :: std :: os :: raw :: c_uchar , key_size : usize) ; } extern "C" { pub fn dtls_ecdsa_create_sig_hash (priv_key : * const :: std :: os :: raw :: c_uchar , key_size : usize , sign_hash : * const :: std :: os :: raw :: c_uchar , sign_hash_size : usize , point_r : * mut u32 , point_s : * mut u32) ; } extern "C" { pub fn dtls_ecdsa_create_sig (priv_key : * const :: std :: os :: raw :: c_uchar , key_size : usize , client_random : * const :: std :: os :: raw :: c_uchar , client_random_size : usize , server_random : * const :: std :: os :: raw :: c_uchar , server_random_size : usize , keyx_params : * const :: std :: os :: raw :: c_uchar , keyx_params_size : usize , point_r : * mut u32 , point_s : * mut u32) ; } extern "C" { pub fn dtls_ecdsa_verify_sig_hash (pub_key_x : * const :: std :: os :: raw :: c_uchar , pub_key_y : * const :: std :: os :: raw :: c_uchar , key_size : usize , sign_hash : * const :: std :: os :: raw :: c_uchar , sign_hash_size : usize , result_r : * mut :: std :: os :: raw :: c_uchar , result_s : * mut :: std :: os :: raw :: c_uchar) -> :: std :: os :: raw :: c_int ; } extern "C" { pub fn dtls_ecdsa_verify_sig (pub_key_x : * const :: std :: os :: raw :: c_uchar , pub_key_y : * const :: std :: os :: raw :: c_uchar , key_size : usize , client_random : * const :: std :: os :: raw :: c_uchar , client_random_size : usize , server_random : * const :: std :: os :: raw :: c_uchar , server_random_size : usize , keyx_params : * const :: std :: os :: raw :: c_uchar , keyx_params_size : usize , result_r : * mut :: std :: os :: raw :: c_uchar , result_s : * mut :: std :: os :: raw :: c_uchar) -> :: std :: os :: raw :: c_int ; } extern "C" { pub fn dtls_ec_key_asn1_from_uint32 (key : * const u32 , key_size : usize , buf : * mut :: std :: os :: raw :: c_uchar) -> :: std :: os :: raw :: c_int ; } extern "C" { pub fn dtls_handshake_new () -> * mut dtls_handshake_parameters_t ; } extern "C" { pub fn dtls_handshake_free (handshake : * mut dtls_handshake_parameters_t) ; } extern "C" { pub fn dtls_security_new () -> * mut dtls_security_parameters_t ; } extern "C" { pub fn dtls_security_free (security : * mut dtls_security_parameters_t) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct UT_hash_bucket { pub hh_head : * mut UT_hash_handle , pub count : :: std :: os :: raw :: c_uint , pub expand_mult : :: std :: os :: raw :: c_uint , } # [test] fn bindgen_test_layout_UT_hash_bucket () { const UNINIT : :: std :: mem :: MaybeUninit < UT_hash_bucket > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < UT_hash_bucket > () , 16usize , concat ! ("Size of: " , stringify ! (UT_hash_bucket))) ; assert_eq ! (:: std :: mem :: align_of :: < UT_hash_bucket > () , 8usize , concat ! ("Alignment of " , stringify ! (UT_hash_bucket))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hh_head) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (UT_hash_bucket) , "::" , stringify ! (hh_head))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . count) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (UT_hash_bucket) , "::" , stringify ! (count))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . expand_mult) as usize - ptr as usize } , 12usize , concat ! ("Offset of field: " , stringify ! (UT_hash_bucket) , "::" , stringify ! (expand_mult))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct UT_hash_table { pub buckets : * mut UT_hash_bucket , pub num_buckets : :: std :: os :: raw :: c_uint , pub log2_num_buckets : :: std :: os :: raw :: c_uint , pub num_items : :: std :: os :: raw :: c_uint , pub tail : * mut UT_hash_handle , pub hho : isize , pub ideal_chain_maxlen : :: std :: os :: raw :: c_uint , pub nonideal_items : :: std :: os :: raw :: c_uint , pub ineff_expands : :: std :: os :: raw :: c_uint , pub noexpand : :: std :: os :: raw :: c_uint , pub signature : u32 , } # [test] fn bindgen_test_layout_UT_hash_table () { const UNINIT : :: std :: mem :: MaybeUninit < UT_hash_table > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < UT_hash_table > () , 64usize , concat ! ("Size of: " , stringify ! (UT_hash_table))) ; assert_eq ! (:: std :: mem :: align_of :: < UT_hash_table > () , 8usize , concat ! ("Alignment of " , stringify ! (UT_hash_table))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . buckets) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (buckets))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . num_buckets) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (num_buckets))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . log2_num_buckets) as usize - ptr as usize } , 12usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (log2_num_buckets))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . num_items) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (num_items))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . tail) as usize - ptr as usize } , 24usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (tail))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hho) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (hho))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ideal_chain_maxlen) as usize - ptr as usize } , 40usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (ideal_chain_maxlen))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . nonideal_items) as usize - ptr as usize } , 44usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (nonideal_items))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . ineff_expands) as usize - ptr as usize } , 48usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (ineff_expands))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . noexpand) as usize - ptr as usize } , 52usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (noexpand))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . signature) as usize - ptr as usize } , 56usize , concat ! ("Offset of field: " , stringify ! (UT_hash_table) , "::" , stringify ! (signature))) ; } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct UT_hash_handle { pub tbl : * mut UT_hash_table , pub prev : * mut :: std :: os :: raw :: c_void , pub next : * mut :: std :: os :: raw :: c_void , pub hh_prev : * mut UT_hash_handle , pub hh_next : * mut UT_hash_handle , pub key : * mut :: std :: os :: raw :: c_void , pub keylen : :: std :: os :: raw :: c_uint , pub hashv : :: std :: os :: raw :: c_uint , } # [test] fn bindgen_test_layout_UT_hash_handle () { const UNINIT : :: std :: mem :: MaybeUninit < UT_hash_handle > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < UT_hash_handle > () , 56usize , concat ! ("Size of: " , stringify ! (UT_hash_handle))) ; assert_eq ! (:: std :: mem :: align_of :: < UT_hash_handle > () , 8usize , concat ! ("Alignment of " , stringify ! (UT_hash_handle))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . tbl) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (tbl))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . prev) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (prev))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . next) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (next))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hh_prev) as usize - ptr as usize } , 24usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (hh_prev))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hh_next) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (hh_next))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . key) as usize - ptr as usize } , 40usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (key))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . keylen) as usize - ptr as usize } , 48usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (keylen))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hashv) as usize - ptr as usize } , 52usize , concat ! ("Offset of field: " , stringify ! (UT_hash_handle) , "::" , stringify ! (hashv))) ; } # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_peer_type { DTLS_CLIENT = 0 , DTLS_SERVER = 1 , } # [doc = " Holds security parameters, local state and the transport address\n for each peer."] # [repr (C)] pub struct dtls_peer_t { pub hh : UT_hash_handle , # [doc = "< peer address and local interface"] pub session : session_t , # [doc = "< denotes if this host is DTLS_CLIENT or DTLS_SERVER"] pub role : dtls_peer_type , # [doc = "< DTLS engine state"] pub state : dtls_state_t , # [doc = "< optional next handshake message, DTLS_HT_NO_OPTIONAL_MESSAGE, if no optional message is expected."] pub optional_handshake_message : i16 , pub security_params : [* mut dtls_security_parameters_t ; 2usize] , pub handshake_params : * mut dtls_handshake_parameters_t , } # [test] fn bindgen_test_layout_dtls_peer_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_peer_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_peer_t > () , 240usize , concat ! ("Size of: " , stringify ! (dtls_peer_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_peer_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_peer_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . hh) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (hh))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . session) as usize - ptr as usize } , 56usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (session))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . role) as usize - ptr as usize } , 200usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (role))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . state) as usize - ptr as usize } , 204usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (state))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . optional_handshake_message) as usize - ptr as usize } , 208usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (optional_handshake_message))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . security_params) as usize - ptr as usize } , 216usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (security_params))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . handshake_params) as usize - ptr as usize } , 232usize , concat ! ("Offset of field: " , stringify ! (dtls_peer_t) , "::" , stringify ! (handshake_params))) ; } # [doc = " Holds ClientHello's sequence numbers for the stateless address verification."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_ephemeral_peer_t { # [doc = "< peer address and local interface"] pub session : * mut session_t , # [doc = "< ClientHello record sequence number"] pub rseq : u64 , # [doc = "< ClientHello handshake message sequence number"] pub mseq : u16 , } # [test] fn bindgen_test_layout_dtls_ephemeral_peer_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_ephemeral_peer_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_ephemeral_peer_t > () , 24usize , concat ! ("Size of: " , stringify ! (dtls_ephemeral_peer_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_ephemeral_peer_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_ephemeral_peer_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . session) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_ephemeral_peer_t) , "::" , stringify ! (session))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . rseq) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (dtls_ephemeral_peer_t) , "::" , stringify ! (rseq))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . mseq) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (dtls_ephemeral_peer_t) , "::" , stringify ! (mseq))) ; } extern "C" { # [doc = " Creates a new peer for given @p session. The current configuration\n is initialized with the cipher suite TLS_NULL_WITH_NULL_NULL (i.e.\n no security at all). This function returns a pointer to the new\n peer or NULL on error. The caller is responsible for releasing the\n storage allocated for this peer using dtls_free_peer().\n\n @param session  The remote peer's address and local interface index.\n @return A pointer to a newly created and initialized peer object\n or NULL on error."] pub fn dtls_new_peer (session : * const session_t) -> * mut dtls_peer_t ; } extern "C" { # [doc = " Releases the storage allocated to @p peer."] pub fn dtls_free_peer (peer : * mut dtls_peer_t) ; } # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_alert_level_t { DTLS_ALERT_LEVEL_WARNING = 1 , DTLS_ALERT_LEVEL_FATAL = 2 , } # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_alert_t { DTLS_ALERT_CLOSE_NOTIFY = 0 , DTLS_ALERT_UNEXPECTED_MESSAGE = 10 , DTLS_ALERT_BAD_RECORD_MAC = 20 , DTLS_ALERT_RECORD_OVERFLOW = 22 , DTLS_ALERT_DECOMPRESSION_FAILURE = 30 , DTLS_ALERT_HANDSHAKE_FAILURE = 40 , DTLS_ALERT_BAD_CERTIFICATE = 42 , DTLS_ALERT_UNSUPPORTED_CERTIFICATE = 43 , DTLS_ALERT_CERTIFICATE_REVOKED = 44 , DTLS_ALERT_CERTIFICATE_EXPIRED = 45 , DTLS_ALERT_CERTIFICATE_UNKNOWN = 46 , DTLS_ALERT_ILLEGAL_PARAMETER = 47 , DTLS_ALERT_UNKNOWN_CA = 48 , DTLS_ALERT_ACCESS_DENIED = 49 , DTLS_ALERT_DECODE_ERROR = 50 , DTLS_ALERT_DECRYPT_ERROR = 51 , DTLS_ALERT_PROTOCOL_VERSION = 70 , DTLS_ALERT_INSUFFICIENT_SECURITY = 71 , DTLS_ALERT_INTERNAL_ERROR = 80 , DTLS_ALERT_USER_CANCELED = 90 , DTLS_ALERT_NO_RENEGOTIATION = 100 , DTLS_ALERT_UNSUPPORTED_EXTENSION = 110 , } pub type clock_time_t = u32 ; pub type dtls_tick_t = clock_time_t ; extern "C" { pub fn dtls_clock_init () ; } extern "C" { pub fn dtls_ticks (t : * mut dtls_tick_t) ; } # [repr (u32)] # [non_exhaustive] # [derive (Debug , Copy , Clone , Hash , PartialEq , Eq)] pub enum dtls_credentials_type_t { DTLS_PSK_HINT = 0 , DTLS_PSK_IDENTITY = 1 , DTLS_PSK_KEY = 2 , } # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_ecdsa_key_t { pub curve : dtls_ecdh_curve , pub priv_key : * const :: std :: os :: raw :: c_uchar , # [doc = " < private key as bytes >"] pub pub_key_x : * const :: std :: os :: raw :: c_uchar , # [doc = " < x part of the public key for the given private key >"] pub pub_key_y : * const :: std :: os :: raw :: c_uchar , } # [test] fn bindgen_test_layout_dtls_ecdsa_key_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_ecdsa_key_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_ecdsa_key_t > () , 32usize , concat ! ("Size of: " , stringify ! (dtls_ecdsa_key_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_ecdsa_key_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_ecdsa_key_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . curve) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_ecdsa_key_t) , "::" , stringify ! (curve))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . priv_key) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (dtls_ecdsa_key_t) , "::" , stringify ! (priv_key))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . pub_key_x) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (dtls_ecdsa_key_t) , "::" , stringify ! (pub_key_x))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . pub_key_y) as usize - ptr as usize } , 24usize , concat ! ("Offset of field: " , stringify ! (dtls_ecdsa_key_t) , "::" , stringify ! (pub_key_y))) ; } # [doc = " This structure contains callback functions used by tinydtls to\n communicate with the application. At least the write function must\n be provided. It is called by the DTLS state machine to send packets\n over the network. The read function is invoked to deliver decrypted\n and verfified application data. The third callback is an event\n handler function that is called when alert messages are encountered\n or events generated by the library have occured."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_handler_t { # [doc = " Called from dtls_handle_message() to send DTLS packets over the\n network. The callback function must use the network interface\n denoted by session->ifindex to send the data.\n\n @param ctx  The current DTLS context.\n @param session The session object, including the address of the\n              remote peer where the data shall be sent.\n @param buf  The data to send.\n @param len  The actual length of @p buf.\n @return The callback function must return the number of bytes\n         that were sent, or a value less than zero to indicate an\n         error."] pub write : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * mut session_t , buf : * mut uint8 , len : usize) -> :: std :: os :: raw :: c_int > , # [doc = " Called from dtls_handle_message() deliver application data that was\n received on the given session. The data is delivered only after\n decryption and verification have succeeded.\n\n @param ctx  The current DTLS context.\n @param session The session object, including the address of the\n              data's origin.\n @param buf  The received data packet.\n @param len  The actual length of @p buf.\n @return ignored"] pub read : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * mut session_t , buf : * mut uint8 , len : usize) -> :: std :: os :: raw :: c_int > , # [doc = " The event handler is called when a message from the alert\n protocol is received or the state of the DTLS session changes.\n\n @param ctx     The current dtls context.\n @param session The session object that was affected.\n @param level   The alert level or @c 0 when an event ocurred that\n                is not an alert.\n @param code    Values less than @c 256 indicate alerts, while\n                @c 256 or greater indicate internal DTLS session changes.\n @return ignored"] pub event : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * mut session_t , level : dtls_alert_level_t , code : :: std :: os :: raw :: c_ushort) -> :: std :: os :: raw :: c_int > , # [doc = " Called during handshake to get the user parameter.\n\n @param ctx     The current dtls context.\n @param session The session where the cipher suites will be used.\n @param parameters The pointer to user parameters.\n                   The user parameters are initialized with the default\n                   values."] pub get_user_parameters : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * mut session_t , parameters : * mut dtls_user_parameters_t) > , # [doc = " Called during handshake to get information related to the\n psk key exchange. The type of information requested is\n indicated by @p type which will be one of DTLS_PSK_HINT,\n DTLS_PSK_IDENTITY, or DTLS_PSK_KEY. The called function\n must store the requested item in the buffer @p result of\n size @p result_length. On success, the function must return\n the actual number of bytes written to @p result, of a\n value less than zero on error. The parameter @p desc may\n contain additional request information (e.g. the psk_identity\n for which a key is requested when @p type == @c DTLS_PSK_KEY.\n\n @param ctx     The current dtls context.\n @param session The session where the key will be used.\n @param type    The type of the requested information.\n @param desc    Additional request information\n @param desc_len The actual length of desc.\n @param result  Must be filled with the requested information.\n @param result_length  Maximum size of @p result.\n @return The number of bytes written to @p result or a value\n         less than zero on error."] pub get_psk_info : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * const session_t , type_ : dtls_credentials_type_t , desc : * const :: std :: os :: raw :: c_uchar , desc_len : usize , result : * mut :: std :: os :: raw :: c_uchar , result_length : usize) -> :: std :: os :: raw :: c_int > , # [doc = " Called during handshake to get the server's or client's ecdsa\n key used to authenticate this server or client in this\n session. If found, the key must be stored in @p result and\n the return value must be @c 0. If not found, @p result is\n undefined and the return value must be less than zero.\n\n If ECDSA should not be supported, set this pointer to NULL.\n\n Implement this if you want to provide your own certificate to\n the other peer. This is mandatory for a server providing ECDSA\n support and optional for a client. A client doing DTLS client\n authentication has to implementing this callback.\n\n @param ctx     The current dtls context.\n @param session The session where the key will be used.\n @param result  Must be set to the key object to used for the given\n                session.\n @return @c 0 if result is set, or less than zero on error."] pub get_ecdsa_key : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * const session_t , result : * mut * const dtls_ecdsa_key_t) -> :: std :: os :: raw :: c_int > , # [doc = " Called during handshake to check the peer's pubic key in this\n session. If the public key matches the session and should be\n considerated valid the return value must be @c 0. If not valid,\n the return value must be less than zero.\n\n If ECDSA should not be supported, set this pointer to NULL.\n\n Implement this if you want to verify the other peers public key.\n This is mandatory for a DTLS client doing based ECDSA\n authentication. A server implementing this will request the\n client to do DTLS client authentication.\n\n @param ctx          The current dtls context.\n @param session      The session where the key will be used.\n @param other_pub_x  x component of the public key.\n @param other_pub_y  y component of the public key.\n @return @c 0 if public key matches, or less than zero on error.\n error codes:\n   return dtls_alert_fatal_create(DTLS_ALERT_BAD_CERTIFICATE);\n   return dtls_alert_fatal_create(DTLS_ALERT_UNSUPPORTED_CERTIFICATE);\n   return dtls_alert_fatal_create(DTLS_ALERT_CERTIFICATE_REVOKED);\n   return dtls_alert_fatal_create(DTLS_ALERT_CERTIFICATE_EXPIRED);\n   return dtls_alert_fatal_create(DTLS_ALERT_CERTIFICATE_UNKNOWN);\n   return dtls_alert_fatal_create(DTLS_ALERT_UNKNOWN_CA);"] pub verify_ecdsa_key : :: std :: option :: Option < unsafe extern "C" fn (ctx : * mut dtls_context_t , session : * const session_t , other_pub_x : * const :: std :: os :: raw :: c_uchar , other_pub_y : * const :: std :: os :: raw :: c_uchar , key_size : usize) -> :: std :: os :: raw :: c_int > , } # [test] fn bindgen_test_layout_dtls_handler_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handler_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handler_t > () , 56usize , concat ! ("Size of: " , stringify ! (dtls_handler_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handler_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_handler_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . write) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (write))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . read) as usize - ptr as usize } , 8usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (read))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . event) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (event))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . get_user_parameters) as usize - ptr as usize } , 24usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (get_user_parameters))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . get_psk_info) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (get_psk_info))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . get_ecdsa_key) as usize - ptr as usize } , 40usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (get_ecdsa_key))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . verify_ecdsa_key) as usize - ptr as usize } , 48usize , concat ! ("Offset of field: " , stringify ! (dtls_handler_t) , "::" , stringify ! (verify_ecdsa_key))) ; } # [doc = " Holds global information of the DTLS engine."] # [repr (C)] # [derive (Debug , Copy , Clone)] pub struct dtls_context_t { pub cookie_secret : [:: std :: os :: raw :: c_uchar ; 12usize] , # [doc = "< the time the secret has been generated"] pub cookie_secret_age : clock_time_t , # [doc = "< peer hash map"] pub peers : * mut dtls_peer_t , # [doc = "< the packets to send"] pub sendqueue : * mut netq_t , # [doc = "< application-specific data"] pub app : * mut :: std :: os :: raw :: c_void , # [doc = "< callback handlers"] pub h : * mut dtls_handler_t , } # [test] fn bindgen_test_layout_dtls_context_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_context_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_context_t > () , 48usize , concat ! ("Size of: " , stringify ! (dtls_context_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_context_t > () , 8usize , concat ! ("Alignment of " , stringify ! (dtls_context_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cookie_secret) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_context_t) , "::" , stringify ! (cookie_secret))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cookie_secret_age) as usize - ptr as usize } , 12usize , concat ! ("Offset of field: " , stringify ! (dtls_context_t) , "::" , stringify ! (cookie_secret_age))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . peers) as usize - ptr as usize } , 16usize , concat ! ("Offset of field: " , stringify ! (dtls_context_t) , "::" , stringify ! (peers))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . sendqueue) as usize - ptr as usize } , 24usize , concat ! ("Offset of field: " , stringify ! (dtls_context_t) , "::" , stringify ! (sendqueue))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . app) as usize - ptr as usize } , 32usize , concat ! ("Offset of field: " , stringify ! (dtls_context_t) , "::" , stringify ! (app))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . h) as usize - ptr as usize } , 40usize , concat ! ("Offset of field: " , stringify ! (dtls_context_t) , "::" , stringify ! (h))) ; } extern "C" { # [doc = " This function initializes the tinyDTLS memory management and must\n be called first."] pub fn dtls_init () ; } extern "C" { # [doc = " Creates a new context object. The storage allocated for the new\n object must be released with dtls_free_context()."] pub fn dtls_new_context (app_data : * mut :: std :: os :: raw :: c_void) -> * mut dtls_context_t ; } extern "C" { # [doc = " Releases any storage that has been allocated for \\p ctx."] pub fn dtls_free_context (ctx : * mut dtls_context_t) ; } extern "C" { # [doc = " Establishes a DTLS channel with the specified remote peer @p dst.\n This function returns @c 0 if that channel already exists, a value\n greater than zero when a new ClientHello message was sent, and\n a value less than zero on error.\n\n @param ctx    The DTLS context to use.\n @param dst    The remote party to connect to.\n @return A value less than zero on error, greater or equal otherwise."] pub fn dtls_connect (ctx : * mut dtls_context_t , dst : * const session_t) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Establishes a DTLS channel with the specified remote peer.\n This function returns @c 0 if that channel already exists and a renegotiate\n was initiated, a value greater than zero when a new ClientHello message was\n sent, and a value less than zero on error.\n\n @param ctx    The DTLS context to use.\n @param peer   The peer object that describes the session.\n @return A value less than zero on error, greater or equal otherwise."] pub fn dtls_connect_peer (ctx : * mut dtls_context_t , peer : * mut dtls_peer_t) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Closes the DTLS connection associated with @p remote. This function\n returns zero on success, and a value less than zero on error."] pub fn dtls_close (ctx : * mut dtls_context_t , remote : * const session_t) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Writes the application data given in multiple buffers to the peer\n specified by @p session.\n\n @param ctx      The DTLS context to use.\n @param session  The remote transport address and local interface.\n @param buf_array     Array of buffers with the data to write.\n @param buf_len_array The length of the arrays in @p buf_array.\n @param buf_array_len The number of data arrays.\n\n @return The number of bytes written, @c -1 on error or @c 0\n         if the peer already exists but is not connected yet."] pub fn dtls_writev (ctx : * mut dtls_context_t , session : * mut session_t , buf_array : * mut * mut uint8 , buf_len_array : * mut usize , buf_array_len : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Writes the application data given in @p buf to the peer specified\n by @p session.\n\n @param ctx      The DTLS context to use.\n @param session  The remote transport address and local interface.\n @param buf      The data to write.\n @param len      The actual length of @p data.\n\n @return The number of bytes written, @c -1 on error or @c 0\n         if the peer already exists but is not connected yet."] pub fn dtls_write (ctx : * mut dtls_context_t , session : * mut session_t , buf : * mut uint8 , len : usize) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Checks sendqueue of given DTLS context object for any outstanding\n packets to be transmitted.\n\n @param context The DTLS context object to use.\n @param next    If not NULL, @p next is filled with the timestamp\n  of the next scheduled retransmission, or @c 0 when no packets are\n  waiting."] pub fn dtls_check_retransmit (context : * mut dtls_context_t , next : * mut clock_time_t) ; } # [doc = " Generic header structure of the DTLS record layer."] # [repr (C , packed)] # [derive (Debug , Copy , Clone)] pub struct dtls_record_header_t { # [doc = "< content type of the included message"] pub content_type : uint8 , # [doc = "< Protocol version"] pub version : uint16 , # [doc = "< counter for cipher state changes"] pub epoch : uint16 , # [doc = "< sequence number"] pub sequence_number : uint48 , # [doc = "< length of the following fragment"] pub length : uint16 , } # [test] fn bindgen_test_layout_dtls_record_header_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_record_header_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_record_header_t > () , 13usize , concat ! ("Size of: " , stringify ! (dtls_record_header_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_record_header_t > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_record_header_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . content_type) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_record_header_t) , "::" , stringify ! (content_type))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . version) as usize - ptr as usize } , 1usize , concat ! ("Offset of field: " , stringify ! (dtls_record_header_t) , "::" , stringify ! (version))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . epoch) as usize - ptr as usize } , 3usize , concat ! ("Offset of field: " , stringify ! (dtls_record_header_t) , "::" , stringify ! (epoch))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . sequence_number) as usize - ptr as usize } , 5usize , concat ! ("Offset of field: " , stringify ! (dtls_record_header_t) , "::" , stringify ! (sequence_number))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . length) as usize - ptr as usize } , 11usize , concat ! ("Offset of field: " , stringify ! (dtls_record_header_t) , "::" , stringify ! (length))) ; } # [doc = " Header structure for the DTLS handshake protocol."] # [repr (C , packed)] # [derive (Debug , Copy , Clone)] pub struct dtls_handshake_header_t { # [doc = "< Type of handshake message  (one of DTLS_HT_)"] pub msg_type : uint8 , # [doc = "< length of this message"] pub length : uint24 , # [doc = "< Message sequence number"] pub message_seq : uint16 , # [doc = "< Fragment offset."] pub fragment_offset : uint24 , # [doc = "< Fragment length."] pub fragment_length : uint24 , } # [test] fn bindgen_test_layout_dtls_handshake_header_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_handshake_header_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_handshake_header_t > () , 12usize , concat ! ("Size of: " , stringify ! (dtls_handshake_header_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_handshake_header_t > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_handshake_header_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . msg_type) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_header_t) , "::" , stringify ! (msg_type))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . length) as usize - ptr as usize } , 1usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_header_t) , "::" , stringify ! (length))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . message_seq) as usize - ptr as usize } , 4usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_header_t) , "::" , stringify ! (message_seq))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . fragment_offset) as usize - ptr as usize } , 6usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_header_t) , "::" , stringify ! (fragment_offset))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . fragment_length) as usize - ptr as usize } , 9usize , concat ! ("Offset of field: " , stringify ! (dtls_handshake_header_t) , "::" , stringify ! (fragment_length))) ; } # [doc = " Structure of the Client Hello message."] # [repr (C , packed)] # [derive (Debug , Copy , Clone)] pub struct dtls_client_hello_t { # [doc = "< Client version"] pub version : uint16 , # [doc = "< GMT time of the random byte creation"] pub gmt_random : uint32 , # [doc = "< Client random bytes"] pub random : [:: std :: os :: raw :: c_uchar ; 28usize] , } # [test] fn bindgen_test_layout_dtls_client_hello_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_client_hello_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_client_hello_t > () , 34usize , concat ! ("Size of: " , stringify ! (dtls_client_hello_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_client_hello_t > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_client_hello_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . version) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_client_hello_t) , "::" , stringify ! (version))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . gmt_random) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (dtls_client_hello_t) , "::" , stringify ! (gmt_random))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . random) as usize - ptr as usize } , 6usize , concat ! ("Offset of field: " , stringify ! (dtls_client_hello_t) , "::" , stringify ! (random))) ; } # [doc = " Structure of the Hello Verify Request."] # [repr (C , packed)] pub struct dtls_hello_verify_t { # [doc = "< Server version"] pub version : uint16 , # [doc = "< Length of the included cookie"] pub cookie_length : uint8 , # [doc = "< up to 32 bytes making up the cookie"] pub cookie : __IncompleteArrayField < uint8 > , } # [test] fn bindgen_test_layout_dtls_hello_verify_t () { const UNINIT : :: std :: mem :: MaybeUninit < dtls_hello_verify_t > = :: std :: mem :: MaybeUninit :: uninit () ; let ptr = UNINIT . as_ptr () ; assert_eq ! (:: std :: mem :: size_of :: < dtls_hello_verify_t > () , 3usize , concat ! ("Size of: " , stringify ! (dtls_hello_verify_t))) ; assert_eq ! (:: std :: mem :: align_of :: < dtls_hello_verify_t > () , 1usize , concat ! ("Alignment of " , stringify ! (dtls_hello_verify_t))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . version) as usize - ptr as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (dtls_hello_verify_t) , "::" , stringify ! (version))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cookie_length) as usize - ptr as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (dtls_hello_verify_t) , "::" , stringify ! (cookie_length))) ; assert_eq ! (unsafe { :: std :: ptr :: addr_of ! ((* ptr) . cookie) as usize - ptr as usize } , 3usize , concat ! ("Offset of field: " , stringify ! (dtls_hello_verify_t) , "::" , stringify ! (cookie))) ; } extern "C" { # [doc = " Handles incoming data as DTLS message from given peer.\n\n @param ctx     The dtls context to use.\n @param session The current session\n @param msg     The received data\n @param msglen  The actual length of @p msg.\n @return A value less than zero on error, zero on success."] pub fn dtls_handle_message (ctx : * mut dtls_context_t , session : * mut session_t , msg : * mut uint8 , msglen : :: std :: os :: raw :: c_int) -> :: std :: os :: raw :: c_int ; } extern "C" { # [doc = " Check if @p session is associated with a peer object in @p context.\n This function returns a pointer to the peer if found, NULL otherwise.\n\n @param context  The DTLS context to search.\n @param session  The remote address and local interface\n @return A pointer to the peer associated with @p session or NULL if\n  none exists."] pub fn dtls_get_peer (context : * const dtls_context_t , session : * const session_t) -> * mut dtls_peer_t ; } extern "C" { # [doc = " Resets all connections with @p peer.\n\n @param context  The active DTLS context.\n @param peer     The peer to reset."] pub fn dtls_reset_peer (context : * mut dtls_context_t , peer : * mut dtls_peer_t) ; }
[WARN] too much data in the log, truncating it