Lines Matching refs:p

56     unsigned char *p = buf;  in ssl_write_renegotiation_ext()  local
70 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 5 + ssl->verify_data_len); in ssl_write_renegotiation_ext()
75 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_RENEGOTIATION_INFO, p, 0); in ssl_write_renegotiation_ext()
76 p += 2; in ssl_write_renegotiation_ext()
78 *p++ = 0x00; in ssl_write_renegotiation_ext()
79 *p++ = MBEDTLS_BYTE_0(ssl->verify_data_len + 1); in ssl_write_renegotiation_ext()
80 *p++ = MBEDTLS_BYTE_0(ssl->verify_data_len); in ssl_write_renegotiation_ext()
82 memcpy(p, ssl->own_verify_data, ssl->verify_data_len); in ssl_write_renegotiation_ext()
100 unsigned char *p = buf; in ssl_write_supported_point_formats_ext() local
107 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 6); in ssl_write_supported_point_formats_ext()
109 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS, p, 0); in ssl_write_supported_point_formats_ext()
110 p += 2; in ssl_write_supported_point_formats_ext()
112 *p++ = 0x00; in ssl_write_supported_point_formats_ext()
113 *p++ = 2; in ssl_write_supported_point_formats_ext()
115 *p++ = 1; in ssl_write_supported_point_formats_ext()
116 *p++ = MBEDTLS_ECP_PF_UNCOMPRESSED; in ssl_write_supported_point_formats_ext()
134 unsigned char *p = buf; in ssl_write_ecjpake_kkpp_ext() local
153 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4); in ssl_write_ecjpake_kkpp_ext()
155 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_ECJPAKE_KKPP, p, 0); in ssl_write_ecjpake_kkpp_ext()
156 p += 2; in ssl_write_ecjpake_kkpp_ext()
169 p + 2, end - p - 2, &kkpp_len, in ssl_write_ecjpake_kkpp_ext()
179 p + 2, end - p - 2, &kkpp_len, in ssl_write_ecjpake_kkpp_ext()
194 memcpy(ssl->handshake->ecjpake_cache, p + 2, kkpp_len); in ssl_write_ecjpake_kkpp_ext()
200 MBEDTLS_SSL_CHK_BUF_PTR(p + 2, end, kkpp_len); in ssl_write_ecjpake_kkpp_ext()
202 memcpy(p + 2, ssl->handshake->ecjpake_cache, kkpp_len); in ssl_write_ecjpake_kkpp_ext()
205 MBEDTLS_PUT_UINT16_BE(kkpp_len, p, 0); in ssl_write_ecjpake_kkpp_ext()
206 p += 2; in ssl_write_ecjpake_kkpp_ext()
221 unsigned char *p = buf; in ssl_write_cid_ext() local
239 MBEDTLS_SSL_CHK_BUF_PTR(p, end, (unsigned) (ssl->own_cid_len + 5)); in ssl_write_cid_ext()
242 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_CID, p, 0); in ssl_write_cid_ext()
243 p += 2; in ssl_write_cid_ext()
245 MBEDTLS_PUT_UINT16_BE(ext_len, p, 0); in ssl_write_cid_ext()
246 p += 2; in ssl_write_cid_ext()
248 *p++ = (uint8_t) ssl->own_cid_len; in ssl_write_cid_ext()
249 memcpy(p, ssl->own_cid, ssl->own_cid_len); in ssl_write_cid_ext()
264 unsigned char *p = buf; in ssl_write_max_fragment_length_ext() local
275 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 5); in ssl_write_max_fragment_length_ext()
277 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH, p, 0); in ssl_write_max_fragment_length_ext()
278 p += 2; in ssl_write_max_fragment_length_ext()
280 *p++ = 0x00; in ssl_write_max_fragment_length_ext()
281 *p++ = 1; in ssl_write_max_fragment_length_ext()
283 *p++ = ssl->conf->mfl_code; in ssl_write_max_fragment_length_ext()
298 unsigned char *p = buf; in ssl_write_encrypt_then_mac_ext() local
309 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4); in ssl_write_encrypt_then_mac_ext()
311 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC, p, 0); in ssl_write_encrypt_then_mac_ext()
312 p += 2; in ssl_write_encrypt_then_mac_ext()
314 *p++ = 0x00; in ssl_write_encrypt_then_mac_ext()
315 *p++ = 0x00; in ssl_write_encrypt_then_mac_ext()
330 unsigned char *p = buf; in ssl_write_extended_ms_ext() local
341 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4); in ssl_write_extended_ms_ext()
343 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET, p, 0); in ssl_write_extended_ms_ext()
344 p += 2; in ssl_write_extended_ms_ext()
346 *p++ = 0x00; in ssl_write_extended_ms_ext()
347 *p++ = 0x00; in ssl_write_extended_ms_ext()
362 unsigned char *p = buf; in ssl_write_session_ticket_ext() local
375 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4 + tlen); in ssl_write_session_ticket_ext()
377 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_SESSION_TICKET, p, 0); in ssl_write_session_ticket_ext()
378 p += 2; in ssl_write_session_ticket_ext()
380 MBEDTLS_PUT_UINT16_BE(tlen, p, 0); in ssl_write_session_ticket_ext()
381 p += 2; in ssl_write_session_ticket_ext()
392 memcpy(p, ssl->session_negotiate->ticket, tlen); in ssl_write_session_ticket_ext()
407 unsigned char *p = buf; in ssl_write_use_srtp_ext() local
443 MBEDTLS_SSL_CHK_BUF_PTR(p, end, ext_len + 4); in ssl_write_use_srtp_ext()
445 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_USE_SRTP, p, 0); in ssl_write_use_srtp_ext()
446 p += 2; in ssl_write_use_srtp_ext()
448 MBEDTLS_PUT_UINT16_BE(ext_len, p, 0); in ssl_write_use_srtp_ext()
449 p += 2; in ssl_write_use_srtp_ext()
459 *p++ = 0; in ssl_write_use_srtp_ext()
460 *p++ = MBEDTLS_BYTE_0(2 * ssl->conf->dtls_srtp_profile_list_len); in ssl_write_use_srtp_ext()
470 MBEDTLS_PUT_UINT16_BE(profile_value, p, 0); in ssl_write_use_srtp_ext()
471 p += 2; in ssl_write_use_srtp_ext()
486 *p++ = mki_len & 0xFF; in ssl_write_use_srtp_ext()
489 memcpy(p, ssl->dtls_srtp_info.mki_value, mki_len); in ssl_write_use_srtp_ext()
493 p += mki_len; in ssl_write_use_srtp_ext()
506 *olen = p - buf; in ssl_write_use_srtp_ext()
519 unsigned char *p = buf; in mbedtls_ssl_tls12_write_client_hello_exts() local
533 if ((ret = ssl_write_renegotiation_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
537 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
544 if ((ret = ssl_write_supported_point_formats_ext(ssl, p, end, in mbedtls_ssl_tls12_write_client_hello_exts()
549 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
554 if ((ret = ssl_write_ecjpake_kkpp_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
558 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
562 if ((ret = ssl_write_cid_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
566 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
570 if ((ret = ssl_write_max_fragment_length_ext(ssl, p, end, in mbedtls_ssl_tls12_write_client_hello_exts()
575 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
579 if ((ret = ssl_write_encrypt_then_mac_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
583 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
587 if ((ret = ssl_write_extended_ms_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
591 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
595 if ((ret = ssl_write_use_srtp_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
599 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
603 if ((ret = ssl_write_session_ticket_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
607 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
610 *out_len = p - buf; in mbedtls_ssl_tls12_write_client_hello_exts()
818 const unsigned char *p; in ssl_parse_supported_point_formats_ext() local
828 p = buf + 1; in ssl_parse_supported_point_formats_ext()
830 if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || in ssl_parse_supported_point_formats_ext()
831 p[0] == MBEDTLS_ECP_PF_COMPRESSED) { in ssl_parse_supported_point_formats_ext()
834 ssl->handshake->ecdh_ctx.point_format = p[0]; in ssl_parse_supported_point_formats_ext()
839 p[0]); in ssl_parse_supported_point_formats_ext()
841 MBEDTLS_SSL_DEBUG_MSG(4, ("point format selected: %d", p[0])); in ssl_parse_supported_point_formats_ext()
846 p++; in ssl_parse_supported_point_formats_ext()
915 const char **p; in ssl_parse_alpn_ext() local
959 for (p = ssl->conf->alpn_list; *p != NULL; p++) { in ssl_parse_alpn_ext()
960 if (name_len == strlen(*p) && in ssl_parse_alpn_ext()
961 memcmp(buf + 3, *p, name_len) == 0) { in ssl_parse_alpn_ext()
962 ssl->alpn_chosen = *p; in ssl_parse_alpn_ext()
1095 const unsigned char *p = ssl->in_msg + mbedtls_ssl_hs_hdr_len(ssl); in ssl_parse_hello_verify_request() local
1124 MBEDTLS_SSL_DEBUG_BUF(3, "server version", p, 2); in ssl_parse_hello_verify_request()
1125 dtls_legacy_version = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_parse_hello_verify_request()
1126 p += 2; in ssl_parse_hello_verify_request()
1142 cookie_len = *p++; in ssl_parse_hello_verify_request()
1143 if ((ssl->in_msg + ssl->in_msglen) - p < cookie_len) { in ssl_parse_hello_verify_request()
1150 MBEDTLS_SSL_DEBUG_BUF(3, "cookie", p, cookie_len); in ssl_parse_hello_verify_request()
1160 memcpy(ssl->handshake->cookie, p, cookie_len); in ssl_parse_hello_verify_request()
1670 unsigned char **p, in ssl_parse_server_dh_params() argument
1686 p, end)) != 0) { in ssl_parse_server_dh_params()
1714 unsigned char **p, in ssl_parse_server_ecdh_params() argument
1734 if (end - *p < 4) { in ssl_parse_server_ecdh_params()
1739 if (*(*p)++ != MBEDTLS_ECP_TLS_NAMED_CURVE) { in ssl_parse_server_ecdh_params()
1744 tls_id = *(*p)++; in ssl_parse_server_ecdh_params()
1746 tls_id |= *(*p)++; in ssl_parse_server_ecdh_params()
1765 ecpoint_len = *(*p)++; in ssl_parse_server_ecdh_params()
1766 if ((size_t) (end - *p) < ecpoint_len) { in ssl_parse_server_ecdh_params()
1774 memcpy(handshake->xxdh_psa_peerkey, *p, ecpoint_len); in ssl_parse_server_ecdh_params()
1776 *p += ecpoint_len; in ssl_parse_server_ecdh_params()
1830 unsigned char **p, in ssl_parse_server_ecdh_params() argument
1844 (const unsigned char **) p, end)) != 0) { in ssl_parse_server_ecdh_params()
1869 unsigned char **p, in ssl_parse_server_psk_hint() argument
1881 if (end - (*p) < 2) { in ssl_parse_server_psk_hint()
1886 len = (*p)[0] << 8 | (*p)[1]; in ssl_parse_server_psk_hint()
1887 *p += 2; in ssl_parse_server_psk_hint()
1889 if (end - (*p) < len) { in ssl_parse_server_psk_hint()
1900 *p += len; in ssl_parse_server_psk_hint()
1919 unsigned char *p = ssl->handshake->premaster + pms_offset; in ssl_write_encrypted_pms() local
1934 mbedtls_ssl_write_version(p, ssl->conf->transport, in ssl_write_encrypted_pms()
1937 if ((ret = ssl->conf->f_rng(ssl->conf->p_rng, p + 2, 46)) != 0) { in ssl_write_encrypted_pms()
1964 p, ssl->handshake->pmslen, in ssl_write_encrypted_pms()
2088 unsigned char *p = NULL, *end = NULL; in ssl_parse_server_key_exchange() local
2098 ((void) p); in ssl_parse_server_key_exchange()
2119 ((void) p); in ssl_parse_server_key_exchange()
2175 p = ssl->in_msg + mbedtls_ssl_hs_hdr_len(ssl); in ssl_parse_server_key_exchange()
2177 MBEDTLS_SSL_DEBUG_BUF(3, "server key exchange", p, end - p); in ssl_parse_server_key_exchange()
2184 if (ssl_parse_server_psk_hint(ssl, &p, end) != 0) { in ssl_parse_server_key_exchange()
2207 if (ssl_parse_server_dh_params(ssl, &p, end) != 0) { in ssl_parse_server_key_exchange()
2224 if (ssl_parse_server_ecdh_params(ssl, &p, end) != 0) { in ssl_parse_server_key_exchange()
2247 uint16_t read_tls_id = MBEDTLS_GET_UINT16_BE(p, 1); in ssl_parse_server_key_exchange()
2255 if ((*p != MBEDTLS_ECP_TLS_NAMED_CURVE) || in ssl_parse_server_key_exchange()
2260 p += 3; in ssl_parse_server_key_exchange()
2263 &ssl->handshake->psa_pake_ctx, p, end - p, in ssl_parse_server_key_exchange()
2277 p, end - p); in ssl_parse_server_key_exchange()
2302 size_t params_len = p - params; in ssl_parse_server_key_exchange()
2322 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, 2); in ssl_parse_server_key_exchange()
2323 sig_alg = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_parse_server_key_exchange()
2336 p += 2; in ssl_parse_server_key_exchange()
2352 if (p > end - 2) { in ssl_parse_server_key_exchange()
2360 sig_len = (p[0] << 8) | p[1]; in ssl_parse_server_key_exchange()
2361 p += 2; in ssl_parse_server_key_exchange()
2363 if (p != end - sig_len) { in ssl_parse_server_key_exchange()
2372 MBEDTLS_SSL_DEBUG_BUF(3, "signature", p, sig_len); in ssl_parse_server_key_exchange()
2422 p, sig_len); in ssl_parse_server_key_exchange()
2426 md_alg, hash, hashlen, p, sig_len, rs_ctx); in ssl_parse_server_key_exchange()
2638 unsigned char *p = dn + i + 2; in ssl_parse_certificate_request() local
2645 mbedtls_asn1_get_tag(&p, p + dni_len, &asn1_len, in ssl_parse_certificate_request()
2647 mbedtls_x509_get_name(&p, p + asn1_len, &name) != 0) { in ssl_parse_certificate_request()
2930 unsigned char *p = ssl->out_msg + header_len; in ssl_write_client_key_exchange() local
2932 *p++ = MBEDTLS_BYTE_1(ssl->conf->psk_identity_len); in ssl_write_client_key_exchange()
2933 *p++ = MBEDTLS_BYTE_0(ssl->conf->psk_identity_len); in ssl_write_client_key_exchange()
2936 memcpy(p, ssl->conf->psk_identity, in ssl_write_client_key_exchange()
2938 p += ssl->conf->psk_identity_len; in ssl_write_client_key_exchange()
2971 unsigned char *own_pubkey = p + 1; in ssl_write_client_key_exchange()
2985 *p = (unsigned char) own_pubkey_len; in ssl_write_client_key_exchange()