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

Diff for /src/usr.bin/ssh/kexc25519.c between version 1.15 and 1.16

version 1.15, 2019/01/21 10:35:09 version 1.16, 2019/01/21 10:38:54
Line 87 
Line 87 
 }  }
   
 int  int
 kex_c25519_hash(  
     int hash_alg,  
     const struct sshbuf *client_version,  
     const struct sshbuf *server_version,  
     const u_char *ckexinit, size_t ckexinitlen,  
     const u_char *skexinit, size_t skexinitlen,  
     const u_char *serverhostkeyblob, size_t sbloblen,  
     const struct sshbuf *client_pub,  
     const struct sshbuf *server_pub,  
     const struct sshbuf *shared_secret,  
     u_char *hash, size_t *hashlen)  
 {  
         struct sshbuf *b;  
         int r;  
   
         if (*hashlen < ssh_digest_bytes(hash_alg))  
                 return SSH_ERR_INVALID_ARGUMENT;  
         if ((b = sshbuf_new()) == NULL)  
                 return SSH_ERR_ALLOC_FAIL;  
         if ((r = sshbuf_put_stringb(b, client_version)) != 0 ||  
             (r = sshbuf_put_stringb(b, server_version)) != 0 ||  
             /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */  
             (r = sshbuf_put_u32(b, ckexinitlen+1)) != 0 ||  
             (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||  
             (r = sshbuf_put(b, ckexinit, ckexinitlen)) != 0 ||  
             (r = sshbuf_put_u32(b, skexinitlen+1)) != 0 ||  
             (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||  
             (r = sshbuf_put(b, skexinit, skexinitlen)) != 0 ||  
             (r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) != 0 ||  
             (r = sshbuf_put_stringb(b, client_pub)) != 0 ||  
             (r = sshbuf_put_stringb(b, server_pub)) != 0 ||  
             (r = sshbuf_putb(b, shared_secret)) != 0) {  
                 sshbuf_free(b);  
                 return r;  
         }  
 #ifdef DEBUG_KEX  
         sshbuf_dump(b, stderr);  
 #endif  
         if (ssh_digest_buffer(hash_alg, b, hash, *hashlen) != 0) {  
                 sshbuf_free(b);  
                 return SSH_ERR_LIBCRYPTO_ERROR;  
         }  
         sshbuf_free(b);  
         *hashlen = ssh_digest_bytes(hash_alg);  
 #ifdef DEBUG_KEX  
         dump_digest("hash", hash, *hashlen);  
 #endif  
         return 0;  
 }  
   
 int  
 kex_c25519_keypair(struct kex *kex)  kex_c25519_keypair(struct kex *kex)
 {  {
         struct sshbuf *buf = NULL;          struct sshbuf *buf = NULL;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16