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

Diff for /src/usr.bin/ssh/kexgexc.c between version 1.27 and 1.28

version 1.27, 2018/02/07 02:06:51 version 1.28, 2018/09/13 02:08:33
Line 88 
Line 88 
 {  {
         struct kex *kex = ssh->kex;          struct kex *kex = ssh->kex;
         BIGNUM *p = NULL, *g = NULL;          BIGNUM *p = NULL, *g = NULL;
           const BIGNUM *pub_key;
         int r, bits;          int r, bits;
   
         debug("got SSH2_MSG_KEX_DH_GEX_GROUP");          debug("got SSH2_MSG_KEX_DH_GEX_GROUP");
Line 113 
Line 114 
         p = g = NULL; /* belong to kex->dh now */          p = g = NULL; /* belong to kex->dh now */
   
         /* generate and send 'e', client DH public key */          /* generate and send 'e', client DH public key */
         if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0 ||          if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0)
             (r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_INIT)) != 0 ||                  goto out;
             (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 ||          DH_get0_key(kex->dh, &pub_key, NULL);
           if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_INIT)) != 0 ||
               (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 ||
             (r = sshpkt_send(ssh)) != 0)              (r = sshpkt_send(ssh)) != 0)
                 goto out;                  goto out;
         debug("SSH2_MSG_KEX_DH_GEX_INIT sent");          debug("SSH2_MSG_KEX_DH_GEX_INIT sent");
 #ifdef DEBUG_KEXDH  #ifdef DEBUG_KEXDH
         DHparams_print_fp(stderr, kex->dh);          DHparams_print_fp(stderr, kex->dh);
         fprintf(stderr, "pub= ");          fprintf(stderr, "pub= ");
         BN_print_fp(stderr, kex->dh->pub_key);          BN_print_fp(stderr, pub_key);
         fprintf(stderr, "\n");          fprintf(stderr, "\n");
 #endif  #endif
         ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_GROUP, NULL);          ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_GROUP, NULL);
Line 139 
Line 142 
 {  {
         struct kex *kex = ssh->kex;          struct kex *kex = ssh->kex;
         BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;          BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;
           const BIGNUM *pub_key, *dh_p, *dh_g;
         struct sshkey *server_host_key = NULL;          struct sshkey *server_host_key = NULL;
         u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;          u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;
         u_char hash[SSH_DIGEST_MAX_LENGTH];          u_char hash[SSH_DIGEST_MAX_LENGTH];
Line 206 
Line 210 
                 kex->min = kex->max = -1;                  kex->min = kex->max = -1;
   
         /* calc and verify H */          /* calc and verify H */
           DH_get0_key(kex->dh, &pub_key, NULL);
           DH_get0_pqg(kex->dh, &dh_p, NULL, &dh_g);
         hashlen = sizeof(hash);          hashlen = sizeof(hash);
         if ((r = kexgex_hash(          if ((r = kexgex_hash(
             kex->hash_alg,              kex->hash_alg,
Line 215 
Line 221 
             sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),              sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
             server_host_key_blob, sbloblen,              server_host_key_blob, sbloblen,
             kex->min, kex->nbits, kex->max,              kex->min, kex->nbits, kex->max,
             kex->dh->p, kex->dh->g,              dh_p, dh_g,
             kex->dh->pub_key,              pub_key,
             dh_server_pub,              dh_server_pub,
             shared_secret,              shared_secret,
             hash, &hashlen)) != 0)              hash, &hashlen)) != 0)

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