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 <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
bc41cdf327
commit
d4ebc99122
@ -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 *nonce, size_t nonce_len,
|
||||||
const uint8_t *in, size_t in_len,
|
const uint8_t *in, size_t in_len,
|
||||||
const uint8_t *ad, size_t ad_len) {
|
const uint8_t *ad, size_t ad_len) {
|
||||||
size_t bulk = 0;
|
|
||||||
const struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state;
|
const struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state;
|
||||||
GCM128_CONTEXT gcm;
|
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 (gcm_ctx->ctr) {
|
||||||
if (!CRYPTO_gcm128_encrypt_ctr32(&gcm, in + bulk, out + bulk, in_len - bulk,
|
if (!CRYPTO_gcm128_encrypt_ctr32(&gcm, in, out, in_len, gcm_ctx->ctr)) {
|
||||||
gcm_ctx->ctr)) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!CRYPTO_gcm128_encrypt(&gcm, in + bulk, out + bulk, in_len - bulk)) {
|
if (!CRYPTO_gcm128_encrypt(&gcm, in, out, in_len)) {
|
||||||
return 0;
|
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 *nonce, size_t nonce_len,
|
||||||
const uint8_t *in, size_t in_len,
|
const uint8_t *in, size_t in_len,
|
||||||
const uint8_t *ad, size_t ad_len) {
|
const uint8_t *ad, size_t ad_len) {
|
||||||
size_t bulk = 0;
|
|
||||||
const struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state;
|
const struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state;
|
||||||
uint8_t tag[EVP_AEAD_AES_GCM_TAG_LEN];
|
uint8_t tag[EVP_AEAD_AES_GCM_TAG_LEN];
|
||||||
size_t plaintext_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 (gcm_ctx->ctr) {
|
||||||
if (!CRYPTO_gcm128_decrypt_ctr32(&gcm, in + bulk, out + bulk,
|
if (!CRYPTO_gcm128_decrypt_ctr32(&gcm, in, out, in_len - gcm_ctx->tag_len,
|
||||||
in_len - bulk - gcm_ctx->tag_len,
|
|
||||||
gcm_ctx->ctr)) {
|
gcm_ctx->ctr)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!CRYPTO_gcm128_decrypt(&gcm, in + bulk, out + bulk,
|
if (!CRYPTO_gcm128_decrypt(&gcm, in, out, in_len - gcm_ctx->tag_len)) {
|
||||||
in_len - bulk - gcm_ctx->tag_len)) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user