X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/378c65045e2d11ac91dcdf16ca6a69382e9b3090..14ec1d8392d27cd5f9dc923ff7dc6416827d4060:/sshrsa.c diff --git a/sshrsa.c b/sshrsa.c index 11c488e8..3bd971f8 100644 --- a/sshrsa.c +++ b/sshrsa.c @@ -558,8 +558,6 @@ static void *rsa2_newkey(char *data, int len) struct RSAKey *rsa; rsa = snew(struct RSAKey); - if (!rsa) - return NULL; getstring(&data, &len, &p, &slen); if (!p || slen != 7 || memcmp(p, "ssh-rsa", 7)) { @@ -694,8 +692,6 @@ static void *rsa2_openssh_createkey(unsigned char **blob, int *len) struct RSAKey *rsa; rsa = snew(struct RSAKey); - if (!rsa) - return NULL; rsa->comment = NULL; rsa->modulus = getmp(b, len); @@ -711,6 +707,11 @@ static void *rsa2_openssh_createkey(unsigned char **blob, int *len) return NULL; } + if (!rsa_verify(rsa)) { + rsa2_freekey(rsa); + return NULL; + } + return rsa; }