crypto: testmgr - fix testing OPTIONAL_KEY hash algorithms
authorEric Biggers <ebiggers@google.com>
Sun, 20 May 2018 05:07:41 +0000 (22:07 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 26 May 2018 16:12:10 +0000 (00:12 +0800)
commit9b3abc0162e8fb2927644bab682815bd920f0f2f
tree6592dc0b3db3c524df502c8c7e2ff746bdcfc577
parenta179a2bf0561359973114a539c6f26c858bcb781
crypto: testmgr - fix testing OPTIONAL_KEY hash algorithms

Since testmgr uses a single tfm for all tests of each hash algorithm,
once a key is set the tfm won't be unkeyed anymore.  But with crc32 and
crc32c, the key is really the "default initial state" and is optional;
those algorithms should have both keyed and unkeyed test vectors, to
verify that implementations use the correct default key.

Simply listing the unkeyed test vectors first isn't guaranteed to work
yet because testmgr makes multiple passes through the test vectors.
crc32c does have an unkeyed test vector listed first currently, but it
only works by chance because the last crc32c test vector happens to use
a key that is the same as the default key.

Therefore, teach testmgr to split hash test vectors into unkeyed and
keyed sections, and do all the unkeyed ones before the keyed ones.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/testmgr.c