Lines Matching refs:pkt
31 static MSG_PROCESS_RETURN tls_process_as_hello_retry_request(SSL *s, PACKET *pkt);
32 static MSG_PROCESS_RETURN tls_process_encrypted_extensions(SSL *s, PACKET *pkt);
37 WPACKET *pkt);
882 int ossl_statem_client_construct_message(SSL *s, WPACKET *pkt, in ossl_statem_client_construct_message() argument
1016 MSG_PROCESS_RETURN ossl_statem_client_process_message(SSL *s, PACKET *pkt) in ossl_statem_client_process_message() argument
1027 return tls_process_server_hello(s, pkt); in ossl_statem_client_process_message()
1030 return dtls_process_hello_verify(s, pkt); in ossl_statem_client_process_message()
1033 return tls_process_server_certificate(s, pkt); in ossl_statem_client_process_message()
1036 return tls_process_cert_verify(s, pkt); in ossl_statem_client_process_message()
1039 return tls_process_cert_status(s, pkt); in ossl_statem_client_process_message()
1042 return tls_process_key_exchange(s, pkt); in ossl_statem_client_process_message()
1045 return tls_process_certificate_request(s, pkt); in ossl_statem_client_process_message()
1048 return tls_process_server_done(s, pkt); in ossl_statem_client_process_message()
1051 return tls_process_change_cipher_spec(s, pkt); in ossl_statem_client_process_message()
1054 return tls_process_new_session_ticket(s, pkt); in ossl_statem_client_process_message()
1057 return tls_process_finished(s, pkt); in ossl_statem_client_process_message()
1060 return tls_process_hello_req(s, pkt); in ossl_statem_client_process_message()
1063 return tls_process_encrypted_extensions(s, pkt); in ossl_statem_client_process_message()
1066 return tls_process_key_update(s, pkt); in ossl_statem_client_process_message()
1093 int tls_construct_client_hello(SSL *s, WPACKET *pkt) in tls_construct_client_hello() argument
1180 if (!WPACKET_put_bytes_u16(pkt, s->client_version) in tls_construct_client_hello()
1181 || !WPACKET_memcpy(pkt, s->s3.client_random, SSL3_RANDOM_SIZE)) { in tls_construct_client_hello()
1211 if (!WPACKET_start_sub_packet_u8(pkt) in tls_construct_client_hello()
1212 || (sess_id_len != 0 && !WPACKET_memcpy(pkt, session_id, in tls_construct_client_hello()
1214 || !WPACKET_close(pkt)) { in tls_construct_client_hello()
1222 || !WPACKET_sub_memcpy_u8(pkt, s->d1->cookie, in tls_construct_client_hello()
1230 if (!WPACKET_start_sub_packet_u16(pkt)) { in tls_construct_client_hello()
1235 if (!ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), pkt)) { in tls_construct_client_hello()
1239 if (!WPACKET_close(pkt)) { in tls_construct_client_hello()
1245 if (!WPACKET_start_sub_packet_u8(pkt)) { in tls_construct_client_hello()
1256 if (!WPACKET_put_bytes_u8(pkt, comp->id)) { in tls_construct_client_hello()
1264 if (!WPACKET_put_bytes_u8(pkt, 0) || !WPACKET_close(pkt)) { in tls_construct_client_hello()
1270 if (!tls_construct_extensions(s, pkt, SSL_EXT_CLIENT_HELLO, NULL, 0)) { in tls_construct_client_hello()
1278 MSG_PROCESS_RETURN dtls_process_hello_verify(SSL *s, PACKET *pkt) in dtls_process_hello_verify() argument
1283 if (!PACKET_forward(pkt, 2) in dtls_process_hello_verify()
1284 || !PACKET_get_length_prefixed_1(pkt, &cookiepkt)) { in dtls_process_hello_verify()
1374 MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt) in tls_process_server_hello() argument
1388 if (!PACKET_get_net_2(pkt, &sversion)) { in tls_process_server_hello()
1396 && PACKET_remaining(pkt) >= SSL3_RANDOM_SIZE in tls_process_server_hello()
1397 && memcmp(hrrrandom, PACKET_data(pkt), SSL3_RANDOM_SIZE) == 0) { in tls_process_server_hello()
1400 if (!PACKET_forward(pkt, SSL3_RANDOM_SIZE)) { in tls_process_server_hello()
1405 if (!PACKET_copy_bytes(pkt, s->s3.server_random, SSL3_RANDOM_SIZE)) { in tls_process_server_hello()
1412 if (!PACKET_get_length_prefixed_1(pkt, &session_id)) { in tls_process_server_hello()
1423 if (!PACKET_get_bytes(pkt, &cipherchars, TLS_CIPHER_LEN)) { in tls_process_server_hello()
1428 if (!PACKET_get_1(pkt, &compression)) { in tls_process_server_hello()
1434 if (PACKET_remaining(pkt) == 0 && !hrr) { in tls_process_server_hello()
1436 } else if (!PACKET_as_length_prefixed_2(pkt, &extpkt) in tls_process_server_hello()
1437 || PACKET_remaining(pkt) != 0) { in tls_process_server_hello()
1767 MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt) in tls_process_server_certificate() argument
1780 if ((SSL_IS_TLS13(s) && !PACKET_get_1(pkt, &context)) in tls_process_server_certificate()
1782 || !PACKET_get_net_3(pkt, &cert_list_len) in tls_process_server_certificate()
1783 || PACKET_remaining(pkt) != cert_list_len in tls_process_server_certificate()
1784 || PACKET_remaining(pkt) == 0) { in tls_process_server_certificate()
1788 for (chainidx = 0; PACKET_remaining(pkt); chainidx++) { in tls_process_server_certificate()
1789 if (!PACKET_get_net_3(pkt, &cert_len) in tls_process_server_certificate()
1790 || !PACKET_get_bytes(pkt, &certbytes, cert_len)) { in tls_process_server_certificate()
1817 if (!PACKET_get_length_prefixed_2(pkt, &extensions)) { in tls_process_server_certificate()
1826 PACKET_remaining(pkt) == 0)) { in tls_process_server_certificate()
1934 static int tls_process_ske_psk_preamble(SSL *s, PACKET *pkt) in tls_process_ske_psk_preamble() argument
1941 if (!PACKET_get_length_prefixed_2(pkt, &psk_identity_hint)) { in tls_process_ske_psk_preamble()
1973 static int tls_process_ske_srp(SSL *s, PACKET *pkt, EVP_PKEY **pkey) in tls_process_ske_srp() argument
1978 if (!PACKET_get_length_prefixed_2(pkt, &prime) in tls_process_ske_srp()
1979 || !PACKET_get_length_prefixed_2(pkt, &generator) in tls_process_ske_srp()
1980 || !PACKET_get_length_prefixed_1(pkt, &salt) in tls_process_ske_srp()
1981 || !PACKET_get_length_prefixed_2(pkt, &server_pub)) { in tls_process_ske_srp()
2018 static int tls_process_ske_dhe(SSL *s, PACKET *pkt, EVP_PKEY **pkey) in tls_process_ske_dhe() argument
2028 if (!PACKET_get_length_prefixed_2(pkt, &prime) in tls_process_ske_dhe()
2029 || !PACKET_get_length_prefixed_2(pkt, &generator) in tls_process_ske_dhe()
2030 || !PACKET_get_length_prefixed_2(pkt, &pub_key)) { in tls_process_ske_dhe()
2114 static int tls_process_ske_ecdhe(SSL *s, PACKET *pkt, EVP_PKEY **pkey) in tls_process_ske_ecdhe() argument
2124 if (!PACKET_get_1(pkt, &curve_type) || !PACKET_get_net_2(pkt, &curve_id)) { in tls_process_ske_ecdhe()
2144 if (!PACKET_get_length_prefixed_1(pkt, &encoded_pt)) { in tls_process_ske_ecdhe()
2172 MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt) in tls_process_key_exchange() argument
2182 save_param_start = *pkt; in tls_process_key_exchange()
2188 if (!tls_process_ske_psk_preamble(s, pkt)) { in tls_process_key_exchange()
2197 if (!tls_process_ske_srp(s, pkt, &pkey)) { in tls_process_key_exchange()
2202 if (!tls_process_ske_dhe(s, pkt, &pkey)) { in tls_process_key_exchange()
2207 if (!tls_process_ske_ecdhe(s, pkt, &pkey)) { in tls_process_key_exchange()
2230 PACKET_remaining(pkt))) { in tls_process_key_exchange()
2238 if (!PACKET_get_net_2(pkt, &sigalg)) { in tls_process_key_exchange()
2260 if (!PACKET_get_length_prefixed_2(pkt, &signature) in tls_process_key_exchange()
2261 || PACKET_remaining(pkt) != 0) { in tls_process_key_exchange()
2315 if (PACKET_remaining(pkt) != 0) { in tls_process_key_exchange()
2327 MSG_PROCESS_RETURN tls_process_certificate_request(SSL *s, PACKET *pkt) in tls_process_certificate_request() argument
2356 if (!PACKET_get_length_prefixed_1(pkt, &reqctx) || in tls_process_certificate_request()
2362 if (!PACKET_get_length_prefixed_2(pkt, &extensions)) { in tls_process_certificate_request()
2384 if (!PACKET_get_length_prefixed_1(pkt, &ctypes)) { in tls_process_certificate_request()
2397 if (!PACKET_get_length_prefixed_2(pkt, &sigalgs)) { in tls_process_certificate_request()
2418 if (!parse_ca_names(s, pkt)) { in tls_process_certificate_request()
2424 if (PACKET_remaining(pkt) != 0) { in tls_process_certificate_request()
2446 MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt) in tls_process_new_session_ticket() argument
2457 if (!PACKET_get_net_4(pkt, &ticket_lifetime_hint) in tls_process_new_session_ticket()
2459 && (!PACKET_get_net_4(pkt, &age_add) in tls_process_new_session_ticket()
2460 || !PACKET_get_length_prefixed_1(pkt, &nonce))) in tls_process_new_session_ticket()
2461 || !PACKET_get_net_2(pkt, &ticklen) in tls_process_new_session_ticket()
2462 || (SSL_IS_TLS13(s) ? (ticklen == 0 || PACKET_remaining(pkt) < ticklen) in tls_process_new_session_ticket()
2463 : PACKET_remaining(pkt) != ticklen)) { in tls_process_new_session_ticket()
2522 if (!PACKET_copy_bytes(pkt, s->session->ext.tick, ticklen)) { in tls_process_new_session_ticket()
2534 if (!PACKET_as_length_prefixed_2(pkt, &extpkt) in tls_process_new_session_ticket()
2535 || PACKET_remaining(pkt) != 0) { in tls_process_new_session_ticket()
2625 int tls_process_cert_status_body(SSL *s, PACKET *pkt) in tls_process_cert_status_body() argument
2630 if (!PACKET_get_1(pkt, &type) in tls_process_cert_status_body()
2635 if (!PACKET_get_net_3_len(pkt, &resplen) in tls_process_cert_status_body()
2636 || PACKET_remaining(pkt) != resplen) { in tls_process_cert_status_body()
2647 if (!PACKET_copy_bytes(pkt, s->ext.ocsp.resp, resplen)) { in tls_process_cert_status_body()
2656 MSG_PROCESS_RETURN tls_process_cert_status(SSL *s, PACKET *pkt) in tls_process_cert_status() argument
2658 if (!tls_process_cert_status_body(s, pkt)) { in tls_process_cert_status()
2716 MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt) in tls_process_server_done() argument
2718 if (PACKET_remaining(pkt) > 0) { in tls_process_server_done()
2740 static int tls_construct_cke_psk_preamble(SSL *s, WPACKET *pkt) in tls_construct_cke_psk_preamble() argument
2797 if (!WPACKET_sub_memcpy_u16(pkt, identity, identitylen)) { in tls_construct_cke_psk_preamble()
2817 static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) in tls_construct_cke_rsa() argument
2855 if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { in tls_construct_cke_rsa()
2866 if (!WPACKET_allocate_bytes(pkt, enclen, &encdata) in tls_construct_cke_rsa()
2875 if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) { in tls_construct_cke_rsa()
2897 static int tls_construct_cke_dhe(SSL *s, WPACKET *pkt) in tls_construct_cke_dhe() argument
2941 if (!WPACKET_sub_allocate_bytes_u16(pkt, pad_len, &keybytes)) { in tls_construct_cke_dhe()
2948 if (!WPACKET_sub_memcpy_u16(pkt, encoded_pub, encoded_pub_len)) { in tls_construct_cke_dhe()
2960 static int tls_construct_cke_ecdhe(SSL *s, WPACKET *pkt) in tls_construct_cke_ecdhe() argument
2992 if (!WPACKET_sub_memcpy_u8(pkt, encodedPoint, encoded_pt_len)) { in tls_construct_cke_ecdhe()
3004 static int tls_construct_cke_gost(SSL *s, WPACKET *pkt) in tls_construct_cke_gost() argument
3091 if (!WPACKET_put_bytes_u8(pkt, V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED) in tls_construct_cke_gost()
3092 || (msglen >= 0x80 && !WPACKET_put_bytes_u8(pkt, 0x81)) in tls_construct_cke_gost()
3093 || !WPACKET_sub_memcpy_u8(pkt, tmp, msglen)) { in tls_construct_cke_gost()
3150 static int tls_construct_cke_gost18(SSL *s, WPACKET *pkt) in tls_construct_cke_gost18() argument
3225 if (!WPACKET_memcpy(pkt, tmp, msglen)) { in tls_construct_cke_gost18()
3245 static int tls_construct_cke_srp(SSL *s, WPACKET *pkt) in tls_construct_cke_srp() argument
3251 || !WPACKET_sub_allocate_bytes_u16(pkt, BN_num_bytes(s->srp_ctx.A), in tls_construct_cke_srp()
3272 int tls_construct_client_key_exchange(SSL *s, WPACKET *pkt) in tls_construct_client_key_exchange() argument
3283 && !tls_construct_cke_psk_preamble(s, pkt)) in tls_construct_client_key_exchange()
3287 if (!tls_construct_cke_rsa(s, pkt)) in tls_construct_client_key_exchange()
3290 if (!tls_construct_cke_dhe(s, pkt)) in tls_construct_client_key_exchange()
3293 if (!tls_construct_cke_ecdhe(s, pkt)) in tls_construct_client_key_exchange()
3296 if (!tls_construct_cke_gost(s, pkt)) in tls_construct_client_key_exchange()
3299 if (!tls_construct_cke_gost18(s, pkt)) in tls_construct_client_key_exchange()
3302 if (!tls_construct_cke_srp(s, pkt)) in tls_construct_client_key_exchange()
3492 int tls_construct_client_certificate(SSL *s, WPACKET *pkt) in tls_construct_client_certificate() argument
3497 if (!WPACKET_put_bytes_u8(pkt, 0)) { in tls_construct_client_certificate()
3501 } else if (!WPACKET_sub_memcpy_u8(pkt, s->pha_context, s->pha_context_len)) { in tls_construct_client_certificate()
3506 if (!ssl3_output_cert_chain(s, pkt, in tls_construct_client_certificate()
3572 int tls_construct_next_proto(SSL *s, WPACKET *pkt) in tls_construct_next_proto() argument
3580 if (!WPACKET_sub_memcpy_u8(pkt, s->ext.npn, len) in tls_construct_next_proto()
3581 || !WPACKET_sub_allocate_bytes_u8(pkt, padding_len, &padding)) { in tls_construct_next_proto()
3592 MSG_PROCESS_RETURN tls_process_hello_req(SSL *s, PACKET *pkt) in tls_process_hello_req() argument
3594 if (PACKET_remaining(pkt) > 0) { in tls_process_hello_req()
3620 static MSG_PROCESS_RETURN tls_process_encrypted_extensions(SSL *s, PACKET *pkt) in tls_process_encrypted_extensions() argument
3625 if (!PACKET_as_length_prefixed_2(pkt, &extensions) in tls_process_encrypted_extensions()
3626 || PACKET_remaining(pkt) != 0) { in tls_process_encrypted_extensions()
3663 int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, WPACKET *pkt) in ssl_cipher_list_to_bytes() argument
3709 if (!s->method->put_cipher_by_char(c, pkt, &len)) { in ssl_cipher_list_to_bytes()
3746 if (!s->method->put_cipher_by_char(&scsv, pkt, &len)) { in ssl_cipher_list_to_bytes()
3755 if (!s->method->put_cipher_by_char(&scsv, pkt, &len)) { in ssl_cipher_list_to_bytes()
3765 int tls_construct_end_of_early_data(SSL *s, WPACKET *pkt) in tls_construct_end_of_early_data() argument