diff options
author | Geoff Thorpe <geoff@openssl.org> | 2002-12-08 16:45:26 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2002-12-08 16:45:26 +0000 |
commit | e189872486477c2bb9b041cb00f4390ef4aa911b (patch) | |
tree | d5a3ad328351adddf360315937074087669ee83d /crypto/rsa/rsa_gen.c | |
parent | fdaea9ed2e5644b98baae983ce7a55100c956999 (diff) | |
download | openssl-e189872486477c2bb9b041cb00f4390ef4aa911b.tar.gz |
Nils Larsch submitted;
- a patch to fix a memory leak in rsa_gen.c
- a note about compiler warnings with unions
- a note about improving structure element names
This applies his patch and implements a solution to the notes.
Diffstat (limited to 'crypto/rsa/rsa_gen.c')
-rw-r--r-- | crypto/rsa/rsa_gen.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c index a45b9aab5c..e3ae03e691 100644 --- a/crypto/rsa/rsa_gen.c +++ b/crypto/rsa/rsa_gen.c @@ -166,22 +166,16 @@ int RSA_generate_key_ex(RSA *rsa, int bits, unsigned long e_value, BN_GENCB *cb) goto err; } */ - rsa->d=BN_mod_inverse(NULL,rsa->e,r0,ctx2); /* d */ - if (rsa->d == NULL) goto err; + if (!BN_mod_inverse(rsa->d,rsa->e,r0,ctx2)) goto err; /* d */ /* calculate d mod (p-1) */ - rsa->dmp1=BN_new(); - if (rsa->dmp1 == NULL) goto err; if (!BN_mod(rsa->dmp1,rsa->d,r1,ctx)) goto err; /* calculate d mod (q-1) */ - rsa->dmq1=BN_new(); - if (rsa->dmq1 == NULL) goto err; if (!BN_mod(rsa->dmq1,rsa->d,r2,ctx)) goto err; /* calculate inverse of q mod p */ - rsa->iqmp=BN_mod_inverse(NULL,rsa->q,rsa->p,ctx2); - if (rsa->iqmp == NULL) goto err; + if (!BN_mod_inverse(rsa->iqmp,rsa->q,rsa->p,ctx2)) goto err; ok=1; err: |