From 5c192adf8a500c53c2c7f5be7de9d6f697e43096 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 11 Apr 2025 17:38:15 +0200 Subject: add comment about AES NI instructions --- src/aesround.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/aesround.rs') diff --git a/src/aesround.rs b/src/aesround.rs index d04ac9b..169c125 100644 --- a/src/aesround.rs +++ b/src/aesround.rs @@ -57,6 +57,13 @@ impl AesRound for AesSoft { } } +// It feels silly re-implementing the native AES instruction (especially since aes does use it +// under the hood), but there is a big benefit here: +// First, we can save time by only loading the keys once as a __m128i, which makes the whole thing +// a bit faster. +// More importantly though, when using target-cpu=native, we get nicely vectorized AES instructions +// (VAESENC), which we don't get if we go through aes::hazmat::cipher_round. This is a *huge* +// speedup, which we don't want to miss. #[cfg(target_arch = "x86_64")] pub mod x86_64 { use super::*; -- cgit v1.2.3