Lines Matching refs:data

701 static int verify_ext_eliptic_curves(uint8 *data, size_t data_length) {  in verify_ext_eliptic_curves()  argument
705 i = dtls_uint16_to_int(data); in verify_ext_eliptic_curves()
706 data += sizeof(uint16); in verify_ext_eliptic_curves()
714 curve_name = dtls_uint16_to_int(data); in verify_ext_eliptic_curves()
715 data += sizeof(uint16); in verify_ext_eliptic_curves()
725 static int verify_ext_cert_type(uint8 *data, size_t data_length) { in verify_ext_cert_type() argument
729 i = dtls_uint8_to_int(data); in verify_ext_cert_type()
730 data += sizeof(uint8); in verify_ext_cert_type()
738 cert_type = dtls_uint8_to_int(data); in verify_ext_cert_type()
739 data += sizeof(uint8); in verify_ext_cert_type()
749 static int verify_ext_ec_point_formats(uint8 *data, size_t data_length) { in verify_ext_ec_point_formats() argument
753 i = dtls_uint8_to_int(data); in verify_ext_ec_point_formats()
754 data += sizeof(uint8); in verify_ext_ec_point_formats()
762 cert_type = dtls_uint8_to_int(data); in verify_ext_ec_point_formats()
763 data += sizeof(uint8); in verify_ext_ec_point_formats()
778 uint8 *data, size_t data_length, int client_hello) in dtls_check_tls_extension() argument
796 j = dtls_uint16_to_int(data); in dtls_check_tls_extension()
797 data += sizeof(uint16); in dtls_check_tls_extension()
809 i = dtls_uint16_to_int(data); in dtls_check_tls_extension()
810 data += sizeof(uint16); in dtls_check_tls_extension()
814 j = dtls_uint16_to_int(data); in dtls_check_tls_extension()
815 data += sizeof(uint16); in dtls_check_tls_extension()
824 if (verify_ext_eliptic_curves(data, j)) in dtls_check_tls_extension()
830 if (verify_ext_cert_type(data, j)) in dtls_check_tls_extension()
833 if (dtls_uint8_to_int(data) != TLS_CERT_TYPE_RAW_PUBLIC_KEY) in dtls_check_tls_extension()
840 if (verify_ext_cert_type(data, j)) in dtls_check_tls_extension()
843 if (dtls_uint8_to_int(data) != TLS_CERT_TYPE_RAW_PUBLIC_KEY) in dtls_check_tls_extension()
849 if (verify_ext_ec_point_formats(data, j)) in dtls_check_tls_extension()
862 data += j; in dtls_check_tls_extension()
902 uint8 *data, size_t data_length) { in dtls_update_parameters() argument
912 data += DTLS_HS_LENGTH + sizeof(uint16); in dtls_update_parameters()
916 memcpy(config->tmp.random.client, data, DTLS_RANDOM_LENGTH); in dtls_update_parameters()
917 data += DTLS_RANDOM_LENGTH; in dtls_update_parameters()
921 SKIP_VAR_FIELD(data, data_length, uint8); /* skip session id */ in dtls_update_parameters()
922 SKIP_VAR_FIELD(data, data_length, uint8); /* skip cookie */ in dtls_update_parameters()
924 i = dtls_uint16_to_int(data); in dtls_update_parameters()
938 data += sizeof(uint16); in dtls_update_parameters()
943 config->cipher = dtls_uint16_to_int(data); in dtls_update_parameters()
946 data += sizeof(uint16); in dtls_update_parameters()
950 data += i; in dtls_update_parameters()
968 i = dtls_uint8_to_int(data); in dtls_update_parameters()
972 data += sizeof(uint8); in dtls_update_parameters()
978 if (dtls_uint8_to_int(data) == compression_methods[j]) { in dtls_update_parameters()
983 data += sizeof(uint8); in dtls_update_parameters()
991 return dtls_check_tls_extension(peer, data, data_length, 1); in dtls_update_parameters()
1007 uint8 *data, size_t length) { in check_client_keyexchange() argument
1016 data += DTLS_HS_LENGTH; in check_client_keyexchange()
1018 if (dtls_uint8_to_int(data) != 1 + 2 * DTLS_EC_KEY_SIZE) { in check_client_keyexchange()
1022 data += sizeof(uint8); in check_client_keyexchange()
1024 if (dtls_uint8_to_int(data) != 4) { in check_client_keyexchange()
1028 data += sizeof(uint8); in check_client_keyexchange()
1030 memcpy(handshake->keyx.ecdsa.other_eph_pub_x, data, in check_client_keyexchange()
1032 data += sizeof(handshake->keyx.ecdsa.other_eph_pub_x); in check_client_keyexchange()
1034 memcpy(handshake->keyx.ecdsa.other_eph_pub_y, data, in check_client_keyexchange()
1036 data += sizeof(handshake->keyx.ecdsa.other_eph_pub_y); in check_client_keyexchange()
1047 data += DTLS_HS_LENGTH; in check_client_keyexchange()
1049 id_length = dtls_uint16_to_int(data); in check_client_keyexchange()
1050 data += sizeof(uint16); in check_client_keyexchange()
1063 memcpy(handshake->keyx.psk.identity, data, id_length); in check_client_keyexchange()
1070 update_hs_hash(dtls_peer_t *peer, uint8 *data, size_t length) { in update_hs_hash() argument
1071 dtls_debug_dump("add MAC data", data, length); in update_hs_hash()
1072 dtls_hash_update(&peer->handshake_params->hs_state.hs_hash, data, length); in update_hs_hash()
1105 uint8 *data, size_t data_length) { in check_finished() argument
1146 dtls_debug_dump("d:", data + DTLS_HS_LENGTH, sizeof(b.verify_data)); in check_finished()
1150 return equals(data + DTLS_HS_LENGTH, b.verify_data, sizeof(b.verify_data)) in check_finished()
1327 uint8 *data, size_t data_length, in dtls_send_handshake_msg_hash() argument
1346 if (data != NULL) { in dtls_send_handshake_msg_hash()
1348 update_hs_hash(peer, data, data_length); in dtls_send_handshake_msg_hash()
1350 data_array[i] = data; in dtls_send_handshake_msg_hash()
1364 uint8 *data, size_t data_length) in dtls_send_handshake_msg() argument
1367 header_type, data, data_length, 1); in dtls_send_handshake_msg()
1453 memcpy(n->data + n->length, buf_array[i], buf_len_array[i]); in dtls_send_multi()
1543 uint8 *data, size_t data_length) in dtls_verify_peer() argument
1554 err = dtls_create_cookie(ctx, session, data, data_length, mycookie, &len); in dtls_verify_peer()
1563 len = dtls_get_cookie(data, data_length, &cookie); in dtls_verify_peer()
1611 dtls_check_ecdsa_signature_elem(uint8 *data, size_t data_length, in dtls_check_ecdsa_signature_elem() argument
1616 uint8 *data_orig = data; in dtls_check_ecdsa_signature_elem()
1618 if (dtls_uint8_to_int(data) != TLS_EXT_SIG_HASH_ALGO_SHA256) { in dtls_check_ecdsa_signature_elem()
1622 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1625 if (dtls_uint8_to_int(data) != TLS_EXT_SIG_HASH_ALGO_ECDSA) { in dtls_check_ecdsa_signature_elem()
1629 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1632 if (data_length < dtls_uint16_to_int(data)) { in dtls_check_ecdsa_signature_elem()
1636 data += sizeof(uint16); in dtls_check_ecdsa_signature_elem()
1639 if (dtls_uint8_to_int(data) != 0x30) { in dtls_check_ecdsa_signature_elem()
1643 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1646 if (data_length < dtls_uint8_to_int(data)) { in dtls_check_ecdsa_signature_elem()
1650 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1653 if (dtls_uint8_to_int(data) != 0x02) { in dtls_check_ecdsa_signature_elem()
1657 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1660 i = dtls_uint8_to_int(data); in dtls_check_ecdsa_signature_elem()
1661 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1665 *result_r = data + i - DTLS_EC_KEY_SIZE; in dtls_check_ecdsa_signature_elem()
1667 data += i; in dtls_check_ecdsa_signature_elem()
1670 if (dtls_uint8_to_int(data) != 0x02) { in dtls_check_ecdsa_signature_elem()
1674 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1677 i = dtls_uint8_to_int(data); in dtls_check_ecdsa_signature_elem()
1678 data += sizeof(uint8); in dtls_check_ecdsa_signature_elem()
1682 *result_s = data + i - DTLS_EC_KEY_SIZE; in dtls_check_ecdsa_signature_elem()
1684 data += i; in dtls_check_ecdsa_signature_elem()
1687 return data - data_orig; in dtls_check_ecdsa_signature_elem()
1693 uint8 *data, size_t data_length) in check_client_certificate_verify() argument
1704 data += DTLS_HS_LENGTH; in check_client_certificate_verify()
1711 ret = dtls_check_ecdsa_signature_elem(data, data_length, &result_r, &result_s); in check_client_certificate_verify()
1715 data += ret; in check_client_certificate_verify()
2462 uint8 *data, size_t data_length) in check_server_hello() argument
2474 update_hs_hash(peer, data, data_length); in check_server_hello()
2484 data += DTLS_HS_LENGTH; in check_server_hello()
2487 if (dtls_uint16_to_int(data) != DTLS_VERSION) { in check_server_hello()
2492 data += sizeof(uint16); /* skip version field */ in check_server_hello()
2496 memcpy(handshake->tmp.random.server, data, DTLS_RANDOM_LENGTH); in check_server_hello()
2498 data += DTLS_RANDOM_LENGTH; in check_server_hello()
2501 SKIP_VAR_FIELD(data, data_length, uint8); /* skip session id */ in check_server_hello()
2506 handshake->cipher = dtls_uint16_to_int(data); in check_server_hello()
2509 data[0], data[1]); in check_server_hello()
2512 data += sizeof(uint16); in check_server_hello()
2516 if (dtls_uint8_to_int(data) != TLS_COMPRESSION_NULL) { in check_server_hello()
2517 dtls_alert("unsupported compression method 0x%02x\n", data[0]); in check_server_hello()
2520 data += sizeof(uint8); in check_server_hello()
2523 return dtls_check_tls_extension(peer, data, data_length, 0); in check_server_hello()
2532 uint8 *data, size_t data_length) in check_server_hello_verify_request() argument
2540 hv = (dtls_hello_verify_t *)(data + DTLS_HS_LENGTH); in check_server_hello_verify_request()
2554 uint8 *data, size_t data_length) in check_server_certificate() argument
2559 update_hs_hash(peer, data, data_length); in check_server_certificate()
2563 data += DTLS_HS_LENGTH; in check_server_certificate()
2565 if (dtls_uint24_to_int(data) != 94) { in check_server_certificate()
2569 data += sizeof(uint24); in check_server_certificate()
2571 if (dtls_uint24_to_int(data) != 91) { in check_server_certificate()
2575 data += sizeof(uint24); in check_server_certificate()
2577 if (memcmp(data, cert_asn1_header, sizeof(cert_asn1_header))) { in check_server_certificate()
2581 data += sizeof(cert_asn1_header); in check_server_certificate()
2583 memcpy(config->keyx.ecdsa.other_pub_x, data, in check_server_certificate()
2585 data += sizeof(config->keyx.ecdsa.other_pub_x); in check_server_certificate()
2587 memcpy(config->keyx.ecdsa.other_pub_y, data, in check_server_certificate()
2589 data += sizeof(config->keyx.ecdsa.other_pub_y); in check_server_certificate()
2606 uint8 *data, size_t data_length) in check_server_key_exchange_ecdsa() argument
2614 update_hs_hash(peer, data, data_length); in check_server_key_exchange_ecdsa()
2618 data += DTLS_HS_LENGTH; in check_server_key_exchange_ecdsa()
2624 key_params = data; in check_server_key_exchange_ecdsa()
2626 if (dtls_uint8_to_int(data) != TLS_EC_CURVE_TYPE_NAMED_CURVE) { in check_server_key_exchange_ecdsa()
2630 data += sizeof(uint8); in check_server_key_exchange_ecdsa()
2633 if (dtls_uint16_to_int(data) != TLS_EXT_ELLIPTIC_CURVES_SECP256R1) { in check_server_key_exchange_ecdsa()
2637 data += sizeof(uint16); in check_server_key_exchange_ecdsa()
2640 if (dtls_uint8_to_int(data) != 1 + 2 * DTLS_EC_KEY_SIZE) { in check_server_key_exchange_ecdsa()
2644 data += sizeof(uint8); in check_server_key_exchange_ecdsa()
2647 if (dtls_uint8_to_int(data) != 4) { in check_server_key_exchange_ecdsa()
2651 data += sizeof(uint8); in check_server_key_exchange_ecdsa()
2654 memcpy(config->keyx.ecdsa.other_eph_pub_x, data, sizeof(config->keyx.ecdsa.other_eph_pub_y)); in check_server_key_exchange_ecdsa()
2655 data += sizeof(config->keyx.ecdsa.other_eph_pub_y); in check_server_key_exchange_ecdsa()
2658 memcpy(config->keyx.ecdsa.other_eph_pub_y, data, sizeof(config->keyx.ecdsa.other_eph_pub_y)); in check_server_key_exchange_ecdsa()
2659 data += sizeof(config->keyx.ecdsa.other_eph_pub_y); in check_server_key_exchange_ecdsa()
2662 ret = dtls_check_ecdsa_signature_elem(data, data_length, &result_r, &result_s); in check_server_key_exchange_ecdsa()
2666 data += ret; in check_server_key_exchange_ecdsa()
2689 uint8 *data, size_t data_length) in check_server_key_exchange_psk() argument
2694 update_hs_hash(peer, data, data_length); in check_server_key_exchange_psk()
2698 data += DTLS_HS_LENGTH; in check_server_key_exchange_psk()
2705 len = dtls_uint16_to_int(data); in check_server_key_exchange_psk()
2706 data += sizeof(uint16); in check_server_key_exchange_psk()
2720 memcpy(config->keyx.psk.identity, data, len); in check_server_key_exchange_psk()
2728 uint8 *data, size_t data_length) in check_certificate_request() argument
2735 update_hs_hash(peer, data, data_length); in check_certificate_request()
2739 data += DTLS_HS_LENGTH; in check_certificate_request()
2746 i = dtls_uint8_to_int(data); in check_certificate_request()
2747 data += sizeof(uint8); in check_certificate_request()
2755 if (dtls_uint8_to_int(data) == TLS_CLIENT_CERTIFICATE_TYPE_ECDSA_SIGN in check_certificate_request()
2757 auth_alg = dtls_uint8_to_int(data); in check_certificate_request()
2758 data += sizeof(uint8); in check_certificate_request()
2766 i = dtls_uint16_to_int(data); in check_certificate_request()
2767 data += sizeof(uint16); in check_certificate_request()
2779 current_hash_alg = dtls_uint8_to_int(data); in check_certificate_request()
2780 data += sizeof(uint8); in check_certificate_request()
2781 current_sig_alg = dtls_uint8_to_int(data); in check_certificate_request()
2782 data += sizeof(uint8); in check_certificate_request()
2806 uint8 *data, size_t data_length) in check_server_hellodone() argument
2817 update_hs_hash(peer, data, data_length); in check_server_hellodone()
2994 uint8 *data, size_t data_length) { in handle_handshake_msg() argument
3012 dtls_handshake_type_to_name(data[0]), data[0]); in handle_handshake_msg()
3013 switch (data[0]) { in handle_handshake_msg()
3024 err = check_server_hello_verify_request(ctx, peer, data, data_length); in handle_handshake_msg()
3037 err = check_server_hello(ctx, peer, data, data_length); in handle_handshake_msg()
3057 err = check_server_certificate(ctx, peer, data, data_length); in handle_handshake_msg()
3079 err = check_server_key_exchange_ecdsa(ctx, peer, data, data_length); in handle_handshake_msg()
3087 err = check_server_key_exchange_psk(ctx, peer, data, data_length); in handle_handshake_msg()
3106 err = check_server_hellodone(ctx, peer, data, data_length); in handle_handshake_msg()
3122 err = check_certificate_request(ctx, peer, data, data_length); in handle_handshake_msg()
3137 err = check_finished(ctx, peer, data, data_length); in handle_handshake_msg()
3144 update_hs_hash(peer, data, data_length); in handle_handshake_msg()
3181 err = check_client_keyexchange(ctx, peer->handshake_params, data, data_length); in handle_handshake_msg()
3186 update_hs_hash(peer, data, data_length); in handle_handshake_msg()
3202 err = check_client_certificate_verify(ctx, peer, data, data_length); in handle_handshake_msg()
3208 update_hs_hash(peer, data, data_length); in handle_handshake_msg()
3229 err = dtls_verify_peer(ctx, peer, session, data, data_length); in handle_handshake_msg()
3263 dtls_handshake_header_t *hs_header = DTLS_HANDSHAKE_HEADER(data); in handle_handshake_msg()
3282 err = dtls_update_parameters(ctx, peer, data, data_length); in handle_handshake_msg()
3289 update_hs_hash(peer, data, data_length); in handle_handshake_msg()
3335 dtls_crit("unhandled message %d\n", data[0]); in handle_handshake_msg()
3349 uint8 *data, size_t data_length) in handle_handshake() argument
3358 hs_header = DTLS_HANDSHAKE_HEADER(data); in handle_handshake()
3373 return handle_handshake_msg(ctx, peer, session, role, state, data, in handle_handshake()
3397 dtls_handshake_header_t *node_header = DTLS_HANDSHAKE_HEADER(node->data); in handle_handshake()
3413 memcpy(n->data, data, data_length); in handle_handshake()
3425 res = handle_handshake_msg(ctx, peer, session, role, state, data, data_length); in handle_handshake()
3434 dtls_handshake_header_t *node_header = DTLS_HANDSHAKE_HEADER(node->data); in handle_handshake()
3439 … res = handle_handshake_msg(ctx, peer, session, role, peer->state, node->data, node->length); in handle_handshake()
3458 uint8 *record_header, uint8 *data, size_t data_length) in handle_ccs() argument
3474 if (data_length < 1 || data[0] != 1) in handle_ccs()
3497 uint8 *record_header, uint8 *data, size_t data_length) { in handle_alert() argument
3503 dtls_info("** Alert: level %d, description %d\n", data[0], data[1]); in handle_alert()
3516 if (data[0] == DTLS_ALERT_LEVEL_FATAL || data[1] == DTLS_ALERT_CLOSE_NOTIFY) { in handle_alert()
3517 dtls_alert("%d invalidate peer\n", data[1]); in handle_alert()
3536 (dtls_alert_level_t)data[0], (unsigned short)data[1]); in handle_alert()
3537 switch (data[1]) { in handle_alert()
3596 uint8 *data; /* (decrypted) payload */ in dtls_handle_message() local
3617 data_length = decrypt_verify(peer, msg, rlen, &data); in dtls_handle_message()
3633 data = msg + DTLS_RH_LENGTH; in dtls_handle_message()
3640 dtls_debug_hexdump("receive unencrypted", data, data_length); in dtls_handle_message()
3653 err = handle_ccs(ctx, peer, msg, data, data_length); in dtls_handle_message()
3670 err = handle_alert(ctx, peer, msg, data, data_length); in dtls_handle_message()
3704 err = handle_handshake(ctx, peer, session, role, state, data, data_length); in dtls_handle_message()
3725 CALL(ctx, read, &peer->session, data, data_length); in dtls_handle_message()
3899 unsigned char *data = node->data; in dtls_retransmit() local
3910 dtls_handshake_header_t *hs_header = DTLS_HANDSHAKE_HEADER(data); in dtls_retransmit()
3918 err = dtls_prepare_record(node->peer, security, node->type, &data, &length, in dtls_retransmit()
3926 dtls_debug_hexdump("retransmit unencrypted", node->data, node->length); in dtls_retransmit()
3976 PROCESS_THREAD(dtls_retransmit_process, ev, data) in PROCESS_THREAD() argument