Lines Matching refs:opt

711 } opt;
1343 if (opt.transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
1357 if (opt.cid_enabled == MBEDTLS_SSL_CID_ENABLED) {
1423 switch (opt.dummy_ticket % 11) {
1681 opt.buffer_size = DFL_IO_BUF_LEN;
1682 opt.server_addr = DFL_SERVER_ADDR;
1683 opt.server_port = DFL_SERVER_PORT;
1684 opt.debug_level = DFL_DEBUG_LEVEL;
1685 opt.event = DFL_EVENT;
1686 opt.response_size = DFL_RESPONSE_SIZE;
1687 opt.nbio = DFL_NBIO;
1688 opt.cid_enabled = DFL_CID_ENABLED;
1689 opt.cid_enabled_renego = DFL_CID_ENABLED_RENEGO;
1690 opt.cid_val = DFL_CID_VALUE;
1691 opt.cid_val_renego = DFL_CID_VALUE_RENEGO;
1692 opt.read_timeout = DFL_READ_TIMEOUT;
1693 opt.ca_file = DFL_CA_FILE;
1694 opt.ca_path = DFL_CA_PATH;
1695 opt.crt_file = DFL_CRT_FILE;
1696 opt.key_file = DFL_KEY_FILE;
1697 opt.key_opaque = DFL_KEY_OPAQUE;
1698 opt.key_pwd = DFL_KEY_PWD;
1699 opt.crt_file2 = DFL_CRT_FILE2;
1700 opt.key_file2 = DFL_KEY_FILE2;
1701 opt.key_pwd2 = DFL_KEY_PWD2;
1702 opt.async_operations = DFL_ASYNC_OPERATIONS;
1703 opt.async_private_delay1 = DFL_ASYNC_PRIVATE_DELAY1;
1704 opt.async_private_delay2 = DFL_ASYNC_PRIVATE_DELAY2;
1705 opt.async_private_error = DFL_ASYNC_PRIVATE_ERROR;
1706 opt.psk = DFL_PSK;
1708 opt.psk_opaque = DFL_PSK_OPAQUE;
1709 opt.psk_list_opaque = DFL_PSK_LIST_OPAQUE;
1712 opt.ca_callback = DFL_CA_CALLBACK;
1714 opt.psk_identity = DFL_PSK_IDENTITY;
1715 opt.psk_list = DFL_PSK_LIST;
1716 opt.ecjpake_pw = DFL_ECJPAKE_PW;
1718 opt.ecjpake_pw_opaque = DFL_ECJPAKE_PW_OPAQUE;
1720 opt.force_ciphersuite[0] = DFL_FORCE_CIPHER;
1722 opt.tls13_kex_modes = DFL_TLS1_3_KEX_MODES;
1724 opt.renegotiation = DFL_RENEGOTIATION;
1725 opt.allow_legacy = DFL_ALLOW_LEGACY;
1726 opt.renegotiate = DFL_RENEGOTIATE;
1727 opt.renego_delay = DFL_RENEGO_DELAY;
1728 opt.renego_period = DFL_RENEGO_PERIOD;
1729 opt.exchanges = DFL_EXCHANGES;
1730 opt.min_version = DFL_MIN_VERSION;
1731 opt.max_version = DFL_MAX_VERSION;
1732 opt.allow_sha1 = DFL_SHA1;
1733 opt.auth_mode = DFL_AUTH_MODE;
1734 opt.cert_req_ca_list = DFL_CERT_REQ_CA_LIST;
1735 opt.cert_req_dn_hint = DFL_CERT_REQ_DN_HINT;
1736 opt.mfl_code = DFL_MFL_CODE;
1737 opt.trunc_hmac = DFL_TRUNC_HMAC;
1738 opt.tickets = DFL_TICKETS;
1739 opt.dummy_ticket = DFL_DUMMY_TICKET;
1740 opt.ticket_rotate = DFL_TICKET_ROTATE;
1741 opt.ticket_timeout = DFL_TICKET_TIMEOUT;
1742 opt.ticket_aead = DFL_TICKET_AEAD;
1743 opt.cache_max = DFL_CACHE_MAX;
1745 opt.cache_timeout = DFL_CACHE_TIMEOUT;
1747 opt.cache_remove = DFL_CACHE_REMOVE;
1748 opt.sni = DFL_SNI;
1749 opt.alpn_string = DFL_ALPN_STRING;
1750 opt.groups = DFL_GROUPS;
1752 opt.early_data = DFL_EARLY_DATA;
1753 opt.max_early_data_size = DFL_MAX_EARLY_DATA_SIZE;
1755 opt.sig_algs = DFL_SIG_ALGS;
1756 opt.dhm_file = DFL_DHM_FILE;
1757 opt.transport = DFL_TRANSPORT;
1758 opt.cookies = DFL_COOKIES;
1759 opt.anti_replay = DFL_ANTI_REPLAY;
1760 opt.hs_to_min = DFL_HS_TO_MIN;
1761 opt.hs_to_max = DFL_HS_TO_MAX;
1762 opt.dtls_mtu = DFL_DTLS_MTU;
1763 opt.dgram_packing = DFL_DGRAM_PACKING;
1764 opt.badmac_limit = DFL_BADMAC_LIMIT;
1765 opt.extended_ms = DFL_EXTENDED_MS;
1766 opt.etm = DFL_ETM;
1767 opt.serialize = DFL_SERIALIZE;
1768 opt.context_file = DFL_CONTEXT_FILE;
1769 opt.eap_tls = DFL_EAP_TLS;
1770 opt.reproducible = DFL_REPRODUCIBLE;
1771 opt.nss_keylog = DFL_NSS_KEYLOG;
1772 opt.nss_keylog_file = DFL_NSS_KEYLOG_FILE;
1773 opt.query_config_mode = DFL_QUERY_CONFIG_MODE;
1774 opt.use_srtp = DFL_USE_SRTP;
1775 opt.force_srtp_profile = DFL_SRTP_FORCE_PROFILE;
1776 opt.support_mki = DFL_SRTP_SUPPORT_MKI;
1777 opt.key1_opaque_alg1 = DFL_KEY_OPAQUE_ALG;
1778 opt.key1_opaque_alg2 = DFL_KEY_OPAQUE_ALG;
1779 opt.key2_opaque_alg1 = DFL_KEY_OPAQUE_ALG;
1780 opt.key2_opaque_alg2 = DFL_KEY_OPAQUE_ALG;
1835 opt.server_port = q;
1837 opt.server_addr = q;
1841 opt.transport = MBEDTLS_SSL_TRANSPORT_STREAM;
1843 opt.transport = MBEDTLS_SSL_TRANSPORT_DATAGRAM;
1848 opt.debug_level = atoi(q);
1849 if (opt.debug_level < 0 || opt.debug_level > 65535) {
1860 opt.nbio = atoi(q);
1861 if (opt.nbio < 0 || opt.nbio > 2) {
1865 opt.event = atoi(q);
1866 if (opt.event < 0 || opt.event > 2) {
1870 opt.read_timeout = atoi(q);
1872 opt.buffer_size = atoi(q);
1873 if (opt.buffer_size < 1) {
1877 opt.response_size = atoi(q);
1878 if (opt.response_size < 0 || opt.response_size > MBEDTLS_SSL_OUT_CONTENT_LEN) {
1881 if (opt.buffer_size < opt.response_size) {
1882 opt.buffer_size = opt.response_size;
1885 opt.ca_file = q;
1887 opt.ca_path = q;
1889 opt.crt_file = q;
1891 opt.key_file = q;
1893 opt.key_pwd = q;
1897 opt.key_opaque = atoi(q);
1901 opt.crt_file2 = q;
1903 opt.key_file2 = q;
1905 opt.key_pwd2 = q;
1907 opt.dhm_file = q;
1911 opt.async_operations = q;
1913 opt.async_private_delay1 = atoi(q);
1915 opt.async_private_delay2 = atoi(q);
1923 opt.async_private_error = n;
1928 opt.cid_enabled = atoi(q);
1929 if (opt.cid_enabled != 0 && opt.cid_enabled != 1) {
1933 opt.cid_enabled_renego = atoi(q);
1934 if (opt.cid_enabled_renego != 0 && opt.cid_enabled_renego != 1) {
1938 opt.cid_val = q;
1940 opt.cid_val_renego = q;
1944 opt.psk = q;
1948 opt.psk_opaque = atoi(q);
1950 opt.psk_list_opaque = atoi(q);
1955 opt.ca_callback = atoi(q);
1959 opt.psk_identity = q;
1961 opt.psk_list = q;
1963 opt.ecjpake_pw = q;
1967 opt.ecjpake_pw_opaque = atoi(q);
1971 opt.force_ciphersuite[0] = mbedtls_ssl_get_ciphersuite_id(q);
1973 if (opt.force_ciphersuite[0] == 0) {
1977 opt.force_ciphersuite[1] = 0;
1979 opt.groups = q;
1983 opt.sig_algs = q;
1990 opt.early_data = MBEDTLS_SSL_EARLY_DATA_DISABLED;
1993 opt.early_data = MBEDTLS_SSL_EARLY_DATA_ENABLED;
1998 opt.max_early_data_size = (uint32_t) atoll(q);
2002 opt.renegotiation = (atoi(q)) ?
2008 opt.allow_legacy = MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE;
2011 opt.allow_legacy = MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION;
2014 opt.allow_legacy = MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION;
2019 opt.renegotiate = atoi(q);
2020 if (opt.renegotiate < 0 || opt.renegotiate > 1) {
2024 opt.renego_delay = atoi(q);
2027 opt.renego_period = _strtoui64(q, NULL, 10);
2029 if (sscanf(q, "%" SCNu64, &opt.renego_period) != 1) {
2033 if (opt.renego_period < 2) {
2037 opt.exchanges = atoi(q);
2038 if (opt.exchanges < 0) {
2045 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK;
2047 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL;
2049 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL;
2051 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ALL;
2053 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ALL;
2055 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_ALL;
2065 opt.tls13_kex_modes = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK |
2076 opt.min_version = MBEDTLS_SSL_VERSION_TLS1_2;
2080 opt.min_version = MBEDTLS_SSL_VERSION_TLS1_3;
2089 opt.max_version = MBEDTLS_SSL_VERSION_TLS1_2;
2093 opt.max_version = MBEDTLS_SSL_VERSION_TLS1_3;
2101 case 0: opt.allow_sha1 = 0; break;
2102 case 1: opt.allow_sha1 = 1; break;
2107 opt.min_version = MBEDTLS_SSL_VERSION_TLS1_2;
2108 opt.max_version = MBEDTLS_SSL_VERSION_TLS1_2;
2110 opt.min_version = MBEDTLS_SSL_VERSION_TLS1_2;
2111 opt.max_version = MBEDTLS_SSL_VERSION_TLS1_2;
2112 opt.transport = MBEDTLS_SSL_TRANSPORT_DATAGRAM;
2116 opt.min_version = MBEDTLS_SSL_VERSION_TLS1_3;
2117 opt.max_version = MBEDTLS_SSL_VERSION_TLS1_3;
2124 if ((opt.auth_mode = get_auth_mode(q)) < 0) {
2128 opt.cert_req_ca_list = atoi(q);
2129 if (opt.cert_req_ca_list < 0 || opt.cert_req_ca_list > 3) {
2132 if (opt.cert_req_ca_list > 1) {
2133 opt.cert_req_dn_hint = opt.cert_req_ca_list;
2134 opt.cert_req_ca_list = MBEDTLS_SSL_CERT_REQ_CA_LIST_ENABLED;
2138 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_512;
2140 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_1024;
2142 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_2048;
2144 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_4096;
2149 opt.alpn_string = q;
2152 case 0: opt.trunc_hmac = MBEDTLS_SSL_TRUNC_HMAC_DISABLED; break;
2153 case 1: opt.trunc_hmac = MBEDTLS_SSL_TRUNC_HMAC_ENABLED; break;
2159 opt.extended_ms = MBEDTLS_SSL_EXTENDED_MS_DISABLED;
2162 opt.extended_ms = MBEDTLS_SSL_EXTENDED_MS_ENABLED;
2168 case 0: opt.etm = MBEDTLS_SSL_ETM_DISABLED; break;
2169 case 1: opt.etm = MBEDTLS_SSL_ETM_ENABLED; break;
2173 opt.tickets = atoi(q);
2174 if (opt.tickets < 0) {
2178 opt.dummy_ticket = atoi(q);
2179 if (opt.dummy_ticket < 0) {
2183 opt.ticket_rotate = atoi(q);
2184 if (opt.ticket_rotate < 0 || opt.ticket_rotate > 1) {
2188 opt.ticket_timeout = atoi(q);
2189 if (opt.ticket_timeout < 0) {
2193 opt.ticket_aead = parse_cipher(q);
2195 if (opt.ticket_aead == MBEDTLS_CIPHER_NONE) {
2199 opt.cache_max = atoi(q);
2200 if (opt.cache_max < 0) {
2206 opt.cache_timeout = atoi(q);
2207 if (opt.cache_timeout < 0) {
2213 opt.cache_remove = atoi(q);
2214 if (opt.cache_remove < 0 || opt.cache_remove > 1) {
2218 opt.cookies = atoi(q);
2219 if (opt.cookies < -1 || opt.cookies > 1) {
2223 opt.anti_replay = atoi(q);
2224 if (opt.anti_replay < 0 || opt.anti_replay > 1) {
2228 opt.badmac_limit = atoi(q);
2229 if (opt.badmac_limit < 0) {
2237 opt.hs_to_min = atoi(q);
2238 opt.hs_to_max = atoi(p);
2239 if (opt.hs_to_min == 0 || opt.hs_to_max < opt.hs_to_min) {
2243 opt.dtls_mtu = atoi(q);
2244 if (opt.dtls_mtu < 0) {
2248 opt.dgram_packing = atoi(q);
2249 if (opt.dgram_packing != 0 &&
2250 opt.dgram_packing != 1) {
2254 opt.sni = q;
2256 opt.query_config_mode = 1;
2260 opt.serialize = atoi(q);
2261 if (opt.serialize < 0 || opt.serialize > 2) {
2265 opt.context_file = q;
2267 opt.eap_tls = atoi(q);
2268 if (opt.eap_tls < 0 || opt.eap_tls > 1) {
2272 opt.reproducible = 1;
2274 opt.nss_keylog = atoi(q);
2275 if (opt.nss_keylog < 0 || opt.nss_keylog > 1) {
2279 opt.nss_keylog_file = q;
2281 opt.use_srtp = atoi(q);
2283 opt.force_srtp_profile = atoi(q);
2285 opt.support_mki = atoi(q);
2287 if (key_opaque_alg_parse(q, &opt.key1_opaque_alg1,
2288 &opt.key1_opaque_alg2) != 0) {
2292 if (key_opaque_alg_parse(q, &opt.key2_opaque_alg1,
2293 &opt.key2_opaque_alg2) != 0) {
2305 if (opt.nss_keylog != 0 && opt.eap_tls != 0) {
2313 if (opt.event == 1 && opt.nbio != 1) {
2315 opt.nbio = 1;
2319 mbedtls_debug_set_threshold(opt.debug_level);
2324 size_t buf_content_size = opt.buffer_size;
2330 if (opt.response_size != DFL_RESPONSE_SIZE &&
2331 buf_content_size < (size_t) opt.response_size) {
2332 buf_content_size = opt.response_size;
2343 if (opt.psk_opaque != 0) {
2344 if (strlen(opt.psk) == 0) {
2350 if (opt.force_ciphersuite[0] <= 0) {
2358 if (opt.psk_list_opaque != 0) {
2359 if (opt.psk_list == NULL) {
2365 if (opt.force_ciphersuite[0] <= 0) {
2374 if (opt.force_ciphersuite[0] > 0) {
2377 mbedtls_ssl_ciphersuite_from_id(opt.force_ciphersuite[0]);
2379 if (opt.max_version != -1 &&
2380 ciphersuite_info->min_tls_version > opt.max_version) {
2385 if (opt.min_version != -1 &&
2386 ciphersuite_info->max_tls_version < opt.min_version) {
2394 if (opt.max_version == -1 ||
2395 opt.max_version > ciphersuite_info->max_tls_version) {
2396 opt.max_version = ciphersuite_info->max_tls_version;
2398 if (opt.min_version < ciphersuite_info->min_tls_version) {
2399 opt.min_version = ciphersuite_info->min_tls_version;
2404 if (opt.psk_opaque != 0 || opt.psk_list_opaque != 0) {
2419 opt.cid_val, &cid_len) != 0) {
2426 if (opt.cid_enabled_renego == DFL_CID_ENABLED_RENEGO) {
2427 opt.cid_enabled_renego = opt.cid_enabled;
2429 if (opt.cid_val_renego == DFL_CID_VALUE_RENEGO) {
2430 opt.cid_val_renego = opt.cid_val;
2434 opt.cid_val_renego, &cid_renego_len) != 0) {
2445 opt.psk, &psk_len) != 0) {
2450 if (opt.psk_list != NULL) {
2451 if ((psk_info = psk_parse(opt.psk_list)) == NULL) {
2458 if (opt.groups != NULL) {
2459 if (parse_groups(opt.groups, group_list, GROUP_LIST_SIZE) != 0) {
2465 if (opt.sig_algs != NULL) {
2466 p = (char *) opt.sig_algs;
2532 if (opt.alpn_string != NULL) {
2533 p = (char *) opt.alpn_string;
2560 ret = rng_seed(&rng, opt.reproducible, pers);
2573 if (strcmp(opt.ca_path, "none") == 0 ||
2574 strcmp(opt.ca_file, "none") == 0) {
2578 if (strlen(opt.ca_path)) {
2579 ret = mbedtls_x509_crt_parse_path(&cacert, opt.ca_path);
2580 } else if (strlen(opt.ca_file)) {
2581 ret = mbedtls_x509_crt_parse_file(&cacert, opt.ca_file);
2621 if (strlen(opt.crt_file) && strcmp(opt.crt_file, "none") != 0) {
2623 if ((ret = mbedtls_x509_crt_parse_file(&srvcert, opt.crt_file)) != 0) {
2629 if (strlen(opt.key_file) && strcmp(opt.key_file, "none") != 0) {
2631 if ((ret = mbedtls_pk_parse_keyfile(&pkey, opt.key_file,
2632 opt.key_pwd, rng_get, &rng)) != 0) {
2643 if (strlen(opt.crt_file2) && strcmp(opt.crt_file2, "none") != 0) {
2645 if ((ret = mbedtls_x509_crt_parse_file(&srvcert2, opt.crt_file2)) != 0) {
2651 if (strlen(opt.key_file2) && strcmp(opt.key_file2, "none") != 0) {
2653 if ((ret = mbedtls_pk_parse_keyfile(&pkey2, opt.key_file2,
2654 opt.key_pwd2, rng_get, &rng)) != 0) {
2666 strcmp(opt.crt_file, "none") != 0 &&
2667 strcmp(opt.key_file, "none") != 0 &&
2669 strcmp(opt.crt_file2, "none") != 0 &&
2670 strcmp(opt.key_file2, "none") != 0) {
2710 if (opt.key_opaque != 0) {
2714 if (key_opaque_set_alg_usage(opt.key1_opaque_alg1,
2715 opt.key1_opaque_alg2,
2731 if (key_opaque_set_alg_usage(opt.key2_opaque_alg1,
2732 opt.key2_opaque_alg2,
2753 if (opt.dhm_file != NULL) {
2757 if ((ret = mbedtls_dhm_parse_dhmfile(&dhm, opt.dhm_file)) != 0) {
2768 if (opt.sni != NULL) {
2772 if ((sni_info = sni_parse(opt.sni)) == NULL) {
2789 opt.transport,
2800 if (opt.allow_sha1 > 0) {
2807 if (opt.auth_mode != DFL_AUTH_MODE) {
2808 mbedtls_ssl_conf_authmode(&conf, opt.auth_mode);
2811 if (opt.cert_req_ca_list != DFL_CERT_REQ_CA_LIST) {
2812 mbedtls_ssl_conf_cert_req_ca_list(&conf, opt.cert_req_ca_list);
2816 if (opt.early_data != DFL_EARLY_DATA) {
2817 mbedtls_ssl_conf_early_data(&conf, opt.early_data);
2819 if (opt.max_early_data_size != DFL_MAX_EARLY_DATA_SIZE) {
2821 &conf, opt.max_early_data_size);
2829 if (opt.cert_req_dn_hint == 2 && key_cert_init2) {
2835 if (opt.hs_to_min != DFL_HS_TO_MIN || opt.hs_to_max != DFL_HS_TO_MAX) {
2836 mbedtls_ssl_conf_handshake_timeout(&conf, opt.hs_to_min, opt.hs_to_max);
2839 if (opt.dgram_packing != DFL_DGRAM_PACKING) {
2840 mbedtls_ssl_set_datagram_packing(&ssl, opt.dgram_packing);
2845 if ((ret = mbedtls_ssl_conf_max_frag_len(&conf, opt.mfl_code)) != 0) {
2852 if (opt.cid_enabled == 1 || opt.cid_enabled_renego == 1) {
2853 if (opt.cid_enabled == 1 &&
2854 opt.cid_enabled_renego == 1 &&
2860 if (opt.cid_enabled == 1) {
2878 { opt.force_srtp_profile, MBEDTLS_TLS_SRTP_UNSET };
2879 if (opt.use_srtp == 1) {
2880 if (opt.force_srtp_profile != 0) {
2894 opt.support_mki ?
2898 } else if (opt.force_srtp_profile != 0) {
2905 if (opt.extended_ms != DFL_EXTENDED_MS) {
2906 mbedtls_ssl_conf_extended_master_secret(&conf, opt.extended_ms);
2911 if (opt.etm != DFL_ETM) {
2912 mbedtls_ssl_conf_encrypt_then_mac(&conf, opt.etm);
2917 if (opt.alpn_string != NULL) {
2925 if (opt.reproducible) {
2938 if (opt.cache_max != -1) {
2939 mbedtls_ssl_cache_set_max_entries(&cache, opt.cache_max);
2943 if (opt.cache_timeout != -1) {
2944 mbedtls_ssl_cache_set_timeout(&cache, opt.cache_timeout);
2954 if (opt.tickets != MBEDTLS_SSL_SESSION_TICKETS_DISABLED) {
2956 if (opt.dummy_ticket) {
2966 opt.ticket_aead,
2967 opt.ticket_timeout)) != 0) {
2981 mbedtls_ssl_conf_new_session_tickets(&conf, opt.tickets);
2986 if (opt.ticket_rotate) {
2993 opt.ticket_timeout)) != 0) {
3002 if (opt.transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
3004 if (opt.cookies > 0) {
3016 if (opt.cookies == 0) {
3025 if (opt.anti_replay != DFL_ANTI_REPLAY) {
3026 mbedtls_ssl_conf_dtls_anti_replay(&conf, opt.anti_replay);
3030 if (opt.badmac_limit != DFL_BADMAC_LIMIT) {
3031 mbedtls_ssl_conf_dtls_badmac_limit(&conf, opt.badmac_limit);
3036 if (opt.force_ciphersuite[0] != DFL_FORCE_CIPHER) {
3037 mbedtls_ssl_conf_ciphersuites(&conf, opt.force_ciphersuite);
3041 mbedtls_ssl_conf_tls13_key_exchange_modes(&conf, opt.tls13_kex_modes);
3044 if (opt.allow_legacy != DFL_ALLOW_LEGACY) {
3045 mbedtls_ssl_conf_legacy_renegotiation(&conf, opt.allow_legacy);
3048 mbedtls_ssl_conf_renegotiation(&conf, opt.renegotiation);
3050 if (opt.renego_delay != DFL_RENEGO_DELAY) {
3051 mbedtls_ssl_conf_renegotiation_enforced(&conf, opt.renego_delay);
3054 if (opt.renego_period != DFL_RENEGO_PERIOD) {
3055 PUT_UINT64_BE(renego_period, opt.renego_period, 0);
3061 if (strcmp(opt.ca_path, "none") != 0 &&
3062 strcmp(opt.ca_file, "none") != 0) {
3064 if (opt.ca_callback != 0) {
3073 if (opt.async_private_delay1 >= 0) {
3075 opt.async_private_delay1);
3092 if (opt.async_private_delay2 >= 0) {
3094 opt.async_private_delay2);
3110 if (opt.async_operations[0] != '-') {
3114 for (r = opt.async_operations; *r; r++) {
3124 ssl_async_keys.inject_error = (opt.async_private_error < 0 ?
3125 -opt.async_private_error :
3126 opt.async_private_error);
3140 if (opt.sni != NULL) {
3144 if (opt.async_private_delay2 >= 0) {
3149 opt.async_private_delay2);
3165 if (opt.groups != NULL &&
3166 strcmp(opt.groups, "default") != 0) {
3172 if (opt.sig_algs != NULL) {
3179 if (strlen(opt.psk) != 0 && strlen(opt.psk_identity) != 0) {
3181 if (opt.psk_opaque != 0) {
3190 (const unsigned char *) opt.psk_identity,
3191 strlen(opt.psk_identity))) != 0) {
3200 (const unsigned char *) opt.psk_identity,
3201 strlen(opt.psk_identity));
3210 if (opt.psk_list != NULL) {
3212 if (opt.psk_list_opaque != 0) {
3236 if (opt.dhm_file != NULL) {
3247 if (opt.min_version != DFL_MIN_VERSION) {
3248 mbedtls_ssl_conf_min_tls_version(&conf, opt.min_version);
3251 if (opt.max_version != DFL_MIN_VERSION) {
3252 mbedtls_ssl_conf_max_tls_version(&conf, opt.max_version);
3260 if (opt.eap_tls != 0) {
3263 } else if (opt.nss_keylog != 0) {
3269 else if (opt.use_srtp != 0) {
3278 opt.nbio == 0 ? recv_timeout_cb : NULL);
3281 if (opt.transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
3282 if ((ret = mbedtls_ssl_set_cid(&ssl, opt.cid_enabled,
3292 if (opt.dtls_mtu != DFL_DTLS_MTU) {
3293 mbedtls_ssl_set_mtu(&ssl, opt.dtls_mtu);
3308 opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ? "tcp" : "udp",
3309 opt.server_addr ? opt.server_addr : "*",
3310 opt.server_port);
3313 if ((ret = mbedtls_net_bind(&listen_fd, opt.server_addr, opt.server_port,
3314 opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ?
3373 if (opt.nbio > 0) {
3383 mbedtls_ssl_conf_read_timeout(&conf, opt.read_timeout);
3386 if (opt.transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
3397 if (opt.ecjpake_pw != DFL_ECJPAKE_PW) {
3399 if (opt.ecjpake_pw_opaque != DFL_ECJPAKE_PW_OPAQUE) {
3407 (const unsigned char *) opt.ecjpake_pw,
3408 strlen(opt.ecjpake_pw),
3427 (const unsigned char *) opt.ecjpake_pw,
3428 strlen(opt.ecjpake_pw))) != 0) {
3444 if (opt.cert_req_dn_hint == 3 && key_cert_init2) {
3462 memset(buf, 0, opt.buffer_size);
3463 ret = mbedtls_ssl_read_early_data(&ssl, buf, opt.buffer_size);
3486 if (opt.event == 1 /* level triggered IO */) {
3518 if (opt.async_private_error < 0) {
3552 if (opt.alpn_string != NULL) {
3588 if (opt.eap_tls != 0) {
3636 else if (opt.use_srtp != 0) {
3699 if (opt.transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
3700 if ((ret = mbedtls_ssl_set_cid(&ssl, opt.cid_enabled_renego,
3716 if (opt.exchanges == 0) {
3720 exchanges_left = opt.exchanges;
3731 if (opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM) {
3734 len = opt.buffer_size;
3735 memset(buf, 0, opt.buffer_size);
3739 if (opt.event == 1 /* level triggered IO */) {
3824 len = opt.buffer_size;
3825 memset(buf, 0, opt.buffer_size);
3836 * in tests/ssl-opt.sh.
3841 opt.event == 1 /* level triggered IO */) {
3880 if (opt.renegotiate && exchanges_left == opt.exchanges) {
3891 if (opt.event == 1 /* level triggered IO */) {
3922 /* Add padding to the response to reach opt.response_size in length */
3923 if (opt.response_size != DFL_RESPONSE_SIZE &&
3924 len < opt.response_size) {
3925 memset(buf + len, 'B', opt.response_size - len);
3926 len += opt.response_size - len;
3930 if (opt.response_size != DFL_RESPONSE_SIZE &&
3931 len > opt.response_size) {
3932 len = opt.response_size;
3943 if (opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM) {
3958 if (opt.event == 1 /* level triggered IO */) {
3976 if (opt.event == 1 /* level triggered IO */) {
4002 if (opt.serialize != 0) {
4033 /* Save serialized context to the 'opt.context_file' as a base64 code */
4034 if (0 < strlen(opt.context_file)) {
4057 if ((b64_file = fopen(opt.context_file, "w")) == NULL) {
4059 opt.context_file);
4085 if (opt.serialize == 1) {
4098 if (opt.serialize == 2) {
4117 if (opt.nbio == 2) {
4123 opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL);
4175 if (opt.cache_remove > 0) {
4194 if (opt.query_config_mode == DFL_QUERY_CONFIG_MODE) {
4228 if ((ret != 0) && (opt.query_config_mode == DFL_QUERY_CONFIG_MODE)) {
4261 if (opt.psk_opaque != 0) {
4268 (opt.query_config_mode == DFL_QUERY_CONFIG_MODE)) {
4283 if ((opt.ecjpake_pw_opaque != DFL_ECJPAKE_PW_OPAQUE)) {
4324 if (opt.query_config_mode == DFL_QUERY_CONFIG_MODE) {
4342 if (opt.query_config_mode == DFL_QUERY_CONFIG_MODE) {
4351 if (opt.query_config_mode == DFL_QUERY_CONFIG_MODE) {