mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +09:00
session: Reformat ssh_get_publickey_hash
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
a85813e6e6
commit
6fc1bf6901
@@ -1238,8 +1238,7 @@ int ssh_get_publickey_hash(const ssh_key key,
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SSH_PUBLICKEY_HASH_SHA1:
|
||||
{
|
||||
case SSH_PUBLICKEY_HASH_SHA1: {
|
||||
SHACTX ctx;
|
||||
|
||||
h = calloc(1, SHA_DIGEST_LEN);
|
||||
@@ -1268,10 +1267,9 @@ int ssh_get_publickey_hash(const ssh_key key,
|
||||
}
|
||||
|
||||
*hlen = SHA_DIGEST_LEN;
|
||||
}
|
||||
break;
|
||||
case SSH_PUBLICKEY_HASH_SHA256:
|
||||
{
|
||||
}
|
||||
case SSH_PUBLICKEY_HASH_SHA256: {
|
||||
SHA256CTX ctx;
|
||||
|
||||
h = calloc(1, SHA256_DIGEST_LEN);
|
||||
@@ -1300,15 +1298,15 @@ int ssh_get_publickey_hash(const ssh_key key,
|
||||
}
|
||||
|
||||
*hlen = SHA256_DIGEST_LEN;
|
||||
}
|
||||
break;
|
||||
case SSH_PUBLICKEY_HASH_MD5:
|
||||
{
|
||||
}
|
||||
case SSH_PUBLICKEY_HASH_MD5: {
|
||||
MD5CTX ctx;
|
||||
|
||||
/* In FIPS mode, we cannot use MD5 */
|
||||
if (ssh_fips_mode()) {
|
||||
SSH_LOG(SSH_LOG_TRACE, "In FIPS mode MD5 is not allowed."
|
||||
SSH_LOG(SSH_LOG_TRACE,
|
||||
"In FIPS mode MD5 is not allowed."
|
||||
"Try using SSH_PUBLICKEY_HASH_SHA256");
|
||||
rc = SSH_ERROR;
|
||||
goto out;
|
||||
@@ -1340,8 +1338,8 @@ int ssh_get_publickey_hash(const ssh_key key,
|
||||
}
|
||||
|
||||
*hlen = MD5_DIGEST_LEN;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
rc = -1;
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user