Lines Matching refs:ret
90 int ret, len; in main() local
132 if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, in main()
135 printf(" failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret); in main()
152 ret = mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_srv_crt, in main()
154 if (ret != 0) { in main()
155 printf(" failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret); in main()
159 ret = mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_cas_pem, in main()
161 if (ret != 0) { in main()
162 printf(" failed\n ! mbedtls_x509_crt_parse returned %d\n\n", ret); in main()
166 ret = mbedtls_pk_parse_key(&pkey, in main()
173 if (ret != 0) { in main()
174 printf(" failed\n ! mbedtls_pk_parse_key returned %d\n\n", ret); in main()
186 if ((ret = mbedtls_net_bind(&listen_fd, BIND_IP, "4433", MBEDTLS_NET_PROTO_UDP)) != 0) { in main()
187 printf(" failed\n ! mbedtls_net_bind returned %d\n\n", ret); in main()
199 if ((ret = mbedtls_ssl_config_defaults(&conf, in main()
203 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()
219 printf(" failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret); in main()
223 if ((ret = mbedtls_ssl_cookie_setup(&cookie_ctx, in main()
225 printf(" failed\n ! mbedtls_ssl_cookie_setup returned %d\n\n", ret); in main()
232 if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) { in main()
233 printf(" failed\n ! mbedtls_ssl_setup returned %d\n\n", ret); in main()
244 if (ret != 0) { in main()
246 mbedtls_strerror(ret, error_buf, 100); in main()
247 printf("Last error was: %d - %s\n\n", ret, error_buf); in main()
261 if ((ret = mbedtls_net_accept(&listen_fd, &client_fd, in main()
263 printf(" failed\n ! mbedtls_net_accept returned %d\n\n", ret); in main()
268 if ((ret = mbedtls_ssl_set_client_transport_id(&ssl, in main()
271 "mbedtls_ssl_set_client_transport_id() returned -0x%x\n\n", (unsigned int) -ret); in main()
287 ret = mbedtls_ssl_handshake(&ssl); in main()
288 } while (ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
289 ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
291 if (ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) { in main()
293 ret = 0; in main()
295 } else if (ret != 0) { in main()
296 printf(" failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", (unsigned int) -ret); in main()
312 ret = mbedtls_ssl_read(&ssl, buf, len); in main()
313 } while (ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
314 ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
316 if (ret <= 0) { in main()
317 switch (ret) { in main()
324 ret = 0; in main()
328 printf(" mbedtls_ssl_read returned -0x%x\n\n", (unsigned int) -ret); in main()
333 len = ret; in main()
343 ret = mbedtls_ssl_write(&ssl, buf, len); in main()
344 } while (ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
345 ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
347 if (ret < 0) { in main()
348 printf(" failed\n ! mbedtls_ssl_write returned %d\n\n", ret); in main()
352 len = ret; in main()
363 ret = mbedtls_ssl_close_notify(&ssl); in main()
364 } while (ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
365 ret = 0; in main()
377 if (ret != 0) { in main()
379 mbedtls_strerror(ret, error_buf, 100); in main()
380 printf("Last error was: %d - %s\n\n", ret, error_buf); in main()
399 if (ret < 0) { in main()
400 ret = 1; in main()
403 mbedtls_exit(ret); in main()