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

Diff for /src/usr.bin/openssl/s_time.c between version 1.26 and 1.27

version 1.26, 2018/08/14 15:25:04 version 1.27, 2018/08/18 16:51:33
Line 90 
Line 90 
 extern int verify_depth;  extern int verify_depth;
   
 static void s_time_usage(void);  static void s_time_usage(void);
 static SSL *doConnection(SSL * scon);  static int doConnection(SSL *);
 static int benchmark(int);  static int benchmark(int);
   
 static SSL_CTX *tm_ctx = NULL;  static SSL_CTX *tm_ctx = NULL;
Line 345 
Line 345 
 /***********************************************************************  /***********************************************************************
  * doConnection - make a connection   * doConnection - make a connection
  * Args:   * Args:
  *              scon    = earlier ssl connection for session id, or NULL   *              scon    = SSL connection
  * Returns:   * Returns:
  *              SSL *   = the connection pointer.   *              1 on success, 0 on error
  */   */
 static SSL *  static int
 doConnection(SSL * scon)  doConnection(SSL *scon)
 {  {
         struct pollfd pfd[1];          struct pollfd pfd[1];
         SSL *serverCon;  
         BIO *conn;          BIO *conn;
         long verify_error;          long verify_error;
         int i;          int i;
   
         if ((conn = BIO_new(BIO_s_connect())) == NULL)          if ((conn = BIO_new(BIO_s_connect())) == NULL)
                 return (NULL);                  return 0;
   
 /*      BIO_set_conn_port(conn,port);*/  
         BIO_set_conn_hostname(conn, s_time_config.host);          BIO_set_conn_hostname(conn, s_time_config.host);
           SSL_set_connect_state(scon);
         if (scon == NULL)          SSL_set_bio(scon, conn, conn);
                 serverCon = SSL_new(tm_ctx);  
         else {  
                 serverCon = scon;  
                 SSL_set_connect_state(serverCon);  
         }  
   
         SSL_set_bio(serverCon, conn, conn);  
   
         /* ok, lets connect */  
         for (;;) {          for (;;) {
                 i = SSL_connect(serverCon);                  i = SSL_connect(scon);
                 if (BIO_sock_should_retry(i)) {                  if (BIO_sock_should_retry(i)) {
                         BIO_printf(bio_err, "DELAY\n");                          BIO_printf(bio_err, "DELAY\n");
                           pfd[0].fd = SSL_get_fd(scon);
                         i = SSL_get_fd(serverCon);  
                         pfd[0].fd = i;  
                         pfd[0].events = POLLIN;                          pfd[0].events = POLLIN;
                         poll(pfd, 1, -1);                          poll(pfd, 1, -1);
                         continue;                          continue;
Line 389 
Line 375 
         }          }
         if (i <= 0) {          if (i <= 0) {
                 BIO_printf(bio_err, "ERROR\n");                  BIO_printf(bio_err, "ERROR\n");
                 verify_error = SSL_get_verify_result(serverCon);                  verify_error = SSL_get_verify_result(scon);
                 if (verify_error != X509_V_OK)                  if (verify_error != X509_V_OK)
                         BIO_printf(bio_err, "verify error:%s\n",                          BIO_printf(bio_err, "verify error:%s\n",
                             X509_verify_cert_error_string(verify_error));                              X509_verify_cert_error_string(verify_error));
                 else                  else
                         ERR_print_errors(bio_err);                          ERR_print_errors(bio_err);
                 if (scon == NULL)                  return 0;
                         SSL_free(serverCon);  
                 return NULL;  
         }          }
         return serverCon;          return 1;
 }  }
   
 static int  static int
Line 415 
Line 399 
   
         if (reuse_session) {          if (reuse_session) {
                 /* Get an SSL object so we can reuse the session id */                  /* Get an SSL object so we can reuse the session id */
                 if ((scon = doConnection(NULL)) == NULL) {                  if ((scon = SSL_new(tm_ctx)) == NULL)
                           goto end;
                   if (!doConnection(scon)) {
                         fprintf(stderr, "Unable to get connection\n");                          fprintf(stderr, "Unable to get connection\n");
                         goto end;                          goto end;
                 }                  }
Line 448 
Line 434 
         for (;;) {          for (;;) {
                 if (finishtime < time(NULL))                  if (finishtime < time(NULL))
                         break;                          break;
                 if ((scon = doConnection(reuse_session ? scon : NULL)) == NULL)                  if (scon == NULL) {
                           if ((scon = SSL_new(tm_ctx)) == NULL)
                                   goto end;
                   }
                   if (!doConnection(scon))
                         goto end;                          goto end;
   
                 if (s_time_config.www_path != NULL) {                  if (s_time_config.www_path != NULL) {

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27