Commit c24ee936 authored by Tianjia Zhang's avatar Tianjia Zhang Committed by Herbert Xu

crypto: testmgr - add SM4 cts-cbc/xts/xcbc test vectors

This patch newly adds the test vectors of CTS-CBC/XTS/XCBC modes of
the SM4 algorithm, and also added some test vectors for SM4 GCM/CCM.
Signed-off-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 62508017
...@@ -4712,6 +4712,12 @@ static const struct alg_test_desc alg_test_descs[] = { ...@@ -4712,6 +4712,12 @@ static const struct alg_test_desc alg_test_descs[] = {
.alg = "cts(cbc(paes))", .alg = "cts(cbc(paes))",
.test = alg_test_null, .test = alg_test_null,
.fips_allowed = 1, .fips_allowed = 1,
}, {
.alg = "cts(cbc(sm4))",
.test = alg_test_skcipher,
.suite = {
.cipher = __VECS(sm4_cts_tv_template)
}
}, { }, {
.alg = "curve25519", .alg = "curve25519",
.test = alg_test_kpp, .test = alg_test_kpp,
...@@ -5586,6 +5592,12 @@ static const struct alg_test_desc alg_test_descs[] = { ...@@ -5586,6 +5592,12 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = { .suite = {
.hash = __VECS(aes_xcbc128_tv_template) .hash = __VECS(aes_xcbc128_tv_template)
} }
}, {
.alg = "xcbc(sm4)",
.test = alg_test_hash,
.suite = {
.hash = __VECS(sm4_xcbc128_tv_template)
}
}, { }, {
.alg = "xchacha12", .alg = "xchacha12",
.test = alg_test_skcipher, .test = alg_test_skcipher,
...@@ -5640,6 +5652,13 @@ static const struct alg_test_desc alg_test_descs[] = { ...@@ -5640,6 +5652,13 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = { .suite = {
.cipher = __VECS(serpent_xts_tv_template) .cipher = __VECS(serpent_xts_tv_template)
} }
}, {
.alg = "xts(sm4)",
.generic_driver = "xts(ecb(sm4-generic))",
.test = alg_test_skcipher,
.suite = {
.cipher = __VECS(sm4_xts_tv_template)
}
}, { }, {
.alg = "xts(twofish)", .alg = "xts(twofish)",
.generic_driver = "xts(ecb(twofish-generic))", .generic_driver = "xts(ecb(twofish-generic))",
......
...@@ -14882,6 +14882,353 @@ static const struct cipher_testvec sm4_cfb_tv_template[] = { ...@@ -14882,6 +14882,353 @@ static const struct cipher_testvec sm4_cfb_tv_template[] = {
} }
}; };
static const struct cipher_testvec sm4_cts_tv_template[] = {
/* Generated from AES-CTS test vectors */
{
.klen = 16,
.key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
"\x74\x65\x72\x69\x79\x61\x6b\x69",
.ptext = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
"\x6c\x69\x6b\x65\x20\x74\x68\x65"
"\x20",
.len = 17,
.ctext = "\x05\xfe\x23\xee\x17\xa2\x89\x98"
"\xbc\x97\x0a\x0b\x54\x67\xca\xd7"
"\xd6",
}, {
.klen = 16,
.key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
"\x74\x65\x72\x69\x79\x61\x6b\x69",
.ptext = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
"\x6c\x69\x6b\x65\x20\x74\x68\x65"
"\x20\x47\x65\x6e\x65\x72\x61\x6c"
"\x20\x47\x61\x75\x27\x73\x20",
.len = 31,
.ctext = "\x15\x46\xe4\x95\xa4\xec\xf0\xb8"
"\x49\xd6\x6a\x9d\x89\xc7\xfd\x70"
"\xd6\x71\xc8\xc0\x4d\x52\x7c\x66"
"\x93\xf7\x70\xbb\xa8\x3f\xa3",
}, {
.klen = 16,
.key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
"\x74\x65\x72\x69\x79\x61\x6b\x69",
.ptext = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
"\x6c\x69\x6b\x65\x20\x74\x68\x65"
"\x20\x47\x65\x6e\x65\x72\x61\x6c"
"\x20\x47\x61\x75\x27\x73\x20\x43",
.len = 32,
.ctext = "\x89\xc7\x99\x3f\x87\x69\x5c\xd3"
"\x01\x6a\xbf\xd4\x3f\x79\x02\xa3"
"\xd6\x71\xc8\xc0\x4d\x52\x7c\x66"
"\x93\xf7\x70\xbb\xa8\x3f\xa3\xcf",
}, {
.klen = 16,
.key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
"\x74\x65\x72\x69\x79\x61\x6b\x69",
.ptext = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
"\x6c\x69\x6b\x65\x20\x74\x68\x65"
"\x20\x47\x65\x6e\x65\x72\x61\x6c"
"\x20\x47\x61\x75\x27\x73\x20\x43"
"\x68\x69\x63\x6b\x65\x6e\x2c\x20"
"\x70\x6c\x65\x61\x73\x65\x2c",
.len = 47,
.ctext = "\xd6\x71\xc8\xc0\x4d\x52\x7c\x66"
"\x93\xf7\x70\xbb\xa8\x3f\xa3\xcf"
"\xd3\xe1\xdc\xeb\xfa\x04\x11\x99"
"\xde\xcf\x6f\x4d\x7b\x09\x92\x7f"
"\x89\xc7\x99\x3f\x87\x69\x5c\xd3"
"\x01\x6a\xbf\xd4\x3f\x79\x02",
}, {
.klen = 16,
.key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
"\x74\x65\x72\x69\x79\x61\x6b\x69",
.ptext = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
"\x6c\x69\x6b\x65\x20\x74\x68\x65"
"\x20\x47\x65\x6e\x65\x72\x61\x6c"
"\x20\x47\x61\x75\x27\x73\x20\x43"
"\x68\x69\x63\x6b\x65\x6e\x2c\x20"
"\x70\x6c\x65\x61\x73\x65\x2c\x20",
.len = 48,
.ctext = "\xd6\x71\xc8\xc0\x4d\x52\x7c\x66"
"\x93\xf7\x70\xbb\xa8\x3f\xa3\xcf"
"\x9a\xbd\x7b\xfe\x82\xab\xcc\x7f"
"\xbd\x99\x21\x0c\x5e\x4d\xed\x20"
"\x89\xc7\x99\x3f\x87\x69\x5c\xd3"
"\x01\x6a\xbf\xd4\x3f\x79\x02\xa3",
}, {
.klen = 16,
.key = "\x63\x68\x69\x63\x6b\x65\x6e\x20"
"\x74\x65\x72\x69\x79\x61\x6b\x69",
.ptext = "\x49\x20\x77\x6f\x75\x6c\x64\x20"
"\x6c\x69\x6b\x65\x20\x74\x68\x65"
"\x20\x47\x65\x6e\x65\x72\x61\x6c"
"\x20\x47\x61\x75\x27\x73\x20\x43"
"\x68\x69\x63\x6b\x65\x6e\x2c\x20"
"\x70\x6c\x65\x61\x73\x65\x2c\x20"
"\x61\x6e\x64\x20\x77\x6f\x6e\x74"
"\x6f\x6e\x20\x73\x6f\x75\x70\x2e",
.len = 64,
.ctext = "\xd6\x71\xc8\xc0\x4d\x52\x7c\x66"
"\x93\xf7\x70\xbb\xa8\x3f\xa3\xcf"
"\x89\xc7\x99\x3f\x87\x69\x5c\xd3"
"\x01\x6a\xbf\xd4\x3f\x79\x02\xa3"
"\x58\x19\xa4\x8f\xa9\x68\x5e\x6b"
"\x2c\x0f\x81\x60\x15\x98\x27\x4f"
"\x9a\xbd\x7b\xfe\x82\xab\xcc\x7f"
"\xbd\x99\x21\x0c\x5e\x4d\xed\x20",
}
};
static const struct cipher_testvec sm4_xts_tv_template[] = {
/* Generated from AES-XTS test vectors */
{
.key = "\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.klen = 32,
.iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.ptext = "\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.ctext = "\xd9\xb4\x21\xf7\x31\xc8\x94\xfd"
"\xc3\x5b\x77\x29\x1f\xe4\xe3\xb0"
"\x2a\x1f\xb7\x66\x98\xd5\x9f\x0e"
"\x51\x37\x6c\x4a\xda\x5b\xc7\x5d",
.len = 32,
}, {
.key = "\x11\x11\x11\x11\x11\x11\x11\x11"
"\x11\x11\x11\x11\x11\x11\x11\x11"
"\x22\x22\x22\x22\x22\x22\x22\x22"
"\x22\x22\x22\x22\x22\x22\x22\x22",
.klen = 32,
.iv = "\x33\x33\x33\x33\x33\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.ptext = "\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44",
.ctext = "\xa7\x4d\x72\x6c\x11\x19\x6a\x32"
"\xbe\x04\xe0\x01\xff\x29\xd0\xc7"
"\x93\x2f\x9f\x3e\xc2\x9b\xfc\xb6"
"\x4d\xd1\x7f\x63\xcb\xd3\xea\x31",
.len = 32,
}, {
.key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
"\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
"\x22\x22\x22\x22\x22\x22\x22\x22"
"\x22\x22\x22\x22\x22\x22\x22\x22",
.klen = 32,
.iv = "\x33\x33\x33\x33\x33\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.ptext = "\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44",
.ctext = "\x7f\x76\x08\x8e\xff\xad\xf7\x0c"
"\x02\xea\x9f\x95\xda\x06\x28\xd3"
"\x51\xbf\xcb\x9e\xac\x05\x63\xbc"
"\xf1\x7b\x71\x0d\xab\x0a\x98\x26",
.len = 32,
}, {
.key = "\x27\x18\x28\x18\x28\x45\x90\x45"
"\x23\x53\x60\x28\x74\x71\x35\x26"
"\x31\x41\x59\x26\x53\x58\x97\x93"
"\x23\x84\x62\x64\x33\x83\x27\x95",
.klen = 32,
.iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.ptext = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
"\x20\x21\x22\x23\x24\x25\x26\x27"
"\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
"\x30\x31\x32\x33\x34\x35\x36\x37"
"\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
"\x40\x41\x42\x43\x44\x45\x46\x47"
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
"\x50\x51\x52\x53\x54\x55\x56\x57"
"\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
"\x60\x61\x62\x63\x64\x65\x66\x67"
"\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
"\x70\x71\x72\x73\x74\x75\x76\x77"
"\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
"\x80\x81\x82\x83\x84\x85\x86\x87"
"\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
"\x90\x91\x92\x93\x94\x95\x96\x97"
"\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
"\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
"\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
"\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
"\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
"\xe8\xe9\xea\xeb\xec\xed\xee\xef"
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
"\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
"\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
"\x20\x21\x22\x23\x24\x25\x26\x27"
"\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
"\x30\x31\x32\x33\x34\x35\x36\x37"
"\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
"\x40\x41\x42\x43\x44\x45\x46\x47"
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
"\x50\x51\x52\x53\x54\x55\x56\x57"
"\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
"\x60\x61\x62\x63\x64\x65\x66\x67"
"\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
"\x70\x71\x72\x73\x74\x75\x76\x77"
"\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
"\x80\x81\x82\x83\x84\x85\x86\x87"
"\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
"\x90\x91\x92\x93\x94\x95\x96\x97"
"\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
"\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
"\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
"\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
"\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
"\xe8\xe9\xea\xeb\xec\xed\xee\xef"
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
"\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
.ctext = "\x54\xdd\x65\xb6\x32\x6f\xae\xa8"
"\xfa\xd1\xa8\x3c\x63\x61\x4a\xf3"
"\x9f\x72\x1d\x8d\xfe\x17\x7a\x30"
"\xb6\x6a\xbf\x6a\x44\x99\x80\xe1"
"\xcd\xbe\x06\xaf\xb7\x33\x36\xf3"
"\x7a\x4d\x39\xde\x96\x4a\x30\xd7"
"\xd0\x4a\x37\x99\x16\x9c\x60\x25"
"\x8f\x6b\x74\x8a\x61\x86\x1a\xa5"
"\xec\x92\xa2\xc1\x5b\x2b\x7c\x61"
"\x5a\x42\xab\xa4\x99\xbb\xd6\xb7"
"\x1d\xb9\xc7\x89\xb2\x18\x20\x89"
"\xa2\x5d\xd3\xdf\x80\x0e\xd1\x86"
"\x4d\x19\xf7\xed\x45\xfd\x17\xa9"
"\x48\x0b\x0f\xb8\x2d\x9b\x7f\xc3"
"\xed\x57\xe9\xa1\x14\x0e\xaa\x77"
"\x8d\xd2\xdd\x67\x9e\x3e\xdc\x3d"
"\xc4\xd5\x5c\x95\x0e\xbc\x53\x1d"
"\x95\x92\xf7\xc4\x63\x82\x56\xd5"
"\x65\x18\x29\x2a\x20\xaf\x98\xfd"
"\xd3\xa6\x36\x00\x35\x0a\x70\xab"
"\x5a\x40\xf4\xc2\x85\x03\x7c\xa0"
"\x1f\x25\x1f\x19\xec\xae\x03\x29"
"\xff\x77\xad\x88\xcd\x5a\x4c\xde"
"\xa2\xae\xab\xc2\x21\x48\xff\xbd"
"\x23\x9b\xd1\x05\x15\xbd\xe1\x13"
"\x1d\xec\x84\x04\xe4\x43\xdc\x76"
"\x31\x40\xd5\xf2\x2b\xf3\x3e\x0c"
"\x68\x72\xd6\xb8\x1d\x63\x0f\x6f"
"\x00\xcd\xd0\x58\xfe\x80\xf9\xcb"
"\xfb\x77\x70\x7f\x93\xce\xe2\xca"
"\x92\xb9\x15\xb8\x30\x40\x27\xc1"
"\x90\xa8\x4e\x2d\x65\xe0\x18\xcc"
"\x6a\x38\x7d\x37\x66\xac\xdb\x28"
"\x25\x32\x84\xe8\xdb\x9a\xcf\x8f"
"\x52\x28\x0d\xdc\x6d\x00\x33\xd2"
"\xcc\xaa\xa4\xf9\xae\xff\x12\x36"
"\x69\xbc\x02\x4f\xd6\x76\x8e\xdf"
"\x8b\xc1\xf8\xd6\x22\xc1\x9c\x60"
"\x9e\xf9\x7f\x60\x91\x90\xcd\x11"
"\x02\x41\xe7\xfb\x08\x4e\xd8\x94"
"\x2d\xa1\xf9\xb9\xcf\x1b\x51\x4b"
"\x61\xa3\x88\xb3\x0e\xa6\x1a\x4a"
"\x74\x5b\x38\x1e\xe7\xad\x6c\x4d"
"\xb1\x27\x54\x53\xb8\x41\x3f\x98"
"\xdf\x6e\x4a\x40\x98\x6e\xe4\xb5"
"\x9a\xf5\xdf\xae\xcd\x30\x12\x65"
"\x17\x90\x67\xa0\x0d\x7c\xa3\x5a"
"\xb9\x5a\xbd\x61\x7a\xde\xa2\x8e"
"\xc1\xc2\x6a\x97\xde\x28\xb8\xbf"
"\xe3\x01\x20\xd6\xae\xfb\xd2\x58"
"\xc5\x9e\x42\xd1\x61\xe8\x06\x5a"
"\x78\x10\x6b\xdc\xa5\xcd\x90\xfb"
"\x3a\xac\x4e\x93\x86\x6c\x8a\x7f"
"\x96\x76\x86\x0a\x79\x14\x5b\xd9"
"\x2e\x02\xe8\x19\xa9\x0b\xe0\xb9"
"\x7c\xc5\x22\xb3\x21\x06\x85\x6f"
"\xdf\x0e\x54\xd8\x8e\x46\x24\x15"
"\x5a\x2f\x1c\x14\xea\xea\xa1\x63"
"\xf8\x58\xe9\x9a\x80\x6e\x79\x1a"
"\xcd\x82\xf1\xb0\xe2\x9f\x00\x28"
"\xa4\xc3\x8e\x97\x6f\x57\x1a\x93"
"\xf4\xfd\x57\xd7\x87\xc2\x4d\xb0"
"\xe0\x1c\xa3\x04\xe5\xa5\xc4\xdd"
"\x50\xcf\x8b\xdb\xf4\x91\xe5\x7c",
.len = 512,
}, {
.key = "\x62\x49\x77\x57\x24\x70\x93\x69"
"\x99\x59\x57\x49\x66\x96\x76\x27"
"\x02\x88\x41\x97\x16\x93\x99\x37"
"\x51\x05\x82\x09\x74\x94\x45\x92",
.klen = 32,
.iv = "\xff\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00",
.ptext = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
"\x20\x21\x22\x23\x24\x25\x26\x27"
"\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
"\x30\x31\x32\x33\x34\x35\x36\x37"
"\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
"\x40\x41\x42\x43\x44\x45\x46\x47"
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
"\x50\x51\x52\x53\x54\x55\x56\x57"
"\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
"\x60\x61\x62\x63\x64\x65\x66\x67"
"\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
"\x70\x71\x72\x73\x74\x75\x76\x77"
"\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
"\x80\x81\x82\x83\x84\x85\x86\x87"
"\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
"\x90\x91\x92\x93\x94\x95\x96\x97"
"\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
"\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
"\xf8\xf9\xfa\xfb\xfc",
.ctext = "\xa2\x9f\x9e\x4e\x71\xdb\x28\x3c"
"\x80\x0e\xf6\xb7\x8e\x57\x1c\xba"
"\x90\xda\x3b\x6c\x22\x00\x68\x30"
"\x1d\x63\x0d\x9e\x6a\xad\x37\x55"
"\xbc\x77\x1e\xc9\xad\x83\x30\xd5"
"\x27\xb2\x66\x77\x18\x3c\xa6\x39"
"\x9c\x0a\xaa\x1f\x02\xe1\xd5\x65"
"\x9b\x8d\xc5\x97\x3d\xc5\x04\x53"
"\x78\x00\xe3\xb0\x1a\x43\x4e\xb7"
"\xc4\x9f\x38\xc5\x7b\xa4\x70\x64"
"\x78\xe6\x32\xd9\x65\x44\xc5\x64"
"\xb8\x42\x35\x99\xff\x66\x75\xb0"
"\x22\xd3\x9b\x6e\x8d\xcf\x6a\x24"
"\xfd\x92\xb7\x1b\x04\x28\x2a\x61"
"\xdc\x96\x2a\x20\x7a\x2c\xf1\xf9"
"\x12\x15\xf0\x4d\xcf\x2b\xde\x33"
"\x41\xbc\xe7\x85\x87\x22\xb7\x16"
"\x02\x1c\xd8\xa2\x0f\x1f\xa3\xe9"
"\xd8\x45\x48\xe7\xbe\x08\x4e\x4e"
"\x23\x79\x84\xdb\x40\x76\xf5\x13"
"\x78\x92\x4a\x2f\xf9\x1b\xf2\x80"
"\x25\x74\x51\x45\x9a\x77\x78\x97"
"\xd3\xe0\xc7\xc4\x35\x67\x2a\xe6"
"\xb3\x0d\x62\x9f\x8b",
.len = 189,
},
};
static const struct aead_testvec sm4_gcm_tv_template[] = { static const struct aead_testvec sm4_gcm_tv_template[] = {
{ /* From https://datatracker.ietf.org/doc/html/rfc8998#appendix-A.1 */ { /* From https://datatracker.ietf.org/doc/html/rfc8998#appendix-A.1 */
.key = "\x01\x23\x45\x67\x89\xAB\xCD\xEF" .key = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
...@@ -14913,6 +15260,298 @@ static const struct aead_testvec sm4_gcm_tv_template[] = { ...@@ -14913,6 +15260,298 @@ static const struct aead_testvec sm4_gcm_tv_template[] = {
"\x83\xDE\x35\x41\xE4\xC2\xB5\x81" "\x83\xDE\x35\x41\xE4\xC2\xB5\x81"
"\x77\xE0\x65\xA9\xBF\x7B\x62\xEC", "\x77\xE0\x65\xA9\xBF\x7B\x62\xEC",
.clen = 80, .clen = 80,
}, { /* Generated from AES-GCM test vectors */
.key = zeroed_string,
.klen = 16,
.ctext = "\x23\x2f\x0c\xfe\x30\x8b\x49\xea"
"\x6f\xc8\x82\x29\xb5\xdc\x85\x8d",
.clen = 16,
}, {
.key = zeroed_string,
.klen = 16,
.ptext = zeroed_string,
.plen = 16,
.ctext = "\x7d\xe2\xaa\x7f\x11\x10\x18\x82"
"\x18\x06\x3b\xe1\xbf\xeb\x6d\x89"
"\xb8\x51\xb5\xf3\x94\x93\x75\x2b"
"\xe5\x08\xf1\xbb\x44\x82\xc5\x57",
.clen = 32,
}, {
.key = "\xfe\xff\xe9\x92\x86\x65\x73\x1c"
"\x6d\x6a\x8f\x94\x67\x30\x83\x08",
.klen = 16,
.iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad"
"\xde\xca\xf8\x88",
.ptext = "\xd9\x31\x32\x25\xf8\x84\x06\xe5"
"\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
"\x86\xa7\xa9\x53\x15\x34\xf7\xda"
"\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
"\x1c\x3c\x0c\x95\x95\x68\x09\x53"
"\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
"\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57"
"\xba\x63\x7b\x39\x1a\xaf\xd2\x55",
.plen = 64,
.ctext = "\xe4\x11\x0f\xf1\xc1\x41\x97\xe6"
"\x76\x21\x6a\x33\x83\x10\x41\xeb"
"\x09\x58\x00\x11\x7b\xdc\x3f\x75"
"\x1a\x49\x6e\xfc\xf2\xbb\xdf\xdb"
"\x3a\x2e\x13\xfd\xc5\xc1\x9d\x07"
"\x1a\xe5\x48\x3f\xed\xde\x98\x5d"
"\x3f\x2d\x5b\x4e\xee\x0b\xb6\xdf"
"\xe3\x63\x36\x83\x23\xf7\x5b\x80"
"\x7d\xfe\x77\xef\x71\xb1\x5e\xc9"
"\x52\x6b\x09\xab\x84\x28\x4b\x8a",
.clen = 80,
}, {
.key = "\xfe\xff\xe9\x92\x86\x65\x73\x1c"
"\x6d\x6a\x8f\x94\x67\x30\x83\x08",
.klen = 16,
.iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad"
"\xde\xca\xf8\x88",
.ptext = "\xd9\x31\x32\x25\xf8\x84\x06\xe5"
"\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
"\x86\xa7\xa9\x53\x15\x34\xf7\xda"
"\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
"\x1c\x3c\x0c\x95\x95\x68\x09\x53"
"\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
"\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57"
"\xba\x63\x7b\x39",
.plen = 60,
.assoc = "\xfe\xed\xfa\xce\xde\xad\xbe\xef"
"\xfe\xed\xfa\xce\xde\xad\xbe\xef"
"\xab\xad\xda\xd2",
.alen = 20,
.ctext = "\xe4\x11\x0f\xf1\xc1\x41\x97\xe6"
"\x76\x21\x6a\x33\x83\x10\x41\xeb"
"\x09\x58\x00\x11\x7b\xdc\x3f\x75"
"\x1a\x49\x6e\xfc\xf2\xbb\xdf\xdb"
"\x3a\x2e\x13\xfd\xc5\xc1\x9d\x07"
"\x1a\xe5\x48\x3f\xed\xde\x98\x5d"
"\x3f\x2d\x5b\x4e\xee\x0b\xb6\xdf"
"\xe3\x63\x36\x83"
"\x89\xf6\xba\x35\xb8\x18\xd3\xcc"
"\x38\x6c\x05\xb3\x8a\xcb\xc9\xde",
.clen = 76,
}, {
.key = "\xfe\xff\xe9\x92\x86\x65\x73\x1c"
"\xfe\xff\xe9\x92\x86\x65\x73\x1c",
.klen = 16,
.iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad"
"\xde\xca\xf8\x88",
.ptext = "\xd9\x31\x32\x25\xf8\x84\x06\xe5"
"\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
"\x86\xa7\xa9\x53\x15\x34\xf7\xda"
"\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
"\x1c\x3c\x0c\x95\x95\x68\x09\x53"
"\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
"\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57"
"\xba\x63\x7b\x39",
.plen = 60,
.assoc = "\xfe\xed\xfa\xce\xde\xad\xbe\xef"
"\xfe\xed\xfa\xce\xde\xad\xbe\xef"
"\xab\xad\xda\xd2",
.alen = 20,
.ctext = "\xc1\x11\x44\x51\xd9\x25\x87\x5b"
"\x0f\xd9\x06\xf3\x33\x44\xbb\x87"
"\x8b\xa3\x77\xd2\x0c\x60\xfa\xcc"
"\x85\x50\x6f\x96\x0c\x54\x54\xc1"
"\x58\x04\x88\x6e\xf4\x26\x35\x7e"
"\x94\x80\x48\x6c\xf2\xf4\x88\x1f"
"\x19\x63\xea\xae\xba\x81\x1a\x5d"
"\x0e\x6f\x59\x08"
"\x33\xac\x5b\xa8\x19\x60\xdb\x1d"
"\xdd\x2e\x22\x2e\xe0\x87\x51\x5d",
.clen = 76,
}, {
.key = "\x8b\x32\xcf\xe7\x44\xed\x13\x59"
"\x04\x38\x77\xb0\xb9\xad\xb4\x38",
.klen = 16,
.iv = "\x00\xff\xff\xff\xff\x00\x00\xff"
"\xff\xff\x00\xff",
.ptext = "\x42\xc1\xcc\x08\x48\x6f\x41\x3f"
"\x2f\x11\x66\x8b\x2a\x16\xf0\xe0"
"\x58\x83\xf0\xc3\x70\x14\xc0\x5b"
"\x3f\xec\x1d\x25\x3c\x51\xd2\x03"
"\xcf\x59\x74\x1f\xb2\x85\xb4\x07"
"\xc6\x6a\x63\x39\x8a\x5b\xde\xcb"
"\xaf\x08\x44\xbd\x6f\x91\x15\xe1"
"\xf5\x7a\x6e\x18\xbd\xdd\x61\x50"
"\x59\xa9\x97\xab\xbb\x0e\x74\x5c"
"\x00\xa4\x43\x54\x04\x54\x9b\x3b"
"\x77\xec\xfd\x5c\xa6\xe8\x7b\x08"
"\xae\xe6\x10\x3f\x32\x65\xd1\xfc"
"\xa4\x1d\x2c\x31\xfb\x33\x7a\xb3"
"\x35\x23\xf4\x20\x41\xd4\xad\x82"
"\x8b\xa4\xad\x96\x1c\x20\x53\xbe"
"\x0e\xa6\xf4\xdc\x78\x49\x3e\x72"
"\xb1\xa9\xb5\x83\xcb\x08\x54\xb7"
"\xad\x49\x3a\xae\x98\xce\xa6\x66"
"\x10\x30\x90\x8c\x55\x83\xd7\x7c"
"\x8b\xe6\x53\xde\xd2\x6e\x18\x21"
"\x01\x52\xd1\x9f\x9d\xbb\x9c\x73"
"\x57\xcc\x89\x09\x75\x9b\x78\x70"
"\xed\x26\x97\x4d\xb4\xe4\x0c\xa5"
"\xfa\x70\x04\x70\xc6\x96\x1c\x7d"
"\x54\x41\x77\xa8\xe3\xb0\x7e\x96"
"\x82\xd9\xec\xa2\x87\x68\x55\xf9"
"\x8f\x9e\x73\x43\x47\x6a\x08\x36"
"\x93\x67\xa8\x2d\xde\xac\x41\xa9"
"\x5c\x4d\x73\x97\x0f\x70\x68\xfa"
"\x56\x4d\x00\xc2\x3b\x1f\xc8\xb9"
"\x78\x1f\x51\x07\xe3\x9a\x13\x4e"
"\xed\x2b\x2e\xa3\xf7\x44\xb2\xe7"
"\xab\x19\x37\xd9\xba\x76\x5e\xd2"
"\xf2\x53\x15\x17\x4c\x6b\x16\x9f"
"\x02\x66\x49\xca\x7c\x91\x05\xf2"
"\x45\x36\x1e\xf5\x77\xad\x1f\x46"
"\xa8\x13\xfb\x63\xb6\x08\x99\x63"
"\x82\xa2\xed\xb3\xac\xdf\x43\x19"
"\x45\xea\x78\x73\xd9\xb7\x39\x11"
"\xa3\x13\x7c\xf8\x3f\xf7\xad\x81"
"\x48\x2f\xa9\x5c\x5f\xa0\xf0\x79"
"\xa4\x47\x7d\x80\x20\x26\xfd\x63"
"\x0a\xc7\x7e\x6d\x75\x47\xff\x76"
"\x66\x2e\x8a\x6c\x81\x35\xaf\x0b"
"\x2e\x6a\x49\x60\xc1\x10\xe1\xe1"
"\x54\x03\xa4\x09\x0c\x37\x7a\x15"
"\x23\x27\x5b\x8b\x4b\xa5\x64\x97"
"\xae\x4a\x50\x73\x1f\x66\x1c\x5c"
"\x03\x25\x3c\x8d\x48\x58\x71\x34"
"\x0e\xec\x4e\x55\x1a\x03\x6a\xe5"
"\xb6\x19\x2b\x84\x2a\x20\xd1\xea"
"\x80\x6f\x96\x0e\x05\x62\xc7\x78"
"\x87\x79\x60\x38\x46\xb4\x25\x57"
"\x6e\x16\x63\xf8\xad\x6e\xd7\x42"
"\x69\xe1\x88\xef\x6e\xd5\xb4\x9a"
"\x3c\x78\x6c\x3b\xe5\xa0\x1d\x22"
"\x86\x5c\x74\x3a\xeb\x24\x26\xc7"
"\x09\xfc\x91\x96\x47\x87\x4f\x1a"
"\xd6\x6b\x2c\x18\x47\xc0\xb8\x24"
"\xa8\x5a\x4a\x9e\xcb\x03\xe7\x2a"
"\x09\xe6\x4d\x9c\x6d\x86\x60\xf5"
"\x2f\x48\x69\x37\x9f\xf2\xd2\xcb"
"\x0e\x5a\xdd\x6e\x8a\xfb\x6a\xfe"
"\x0b\x63\xde\x87\x42\x79\x8a\x68"
"\x51\x28\x9b\x7a\xeb\xaf\xb8\x2f"
"\x9d\xd1\xc7\x45\x90\x08\xc9\x83"
"\xe9\x83\x84\xcb\x28\x69\x09\x69"
"\xce\x99\x46\x00\x54\xcb\xd8\x38"
"\xf9\x53\x4a\xbf\x31\xce\x57\x15"
"\x33\xfa\x96\x04\x33\x42\xe3\xc0"
"\xb7\x54\x4a\x65\x7a\x7c\x02\xe6"
"\x19\x95\xd0\x0e\x82\x07\x63\xf9"
"\xe1\x2b\x2a\xfc\x55\x92\x52\xc9"
"\xb5\x9f\x23\x28\x60\xe7\x20\x51"
"\x10\xd3\xed\x6d\x9b\xab\xb8\xe2"
"\x5d\x9a\x34\xb3\xbe\x9c\x64\xcb"
"\x78\xc6\x91\x22\x40\x91\x80\xbe"
"\xd7\x78\x5c\x0e\x0a\xdc\x08\xe9"
"\x67\x10\xa4\x83\x98\x79\x23\xe7"
"\x92\xda\xa9\x22\x16\xb1\xe7\x78"
"\xa3\x1c\x6c\x8f\x35\x7c\x4d\x37"
"\x2f\x6e\x0b\x50\x5c\x34\xb9\xf9"
"\xe6\x3d\x91\x0d\x32\x95\xaa\x3d"
"\x48\x11\x06\xbb\x2d\xf2\x63\x88"
"\x3f\x73\x09\xe2\x45\x56\x31\x51"
"\xfa\x5e\x4e\x62\xf7\x90\xf9\xa9"
"\x7d\x7b\x1b\xb1\xc8\x26\x6e\x66"
"\xf6\x90\x9a\x7f\xf2\x57\xcc\x23"
"\x59\xfa\xfa\xaa\x44\x04\x01\xa7"
"\xa4\x78\xdb\x74\x3d\x8b\xb5",
.plen = 719,
.ctext = "\xdc\xb1\x0f\x2a\xe8\x2d\x1c\x57"
"\xc4\x82\xfa\xd6\x87\xe6\x2f\x50"
"\xbd\x9e\x0a\x42\x31\xf2\xc7\xbb"
"\x21\x63\xa7\x05\x43\x33\xef\x33"
"\x5c\xd3\x47\x55\xce\x5c\xe4\xd4"
"\xe5\x07\x62\x22\xac\x01\xa8\x35"
"\x9c\x59\x34\x30\x8e\xff\x9f\xb4"
"\xd2\x4e\x74\x90\x64\xf2\x78\x5e"
"\x63\xb7\xc5\x08\x1b\x37\xa5\x9e"
"\xc0\xde\xff\xa9\x7f\x0b\xd3\x02"
"\x83\x6e\x33\xfa\x43\x11\xd3\xda"
"\x02\xcf\xcd\x4a\xc0\x78\x1f\x39"
"\x62\xcb\xa3\x95\x7e\x13\x92\x28"
"\xb2\xc4\x7a\xba\xd1\xc6\xf6\x1f"
"\xda\x0b\xf1\xd1\x99\x54\xd8\x3b"
"\x16\xf8\xe6\x97\x1e\xa7\xcf\x49"
"\x69\x84\x01\x4c\xdc\x7a\x34\xff"
"\x01\x08\xa3\x0b\x39\xac\x21\x37"
"\xd8\xb4\x04\x19\x8b\x7a\x7d\x17"
"\x44\xd1\x18\xaf\x1f\xa9\x29\xfe"
"\xfa\x77\xe0\x40\x42\x0c\x79\xb7"
"\xc3\x15\x1b\xd9\x0c\x82\xfc\x16"
"\x70\xd6\x2a\xe9\x94\x72\xc5\xa5"
"\x8a\x58\xbc\xfa\xe0\x88\x39\x4a"
"\x80\xe8\xec\xaf\x60\xac\xe7\xf8"
"\x9c\xf0\xfc\x61\x39\x07\x98\x6b"
"\x88\xe3\x98\x22\x28\x18\x4a\x2d"
"\x25\xef\x10\xe3\x83\x66\x3f\xfd"
"\xc7\x0b\xa3\xfd\x97\xa9\xf4\xbd"
"\xd8\x2a\xee\x4a\x50\xad\xcc\xb5"
"\xc7\xab\xb8\x79\x9c\xd1\xf1\x27"
"\x08\xf5\xf5\xe8\x1b\x66\xce\x41"
"\x56\x60\x94\x86\xf0\x78\xc2\xfa"
"\x5b\x63\x40\xb1\xd1\x1a\x38\x69"
"\x0b\x8c\xb2\xf5\xa2\xbe\x90\x9d"
"\x46\x23\x79\x8b\x3b\x4a\xf4\xbb"
"\x55\xf7\x58\x9d\xaf\x59\xff\x74"
"\xf3\xb9\xc4\x26\xb1\xf8\xe1\x28"
"\x8b\x5e\x8f\x6d\x64\xe7\xe8\x63"
"\xd2\x9e\xcb\xee\xae\x19\x04\x1d"
"\x05\xf0\x9d\x99\x7b\x33\x33\xae"
"\x6e\xe5\x09\xdd\x67\x51\xc4\xc8"
"\x6a\xc7\x36\x35\xc9\x93\x76\xa1"
"\xa8\x1c\xfa\x75\x92\x34\x0e\x7d"
"\x3d\x1d\xef\x00\xfd\xa5\x25\x12"
"\x7c\x91\x21\x41\xcc\x50\x47\xa9"
"\x22\x50\x24\x96\x34\x79\x3d\xe8"
"\x3f\xa0\x56\xaf\x98\x53\x55\xc3"
"\x46\x1b\x17\x54\xb8\xb0\xb7\xe0"
"\xe0\xab\x47\x6f\x06\xda\xcc\x75"
"\xa7\x96\xb7\x92\xf3\xa0\x5f\xe6"
"\xba\x97\xe3\x2f\x97\x05\xb2\x99"
"\xa0\x09\x10\x98\x9c\xd3\x2e\xd1"
"\x7e\x2a\x30\x54\x3c\xb9\x33\xe3"
"\xf2\xaf\xd3\xa5\xee\xd0\x0b\x8a"
"\x19\x54\x0f\x02\x51\x1f\x91\xdf"
"\x71\x9c\xad\x77\x35\x28\x55\x6d"
"\xcd\x7a\xd9\xa3\x41\x98\x6b\x37"
"\x19\x0f\xbe\xae\x69\xb2\x25\x01"
"\xee\x0e\x51\x4b\x53\xea\x0f\x5f"
"\x85\x74\x79\x36\x32\x0a\x2a\x40"
"\xad\x6b\x78\x41\x54\x99\xe9\xc1"
"\x2b\x6c\x9b\x42\x21\xef\xe2\x50"
"\x56\x8d\x78\xdf\x58\xbe\x0a\x0f"
"\xfc\xfc\x0d\x2e\xd0\xcb\xa6\x0a"
"\xa8\xd9\x1e\xa9\xd4\x7c\x99\x88"
"\xcf\x11\xad\x1c\xd3\x04\x63\x55"
"\xef\x85\x0b\x69\xa1\x40\xf1\x75"
"\x24\xf4\xe5\x2c\xd4\x7a\x24\x50"
"\x8f\xa2\x71\xc9\x92\x20\xcd\xcf"
"\xda\x40\xbe\xf6\xfe\x1a\xca\xc7"
"\x4a\x80\x45\x55\xcb\xdd\xb7\x01"
"\xb0\x8d\xcb\xd2\xae\xbd\xa4\xd0"
"\x5c\x10\x05\x66\x7b\xd4\xff\xd9"
"\xc4\x23\x9d\x8d\x6b\x24\xf8\x3f"
"\x73\x4d\x5c\x2b\x33\x4c\x5e\x63"
"\x74\x6d\x03\xa1\x7a\x35\x65\x17"
"\x38\x7f\x3b\xc1\x69\xcf\x61\x34"
"\x30\x21\xaf\x97\x47\x12\x3f\xa1"
"\xa7\x50\xc5\x87\xfb\x3f\x70\x32"
"\x86\x17\x5f\x25\xe4\x74\xc6\xd0"
"\x9b\x39\xe6\xe1\x5a\xec\x8f\x40"
"\xce\xcc\x37\x3b\xd8\x72\x1c\x31"
"\x75\xa4\xa6\x89\x8c\xdd\xd6\xd2"
"\x32\x3d\xe8\xc3\x54\xab\x1f\x35"
"\x52\xb4\x94\x81\xb0\x37\x3a\x03"
"\xbb\xb1\x99\x30\xa5\xf8\x21\xcd"
"\x93\x5d\xa7\x13\xed\xc7\x49\x09"
"\x70\xda\x08\x39\xaa\x15\x9e\x45"
"\x35\x2b\x0f\x5c\x8c\x8b\xc9"
"\xa8\xb8\x9f\xfd\x37\x36\x31\x7e"
"\x34\x4f\xc1\xc0\xca\x8a\x22\xfd",
.clen = 735,
} }
}; };
...@@ -14947,6 +15586,282 @@ static const struct aead_testvec sm4_ccm_tv_template[] = { ...@@ -14947,6 +15586,282 @@ static const struct aead_testvec sm4_ccm_tv_template[] = {
"\x16\x84\x2D\x4F\xA1\x86\xF5\x6A" "\x16\x84\x2D\x4F\xA1\x86\xF5\x6A"
"\xB3\x32\x56\x97\x1F\xA1\x10\xF4", "\xB3\x32\x56\x97\x1F\xA1\x10\xF4",
.clen = 80, .clen = 80,
}, { /* Generated from AES-CCM test vectors */
.key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
"\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
.klen = 16,
.iv = "\x01\x00\x00\x00\x03\x02\x01\x00"
"\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00",
.assoc = "\x00\x01\x02\x03\x04\x05\x06\x07",
.alen = 8,
.ptext = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e",
.plen = 23,
.ctext = "\x7b\xff\x4a\x15\xf5\x73\xce\x82"
"\x6e\xc2\x31\x1d\xe2\x53\x02\xac"
"\xa4\x48\xf9\xe4\xf5\x1f\x81\x70"
"\x18\xbc\xb6\x84\x01\xb8\xae",
.clen = 31,
}, {
.key = "\xf4\x6b\xc2\x75\x62\xfe\xb4\xe1"
"\x53\x14\x73\x66\x8d\x88\xf6\x80",
.klen = 16,
.iv = "\x03\xa0\x20\x35\x26\xf2\x21\x8d"
"\x50\x20\xda\xe2\x00\x00\x00\x00",
.assoc = "\x5b\x9e\x13\x67\x02\x5e\xef\xc1"
"\x6c\xf9\xd7\x1e\x52\x8f\x7a\x47"
"\xe9\xd4\xcf\x20\x14\x6e\xf0\x2d"
"\xd8\x9e\x2b\x56\x10\x23\x56\xe7",
.alen = 32,
.ctext = "\x23\x58\xce\xdc\x40\xb1\xcd\x92"
"\x47\x96\x59\xfc\x8a\x26\x4f\xcf",
.clen = 16,
}, {
.key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1"
"\xff\x80\x2e\x48\x7d\x82\xf8\xb9",
.klen = 16,
.iv = "\x03\xaf\x94\x87\x78\x35\x82\x81"
"\x7f\x88\x94\x68\x00\x00\x00\x00",
.alen = 0,
.ptext = "\x00",
.plen = 0,
.ctext = "\x72\x7e\xf5\xd6\x39\x7a\x2b\x43",
.clen = 8,
}, {
.key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73"
"\xa4\x48\x93\x39\x26\x71\x4a\xc6",
.klen = 16,
.iv = "\x03\xee\x49\x83\xe9\xa9\xff\xe9"
"\x57\xba\xfd\x9e\x00\x00\x00\x00",
.assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1"
"\x58\x7c\xf2\x5c\x6d\x39\x0a\x64"
"\xa4\xf0\x13\x05\xd1\x77\x99\x67"
"\x11\xc4\xc6\xdb\x00\x56\x36\x61",
.alen = 32,
.ptext = "\x00",
.plen = 0,
.ctext = "\xb0\x9d\xc6\xfb\x7d\xb5\xa1\x0e",
.clen = 8,
}, {
.key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7"
"\x0d\x1a\x53\x3b\xb5\xe3\xf8\x8b",
.klen = 16,
.iv = "\x03\xcf\x76\x3f\xd9\x95\x75\x8f"
"\x44\x89\x40\x7b\x00\x00\x00\x00",
.assoc = "\x8f\x86\x6c\x4d\x1d\xc5\x39\x88"
"\xc8\xf3\x5c\x52\x10\x63\x6f\x2b"
"\x8a\x2a\xc5\x6f\x30\x23\x58\x7b"
"\xfb\x36\x03\x11\xb4\xd9\xf2\xfe",
.alen = 32,
.ptext = "\xc2\x54\xc8\xde\x78\x87\x77\x40"
"\x49\x71\xe4\xb7\xe7\xcb\x76\x61"
"\x0a\x41\xb9\xe9\xc0\x76\x54\xab"
"\x04\x49\x3b\x19\x93\x57\x25\x5d",
.plen = 32,
.ctext = "\xc9\xae\xef\x1d\xf3\x2c\xd3\x38"
"\xc9\x7f\x7e\x28\xe8\xaa\xb3\x60"
"\x49\xdc\x66\xca\x7b\x3d\xe0\x3c"
"\xcb\x45\x9c\x1b\xb2\xbe\x07\x90"
"\x87\xa6\x6b\x89\x0d\x0f\x90\xaa"
"\x7d\xf6\x5a\x9a\x68\x2b\x81\x92",
.clen = 48,
}, {
.key = "\x8b\x32\xcf\xe7\x44\xed\x13\x59"
"\x04\x38\x77\xb0\xb9\xad\xb4\x38",
.klen = 16,
.iv = "\x02\xff\xff\xff\xff\x00\x00\xff"
"\xff\xff\x00\xff\xff\x00\x00\x00",
.assoc = "\x8f\x86\x6c\x4d\x1d\xc5\x39\x88"
"\xc8\xf3\x5c\x52\x10\x63\x6f\x2b"
"\x8a\x2a\xc5\x6f\x30\x23\x58\x7b"
"\xfb\x36\x03\x11\xb4\xd9\xf2\xfe"
"\xc8\xf3\x5c\x52\x10\x63",
.alen = 38,
.ptext = "\x42\xc1\xcc\x08\x48\x6f\x41\x3f"
"\x2f\x11\x66\x8b\x2a\x16\xf0\xe0"
"\x58\x83\xf0\xc3\x70\x14\xc0\x5b"
"\x3f\xec\x1d\x25\x3c\x51\xd2\x03"
"\xcf\x59\x74\x1f\xb2\x85\xb4\x07"
"\xc6\x6a\x63\x39\x8a\x5b\xde\xcb"
"\xaf\x08\x44\xbd\x6f\x91\x15\xe1"
"\xf5\x7a\x6e\x18\xbd\xdd\x61\x50"
"\x59\xa9\x97\xab\xbb\x0e\x74\x5c"
"\x00\xa4\x43\x54\x04\x54\x9b\x3b"
"\x77\xec\xfd\x5c\xa6\xe8\x7b\x08"
"\xae\xe6\x10\x3f\x32\x65\xd1\xfc"
"\xa4\x1d\x2c\x31\xfb\x33\x7a\xb3"
"\x35\x23\xf4\x20\x41\xd4\xad\x82"
"\x8b\xa4\xad\x96\x1c\x20\x53\xbe"
"\x0e\xa6\xf4\xdc\x78\x49\x3e\x72"
"\xb1\xa9\xb5\x83\xcb\x08\x54\xb7"
"\xad\x49\x3a\xae\x98\xce\xa6\x66"
"\x10\x30\x90\x8c\x55\x83\xd7\x7c"
"\x8b\xe6\x53\xde\xd2\x6e\x18\x21"
"\x01\x52\xd1\x9f\x9d\xbb\x9c\x73"
"\x57\xcc\x89\x09\x75\x9b\x78\x70"
"\xed\x26\x97\x4d\xb4\xe4\x0c\xa5"
"\xfa\x70\x04\x70\xc6\x96\x1c\x7d"
"\x54\x41\x77\xa8\xe3\xb0\x7e\x96"
"\x82\xd9\xec\xa2\x87\x68\x55\xf9"
"\x8f\x9e\x73\x43\x47\x6a\x08\x36"
"\x93\x67\xa8\x2d\xde\xac\x41\xa9"
"\x5c\x4d\x73\x97\x0f\x70\x68\xfa"
"\x56\x4d\x00\xc2\x3b\x1f\xc8\xb9"
"\x78\x1f\x51\x07\xe3\x9a\x13\x4e"
"\xed\x2b\x2e\xa3\xf7\x44\xb2\xe7"
"\xab\x19\x37\xd9\xba\x76\x5e\xd2"
"\xf2\x53\x15\x17\x4c\x6b\x16\x9f"
"\x02\x66\x49\xca\x7c\x91\x05\xf2"
"\x45\x36\x1e\xf5\x77\xad\x1f\x46"
"\xa8\x13\xfb\x63\xb6\x08\x99\x63"
"\x82\xa2\xed\xb3\xac\xdf\x43\x19"
"\x45\xea\x78\x73\xd9\xb7\x39\x11"
"\xa3\x13\x7c\xf8\x3f\xf7\xad\x81"
"\x48\x2f\xa9\x5c\x5f\xa0\xf0\x79"
"\xa4\x47\x7d\x80\x20\x26\xfd\x63"
"\x0a\xc7\x7e\x6d\x75\x47\xff\x76"
"\x66\x2e\x8a\x6c\x81\x35\xaf\x0b"
"\x2e\x6a\x49\x60\xc1\x10\xe1\xe1"
"\x54\x03\xa4\x09\x0c\x37\x7a\x15"
"\x23\x27\x5b\x8b\x4b\xa5\x64\x97"
"\xae\x4a\x50\x73\x1f\x66\x1c\x5c"
"\x03\x25\x3c\x8d\x48\x58\x71\x34"
"\x0e\xec\x4e\x55\x1a\x03\x6a\xe5"
"\xb6\x19\x2b\x84\x2a\x20\xd1\xea"
"\x80\x6f\x96\x0e\x05\x62\xc7\x78"
"\x87\x79\x60\x38\x46\xb4\x25\x57"
"\x6e\x16\x63\xf8\xad\x6e\xd7\x42"
"\x69\xe1\x88\xef\x6e\xd5\xb4\x9a"
"\x3c\x78\x6c\x3b\xe5\xa0\x1d\x22"
"\x86\x5c\x74\x3a\xeb\x24\x26\xc7"
"\x09\xfc\x91\x96\x47\x87\x4f\x1a"
"\xd6\x6b\x2c\x18\x47\xc0\xb8\x24"
"\xa8\x5a\x4a\x9e\xcb\x03\xe7\x2a"
"\x09\xe6\x4d\x9c\x6d\x86\x60\xf5"
"\x2f\x48\x69\x37\x9f\xf2\xd2\xcb"
"\x0e\x5a\xdd\x6e\x8a\xfb\x6a\xfe"
"\x0b\x63\xde\x87\x42\x79\x8a\x68"
"\x51\x28\x9b\x7a\xeb\xaf\xb8\x2f"
"\x9d\xd1\xc7\x45\x90\x08\xc9\x83"
"\xe9\x83\x84\xcb\x28\x69\x09\x69"
"\xce\x99\x46\x00\x54\xcb\xd8\x38"
"\xf9\x53\x4a\xbf\x31\xce\x57\x15"
"\x33\xfa\x96\x04\x33\x42\xe3\xc0"
"\xb7\x54\x4a\x65\x7a\x7c\x02\xe6"
"\x19\x95\xd0\x0e\x82\x07\x63\xf9"
"\xe1\x2b\x2a\xfc\x55\x92\x52\xc9"
"\xb5\x9f\x23\x28\x60\xe7\x20\x51"
"\x10\xd3\xed\x6d\x9b\xab\xb8\xe2"
"\x5d\x9a\x34\xb3\xbe\x9c\x64\xcb"
"\x78\xc6\x91\x22\x40\x91\x80\xbe"
"\xd7\x78\x5c\x0e\x0a\xdc\x08\xe9"
"\x67\x10\xa4\x83\x98\x79\x23\xe7"
"\x92\xda\xa9\x22\x16\xb1\xe7\x78"
"\xa3\x1c\x6c\x8f\x35\x7c\x4d\x37"
"\x2f\x6e\x0b\x50\x5c\x34\xb9\xf9"
"\xe6\x3d\x91\x0d\x32\x95\xaa\x3d"
"\x48\x11\x06\xbb\x2d\xf2\x63\x88"
"\x3f\x73\x09\xe2\x45\x56\x31\x51"
"\xfa\x5e\x4e\x62\xf7\x90\xf9\xa9"
"\x7d\x7b\x1b\xb1\xc8\x26\x6e\x66"
"\xf6\x90\x9a\x7f\xf2\x57\xcc\x23"
"\x59\xfa\xfa\xaa\x44\x04\x01\xa7"
"\xa4\x78\xdb\x74\x3d\x8b\xb5",
.plen = 719,
.ctext = "\xc5\x50\x85\x02\x72\xa8\xb3\x62"
"\xf9\xcd\x77\x7b\x43\xa5\x04\x70"
"\x68\x40\x57\x21\x1c\xfe\xef\x05"
"\x4d\xb8\x44\xba\x59\xea\x62\x32"
"\xcb\x6b\x6a\x39\x9b\xf3\xe5\xa4"
"\x36\x38\xde\x7d\xcf\xb6\xcd\xe3"
"\x89\xbf\x37\xc9\x96\x3c\x70\x10"
"\x92\x47\xcc\xac\x6f\xf8\x55\x9a"
"\x26\x43\x34\xb4\x92\x7d\x68\xfc"
"\x60\x37\x74\x2a\x55\xba\xc7\xd7"
"\x98\x69\xb7\xcf\x42\xfd\xb2\x10"
"\xa0\x59\xe1\x2c\x73\x66\x12\x97"
"\x85\x8b\x28\xcc\x29\x02\x15\x89"
"\x23\xd3\x32\x92\x87\x57\x09\x13"
"\x04\x7e\x8b\x6c\x3a\xc1\x4e\x6c"
"\xe1\x9f\xc8\xcc\x47\x9c\xd8\x10"
"\xf4\xb7\x5c\x30\x7a\x8b\x0f\x01"
"\x52\x38\x02\x92\x99\xac\x03\x90"
"\x18\x32\x2d\x21\x6a\x0a\x2a\xe7"
"\xc2\xcc\x15\x84\x4e\x2b\x0b\x3a"
"\x4c\xdc\xb0\x6b\x10\xd1\x27\x10"
"\xf0\x4a\x5c\x43\xa0\x34\x34\x59"
"\x47\x43\x48\xcb\x69\xa7\xff\x52"
"\xb8\xca\x23\x09\x07\xd7\xc5\xe4"
"\x2a\x4f\x99\xd5\x83\x36\x2a\x2d"
"\x59\xd0\xca\xb0\xfa\x40\x8c\xab"
"\xdf\x69\x08\xd9\x79\x1d\xde\xa8"
"\x0b\x34\x74\x4d\xf5\xa0\x4c\x81"
"\x7f\x93\x06\x40\x24\xfe\x7d\xcd"
"\xe4\xfe\xf8\xf8\x30\xce\xd0\x5d"
"\x70\xfd\x0d\x5a\x78\x85\x74\x2d"
"\xe4\xb5\x40\x18\x99\x11\xe4\x6a"
"\xdf\xfa\x4f\x25\x2c\xde\x15\xb7"
"\x12\xd8\xc6\x90\x0d\x0f\xc9\xfb"
"\x21\xf1\xed\xfe\x98\xe1\x03\xe2"
"\x5c\xef\xb6\xc7\x87\x77\x0e\xcd"
"\xff\x78\x94\xc9\xbe\xd3\x47\xf7"
"\x8d\x37\x48\x01\x42\xe2\x17\x96"
"\xfc\xc0\xcb\x7b\x7b\x57\xaf\x3b"
"\xc9\xd0\x94\xce\x5e\x1b\xa9\x47"
"\x02\x4d\x74\xcc\x45\x1d\xd3\x2d"
"\x5f\x4f\x7f\xf2\x4b\xf9\x59\xee"
"\x9e\x9e\xb9\x95\x29\x19\xd1\x5f"
"\x72\xab\x8d\xf1\x28\xd1\x1c\xae"
"\xc2\xba\xf7\x22\x84\x2c\x83\x51"
"\x03\xad\xa3\xef\x81\xa7\xdc\xf1"
"\x44\x51\x50\x96\x70\xd1\xe5\x47"
"\x57\xf9\x30\x90\xe4\xbf\xfc\x75"
"\x14\xaa\x4d\xb7\xb1\xe7\x79\x33"
"\x43\xc2\x5c\xc1\xbc\x09\x92\x0f"
"\xa7\xaf\x68\x51\x51\xec\x0b\xc3"
"\x3d\x2b\x94\x30\x45\x29\x1b\x9e"
"\x70\x56\xf8\xd6\x67\x2d\x39\x3b"
"\x3c\xd2\xd0\xd3\xdc\x7d\x84\xe9"
"\x06\x31\x98\xa6\x5c\xbf\x10\x58"
"\xce\xbb\xa7\xe1\x65\x7e\x51\x87"
"\x70\x46\xb4\x7f\xf9\xec\x92\x1c"
"\x9b\x24\x49\xc1\x04\xbe\x1c\x5f"
"\xcc\xb3\x33\x8c\xad\xe7\xdc\x32"
"\x54\xa2\x0d\x83\x0f\x3c\x12\x5d"
"\x71\xe3\x9c\xae\x71\xa3\x2a\x10"
"\xc5\x91\xb4\x73\x96\x60\xdb\x5d"
"\x1f\xd5\x9a\xd2\x69\xc3\xd7\x4b"
"\xa2\x66\x81\x96\x4a\xaa\x02\xd6"
"\xd5\x44\x9b\x42\x3a\x15\x5f\xe7"
"\x4d\x7c\xf6\x71\x4a\xea\xe8\x43"
"\xd7\x68\xe4\xbc\x05\x87\x49\x05"
"\x3b\x47\xb2\x6d\x5f\xd1\x11\xa6"
"\x58\xd4\xa2\x45\xec\xb5\x54\x55"
"\xd3\xd6\xd2\x6a\x8b\x21\x9e\x2c"
"\xf1\x27\x4b\x5b\xe3\xff\xe0\xfd"
"\x4b\xf1\xe7\xe2\x84\xf2\x17\x37"
"\x11\x68\xc4\x92\x4b\x6b\xef\x8e"
"\x75\xf5\xc2\x7d\x5c\xe9\x7c\xfc"
"\x2b\x00\x33\x0e\x7d\x69\xd8\xd4"
"\x9b\xa8\x38\x54\x7e\x6d\x23\x51"
"\x2c\xd6\xc4\x58\x23\x1c\x22\x2a"
"\x59\xc5\x9b\xec\x9d\xbf\x03\x0f"
"\xb3\xdd\xba\x02\x22\xa0\x34\x37"
"\x19\x56\xc2\x5b\x32\x1d\x1e\x66"
"\x68\xf4\x47\x05\x04\x18\xa7\x28"
"\x80\xf2\xc7\x99\xed\x1e\x72\x48"
"\x8f\x97\x5d\xb3\x74\x42\xfd\x0c"
"\x0f\x5f\x29\x0c\xf1\x35\x22\x90"
"\xd6\x7c\xb8\xa3\x2a\x89\x38\x71"
"\xe9\x7a\x55\x3c\x3b\xf2\x6e\x1a"
"\x22\x8f\x07\x81\xc1\xe1\xf1\x76"
"\x2a\x75\xab\x86\xc4\xcc\x52\x59"
"\x83\x19\x5e\xb3\x53\xe2\x81\xdf"
"\xe6\x15\xb3\xba\x0c\x0e\xba"
"\xa9\x2c\xed\x51\xd5\x06\xc8\xc6"
"\x4b\x9f\x5d\x1b\x61\x31\xad\xf4",
.clen = 735,
} }
}; };
...@@ -15030,6 +15945,68 @@ static const struct hash_testvec sm4_cmac128_tv_template[] = { ...@@ -15030,6 +15945,68 @@ static const struct hash_testvec sm4_cmac128_tv_template[] = {
} }
}; };
static const struct hash_testvec sm4_xcbc128_tv_template[] = {
{ /* Generated from AES-XCBC128 test vectors */
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.plaintext = zeroed_string,
.digest = "\xa9\x9a\x5c\x44\xe2\x34\xee\x2c"
"\x9b\xe4\x9d\xca\x64\xb0\xa5\xc4",
.psize = 0,
.ksize = 16,
}, {
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.plaintext = "\x00\x01\x02",
.digest = "\x17\x27\x62\xf3\x8b\x88\x1d\xc0"
"\x97\x35\x9c\x3e\x9f\x27\xb7\x83",
.psize = 3,
.ksize = 16,
} , {
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.digest = "\xda\x45\xd1\xac\xec\x4d\xab\x46"
"\xdd\x59\xe0\x44\xff\x59\xd5\xfc",
.psize = 16,
.ksize = 16,
}, {
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13",
.digest = "\xbe\x24\x5d\x81\x8c\x8a\x10\xa4"
"\x8e\xc2\x16\xfa\xa4\x83\xc9\x2a",
.psize = 20,
.ksize = 16,
}, {
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
.digest = "\x91\x82\x31\x56\xd5\x77\xa4\xc5"
"\x88\x2d\xce\x3a\x87\x5e\xbd\xba",
.psize = 32,
.ksize = 16,
}, {
.key = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
.plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
"\x20\x21",
.digest = "\x2a\xae\xa5\x24\x0c\x12\x9f\x5f"
"\x55\xfb\xae\x35\x13\x0d\x22\x2d",
.psize = 34,
.ksize = 16,
}
};
/* Cast6 test vectors from RFC 2612 */ /* Cast6 test vectors from RFC 2612 */
static const struct cipher_testvec cast6_tv_template[] = { static const struct cipher_testvec cast6_tv_template[] = {
{ {
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