Lines Matching refs:ret

95     int ret, len;  in main()  local
137 ret = mbedtls_x509_crt_parse( &srvcert, (const unsigned char *) mbedtls_test_srv_crt, in main()
139 if( ret != 0 ) in main()
141 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
145 ret = mbedtls_x509_crt_parse( &srvcert, (const unsigned char *) mbedtls_test_cas_pem, in main()
147 if( ret != 0 ) in main()
149 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
153 ret = mbedtls_pk_parse_key( &pkey, (const unsigned char *) mbedtls_test_srv_key, in main()
155 if( ret != 0 ) in main()
157 mbedtls_printf( " failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret ); in main()
169 if( ( ret = mbedtls_net_bind( &listen_fd, NULL, "4433", MBEDTLS_NET_PROTO_TCP ) ) != 0 ) in main()
171 mbedtls_printf( " failed\n ! mbedtls_net_bind returned %d\n\n", ret ); in main()
183 if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, in main()
187 mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret ); in main()
199 if( ( ret = mbedtls_ssl_config_defaults( &conf, in main()
204 mbedtls_printf( " failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret ); in main()
218 if( ( ret = mbedtls_ssl_conf_own_cert( &conf, &srvcert, &pkey ) ) != 0 ) in main()
220 mbedtls_printf( " failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret ); in main()
224 if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 ) in main()
226 mbedtls_printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret ); in main()
234 if( ret != 0 ) in main()
237 mbedtls_strerror( ret, error_buf, 100 ); in main()
238 mbedtls_printf("Last error was: %d - %s\n\n", ret, error_buf ); in main()
252 if( ( ret = mbedtls_net_accept( &listen_fd, &client_fd, in main()
255 mbedtls_printf( " failed\n ! mbedtls_net_accept returned %d\n\n", ret ); in main()
269 while( ( ret = mbedtls_ssl_handshake( &ssl ) ) != 0 ) in main()
271 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in main()
273 mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned %d\n\n", ret ); in main()
290 ret = mbedtls_ssl_read( &ssl, buf, len ); in main()
292 if( ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE ) in main()
295 if( ret <= 0 ) in main()
297 switch( ret ) in main()
308 mbedtls_printf( " mbedtls_ssl_read returned -0x%x\n", -ret ); in main()
315 len = ret; in main()
318 if( ret > 0 ) in main()
332 while( ( ret = mbedtls_ssl_write( &ssl, buf, len ) ) <= 0 ) in main()
334 if( ret == MBEDTLS_ERR_NET_CONN_RESET ) in main()
340 if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in main()
342 mbedtls_printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret ); in main()
347 len = ret; in main()
352 while( ( ret = mbedtls_ssl_close_notify( &ssl ) ) < 0 ) in main()
354 if( ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
355 ret != MBEDTLS_ERR_SSL_WANT_WRITE ) in main()
357 mbedtls_printf( " failed\n ! mbedtls_ssl_close_notify returned %d\n\n", ret ); in main()
364 ret = 0; in main()
370 if( ret != 0 ) in main()
373 mbedtls_strerror( ret, error_buf, 100 ); in main()
374 mbedtls_printf("Last error was: %d - %s\n\n", ret, error_buf ); in main()
396 return( ret ); in main()