1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-12 15:41:16 +03:00

server: reply with PK_OK with correct algorithm

RFC 4252 §7 states that the public key algorithm in a
SSH_MSG_USERAUTH_PK_OK response is the public key algorithm name from
the request.  When using RSA with SHA-2, this will be either
"rsa-sha2-256" or "rsa-sha2-512" as specified by RFC 8332 §3.2.

However, currently libssh emits the public key type instead, which is
"ssh-rsa".  This is not in conformance with the RFCs, so let's fix this
by storing the signature type and emitting it in our response instead of
the public key when sending SSH_MSG_USERAUTH_PK_OK in the server.

Signed-off-by: brian m. carlson <bk2204@github.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
brian m. carlson
2021-11-30 16:35:15 +00:00
committed by Jakub Jelen
parent 42d1efe4f9
commit c573adced4
3 changed files with 11 additions and 1 deletions

View File

@@ -1025,7 +1025,7 @@ int ssh_message_auth_reply_pk_ok_simple(ssh_message msg) {
ssh_string pubkey_blob = NULL;
int ret;
algo = ssh_string_from_char(msg->auth_request.pubkey->type_c);
algo = ssh_string_from_char(msg->auth_request.sigtype);
if (algo == NULL) {
return SSH_ERROR;
}