Lines Matching refs:ret
169 int ret; in do_handshake() local
180 while( ( ret = mbedtls_ssl_handshake( ssl ) ) != 0 ) in do_handshake()
182 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in do_handshake()
185 mbedtls_strerror( ret, (char *) buf, 1024 ); in do_handshake()
187 mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned %d: %s\n\n", ret, buf ); in do_handshake()
224 int ret; in write_ssl_data() local
227 while( len && ( ret = mbedtls_ssl_write( ssl, buf, len ) ) <= 0 ) in write_ssl_data()
229 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in write_ssl_data()
231 mbedtls_printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret ); in write_ssl_data()
241 int ret; in write_ssl_and_get_response() local
247 while( len && ( ret = mbedtls_ssl_write( ssl, buf, len ) ) <= 0 ) in write_ssl_and_get_response()
249 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in write_ssl_and_get_response()
251 mbedtls_printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret ); in write_ssl_and_get_response()
260 ret = mbedtls_ssl_read( ssl, data, len ); in write_ssl_and_get_response()
262 if( ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE ) in write_ssl_and_get_response()
265 if( ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY ) in write_ssl_and_get_response()
268 if( ret <= 0 ) in write_ssl_and_get_response()
270 mbedtls_printf( "failed\n ! mbedtls_ssl_read returned %d\n\n", ret ); in write_ssl_and_get_response()
275 len = ret; in write_ssl_and_get_response()
299 int ret; in write_and_get_response() local
305 if( len && ( ret = mbedtls_net_send( sock_fd, buf, len ) ) <= 0 ) in write_and_get_response()
307 mbedtls_printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret ); in write_and_get_response()
315 ret = mbedtls_net_recv( sock_fd, data, len ); in write_and_get_response()
317 if( ret <= 0 ) in write_and_get_response()
319 mbedtls_printf( "failed\n ! read returned %d\n\n", ret ); in write_and_get_response()
325 len = ret; in write_and_get_response()
349 int ret = 0, len; in main() local
476 if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, in main()
480 mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret ); in main()
494 ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file ); in main()
498 ret = mbedtls_x509_crt_parse( &cacert, (const unsigned char *) mbedtls_test_cas_pem, in main()
502 ret = 1; in main()
506 if( ret < 0 ) in main()
508 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
512 mbedtls_printf( " ok (%d skipped)\n", ret ); in main()
524 ret = mbedtls_x509_crt_parse_file( &clicert, opt.crt_file ); in main()
528 ret = mbedtls_x509_crt_parse( &clicert, (const unsigned char *) mbedtls_test_cli_crt, in main()
532 ret = -1; in main()
536 if( ret != 0 ) in main()
538 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
544 ret = mbedtls_pk_parse_keyfile( &pkey, opt.key_file, "" ); in main()
548 ret = mbedtls_pk_parse_key( &pkey, (const unsigned char *) mbedtls_test_cli_key, in main()
552 ret = -1; in main()
556 if( ret != 0 ) in main()
558 mbedtls_printf( " failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret ); in main()
571 if( ( ret = mbedtls_net_connect( &server_fd, opt.server_name, in main()
574 mbedtls_printf( " failed\n ! mbedtls_net_connect returned %d\n\n", ret ); in main()
586 if( ( ret = mbedtls_ssl_config_defaults( &conf, in main()
591 mbedtls_printf( " failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret ); in main()
606 if( ( ret = mbedtls_ssl_conf_own_cert( &conf, &clicert, &pkey ) ) != 0 ) in main()
608 mbedtls_printf( " failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret ); in main()
612 if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 ) in main()
614 mbedtls_printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret ); in main()
618 if( ( ret = mbedtls_ssl_set_hostname( &ssl, opt.server_name ) ) != 0 ) in main()
620 mbedtls_printf( " failed\n ! mbedtls_ssl_set_hostname returned %d\n\n", ret ); in main()
636 ret = write_ssl_and_get_response( &ssl, buf, 0 ); in main()
637 if( ret < 200 || ret > 299 ) in main()
639 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
650 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
651 if( ret < 200 || ret > 299 ) in main()
653 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
662 ret = write_and_get_response( &server_fd, buf, 0 ); in main()
663 if( ret < 200 || ret > 299 ) in main()
665 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
676 ret = write_and_get_response( &server_fd, buf, len ); in main()
677 if( ret < 200 || ret > 299 ) in main()
679 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
690 ret = write_and_get_response( &server_fd, buf, len ); in main()
691 if( ret < 200 || ret > 299 ) in main()
693 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
710 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
711 if( ret < 200 || ret > 399 ) in main()
713 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
722 … ret = mbedtls_base64_encode( base, sizeof( base ), &n, (const unsigned char *) opt.user_name, in main()
725 if( ret != 0 ) { in main()
726 mbedtls_printf( " failed\n ! mbedtls_base64_encode returned %d\n\n", ret ); in main()
730 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
731 if( ret < 300 || ret > 399 ) in main()
733 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
742 ret = mbedtls_base64_encode( base, sizeof( base ), &n, (const unsigned char *) opt.user_pwd, in main()
745 if( ret != 0 ) { in main()
746 mbedtls_printf( " failed\n ! mbedtls_base64_encode returned %d\n\n", ret ); in main()
750 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
751 if( ret < 200 || ret > 399 ) in main()
753 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
765 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
766 if( ret < 200 || ret > 299 ) in main()
768 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
778 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
779 if( ret < 200 || ret > 299 ) in main()
781 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
791 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
792 if( ret < 300 || ret > 399 ) in main()
794 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
808 ret = write_ssl_data( &ssl, buf, len ); in main()
811 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
812 if( ret < 200 || ret > 299 ) in main()
814 mbedtls_printf( " failed\n ! server responded with %d\n\n", ret ); in main()
838 return( ret ); in main()