Skip to content

Commit

Permalink
crypto: arch/nhpoly1305 - process in explicit 4k chunks
Browse files Browse the repository at this point in the history
Rather than chunking via PAGE_SIZE, this commit changes the arch
implementations to chunk in explicit 4k parts, so that calculations on
maximum acceptable latency don't suddenly become invalid on platforms
where PAGE_SIZE isn't 4k, such as arm64.

Fixes: 0f961f9 ("crypto: x86/nhpoly1305 - add AVX2 accelerated NHPoly1305")
Fixes: 012c823 ("crypto: x86/nhpoly1305 - add SSE2 accelerated NHPoly1305")
Fixes: a00fa0c ("crypto: arm64/nhpoly1305 - add NEON-accelerated NHPoly1305")
Fixes: 16aae35 ("crypto: arm/nhpoly1305 - add NEON-accelerated NHPoly1305")
Cc: stable@vger.kernel.org
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Jason A. Donenfeld authored and Herbert Xu committed Apr 30, 2020
1 parent 706024a commit a9a8ba9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/arm/crypto/nhpoly1305-neon-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int nhpoly1305_neon_update(struct shash_desc *desc,
return crypto_nhpoly1305_update(desc, src, srclen);

do {
unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
unsigned int n = min_t(unsigned int, srclen, SZ_4K);

kernel_neon_begin();
crypto_nhpoly1305_update_helper(desc, src, n, _nh_neon);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/nhpoly1305-neon-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int nhpoly1305_neon_update(struct shash_desc *desc,
return crypto_nhpoly1305_update(desc, src, srclen);

do {
unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
unsigned int n = min_t(unsigned int, srclen, SZ_4K);

kernel_neon_begin();
crypto_nhpoly1305_update_helper(desc, src, n, _nh_neon);
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/crypto/nhpoly1305-avx2-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static int nhpoly1305_avx2_update(struct shash_desc *desc,
return crypto_nhpoly1305_update(desc, src, srclen);

do {
unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
unsigned int n = min_t(unsigned int, srclen, SZ_4K);

kernel_fpu_begin();
crypto_nhpoly1305_update_helper(desc, src, n, _nh_avx2);
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/crypto/nhpoly1305-sse2-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static int nhpoly1305_sse2_update(struct shash_desc *desc,
return crypto_nhpoly1305_update(desc, src, srclen);

do {
unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
unsigned int n = min_t(unsigned int, srclen, SZ_4K);

kernel_fpu_begin();
crypto_nhpoly1305_update_helper(desc, src, n, _nh_sse2);
Expand Down

0 comments on commit a9a8ba9

Please sign in to comment.