aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/misc.cpp
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2023-08-07 09:42:25 +0900
committerMITSUNARI Shigeo <[email protected]>2023-08-07 09:42:25 +0900
commitd9e76b1c6d7545eb4596ef20065b2f46bdb0eeef (patch)
tree458542c8b70c3469e6165c14a88224b42be2e41b /test/misc.cpp
parente1c4c360b7e26eb8dbc7adb90ca6c177cfc64a12 (diff)
downloadxbyak-d9e76b1c6d7545eb4596ef20065b2f46bdb0eeef.tar.gz
xbyak-d9e76b1c6d7545eb4596ef20065b2f46bdb0eeef.zip
add tests of SM4
Diffstat (limited to 'test/misc.cpp')
-rw-r--r--test/misc.cpp14
1 files changed, 14 insertions, 0 deletions
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);