summaryrefslogtreecommitdiffstats
path: root/src/plugins/crypto_ia32/aes_gcm.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-04-15 15:28:21 +0200
committerDamjan Marion <dmarion@me.com>2019-11-27 10:50:28 +0000
commit9fb6d40eb3d4a2da8f45187de773498b784596e6 (patch)
treee785ebfbe73b847146debb2dae4a4304c51aa9cf /src/plugins/crypto_ia32/aes_gcm.c
parent99fbf0574f099f09b7b46dcabe5bb50d78091dce (diff)
misc: add address sanitizer heap instrumentation
Introduce AddressSanitizer support: https://github.com/google/sanitizers/ This starts with heap instrumentation. vlib_buffer, bihash and stack instrumentation should follow. Type: feature Change-Id: I7f20e235b2f79db72efd0e756f22c75f717a9884 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/crypto_ia32/aes_gcm.c')
-rw-r--r--src/plugins/crypto_ia32/aes_gcm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/crypto_ia32/aes_gcm.c b/src/plugins/crypto_ia32/aes_gcm.c
index c48ee8847b1..a21ecf3e6df 100644
--- a/src/plugins/crypto_ia32/aes_gcm.c
+++ b/src/plugins/crypto_ia32/aes_gcm.c
@@ -63,10 +63,12 @@ aesni_gcm_byte_mask (__m128i x, u8 n_bytes)
static_always_inline __m128i
aesni_gcm_load_partial (__m128i * p, int n_bytes)
{
+ ASSERT (n_bytes <= 16);
#ifdef __AVX512F__
return _mm_mask_loadu_epi8 (zero, (1 << n_bytes) - 1, p);
#else
- return aesni_gcm_byte_mask (_mm_loadu_si128 (p), n_bytes);
+ return aesni_gcm_byte_mask (CLIB_MEM_OVERFLOW_LOAD (_mm_loadu_si128, p),
+ n_bytes);
#endif
}
@@ -591,7 +593,7 @@ aes_gcm (const u8 * in, u8 * out, const u8 * addt, const u8 * iv, u8 * tag,
T = aesni_gcm_ghash (T, kd, (__m128i *) addt, aad_bytes);
/* initalize counter */
- Y0 = _mm_loadu_si128 ((__m128i *) iv);
+ Y0 = CLIB_MEM_OVERFLOW_LOAD (_mm_loadu_si128, (__m128i *) iv);
Y0 = _mm_insert_epi32 (Y0, clib_host_to_net_u32 (1), 3);
/* ghash and encrypt/edcrypt */