X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fengine%2Fhw_atalla.c;h=84105516eeb3b96135bd8ad3fecf8353aa46173e;hp=c1640ca00035260f4db3eb7e654b93d26c2aa80c;hb=c62b26fdc6bb176541ec56498090ff6f2ad4a885;hpb=f971ccb2646828aee104c5be5deab9991f0a4d2b diff --git a/crypto/engine/hw_atalla.c b/crypto/engine/hw_atalla.c index c1640ca000..84105516ee 100644 --- a/crypto/engine/hw_atalla.c +++ b/crypto/engine/hw_atalla.c @@ -63,8 +63,8 @@ #include "engine_int.h" #include -#ifndef NO_HW -#ifndef NO_HW_ATALLA +#ifndef OPENSSL_NO_HW +#ifndef OPENSSL_NO_HW_ATALLA #ifdef FLAT_INC #include "atalla.h" @@ -216,7 +216,7 @@ static tfnASI_RSAPrivateKeyOpFn *p_Atalla_RSAPrivateKeyOpFn = NULL; static tfnASI_GetPerformanceStatistics *p_Atalla_GetPerformanceStatistics = NULL; /* (de)initialisation functions. */ -static int atalla_init() +static int atalla_init(void) { tfnASI_GetHardwareConfig *p1; tfnASI_RSAPrivateKeyOpFn *p2; @@ -275,7 +275,7 @@ err: return 0; } -static int atalla_finish() +static int atalla_finish(void) { if(atalla_dso == NULL) { @@ -318,11 +318,12 @@ static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, goto err; } /* Prepare the params */ + BN_CTX_start(ctx); modulus = BN_CTX_get(ctx); exponent = BN_CTX_get(ctx); argument = BN_CTX_get(ctx); result = BN_CTX_get(ctx); - if(!modulus || !exponent || !argument || !result) + if (!result) { ENGINEerr(ENGINE_F_ATALLA_MOD_EXP,ENGINE_R_BN_CTX_FULL); goto err; @@ -360,10 +361,7 @@ static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_bin2bn((unsigned char *)result->d, numbytes, r); to_return = 1; err: - if(modulus) ctx->tos--; - if(exponent) ctx->tos--; - if(argument) ctx->tos--; - if(result) ctx->tos--; + BN_CTX_end(ctx); return to_return; } @@ -441,5 +439,5 @@ static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r, return atalla_mod_exp(r, a, p, m, ctx); } -#endif /* !NO_HW_ATALLA */ -#endif /* !NO_HW */ +#endif /* !OPENSSL_NO_HW_ATALLA */ +#endif /* !OPENSSL_NO_HW */