mirror of
https://github.com/herumi/xbyak
synced 2024-11-21 16:09:11 -07:00
add tests of SM4
This commit is contained in:
parent
e1c4c360b7
commit
d9e76b1c6d
1 changed files with 14 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue