Skip to content

Possible (unconsequential) source bug. #919

Closed

Description

@zocterminal

I'm currently researching ways to implement the "rsa-sha2-256" and "rsa-sha2-512" hostkey mechanism and stumbled upon an issue in the source code.

hostkey.c, line 252ff (libssh2 1.10).

static const LIBSSH2_HOSTKEY_METHOD hostkey_method_ssh_rsa = {
"ssh-rsa",
MD5_DIGEST_LENGTH,
hostkey_method_ssh_rsa_init,
hostkey_method_ssh_rsa_initPEM,
hostkey_method_ssh_rsa_initPEMFromMemory,
hostkey_method_ssh_rsa_sig_verify,
hostkey_method_ssh_rsa_signv,
NULL, /* encrypt */
hostkey_method_ssh_rsa_dtor,
};

I believe this should be SHA1_DIGEST_LENGTH because hostkey_method_ssh_rsa_sig_verify() creates a SHA1.

I did check and the hash_len field in the LIBSSH2_HOSTKEY_METHOD struct doesn't appear to be used in critical places but looking at the other hostkey methods, I believe MD5 length is wrong.

It also appears for the "ssh-dss", which I believe also computes a SHA1.

Activity

  1. vszakats commented on Apr 2, 2023

    @vszakats
    Member

    @Markus-Schmidt Nice catch! Also applies to [email protected] in 1.10.1-DEV.

  2. added 5 commits that reference this issue on Apr 2, 2023
    73027e9
    4470c17
    f570e32
    406d085
    fe7b563
  3. added a commit that references this issue on Mar 28, 2024
    ad6aae3
  4. added a commit that references this issue on Jul 14, 2024
    7b3dd18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions