summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.h
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-02-01 02:51:47 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2019-02-08 02:30:09 -0500
commited96804ff1a5f94bdf4cda73ee81ba4545a076e5 (patch)
treeb4833b14763c9899f9b75ce06c1f2d5f17ecf6f4 /crypto/testmgr.h
parent4e7babba30d820c4195b1d58cf51dce3c22ecf2b (diff)
crypto: testmgr - convert aead testing to use testvec_configs
Convert alg_test_aead() to use the new test framework, using the same list of testvec_configs that skcipher testing uses. This significantly improves AEAD test coverage mainly because previously there was only very limited test coverage of the possible data layouts. Now the data layouts to test are listed in one place for all algorithms and optionally are also randomly generated. In fact, only one AEAD algorithm (AES-GCM) even had a chunked test case before. This already found bugs in all the AEGIS and MORUS implementations, the x86 AES-GCM implementation, and the arm64 AES-CCM implementation. I removed the AEAD chunked test vectors that were the same as non-chunked ones, but left the ones that were unique. Note: the rewritten test code allocates an aead_request just once per algorithm rather than once per encryption/decryption, but some AEAD algorithms incorrectly change the tfm pointer in the request. It's nontrivial to fix these, so to move forward I'm temporarily working around it by resetting the tfm pointer. But they'll need to be fixed. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r--crypto/testmgr.h47
1 files changed, 0 insertions, 47 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 1a73af8a79f7..dfd8059d1306 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -78,10 +78,6 @@ struct cipher_testvec {
78 * @ctext: Pointer to the full authenticated ciphertext. For AEADs that 78 * @ctext: Pointer to the full authenticated ciphertext. For AEADs that
79 * produce a separate "ciphertext" and "authentication tag", these 79 * produce a separate "ciphertext" and "authentication tag", these
80 * two parts are concatenated: ciphertext || tag. 80 * two parts are concatenated: ciphertext || tag.
81 * @tap: How to distribute ptext data in @np SGs
82 * @atap: How to distribute assoc data in @anp SGs
83 * @np: Numbers of SG to distribute ptext data in
84 * @anp: Numbers of SG to distribute assoc data in
85 * @fail: setkey() failure expected? 81 * @fail: setkey() failure expected?
86 * @novrfy: Decryption verification failure expected? 82 * @novrfy: Decryption verification failure expected?
87 * @wk: Does the test need CRYPTO_TFM_REQ_FORBID_WEAK_KEYS? 83 * @wk: Does the test need CRYPTO_TFM_REQ_FORBID_WEAK_KEYS?
@@ -97,10 +93,6 @@ struct aead_testvec {
97 const char *ptext; 93 const char *ptext;
98 const char *assoc; 94 const char *assoc;
99 const char *ctext; 95 const char *ctext;
100 unsigned char tap[MAX_TAP];
101 unsigned char atap[MAX_TAP];
102 int np;
103 int anp;
104 bool fail; 96 bool fail;
105 unsigned char novrfy; 97 unsigned char novrfy;
106 unsigned char wk; 98 unsigned char wk;
@@ -16606,41 +16598,6 @@ static const struct aead_testvec aes_gcm_tv_template[] = {
16606 "\xb1\x18\x02\x4d\xb8\x67\x4a\x14", 16598 "\xb1\x18\x02\x4d\xb8\x67\x4a\x14",
16607 .clen = 80, 16599 .clen = 80,
16608 }, { 16600 }, {
16609 .key = "\xfe\xff\xe9\x92\x86\x65\x73\x1c"
16610 "\x6d\x6a\x8f\x94\x67\x30\x83\x08"
16611 "\xfe\xff\xe9\x92\x86\x65\x73\x1c",
16612 .klen = 24,
16613 .iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad"
16614 "\xde\xca\xf8\x88",
16615 .ptext = "\xd9\x31\x32\x25\xf8\x84\x06\xe5"
16616 "\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
16617 "\x86\xa7\xa9\x53\x15\x34\xf7\xda"
16618 "\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
16619 "\x1c\x3c\x0c\x95\x95\x68\x09\x53"
16620 "\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
16621 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57"
16622 "\xba\x63\x7b\x39",
16623 .plen = 60,
16624 .assoc = "\xfe\xed\xfa\xce\xde\xad\xbe\xef"
16625 "\xfe\xed\xfa\xce\xde\xad\xbe\xef"
16626 "\xab\xad\xda\xd2",
16627 .alen = 20,
16628 .ctext = "\x39\x80\xca\x0b\x3c\x00\xe8\x41"
16629 "\xeb\x06\xfa\xc4\x87\x2a\x27\x57"
16630 "\x85\x9e\x1c\xea\xa6\xef\xd9\x84"
16631 "\x62\x85\x93\xb4\x0c\xa1\xe1\x9c"
16632 "\x7d\x77\x3d\x00\xc1\x44\xc5\x25"
16633 "\xac\x61\x9d\x18\xc8\x4a\x3f\x47"
16634 "\x18\xe2\x44\x8b\x2f\xe3\x24\xd9"
16635 "\xcc\xda\x27\x10"
16636 "\x25\x19\x49\x8e\x80\xf1\x47\x8f"
16637 "\x37\xba\x55\xbd\x6d\x27\x61\x8c",
16638 .clen = 76,
16639 .np = 2,
16640 .tap = { 32, 28 },
16641 .anp = 2,
16642 .atap = { 8, 12 }
16643 }, {
16644 .key = zeroed_string, 16601 .key = zeroed_string,
16645 .klen = 32, 16602 .klen = 32,
16646 .ctext = "\x53\x0f\x8a\xfb\xc7\x45\x36\xb9" 16603 .ctext = "\x53\x0f\x8a\xfb\xc7\x45\x36\xb9"
@@ -16716,10 +16673,6 @@ static const struct aead_testvec aes_gcm_tv_template[] = {
16716 "\x76\xfc\x6e\xce\x0f\x4e\x17\x68" 16673 "\x76\xfc\x6e\xce\x0f\x4e\x17\x68"
16717 "\xcd\xdf\x88\x53\xbb\x2d\x55\x1b", 16674 "\xcd\xdf\x88\x53\xbb\x2d\x55\x1b",
16718 .clen = 76, 16675 .clen = 76,
16719 .np = 2,
16720 .tap = { 48, 12 },
16721 .anp = 3,
16722 .atap = { 8, 8, 4 }
16723 }, { 16676 }, {
16724 .key = "\xfe\xff\xe9\x92\x86\x65\x73\x1c" 16677 .key = "\xfe\xff\xe9\x92\x86\x65\x73\x1c"
16725 "\x6d\x6a\x8f\x94\x67\x30\x83\x08" 16678 "\x6d\x6a\x8f\x94\x67\x30\x83\x08"