Skip to content
This repository was archived by the owner on Dec 27, 2019. It is now read-only.

Commit 1965db8

Browse files
committed
chacha20-x86_64: more limited cascade
1 parent 8639eca commit 1965db8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/crypto/zinc/chacha20/chacha20-x86_64-glue.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,21 @@ static inline bool chacha20_arch(u8 *dst, const u8 *src, const size_t len,
6060
const u32 key[8], const u32 counter[4],
6161
simd_context_t *simd_context)
6262
{
63-
if ((len < CHACHA20_BLOCK_SIZE && !(*simd_context && HAVE_SIMD_IN_USE)) ||
64-
!simd_use(simd_context))
63+
if (len <= CHACHA20_BLOCK_SIZE || !simd_use(simd_context))
6564
return false;
6665

6766
#ifdef CONFIG_AS_AVX512
68-
if (chacha20_use_avx512 && len >= CHACHA20_BLOCK_SIZE * 16) {
67+
if (chacha20_use_avx512) {
6968
chacha20_avx512(dst, src, len, key, counter);
7069
return true;
7170
}
72-
if (chacha20_use_avx512vl && len >= CHACHA20_BLOCK_SIZE * 16) {
71+
if (chacha20_use_avx512vl) {
7372
chacha20_avx512vl(dst, src, len, key, counter);
7473
return true;
7574
}
7675
#endif
7776
#ifdef CONFIG_AS_AVX2
78-
if (chacha20_use_avx2 && len >= CHACHA20_BLOCK_SIZE * 8) {
77+
if (chacha20_use_avx2) {
7978
chacha20_avx2(dst, src, len, key, counter);
8079
return true;
8180
}

0 commit comments

Comments
 (0)