Lines Matching refs:ret

105 	int ret, len, c;  in main()  local
188 ret = mbedtls_x509_crt_parse_file(&srvcert, srv_cert_file); in main()
189 if (ret != 0) { in main()
191 ret); in main()
195 ret = mbedtls_pk_parse_keyfile(&pkey, srv_key_file, NULL); in main()
196 if (ret != 0) { in main()
198 ret); in main()
210 if ((ret = mbedtls_net_bind(&listen_fd, NULL, listen_port, in main()
212 printf(" failed\n ! mbedtls_net_bind returned %d\n\n", ret); in main()
224 if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, in main()
228 printf(" failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret); in main()
240 if ((ret = mbedtls_ssl_config_defaults(&conf, in main()
245 "returned %d\n\n", ret); in main()
259 if ((ret = mbedtls_ssl_conf_own_cert(&conf, &srvcert, &pkey)) != 0) { in main()
261 "returned %d\n\n", ret); in main()
265 if ((ret = mbedtls_ssl_cookie_setup(&cookie_ctx, in main()
269 ret); in main()
276 if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) { in main()
277 printf(" failed\n ! mbedtls_ssl_setup returned %d\n\n", ret); in main()
288 if (ret != 0) { in main()
290 mbedtls_strerror(ret, error_buf, 100); in main()
291 printf("Last error was: %d - %s\n\n", ret, error_buf); in main()
305 if ((ret = mbedtls_net_accept(&listen_fd, &client_fd, in main()
308 printf(" failed\n ! mbedtls_net_accept returned %d\n\n", ret); in main()
313 if ((ret = mbedtls_ssl_set_client_transport_id(&ssl, in main()
318 "returned -0x%x\n\n", -ret); in main()
334 do ret = mbedtls_ssl_handshake(&ssl); in main()
335 while(ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
336 ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
338 if (ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) { in main()
340 ret = 0; in main()
343 else if (ret != 0) in main()
346 -ret); in main()
362 do ret = mbedtls_ssl_read(&ssl, buf, len); in main()
363 while(ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
364 ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
366 if (ret <= 0) { in main()
367 switch(ret) { in main()
374 ret = 0; in main()
378 printf(" mbedtls_ssl_read returned -0x%x\n\n", -ret); in main()
383 len = ret; in main()
392 do ret = mbedtls_ssl_write(&ssl, buf, len); in main()
393 while(ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
394 ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
396 if (ret < 0) { in main()
397 printf(" failed\n ! mbedtls_ssl_write returned %d\n\n", ret); in main()
401 len = ret; in main()
413 do ret = mbedtls_ssl_close_notify(&ssl); in main()
414 while(ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
415 ret = 0; in main()
427 if (ret != 0) { in main()
429 mbedtls_strerror(ret, error_buf, 100); in main()
430 printf("Last error was: %d - %s\n\n", ret, error_buf); in main()
454 if (ret < 0) in main()
455 ret = 1; in main()
457 return(ret); in main()