diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-11-26 15:42:26 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-11-30 16:24:14 +0100 |
commit | 783e5fd206df968123a541a98c11b93f1d9da291 (patch) | |
tree | fa4f1827b001cd03bb27eb36d2feef4733dd7cf2 /src/pki_gcrypt.c | |
parent | c79c33e22431065e2ec2f8e5dfcbada9d849cfe8 (diff) | |
download | libssh-783e5fd206df968123a541a98c11b93f1d9da291.tar.gz libssh-783e5fd206df968123a541a98c11b93f1d9da291.tar.xz libssh-783e5fd206df968123a541a98c11b93f1d9da291.zip |
pki: Verify the provided public key has expected type
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/pki_gcrypt.c')
-rw-r--r-- | src/pki_gcrypt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c index ff60dc67..5506edfb 100644 --- a/src/pki_gcrypt.c +++ b/src/pki_gcrypt.c @@ -1848,6 +1848,14 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, size_t rsalen; int rc; + if (type != pubkey->type) { + SSH_LOG(SSH_LOG_WARN, + "Incompatible public key provided (%d) expecting (%d)", + type, + pubkey->type); + return NULL; + } + sig = ssh_signature_new(); if (sig == NULL) { return NULL; |