]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/ukrandom: Increase ChaCha rounds to 20
authorMichalis Pappas <michalis@unikraft.io>
Mon, 7 Oct 2024 13:52:19 +0000 (15:52 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Wed, 4 Dec 2024 15:24:38 +0000 (15:24 +0000)
Although 8 rounds most likely provide enough security [1], ChaCha20
brings us in alignment with Linux, and allows us to implement tests
using the vectors defined in RFC8439.

[1] https://eprint.iacr.org/2019/1492.pdf

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Pana <maria.pana4@gmail.com>
Reviewed-by: Alex Apostolescu <alexx.apostolescu@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1496

lib/ukrandom/chacha.c

index a5edc334f304750cb534a3a3aecac808c6d85c50..22aa2b680c598dec6937a62648757e3fbe720030 100644 (file)
@@ -88,7 +88,7 @@ uk_salsa20_wordtobyte(__u32 output[16], const __u32 input[16])
        for (i = 0; i < 16; i++)
                output[i] = input[i];
 
-       for (i = 8; i > 0; i -= 2) {
+       for (i = 20; i > 0; i -= 2) {
                uk_quarterround(output, 0, 4, 8, 12);
                uk_quarterround(output, 1, 5, 9, 13);
                uk_quarterround(output, 2, 6, 10, 14);