1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-10-29 00:54:50 +03:00

hostkey: fix hash_len field constants

Replace incorrect `MD5_DIGEST_LENGTH` with `SHA_DIGEST_LENGTH` for these
hostkey algos:

- `ssh-rsa` and `ssh-dss`

  Ref: 7a5ffc8cee (2004-12-07 Initial)

- `ssh-rsa-cert-v01@openssh.com`

  Ref: 4b21e49d9d (2022-07-28)
  Ref: #710

Also delete local fall-back definition of `MD5_DIGEST_LENGTH` (added
in 9af7eb48dc). Macro is no longer used.

Reported-by: Markus-Schmidt on github
Fixes #919
Closes #926
This commit is contained in:
Viktor Szakats
2023-04-03 12:09:48 +00:00
parent 2e3e0be816
commit ad6aae302a

View File

@@ -413,13 +413,9 @@ hostkey_method_ssh_rsa_dtor(LIBSSH2_SESSION * session, void **abstract)
return 0;
}
#ifdef OPENSSL_NO_MD5
#define MD5_DIGEST_LENGTH 16
#endif
static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_rsa = {
"ssh-rsa",
MD5_DIGEST_LENGTH,
SHA_DIGEST_LENGTH,
hostkey_method_ssh_rsa_init,
hostkey_method_ssh_rsa_initPEM,
hostkey_method_ssh_rsa_initPEMFromMemory,
@@ -459,7 +455,7 @@ static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_rsa_sha2_512 = {
static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_rsa_cert = {
"ssh-rsa-cert-v01@openssh.com",
MD5_DIGEST_LENGTH,
SHA_DIGEST_LENGTH,
NULL,
hostkey_method_ssh_rsa_initPEM,
hostkey_method_ssh_rsa_initPEMFromMemory,
@@ -688,7 +684,7 @@ hostkey_method_ssh_dss_dtor(LIBSSH2_SESSION * session, void **abstract)
static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_dss = {
"ssh-dss",
MD5_DIGEST_LENGTH,
SHA_DIGEST_LENGTH,
hostkey_method_ssh_dss_init,
hostkey_method_ssh_dss_initPEM,
hostkey_method_ssh_dss_initPEMFromMemory,