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/modes | |
parent | 12048657a91b12e499d03ec9ff406b42aba67366 (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/modes')
-rw-r--r-- | crypto/modes/ocb128.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/modes/ocb128.c b/crypto/modes/ocb128.c index 79b786260a..ed484606e5 100644 --- a/crypto/modes/ocb128.c +++ b/crypto/modes/ocb128.c @@ -226,9 +226,7 @@ OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, block128_f encrypt, block128_f decrypt) { - /* Clear everything to NULLs */ memset(ctx, 0, sizeof(*ctx)); - ctx->l_index = 0; ctx->max_l_index = 1; ctx->l = OPENSSL_malloc(ctx->max_l_index * 16); @@ -374,8 +372,8 @@ int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, ocb_block16_xor(&ctx->offset_aad, &ctx->l_star, &ctx->offset_aad); /* CipherInput = (A_* || 1 || zeros(127-bitlen(A_*))) xor Offset_* */ - memset((void *)&tmp1, 0, 16); - memcpy((void *)&tmp1, aad + (num_blocks * 16), last_len); + memset(&tmp1, 0, 16); + memcpy(&tmp1, aad + (num_blocks * 16), last_len); ((unsigned char *)&tmp1)[last_len] = 0x80; ocb_block16_xor(&ctx->offset_aad, &tmp1, &tmp2); @@ -453,8 +451,8 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, out + (num_blocks * 16)); /* Checksum_* = Checksum_m xor (P_* || 1 || zeros(127-bitlen(P_*))) */ - memset((void *)&tmp1, 0, 16); - memcpy((void *)&tmp1, in + (len / 16) * 16, last_len); + memset(&tmp1, 0, 16); + memcpy(&tmp1, in + (len / 16) * 16, last_len); ((unsigned char *)(&tmp1))[last_len] = 0x80; ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum); } @@ -526,8 +524,8 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, out + (num_blocks * 16)); /* Checksum_* = Checksum_m xor (P_* || 1 || zeros(127-bitlen(P_*))) */ - memset((void *)&tmp1, 0, 16); - memcpy((void *)&tmp1, out + (len / 16) * 16, last_len); + memset(&tmp1, 0, 16); + memcpy(&tmp1, out + (len / 16) * 16, last_len); ((unsigned char *)(&tmp1))[last_len] = 0x80; ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum); } |