summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2019-06-14 16:29:31 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-24 18:30:56 +0000
commitddd1266082c7fc4a4002da1383c7052629e2c8f4 (patch)
treee6cfe5715c10f99cc3e64e3664a8fe0a98850cd5
parent1722849223efae4aaf87d2476a7ad07d2c7bd8c5 (diff)
downloadchrome-ec-ddd1266082c7fc4a4002da1383c7052629e2c8f4.tar.gz
aes-gcm: Fix unused error for kSizeTWithoutLower4Bits
This fixes the following compiler error when CORE_CORTEX_M is not set. common/aes-gcm.c:101:21: error: unused variable 'kSizeTWithoutLower4Bits' [-Werror,-Wunused-const-variable] static const size_t kSizeTWithoutLower4Bits = (size_t) -16; This occurs when compiling the host-based unit and fuzzer tests. The trace for this goes as follows: Setting CORE_CORTEX_M sets GHASH_ASM, which later on sets GHASH. Certain sections of code that use this static const are disabled if GHASH is not set. Thus, no uses of this static const. This issue arose when attempting to add the fpsensor task to host_command_fuzz, but is actually present(and unreported) in the fpsensor unit test. The presence of this unreported issue in the host-fpsensor build target was discovered by manually invoking cpp for aes-gcm.c and checking that the static const existed, but was not references. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I2ef5d73e11ced421d888221ef3c672e42bba53a3 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1661121 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--third_party/boringssl/common/aes-gcm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/third_party/boringssl/common/aes-gcm.c b/third_party/boringssl/common/aes-gcm.c
index 5647a22995..edb98b88b3 100644
--- a/third_party/boringssl/common/aes-gcm.c
+++ b/third_party/boringssl/common/aes-gcm.c
@@ -95,10 +95,6 @@ static inline void store_word_le(void *out, size_t v) {
} \
} while (0)
-// kSizeTWithoutLower4Bits is a mask that can be used to zero the lower four
-// bits of a |size_t|.
-static const size_t kSizeTWithoutLower4Bits = (size_t) -16;
-
static void gcm_init_4bit(u128 Htable[16], uint64_t H[2]) {
u128 V;
@@ -376,6 +372,12 @@ void gcm_ghash_p8(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
#endif
#endif
+#ifdef GHASH
+// kSizeTWithoutLower4Bits is a mask that can be used to zero the lower four
+// bits of a |size_t|.
+static const size_t kSizeTWithoutLower4Bits = (size_t) -16;
+#endif
+
static void CRYPTO_ghash_init(gmult_func *out_mult, ghash_func *out_hash,
u128 *out_key, u128 out_table[16],
const uint8_t *gcm_key) {