Lines Matching refs:ret
603 int ret; in report_cid_usage() local
622 ret = mbedtls_ssl_get_peer_cid(ssl, &cid_negotiated, in report_cid_usage()
624 if (ret != 0) { in report_cid_usage()
626 (unsigned int) -ret); in report_cid_usage()
627 return ret; in report_cid_usage()
641 ret = mbedtls_ssl_get_peer_cid(ssl, &cid_negotiated, in report_cid_usage()
643 if (ret != 0) { in report_cid_usage()
645 (unsigned int) -ret); in report_cid_usage()
646 return ret; in report_cid_usage()
650 ret = mbedtls_ssl_get_peer_cid(ssl, &cid_negotiated, in report_cid_usage()
652 if (ret != 0) { in report_cid_usage()
654 (unsigned int) -ret); in report_cid_usage()
655 return ret; in report_cid_usage()
675 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in ssl_save_session_serialize() local
687 ret = mbedtls_ssl_get_session(ssl, &exported_session); in ssl_save_session_serialize()
688 if (ret != 0) { in ssl_save_session_serialize()
691 (unsigned) -ret); in ssl_save_session_serialize()
701 ret = MBEDTLS_ERR_SSL_ALLOC_FAILED; in ssl_save_session_serialize()
706 if ((ret = mbedtls_ssl_session_save(&exported_session, in ssl_save_session_serialize()
710 (unsigned int) -ret); in ssl_save_session_serialize()
716 return ret; in ssl_save_session_serialize()
721 int ret = 0, len, tail_len, i, written, frags, retry_left; in main() local
847 ret = MBEDTLS_ERR_SSL_HW_ACCEL_FAILED; in main()
857 if (ret == 0) { in main()
858 ret = 1; in main()
1090 ret = 2; in main()
1401 ret = 2; in main()
1408 ret = 2; in main()
1422 ret = 2; in main()
1428 ret = 2; in main()
1541 ret = -1; in main()
1587 ret = rng_seed(&rng, opt.reproducible, pers); in main()
1588 if (ret != 0) { in main()
1602 ret = 0; in main()
1606 ret = mbedtls_x509_crt_parse_path(&cacert, opt.ca_path); in main()
1608 ret = mbedtls_x509_crt_parse_file(&cacert, opt.ca_file); in main()
1614 ret = mbedtls_x509_crt_parse(&cacert, in main()
1617 if (ret != 0) { in main()
1622 if (ret == 0) { in main()
1624 ret = mbedtls_x509_crt_parse_der(&cacert, in main()
1627 if (ret != 0) { in main()
1633 if (ret < 0) { in main()
1635 (unsigned int) -ret); in main()
1639 mbedtls_printf(" ok (%d skipped)\n", ret); in main()
1650 ret = 0; in main()
1654 ret = mbedtls_x509_crt_parse_file(&clicert, opt.crt_file); in main()
1657 { ret = mbedtls_x509_crt_parse(&clicert, in main()
1660 if (ret != 0) { in main()
1662 (unsigned int) -ret); in main()
1667 ret = 0; in main()
1671 ret = mbedtls_pk_parse_keyfile(&pkey, opt.key_file, opt.key_pwd, rng_get, &rng); in main()
1674 { ret = mbedtls_pk_parse_key(&pkey, in main()
1677 if (ret != 0) { in main()
1679 (unsigned int) -ret); in main()
1693 ret = mbedtls_pk_wrap_as_opaque(&pkey, &key_slot, psa_alg, in main()
1695 if (ret != 0) { in main()
1698 (unsigned int) -ret); in main()
1716 if ((ret = mbedtls_ssl_config_defaults(&conf, in main()
1721 (unsigned int) -ret); in main()
1750 ret = mbedtls_ssl_conf_cid(&conf, cid_len, in main()
1753 ret = mbedtls_ssl_conf_cid(&conf, cid_renego_len, in main()
1757 if (ret != 0) { in main()
1759 (unsigned int) -ret); in main()
1781 if ((ret = mbedtls_ssl_conf_max_frag_len(&conf, opt.mfl_code)) != 0) { in main()
1783 ret); in main()
1793 ret = mbedtls_ssl_conf_dtls_srtp_protection_profiles(&conf, forced_profile); in main()
1795 ret = mbedtls_ssl_conf_dtls_srtp_protection_profiles(&conf, default_profiles); in main()
1798 if (ret != 0) { in main()
1801 ret); in main()
1831 if ((ret = mbedtls_ssl_conf_alpn_protocols(&conf, alpn_list)) != 0) { in main()
1833 ret); in main()
1884 if ((ret = mbedtls_ssl_conf_own_cert(&conf, &clicert, &pkey)) != 0) { in main()
1886 ret); in main()
1917 ret = MBEDTLS_ERR_SSL_HW_ACCEL_FAILED; in main()
1921 if ((ret = mbedtls_ssl_conf_psk_opaque(&conf, slot, in main()
1925 ret); in main()
1931 ret = mbedtls_ssl_conf_psk(&conf, psk, psk_len, in main()
1934 if (ret != 0) { in main()
1935 mbedtls_printf(" failed\n ! mbedtls_ssl_conf_psk returned %d\n\n", ret); in main()
1953 if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) { in main()
1955 (unsigned int) -ret); in main()
1975 if ((ret = mbedtls_ssl_set_hostname(&ssl, opt.server_name)) != 0) { in main()
1977 ret); in main()
2001 if ((ret = mbedtls_ssl_set_hs_ecjpake_password_opaque(&ssl, in main()
2005 ret); in main()
2012 if ((ret = mbedtls_ssl_set_hs_ecjpake_password(&ssl, in main()
2016 ret); in main()
2036 if ((ret = mbedtls_ssl_set_cid(&ssl, opt.cid_enabled, in main()
2039 ret); in main()
2071 if ((ret = mbedtls_ssl_dtls_srtp_set_mki_value(&ssl, mki, in main()
2073 mbedtls_printf(" failed\n ! mbedtls_ssl_dtls_srtp_set_mki_value returned %d\n\n", ret); in main()
2093 if ((ret = mbedtls_net_connect(&server_fd, in main()
2098 (unsigned int) -ret); in main()
2103 ret = mbedtls_net_set_nonblock(&server_fd); in main()
2105 ret = mbedtls_net_set_block(&server_fd); in main()
2107 if (ret != 0) { in main()
2109 (unsigned int) -ret); in main()
2121 while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) { in main()
2122 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2123 ret != MBEDTLS_ERR_SSL_WANT_WRITE && in main()
2124 ret != MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2126 (unsigned int) -ret); in main()
2127 if (ret == MBEDTLS_ERR_X509_CERT_VERIFY_FAILED) { in main()
2144 if (ret == MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2152 ret = idle(&server_fd, &timer, ret); in main()
2154 ret = idle(&server_fd, ret); in main()
2156 if (ret != 0) { in main()
2176 if ((ret = mbedtls_ssl_get_record_expansion(&ssl)) >= 0) { in main()
2177 mbedtls_printf(" [ Record expansion is %d ]\n", ret); in main()
2200 if ((ret = mbedtls_ssl_tls_prf(eap_tls_keying.tls_prf_type, in main()
2210 (unsigned int) -ret); in main()
2223 if ((ret = mbedtls_ssl_tls_prf(eap_tls_keying.tls_prf_type, NULL, 0, in main()
2230 (unsigned int) -ret); in main()
2255 if ((ret = mbedtls_ssl_tls_prf(dtls_srtp_keying.tls_prf_type, in main()
2265 (unsigned int) -ret); in main()
2305 if ((ret = ssl_save_session_serialize(&ssl, in main()
2308 (unsigned int) -ret); in main()
2313 if ((ret = mbedtls_ssl_get_session(&ssl, &saved_session)) != 0) { in main()
2315 (unsigned int) -ret); in main()
2353 ret = report_cid_usage(&ssl, "initial handshake"); in main()
2354 if (ret != 0) { in main()
2359 if ((ret = mbedtls_ssl_set_cid(&ssl, opt.cid_enabled_renego, in main()
2363 ret); in main()
2377 while ((ret = mbedtls_ssl_renegotiate(&ssl)) != 0) { in main()
2378 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2379 ret != MBEDTLS_ERR_SSL_WANT_WRITE && in main()
2380 ret != MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2382 ret); in main()
2387 if (ret == MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2395 idle(&server_fd, &timer, ret); in main()
2397 idle(&server_fd, ret); in main()
2407 ret = report_cid_usage(&ssl, "after renegotiation"); in main()
2408 if (ret != 0) { in main()
2454 while ((ret = mbedtls_ssl_write(&ssl, buf + written, in main()
2456 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2457 ret != MBEDTLS_ERR_SSL_WANT_WRITE && in main()
2458 ret != MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2460 (unsigned int) -ret); in main()
2467 idle(&server_fd, &timer, ret); in main()
2469 idle(&server_fd, ret); in main()
2475 written += ret; in main()
2479 ret = mbedtls_ssl_write(&ssl, buf, len); in main()
2482 if (ret == MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2487 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2488 ret != MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
2495 idle(&server_fd, &timer, ret); in main()
2497 idle(&server_fd, ret); in main()
2502 if (ret < 0) { in main()
2504 ret); in main()
2509 written = ret; in main()
2541 ret = mbedtls_ssl_read(&ssl, buf, len); in main()
2544 if (ret == MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2549 if (ret == MBEDTLS_ERR_SSL_WANT_READ || in main()
2550 ret == MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
2554 idle(&server_fd, &timer, ret); in main()
2556 idle(&server_fd, ret); in main()
2562 if (ret <= 0) { in main()
2563 switch (ret) { in main()
2566 ret = 0; in main()
2572 ret = 0; in main()
2588 if ((ret = ssl_save_session_serialize(&ssl, in main()
2593 (unsigned int) -ret); in main()
2597 if ((ret = mbedtls_ssl_get_session(&ssl, &saved_session)) != 0) { in main()
2600 (unsigned int) -ret); in main()
2619 (unsigned int) -ret); in main()
2624 len = ret; in main()
2630 if (ret > 0 && buf[len-1] == '\n') { in main()
2631 ret = 0; in main()
2640 ret = mbedtls_ssl_read(&ssl, buf, len); in main()
2643 if (ret == MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2648 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2649 ret != MBEDTLS_ERR_SSL_WANT_WRITE) { in main()
2656 idle(&server_fd, &timer, ret); in main()
2658 idle(&server_fd, ret); in main()
2663 if (ret <= 0) { in main()
2664 switch (ret) { in main()
2674 ret = 0; in main()
2678 mbedtls_printf(" mbedtls_ssl_read returned -0x%x\n", (unsigned int) -ret); in main()
2683 len = ret; in main()
2686 ret = 0; in main()
2702 if ((ret = mbedtls_ssl_session_reset(&ssl)) != 0) { in main()
2704 (unsigned int) -ret); in main()
2708 while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) { in main()
2709 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2710 ret != MBEDTLS_ERR_SSL_WANT_WRITE && in main()
2711 ret != MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2713 (unsigned int) -ret); in main()
2720 idle(&server_fd, &timer, ret); in main()
2722 idle(&server_fd, ret); in main()
2741 ret = mbedtls_ssl_context_save(&ssl, NULL, 0, &buf_len); in main()
2742 if (ret != MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) { in main()
2744 "-0x%x\n\n", (unsigned int) -ret); in main()
2757 if ((ret = mbedtls_ssl_context_save(&ssl, context_buf, in main()
2760 "-0x%x\n\n", (unsigned int) -ret); in main()
2783 if ((ret = mbedtls_base64_encode(b64_buf, b64_len, &b64_len, in main()
2786 "-0x%x\n", (unsigned int) -ret); in main()
2824 if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) { in main()
2826 "-0x%x\n\n", (unsigned int) -ret); in main()
2850 if ((ret = mbedtls_ssl_context_load(&ssl, context_buf, in main()
2853 "-0x%x\n\n", (unsigned int) -ret); in main()
2895 ret = mbedtls_ssl_close_notify(&ssl); in main()
2896 } while (ret == MBEDTLS_ERR_SSL_WANT_WRITE); in main()
2897 ret = 0; in main()
2923 if ((ret = mbedtls_ssl_session_reset(&ssl)) != 0) { in main()
2925 (unsigned int) -ret); in main()
2930 if ((ret = mbedtls_ssl_session_load(&saved_session, in main()
2934 (unsigned int) -ret); in main()
2939 if ((ret = mbedtls_ssl_set_session(&ssl, &saved_session)) != 0) { in main()
2941 (unsigned int) -ret); in main()
2947 (ret = mbedtls_ssl_set_hostname(&ssl, in main()
2950 ret); in main()
2955 if ((ret = mbedtls_net_connect(&server_fd, in main()
2960 (unsigned int) -ret); in main()
2965 ret = mbedtls_net_set_nonblock(&server_fd); in main()
2967 ret = mbedtls_net_set_block(&server_fd); in main()
2969 if (ret != 0) { in main()
2971 (unsigned int) -ret); in main()
2975 while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) { in main()
2976 if (ret != MBEDTLS_ERR_SSL_WANT_READ && in main()
2977 ret != MBEDTLS_ERR_SSL_WANT_WRITE && in main()
2978 ret != MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) { in main()
2980 (unsigned int) -ret); in main()
2995 if (ret != 0) { in main()
2997 mbedtls_strerror(ret, error_buf, 100); in main()
2998 mbedtls_printf("Last error was: -0x%X - %s\n\n", (unsigned int) -ret, error_buf); in main()
3041 if (ret == 0) { in main()
3042 ret = MBEDTLS_ERR_SSL_HW_ACCEL_FAILED; in main()
3061 if (ret == 0) { in main()
3062 ret = 1; in main()
3074 if (ret == 0) { in main()
3075 ret = 1; in main()
3092 if (ret == 0) { in main()
3093 ret = 1; in main()
3108 if (ret < 0) { in main()
3109 ret = 1; in main()
3113 mbedtls_exit(ret); in main()