Crate tinydtls_sys

source ·

Structs

Crypto context for TLS_PSK_WITH_AES_128_CCM_8 cipher suite.
Represents AEAD parameters for dtls_encrypt_params().
Structure of the Client Hello message.
Holds global information of the DTLS engine.
Holds ClientHello’s sequence numbers for the stateless address verification.
This structure contains callback functions used by tinydtls to communicate with the application. At least the write function must be provided. It is called by the DTLS state machine to send packets over the network. The read function is invoked to deliver decrypted and verfified application data. The third callback is an event handler function that is called when alert messages are encountered or events generated by the library have occured.
Header structure for the DTLS handshake protocol.
Structure of the Hello Verify Request.
Context for HMAC generation. This object is initialized with dtls_hmac_init() and must be passed to dtls_hmac_update() and dtls_hmac_finalize(). Once, finalized, the component \c H is invalid and must be initialized again with dtls_hmac_init() before the structure can be used again.
Holds security parameters, local state and the transport address for each peer.
Generic header structure of the DTLS record layer.

Enums

Known cipher suites.
Known compression suites.
List of known hash functions for use in dtls_hmac_init(). The identifiers are the same as the HashAlgorithm defined in Section 7.4.1.4.1 of RFC 5246.

Constants

Functions

Authenticates and encrypts a message using AES in CCM mode. Please see also RFC 3610 for the meaning of \p M, \p L, \p lm and \p la.
Checks sendqueue of given DTLS context object for any outstanding packets to be transmitted.
Closes the DTLS connection associated with @p remote. This function returns zero on success, and a value less than zero on error.
Establishes a DTLS channel with the specified remote peer @p dst. This function returns @c 0 if that channel already exists, a value greater than zero when a new ClientHello message was sent, and a value less than zero on error.
Establishes a DTLS channel with the specified remote peer. This function returns @c 0 if that channel already exists and a renegotiate was initiated, a value greater than zero when a new ClientHello message was sent, and a value less than zero on error.
Decrypts the given buffer \p src of given \p length, writing the result to \p buf. The function returns \c -1 in case of an error, or the number of bytes written. Note that for block ciphers, \p length must be a multiple of the cipher’s block size. A return value between \c 0 and the actual length indicates that only \c n-1 block have been processed. The provided \p src and \p buf may overlap.
Decrypts the given buffer \p src of given \p length, writing the result to \p buf. The function returns \c -1 in case of an error, or the number of bytes written. Note that for block ciphers, \p length must be a multiple of the cipher’s block size. A return value between \c 0 and the actual length indicates that only \c n-1 block have been processed. The provided \p src and \p buf may overlap.
Encrypts the specified \p src of given \p length, writing the result to \p buf. The cipher implementation may add more data to the result buffer such as an initialization vector or padding (e.g. for block ciphers in CBC mode). The caller therefore must ensure that \p buf provides sufficient storage to hold the result. Usually this means ( 2 + \p length / blocksize ) * blocksize. The function returns a value less than zero on error or otherwise the number of bytes written. The provided \p src and \p buf may overlap.
Encrypts the specified \p src of given \p length, writing the result to \p buf. The cipher implementation may add more data to the result buffer such as an initialization vector or padding (e.g. for block ciphers in CBC mode). The caller therefore must ensure that \p buf provides sufficient storage to hold the result. Usually this means ( 2 + \p length / blocksize ) * blocksize. The function returns a value less than zero on error or otherwise the number of bytes written. The provided \p src and \p buf may overlap.
Releases any storage that has been allocated for \p ctx.
Releases the storage allocated to @p peer.
Frees memory allocated for a session using ::dtls_new_session.
Check if @p session is associated with a peer object in @p context. This function returns a pointer to the peer if found, NULL otherwise.
Handles incoming data as DTLS message from given peer.
Completes the HMAC generation and writes the result to the given output parameter \c result. The buffer must be large enough to hold the message digest created by the actual hash function. If in doubt, use \c DTLS_HMAC_MAX. The function returns the number of bytes written to \c result.
Initializes an existing HMAC context.
Updates the HMAC context with data from \p input.
This function initializes the tinyDTLS memory management and must be called first.
Calculates MAC for record + cleartext packet and places the result in \p buf. The given \p hmac_ctx must be initialized with the HMAC function to use and the proper secret. As the DTLS mac calculation requires data from the record header, \p record must point to a buffer of at least \c sizeof(dtls_record_header_t) bytes. Usually, the remaining packet will be encrypted, therefore, the cleartext is passed separately in \p packet.
Creates a new context object. The storage allocated for the new object must be released with dtls_free_context().
Creates a new peer for given @p session. The current configuration is initialized with the cipher suite TLS_NULL_WITH_NULL_NULL (i.e. no security at all). This function returns a pointer to the new peer or NULL on error. The caller is responsible for releasing the storage allocated for this peer using dtls_free_peer().
Creates a new ::session_t for the given address.
Expands the secret and key to a block of DTLS_HMAC_MAX size according to the algorithm specified in section 5 of RFC 4346.
This function implements the TLS PRF for DTLS_VERSION. For version 1.0, the PRF is P_MD5 ^ P_SHA1 while version 1.2 uses P_SHA256. Currently, the actual PRF is selected at compile time.
Generates pre_master_sercet from given PSK and fills the result according to the “plain PSK” case in section 2 of RFC 4279. Diffie-Hellman and RSA key exchange are currently not supported.
Renegotiates a DTLS channel based on the specified session. This function returns a value greater than zero when a new ClientHello message was sent, and a value less than zero on error.
Resets all connections with @p peer.
Extracts the address of the given ::session_t.
Compares the given session objects. This function returns @c 0 when @p a and @p b differ, @c 1 otherwise.
Resets the given session_t object @p sess to its default values. In particular, the member rlen must be initialized to the available size for storing addresses.
Writes the application data given in @p buf to the peer specified by @p session.
Writes the application data given in multiple buffers to the peer specified by @p session.

Type Definitions

Unions