Subject: sha1 hash is incorrect

sha1 hash is incorrect

From: evgeniy v <y.vishniavetsk_at_gmail.com>
Date: Sun, 13 Jun 2010 22:23:42 +0300

Hello

The problem is the remote host signature failed.
I debugged libssh and openssl libraries and the result is the following:

libssh2_session_startup -> [kex.c] exchange_keys() -> diffie_hellman_sha1()
-> [kex.c] sig_verify() ->
[hostkey.c] hostkey_method_ssh_rsa_sig_verify() ->[openssl.c]
_libssh2_rsa_sha1_verify():

Inside _libssh2_rsa_sha1_verify() we call libssh2_sha1() to get sha1 hash.

After this we call RSA_verify() -> [rsa_sign.c] -> int_rsa_verify()

Inside int_rsa_verify() our hash doesn't match sig->digest->data value.
(bottom of the function)

==============================================
else if (((unsigned int)sig->digest->length != m_len) ||
            (memcmp(m,sig->digest->data,m_len) != 0)) <<<<< hash doesn't
match
            {
            RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE);
            }
        else
            ret=1;
=============================================

Key-exchange method is diffie-hellman-group1-sha1.
Remote host ssh server is SSH-1.99-FreSSH.08.

The question is: how it can be that hash is incorrect if I was able to
connect to this host using other ssh clients.
I used libssh2.1.2.6.

I need help!!! This block development of the tool.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-06-13