aboutsummaryrefslogtreecommitdiff
path: root/src/pki.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-11-26 15:27:53 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-11-30 16:22:51 +0100
commitc79c33e22431065e2ec2f8e5dfcbada9d849cfe8 (patch)
tree7c9ade29caf41b8d7ba7f6414498eb82c6f000c5 /src/pki.c
parent968fdf4e188b57b6b9c2d49cae6a1617070374cc (diff)
downloadlibssh-c79c33e22431065e2ec2f8e5dfcbada9d849cfe8.tar.gz
libssh-c79c33e22431065e2ec2f8e5dfcbada9d849cfe8.tar.xz
libssh-c79c33e22431065e2ec2f8e5dfcbada9d849cfe8.zip
pki: Sanity-check signature matches base key type
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/pki.c')
-rw-r--r--src/pki.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index 0080b539..a581b72e 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -1931,6 +1931,12 @@ int ssh_pki_signature_verify(ssh_session session,
"Going to verify a %s type signature",
sig->type_c);
+ if (key->type != sig->type) {
+ SSH_LOG(SSH_LOG_WARN,
+ "Can not verify %s signature with %s key",
+ sig->type_c, key->type_c);
+ return SSH_ERROR;
+ }
if (key->type == SSH_KEYTYPE_ECDSA) {
#if HAVE_ECC