summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_lib.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-04 18:00:15 -0400
committerRich Salz <rsalz@openssl.org>2015-05-05 22:18:59 -0400
commit16f8d4ebf0fd4847fa83d9c61f4150273cb4f533 (patch)
tree3c30094cad38433c24008c30efe3d93cf38d8ae9 /crypto/bn/bn_lib.c
parent12048657a91b12e499d03ec9ff406b42aba67366 (diff)
memset, memcpy, sizeof consistency fixes
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr) for memset and memcpy. Remove needless casts for those functions. For memset, replace alternative forms of zero with 0. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bn/bn_lib.c')
-rw-r--r--crypto/bn/bn_lib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index 6fc0e396bf..fec70a5ccc 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -260,7 +260,7 @@ void BN_free(BIGNUM *a)
void BN_init(BIGNUM *a)
{
- memset(a, 0, sizeof(BIGNUM));
+ memset(a, 0, sizeof(*a));
bn_check_top(a);
}
@@ -311,7 +311,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
* function - what's important is constant time operation (we're not
* actually going to use the data)
*/
- memset(a, 0, sizeof(BN_ULONG) * words);
+ memset(a, 0, sizeof(*a) * words);
#endif
#if 1
@@ -355,7 +355,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
}
}
#else
- memset(A, 0, sizeof(BN_ULONG) * words);
+ memset(A, 0, sizeof(*A) * words);
memcpy(A, b->d, sizeof(b->d[0]) * b->top);
#endif
@@ -492,7 +492,7 @@ void BN_clear(BIGNUM *a)
{
bn_check_top(a);
if (a->d != NULL)
- memset(a->d, 0, a->dmax * sizeof(a->d[0]));
+ memset(a->d, 0, sizeof(*a->d) * a->dmax);
a->top = 0;
a->neg = 0;
}