get rid of unconditional goto in RSA1 code

Reported by <vyekkira@illinois.edu>
This commit is contained in:
Jakub Jelen 2017-06-19 18:23:59 +02:00
parent f07a0866e1
commit cdc7ba7293

View File

@ -3307,7 +3307,7 @@ diff -up openssh-7.4p1/sshkey.c.openssl openssh-7.4p1/sshkey.c
/* Check that it is a supported cipher. */
cipher = cipher_by_number(cipher_type);
@@ -3786,14 +4038,31 @@ sshkey_parse_private_rsa1(struct sshbuf
@@ -3786,15 +4038,33 @@ sshkey_parse_private_rsa1(struct sshbuf
}
/* Read the rest of the private key. */
@ -3339,11 +3339,13 @@ diff -up openssh-7.4p1/sshkey.c.openssl openssh-7.4p1/sshkey.c
/* calculate p-1 and q-1 */
- if ((r = rsa_generate_additional_parameters(prv->rsa)) != 0)
+ if ((r = rsa_generate_additional_parameters(prv->rsa, iqmp)) != 0)
+ if ((r = rsa_generate_additional_parameters(prv->rsa, iqmp)) != 0) {
+ BN_free(iqmp);
goto out;
+ }
/* enable blinding */
if (RSA_blinding_on(prv->rsa, NULL) != 1) {
@@ -3874,7 +4146,9 @@ sshkey_parse_private_pem_fileblob(struct
case EVP_R_BAD_DECRYPT:
r = SSH_ERR_KEY_WRONG_PASSPHRASE;