Lines Matching refs:ret
80 int ret, len; in main() local
117 if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, in main()
120 mbedtls_printf(" failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret); in main()
137 ret = mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_srv_crt, in main()
139 if (ret != 0) { in main()
140 mbedtls_printf(" failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret); in main()
144 ret = mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_cas_pem, in main()
146 if (ret != 0) { in main()
147 mbedtls_printf(" failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret); in main()
151 ret = mbedtls_pk_parse_key(&pkey, (const unsigned char *) mbedtls_test_srv_key, in main()
154 if (ret != 0) { in main()
155 mbedtls_printf(" failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret); in main()
167 if ((ret = mbedtls_net_bind(&listen_fd, NULL, "4433", MBEDTLS_NET_PROTO_TCP)) != 0) { in main()
168 mbedtls_printf(" failed\n ! mbedtls_net_bind returned %d\n\n", ret); in main()
180 if ((ret = mbedtls_ssl_config_defaults(&conf, in main()
184 mbedtls_printf(" failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret); in main()
198 if ((ret = mbedtls_ssl_conf_own_cert(&conf, &srvcert, &pkey)) != 0) { in main()
199 mbedtls_printf(" failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret); in main()
203 if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) { in main()
204 mbedtls_printf(" failed\n ! mbedtls_ssl_setup returned %d\n\n", ret); in main()
212 if (ret != 0) { in main()
214 mbedtls_strerror(ret, error_buf, 100); in main()
215 mbedtls_printf("Last error was: %d - %s\n\n", ret, error_buf); in main()
229 if ((ret = mbedtls_net_accept(&listen_fd, &client_fd, in main()
231 mbedtls_printf(" failed\n ! mbedtls_net_accept returned %d\n\n", ret); in main()
245 while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) { in main()
246 if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
247 mbedtls_printf(" failed\n ! mbedtls_ssl_handshake returned %d\n\n", ret); in main()
263 ret = mbedtls_ssl_read(&ssl, buf, len); in main()
265 if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
269 if (ret <= 0) { in main()
270 switch (ret) { in main()
280 mbedtls_printf(" mbedtls_ssl_read returned -0x%x\n", (unsigned int) -ret); in main()
287 len = ret; in main()
290 if (ret > 0) { in main()
304 while ((ret = mbedtls_ssl_write(&ssl, buf, len)) <= 0) { in main()
305 if (ret == MBEDTLS_ERR_NET_CONN_RESET) { in main()
310 if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
311 mbedtls_printf(" failed\n ! mbedtls_ssl_write returned %d\n\n", ret); in main()
316 len = ret; in main()
321 while ((ret = mbedtls_ssl_close_notify(&ssl)) < 0) { in main()
322 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
323 ret != MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
324 mbedtls_printf(" failed\n ! mbedtls_ssl_close_notify returned %d\n\n", ret); in main()
331 ret = 0; in main()
337 if (ret != 0) { in main()
339 mbedtls_strerror(ret, error_buf, 100); in main()
340 mbedtls_printf("Last error was: %d - %s\n\n", ret, error_buf); in main()
357 mbedtls_exit(ret); in main()