aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2025-04-11 17:38:15 +0200
committerDaniel Schadt <kingdread@gmx.de>2025-04-11 17:38:15 +0200
commit5c192adf8a500c53c2c7f5be7de9d6f697e43096 (patch)
tree6aaa936629e76f912b7d92d1a57fc0c2de2af851 /src
parentcd23c0d871f564e0a1da689c220fe542e8075af0 (diff)
downloadzears-5c192adf8a500c53c2c7f5be7de9d6f697e43096.tar.gz
zears-5c192adf8a500c53c2c7f5be7de9d6f697e43096.tar.bz2
zears-5c192adf8a500c53c2c7f5be7de9d6f697e43096.zip
add comment about AES NI instructions
Diffstat (limited to 'src')
-rw-r--r--src/aesround.rs7
1 files changed, 7 insertions, 0 deletions
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::*;