|
#define | __STDC_FORMAT_MACROS |
|
#define | dtls_set_version(H, V) dtls_int_to_uint16((H)->version, (V)) |
|
#define | dtls_set_content_type(H, V) ((H)->content_type = (V) & 0xff) |
|
#define | dtls_set_length(H, V) ((H)->length = (V)) |
|
#define | dtls_get_content_type(H) ((H)->content_type & 0xff) |
|
#define | dtls_get_version(H) dtls_uint16_to_int((H)->version) |
|
#define | dtls_get_epoch(H) dtls_uint16_to_int((H)->epoch) |
|
#define | dtls_get_sequence_number(H) dtls_uint48_to_ulong((H)->sequence_number) |
|
#define | dtls_get_fragment_length(H) dtls_uint24_to_int((H)->fragment_length) |
|
#define | FIND_PEER(head, sess, out) HASH_FIND(hh,head,sess,sizeof(session_t),out) |
|
#define | ADD_PEER(head, sess, add) HASH_ADD(hh,head,sess,sizeof(session_t),add) |
|
#define | DEL_PEER(head, delptr) |
|
#define | DTLS_RH_LENGTH sizeof(dtls_record_header_t) |
|
#define | DTLS_HS_LENGTH sizeof(dtls_handshake_header_t) |
|
#define | DTLS_CH_LENGTH sizeof(dtls_client_hello_t) /* no variable length fields! */ |
|
#define | DTLS_COOKIE_LENGTH_MAX 32 |
|
#define | DTLS_CH_LENGTH_MAX sizeof(dtls_client_hello_t) + DTLS_COOKIE_LENGTH_MAX + 12 + 26 |
|
#define | DTLS_HV_LENGTH sizeof(dtls_hello_verify_t) |
|
#define | DTLS_SH_LENGTH (2 + DTLS_RANDOM_LENGTH + 1 + 2 + 1) |
|
#define | DTLS_CE_LENGTH (3 + 3 + 27 + DTLS_EC_KEY_SIZE + DTLS_EC_KEY_SIZE) |
|
#define | DTLS_SKEXEC_LENGTH (1 + 2 + 1 + 1 + DTLS_EC_KEY_SIZE + DTLS_EC_KEY_SIZE + 1 + 1 + 2 + 70) |
|
#define | DTLS_SKEXECPSK_LENGTH_MIN 2 |
|
#define | DTLS_SKEXECPSK_LENGTH_MAX 2 + DTLS_PSK_MAX_CLIENT_IDENTITY_LEN |
|
#define | DTLS_CKXPSK_LENGTH_MIN 2 |
|
#define | DTLS_CKXEC_LENGTH (1 + 1 + DTLS_EC_KEY_SIZE + DTLS_EC_KEY_SIZE) |
|
#define | DTLS_CV_LENGTH (1 + 1 + 2 + 1 + 1 + 1 + 1 + DTLS_EC_KEY_SIZE + 1 + 1 + DTLS_EC_KEY_SIZE) |
|
#define | DTLS_FIN_LENGTH 12 |
|
#define | HS_HDR_LENGTH DTLS_RH_LENGTH + DTLS_HS_LENGTH |
|
#define | HV_HDR_LENGTH HS_HDR_LENGTH + DTLS_HV_LENGTH |
|
#define | HIGH(V) (((V) >> 8) & 0xff) |
|
#define | LOW(V) ((V) & 0xff) |
|
#define | DTLS_RECORD_HEADER(M) ((dtls_record_header_t *)(M)) |
|
#define | DTLS_HANDSHAKE_HEADER(M) ((dtls_handshake_header_t *)(M)) |
|
#define | HANDSHAKE(M) ((dtls_handshake_header_t *)((M) + DTLS_RH_LENGTH)) |
|
#define | CLIENTHELLO(M) ((dtls_client_hello_t *)((M) + HS_HDR_LENGTH)) |
|
#define | SKIP_VAR_FIELD(P, L, T) |
|
#define | PRF_LABEL(Label) prf_label_##Label |
|
#define | PRF_LABEL_SIZE(Label) (sizeof(PRF_LABEL(Label)) - 1) |
|
#define | CALL(Context, which, ...) |
|
#define | A_DATA_LEN 13 |
|
#define | MUST_HASH(Type, Data, Length) |
|
#define | mycookie (buf + DTLS_HV_LENGTH) |
|
#define | DTLS_EC_SUBJECTPUBLICKEY_SIZE (2 * DTLS_EC_KEY_SIZE + sizeof(cert_asn1_header)) |
|
#define | R_KEY_OFFSET (1 + 1 + 2 + 1 + 1 + 1 + 1) |
|
#define | S_KEY_OFFSET(len_s) (R_KEY_OFFSET + (len_s) + 1 + 1) |
|
#define | A_DATA_LEN 13 |
|
|
static dtls_context_t * | malloc_context (void) |
|
static void | free_context (dtls_context_t *context) |
|
void | dtls_init (void) |
|
static int | dtls_send_multi (dtls_context_t *ctx, dtls_peer_t *peer, dtls_security_parameters_t *security, session_t *session, unsigned char type, uint8 *buf_array[], size_t buf_len_array[], size_t buf_array_len) |
|
static int | dtls_send (dtls_context_t *ctx, dtls_peer_t *peer, unsigned char type, uint8 *buf, size_t buflen) |
|
static void | dtls_stop_retransmission (dtls_context_t *context, dtls_peer_t *peer) |
|
dtls_peer_t * | dtls_get_peer (const dtls_context_t *ctx, const session_t *session) |
|
static int | dtls_add_peer (dtls_context_t *ctx, dtls_peer_t *peer) |
|
int | dtls_write (struct dtls_context_t *ctx, session_t *dst, uint8 *buf, size_t len) |
|
static int | dtls_get_cookie (uint8 *msg, size_t msglen, uint8 **cookie) |
|
static int | dtls_create_cookie (dtls_context_t *ctx, session_t *session, uint8 *msg, size_t msglen, uint8 *cookie, int *clen) |
|
static unsigned int | is_record (uint8 *msg, size_t msglen) |
|
static uint8 * | dtls_set_record_header (uint8 type, dtls_security_parameters_t *security, uint8 *buf) |
|
static uint8 * | dtls_set_handshake_header (uint8 type, dtls_peer_t *peer, int length, int frag_offset, int frag_length, uint8 *buf) |
|
static int | is_tls_ecdhe_ecdsa_with_aes_128_ccm_8 (dtls_cipher_t cipher) |
|
static int | is_tls_psk_with_aes_128_ccm_8 (dtls_cipher_t cipher) |
|
static int | is_psk_supported (dtls_context_t *ctx) |
|
static int | is_ecdsa_supported (dtls_context_t *ctx, int is_client) |
|
static int | is_ecdsa_client_auth_supported (dtls_context_t *ctx) |
|
static int | known_cipher (dtls_context_t *ctx, dtls_cipher_t code, int is_client) |
|
static int | hs_attempt_with_existing_peer (uint8_t *msg, size_t msglen, dtls_peer_t *peer) |
|
static void | dtls_debug_keyblock (dtls_security_parameters_t *config) |
|
static char * | dtls_handshake_type_to_name (int type) |
|
static int | calculate_key_block (dtls_context_t *ctx, dtls_handshake_parameters_t *handshake, dtls_peer_t *peer, session_t *session, dtls_peer_type role) |
|
static int | verify_ext_eliptic_curves (uint8 *data, size_t data_length) |
|
static int | verify_ext_cert_type (uint8 *data, size_t data_length) |
|
static int | verify_ext_ec_point_formats (uint8 *data, size_t data_length) |
|
static int | dtls_check_tls_extension (dtls_peer_t *peer, uint8 *data, size_t data_length, int client_hello) |
|
static int | dtls_update_parameters (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_client_keyexchange (dtls_context_t *ctx, dtls_handshake_parameters_t *handshake, uint8 *data, size_t length) |
|
static void | update_hs_hash (dtls_peer_t *peer, uint8 *data, size_t length) |
|
static void | copy_hs_hash (dtls_peer_t *peer, dtls_hash_ctx *hs_hash) |
|
static size_t | finalize_hs_hash (dtls_peer_t *peer, uint8 *buf) |
|
static void | clear_hs_hash (dtls_peer_t *peer) |
|
static int | check_finished (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | dtls_prepare_record (dtls_peer_t *peer, dtls_security_parameters_t *security, unsigned char type, uint8 *data_array[], size_t data_len_array[], size_t data_array_len, uint8 *sendbuf, size_t *rlen) |
|
static int | dtls_send_handshake_msg_hash (dtls_context_t *ctx, dtls_peer_t *peer, session_t *session, uint8 header_type, uint8 *data, size_t data_length, int add_hash) |
|
static int | dtls_send_handshake_msg (dtls_context_t *ctx, dtls_peer_t *peer, uint8 header_type, uint8 *data, size_t data_length) |
|
static int | dtls_send_alert (dtls_context_t *ctx, dtls_peer_t *peer, dtls_alert_level_t level, dtls_alert_t description) |
|
int | dtls_close (dtls_context_t *ctx, const session_t *remote) |
|
static void | dtls_destroy_peer (dtls_context_t *ctx, dtls_peer_t *peer, int unlink) |
|
static int | dtls_verify_peer (dtls_context_t *ctx, dtls_peer_t *peer, session_t *session, const dtls_state_t state, uint8 *data, size_t data_length) |
|
static int | dtls_check_ecdsa_signature_elem (uint8 *data, size_t data_length, unsigned char **result_r, unsigned char **result_s) |
|
static int | check_client_certificate_verify (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | dtls_send_server_hello (dtls_context_t *ctx, dtls_peer_t *peer) |
|
static int | dtls_send_certificate_ecdsa (dtls_context_t *ctx, dtls_peer_t *peer, const dtls_ecdsa_key_t *key) |
|
static uint8 * | dtls_add_ecdsa_signature_elem (uint8 *p, uint32_t *point_r, uint32_t *point_s) |
|
static int | dtls_send_server_key_exchange_ecdh (dtls_context_t *ctx, dtls_peer_t *peer, const dtls_ecdsa_key_t *key) |
|
static int | dtls_send_server_key_exchange_psk (dtls_context_t *ctx, dtls_peer_t *peer, const unsigned char *psk_hint, size_t len) |
|
static int | dtls_send_server_certificate_request (dtls_context_t *ctx, dtls_peer_t *peer) |
|
static int | dtls_send_server_hello_done (dtls_context_t *ctx, dtls_peer_t *peer) |
|
static int | dtls_send_server_hello_msgs (dtls_context_t *ctx, dtls_peer_t *peer) |
|
static int | dtls_send_ccs (dtls_context_t *ctx, dtls_peer_t *peer) |
|
static int | dtls_send_client_key_exchange (dtls_context_t *ctx, dtls_peer_t *peer) |
|
static int | dtls_send_certificate_verify_ecdh (dtls_context_t *ctx, dtls_peer_t *peer, const dtls_ecdsa_key_t *key) |
|
static int | dtls_send_finished (dtls_context_t *ctx, dtls_peer_t *peer, const unsigned char *label, size_t labellen) |
|
static int | dtls_send_client_hello (dtls_context_t *ctx, dtls_peer_t *peer, uint8 cookie[], size_t cookie_length) |
|
static int | check_server_hello (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_server_hello_verify_request (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_server_certificate (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_server_key_exchange_ecdsa (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_server_key_exchange_psk (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_certificate_request (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | check_server_hellodone (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *data, size_t data_length) |
|
static int | decrypt_verify (dtls_peer_t *peer, uint8 *packet, size_t length, uint8 **cleartext) |
|
static int | dtls_send_hello_request (dtls_context_t *ctx, dtls_peer_t *peer) |
|
int | dtls_renegotiate (dtls_context_t *ctx, const session_t *dst) |
|
static int | handle_handshake_msg (dtls_context_t *ctx, dtls_peer_t *peer, session_t *session, const dtls_peer_type role, const dtls_state_t state, uint8 *data, size_t data_length) |
|
static int | handle_handshake (dtls_context_t *ctx, dtls_peer_t *peer, session_t *session, const dtls_peer_type role, const dtls_state_t state, uint8 *data, size_t data_length) |
|
static int | handle_ccs (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *record_header, uint8 *data, size_t data_length) |
|
static int | handle_alert (dtls_context_t *ctx, dtls_peer_t *peer, uint8 *record_header, uint8 *data, size_t data_length) |
|
static int | dtls_alert_send_from_err (dtls_context_t *ctx, dtls_peer_t *peer, session_t *session, int err) |
|
int | dtls_handle_message (dtls_context_t *ctx, session_t *session, uint8 *msg, int msglen) |
|
dtls_context_t * | dtls_new_context (void *app_data) |
|
void | dtls_reset_peer (dtls_context_t *ctx, dtls_peer_t *peer) |
|
void | dtls_free_context (dtls_context_t *ctx) |
|
int | dtls_connect_peer (dtls_context_t *ctx, dtls_peer_t *peer) |
|
int | dtls_connect (dtls_context_t *ctx, const session_t *dst) |
|
static void | dtls_retransmit (dtls_context_t *context, netq_t *node) |
|
void | dtls_check_retransmit (dtls_context_t *context, clock_time_t *next) |
|