From 95ba597367ddc26c1062c7ee9697c9aee53d04d0 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Thu, 20 Sep 2018 14:18:38 +0100 Subject: crypto: testmgr - update sm4 test vectors Add additional test vectors from "The SM4 Blockcipher Algorithm And Its Modes Of Operations" draft-ribose-cfrg-sm4-10 and register cipher speed tests for sm4. Signed-off-by: Gilad Ben-Yossef Signed-off-by: Herbert Xu --- crypto/tcrypt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'crypto/tcrypt.c') diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 4385abe1f547..9430744b6f8e 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -2031,6 +2031,8 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) break; case 191: ret += tcrypt_test("ecb(sm4)"); + ret += tcrypt_test("cbc(sm4)"); + ret += tcrypt_test("ctr(sm4)"); break; case 200: test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, @@ -2280,6 +2282,20 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) num_mb); break; + case 218: + test_cipher_speed("ecb(sm4)", ENCRYPT, sec, NULL, 0, + speed_template_16); + test_cipher_speed("ecb(sm4)", DECRYPT, sec, NULL, 0, + speed_template_16); + test_cipher_speed("cbc(sm4)", ENCRYPT, sec, NULL, 0, + speed_template_16); + test_cipher_speed("cbc(sm4)", DECRYPT, sec, NULL, 0, + speed_template_16); + test_cipher_speed("ctr(sm4)", ENCRYPT, sec, NULL, 0, + speed_template_16); + test_cipher_speed("ctr(sm4)", DECRYPT, sec, NULL, 0, + speed_template_16); + break; case 300: if (alg) { test_hash_speed(alg, sec, generic_hash_speed_template); -- cgit v1.2.3