summaryrefslogtreecommitdiffstats
path: root/engines
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2006-01-29 23:12:22 +0000
committerNils Larsch <nils@openssl.org>2006-01-29 23:12:22 +0000
commit8c5a2bd6bb9a8c2bb3e1b63c03e57bb1115275d1 (patch)
tree6f47255125d6970ab07881a58be1e7df1e4e9490 /engines
parent25a58453ff5b73e7b4d5e2764d7924424694a82a (diff)
add additional checks + cleanup
Submitted by: David Hartman <david_hartman@symantec.com>
Diffstat (limited to 'engines')
-rw-r--r--engines/e_cswift.c11
-rw-r--r--engines/e_sureware.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/engines/e_cswift.c b/engines/e_cswift.c
index e67379e23e..bc65179846 100644
--- a/engines/e_cswift.c
+++ b/engines/e_cswift.c
@@ -744,6 +744,12 @@ static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx
int to_return = 0;
const RSA_METHOD * def_rsa_method;
+ if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp)
+ {
+ CSWIFTerr(CSWIFT_F_CSWIFT_RSA_MOD_EXP,CSWIFT_R_MISSING_KEY_COMPONENTS);
+ goto err;
+ }
+
/* Try the limits of RSA (2048 bits) */
if(BN_num_bytes(rsa->p) > 128 ||
BN_num_bytes(rsa->q) > 128 ||
@@ -764,11 +770,6 @@ static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx
return def_rsa_method->rsa_mod_exp(r0, I, rsa, ctx);
}
- if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp)
- {
- CSWIFTerr(CSWIFT_F_CSWIFT_RSA_MOD_EXP,CSWIFT_R_MISSING_KEY_COMPONENTS);
- goto err;
- }
to_return = cswift_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa->dmp1,
rsa->dmq1, rsa->iqmp, ctx);
err:
diff --git a/engines/e_sureware.c b/engines/e_sureware.c
index 424b82fd98..58fa9a98ee 100644
--- a/engines/e_sureware.c
+++ b/engines/e_sureware.c
@@ -976,11 +976,13 @@ static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA
if (!p_surewarehk_Dsa_Sign)
{
SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED);
+ goto err;
}
/* extract ref to private key */
else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
{
SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
+ goto err;
}
else
{