mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03:00
pki: Sanitize input to verification
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
c7628fbfea
commit
b72c9eead6
@@ -1797,7 +1797,15 @@ int pki_signature_verify(ssh_session session,
|
|||||||
int rc;
|
int rc;
|
||||||
int nid;
|
int nid;
|
||||||
|
|
||||||
switch(key->type) {
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (key->type) {
|
||||||
case SSH_KEYTYPE_DSS:
|
case SSH_KEYTYPE_DSS:
|
||||||
rc = DSA_do_verify(hash,
|
rc = DSA_do_verify(hash,
|
||||||
hlen,
|
hlen,
|
||||||
|
|||||||
@@ -2034,6 +2034,14 @@ int pki_signature_verify(ssh_session session,
|
|||||||
gcry_sexp_t sexp;
|
gcry_sexp_t sexp;
|
||||||
gcry_error_t err;
|
gcry_error_t err;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
switch(key->type) {
|
switch(key->type) {
|
||||||
case SSH_KEYTYPE_DSS:
|
case SSH_KEYTYPE_DSS:
|
||||||
/* That is to mark the number as positive */
|
/* That is to mark the number as positive */
|
||||||
|
|||||||
@@ -1008,6 +1008,14 @@ int pki_signature_verify(ssh_session session, const ssh_signature sig, const
|
|||||||
int rc;
|
int rc;
|
||||||
mbedtls_md_type_t md = 0;
|
mbedtls_md_type_t md = 0;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
switch (key->type) {
|
switch (key->type) {
|
||||||
case SSH_KEYTYPE_RSA:
|
case SSH_KEYTYPE_RSA:
|
||||||
switch (sig->hash_type) {
|
switch (sig->hash_type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user