mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
server: Use really the negotiated signature type
Generally, when the extension negotiation is enabled and client supports
SHA2 algorithms for RSA, they are supposed to be prioritized against the
old SHA1. If it is not (ssh-rsa is listed in front of rsa-sha2-* hostkey
algorithms during negotiation), the server wrongly tries to provide the
new typo of signature, ignoring the negotiated algirithm
This commit propagates the digest algorithm from negotiation to the actual
signature functions, which were previously responsible for decision
about the hash algorithm based just on the negotiated extensions.
Fixes T191
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 1ebf506913)
This commit is contained in:
committed by
Andreas Schneider
parent
f0b676a9f0
commit
54cf7b92ed
@@ -264,7 +264,11 @@ SSH_PACKET_CALLBACK(ssh_packet_kexdh_init){
|
||||
return SSH_PACKET_NOT_USED;
|
||||
}
|
||||
|
||||
int ssh_get_key_params(ssh_session session, ssh_key *privkey){
|
||||
int
|
||||
ssh_get_key_params(ssh_session session,
|
||||
ssh_key *privkey,
|
||||
enum ssh_digest_e *digest)
|
||||
{
|
||||
ssh_key pubkey;
|
||||
ssh_string pubkey_blob;
|
||||
int rc;
|
||||
@@ -290,6 +294,7 @@ int ssh_get_key_params(ssh_session session, ssh_key *privkey){
|
||||
*privkey = NULL;
|
||||
}
|
||||
|
||||
*digest = session->srv.hostkey_digest;
|
||||
rc = ssh_pki_export_privkey_to_pubkey(*privkey, &pubkey);
|
||||
if (rc < 0) {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
|
||||
Reference in New Issue
Block a user