aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-11-21 08:27:46 -0500
committerRich Salz <rsalz@openssl.org>2015-11-30 16:10:12 -0500
commitd59c7c81e3850dc667d61047850c3b6936eb5fca (patch)
treec658a298cab7e2dce4d6c8d24c38fabc60ad8010 /crypto
parent30c7fea496083d41b809db0041e6dfd3ea9cb858 (diff)
downloadopenssl-d59c7c81e3850dc667d61047850c3b6936eb5fca.tar.gz
Remove BN_init
Rename it to be an internal function bn_init. Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bn/bn_ctx.c2
-rw-r--r--crypto/bn/bn_gcd.c4
-rw-r--r--crypto/bn/bn_lcl.h2
-rw-r--r--crypto/bn/bn_lib.c6
-rw-r--r--crypto/bn/bn_mont.c8
-rw-r--r--crypto/bn/bn_recp.c4
6 files changed, 14 insertions, 12 deletions
diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c
index 19ff68e1eb..be7a20d634 100644
--- a/crypto/bn/bn_ctx.c
+++ b/crypto/bn/bn_ctx.c
@@ -365,7 +365,7 @@ static BIGNUM *BN_POOL_get(BN_POOL *p, int flag)
if (item == NULL)
return NULL;
for (loop = 0, bn = item->vals; loop++ < BN_CTX_POOL_SIZE; bn++) {
- BN_init(bn);
+ bn_init(bn);
if ((flag & BN_FLG_SECURE) != 0)
BN_set_flags(bn, BN_FLG_SECURE);
}
diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c
index d24360615f..84d1df5743 100644
--- a/crypto/bn/bn_gcd.c
+++ b/crypto/bn/bn_gcd.c
@@ -598,7 +598,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
*/
{
BIGNUM local_B;
- BN_init(&local_B);
+ bn_init(&local_B);
BN_with_flags(&local_B, B, BN_FLG_CONSTTIME);
if (!BN_nnmod(B, &local_B, A, ctx))
goto err;
@@ -629,7 +629,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
*/
{
BIGNUM local_A;
- BN_init(&local_A);
+ bn_init(&local_A);
BN_with_flags(&local_A, A, BN_FLG_CONSTTIME);
/* (D, M) := (A/B, A%B) ... */
diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
index 1a75c10c8d..e4281a34b4 100644
--- a/crypto/bn/bn_lcl.h
+++ b/crypto/bn/bn_lcl.h
@@ -638,10 +638,10 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
}
# endif /* !BN_LLONG */
-void BN_init(BIGNUM *a);
void BN_RECP_CTX_init(BN_RECP_CTX *recp);
void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
+void bn_init(BIGNUM *a);
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb);
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index 4a6480ba97..b9e96b553e 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -265,9 +265,11 @@ void BN_free(BIGNUM *a)
}
}
-void BN_init(BIGNUM *a)
+void bn_init(BIGNUM *a)
{
- memset(a, 0, sizeof(*a));
+ static BIGNUM nilbn;
+
+ *a = nilbn;
bn_check_top(a);
}
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index bda2157aa5..90c718ba59 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -327,9 +327,9 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
{
ctx->ri = 0;
- BN_init(&(ctx->RR));
- BN_init(&(ctx->N));
- BN_init(&(ctx->Ni));
+ bn_init(&(ctx->RR));
+ bn_init(&(ctx->N));
+ bn_init(&(ctx->Ni));
ctx->n0[0] = ctx->n0[1] = 0;
ctx->flags = 0;
}
@@ -367,7 +367,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
BIGNUM tmod;
BN_ULONG buf[2];
- BN_init(&tmod);
+ bn_init(&tmod);
tmod.d = buf;
tmod.dmax = 2;
tmod.neg = 0;
diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c
index 39eed8b297..ef23a8c751 100644
--- a/crypto/bn/bn_recp.c
+++ b/crypto/bn/bn_recp.c
@@ -61,8 +61,8 @@
void BN_RECP_CTX_init(BN_RECP_CTX *recp)
{
- BN_init(&(recp->N));
- BN_init(&(recp->Nr));
+ bn_init(&(recp->N));
+ bn_init(&(recp->Nr));
recp->num_bits = 0;
recp->flags = 0;
}