diff options
author | beck <> | 2001-06-22 00:03:44 +0000 |
---|---|---|
committer | beck <> | 2001-06-22 00:03:44 +0000 |
commit | 38b6ff9e5294811c57541ad47940f8f8f41dc114 (patch) | |
tree | 402699541cee3cf3f2943b0384dbda7de534de70 /src/lib/libcrypto/rsa/rsa_lib.c | |
parent | afae624d63e4e717c5bae8c7842a4712309f728f (diff) | |
download | openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.gz openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.bz2 openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.zip |
openssl-engine-0.9.6a merge
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 5e1e8fcdf3..94395cc22c 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
@@ -191,13 +191,13 @@ RSA *RSA_new_method(ENGINE *engine) | |||
191 | ret->blinding=NULL; | 191 | ret->blinding=NULL; |
192 | ret->bignum_data=NULL; | 192 | ret->bignum_data=NULL; |
193 | ret->flags=meth->flags; | 193 | ret->flags=meth->flags; |
194 | CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data); | ||
194 | if ((meth->init != NULL) && !meth->init(ret)) | 195 | if ((meth->init != NULL) && !meth->init(ret)) |
195 | { | 196 | { |
197 | CRYPTO_free_ex_data(rsa_meth,ret,&ret->ex_data); | ||
196 | OPENSSL_free(ret); | 198 | OPENSSL_free(ret); |
197 | ret=NULL; | 199 | ret=NULL; |
198 | } | 200 | } |
199 | else | ||
200 | CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data); | ||
201 | return(ret); | 201 | return(ret); |
202 | } | 202 | } |
203 | 203 | ||
@@ -221,13 +221,13 @@ void RSA_free(RSA *r) | |||
221 | } | 221 | } |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); | ||
225 | |||
226 | meth = ENGINE_get_RSA(r->engine); | 224 | meth = ENGINE_get_RSA(r->engine); |
227 | if (meth->finish != NULL) | 225 | if (meth->finish != NULL) |
228 | meth->finish(r); | 226 | meth->finish(r); |
229 | ENGINE_finish(r->engine); | 227 | ENGINE_finish(r->engine); |
230 | 228 | ||
229 | CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data); | ||
230 | |||
231 | if (r->n != NULL) BN_clear_free(r->n); | 231 | if (r->n != NULL) BN_clear_free(r->n); |
232 | if (r->e != NULL) BN_clear_free(r->e); | 232 | if (r->e != NULL) BN_clear_free(r->e); |
233 | if (r->d != NULL) BN_clear_free(r->d); | 233 | if (r->d != NULL) BN_clear_free(r->d); |
@@ -325,7 +325,7 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx) | |||
325 | 325 | ||
326 | BN_CTX_start(ctx); | 326 | BN_CTX_start(ctx); |
327 | A = BN_CTX_get(ctx); | 327 | A = BN_CTX_get(ctx); |
328 | if (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err; | 328 | if (!BN_rand_range(A,rsa->n)) goto err; |
329 | if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err; | 329 | if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err; |
330 | 330 | ||
331 | if (!ENGINE_get_RSA(rsa->engine)->bn_mod_exp(A,A, | 331 | if (!ENGINE_get_RSA(rsa->engine)->bn_mod_exp(A,A, |