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

Diff for /src/usr.bin/ssh/kexdh.c between version 1.30 and 1.31

version 1.30, 2019/01/21 10:28:01 version 1.31, 2019/01/21 10:35:09
Line 132 
Line 132 
 }  }
   
 int  int
 kex_dh_enc(struct kex *kex, const u_char *pkblob, size_t pklen,  kex_dh_enc(struct kex *kex, const struct sshbuf *client_blob,
     struct sshbuf **server_blobp, struct sshbuf **shared_secretp)      struct sshbuf **server_blobp, struct sshbuf **shared_secretp)
 {  {
         const BIGNUM *pub_key;          const BIGNUM *pub_key;
Line 152 
Line 152 
         if ((r = sshbuf_put_bignum2(server_blob, pub_key)) != 0 ||          if ((r = sshbuf_put_bignum2(server_blob, pub_key)) != 0 ||
             (r = sshbuf_get_u32(server_blob, NULL)) != 0)              (r = sshbuf_get_u32(server_blob, NULL)) != 0)
                 goto out;                  goto out;
         if ((r = kex_dh_dec(kex, pkblob, pklen, shared_secretp)) != 0)          if ((r = kex_dh_dec(kex, client_blob, shared_secretp)) != 0)
                 goto out;                  goto out;
         *server_blobp = server_blob;          *server_blobp = server_blob;
         server_blob = NULL;          server_blob = NULL;
Line 164 
Line 164 
 }  }
   
 int  int
 kex_dh_dec(struct kex *kex, const u_char *pkblob, size_t pklen,  kex_dh_dec(struct kex *kex, const struct sshbuf *dh_blob,
     struct sshbuf **shared_secretp)      struct sshbuf **shared_secretp)
 {  {
         struct sshbuf *buf = NULL;          struct sshbuf *buf = NULL;
Line 177 
Line 177 
                 r = SSH_ERR_ALLOC_FAIL;                  r = SSH_ERR_ALLOC_FAIL;
                 goto out;                  goto out;
         }          }
         if ((r = sshbuf_put_u32(buf, pklen)) != 0 ||          if ((r = sshbuf_put_stringb(buf, dh_blob)) != 0 ||
             (r = sshbuf_put(buf, pkblob, pklen)) != 0) {              (r = sshbuf_get_bignum2(buf, &dh_pub)) != 0)
                 goto out;                  goto out;
         }  
         if ((r = sshbuf_get_bignum2(buf, &dh_pub)) != 0) {  
                 goto out;  
         }  
         sshbuf_reset(buf);          sshbuf_reset(buf);
         if ((r = kex_dh_compute_key(kex, dh_pub, buf)) != 0)          if ((r = kex_dh_compute_key(kex, dh_pub, buf)) != 0)
                 goto out;                  goto out;

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31