pki: Refactor ssh_pki_do_sign()

Added ECDSA key types to ssh_key_type_to_hash(). Refactor
ssh_pki_do_sign() without behaviour changes.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Anderson Toshiyuki Sasaki
2019-04-09 19:00:05 +02:00
committed by Andreas Schneider
parent 5f7a3c5c66
commit 3917a5c916
4 changed files with 76 additions and 100 deletions

View File

@@ -1941,12 +1941,6 @@ ssh_signature pki_do_sign_hash(const ssh_key privkey,
ssh_signature sig;
int rc;
/* Only RSA supports different signature algorithm types now */
if (privkey->type != SSH_KEYTYPE_RSA && hash_type != SSH_DIGEST_AUTO) {
SSH_LOG(SSH_LOG_WARN, "Incompatible signature algorithm passed");
return NULL;
}
sig = ssh_signature_new();
if (sig == NULL) {
return NULL;