Lines Matching refs:opt

320 } opt;  variable
470 opt.server_name = DFL_SERVER_NAME; in main()
471 opt.server_addr = DFL_SERVER_ADDR; in main()
472 opt.server_port = DFL_SERVER_PORT; in main()
473 opt.debug_level = DFL_DEBUG_LEVEL; in main()
474 opt.nbio = DFL_NBIO; in main()
475 opt.read_timeout = DFL_READ_TIMEOUT; in main()
476 opt.max_resend = DFL_MAX_RESEND; in main()
477 opt.request_page = DFL_REQUEST_PAGE; in main()
478 opt.request_size = DFL_REQUEST_SIZE; in main()
479 opt.ca_file = DFL_CA_FILE; in main()
480 opt.ca_path = DFL_CA_PATH; in main()
481 opt.crt_file = DFL_CRT_FILE; in main()
482 opt.key_file = DFL_KEY_FILE; in main()
483 opt.psk = DFL_PSK; in main()
484 opt.psk_identity = DFL_PSK_IDENTITY; in main()
485 opt.ecjpake_pw = DFL_ECJPAKE_PW; in main()
486 opt.force_ciphersuite[0]= DFL_FORCE_CIPHER; in main()
487 opt.renegotiation = DFL_RENEGOTIATION; in main()
488 opt.allow_legacy = DFL_ALLOW_LEGACY; in main()
489 opt.renegotiate = DFL_RENEGOTIATE; in main()
490 opt.exchanges = DFL_EXCHANGES; in main()
491 opt.min_version = DFL_MIN_VERSION; in main()
492 opt.max_version = DFL_MAX_VERSION; in main()
493 opt.arc4 = DFL_ARC4; in main()
494 opt.auth_mode = DFL_AUTH_MODE; in main()
495 opt.mfl_code = DFL_MFL_CODE; in main()
496 opt.trunc_hmac = DFL_TRUNC_HMAC; in main()
497 opt.recsplit = DFL_RECSPLIT; in main()
498 opt.dhmlen = DFL_DHMLEN; in main()
499 opt.reconnect = DFL_RECONNECT; in main()
500 opt.reco_delay = DFL_RECO_DELAY; in main()
501 opt.reconnect_hard = DFL_RECONNECT_HARD; in main()
502 opt.tickets = DFL_TICKETS; in main()
503 opt.alpn_string = DFL_ALPN_STRING; in main()
504 opt.transport = DFL_TRANSPORT; in main()
505 opt.hs_to_min = DFL_HS_TO_MIN; in main()
506 opt.hs_to_max = DFL_HS_TO_MAX; in main()
507 opt.fallback = DFL_FALLBACK; in main()
508 opt.extended_ms = DFL_EXTENDED_MS; in main()
509 opt.etm = DFL_ETM; in main()
519 opt.server_name = q; in main()
521 opt.server_addr = q; in main()
523 opt.server_port = q; in main()
528 opt.transport = MBEDTLS_SSL_TRANSPORT_STREAM; in main()
530 opt.transport = MBEDTLS_SSL_TRANSPORT_DATAGRAM; in main()
536 opt.debug_level = atoi( q ); in main()
537 if( opt.debug_level < 0 || opt.debug_level > 65535 ) in main()
542 opt.nbio = atoi( q ); in main()
543 if( opt.nbio < 0 || opt.nbio > 2 ) in main()
547 opt.read_timeout = atoi( q ); in main()
550 opt.max_resend = atoi( q ); in main()
551 if( opt.max_resend < 0 ) in main()
555 opt.request_page = q; in main()
558 opt.request_size = atoi( q ); in main()
559 if( opt.request_size < 0 || opt.request_size > MBEDTLS_SSL_MAX_CONTENT_LEN ) in main()
563 opt.ca_file = q; in main()
565 opt.ca_path = q; in main()
567 opt.crt_file = q; in main()
569 opt.key_file = q; in main()
571 opt.psk = q; in main()
573 opt.psk_identity = q; in main()
575 opt.ecjpake_pw = q; in main()
578 opt.force_ciphersuite[0] = mbedtls_ssl_get_ciphersuite_id( q ); in main()
580 if( opt.force_ciphersuite[0] == 0 ) in main()
585 opt.force_ciphersuite[1] = 0; in main()
589 opt.renegotiation = (atoi( q )) ? MBEDTLS_SSL_RENEGOTIATION_ENABLED : in main()
596 case -1: opt.allow_legacy = MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE; break; in main()
597 case 0: opt.allow_legacy = MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION; break; in main()
598 case 1: opt.allow_legacy = MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION; break; in main()
604 opt.renegotiate = atoi( q ); in main()
605 if( opt.renegotiate < 0 || opt.renegotiate > 1 ) in main()
610 opt.exchanges = atoi( q ); in main()
611 if( opt.exchanges < 1 ) in main()
616 opt.reconnect = atoi( q ); in main()
617 if( opt.reconnect < 0 || opt.reconnect > 2 ) in main()
622 opt.reco_delay = atoi( q ); in main()
623 if( opt.reco_delay < 0 ) in main()
628 opt.reconnect_hard = atoi( q ); in main()
629 if( opt.reconnect_hard < 0 || opt.reconnect_hard > 1 ) in main()
634 opt.tickets = atoi( q ); in main()
635 if( opt.tickets < 0 || opt.tickets > 2 ) in main()
640 opt.alpn_string = q; in main()
646 case 0: opt.fallback = MBEDTLS_SSL_IS_NOT_FALLBACK; break; in main()
647 case 1: opt.fallback = MBEDTLS_SSL_IS_FALLBACK; break; in main()
655 case 0: opt.extended_ms = MBEDTLS_SSL_EXTENDED_MS_DISABLED; break; in main()
656 case 1: opt.extended_ms = MBEDTLS_SSL_EXTENDED_MS_ENABLED; break; in main()
664 case 0: opt.etm = MBEDTLS_SSL_ETM_DISABLED; break; in main()
665 case 1: opt.etm = MBEDTLS_SSL_ETM_ENABLED; break; in main()
672 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_0; in main()
674 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_1; in main()
677 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
680 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_3; in main()
687 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_0; in main()
689 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_1; in main()
692 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
695 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_3; in main()
703 case 0: opt.arc4 = MBEDTLS_SSL_ARC4_DISABLED; break; in main()
704 case 1: opt.arc4 = MBEDTLS_SSL_ARC4_ENABLED; break; in main()
712 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_0; in main()
713 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_0; in main()
717 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_1; in main()
718 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_1; in main()
722 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
723 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
727 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_3; in main()
728 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_3; in main()
732 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
733 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
734 opt.transport = MBEDTLS_SSL_TRANSPORT_DATAGRAM; in main()
738 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_3; in main()
739 opt.max_version = MBEDTLS_SSL_MINOR_VERSION_3; in main()
740 opt.transport = MBEDTLS_SSL_TRANSPORT_DATAGRAM; in main()
748 opt.auth_mode = MBEDTLS_SSL_VERIFY_NONE; in main()
750 opt.auth_mode = MBEDTLS_SSL_VERIFY_OPTIONAL; in main()
752 opt.auth_mode = MBEDTLS_SSL_VERIFY_REQUIRED; in main()
759 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_512; in main()
761 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_1024; in main()
763 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_2048; in main()
765 opt.mfl_code = MBEDTLS_SSL_MAX_FRAG_LEN_4096; in main()
773 case 0: opt.trunc_hmac = MBEDTLS_SSL_TRUNC_HMAC_DISABLED; break; in main()
774 case 1: opt.trunc_hmac = MBEDTLS_SSL_TRUNC_HMAC_ENABLED; break; in main()
783 opt.hs_to_min = atoi( q ); in main()
784 opt.hs_to_max = atoi( p ); in main()
785 if( opt.hs_to_min == 0 || opt.hs_to_max < opt.hs_to_min ) in main()
790 opt.recsplit = atoi( q ); in main()
791 if( opt.recsplit < 0 || opt.recsplit > 1 ) in main()
796 opt.dhmlen = atoi( q ); in main()
797 if( opt.dhmlen < 0 ) in main()
805 mbedtls_debug_set_threshold( opt.debug_level ); in main()
808 if( opt.force_ciphersuite[0] > 0 ) in main()
811 ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( opt.force_ciphersuite[0] ); in main()
813 if( opt.max_version != -1 && in main()
814 ciphersuite_info->min_minor_ver > opt.max_version ) in main()
820 if( opt.min_version != -1 && in main()
821 ciphersuite_info->max_minor_ver < opt.min_version ) in main()
830 if( opt.max_version == -1 || in main()
831 opt.max_version > ciphersuite_info->max_minor_ver ) in main()
833 opt.max_version = ciphersuite_info->max_minor_ver; in main()
835 if( opt.min_version < ciphersuite_info->min_minor_ver ) in main()
837 opt.min_version = ciphersuite_info->min_minor_ver; in main()
839 if( opt.transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && in main()
840 opt.min_version < MBEDTLS_SSL_MINOR_VERSION_2 ) in main()
841 opt.min_version = MBEDTLS_SSL_MINOR_VERSION_2; in main()
847 if( opt.arc4 == MBEDTLS_SSL_ARC4_DISABLED ) in main()
854 opt.arc4 = MBEDTLS_SSL_ARC4_ENABLED; in main()
862 if( strlen( opt.psk ) ) in main()
867 if( strlen( opt.psk ) % 2 != 0 ) in main()
873 psk_len = strlen( opt.psk ) / 2; in main()
875 for( j = 0; j < strlen( opt.psk ); j += 2 ) in main()
877 c = opt.psk[j]; in main()
891 c = opt.psk[j + 1]; in main()
909 if( opt.alpn_string != NULL ) in main()
911 p = (char *) opt.alpn_string; in main()
953 if( strlen( opt.ca_path ) ) in main()
954 if( strcmp( opt.ca_path, "none" ) == 0 ) in main()
957 ret = mbedtls_x509_crt_parse_path( &cacert, opt.ca_path ); in main()
958 else if( strlen( opt.ca_file ) ) in main()
959 if( strcmp( opt.ca_file, "none" ) == 0 ) in main()
962 ret = mbedtls_x509_crt_parse_file( &cacert, opt.ca_file ); in main()
997 if( strlen( opt.crt_file ) ) in main()
998 if( strcmp( opt.crt_file, "none" ) == 0 ) in main()
1001 ret = mbedtls_x509_crt_parse_file( &clicert, opt.crt_file ); in main()
1020 if( strlen( opt.key_file ) ) in main()
1021 if( strcmp( opt.key_file, "none" ) == 0 ) in main()
1024 ret = mbedtls_pk_parse_keyfile( &pkey, opt.key_file, "" ); in main()
1048 if( opt.server_addr == NULL) in main()
1049 opt.server_addr = opt.server_name; in main()
1052 opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ? "tcp" : "udp", in main()
1053 opt.server_addr, opt.server_port ); in main()
1056 if( ( ret = mbedtls_net_connect( &server_fd, opt.server_addr, opt.server_port, in main()
1057 opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ? in main()
1064 if( opt.nbio > 0 ) in main()
1084 opt.transport, in main()
1092 if( opt.debug_level > 0 ) in main()
1096 if( opt.auth_mode != DFL_AUTH_MODE ) in main()
1097 mbedtls_ssl_conf_authmode( &conf, opt.auth_mode ); in main()
1100 if( opt.hs_to_min != DFL_HS_TO_MIN || opt.hs_to_max != DFL_HS_TO_MAX ) in main()
1101 mbedtls_ssl_conf_handshake_timeout( &conf, opt.hs_to_min, opt.hs_to_max ); in main()
1105 if( ( ret = mbedtls_ssl_conf_max_frag_len( &conf, opt.mfl_code ) ) != 0 ) in main()
1113 if( opt.trunc_hmac != DFL_TRUNC_HMAC ) in main()
1114 mbedtls_ssl_conf_truncated_hmac( &conf, opt.trunc_hmac ); in main()
1118 if( opt.extended_ms != DFL_EXTENDED_MS ) in main()
1119 mbedtls_ssl_conf_extended_master_secret( &conf, opt.extended_ms ); in main()
1123 if( opt.etm != DFL_ETM ) in main()
1124 mbedtls_ssl_conf_encrypt_then_mac( &conf, opt.etm ); in main()
1128 if( opt.recsplit != DFL_RECSPLIT ) in main()
1129 mbedtls_ssl_conf_cbc_record_splitting( &conf, opt.recsplit in main()
1135 if( opt.dhmlen != DFL_DHMLEN ) in main()
1136 mbedtls_ssl_conf_dhm_min_bitlen( &conf, opt.dhmlen ); in main()
1140 if( opt.alpn_string != NULL ) in main()
1151 mbedtls_ssl_conf_read_timeout( &conf, opt.read_timeout ); in main()
1154 mbedtls_ssl_conf_session_tickets( &conf, opt.tickets ); in main()
1157 if( opt.force_ciphersuite[0] != DFL_FORCE_CIPHER ) in main()
1158 mbedtls_ssl_conf_ciphersuites( &conf, opt.force_ciphersuite ); in main()
1161 if( opt.arc4 != DFL_ARC4 ) in main()
1162 mbedtls_ssl_conf_arc4_support( &conf, opt.arc4 ); in main()
1165 if( opt.allow_legacy != DFL_ALLOW_LEGACY ) in main()
1166 mbedtls_ssl_conf_legacy_renegotiation( &conf, opt.allow_legacy ); in main()
1168 mbedtls_ssl_conf_renegotiation( &conf, opt.renegotiation ); in main()
1172 if( strcmp( opt.ca_path, "none" ) != 0 && in main()
1173 strcmp( opt.ca_file, "none" ) != 0 ) in main()
1177 if( strcmp( opt.crt_file, "none" ) != 0 && in main()
1178 strcmp( opt.key_file, "none" ) != 0 ) in main()
1190 (const unsigned char *) opt.psk_identity, in main()
1191 strlen( opt.psk_identity ) ) ) != 0 ) in main()
1198 if( opt.min_version != DFL_MIN_VERSION ) in main()
1199 mbedtls_ssl_conf_min_version( &conf, MBEDTLS_SSL_MAJOR_VERSION_3, opt.min_version ); in main()
1201 if( opt.max_version != DFL_MAX_VERSION ) in main()
1202 mbedtls_ssl_conf_max_version( &conf, MBEDTLS_SSL_MAJOR_VERSION_3, opt.max_version ); in main()
1205 if( opt.fallback != DFL_FALLBACK ) in main()
1206 mbedtls_ssl_conf_fallback( &conf, opt.fallback ); in main()
1216 if( ( ret = mbedtls_ssl_set_hostname( &ssl, opt.server_name ) ) != 0 ) in main()
1224 if( opt.ecjpake_pw != DFL_ECJPAKE_PW ) in main()
1227 (const unsigned char *) opt.ecjpake_pw, in main()
1228 strlen( opt.ecjpake_pw ) ) ) != 0 ) in main()
1236 if( opt.nbio == 2 ) in main()
1240 opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL ); in main()
1287 if( opt.alpn_string != NULL ) in main()
1295 if( opt.reconnect != 0 ) in main()
1338 if( opt.renegotiate ) in main()
1362 retry_left = opt.max_resend; in main()
1368 opt.request_page ); in main()
1372 if( opt.request_size != DFL_REQUEST_SIZE && in main()
1373 len + tail_len < opt.request_size ) in main()
1375 memset( buf + len, 'A', opt.request_size - len - tail_len ); in main()
1376 len += opt.request_size - len - tail_len; in main()
1383 if( opt.request_size != DFL_REQUEST_SIZE && in main()
1384 len > opt.request_size ) in main()
1386 len = opt.request_size; in main()
1393 if( opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ) in main()
1437 if( opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ) in main()
1523 if( opt.reconnect_hard != 0 ) in main()
1525 opt.reconnect_hard = 0; in main()
1554 if( --opt.exchanges > 0 ) in main()
1575 if( opt.reconnect != 0 ) in main()
1577 --opt.reconnect; in main()
1582 if( opt.reco_delay > 0 ) in main()
1583 mbedtls_net_usleep( 1000000 * opt.reco_delay ); in main()
1600 if( ( ret = mbedtls_net_connect( &server_fd, opt.server_addr, opt.server_port, in main()
1601 opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ? in main()
1608 if( opt.nbio > 0 ) in main()