Lines Matching refs:p

55     volatile unsigned char *p = v; while( n-- ) *p++ = 0;  in mbedtls_zeroize()  local
96 const unsigned char *p; in ssl_parse_servername_ext() local
107 p = buf + 2; in ssl_parse_servername_ext()
110 hostname_len = ( ( p[1] << 8 ) | p[2] ); in ssl_parse_servername_ext()
117 if( p[0] == MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME ) in ssl_parse_servername_ext()
120 ssl, p + 3, hostname_len ); in ssl_parse_servername_ext()
132 p += hostname_len + 3; in ssl_parse_servername_ext()
194 const unsigned char *p; in ssl_parse_signature_algorithms_ext() local
214 for( p = buf + 2; p < end; p += 2 ) { in ssl_parse_signature_algorithms_ext()
215 if( *md_cur == (int) mbedtls_ssl_md_alg_from_hash( p[0] ) ) { in ssl_parse_signature_algorithms_ext()
216 ssl->handshake->sig_alg = p[0]; in ssl_parse_signature_algorithms_ext()
242 const unsigned char *p; in ssl_parse_supported_elliptic_curves() local
271 p = buf + 2; in ssl_parse_supported_elliptic_curves()
274 curve_info = mbedtls_ecp_curve_info_from_tls_id( ( p[0] << 8 ) | p[1] ); in ssl_parse_supported_elliptic_curves()
283 p += 2; in ssl_parse_supported_elliptic_curves()
294 const unsigned char *p; in ssl_parse_supported_point_formats() local
303 p = buf + 1; in ssl_parse_supported_point_formats()
306 if( p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || in ssl_parse_supported_point_formats()
307 p[0] == MBEDTLS_ECP_PF_COMPRESSED ) in ssl_parse_supported_point_formats()
310 ssl->handshake->ecdh_ctx.point_format = p[0]; in ssl_parse_supported_point_formats()
313 ssl->handshake->ecjpake_ctx.point_format = p[0]; in ssl_parse_supported_point_formats()
315 MBEDTLS_SSL_DEBUG_MSG( 4, ( "point format selected: %d", p[0] ) ); in ssl_parse_supported_point_formats()
320 p++; in ssl_parse_supported_point_formats()
806 unsigned char *buf, *p; local
941 p = buf + 6 + ciph_len;
945 memcpy( ssl->session_negotiate->id, p, ssl->session_negotiate->id_len );
947 p += sess_len;
949 memcpy( ssl->handshake->randbytes + 32 - chal_len, p, chal_len );
954 for( i = 0, p = buf + 6; i < ciph_len; i += 3, p += 3 )
956 if( p[0] == 0 && p[1] == 0 && p[2] == MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO )
977 for( i = 0, p = buf + 6; i < ciph_len; i += 3, p += 3 )
979 if( p[0] == 0 &&
980 p[1] == (unsigned char)( ( MBEDTLS_SSL_FALLBACK_SCSV_VALUE >> 8 ) & 0xff ) &&
981 p[2] == (unsigned char)( ( MBEDTLS_SSL_FALLBACK_SCSV_VALUE ) & 0xff ) )
1004 for( j = 0, p = buf + 6; j < ciph_len; j += 3, p += 3 )
1010 for( j = 0, p = buf + 6; j < ciph_len; j += 3, p += 3 )
1013 if( p[0] != 0 ||
1014 p[1] != ( ( ciphersuites[i] >> 8 ) & 0xFF ) ||
1015 p[2] != ( ( ciphersuites[i] ) & 0xFF ) )
1079 unsigned char *buf, *p, *ext; local
1703 for( i = 0, p = buf + 41 + sess_len; i < ciph_len; i += 2, p += 2 )
1705 if( p[0] == (unsigned char)( ( MBEDTLS_SSL_FALLBACK_SCSV_VALUE >> 8 ) & 0xff ) &&
1706 p[1] == (unsigned char)( ( MBEDTLS_SSL_FALLBACK_SCSV_VALUE ) & 0xff ) )
1728 for( i = 0, p = buf + ciph_offset + 2; i < ciph_len; i += 2, p += 2 )
1730 if( p[0] == 0 && p[1] == MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO )
1799 for( j = 0, p = buf + ciph_offset + 2; j < ciph_len; j += 2, p += 2 )
1805 for( j = 0, p = buf + ciph_offset + 2; j < ciph_len; j += 2, p += 2 )
1808 if( p[0] != ( ( ciphersuites[i] >> 8 ) & 0xFF ) ||
1809 p[1] != ( ( ciphersuites[i] ) & 0xFF ) )
1860 unsigned char *p = buf; local
1870 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_TRUNCATED_HMAC >> 8 ) & 0xFF );
1871 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_TRUNCATED_HMAC ) & 0xFF );
1873 *p++ = 0x00;
1874 *p++ = 0x00;
1885 unsigned char *p = buf; local
1913 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC >> 8 ) & 0xFF );
1914 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC ) & 0xFF );
1916 *p++ = 0x00;
1917 *p++ = 0x00;
1928 unsigned char *p = buf; local
1940 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET >> 8 ) & 0xFF );
1941 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET ) & 0xFF );
1943 *p++ = 0x00;
1944 *p++ = 0x00;
1955 unsigned char *p = buf; local
1965 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SESSION_TICKET >> 8 ) & 0xFF );
1966 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SESSION_TICKET ) & 0xFF );
1968 *p++ = 0x00;
1969 *p++ = 0x00;
1979 unsigned char *p = buf; local
1989 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO >> 8 ) & 0xFF );
1990 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO ) & 0xFF );
1995 *p++ = 0x00;
1996 *p++ = ( ssl->verify_data_len * 2 + 1 ) & 0xFF;
1997 *p++ = ssl->verify_data_len * 2 & 0xFF;
1999 memcpy( p, ssl->peer_verify_data, ssl->verify_data_len );
2000 p += ssl->verify_data_len;
2001 memcpy( p, ssl->own_verify_data, ssl->verify_data_len );
2002 p += ssl->verify_data_len;
2007 *p++ = 0x00;
2008 *p++ = 0x01;
2009 *p++ = 0x00;
2012 *olen = p - buf;
2020 unsigned char *p = buf; local
2030 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH >> 8 ) & 0xFF );
2031 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH ) & 0xFF );
2033 *p++ = 0x00;
2034 *p++ = 1;
2036 *p++ = ssl->session_negotiate->mfl_code;
2048 unsigned char *p = buf; local
2060 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS >> 8 ) & 0xFF );
2061 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS ) & 0xFF );
2063 *p++ = 0x00;
2064 *p++ = 2;
2066 *p++ = 1;
2067 *p++ = MBEDTLS_ECP_PF_UNCOMPRESSED;
2079 unsigned char *p = buf; local
2092 if( end - p < 4 )
2098 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ECJPAKE_KKPP >> 8 ) & 0xFF );
2099 *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ECJPAKE_KKPP ) & 0xFF );
2102 p + 2, end - p - 2, &kkpp_len,
2110 *p++ = (unsigned char)( ( kkpp_len >> 8 ) & 0xFF );
2111 *p++ = (unsigned char)( ( kkpp_len ) & 0xFF );
2157 unsigned char *p = ssl->out_msg + 4; local
2172 ssl->conf->transport, p );
2173 MBEDTLS_SSL_DEBUG_BUF( 3, "server version", p, 2 );
2174 p += 2;
2184 cookie_len_byte = p++;
2187 &p, ssl->out_buf + MBEDTLS_SSL_BUFFER_LEN,
2194 *cookie_len_byte = (unsigned char)( p - ( cookie_len_byte + 1 ) );
2198 ssl->out_msglen = p - ssl->out_msg;
2223 unsigned char *buf, *p; local
2252 p = buf + 4;
2255 ssl->conf->transport, p );
2256 p += 2;
2263 *p++ = (unsigned char)( t >> 24 );
2264 *p++ = (unsigned char)( t >> 16 );
2265 *p++ = (unsigned char)( t >> 8 );
2266 *p++ = (unsigned char)( t );
2270 if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p, 4 ) ) != 0 )
2273 p += 4;
2276 if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p, 28 ) ) != 0 )
2279 p += 28;
2352 *p++ = (unsigned char) ssl->session_negotiate->id_len;
2353 memcpy( p, ssl->session_negotiate->id, ssl->session_negotiate->id_len );
2354 p += ssl->session_negotiate->id_len;
2361 *p++ = (unsigned char)( ssl->session_negotiate->ciphersuite >> 8 );
2362 *p++ = (unsigned char)( ssl->session_negotiate->ciphersuite );
2363 *p++ = (unsigned char)( ssl->session_negotiate->compression );
2379 ssl_write_renegotiation_ext( ssl, p + 2 + ext_len, &olen );
2383 ssl_write_max_fragment_length_ext( ssl, p + 2 + ext_len, &olen );
2388 ssl_write_truncated_hmac_ext( ssl, p + 2 + ext_len, &olen );
2393 ssl_write_encrypt_then_mac_ext( ssl, p + 2 + ext_len, &olen );
2398 ssl_write_extended_ms_ext( ssl, p + 2 + ext_len, &olen );
2403 ssl_write_session_ticket_ext( ssl, p + 2 + ext_len, &olen );
2409 ssl_write_supported_point_formats_ext( ssl, p + 2 + ext_len, &olen );
2414 ssl_write_ecjpake_kkpp_ext( ssl, p + 2 + ext_len, &olen );
2419 ssl_write_alpn_ext( ssl, p + 2 + ext_len, &olen );
2427 *p++ = (unsigned char)( ( ext_len >> 8 ) & 0xFF );
2428 *p++ = (unsigned char)( ( ext_len ) & 0xFF );
2429 p += ext_len;
2436 ssl->out_msglen = p - buf;
2480 unsigned char *buf, *p; local
2520 p = buf + 4;
2531 p[1 + ct_len++] = MBEDTLS_SSL_CERT_TYPE_RSA_SIGN;
2534 p[1 + ct_len++] = MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN;
2537 p[0] = (unsigned char) ct_len++;
2538 p += ct_len;
2570 p[2 + sa_len++] = hash;
2571 p[2 + sa_len++] = MBEDTLS_SSL_SIG_RSA;
2574 p[2 + sa_len++] = hash;
2575 p[2 + sa_len++] = MBEDTLS_SSL_SIG_ECDSA;
2579 p[0] = (unsigned char)( sa_len >> 8 );
2580 p[1] = (unsigned char)( sa_len );
2582 p += sa_len;
2590 p += 2;
2603 if( end < p ||
2604 (size_t)( end - p ) < dn_size ||
2605 (size_t)( end - p ) < 2 + dn_size )
2611 *p++ = (unsigned char)( dn_size >> 8 );
2612 *p++ = (unsigned char)( dn_size );
2613 memcpy( p, crt->subject_raw.p, dn_size );
2614 p += dn_size;
2616 MBEDTLS_SSL_DEBUG_BUF( 3, "requested DN", p - dn_size, dn_size );
2622 ssl->out_msglen = p - buf;
2679 unsigned char *p = ssl->out_msg + 4; local
2680 unsigned char *dig_signed = p;
2722 p, end - p, &jlen, ssl->conf->f_rng, ssl->conf->p_rng );
2729 p += jlen;
2741 *(p++) = 0x00;
2742 *(p++) = 0x00;
2754 if( ssl->conf->dhm_P.p == NULL || ssl->conf->dhm_G.p == NULL )
2778 p, &len, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 )
2784 dig_signed = p;
2787 p += len;
2837 p, MBEDTLS_SSL_MAX_CONTENT_LEN - n,
2844 dig_signed = p;
2847 p += len;
2993 *(p++) = ssl->handshake->sig_alg;
2994 *(p++) = mbedtls_ssl_sig_from_pk( mbedtls_ssl_own_key( ssl ) );
3001 p + 2 , &signature_len,
3008 *(p++) = (unsigned char)( signature_len >> 8 );
3009 *(p++) = (unsigned char)( signature_len );
3012 MBEDTLS_SSL_DEBUG_BUF( 3, "my signature", p, signature_len );
3067 static int ssl_parse_client_dh_public( mbedtls_ssl_context *ssl, unsigned char **p, argument
3076 if( *p + 2 > end )
3082 n = ( (*p)[0] << 8 ) | (*p)[1];
3083 *p += 2;
3085 if( *p + n > end )
3091 if( ( ret = mbedtls_dhm_read_public( &ssl->handshake->dhm_ctx, *p, n ) ) != 0 )
3097 *p += n;
3109 const unsigned char *p, argument
3135 if( *p++ != ( ( len >> 8 ) & 0xFF ) ||
3136 *p++ != ( ( len ) & 0xFF ) )
3144 if( p + len != end )
3165 ret = mbedtls_pk_decrypt( mbedtls_ssl_own_key( ssl ), p, len,
3209 static int ssl_parse_client_psk_identity( mbedtls_ssl_context *ssl, unsigned char **p, argument
3226 if( *p + 2 > end )
3232 n = ( (*p)[0] << 8 ) | (*p)[1];
3233 *p += 2;
3235 if( n < 1 || n > 65535 || *p + n > end )
3243 if( ssl->conf->f_psk( ssl->conf->p_psk, ssl, *p, n ) != 0 )
3251 mbedtls_ssl_safer_memcmp( ssl->conf->psk_identity, *p, n ) != 0 )
3259 MBEDTLS_SSL_DEBUG_BUF( 3, "Unknown PSK identity", *p, n );
3270 *p += n;
3280 unsigned char *p, *end; local
3292 p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );
3310 if( ( ret = ssl_parse_client_dh_public( ssl, &p, end ) ) != 0 )
3316 if( p != end )
3346 p, end - p) ) != 0 )
3374 if( ( ret = ssl_parse_client_psk_identity( ssl, &p, end ) ) != 0 )
3380 if( p != end )
3398 if( ( ret = ssl_parse_client_psk_identity( ssl, &p, end ) ) != 0 )
3404 if( ( ret = ssl_parse_encrypted_pms( ssl, p, end, 2 ) ) != 0 )
3422 if( ( ret = ssl_parse_client_psk_identity( ssl, &p, end ) ) != 0 )
3427 if( ( ret = ssl_parse_client_dh_public( ssl, &p, end ) ) != 0 )
3433 if( p != end )
3451 if( ( ret = ssl_parse_client_psk_identity( ssl, &p, end ) ) != 0 )
3458 p, end - p ) ) != 0 )
3478 if( ( ret = ssl_parse_encrypted_pms( ssl, p, end, 0 ) ) != 0 )
3490 p, end - p );