Skip to content

Commit ba24b8e

Browse files
dhowellsherbertx
authored andcommitted
crypto: testmgr - Add some test vectors for cmac(camellia)
Add some test vectors for 128-bit cmac(camellia) as found in draft-kato-ipsec-camellia-cmac96and128-01 section 6.2. The document also shows vectors for camellia-cmac-96, and for VK with a length greater than 16, but I'm not sure how to express those in testmgr. This also leaves cts(cbc(camellia)) untested, but I can't seem to find any tests for that that I could put into testmgr. Signed-off-by: David Howells <dhowells@redhat.com> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: Chuck Lever <chuck.lever@oracle.com> cc: Scott Mayhew <smayhew@redhat.com> cc: linux-nfs@vger.kernel.org cc: linux-crypto@vger.kernel.org Link: https://datatracker.ietf.org/doc/pdf/draft-kato-ipsec-camellia-cmac96and128-01 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent cfbda73 commit ba24b8e

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

crypto/testmgr.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4644,6 +4644,12 @@ static const struct alg_test_desc alg_test_descs[] = {
46444644
.suite = {
46454645
.hash = __VECS(aes_cmac128_tv_template)
46464646
}
4647+
}, {
4648+
.alg = "cmac(camellia)",
4649+
.test = alg_test_hash,
4650+
.suite = {
4651+
.hash = __VECS(camellia_cmac128_tv_template)
4652+
}
46474653
}, {
46484654
.alg = "cmac(des3_ede)",
46494655
.test = alg_test_hash,

crypto/testmgr.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25665,6 +25665,53 @@ static const struct cipher_testvec fcrypt_pcbc_tv_template[] = {
2566525665
/*
2566625666
* CAMELLIA test vectors.
2566725667
*/
25668+
static const struct hash_testvec camellia_cmac128_tv_template[] = {
25669+
{ /* From draft-kato-ipsec-camellia-cmac96and128-01 */
25670+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
25671+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
25672+
.plaintext = zeroed_string,
25673+
.digest = "\xba\x92\x57\x82\xaa\xa1\xf5\xd9"
25674+
"\xa0\x0f\x89\x64\x80\x94\xfc\x71",
25675+
.psize = 0,
25676+
.ksize = 16,
25677+
}, {
25678+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
25679+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
25680+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
25681+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
25682+
.digest = "\x6d\x96\x28\x54\xa3\xb9\xfd\xa5"
25683+
"\x6d\x7d\x45\xa9\x5e\xe1\x79\x93",
25684+
.psize = 16,
25685+
.ksize = 16,
25686+
}, {
25687+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
25688+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
25689+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
25690+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
25691+
"\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
25692+
"\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
25693+
"\x30\xc8\x1c\x46\xa3\x5c\xe4\x11",
25694+
.digest = "\x5c\x18\xd1\x19\xcc\xd6\x76\x61"
25695+
"\x44\xac\x18\x66\x13\x1d\x9f\x22",
25696+
.psize = 40,
25697+
.ksize = 16,
25698+
}, {
25699+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
25700+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
25701+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
25702+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
25703+
"\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
25704+
"\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
25705+
"\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
25706+
"\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
25707+
"\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
25708+
"\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
25709+
.digest = "\xc2\x69\x9a\x6e\xba\x55\xce\x9d"
25710+
"\x93\x9a\x8a\x4e\x19\x46\x6e\xe9",
25711+
.psize = 64,
25712+
.ksize = 16,
25713+
}
25714+
};
2566825715
static const struct cipher_testvec camellia_tv_template[] = {
2566925716
{
2567025717
.key = "\x01\x23\x45\x67\x89\xab\xcd\xef"

0 commit comments

Comments
 (0)