Lines Matching refs:ret
85 int ret, len; in main() local
119 if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, in main()
123 mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret ); in main()
135 ret = mbedtls_x509_crt_parse( &cacert, (const unsigned char *) mbedtls_test_cas_pem, in main()
137 if( ret < 0 ) in main()
139 mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n", -ret ); in main()
143 mbedtls_printf( " ok (%d skipped)\n", ret ); in main()
151 if( ( ret = mbedtls_net_connect( &server_fd, SERVER_ADDR, in main()
154 mbedtls_printf( " failed\n ! mbedtls_net_connect returned %d\n\n", ret ); in main()
166 if( ( ret = mbedtls_ssl_config_defaults( &conf, in main()
171 mbedtls_printf( " failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret ); in main()
183 if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 ) in main()
185 mbedtls_printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret ); in main()
189 if( ( ret = mbedtls_ssl_set_hostname( &ssl, SERVER_NAME ) ) != 0 ) in main()
191 mbedtls_printf( " failed\n ! mbedtls_ssl_set_hostname returned %d\n\n", ret ); in main()
209 do ret = mbedtls_ssl_handshake( &ssl ); in main()
210 while( ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
211 ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
213 if( ret != 0 ) in main()
215 mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", -ret ); in main()
251 do ret = mbedtls_ssl_write( &ssl, (unsigned char *) MESSAGE, len ); in main()
252 while( ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
253 ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
255 if( ret < 0 ) in main()
257 mbedtls_printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret ); in main()
261 len = ret; in main()
273 do ret = mbedtls_ssl_read( &ssl, buf, len ); in main()
274 while( ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
275 ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
277 if( ret <= 0 ) in main()
279 switch( ret ) in main()
289 ret = 0; in main()
293 mbedtls_printf( " mbedtls_ssl_read returned -0x%x\n\n", -ret ); in main()
298 len = ret; in main()
308 do ret = mbedtls_ssl_close_notify( &ssl ); in main()
309 while( ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
310 ret = 0; in main()
320 if( ret != 0 ) in main()
323 mbedtls_strerror( ret, error_buf, 100 ); in main()
324 mbedtls_printf( "Last error was: %d - %s\n\n", ret, error_buf ); in main()
342 if( ret < 0 ) in main()
343 ret = 1; in main()
345 return( ret ); in main()