crypto: testmgr - Added testvectors for the rfc3686(ctr(sm4)) skcipher

Added testvectors for the rfc3686(ctr(sm4)) skcipher algorithm

changes since v1:
- nothing

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Pascal van Leeuwen 2019-09-13 11:10:42 +02:00 committed by Herbert Xu
parent f77e5dc08a
commit e48862147f
2 changed files with 35 additions and 0 deletions

View File

@ -4846,6 +4846,12 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = {
.cipher = __VECS(aes_ctr_rfc3686_tv_template)
}
}, {
.alg = "rfc3686(ctr(sm4))",
.test = alg_test_skcipher,
.suite = {
.cipher = __VECS(sm4_ctr_rfc3686_tv_template)
}
}, {
.alg = "rfc4106(gcm(aes))",
.generic_driver = "rfc4106(gcm_base(ctr(aes-generic),ghash-generic))",

View File

@ -11902,6 +11902,35 @@ static const struct cipher_testvec sm4_ctr_tv_template[] = {
}
};
static const struct cipher_testvec sm4_ctr_rfc3686_tv_template[] = {
{
.key = "\xae\x68\x52\xf8\x12\x10\x67\xcc"
"\x4b\xf7\xa5\x76\x55\x77\xf3\x9e"
"\x00\x00\x00\x30",
.klen = 20,
.iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
.ptext = "Single block msg",
.ctext = "\x20\x9b\x77\x31\xd3\x65\xdb\xab"
"\x9e\x48\x74\x7e\xbd\x13\x83\xeb",
.len = 16,
}, {
.key = "\x7e\x24\x06\x78\x17\xfa\xe0\xd7"
"\x43\xd6\xce\x1f\x32\x53\x91\x63"
"\x00\x6c\xb6\xdb",
.klen = 20,
.iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b",
.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",
.ctext = "\x33\xe0\x28\x01\x92\xed\xc9\x1e"
"\x97\x35\xd9\x4a\xec\xd4\xbc\x23"
"\x4f\x35\x9f\x1c\x55\x1f\xe0\x27"
"\xe0\xdf\xc5\x43\xbc\xb0\x23\x94",
.len = 32,
}
};
static const struct cipher_testvec sm4_ofb_tv_template[] = {
{ /* From: draft-ribose-cfrg-sm4-02, paragraph 12.2.3 */
.key = "\x01\x23\x45\x67\x89\xab\xcd\xef"