From d4ebc99122d3bc822f4829a9f4ffb889966d32b9 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 30 Sep 2015 09:38:09 -1000 Subject: [PATCH] Remove always-zero |bulk| variables in crypto/cipher/e_aes.c. Change-Id: I36b2bb0e10c627ae6efa9d133df53b814922e652 Reviewed-on: https://boringssl-review.googlesource.com/6051 Reviewed-by: David Benjamin Reviewed-by: Adam Langley --- crypto/cipher/e_aes.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crypto/cipher/e_aes.c b/crypto/cipher/e_aes.c index 096f56d2..7d444626 100644 --- a/crypto/cipher/e_aes.c +++ b/crypto/cipher/e_aes.c @@ -1109,7 +1109,6 @@ static int aead_aes_gcm_seal(const EVP_AEAD_CTX *ctx, uint8_t *out, const uint8_t *nonce, size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *ad, size_t ad_len) { - size_t bulk = 0; const struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; GCM128_CONTEXT gcm; @@ -1131,12 +1130,11 @@ static int aead_aes_gcm_seal(const EVP_AEAD_CTX *ctx, uint8_t *out, } if (gcm_ctx->ctr) { - if (!CRYPTO_gcm128_encrypt_ctr32(&gcm, in + bulk, out + bulk, in_len - bulk, - gcm_ctx->ctr)) { + if (!CRYPTO_gcm128_encrypt_ctr32(&gcm, in, out, in_len, gcm_ctx->ctr)) { return 0; } } else { - if (!CRYPTO_gcm128_encrypt(&gcm, in + bulk, out + bulk, in_len - bulk)) { + if (!CRYPTO_gcm128_encrypt(&gcm, in, out, in_len)) { return 0; } } @@ -1151,7 +1149,6 @@ static int aead_aes_gcm_open(const EVP_AEAD_CTX *ctx, uint8_t *out, const uint8_t *nonce, size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *ad, size_t ad_len) { - size_t bulk = 0; const struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; uint8_t tag[EVP_AEAD_AES_GCM_TAG_LEN]; size_t plaintext_len; @@ -1177,14 +1174,12 @@ static int aead_aes_gcm_open(const EVP_AEAD_CTX *ctx, uint8_t *out, } if (gcm_ctx->ctr) { - if (!CRYPTO_gcm128_decrypt_ctr32(&gcm, in + bulk, out + bulk, - in_len - bulk - gcm_ctx->tag_len, + if (!CRYPTO_gcm128_decrypt_ctr32(&gcm, in, out, in_len - gcm_ctx->tag_len, gcm_ctx->ctr)) { return 0; } } else { - if (!CRYPTO_gcm128_decrypt(&gcm, in + bulk, out + bulk, - in_len - bulk - gcm_ctx->tag_len)) { + if (!CRYPTO_gcm128_decrypt(&gcm, in, out, in_len - gcm_ctx->tag_len)) { return 0; } }