Lines Matching refs:ret
124 int ret, len; in handle_ssl_connection() local
139 if( ( ret = mbedtls_ssl_setup( &ssl, thread_info->config ) ) != 0 ) in handle_ssl_connection()
142 thread_id, -ret ); in handle_ssl_connection()
153 while( ( ret = mbedtls_ssl_handshake( &ssl ) ) != 0 ) in handle_ssl_connection()
155 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in handle_ssl_connection()
158 thread_id, -ret ); in handle_ssl_connection()
174 ret = mbedtls_ssl_read( &ssl, buf, len ); in handle_ssl_connection()
176 if( ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE ) in handle_ssl_connection()
179 if( ret <= 0 ) in handle_ssl_connection()
181 switch( ret ) in handle_ssl_connection()
195 thread_id, -ret ); in handle_ssl_connection()
200 len = ret; in handle_ssl_connection()
204 if( ret > 0 ) in handle_ssl_connection()
217 while( ( ret = mbedtls_ssl_write( &ssl, buf, len ) ) <= 0 ) in handle_ssl_connection()
219 if( ret == MBEDTLS_ERR_NET_CONN_RESET ) in handle_ssl_connection()
226 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in handle_ssl_connection()
229 thread_id, ret ); in handle_ssl_connection()
234 len = ret; in handle_ssl_connection()
240 while( ( ret = mbedtls_ssl_close_notify( &ssl ) ) < 0 ) in handle_ssl_connection()
242 if( ret != MBEDTLS_ERR_SSL_WANT_READ && in handle_ssl_connection()
243 ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in handle_ssl_connection()
246 thread_id, ret ); in handle_ssl_connection()
253 ret = 0; in handle_ssl_connection()
258 if( ret != 0 ) in handle_ssl_connection()
261 mbedtls_strerror( ret, error_buf, 100 ); in handle_ssl_connection()
263 thread_id, -ret, error_buf ); in handle_ssl_connection()
277 int ret, i; in thread_create() local
306 if( ( ret = pthread_create( &threads[i].thread, NULL, handle_ssl_connection, in thread_create()
309 return( ret ); in thread_create()
317 int ret; in main() local
371 ret = mbedtls_x509_crt_parse( &srvcert, (const unsigned char *) mbedtls_test_srv_crt, in main()
373 if( ret != 0 ) in main()
375 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
379 ret = mbedtls_x509_crt_parse( &cachain, (const unsigned char *) mbedtls_test_cas_pem, in main()
381 if( ret != 0 ) in main()
383 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
388 ret = mbedtls_pk_parse_key( &pkey, (const unsigned char *) mbedtls_test_srv_key, in main()
390 if( ret != 0 ) in main()
392 mbedtls_printf( " failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret ); in main()
403 if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, in main()
408 -ret ); in main()
419 if( ( ret = mbedtls_ssl_config_defaults( &conf, in main()
425 -ret ); in main()
442 if( ( ret = mbedtls_ssl_conf_own_cert( &conf, &srvcert, &pkey ) ) != 0 ) in main()
444 mbedtls_printf( " failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret ); in main()
457 if( ( ret = mbedtls_net_bind( &listen_fd, NULL, "4433", MBEDTLS_NET_PROTO_TCP ) ) != 0 ) in main()
459 mbedtls_printf( " failed\n ! mbedtls_net_bind returned %d\n\n", ret ); in main()
467 if( ret != 0 ) in main()
470 mbedtls_strerror( ret, error_buf, 100 ); in main()
471 mbedtls_printf( " [ main ] Last error was: -0x%04x - %s\n", -ret, error_buf ); in main()
480 if( ( ret = mbedtls_net_accept( &listen_fd, &client_fd, in main()
483 mbedtls_printf( " [ main ] failed: mbedtls_net_accept returned -0x%04x\n", ret ); in main()
490 if( ( ret = thread_create( &client_fd ) ) != 0 ) in main()
492 mbedtls_printf( " [ main ] failed: thread_create returned %d\n", ret ); in main()
497 ret = 0; in main()
523 return( ret ); in main()