summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/testmgr.c15
-rw-r--r--crypto/testmgr.h177
2 files changed, 192 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 717d6f2d8b0f..abd09c2489fa 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2308,6 +2308,21 @@ static const struct alg_test_desc alg_test_descs[] = {
2308 } 2308 }
2309 } 2309 }
2310 }, { 2310 }, {
2311 .alg = "chacha20",
2312 .test = alg_test_skcipher,
2313 .suite = {
2314 .cipher = {
2315 .enc = {
2316 .vecs = chacha20_enc_tv_template,
2317 .count = CHACHA20_ENC_TEST_VECTORS
2318 },
2319 .dec = {
2320 .vecs = chacha20_enc_tv_template,
2321 .count = CHACHA20_ENC_TEST_VECTORS
2322 },
2323 }
2324 }
2325 }, {
2311 .alg = "cmac(aes)", 2326 .alg = "cmac(aes)",
2312 .test = alg_test_hash, 2327 .test = alg_test_hash,
2313 .suite = { 2328 .suite = {
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 60031439f8d3..6e7b902eb6e0 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -28427,6 +28427,183 @@ static struct cipher_testvec salsa20_stream_enc_tv_template[] = {
28427 }, 28427 },
28428}; 28428};
28429 28429
28430#define CHACHA20_ENC_TEST_VECTORS 3
28431static struct cipher_testvec chacha20_enc_tv_template[] = {
28432 { /* RFC7539 A.2. Test Vector #1 */
28433 .key = "\x00\x00\x00\x00\x00\x00\x00\x00"
28434 "\x00\x00\x00\x00\x00\x00\x00\x00"
28435 "\x00\x00\x00\x00\x00\x00\x00\x00"
28436 "\x00\x00\x00\x00\x00\x00\x00\x00",
28437 .klen = 32,
28438 .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
28439 "\x00\x00\x00\x00\x00\x00\x00\x00",
28440 .input = "\x00\x00\x00\x00\x00\x00\x00\x00"
28441 "\x00\x00\x00\x00\x00\x00\x00\x00"
28442 "\x00\x00\x00\x00\x00\x00\x00\x00"
28443 "\x00\x00\x00\x00\x00\x00\x00\x00"
28444 "\x00\x00\x00\x00\x00\x00\x00\x00"
28445 "\x00\x00\x00\x00\x00\x00\x00\x00"
28446 "\x00\x00\x00\x00\x00\x00\x00\x00"
28447 "\x00\x00\x00\x00\x00\x00\x00\x00",
28448 .ilen = 64,
28449 .result = "\x76\xb8\xe0\xad\xa0\xf1\x3d\x90"
28450 "\x40\x5d\x6a\xe5\x53\x86\xbd\x28"
28451 "\xbd\xd2\x19\xb8\xa0\x8d\xed\x1a"
28452 "\xa8\x36\xef\xcc\x8b\x77\x0d\xc7"
28453 "\xda\x41\x59\x7c\x51\x57\x48\x8d"
28454 "\x77\x24\xe0\x3f\xb8\xd8\x4a\x37"
28455 "\x6a\x43\xb8\xf4\x15\x18\xa1\x1c"
28456 "\xc3\x87\xb6\x69\xb2\xee\x65\x86",
28457 .rlen = 64,
28458 }, { /* RFC7539 A.2. Test Vector #2 */
28459 .key = "\x00\x00\x00\x00\x00\x00\x00\x00"
28460 "\x00\x00\x00\x00\x00\x00\x00\x00"
28461 "\x00\x00\x00\x00\x00\x00\x00\x00"
28462 "\x00\x00\x00\x00\x00\x00\x00\x01",
28463 .klen = 32,
28464 .iv = "\x01\x00\x00\x00\x00\x00\x00\x00"
28465 "\x00\x00\x00\x00\x00\x00\x00\x02",
28466 .input = "\x41\x6e\x79\x20\x73\x75\x62\x6d"
28467 "\x69\x73\x73\x69\x6f\x6e\x20\x74"
28468 "\x6f\x20\x74\x68\x65\x20\x49\x45"
28469 "\x54\x46\x20\x69\x6e\x74\x65\x6e"
28470 "\x64\x65\x64\x20\x62\x79\x20\x74"
28471 "\x68\x65\x20\x43\x6f\x6e\x74\x72"
28472 "\x69\x62\x75\x74\x6f\x72\x20\x66"
28473 "\x6f\x72\x20\x70\x75\x62\x6c\x69"
28474 "\x63\x61\x74\x69\x6f\x6e\x20\x61"
28475 "\x73\x20\x61\x6c\x6c\x20\x6f\x72"
28476 "\x20\x70\x61\x72\x74\x20\x6f\x66"
28477 "\x20\x61\x6e\x20\x49\x45\x54\x46"
28478 "\x20\x49\x6e\x74\x65\x72\x6e\x65"
28479 "\x74\x2d\x44\x72\x61\x66\x74\x20"
28480 "\x6f\x72\x20\x52\x46\x43\x20\x61"
28481 "\x6e\x64\x20\x61\x6e\x79\x20\x73"
28482 "\x74\x61\x74\x65\x6d\x65\x6e\x74"
28483 "\x20\x6d\x61\x64\x65\x20\x77\x69"
28484 "\x74\x68\x69\x6e\x20\x74\x68\x65"
28485 "\x20\x63\x6f\x6e\x74\x65\x78\x74"
28486 "\x20\x6f\x66\x20\x61\x6e\x20\x49"
28487 "\x45\x54\x46\x20\x61\x63\x74\x69"
28488 "\x76\x69\x74\x79\x20\x69\x73\x20"
28489 "\x63\x6f\x6e\x73\x69\x64\x65\x72"
28490 "\x65\x64\x20\x61\x6e\x20\x22\x49"
28491 "\x45\x54\x46\x20\x43\x6f\x6e\x74"
28492 "\x72\x69\x62\x75\x74\x69\x6f\x6e"
28493 "\x22\x2e\x20\x53\x75\x63\x68\x20"
28494 "\x73\x74\x61\x74\x65\x6d\x65\x6e"
28495 "\x74\x73\x20\x69\x6e\x63\x6c\x75"
28496 "\x64\x65\x20\x6f\x72\x61\x6c\x20"
28497 "\x73\x74\x61\x74\x65\x6d\x65\x6e"
28498 "\x74\x73\x20\x69\x6e\x20\x49\x45"
28499 "\x54\x46\x20\x73\x65\x73\x73\x69"
28500 "\x6f\x6e\x73\x2c\x20\x61\x73\x20"
28501 "\x77\x65\x6c\x6c\x20\x61\x73\x20"
28502 "\x77\x72\x69\x74\x74\x65\x6e\x20"
28503 "\x61\x6e\x64\x20\x65\x6c\x65\x63"
28504 "\x74\x72\x6f\x6e\x69\x63\x20\x63"
28505 "\x6f\x6d\x6d\x75\x6e\x69\x63\x61"
28506 "\x74\x69\x6f\x6e\x73\x20\x6d\x61"
28507 "\x64\x65\x20\x61\x74\x20\x61\x6e"
28508 "\x79\x20\x74\x69\x6d\x65\x20\x6f"
28509 "\x72\x20\x70\x6c\x61\x63\x65\x2c"
28510 "\x20\x77\x68\x69\x63\x68\x20\x61"
28511 "\x72\x65\x20\x61\x64\x64\x72\x65"
28512 "\x73\x73\x65\x64\x20\x74\x6f",
28513 .ilen = 375,
28514 .result = "\xa3\xfb\xf0\x7d\xf3\xfa\x2f\xde"
28515 "\x4f\x37\x6c\xa2\x3e\x82\x73\x70"
28516 "\x41\x60\x5d\x9f\x4f\x4f\x57\xbd"
28517 "\x8c\xff\x2c\x1d\x4b\x79\x55\xec"
28518 "\x2a\x97\x94\x8b\xd3\x72\x29\x15"
28519 "\xc8\xf3\xd3\x37\xf7\xd3\x70\x05"
28520 "\x0e\x9e\x96\xd6\x47\xb7\xc3\x9f"
28521 "\x56\xe0\x31\xca\x5e\xb6\x25\x0d"
28522 "\x40\x42\xe0\x27\x85\xec\xec\xfa"
28523 "\x4b\x4b\xb5\xe8\xea\xd0\x44\x0e"
28524 "\x20\xb6\xe8\xdb\x09\xd8\x81\xa7"
28525 "\xc6\x13\x2f\x42\x0e\x52\x79\x50"
28526 "\x42\xbd\xfa\x77\x73\xd8\xa9\x05"
28527 "\x14\x47\xb3\x29\x1c\xe1\x41\x1c"
28528 "\x68\x04\x65\x55\x2a\xa6\xc4\x05"
28529 "\xb7\x76\x4d\x5e\x87\xbe\xa8\x5a"
28530 "\xd0\x0f\x84\x49\xed\x8f\x72\xd0"
28531 "\xd6\x62\xab\x05\x26\x91\xca\x66"
28532 "\x42\x4b\xc8\x6d\x2d\xf8\x0e\xa4"
28533 "\x1f\x43\xab\xf9\x37\xd3\x25\x9d"
28534 "\xc4\xb2\xd0\xdf\xb4\x8a\x6c\x91"
28535 "\x39\xdd\xd7\xf7\x69\x66\xe9\x28"
28536 "\xe6\x35\x55\x3b\xa7\x6c\x5c\x87"
28537 "\x9d\x7b\x35\xd4\x9e\xb2\xe6\x2b"
28538 "\x08\x71\xcd\xac\x63\x89\x39\xe2"
28539 "\x5e\x8a\x1e\x0e\xf9\xd5\x28\x0f"
28540 "\xa8\xca\x32\x8b\x35\x1c\x3c\x76"
28541 "\x59\x89\xcb\xcf\x3d\xaa\x8b\x6c"
28542 "\xcc\x3a\xaf\x9f\x39\x79\xc9\x2b"
28543 "\x37\x20\xfc\x88\xdc\x95\xed\x84"
28544 "\xa1\xbe\x05\x9c\x64\x99\xb9\xfd"
28545 "\xa2\x36\xe7\xe8\x18\xb0\x4b\x0b"
28546 "\xc3\x9c\x1e\x87\x6b\x19\x3b\xfe"
28547 "\x55\x69\x75\x3f\x88\x12\x8c\xc0"
28548 "\x8a\xaa\x9b\x63\xd1\xa1\x6f\x80"
28549 "\xef\x25\x54\xd7\x18\x9c\x41\x1f"
28550 "\x58\x69\xca\x52\xc5\xb8\x3f\xa3"
28551 "\x6f\xf2\x16\xb9\xc1\xd3\x00\x62"
28552 "\xbe\xbc\xfd\x2d\xc5\xbc\xe0\x91"
28553 "\x19\x34\xfd\xa7\x9a\x86\xf6\xe6"
28554 "\x98\xce\xd7\x59\xc3\xff\x9b\x64"
28555 "\x77\x33\x8f\x3d\xa4\xf9\xcd\x85"
28556 "\x14\xea\x99\x82\xcc\xaf\xb3\x41"
28557 "\xb2\x38\x4d\xd9\x02\xf3\xd1\xab"
28558 "\x7a\xc6\x1d\xd2\x9c\x6f\x21\xba"
28559 "\x5b\x86\x2f\x37\x30\xe3\x7c\xfd"
28560 "\xc4\xfd\x80\x6c\x22\xf2\x21",
28561 .rlen = 375,
28562 }, { /* RFC7539 A.2. Test Vector #3 */
28563 .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a"
28564 "\xf3\x33\x88\x86\x04\xf6\xb5\xf0"
28565 "\x47\x39\x17\xc1\x40\x2b\x80\x09"
28566 "\x9d\xca\x5c\xbc\x20\x70\x75\xc0",
28567 .klen = 32,
28568 .iv = "\x2a\x00\x00\x00\x00\x00\x00\x00"
28569 "\x00\x00\x00\x00\x00\x00\x00\x02",
28570 .input = "\x27\x54\x77\x61\x73\x20\x62\x72"
28571 "\x69\x6c\x6c\x69\x67\x2c\x20\x61"
28572 "\x6e\x64\x20\x74\x68\x65\x20\x73"
28573 "\x6c\x69\x74\x68\x79\x20\x74\x6f"
28574 "\x76\x65\x73\x0a\x44\x69\x64\x20"
28575 "\x67\x79\x72\x65\x20\x61\x6e\x64"
28576 "\x20\x67\x69\x6d\x62\x6c\x65\x20"
28577 "\x69\x6e\x20\x74\x68\x65\x20\x77"
28578 "\x61\x62\x65\x3a\x0a\x41\x6c\x6c"
28579 "\x20\x6d\x69\x6d\x73\x79\x20\x77"
28580 "\x65\x72\x65\x20\x74\x68\x65\x20"
28581 "\x62\x6f\x72\x6f\x67\x6f\x76\x65"
28582 "\x73\x2c\x0a\x41\x6e\x64\x20\x74"
28583 "\x68\x65\x20\x6d\x6f\x6d\x65\x20"
28584 "\x72\x61\x74\x68\x73\x20\x6f\x75"
28585 "\x74\x67\x72\x61\x62\x65\x2e",
28586 .ilen = 127,
28587 .result = "\x62\xe6\x34\x7f\x95\xed\x87\xa4"
28588 "\x5f\xfa\xe7\x42\x6f\x27\xa1\xdf"
28589 "\x5f\xb6\x91\x10\x04\x4c\x0d\x73"
28590 "\x11\x8e\xff\xa9\x5b\x01\xe5\xcf"
28591 "\x16\x6d\x3d\xf2\xd7\x21\xca\xf9"
28592 "\xb2\x1e\x5f\xb1\x4c\x61\x68\x71"
28593 "\xfd\x84\xc5\x4f\x9d\x65\xb2\x83"
28594 "\x19\x6c\x7f\xe4\xf6\x05\x53\xeb"
28595 "\xf3\x9c\x64\x02\xc4\x22\x34\xe3"
28596 "\x2a\x35\x6b\x3e\x76\x43\x12\xa6"
28597 "\x1a\x55\x32\x05\x57\x16\xea\xd6"
28598 "\x96\x25\x68\xf8\x7d\x3f\x3f\x77"
28599 "\x04\xc6\xa8\xd1\xbc\xd1\xbf\x4d"
28600 "\x50\xd6\x15\x4b\x6d\xa7\x31\xb1"
28601 "\x87\xb5\x8d\xfd\x72\x8a\xfa\x36"
28602 "\x75\x7a\x79\x7a\xc1\x88\xd1",
28603 .rlen = 127,
28604 },
28605};
28606
28430/* 28607/*
28431 * CTS (Cipher Text Stealing) mode tests 28608 * CTS (Cipher Text Stealing) mode tests
28432 */ 28609 */