diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-03-23 15:55:21 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-03-23 15:55:21 -0700 |
commit | 979e52ca0469fb38646bc51d26a0263a740c9f03 (patch) | |
tree | 30e74fe523f2114c76bce93863fec38955d58fa4 /lib | |
parent | 16fbf79b0f83bc752cee8589279f1ebfe57b3b6e (diff) | |
parent | c8cfcb78c65877313cda7bcbace624d3dbd1f3b3 (diff) | |
download | linux-979e52ca0469fb38646bc51d26a0263a740c9f03.tar.bz2 |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu:
"This fixes a correctness bug in the ARM64 version of ChaCha for
lib/crypto used by WireGuard"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: arm64/chacha - correctly walk through blocks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crypto/chacha20poly1305-selftest.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/crypto/chacha20poly1305-selftest.c b/lib/crypto/chacha20poly1305-selftest.c index c391a91364e9..fa43deda2660 100644 --- a/lib/crypto/chacha20poly1305-selftest.c +++ b/lib/crypto/chacha20poly1305-selftest.c @@ -9028,10 +9028,15 @@ bool __init chacha20poly1305_selftest(void) && total_len <= 1 << 10; ++total_len) { for (i = 0; i <= total_len; ++i) { for (j = i; j <= total_len; ++j) { + k = 0; sg_init_table(sg_src, 3); - sg_set_buf(&sg_src[0], input, i); - sg_set_buf(&sg_src[1], input + i, j - i); - sg_set_buf(&sg_src[2], input + j, total_len - j); + if (i) + sg_set_buf(&sg_src[k++], input, i); + if (j - i) + sg_set_buf(&sg_src[k++], input + i, j - i); + if (total_len - j) + sg_set_buf(&sg_src[k++], input + j, total_len - j); + sg_init_marker(sg_src, k); memset(computed_output, 0, total_len); memset(input, 0, total_len); |