From d9e76b1c6d7545eb4596ef20065b2f46bdb0eeef Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Mon, 7 Aug 2023 09:42:25 +0900 Subject: add tests of SM4 --- test/misc.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/misc.cpp') diff --git a/test/misc.cpp b/test/misc.cpp index 56e6bfc..1d1e6af 100644 --- a/test/misc.cpp +++ b/test/misc.cpp @@ -2185,18 +2185,32 @@ CYBOZU_TEST_AUTO(crypto) vsm3msg2(xmm5, xmm6, ptr [rax]); vsm3rnds2(xmm5, xmm7, xmm3, 0x12); vsm3rnds2(xmm5, xmm7, ptr [rcx], 0x34); + + vsm4key4(xmm1, xmm2, xmm3); + vsm4key4(xmm1, xmm2, ptr [rdx]); + vsm4rnds4(xmm1, xmm2, xmm3); + vsm4rnds4(xmm5, xmm6, ptr [rcx+rax*4]); } } c; const uint8_t tbl[] = { + // sha512 0xc4, 0xe2, 0x7f, 0xcc, 0xdd, 0xc4, 0x42, 0x7f, 0xcd, 0xca, 0xc4, 0xe2, 0x67, 0xcb, 0xca, + + // sm3 0xC4, 0xE2, 0x68, 0xDA, 0xCB, 0xC4, 0xE2, 0x68, 0xDA, 0x08, 0xC4, 0xE2, 0x41, 0xDA, 0xEB, 0xC4, 0xE2, 0x49, 0xDA, 0x28, 0xC4, 0xE3, 0x41, 0xDE, 0xEB, 0x12, 0xC4, 0xE3, 0x41, 0xDE, 0x29, 0x34, + + // sm4 + 0xc4, 0xe2, 0x6a, 0xda, 0xcb, + 0xc4, 0xe2, 0x6a, 0xda, 0x0a, + 0xc4, 0xe2, 0x6b, 0xda, 0xcb, + 0xc4, 0xe2, 0x4b, 0xda, 0x2c, 0x81, }; const size_t n = sizeof(tbl) / sizeof(tbl[0]); CYBOZU_TEST_EQUAL(c.getSize(), n); -- cgit v1.2.3