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

Diff for /src/usr.bin/ssh/kexecdh.c between version 1.8 and 1.9

version 1.8, 2019/01/21 10:29:56 version 1.9, 2019/01/21 10:35:09
Line 39 
Line 39 
 #include "ssherr.h"  #include "ssherr.h"
   
 static int  static int
 kex_ecdh_dec_key_group(struct kex *, const u_char *, size_t, EC_KEY *key,  kex_ecdh_dec_key_group(struct kex *, const struct sshbuf *, EC_KEY *key,
     const EC_GROUP *, struct sshbuf **);      const EC_GROUP *, struct sshbuf **);
   
 int  int
Line 85 
Line 85 
 }  }
   
 int  int
 kex_ecdh_enc(struct kex *kex, const u_char *pkblob, size_t pklen,  kex_ecdh_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 EC_GROUP *group;          const EC_GROUP *group;
Line 119 
Line 119 
         if ((r = sshbuf_put_ec(server_blob, pub_key, group)) != 0 ||          if ((r = sshbuf_put_ec(server_blob, pub_key, group)) != 0 ||
             (r = sshbuf_get_u32(server_blob, NULL)) != 0)              (r = sshbuf_get_u32(server_blob, NULL)) != 0)
                 goto out;                  goto out;
         if ((r = kex_ecdh_dec_key_group(kex, pkblob, pklen, server_key, group,          if ((r = kex_ecdh_dec_key_group(kex, client_blob, server_key, group,
             shared_secretp)) != 0)              shared_secretp)) != 0)
                 goto out;                  goto out;
         *server_blobp = server_blob;          *server_blobp = server_blob;
Line 131 
Line 131 
 }  }
   
 static int  static int
 kex_ecdh_dec_key_group(struct kex *kex, const u_char *pkblob, size_t pklen,  kex_ecdh_dec_key_group(struct kex *kex, const struct sshbuf *ec_blob,
     EC_KEY *key, const EC_GROUP *group, struct sshbuf **shared_secretp)      EC_KEY *key, const EC_GROUP *group, struct sshbuf **shared_secretp)
 {  {
         struct sshbuf *buf = NULL;          struct sshbuf *buf = NULL;
Line 147 
Line 147 
                 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, ec_blob)) != 0)
             (r = sshbuf_put(buf, pkblob, pklen)) != 0) {  
                 goto out;                  goto out;
         }  
         if ((dh_pub = EC_POINT_new(group)) == NULL) {          if ((dh_pub = EC_POINT_new(group)) == NULL) {
                 r = SSH_ERR_ALLOC_FAIL;                  r = SSH_ERR_ALLOC_FAIL;
                 goto out;                  goto out;
Line 195 
Line 193 
 }  }
   
 int  int
 kex_ecdh_dec(struct kex *kex, const u_char *pkblob, size_t pklen,  kex_ecdh_dec(struct kex *kex, const struct sshbuf *server_blob,
     struct sshbuf **shared_secretp)      struct sshbuf **shared_secretp)
 {  {
         int r;          int r;
   
         r = kex_ecdh_dec_key_group(kex, pkblob, pklen, kex->ec_client_key,          r = kex_ecdh_dec_key_group(kex, server_blob, kex->ec_client_key,
             kex->ec_group, shared_secretp);              kex->ec_group, shared_secretp);
         EC_KEY_free(kex->ec_client_key);          EC_KEY_free(kex->ec_client_key);
         kex->ec_client_key = NULL;          kex->ec_client_key = NULL;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9