Skip to content

Commit 092acf0

Browse files
Ard Biesheuvelherbertx
authored andcommitted
crypto: testmgr - add test cases for cbcmac(aes)
In preparation of splitting off the CBC-MAC transform in the CCM driver into a separate algorithm, define some test cases for the AES incarnation of cbcmac. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent b5e0b03 commit 092acf0

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

crypto/testmgr.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,6 +2513,13 @@ static const struct alg_test_desc alg_test_descs[] = {
25132513
.dec = __VECS(tf_cbc_dec_tv_template)
25142514
}
25152515
}
2516+
}, {
2517+
.alg = "cbcmac(aes)",
2518+
.fips_allowed = 1,
2519+
.test = alg_test_hash,
2520+
.suite = {
2521+
.hash = __VECS(aes_cbcmac_tv_template)
2522+
}
25162523
}, {
25172524
.alg = "ccm(aes)",
25182525
.test = alg_test_aead,

crypto/testmgr.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,6 +3413,66 @@ static struct hash_testvec aes_cmac128_tv_template[] = {
34133413
}
34143414
};
34153415

3416+
static struct hash_testvec aes_cbcmac_tv_template[] = {
3417+
{
3418+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
3419+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
3420+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3421+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
3422+
.digest = "\x3a\xd7\x7b\xb4\x0d\x7a\x36\x60"
3423+
"\xa8\x9e\xca\xf3\x24\x66\xef\x97",
3424+
.psize = 16,
3425+
.ksize = 16,
3426+
}, {
3427+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
3428+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
3429+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3430+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3431+
"\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3432+
"\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3433+
"\x30",
3434+
.digest = "\x9d\x0d\xd0\x63\xfb\xcb\x24\x43"
3435+
"\xf8\xf2\x76\x03\xac\x39\xb0\x9d",
3436+
.psize = 33,
3437+
.ksize = 16,
3438+
.np = 2,
3439+
.tap = { 7, 26 },
3440+
}, {
3441+
.key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
3442+
"\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
3443+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3444+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3445+
"\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3446+
"\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3447+
"\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
3448+
"\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
3449+
"\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
3450+
"\xad\x2b\x41\x7b\xe6\x6c\x37",
3451+
.digest = "\xc0\x71\x73\xb8\xa0\x2c\x11\x7c"
3452+
"\xaf\xdc\xb2\xf8\x89\x32\xa3\x3a",
3453+
.psize = 63,
3454+
.ksize = 16,
3455+
}, {
3456+
.key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
3457+
"\x2b\x73\xae\xf0\x85\x7d\x77\x81"
3458+
"\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
3459+
"\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
3460+
.plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3461+
"\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3462+
"\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3463+
"\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3464+
"\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
3465+
"\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
3466+
"\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
3467+
"\xad\x2b\x41\x7b\xe6\x6c\x37\x10"
3468+
"\x1c",
3469+
.digest = "\x6a\x4e\xdb\x21\x47\x51\xdf\x4f"
3470+
"\xa8\x4d\x4c\x10\x3b\x72\x7d\xd6",
3471+
.psize = 65,
3472+
.ksize = 32,
3473+
}
3474+
};
3475+
34163476
static struct hash_testvec des3_ede_cmac64_tv_template[] = {
34173477
/*
34183478
* From NIST Special Publication 800-38B, Three Key TDEA

0 commit comments

Comments
 (0)