summaryrefslogtreecommitdiff
path: root/chacha_avx.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-11-10 11:39:30 -0500
committerJeffrey Walton <noloader@gmail.com>2018-11-10 11:39:30 -0500
commit06e1d0c0d9473a20aa64f4e65e1ab6437e7935aa (patch)
treef187b0b60e7a87eaf5ae81c1e4802c62ab948377 /chacha_avx.cpp
parentcc7d5c156185be82dd543181d4306734aa405885 (diff)
downloadcryptopp-git-06e1d0c0d9473a20aa64f4e65e1ab6437e7935aa.tar.gz
Add call to _mm256_zeroupper to avoid state penalties
Also see https://stackoverflow.com/a/7841251/608639
Diffstat (limited to 'chacha_avx.cpp')
-rw-r--r--chacha_avx.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/chacha_avx.cpp b/chacha_avx.cpp
index fd9d42e5..853d2854 100644
--- a/chacha_avx.cpp
+++ b/chacha_avx.cpp
@@ -371,6 +371,9 @@ void ChaCha_OperateKeystream_AVX2(const word32 *state, const byte* input, byte *
_mm256_storeu_si256(output_mm + 14, _mm256_permute2x128_si256(X3_0, X3_1, 0 + (2 << 4)));
_mm256_storeu_si256(output_mm + 15, _mm256_permute2x128_si256(X3_2, X3_3, 0 + (2 << 4)));
}
+
+ // https://stackoverflow.com/a/7841251/608639
+ _mm256_zeroupper();
}
#endif // CRYPTOPP_AVX2_AVAILABLE