Commit c9c28ed0 authored by Stephan Müller's avatar Stephan Müller Committed by Herbert Xu

crypto: hmac - add fips_skip support

By adding the support for the flag fips_skip, hash / HMAC test vectors
may be marked to be not applicable in FIPS mode. Such vectors are
silently skipped in FIPS mode.
Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 95e26b03
...@@ -1851,6 +1851,9 @@ static int __alg_test_hash(const struct hash_testvec *vecs, ...@@ -1851,6 +1851,9 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
} }
for (i = 0; i < num_vecs; i++) { for (i = 0; i < num_vecs; i++) {
if (fips_enabled && vecs[i].fips_skip)
continue;
err = test_hash_vec(&vecs[i], i, req, desc, tsgl, hashstate); err = test_hash_vec(&vecs[i], i, req, desc, tsgl, hashstate);
if (err) if (err)
goto out; goto out;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
* @ksize: Length of @key in bytes (0 if no key) * @ksize: Length of @key in bytes (0 if no key)
* @setkey_error: Expected error from setkey() * @setkey_error: Expected error from setkey()
* @digest_error: Expected error from digest() * @digest_error: Expected error from digest()
* @fips_skip: Skip the test vector in FIPS mode
*/ */
struct hash_testvec { struct hash_testvec {
const char *key; const char *key;
...@@ -42,6 +43,7 @@ struct hash_testvec { ...@@ -42,6 +43,7 @@ struct hash_testvec {
unsigned short ksize; unsigned short ksize;
int setkey_error; int setkey_error;
int digest_error; int digest_error;
bool fips_skip;
}; };
/* /*
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment