[BACK]Return to s_client.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / openssl

Diff for /src/usr.bin/openssl/s_client.c between version 1.52 and 1.53

version 1.52, 2020/10/14 05:36:18 version 1.53, 2021/03/17 18:08:32
Line 260 
Line 260 
         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)
 {  {
Line 285 
Line 285 
         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;
Line 472 
Line 496 
                 .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",
Line 480 
Line 512 
                 .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)",
Line 546 
Line 586 
                 .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",
Line 745 
Line 785 
                 .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",
Line 828 
Line 868 
             "[-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"
Line 1090 
Line 1130 
         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) {
Line 1290 
Line 1329 
                 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;
   
Line 1370 
Line 1408 
                                 /* 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)) {

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53