/mbedtls-development/library/ |
A D | x509write_crt.c | 140 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_basic_constraints() 143 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_basic_constraints() 174 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_subject_key_identifier() 177 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_subject_key_identifier() 181 ret = mbedtls_sha1( buf + sizeof( buf ) - len, len, in mbedtls_x509write_crt_set_subject_key_identifier() 185 c = buf + sizeof( buf ) - 20; in mbedtls_x509write_crt_set_subject_key_identifier() 195 0, buf + sizeof(buf) - len, len ); in mbedtls_x509write_crt_set_subject_key_identifier() 202 unsigned char *c = buf + sizeof( buf ); in mbedtls_x509write_crt_set_authority_key_identifier() 205 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_authority_key_identifier() 213 c = buf + sizeof( buf ) - 20; in mbedtls_x509write_crt_set_authority_key_identifier() [all …]
|
A D | x509write_csr.c | 99 c = buf + 4; in mbedtls_x509write_csr_set_key_usage() 121 c = buf + 4; in mbedtls_x509write_csr_set_ns_cert_type() 158 c = buf + size; in x509write_csr_der_internal() 168 &c, buf, in x509write_csr_der_internal() 174 &c, buf, in x509write_csr_der_internal() 185 &c, buf, in x509write_csr_der_internal() 192 &c, buf, in x509write_csr_der_internal() 214 &c, buf, in x509write_csr_der_internal() 269 c2 = buf + size; in x509write_csr_der_internal() 286 &c2, buf, in x509write_csr_der_internal() [all …]
|
A D | pkwrite.c | 116 unsigned char buf[MBEDTLS_ECP_MAX_PT_LEN]; in pk_write_ec_pubkey() local 120 &len, buf, sizeof( buf ) ) ) != 0 ) in pk_write_ec_pubkey() 129 memcpy( *p, buf, len ); in pk_write_ec_pubkey() 236 PK_VALIDATE_RET( buf != NULL ); in mbedtls_pk_write_pubkey_der() 238 c = buf + size; in mbedtls_pk_write_pubkey_der() 242 if( c - buf < 1 ) in mbedtls_pk_write_pubkey_der() 322 PK_VALIDATE_RET( buf != NULL ); in mbedtls_pk_write_key_der() 324 c = buf + size; in mbedtls_pk_write_key_der() 425 if( c - buf < 1 ) in mbedtls_pk_write_key_der() 563 PK_VALIDATE_RET( buf != NULL || size == 0 ); in mbedtls_pk_write_pubkey_pem() [all …]
|
A D | entropy.c | 271 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in entropy_gather_internal() 405 memcpy( output, buf, len ); in mbedtls_entropy_func() 410 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in mbedtls_entropy_func() 469 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in mbedtls_entropy_write_seed_file() 494 if( fread( buf, 1, n, f ) != n ) in mbedtls_entropy_update_seed_file() 501 mbedtls_platform_zeroize( buf, sizeof( buf ) ); in mbedtls_entropy_update_seed_file() 562 set &= buf[i]; in mbedtls_entropy_source_self_test_check_bits() 563 unset |= buf[i]; in mbedtls_entropy_source_self_test_check_bits() 650 if( ( ret = mbedtls_entropy_update_manual( &ctx, buf, sizeof buf ) ) != 0 ) in mbedtls_entropy_self_test() 663 if( ( ret = mbedtls_entropy_func( &ctx, buf, sizeof( buf ) ) ) != 0 ) in mbedtls_entropy_self_test() [all …]
|
A D | ssl_tls13_client.c | 52 unsigned char *p = buf; in ssl_tls13_write_supported_versions_ext() 171 *olen = p - buf; in ssl_tls13_write_named_group_list_ecdhe() 182 ((void) buf); in ssl_tls13_write_named_group_list_ecdhe() 195 ((void) buf); in ssl_tls13_write_named_group_list_dhe() 267 *olen = p - buf; in ssl_tls13_write_supported_groups_ext() 302 buf, end - buf, in ssl_tls13_generate_and_write_ecdh_key_exchange() 462 *olen = p - buf; in ssl_tls13_write_key_share_ext() 658 *olen = p - buf; in ssl_tls13_write_client_hello_cipher_suites() 818 *olen = p - buf; in ssl_tls13_write_client_hello_body() 957 ret = ssl_server_hello_is_hrr( ssl, *buf, *buf + *buf_len ); in ssl_tls13_server_hello_coordinate() [all …]
|
A D | pem.c | 154 des_iv, buf, buf ); in pem_des_decrypt() 182 des3_iv, buf, buf ); in pem_des3_decrypt() 212 aes_iv, buf, buf ); in pem_aes_decrypt() 231 unsigned char *buf; in mbedtls_pem_read_buffer() local 354 mbedtls_free( buf ); in mbedtls_pem_read_buffer() 365 mbedtls_free( buf ); in mbedtls_pem_read_buffer() 399 if( len <= 2 || buf[0] != 0x30 || buf[1] > 0x83 ) in mbedtls_pem_read_buffer() 407 mbedtls_free( buf ); in mbedtls_pem_read_buffer() 413 ctx->buf = buf; in mbedtls_pem_read_buffer() 421 if ( ctx->buf != NULL ) in mbedtls_pem_free() [all …]
|
A D | ecdh.c | 338 buf += grp_len; in ecdh_make_params_internal() 364 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_make_params() 417 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_read_params() 418 ECDH_VALIDATE_RET( *buf != NULL ); in mbedtls_ecdh_read_params() 421 if( ( ret = mbedtls_ecp_tls_read_group_id( &grp_id, buf, end - *buf ) ) in mbedtls_ecdh_read_params() 570 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_make_public() 603 const unsigned char *p = buf; in ecdh_read_public_internal() 609 if( (size_t)( p - buf ) != blen ) in ecdh_read_public_internal() 622 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_read_public() 704 ECDH_VALIDATE_RET( buf != NULL ); in mbedtls_ecdh_calc_secret() [all …]
|
A D | ecjpake.c | 211 const unsigned char *end = buf + sizeof( buf ); in ecjpake_hash() 233 MBEDTLS_MPI_CHK( mbedtls_md( md_info, buf, p - buf, hash ) ); in ecjpake_hash() 511 *olen = p - buf; in ecjpake_kkpp_write() 739 *olen = p - buf; in mbedtls_ecjpake_write_round_two() 1066 buf, sizeof( buf ), &len, ecjpake_lgc, NULL ) == 0 ); in mbedtls_ecjpake_self_test() 1071 buf, sizeof( buf ), &len, ecjpake_lgc, NULL ) == 0 ); in mbedtls_ecjpake_self_test() 1076 buf, sizeof( buf ), &len, ecjpake_lgc, NULL ) == 0 ); in mbedtls_ecjpake_self_test() 1084 buf, sizeof( buf ), &len, ecjpake_lgc, NULL ) == 0 ); in mbedtls_ecjpake_self_test() 1089 buf, sizeof( buf ), &len, ecjpake_lgc, NULL ) == 0 ); in mbedtls_ecjpake_self_test() 1135 buf, sizeof( buf ), &len, ecjpake_lgc, NULL ) == 0 ); in mbedtls_ecjpake_self_test() [all …]
|
A D | ssl_tls13_generic.c | 66 *buf = ssl->in_msg + 4; in mbedtls_ssl_tls1_3_fetch_handshake_msg() 86 *buf = ssl->out_msg + 4; in mbedtls_ssl_tls13_start_handshake_msg() 160 unsigned char *p = buf; in mbedtls_ssl_tls13_write_sig_alg_ext() 215 *olen = p - buf; in mbedtls_ssl_tls13_write_sig_alg_ext() 314 const unsigned char *p = buf; in ssl_tls13_parse_certificate_verify() 460 unsigned char *buf; in mbedtls_ssl_tls13_process_certificate_verify() local 684 ((void) buf); in ssl_tls13_parse_certificate() 823 unsigned char *buf; in mbedtls_ssl_tls13_process_certificate() local 831 MBEDTLS_SSL_PROC_CHK( ssl_tls13_parse_certificate( ssl, buf, buf + buf_len ) ); in mbedtls_ssl_tls13_process_certificate() 995 unsigned char *buf; in mbedtls_ssl_tls13_process_finished_message() local [all …]
|
A D | entropy_poll.c | 96 static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags ) in getrandom_wrapper() argument 101 memset( buf, 0, buflen ); in getrandom_wrapper() 104 return( syscall( SYS_getrandom, buf, buflen, flags ) ); in getrandom_wrapper() 118 return getrandom( buf, buflen, flags ); in getrandom_wrapper() 138 static int sysctl_arnd_wrapper( unsigned char *buf, size_t buflen ) in sysctl_arnd_wrapper() argument 149 if( sysctl(name, 2, buf, &len, NULL, 0) == -1 ) in sysctl_arnd_wrapper() 152 buf += len; in sysctl_arnd_wrapper() 218 unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE]; in mbedtls_nv_seed_poll() local 222 memset( buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE ); in mbedtls_nv_seed_poll() 224 if( mbedtls_nv_seed_read( buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) < 0 ) in mbedtls_nv_seed_poll() [all …]
|
A D | gcm.c | 267 memset( ctx->buf, 0x00, sizeof(ctx->buf) ); in mbedtls_gcm_starts() 354 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_update_ad() 368 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_update_ad() 462 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_update() 476 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_update() 492 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_update() 534 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_finish() 541 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_finish() 557 gcm_mult( ctx, ctx->buf, ctx->buf ); in mbedtls_gcm_finish() 1023 buf, sizeof( buf ), &olen ); in mbedtls_gcm_self_test() [all …]
|
A D | ssl_srv.c | 96 servername_list_size = ( ( buf[0] << 8 ) | ( buf[1] ) ); in ssl_parse_servername_ext() 105 p = buf + 2; in ssl_parse_servername_ext() 258 sig_alg_list_size = ( ( buf[0] << 8 ) | ( buf[1] ) ); in ssl_parse_signature_algorithms_ext() 332 list_size = ( ( buf[0] << 8 ) | ( buf[1] ) ); in ssl_parse_supported_elliptic_curves() 696 list_len = ( buf[0] << 8 ) | buf[1]; in ssl_parse_alpn_ext() 803 profile_length = ( buf[0] << 8 ) | buf[1]; in ssl_parse_use_srtp_ext() 804 buf += 2; in ssl_parse_use_srtp_ext() 850 buf++; in ssl_parse_use_srtp_ext() 1193 buf[1], buf[2] ) ); in ssl_parse_client_hello() 1303 ( buf[1] << 16 ) | ( buf[2] << 8 ) | buf[3] ) ); in ssl_parse_client_hello() [all …]
|
/mbedtls-development/3rdparty/everest/library/ |
A D | x25519.c | 60 unsigned char *buf, size_t blen, in mbedtls_x25519_make_params() argument 75 *buf++ = MBEDTLS_ECP_TLS_NAMED_CURVE; in mbedtls_x25519_make_params() 76 *buf++ = MBEDTLS_ECP_TLS_CURVE25519 >> 8; in mbedtls_x25519_make_params() 77 *buf++ = MBEDTLS_ECP_TLS_CURVE25519 & 0xFF; in mbedtls_x25519_make_params() 78 *buf++ = MBEDTLS_X25519_KEY_SIZE_BYTES; in mbedtls_x25519_make_params() 93 if( end - *buf < MBEDTLS_X25519_KEY_SIZE_BYTES + 1 ) in mbedtls_x25519_read_params() 96 if( ( *(*buf)++ != MBEDTLS_X25519_KEY_SIZE_BYTES ) ) in mbedtls_x25519_read_params() 100 *buf += MBEDTLS_X25519_KEY_SIZE_BYTES; in mbedtls_x25519_read_params() 120 unsigned char *buf, size_t blen, in mbedtls_x25519_calc_secret() argument 162 *buf++ = MBEDTLS_X25519_KEY_SIZE_BYTES; in mbedtls_x25519_make_public() [all …]
|
A D | everest.c | 54 unsigned char *buf, size_t blen, in mbedtls_everest_make_params() argument 59 return mbedtls_x25519_make_params( x25519_ctx, olen, buf, blen, f_rng, p_rng ); in mbedtls_everest_make_params() 63 const unsigned char **buf, in mbedtls_everest_read_params() argument 67 return mbedtls_x25519_read_params( x25519_ctx, buf, end ); in mbedtls_everest_read_params() 82 unsigned char *buf, size_t blen, in mbedtls_everest_make_public() argument 87 return mbedtls_x25519_make_public( x25519_ctx, olen, buf, blen, f_rng, p_rng ); in mbedtls_everest_make_public() 91 const unsigned char *buf, size_t blen ) in mbedtls_everest_read_public() argument 94 return mbedtls_x25519_read_public ( x25519_ctx, buf, blen ); in mbedtls_everest_read_public() 98 unsigned char *buf, size_t blen, in mbedtls_everest_calc_secret() argument 103 return mbedtls_x25519_calc_secret( x25519_ctx, olen, buf, blen, f_rng, p_rng ); in mbedtls_everest_calc_secret()
|
/mbedtls-development/programs/pkey/ |
A D | dh_client.c | 80 unsigned char buf[2048]; in main() local 157 memset( buf, 0, sizeof( buf ) ); in main() 165 n = buflen = ( buf[0] << 8 ) | buf[1]; in main() 175 memset( buf, 0, sizeof( buf ) ); in main() 183 p = buf, end = buf + buflen; in main() 213 if( ( ret = mbedtls_sha1( buf, (int)( p - 2 - buf ), hash ) ) != 0 ) in main() 252 if( ( ret = mbedtls_dhm_calc_secret( &dhm, buf, sizeof( buf ), &n, in main() 260 mbedtls_printf( "%02x", buf[n] ); in main() 277 memset( buf, 0, sizeof( buf ) ); in main() 285 ret = mbedtls_aes_crypt_ecb( &aes, MBEDTLS_AES_DECRYPT, buf, buf ); in main() [all …]
|
A D | dh_server.c | 79 unsigned char buf[2048]; in main() local 206 memset( buf, 0, sizeof( buf ) ); in main() 218 if( ( ret = mbedtls_sha1( buf, n, hash ) ) != 0 ) in main() 228 32, hash, buf + n + 2 ) ) != 0 ) in main() 251 memset( buf, 0, sizeof( buf ) ); in main() 260 if( ( ret = mbedtls_dhm_read_public( &dhm, buf, n ) ) != 0 ) in main() 272 if( ( ret = mbedtls_dhm_calc_secret( &dhm, buf, sizeof( buf ), &n, in main() 280 mbedtls_printf( "%02x", buf[n] ); in main() 293 ret = mbedtls_aes_setkey_enc( &aes, buf, 256 ); in main() 296 memcpy( buf, PLAINTEXT, 16 ); in main() [all …]
|
/mbedtls-development/programs/test/ |
A D | benchmark.c | 643 memset( buf, 0xAA, sizeof( buf ) ); in main() 702 memset( buf, 0, sizeof( buf ) ); in main() 725 memset( buf, 0, sizeof( buf ) ); in main() 746 memset( buf, 0, sizeof( buf ) ); in main() 769 memset( buf, 0, sizeof( buf ) ); in main() 792 memset( buf, 0, sizeof( buf ) ); in main() 810 memset( buf, 0, sizeof( buf ) ); in main() 838 memset( buf, 0, sizeof( buf ) ); in main() 848 memset( buf, 0, sizeof( buf ) ); in main() 904 TIME_AND_TSC( "ChaCha20", mbedtls_chacha20_crypt( buf, buf, 0U, BUFSIZE, buf, buf ) ); in main() [all …]
|
A D | udp_proxy.c | 240 char *buf; in get_options() local 412 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush() 415 ret = mbedtls_net_send( buf->ctx, buf->data, buf->len ); in ctx_buffer_flush() 452 if( sizeof( buf->data ) - buf->len < len ) in ctx_buffer_append() 461 memcpy( buf->data + buf->len, data, len ); in ctx_buffer_append() 463 buf->len += len; in ctx_buffer_append() 572 memcpy( buf, p->buf, p->len ); in send_packet() 575 buf[11] ^= 1; in send_packet() 590 memcpy( buf, p->buf, p->len ); in send_packet() 598 ++buf[13]; in send_packet() [all …]
|
/mbedtls-development/tests/suites/ |
A D | test_suite_pkwrite.function | 16 unsigned char buf[5000]; 22 memset( buf, 0, sizeof( buf ) ); 28 ret = mbedtls_pk_write_pubkey_pem( &key, buf, sizeof( buf )); 31 pem_len = strlen( (char *) buf ); 36 TEST_ASSERT( buf[buf_index] == 0 ); 56 unsigned char buf[5000]; 62 memset( buf, 0, sizeof( buf ) ); 69 ret = mbedtls_pk_write_key_pem( &key, buf, sizeof( buf )); 72 pem_len = strlen( (char *) buf ); 77 TEST_ASSERT( buf[buf_index] == 0 ); [all …]
|
A D | test_suite_x509write.function | 85 unsigned char buf[4096]; 109 ret = mbedtls_x509write_csr_pem( &req, buf, sizeof( buf ), 128 der_len = mbedtls_x509write_csr_der( &req, buf, sizeof( buf ), 180 ret = mbedtls_x509write_csr_pem( &req, buf, sizeof( buf ) - 1, 186 buf[pem_len] = '\0'; 280 ret = mbedtls_x509write_crt_pem( &crt, buf, sizeof( buf ), 301 der_len = mbedtls_x509write_crt_der( &crt, buf, sizeof( buf ), 334 memset( buf, 0, sizeof( buf ) ); 335 c = buf + sizeof( buf ); 346 TEST_ASSERT( mbedtls_asn1_get_tag( &c, buf + sizeof( buf ), &len, [all …]
|
A D | test_suite_ecdh.function | 209 memset( buf, 0x00, sizeof( buf ) ); vbuf = buf; 215 memset( buf, 0x00, sizeof( buf ) ); 285 memset( buf, 0x00, sizeof( buf ) ); 290 ret = mbedtls_ecdh_make_params( &srv, &len, buf, sizeof( buf ), 300 vbuf = buf; 304 memset( buf, 0x00, sizeof( buf ) ); 309 ret = mbedtls_ecdh_make_public( &cli, &len, buf, sizeof( buf ), 322 memset( buf, 0, sizeof( buf ) ); 327 ret = mbedtls_ecdh_calc_secret( &srv, &len, buf, sizeof( buf ), 340 memset( buf, 0, sizeof( buf ) ); [all …]
|
/mbedtls-development/programs/ssl/ |
A D | ssl_mail_client.c | 176 unsigned char buf[1024]; in do_handshake() local 177 memset(buf, 0, 1024); in do_handshake() 225 mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", in do_handshake() 227 mbedtls_printf( "%s\n", buf ); in do_handshake() 237 mbedtls_printf("\n%s", buf); in write_ssl_data() 257 mbedtls_printf("\n%s", buf); in write_ssl_and_get_response() 315 mbedtls_printf("\n%s", buf); in write_and_get_response() 369 unsigned char buf[sizeof( base ) + 2]; in main() local 371 unsigned char buf[1024]; in main() local 394 memset( &buf, 0, sizeof( buf ) ); in main() [all …]
|
A D | ssl_test_common_source.c | 143 unsigned char const *buf, size_t len ) in ssl_check_record() argument 153 memcpy( tmp_buf, buf, len ); in ssl_check_record() 160 memcpy( tmp_buf, buf, len ); /* Restore buffer */ in ssl_check_record() 204 int recv_cb( void *ctx, unsigned char *buf, size_t len ) in recv_cb() argument 211 ret = delayed_recv( io_ctx->net, buf, len ); in recv_cb() 213 ret = mbedtls_net_recv( io_ctx->net, buf, len ); in recv_cb() 230 int recv_timeout_cb( void *ctx, unsigned char *buf, size_t len, in recv_timeout_cb() argument 254 int send_cb( void *ctx, unsigned char const *buf, size_t len ) in send_cb() argument 259 return( delayed_send( io_ctx->net, buf, len ) ); in send_cb() 261 return( mbedtls_net_send( io_ctx->net, buf, len ) ); in send_cb() [all …]
|
/mbedtls-development/programs/util/ |
A D | pem2der.c | 138 ( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL ) in load_file() 144 if( fread( *buf, 1, *n, f ) != *n ) in load_file() 147 free( *buf ); in load_file() 148 *buf = NULL; in load_file() 154 (*buf)[*n] = '\0'; in load_file() 169 if( fwrite( buf, 1, n, f ) != n ) in write_file() 185 char buf[1024]; in main() local 193 memset( buf, 0, sizeof(buf) ); in main() 233 mbedtls_strerror( ret, buf, 1024 ); in main() 250 mbedtls_strerror( ret, buf, 1024 ); in main() [all …]
|
/mbedtls-development/programs/x509/ |
A D | cert_write.c | 220 char buf[1024]; in main() local 247 memset( buf, 0, 1024 ); in main() 475 mbedtls_strerror( ret, buf, 1024 ); in main() 477 ret, buf ); in main() 490 mbedtls_strerror( ret, buf, 1024 ); in main() 595 mbedtls_strerror( ret, buf, 1024 ); in main() 630 mbedtls_strerror( ret, buf, 1024 ); in main() 638 mbedtls_strerror( ret, buf, 1024 ); in main() 653 mbedtls_strerror( ret, buf, 1024 ); in main() 662 mbedtls_strerror( ret, buf, 1024 ); in main() [all …]
|