diff options
author | Rich Salz <rsalz@akamai.com> | 2015-05-04 18:00:15 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-05 22:18:59 -0400 |
commit | 16f8d4ebf0fd4847fa83d9c61f4150273cb4f533 (patch) | |
tree | 3c30094cad38433c24008c30efe3d93cf38d8ae9 /crypto/rsa | |
parent | 12048657a91b12e499d03ec9ff406b42aba67366 (diff) | |
download | openssl-16f8d4ebf0fd4847fa83d9c61f4150273cb4f533.tar.gz |
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/rsa')
-rw-r--r-- | crypto/rsa/rsa_lib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 7d8fd39de3..f4aaa298ba 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -293,14 +293,14 @@ int RSA_memory_lock(RSA *r) RSAerr(RSA_F_RSA_MEMORY_LOCK, ERR_R_MALLOC_FAILURE); return (0); } - memset(p, 0, (off + j) * sizeof(BN_ULONG)); + memset(p, 0, sizeof(*p) * (off + j)); bn = (BIGNUM *)p; ul = (BN_ULONG *)&(p[off]); for (i = 0; i < 6; i++) { b = *(t[i]); *(t[i]) = bn_array_el(bn, i); - memcpy((char *)bn_array_el(bn, i), (char *)b, bn_sizeof_BIGNUM()); - memcpy((char *)ul, bn_get_words(b), sizeof(BN_ULONG) * bn_get_top(b)); + memcpy(bn_array_el(bn, i), b, bn_sizeof_BIGNUM()); + memcpy(ul, bn_get_words(b), sizeof(*ul) * bn_get_top(b)); bn_set_static_words(bn_array_el(bn, i), ul, bn_get_top(b)); ul += bn_get_top(b); BN_clear_free(b); |