version 1.52, 2020/10/14 05:36:18 |
version 1.53, 2021/03/17 18:08:32 |
|
|
return (0); |
return (0); |
} |
} |
|
|
#ifndef OPENSSL_NO_DTLS1 |
#ifndef OPENSSL_NO_DTLS |
static int |
static int |
s_client_opt_mtu(char *arg) |
s_client_opt_mtu(char *arg) |
{ |
{ |
|
|
return (0); |
return (0); |
} |
} |
|
|
|
#ifndef OPENSSL_NO_DTLS |
|
static int |
|
s_client_opt_protocol_version_dtls(void) |
|
{ |
|
s_client_config.meth = DTLS_client_method(); |
|
s_client_config.socket_type = SOCK_DGRAM; |
|
return (0); |
|
} |
|
#endif |
|
|
#ifndef OPENSSL_NO_DTLS1 |
#ifndef OPENSSL_NO_DTLS1 |
static int |
static int |
s_client_opt_protocol_version_dtls1(void) |
s_client_opt_protocol_version_dtls1(void) |
{ |
{ |
s_client_config.meth = DTLS_client_method(); |
s_client_config.meth = DTLS_client_method(); |
|
s_client_config.min_version = DTLS1_VERSION; |
|
s_client_config.max_version = DTLS1_VERSION; |
s_client_config.socket_type = SOCK_DGRAM; |
s_client_config.socket_type = SOCK_DGRAM; |
return (0); |
return (0); |
} |
} |
#endif |
#endif |
|
|
|
#ifndef OPENSSL_NO_DTLS1_2 |
static int |
static int |
|
s_client_opt_protocol_version_dtls1_2(void) |
|
{ |
|
s_client_config.meth = DTLS_client_method(); |
|
s_client_config.min_version = DTLS1_2_VERSION; |
|
s_client_config.max_version = DTLS1_2_VERSION; |
|
s_client_config.socket_type = SOCK_DGRAM; |
|
return (0); |
|
} |
|
#endif |
|
|
|
static int |
s_client_opt_protocol_version_tls1(void) |
s_client_opt_protocol_version_tls1(void) |
{ |
{ |
s_client_config.min_version = TLS1_VERSION; |
s_client_config.min_version = TLS1_VERSION; |
|
|
.type = OPTION_FLAG, |
.type = OPTION_FLAG, |
.opt.flag = &s_client_config.debug, |
.opt.flag = &s_client_config.debug, |
}, |
}, |
|
#ifndef OPENSSL_NO_DTLS |
|
{ |
|
.name = "dtls", |
|
.desc = "Use any version of DTLS", |
|
.type = OPTION_FUNC, |
|
.opt.func = s_client_opt_protocol_version_dtls, |
|
}, |
|
#endif |
#ifndef OPENSSL_NO_DTLS1 |
#ifndef OPENSSL_NO_DTLS1 |
{ |
{ |
.name = "dtls1", |
.name = "dtls1", |
|
|
.opt.func = s_client_opt_protocol_version_dtls1, |
.opt.func = s_client_opt_protocol_version_dtls1, |
}, |
}, |
#endif |
#endif |
|
#ifndef OPENSSL_NO_DTLS1_2 |
{ |
{ |
|
.name = "dtls1_2", |
|
.desc = "Just use DTLSv1.2", |
|
.type = OPTION_FUNC, |
|
.opt.func = s_client_opt_protocol_version_dtls1_2, |
|
}, |
|
#endif |
|
{ |
.name = "groups", |
.name = "groups", |
.argname = "list", |
.argname = "list", |
.desc = "Specify EC groups (colon-separated list)", |
.desc = "Specify EC groups (colon-separated list)", |
|
|
.type = OPTION_FLAG, |
.type = OPTION_FLAG, |
.opt.flag = &s_client_config.msg, |
.opt.flag = &s_client_config.msg, |
}, |
}, |
#ifndef OPENSSL_NO_DTLS1 |
#ifndef OPENSSL_NO_DTLS |
{ |
{ |
.name = "mtu", |
.name = "mtu", |
.argname = "mtu", |
.argname = "mtu", |
|
|
.type = OPTION_FLAG, |
.type = OPTION_FLAG, |
.opt.flag = &s_client_config.status_req, |
.opt.flag = &s_client_config.status_req, |
}, |
}, |
#ifndef OPENSSL_NO_DTLS1 |
#ifndef OPENSSL_NO_DTLS |
{ |
{ |
.name = "timeout", |
.name = "timeout", |
.desc = "Enable send/receive timeout on DTLS connections", |
.desc = "Enable send/receive timeout on DTLS connections", |
|
|
"[-4 | -6] [-alpn protocols] [-bugs] [-CAfile file]\n" |
"[-4 | -6] [-alpn protocols] [-bugs] [-CAfile file]\n" |
" [-CApath directory] [-cert file] [-certform der | pem] [-check_ss_sig]\n" |
" [-CApath directory] [-cert file] [-certform der | pem] [-check_ss_sig]\n" |
" [-cipher cipherlist] [-connect host[:port]] [-crl_check]\n" |
" [-cipher cipherlist] [-connect host[:port]] [-crl_check]\n" |
" [-crl_check_all] [-crlf] [-debug] [-dtls1] [-extended_crl]\n" |
" [-crl_check_all] [-crlf] [-debug] [-dtls] [-dtls1] [-dtls1_2] [-extended_crl]\n" |
" [-groups list] [-host host] [-ign_eof] [-ignore_critical]\n" |
" [-groups list] [-host host] [-ign_eof] [-ignore_critical]\n" |
" [-issuer_checks] [-key keyfile] [-keyform der | pem]\n" |
" [-issuer_checks] [-key keyfile] [-keyform der | pem]\n" |
" [-keymatexport label] [-keymatexportlen len] [-legacy_server_connect]\n" |
" [-keymatexport label] [-keymatexportlen len] [-legacy_server_connect]\n" |
|
|
if (s_client_config.pause & 0x01) |
if (s_client_config.pause & 0x01) |
SSL_set_debug(con, 1); |
SSL_set_debug(con, 1); |
|
|
if (SSL_version(con) == DTLS1_VERSION) { |
if (SSL_is_dtls(con)) { |
|
|
sbio = BIO_new_dgram(s, BIO_NOCLOSE); |
sbio = BIO_new_dgram(s, BIO_NOCLOSE); |
if (getsockname(s, (struct sockaddr *)&peer, |
if (getsockname(s, (struct sockaddr *)&peer, |
(void *)&peerlen) == -1) { |
(void *)&peerlen) == -1) { |
|
|
struct pollfd pfd[3]; /* stdin, stdout, socket */ |
struct pollfd pfd[3]; /* stdin, stdout, socket */ |
int ptimeout = -1; |
int ptimeout = -1; |
|
|
if ((SSL_version(con) == DTLS1_VERSION) && |
if (SSL_is_dtls(con) && DTLSv1_get_timeout(con, &timeout)) |
DTLSv1_get_timeout(con, &timeout)) |
|
ptimeout = timeout.tv_sec * 1000 + |
ptimeout = timeout.tv_sec * 1000 + |
timeout.tv_usec / 1000; |
timeout.tv_usec / 1000; |
|
|
|
|
/* goto end; */ |
/* goto end; */ |
} |
} |
} |
} |
if ((SSL_version(con) == DTLS1_VERSION) && |
if (SSL_is_dtls(con) && |
DTLSv1_handle_timeout(con) > 0) { |
DTLSv1_handle_timeout(con) > 0) |
BIO_printf(bio_err, "TIMEOUT occured\n"); |
BIO_printf(bio_err, "TIMEOUT occured\n"); |
} |
|
if (!ssl_pending && |
if (!ssl_pending && |
(pfd[2].revents & (POLLOUT|POLLERR|POLLNVAL))) { |
(pfd[2].revents & (POLLOUT|POLLERR|POLLNVAL))) { |
if (pfd[2].revents & (POLLERR|POLLNVAL)) { |
if (pfd[2].revents & (POLLERR|POLLNVAL)) { |