mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
kex: do not ignore failure of libssh2_md5_init()
The MD5 algorithm is disabled when running in FIPS mode.
This commit is contained in:
13
src/kex.c
13
src/kex.c
@@ -218,10 +218,15 @@ static int diffie_hellman_sha1(LIBSSH2_SESSION *session,
|
||||
{
|
||||
libssh2_md5_ctx fingerprint_ctx;
|
||||
|
||||
libssh2_md5_init(&fingerprint_ctx);
|
||||
libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
|
||||
session->server_hostkey_len);
|
||||
libssh2_md5_final(fingerprint_ctx, session->server_hostkey_md5);
|
||||
if (libssh2_md5_init(&fingerprint_ctx)) {
|
||||
libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
|
||||
session->server_hostkey_len);
|
||||
libssh2_md5_final(fingerprint_ctx, session->server_hostkey_md5);
|
||||
session->server_hostkey_md5_valid = TRUE;
|
||||
}
|
||||
else {
|
||||
session->server_hostkey_md5_valid = FALSE;
|
||||
}
|
||||
}
|
||||
#ifdef LIBSSH2DEBUG
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user