Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: sha1 - Add test vector to test partial block processing

In light of the recent discovery of the bug with partial block
processing on s390, we need best test coverage for that. This
patch adds a test vector for SHA1 that should catch such problems.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+29 -1
+29 -1
crypto/testmgr.h
··· 451 451 452 452 /* 453 453 * SHA1 test vectors from from FIPS PUB 180-1 454 + * Long vector from CAVS 5.0 454 455 */ 455 - #define SHA1_TEST_VECTORS 2 456 + #define SHA1_TEST_VECTORS 3 456 457 457 458 static struct hash_testvec sha1_tv_template[] = { 458 459 { ··· 468 467 "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1", 469 468 .np = 2, 470 469 .tap = { 28, 28 } 470 + }, { 471 + .plaintext = "\xec\x29\x56\x12\x44\xed\xe7\x06" 472 + "\xb6\xeb\x30\xa1\xc3\x71\xd7\x44" 473 + "\x50\xa1\x05\xc3\xf9\x73\x5f\x7f" 474 + "\xa9\xfe\x38\xcf\x67\xf3\x04\xa5" 475 + "\x73\x6a\x10\x6e\x92\xe1\x71\x39" 476 + "\xa6\x81\x3b\x1c\x81\xa4\xf3\xd3" 477 + "\xfb\x95\x46\xab\x42\x96\xfa\x9f" 478 + "\x72\x28\x26\xc0\x66\x86\x9e\xda" 479 + "\xcd\x73\xb2\x54\x80\x35\x18\x58" 480 + "\x13\xe2\x26\x34\xa9\xda\x44\x00" 481 + "\x0d\x95\xa2\x81\xff\x9f\x26\x4e" 482 + "\xcc\xe0\xa9\x31\x22\x21\x62\xd0" 483 + "\x21\xcc\xa2\x8d\xb5\xf3\xc2\xaa" 484 + "\x24\x94\x5a\xb1\xe3\x1c\xb4\x13" 485 + "\xae\x29\x81\x0f\xd7\x94\xca\xd5" 486 + "\xdf\xaf\x29\xec\x43\xcb\x38\xd1" 487 + "\x98\xfe\x4a\xe1\xda\x23\x59\x78" 488 + "\x02\x21\x40\x5b\xd6\x71\x2a\x53" 489 + "\x05\xda\x4b\x1b\x73\x7f\xce\x7c" 490 + "\xd2\x1c\x0e\xb7\x72\x8d\x08\x23" 491 + "\x5a\x90\x11", 492 + .psize = 163, 493 + .digest = "\x97\x01\x11\xc4\xe7\x7b\xcc\x88\xcc\x20" 494 + "\x45\x9c\x02\xb6\x9b\x4a\xa8\xf5\x82\x17", 495 + .np = 4, 496 + .tap = { 63, 64, 31, 5 } 471 497 } 472 498 }; 473 499