aboutsummaryrefslogtreecommitdiff
path: root/src/pki_crypto.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-11-26 15:42:26 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-11-30 16:24:14 +0100
commit783e5fd206df968123a541a98c11b93f1d9da291 (patch)
treefa4f1827b001cd03bb27eb36d2feef4733dd7cf2 /src/pki_crypto.c
parentc79c33e22431065e2ec2f8e5dfcbada9d849cfe8 (diff)
downloadlibssh-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_crypto.c')
-rw-r--r--src/pki_crypto.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index 8f3b21ea..366b377d 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -1601,6 +1601,14 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey,
int rc;
BIGNUM *pr = NULL, *ps = NULL;
+ 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;