summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2018-12-06 15:31:54 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2018-12-13 05:24:58 -0500
commit5569e8c07447344cdc3771378ba4e0da0b94c2a4 (patch)
treee7aad4184e7727396465e8839c9e858212bc01b0 /crypto
parenta033aed5a84eb93a32929b6862602cb283d39e82 (diff)
crypto: xchacha - add test vector from XChaCha20 draft RFC
There is a draft specification for XChaCha20 being worked on. Add the XChaCha20 test vector from the appendix so that we can be extra sure the kernel's implementation is compatible. I also recomputed the ciphertext with XChaCha12 and added it there too, to keep the tests for XChaCha20 and XChaCha12 in sync. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/testmgr.h178
1 files changed, 176 insertions, 2 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index e7e56a8febbc..357cf4cbcbb1 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -32800,7 +32800,94 @@ static const struct cipher_testvec xchacha20_tv_template[] = {
32800 .also_non_np = 1, 32800 .also_non_np = 1,
32801 .np = 3, 32801 .np = 3,
32802 .tap = { 1200, 1, 80 }, 32802 .tap = { 1200, 1, 80 },
32803 }, 32803 }, { /* test vector from https://tools.ietf.org/html/draft-arciszewski-xchacha-02#appendix-A.3.2 */
32804 .key = "\x80\x81\x82\x83\x84\x85\x86\x87"
32805 "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
32806 "\x90\x91\x92\x93\x94\x95\x96\x97"
32807 "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
32808 .klen = 32,
32809 .iv = "\x40\x41\x42\x43\x44\x45\x46\x47"
32810 "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
32811 "\x50\x51\x52\x53\x54\x55\x56\x58"
32812 "\x00\x00\x00\x00\x00\x00\x00\x00",
32813 .ptext = "\x54\x68\x65\x20\x64\x68\x6f\x6c"
32814 "\x65\x20\x28\x70\x72\x6f\x6e\x6f"
32815 "\x75\x6e\x63\x65\x64\x20\x22\x64"
32816 "\x6f\x6c\x65\x22\x29\x20\x69\x73"
32817 "\x20\x61\x6c\x73\x6f\x20\x6b\x6e"
32818 "\x6f\x77\x6e\x20\x61\x73\x20\x74"
32819 "\x68\x65\x20\x41\x73\x69\x61\x74"
32820 "\x69\x63\x20\x77\x69\x6c\x64\x20"
32821 "\x64\x6f\x67\x2c\x20\x72\x65\x64"
32822 "\x20\x64\x6f\x67\x2c\x20\x61\x6e"
32823 "\x64\x20\x77\x68\x69\x73\x74\x6c"
32824 "\x69\x6e\x67\x20\x64\x6f\x67\x2e"
32825 "\x20\x49\x74\x20\x69\x73\x20\x61"
32826 "\x62\x6f\x75\x74\x20\x74\x68\x65"
32827 "\x20\x73\x69\x7a\x65\x20\x6f\x66"
32828 "\x20\x61\x20\x47\x65\x72\x6d\x61"
32829 "\x6e\x20\x73\x68\x65\x70\x68\x65"
32830 "\x72\x64\x20\x62\x75\x74\x20\x6c"
32831 "\x6f\x6f\x6b\x73\x20\x6d\x6f\x72"
32832 "\x65\x20\x6c\x69\x6b\x65\x20\x61"
32833 "\x20\x6c\x6f\x6e\x67\x2d\x6c\x65"
32834 "\x67\x67\x65\x64\x20\x66\x6f\x78"
32835 "\x2e\x20\x54\x68\x69\x73\x20\x68"
32836 "\x69\x67\x68\x6c\x79\x20\x65\x6c"
32837 "\x75\x73\x69\x76\x65\x20\x61\x6e"
32838 "\x64\x20\x73\x6b\x69\x6c\x6c\x65"
32839 "\x64\x20\x6a\x75\x6d\x70\x65\x72"
32840 "\x20\x69\x73\x20\x63\x6c\x61\x73"
32841 "\x73\x69\x66\x69\x65\x64\x20\x77"
32842 "\x69\x74\x68\x20\x77\x6f\x6c\x76"
32843 "\x65\x73\x2c\x20\x63\x6f\x79\x6f"
32844 "\x74\x65\x73\x2c\x20\x6a\x61\x63"
32845 "\x6b\x61\x6c\x73\x2c\x20\x61\x6e"
32846 "\x64\x20\x66\x6f\x78\x65\x73\x20"
32847 "\x69\x6e\x20\x74\x68\x65\x20\x74"
32848 "\x61\x78\x6f\x6e\x6f\x6d\x69\x63"
32849 "\x20\x66\x61\x6d\x69\x6c\x79\x20"
32850 "\x43\x61\x6e\x69\x64\x61\x65\x2e",
32851 .ctext = "\x45\x59\xab\xba\x4e\x48\xc1\x61"
32852 "\x02\xe8\xbb\x2c\x05\xe6\x94\x7f"
32853 "\x50\xa7\x86\xde\x16\x2f\x9b\x0b"
32854 "\x7e\x59\x2a\x9b\x53\xd0\xd4\xe9"
32855 "\x8d\x8d\x64\x10\xd5\x40\xa1\xa6"
32856 "\x37\x5b\x26\xd8\x0d\xac\xe4\xfa"
32857 "\xb5\x23\x84\xc7\x31\xac\xbf\x16"
32858 "\xa5\x92\x3c\x0c\x48\xd3\x57\x5d"
32859 "\x4d\x0d\x2c\x67\x3b\x66\x6f\xaa"
32860 "\x73\x10\x61\x27\x77\x01\x09\x3a"
32861 "\x6b\xf7\xa1\x58\xa8\x86\x42\x92"
32862 "\xa4\x1c\x48\xe3\xa9\xb4\xc0\xda"
32863 "\xec\xe0\xf8\xd9\x8d\x0d\x7e\x05"
32864 "\xb3\x7a\x30\x7b\xbb\x66\x33\x31"
32865 "\x64\xec\x9e\x1b\x24\xea\x0d\x6c"
32866 "\x3f\xfd\xdc\xec\x4f\x68\xe7\x44"
32867 "\x30\x56\x19\x3a\x03\xc8\x10\xe1"
32868 "\x13\x44\xca\x06\xd8\xed\x8a\x2b"
32869 "\xfb\x1e\x8d\x48\xcf\xa6\xbc\x0e"
32870 "\xb4\xe2\x46\x4b\x74\x81\x42\x40"
32871 "\x7c\x9f\x43\x1a\xee\x76\x99\x60"
32872 "\xe1\x5b\xa8\xb9\x68\x90\x46\x6e"
32873 "\xf2\x45\x75\x99\x85\x23\x85\xc6"
32874 "\x61\xf7\x52\xce\x20\xf9\xda\x0c"
32875 "\x09\xab\x6b\x19\xdf\x74\xe7\x6a"
32876 "\x95\x96\x74\x46\xf8\xd0\xfd\x41"
32877 "\x5e\x7b\xee\x2a\x12\xa1\x14\xc2"
32878 "\x0e\xb5\x29\x2a\xe7\xa3\x49\xae"
32879 "\x57\x78\x20\xd5\x52\x0a\x1f\x3f"
32880 "\xb6\x2a\x17\xce\x6a\x7e\x68\xfa"
32881 "\x7c\x79\x11\x1d\x88\x60\x92\x0b"
32882 "\xc0\x48\xef\x43\xfe\x84\x48\x6c"
32883 "\xcb\x87\xc2\x5f\x0a\xe0\x45\xf0"
32884 "\xcc\xe1\xe7\x98\x9a\x9a\xa2\x20"
32885 "\xa2\x8b\xdd\x48\x27\xe7\x51\xa2"
32886 "\x4a\x6d\x5c\x62\xd7\x90\xa6\x63"
32887 "\x93\xb9\x31\x11\xc1\xa5\x5d\xd7"
32888 "\x42\x1a\x10\x18\x49\x74\xc7\xc5",
32889 .len = 304,
32890 }
32804}; 32891};
32805 32892
32806/* 32893/*
@@ -33378,7 +33465,94 @@ static const struct cipher_testvec xchacha12_tv_template[] = {
33378 .also_non_np = 1, 33465 .also_non_np = 1,
33379 .np = 3, 33466 .np = 3,
33380 .tap = { 1200, 1, 80 }, 33467 .tap = { 1200, 1, 80 },
33381 }, 33468 }, {
33469 .key = "\x80\x81\x82\x83\x84\x85\x86\x87"
33470 "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
33471 "\x90\x91\x92\x93\x94\x95\x96\x97"
33472 "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
33473 .klen = 32,
33474 .iv = "\x40\x41\x42\x43\x44\x45\x46\x47"
33475 "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
33476 "\x50\x51\x52\x53\x54\x55\x56\x58"
33477 "\x00\x00\x00\x00\x00\x00\x00\x00",
33478 .ptext = "\x54\x68\x65\x20\x64\x68\x6f\x6c"
33479 "\x65\x20\x28\x70\x72\x6f\x6e\x6f"
33480 "\x75\x6e\x63\x65\x64\x20\x22\x64"
33481 "\x6f\x6c\x65\x22\x29\x20\x69\x73"
33482 "\x20\x61\x6c\x73\x6f\x20\x6b\x6e"
33483 "\x6f\x77\x6e\x20\x61\x73\x20\x74"
33484 "\x68\x65\x20\x41\x73\x69\x61\x74"
33485 "\x69\x63\x20\x77\x69\x6c\x64\x20"
33486 "\x64\x6f\x67\x2c\x20\x72\x65\x64"
33487 "\x20\x64\x6f\x67\x2c\x20\x61\x6e"
33488 "\x64\x20\x77\x68\x69\x73\x74\x6c"
33489 "\x69\x6e\x67\x20\x64\x6f\x67\x2e"
33490 "\x20\x49\x74\x20\x69\x73\x20\x61"
33491 "\x62\x6f\x75\x74\x20\x74\x68\x65"
33492 "\x20\x73\x69\x7a\x65\x20\x6f\x66"
33493 "\x20\x61\x20\x47\x65\x72\x6d\x61"
33494 "\x6e\x20\x73\x68\x65\x70\x68\x65"
33495 "\x72\x64\x20\x62\x75\x74\x20\x6c"
33496 "\x6f\x6f\x6b\x73\x20\x6d\x6f\x72"
33497 "\x65\x20\x6c\x69\x6b\x65\x20\x61"
33498 "\x20\x6c\x6f\x6e\x67\x2d\x6c\x65"
33499 "\x67\x67\x65\x64\x20\x66\x6f\x78"
33500 "\x2e\x20\x54\x68\x69\x73\x20\x68"
33501 "\x69\x67\x68\x6c\x79\x20\x65\x6c"
33502 "\x75\x73\x69\x76\x65\x20\x61\x6e"
33503 "\x64\x20\x73\x6b\x69\x6c\x6c\x65"
33504 "\x64\x20\x6a\x75\x6d\x70\x65\x72"
33505 "\x20\x69\x73\x20\x63\x6c\x61\x73"
33506 "\x73\x69\x66\x69\x65\x64\x20\x77"
33507 "\x69\x74\x68\x20\x77\x6f\x6c\x76"
33508 "\x65\x73\x2c\x20\x63\x6f\x79\x6f"
33509 "\x74\x65\x73\x2c\x20\x6a\x61\x63"
33510 "\x6b\x61\x6c\x73\x2c\x20\x61\x6e"
33511 "\x64\x20\x66\x6f\x78\x65\x73\x20"
33512 "\x69\x6e\x20\x74\x68\x65\x20\x74"
33513 "\x61\x78\x6f\x6e\x6f\x6d\x69\x63"
33514 "\x20\x66\x61\x6d\x69\x6c\x79\x20"
33515 "\x43\x61\x6e\x69\x64\x61\x65\x2e",
33516 .ctext = "\x9f\x1a\xab\x8a\x95\xf4\x7e\xcd"
33517 "\xee\x34\xc0\x39\xd6\x23\x43\x94"
33518 "\xf6\x01\xc1\x7f\x60\x91\xa5\x23"
33519 "\x4a\x8a\xe6\xb1\x14\x8b\xd7\x58"
33520 "\xee\x02\xad\xab\xce\x1e\x7d\xdf"
33521 "\xf9\x49\x27\x69\xd0\x8d\x0c\x20"
33522 "\x6e\x17\xc4\xae\x87\x7a\xc6\x61"
33523 "\x91\xe2\x8e\x0a\x1d\x61\xcc\x38"
33524 "\x02\x64\x43\x49\xc6\xb2\x59\x59"
33525 "\x42\xe7\x9d\x83\x00\x60\x90\xd2"
33526 "\xb9\xcd\x97\x6e\xc7\x95\x71\xbc"
33527 "\x23\x31\x58\x07\xb3\xb4\xac\x0b"
33528 "\x87\x64\x56\xe5\xe3\xec\x63\xa1"
33529 "\x71\x8c\x08\x48\x33\x20\x29\x81"
33530 "\xea\x01\x25\x20\xc3\xda\xe6\xee"
33531 "\x6a\x03\xf6\x68\x4d\x26\xa0\x91"
33532 "\x9e\x44\xb8\xc1\xc0\x8f\x5a\x6a"
33533 "\xc0\xcd\xbf\x24\x5e\x40\x66\xd2"
33534 "\x42\x24\xb5\xbf\xc1\xeb\x12\x60"
33535 "\x56\xbe\xb1\xa6\xc4\x0f\xfc\x49"
33536 "\x69\x9f\xcc\x06\x5c\xe3\x26\xd7"
33537 "\x52\xc0\x42\xe8\xb4\x76\xc3\xee"
33538 "\xb2\x97\xe3\x37\x61\x29\x5a\xb5"
33539 "\x8e\xe8\x8c\xc5\x38\xcc\xcb\xec"
33540 "\x64\x1a\xa9\x12\x5f\xf7\x79\xdf"
33541 "\x64\xca\x77\x4e\xbd\xf9\x83\xa0"
33542 "\x13\x27\x3f\x31\x03\x63\x30\x26"
33543 "\x27\x0b\x3e\xb3\x23\x13\x61\x0b"
33544 "\x70\x1d\xd4\xad\x85\x1e\xbf\xdf"
33545 "\xc6\x8e\x4d\x08\xcc\x7e\x77\xbd"
33546 "\x1e\x18\x77\x38\x3a\xfe\xc0\x5d"
33547 "\x16\xfc\xf0\xa9\x2f\xe9\x17\xc7"
33548 "\xd3\x23\x17\x18\xa3\xe6\x54\x77"
33549 "\x6f\x1b\xbe\x8a\x6e\x7e\xca\x97"
33550 "\x08\x05\x36\x76\xaf\x12\x7a\x42"
33551 "\xf7\x7a\xc2\x35\xc3\xb4\x93\x40"
33552 "\x54\x14\x90\xa0\x4d\x65\x1c\x37"
33553 "\x50\x70\x44\x29\x6d\x6e\x62\x68",
33554 .len = 304,
33555 }
33382}; 33556};
33383 33557
33384/* Adiantum test vectors from https://github.com/google/adiantum */ 33558/* Adiantum test vectors from https://github.com/google/adiantum */