Lines Matching refs:p

62     unsigned char *p = buf;  in ssl_write_renegotiation_ext()  local
76 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 5 + ssl->verify_data_len); in ssl_write_renegotiation_ext()
81 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_RENEGOTIATION_INFO, p, 0); in ssl_write_renegotiation_ext()
82 p += 2; in ssl_write_renegotiation_ext()
84 *p++ = 0x00; in ssl_write_renegotiation_ext()
85 *p++ = MBEDTLS_BYTE_0(ssl->verify_data_len + 1); in ssl_write_renegotiation_ext()
86 *p++ = MBEDTLS_BYTE_0(ssl->verify_data_len); in ssl_write_renegotiation_ext()
88 memcpy(p, ssl->own_verify_data, ssl->verify_data_len); in ssl_write_renegotiation_ext()
105 unsigned char *p = buf; in ssl_write_supported_point_formats_ext() local
112 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 6); in ssl_write_supported_point_formats_ext()
114 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS, p, 0); in ssl_write_supported_point_formats_ext()
115 p += 2; in ssl_write_supported_point_formats_ext()
117 *p++ = 0x00; in ssl_write_supported_point_formats_ext()
118 *p++ = 2; in ssl_write_supported_point_formats_ext()
120 *p++ = 1; in ssl_write_supported_point_formats_ext()
121 *p++ = MBEDTLS_ECP_PF_UNCOMPRESSED; in ssl_write_supported_point_formats_ext()
138 unsigned char *p = buf; in ssl_write_ecjpake_kkpp_ext() local
157 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4); in ssl_write_ecjpake_kkpp_ext()
159 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_ECJPAKE_KKPP, p, 0); in ssl_write_ecjpake_kkpp_ext()
160 p += 2; in ssl_write_ecjpake_kkpp_ext()
173 p + 2, end - p - 2, &kkpp_len, in ssl_write_ecjpake_kkpp_ext()
183 p + 2, end - p - 2, &kkpp_len, in ssl_write_ecjpake_kkpp_ext()
198 memcpy(ssl->handshake->ecjpake_cache, p + 2, kkpp_len); in ssl_write_ecjpake_kkpp_ext()
204 MBEDTLS_SSL_CHK_BUF_PTR(p + 2, end, kkpp_len); in ssl_write_ecjpake_kkpp_ext()
206 memcpy(p + 2, ssl->handshake->ecjpake_cache, kkpp_len); in ssl_write_ecjpake_kkpp_ext()
209 MBEDTLS_PUT_UINT16_BE(kkpp_len, p, 0); in ssl_write_ecjpake_kkpp_ext()
210 p += 2; in ssl_write_ecjpake_kkpp_ext()
225 unsigned char *p = buf; in ssl_write_cid_ext() local
243 MBEDTLS_SSL_CHK_BUF_PTR(p, end, (unsigned) (ssl->own_cid_len + 5)); in ssl_write_cid_ext()
246 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_CID, p, 0); in ssl_write_cid_ext()
247 p += 2; in ssl_write_cid_ext()
249 MBEDTLS_PUT_UINT16_BE(ext_len, p, 0); in ssl_write_cid_ext()
250 p += 2; in ssl_write_cid_ext()
252 *p++ = (uint8_t) ssl->own_cid_len; in ssl_write_cid_ext()
253 memcpy(p, ssl->own_cid, ssl->own_cid_len); in ssl_write_cid_ext()
268 unsigned char *p = buf; in ssl_write_max_fragment_length_ext() local
279 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 5); in ssl_write_max_fragment_length_ext()
281 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH, p, 0); in ssl_write_max_fragment_length_ext()
282 p += 2; in ssl_write_max_fragment_length_ext()
284 *p++ = 0x00; in ssl_write_max_fragment_length_ext()
285 *p++ = 1; in ssl_write_max_fragment_length_ext()
287 *p++ = ssl->conf->mfl_code; in ssl_write_max_fragment_length_ext()
302 unsigned char *p = buf; in ssl_write_encrypt_then_mac_ext() local
313 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4); in ssl_write_encrypt_then_mac_ext()
315 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC, p, 0); in ssl_write_encrypt_then_mac_ext()
316 p += 2; in ssl_write_encrypt_then_mac_ext()
318 *p++ = 0x00; in ssl_write_encrypt_then_mac_ext()
319 *p++ = 0x00; in ssl_write_encrypt_then_mac_ext()
334 unsigned char *p = buf; in ssl_write_extended_ms_ext() local
345 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4); in ssl_write_extended_ms_ext()
347 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET, p, 0); in ssl_write_extended_ms_ext()
348 p += 2; in ssl_write_extended_ms_ext()
350 *p++ = 0x00; in ssl_write_extended_ms_ext()
351 *p++ = 0x00; in ssl_write_extended_ms_ext()
366 unsigned char *p = buf; in ssl_write_session_ticket_ext() local
379 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 4 + tlen); in ssl_write_session_ticket_ext()
381 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_SESSION_TICKET, p, 0); in ssl_write_session_ticket_ext()
382 p += 2; in ssl_write_session_ticket_ext()
384 MBEDTLS_PUT_UINT16_BE(tlen, p, 0); in ssl_write_session_ticket_ext()
385 p += 2; in ssl_write_session_ticket_ext()
396 memcpy(p, ssl->session_negotiate->ticket, tlen); in ssl_write_session_ticket_ext()
411 unsigned char *p = buf; in ssl_write_use_srtp_ext() local
447 MBEDTLS_SSL_CHK_BUF_PTR(p, end, ext_len + 4); in ssl_write_use_srtp_ext()
449 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_USE_SRTP, p, 0); in ssl_write_use_srtp_ext()
450 p += 2; in ssl_write_use_srtp_ext()
452 MBEDTLS_PUT_UINT16_BE(ext_len, p, 0); in ssl_write_use_srtp_ext()
453 p += 2; in ssl_write_use_srtp_ext()
463 *p++ = 0; in ssl_write_use_srtp_ext()
464 *p++ = MBEDTLS_BYTE_0(2 * ssl->conf->dtls_srtp_profile_list_len); in ssl_write_use_srtp_ext()
474 MBEDTLS_PUT_UINT16_BE(profile_value, p, 0); in ssl_write_use_srtp_ext()
475 p += 2; in ssl_write_use_srtp_ext()
490 *p++ = mki_len & 0xFF; in ssl_write_use_srtp_ext()
493 memcpy(p, ssl->dtls_srtp_info.mki_value, mki_len); in ssl_write_use_srtp_ext()
497 p += mki_len; in ssl_write_use_srtp_ext()
510 *olen = p - buf; in ssl_write_use_srtp_ext()
523 unsigned char *p = buf; in mbedtls_ssl_tls12_write_client_hello_exts() local
537 if ((ret = ssl_write_renegotiation_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
541 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
547 if ((ret = ssl_write_supported_point_formats_ext(ssl, p, end, in mbedtls_ssl_tls12_write_client_hello_exts()
552 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
557 if ((ret = ssl_write_ecjpake_kkpp_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
561 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
565 if ((ret = ssl_write_cid_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
569 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
573 if ((ret = ssl_write_max_fragment_length_ext(ssl, p, end, in mbedtls_ssl_tls12_write_client_hello_exts()
578 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
582 if ((ret = ssl_write_encrypt_then_mac_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
586 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
590 if ((ret = ssl_write_extended_ms_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
594 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
598 if ((ret = ssl_write_use_srtp_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
602 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
606 if ((ret = ssl_write_session_ticket_ext(ssl, p, end, &ext_len)) != 0) { in mbedtls_ssl_tls12_write_client_hello_exts()
610 p += ext_len; in mbedtls_ssl_tls12_write_client_hello_exts()
613 *out_len = p - buf; in mbedtls_ssl_tls12_write_client_hello_exts()
820 const unsigned char *p; in ssl_parse_supported_point_formats_ext() local
830 p = buf + 1; in ssl_parse_supported_point_formats_ext()
832 if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || in ssl_parse_supported_point_formats_ext()
833 p[0] == MBEDTLS_ECP_PF_COMPRESSED) { in ssl_parse_supported_point_formats_ext()
836 ssl->handshake->ecdh_ctx.point_format = p[0]; in ssl_parse_supported_point_formats_ext()
842 p[0]); in ssl_parse_supported_point_formats_ext()
844 MBEDTLS_SSL_DEBUG_MSG(4, ("point format selected: %d", p[0])); in ssl_parse_supported_point_formats_ext()
849 p++; in ssl_parse_supported_point_formats_ext()
917 const char **p; in ssl_parse_alpn_ext() local
961 for (p = ssl->conf->alpn_list; *p != NULL; p++) { in ssl_parse_alpn_ext()
962 if (name_len == strlen(*p) && in ssl_parse_alpn_ext()
963 memcmp(buf + 3, *p, name_len) == 0) { in ssl_parse_alpn_ext()
964 ssl->alpn_chosen = *p; in ssl_parse_alpn_ext()
1097 const unsigned char *p = ssl->in_msg + mbedtls_ssl_hs_hdr_len(ssl); in ssl_parse_hello_verify_request() local
1126 MBEDTLS_SSL_DEBUG_BUF(3, "server version", p, 2); in ssl_parse_hello_verify_request()
1127 dtls_legacy_version = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_parse_hello_verify_request()
1128 p += 2; in ssl_parse_hello_verify_request()
1144 cookie_len = *p++; in ssl_parse_hello_verify_request()
1145 if ((ssl->in_msg + ssl->in_msglen) - p < cookie_len) { in ssl_parse_hello_verify_request()
1152 MBEDTLS_SSL_DEBUG_BUF(3, "cookie", p, cookie_len); in ssl_parse_hello_verify_request()
1162 memcpy(ssl->handshake->cookie, p, cookie_len); in ssl_parse_hello_verify_request()
1669 unsigned char **p, in ssl_parse_server_dh_params() argument
1685 p, end)) != 0) { in ssl_parse_server_dh_params()
1713 unsigned char **p, in ssl_parse_server_ecdh_params() argument
1733 if (end - *p < 4) { in ssl_parse_server_ecdh_params()
1738 if (*(*p)++ != MBEDTLS_ECP_TLS_NAMED_CURVE) { in ssl_parse_server_ecdh_params()
1743 tls_id = *(*p)++; in ssl_parse_server_ecdh_params()
1745 tls_id |= *(*p)++; in ssl_parse_server_ecdh_params()
1764 ecpoint_len = *(*p)++; in ssl_parse_server_ecdh_params()
1765 if ((size_t) (end - *p) < ecpoint_len) { in ssl_parse_server_ecdh_params()
1773 memcpy(handshake->ecdh_psa_peerkey, *p, ecpoint_len); in ssl_parse_server_ecdh_params()
1775 *p += ecpoint_len; in ssl_parse_server_ecdh_params()
1829 unsigned char **p, in ssl_parse_server_ecdh_params() argument
1843 (const unsigned char **) p, end)) != 0) { in ssl_parse_server_ecdh_params()
1868 unsigned char **p, in ssl_parse_server_psk_hint() argument
1880 if (end - (*p) < 2) { in ssl_parse_server_psk_hint()
1885 len = (*p)[0] << 8 | (*p)[1]; in ssl_parse_server_psk_hint()
1886 *p += 2; in ssl_parse_server_psk_hint()
1888 if (end - (*p) < len) { in ssl_parse_server_psk_hint()
1899 *p += len; in ssl_parse_server_psk_hint()
1918 unsigned char *p = ssl->handshake->premaster + pms_offset; in ssl_write_encrypted_pms() local
1933 mbedtls_ssl_write_version(p, ssl->conf->transport, in ssl_write_encrypted_pms()
1936 if ((ret = ssl->conf->f_rng(ssl->conf->p_rng, p + 2, 46)) != 0) { in ssl_write_encrypted_pms()
1963 p, ssl->handshake->pmslen, in ssl_write_encrypted_pms()
2080 unsigned char *p = NULL, *end = NULL; in ssl_parse_server_key_exchange() local
2090 ((void) p); in ssl_parse_server_key_exchange()
2111 ((void) p); in ssl_parse_server_key_exchange()
2167 p = ssl->in_msg + mbedtls_ssl_hs_hdr_len(ssl); in ssl_parse_server_key_exchange()
2169 MBEDTLS_SSL_DEBUG_BUF(3, "server key exchange", p, end - p); in ssl_parse_server_key_exchange()
2176 if (ssl_parse_server_psk_hint(ssl, &p, end) != 0) { in ssl_parse_server_key_exchange()
2199 if (ssl_parse_server_dh_params(ssl, &p, end) != 0) { in ssl_parse_server_key_exchange()
2216 if (ssl_parse_server_ecdh_params(ssl, &p, end) != 0) { in ssl_parse_server_key_exchange()
2239 uint16_t read_tls_id = MBEDTLS_GET_UINT16_BE(p, 1); in ssl_parse_server_key_exchange()
2247 if ((*p != MBEDTLS_ECP_TLS_NAMED_CURVE) || in ssl_parse_server_key_exchange()
2252 p += 3; in ssl_parse_server_key_exchange()
2255 &ssl->handshake->psa_pake_ctx, p, end - p, in ssl_parse_server_key_exchange()
2269 p, end - p); in ssl_parse_server_key_exchange()
2294 size_t params_len = p - params; in ssl_parse_server_key_exchange()
2314 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, 2); in ssl_parse_server_key_exchange()
2315 sig_alg = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_parse_server_key_exchange()
2328 p += 2; in ssl_parse_server_key_exchange()
2344 if (p > end - 2) { in ssl_parse_server_key_exchange()
2352 sig_len = (p[0] << 8) | p[1]; in ssl_parse_server_key_exchange()
2353 p += 2; in ssl_parse_server_key_exchange()
2355 if (p != end - sig_len) { in ssl_parse_server_key_exchange()
2364 MBEDTLS_SSL_DEBUG_BUF(3, "signature", p, sig_len); in ssl_parse_server_key_exchange()
2414 p, sig_len); in ssl_parse_server_key_exchange()
2418 md_alg, hash, hashlen, p, sig_len, rs_ctx); in ssl_parse_server_key_exchange()
2630 unsigned char *p = dn + i + 2; in ssl_parse_certificate_request() local
2637 mbedtls_asn1_get_tag(&p, p + dni_len, &asn1_len, in ssl_parse_certificate_request()
2639 mbedtls_x509_get_name(&p, p + asn1_len, &name) != 0) { in ssl_parse_certificate_request()
2922 unsigned char *p = ssl->out_msg + header_len; in ssl_write_client_key_exchange() local
2924 *p++ = MBEDTLS_BYTE_1(ssl->conf->psk_identity_len); in ssl_write_client_key_exchange()
2925 *p++ = MBEDTLS_BYTE_0(ssl->conf->psk_identity_len); in ssl_write_client_key_exchange()
2928 memcpy(p, ssl->conf->psk_identity, in ssl_write_client_key_exchange()
2930 p += ssl->conf->psk_identity_len; in ssl_write_client_key_exchange()
2963 unsigned char *own_pubkey = p + 1; in ssl_write_client_key_exchange()
2977 *p = (unsigned char) own_pubkey_len; in ssl_write_client_key_exchange()