aboutsummaryrefslogtreecommitdiff
path: root/src/pki_crypto.c
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2014-02-10 13:07:23 -0800
committerAndreas Schneider <asn@cryptomilk.org>2014-03-27 10:27:23 +0100
commit10bc5ac203a428699508293f91faa460358ca6dc (patch)
tree2d633abc7433527ae7ae2c62409591b6e42d6c39 /src/pki_crypto.c
parent8ba94022824dadfec2b6650324a06106abaeac13 (diff)
downloadlibssh-10bc5ac203a428699508293f91faa460358ca6dc.tar.gz
libssh-10bc5ac203a428699508293f91faa460358ca6dc.tar.xz
libssh-10bc5ac203a428699508293f91faa460358ca6dc.zip
pki_crypto: guard against NULL pubkey->rsa in signature extraction
Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/pki_crypto.c')
-rw-r--r--src/pki_crypto.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index ccf05f43..442c1b38 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -1233,9 +1233,15 @@ static ssh_signature pki_signature_from_rsa_blob(const ssh_key pubkey,
char *blob_padded_data;
ssh_string sig_blob_padded;
+ size_t rsalen = 0;
size_t len = ssh_string_len(sig_blob);
- size_t rsalen= RSA_size(pubkey->rsa);
+ if (pubkey->rsa == NULL) {
+ ssh_pki_log("Pubkey RSA field NULL");
+ goto errout;
+ }
+
+ rsalen = RSA_size(pubkey->rsa);
if (len > rsalen) {
ssh_pki_log("Signature is too big: %lu > %lu",
(unsigned long)len, (unsigned long)rsalen);