[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.3 and 1.3.4.2

version 1.3, 2001/04/04 09:48:34 version 1.3.4.2, 2001/09/27 00:15:42
Line 38 
Line 38 
 #include "dh.h"  #include "dh.h"
 #include "ssh2.h"  #include "ssh2.h"
   
 u_char *  static u_char *
 kex_dh_hash(  kex_dh_hash(
     char *client_version_string,      char *client_version_string,
     char *server_version_string,      char *server_version_string,
     char *ckexinit, int ckexinitlen,      char *ckexinit, int ckexinitlen,
     char *skexinit, int skexinitlen,      char *skexinit, int skexinitlen,
     char *serverhostkeyblob, int sbloblen,      u_char *serverhostkeyblob, int sbloblen,
     BIGNUM *client_dh_pub,      BIGNUM *client_dh_pub,
     BIGNUM *server_dh_pub,      BIGNUM *server_dh_pub,
     BIGNUM *shared_secret)      BIGNUM *shared_secret)
Line 55 
Line 55 
         EVP_MD_CTX md;          EVP_MD_CTX md;
   
         buffer_init(&b);          buffer_init(&b);
         buffer_put_string(&b, client_version_string, strlen(client_version_string));          buffer_put_cstring(&b, client_version_string);
         buffer_put_string(&b, server_version_string, strlen(server_version_string));          buffer_put_cstring(&b, server_version_string);
   
         /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */          /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
         buffer_put_int(&b, ckexinitlen+1);          buffer_put_int(&b, ckexinitlen+1);
Line 88 
Line 88 
   
 /* client */  /* client */
   
 void  static void
 kexdh_client(Kex *kex)  kexdh_client(Kex *kex)
 {  {
         BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;          BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;
         DH *dh;          DH *dh;
         Key *server_host_key;          Key *server_host_key;
         char *server_host_key_blob = NULL, *signature = NULL;          u_char *server_host_key_blob = NULL, *signature = NULL;
         u_char *kbuf, *hash;          u_char *kbuf, *hash;
         u_int klen, kout, slen, sbloblen;          u_int klen, kout, slen, sbloblen;
         int dlen, plen;          int dlen, plen;
Line 123 
Line 123 
         if (server_host_key == NULL)          if (server_host_key == NULL)
                 fatal("cannot decode server_host_key_blob");                  fatal("cannot decode server_host_key_blob");
   
         if (kex->check_host_key == NULL)          if (kex->verify_host_key == NULL)
                 fatal("cannot check server_host_key");                  fatal("cannot verify server_host_key");
         kex->check_host_key(server_host_key);          if (kex->verify_host_key(server_host_key) == -1)
                   fatal("server_host_key verification failed");
   
         /* DH paramter f, server public DH key */          /* DH paramter f, server public DH key */
         dh_server_pub = BN_new();          dh_server_pub = BN_new();
Line 173 
Line 174 
         BN_free(dh_server_pub);          BN_free(dh_server_pub);
         DH_free(dh);          DH_free(dh);
   
         if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1)          if (key_verify(server_host_key, signature, slen, hash, 20) != 1)
                 fatal("key_verify failed for server_host_key");                  fatal("key_verify failed for server_host_key");
         key_free(server_host_key);          key_free(server_host_key);
         xfree(signature);          xfree(signature);
Line 192 
Line 193 
   
 /* server */  /* server */
   
 void  static void
 kexdh_server(Kex *kex)  kexdh_server(Kex *kex)
 {  {
         BIGNUM *shared_secret = NULL, *dh_client_pub = NULL;          BIGNUM *shared_secret = NULL, *dh_client_pub = NULL;
Line 256 
Line 257 
             kex->server_version_string,              kex->server_version_string,
             buffer_ptr(&kex->peer), buffer_len(&kex->peer),              buffer_ptr(&kex->peer), buffer_len(&kex->peer),
             buffer_ptr(&kex->my), buffer_len(&kex->my),              buffer_ptr(&kex->my), buffer_len(&kex->my),
             (char *)server_host_key_blob, sbloblen,              server_host_key_blob, sbloblen,
             dh_client_pub,              dh_client_pub,
             dh->pub_key,              dh->pub_key,
             shared_secret              shared_secret
Line 279 
Line 280 
   
         /* send server hostkey, DH pubkey 'f' and singed H */          /* send server hostkey, DH pubkey 'f' and singed H */
         packet_start(SSH2_MSG_KEXDH_REPLY);          packet_start(SSH2_MSG_KEXDH_REPLY);
         packet_put_string((char *)server_host_key_blob, sbloblen);          packet_put_string(server_host_key_blob, sbloblen);
         packet_put_bignum2(dh->pub_key);        /* f */          packet_put_bignum2(dh->pub_key);        /* f */
         packet_put_string((char *)signature, slen);          packet_put_string(signature, slen);
         packet_send();          packet_send();
   
         xfree(signature);          xfree(signature);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.3.4.2