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

Diff for /src/usr.bin/ssh/sshd.c between version 1.507 and 1.508

version 1.507, 2018/04/10 00:10:49 version 1.508, 2018/04/13 03:57:26
Line 1323 
Line 1323 
         debug("%s: set routing domain %d (was %d)", __func__, rtable, ortable);          debug("%s: set routing domain %d (was %d)", __func__, rtable, ortable);
 }  }
   
   static void
   accumulate_host_timing_secret(struct sshbuf *server_cfg,
       const struct sshkey *key)
   {
           static struct ssh_digest_ctx *ctx;
           u_char *hash;
           size_t len;
           struct sshbuf *buf;
           int r;
   
           if (ctx == NULL && (ctx = ssh_digest_start(SSH_DIGEST_SHA512)) == NULL)
                   fatal("%s: ssh_digest_start", __func__);
           if (key == NULL) { /* finalize */
                   /* add server config in case we are using agent for host keys */
                   if (ssh_digest_update(ctx, sshbuf_ptr(server_cfg),
                       sshbuf_len(server_cfg)) != 0)
                           fatal("%s: ssh_digest_update", __func__);
                   len = ssh_digest_bytes(SSH_DIGEST_SHA512);
                   hash = xmalloc(len);
                   if (ssh_digest_final(ctx, hash, len) != 0)
                           fatal("%s: ssh_digest_final", __func__);
                   options.timing_secret = PEEK_U64(hash);
                   freezero(hash, len);
                   ssh_digest_free(ctx);
                   ctx = NULL;
                   return;
           }
           if ((buf = sshbuf_new()) == NULL)
                   fatal("%s could not allocate buffer", __func__);
           if ((r = sshkey_private_serialize(key, buf)) != 0)
                   fatal("sshkey_private_serialize: %s", ssh_err(r));
           if (ssh_digest_update(ctx, sshbuf_ptr(buf), sshbuf_len(buf)) != 0)
                   fatal("%s: ssh_digest_update", __func__);
           sshbuf_reset(buf);
           sshbuf_free(buf);
   }
   
 /*  /*
  * Main program for the daemon.   * Main program for the daemon.
  */   */
Line 1597 
Line 1634 
                         keytype = pubkey->type;                          keytype = pubkey->type;
                 } else if (key != NULL) {                  } else if (key != NULL) {
                         keytype = key->type;                          keytype = key->type;
                           accumulate_host_timing_secret(&cfg, key);
                 } else {                  } else {
                         error("Could not load host key: %s",                          error("Could not load host key: %s",
                             options.host_key_files[i]);                              options.host_key_files[i]);
Line 1622 
Line 1660 
                     key ? "private" : "agent", i, sshkey_ssh_name(pubkey), fp);                      key ? "private" : "agent", i, sshkey_ssh_name(pubkey), fp);
                 free(fp);                  free(fp);
         }          }
           accumulate_host_timing_secret(&cfg, NULL);
         if (!sensitive_data.have_ssh2_key) {          if (!sensitive_data.have_ssh2_key) {
                 logit("sshd: no hostkeys available -- exiting.");                  logit("sshd: no hostkeys available -- exiting.");
                 exit(1);                  exit(1);

Legend:
Removed from v.1.507  
changed lines
  Added in v.1.508