From d53e13de8e7304af34ecabc160c452d5fdb5916a Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 28 Mar 2022 15:22:00 +0200 Subject: crypto-native: avoid overflow load on data Type: improvement Change-Id: I5317afa02fa1525a7d8df595b56eb6546ccded57 Signed-off-by: Damjan Marion --- src/plugins/crypto_native/aes.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/crypto_native') diff --git a/src/plugins/crypto_native/aes.h b/src/plugins/crypto_native/aes.h index e7f840975d4..e0d832276e0 100644 --- a/src/plugins/crypto_native/aes.h +++ b/src/plugins/crypto_native/aes.h @@ -119,7 +119,10 @@ aes_load_partial (u8x16u * p, int n_bytes) __m128i zero = { }; return (u8x16) _mm_mask_loadu_epi8 (zero, (1 << n_bytes) - 1, p); #else - return aes_byte_mask (CLIB_MEM_OVERFLOW_LOAD (p), n_bytes); + u8x16 v = {}; + CLIB_ASSUME (n_bytes < 16); + clib_memcpy_fast (&v, p, n_bytes); + return v; #endif } -- cgit 1.2.3-korg