Lines Matching refs:ret
94 int ret, len; in main() local
141 ret = mbedtls_x509_crt_parse( &srvcert, (const unsigned char *) mbedtls_test_srv_crt, in main()
143 if( ret != 0 ) in main()
145 printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
149 ret = mbedtls_x509_crt_parse( &srvcert, (const unsigned char *) mbedtls_test_cas_pem, in main()
151 if( ret != 0 ) in main()
153 printf( " failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret ); in main()
157 ret = mbedtls_pk_parse_key( &pkey, (const unsigned char *) mbedtls_test_srv_key, in main()
159 if( ret != 0 ) in main()
161 printf( " failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret ); in main()
173 if( ( ret = mbedtls_net_bind( &listen_fd, NULL, "4433", MBEDTLS_NET_PROTO_UDP ) ) != 0 ) in main()
175 printf( " failed\n ! mbedtls_net_bind returned %d\n\n", ret ); in main()
187 if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, in main()
191 printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret ); in main()
203 if( ( ret = mbedtls_ssl_config_defaults( &conf, in main()
208 mbedtls_printf( " failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret ); in main()
222 if( ( ret = mbedtls_ssl_conf_own_cert( &conf, &srvcert, &pkey ) ) != 0 ) in main()
224 printf( " failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret ); in main()
228 if( ( ret = mbedtls_ssl_cookie_setup( &cookie_ctx, in main()
231 printf( " failed\n ! mbedtls_ssl_cookie_setup returned %d\n\n", ret ); in main()
238 if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 ) in main()
240 printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret ); in main()
251 if( ret != 0 ) in main()
254 mbedtls_strerror( ret, error_buf, 100 ); in main()
255 printf("Last error was: %d - %s\n\n", ret, error_buf ); in main()
269 if( ( ret = mbedtls_net_accept( &listen_fd, &client_fd, in main()
272 printf( " failed\n ! mbedtls_net_accept returned %d\n\n", ret ); in main()
277 if( ( ret = mbedtls_ssl_set_client_transport_id( &ssl, in main()
281 "mbedtls_ssl_set_client_transport_id() returned -0x%x\n\n", -ret ); in main()
296 do ret = mbedtls_ssl_handshake( &ssl ); in main()
297 while( ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
298 ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
300 if( ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED ) in main()
303 ret = 0; in main()
306 else if( ret != 0 ) in main()
308 printf( " failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", -ret ); in main()
323 do ret = mbedtls_ssl_read( &ssl, buf, len ); in main()
324 while( ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
325 ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
327 if( ret <= 0 ) in main()
329 switch( ret ) in main()
337 ret = 0; in main()
341 printf( " mbedtls_ssl_read returned -0x%x\n\n", -ret ); in main()
346 len = ret; in main()
355 do ret = mbedtls_ssl_write( &ssl, buf, len ); in main()
356 while( ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
357 ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
359 if( ret < 0 ) in main()
361 printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret ); in main()
365 len = ret; in main()
375 do ret = mbedtls_ssl_close_notify( &ssl ); in main()
376 while( ret == MBEDTLS_ERR_SSL_WANT_WRITE ); in main()
377 ret = 0; in main()
389 if( ret != 0 ) in main()
392 mbedtls_strerror( ret, error_buf, 100 ); in main()
393 printf( "Last error was: %d - %s\n\n", ret, error_buf ); in main()
417 if( ret < 0 ) in main()
418 ret = 1; in main()
420 return( ret ); in main()