diff options
author | Eric Biggers <ebiggers@google.com> | 2018-12-06 16:00:08 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-12-13 05:24:59 -0500 |
commit | 282c14852d00d6d1b8fadf3e01e4180f02ddda84 (patch) | |
tree | b53a81a4fe030f050facafeaed28f3bdcbb50890 | |
parent | 5569e8c07447344cdc3771378ba4e0da0b94c2a4 (diff) |
crypto: xchacha20 - fix comments for test vectors
The kernel's ChaCha20 uses the RFC7539 convention of the nonce being 12
bytes rather than 8, so actually I only appended 12 random bytes (not
16) to its test vectors to form 24-byte nonces for the XChaCha20 test
vectors. The other 4 bytes were just from zero-padding the stream
position to 8 bytes. Fix the comments above the test vectors.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/testmgr.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 357cf4cbcbb1..e8f47d7b92cd 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -32281,8 +32281,9 @@ static const struct cipher_testvec xchacha20_tv_template[] = { | |||
32281 | "\x57\x78\x8e\x6f\xae\x90\xfc\x31" | 32281 | "\x57\x78\x8e\x6f\xae\x90\xfc\x31" |
32282 | "\x09\x7c\xfc", | 32282 | "\x09\x7c\xfc", |
32283 | .len = 91, | 32283 | .len = 91, |
32284 | }, { /* Taken from the ChaCha20 test vectors, appended 16 random bytes | 32284 | }, { /* Taken from the ChaCha20 test vectors, appended 12 random bytes |
32285 | to nonce, and recomputed the ciphertext with libsodium */ | 32285 | to the nonce, zero-padded the stream position from 4 to 8 bytes, |
32286 | and recomputed the ciphertext using libsodium's XChaCha20 */ | ||
32286 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | 32287 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" |
32287 | "\x00\x00\x00\x00\x00\x00\x00\x00" | 32288 | "\x00\x00\x00\x00\x00\x00\x00\x00" |
32288 | "\x00\x00\x00\x00\x00\x00\x00\x00" | 32289 | "\x00\x00\x00\x00\x00\x00\x00\x00" |
@@ -32309,8 +32310,7 @@ static const struct cipher_testvec xchacha20_tv_template[] = { | |||
32309 | "\x03\xdc\xf8\x2b\xc1\xe1\x75\x67" | 32310 | "\x03\xdc\xf8\x2b\xc1\xe1\x75\x67" |
32310 | "\x23\x7b\xe6\xfc\xd4\x03\x86\x54", | 32311 | "\x23\x7b\xe6\xfc\xd4\x03\x86\x54", |
32311 | .len = 64, | 32312 | .len = 64, |
32312 | }, { /* Taken from the ChaCha20 test vectors, appended 16 random bytes | 32313 | }, { /* Derived from a ChaCha20 test vector, via the process above */ |
32313 | to nonce, and recomputed the ciphertext with libsodium */ | ||
32314 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | 32314 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" |
32315 | "\x00\x00\x00\x00\x00\x00\x00\x00" | 32315 | "\x00\x00\x00\x00\x00\x00\x00\x00" |
32316 | "\x00\x00\x00\x00\x00\x00\x00\x00" | 32316 | "\x00\x00\x00\x00\x00\x00\x00\x00" |
@@ -32419,8 +32419,7 @@ static const struct cipher_testvec xchacha20_tv_template[] = { | |||
32419 | .np = 3, | 32419 | .np = 3, |
32420 | .tap = { 375 - 20, 4, 16 }, | 32420 | .tap = { 375 - 20, 4, 16 }, |
32421 | 32421 | ||
32422 | }, { /* Taken from the ChaCha20 test vectors, appended 16 random bytes | 32422 | }, { /* Derived from a ChaCha20 test vector, via the process above */ |
32423 | to nonce, and recomputed the ciphertext with libsodium */ | ||
32424 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" | 32423 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" |
32425 | "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" | 32424 | "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" |
32426 | "\x47\x39\x17\xc1\x40\x2b\x80\x09" | 32425 | "\x47\x39\x17\xc1\x40\x2b\x80\x09" |
@@ -32463,8 +32462,7 @@ static const struct cipher_testvec xchacha20_tv_template[] = { | |||
32463 | "\x65\x03\xfa\x45\xf7\x9e\x53\x7a" | 32462 | "\x65\x03\xfa\x45\xf7\x9e\x53\x7a" |
32464 | "\x99\xf1\x82\x25\x4f\x8d\x07", | 32463 | "\x99\xf1\x82\x25\x4f\x8d\x07", |
32465 | .len = 127, | 32464 | .len = 127, |
32466 | }, { /* Taken from the ChaCha20 test vectors, appended 16 random bytes | 32465 | }, { /* Derived from a ChaCha20 test vector, via the process above */ |
32467 | to nonce, and recomputed the ciphertext with libsodium */ | ||
32468 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" | 32466 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" |
32469 | "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" | 32467 | "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" |
32470 | "\x47\x39\x17\xc1\x40\x2b\x80\x09" | 32468 | "\x47\x39\x17\xc1\x40\x2b\x80\x09" |