From e690a2a47d7a48a4ebdcaf984afe67d2eb650224 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 20 Dec 2023 14:47:14 +0900 Subject: sha* supports apx --- test/apx.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') diff --git a/test/apx.cpp b/test/apx.cpp index b2675b8..207389c 100644 --- a/test/apx.cpp +++ b/test/apx.cpp @@ -1870,3 +1870,31 @@ CYBOZU_TEST_AUTO(encodekey) CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n); } +CYBOZU_TEST_AUTO(sha) +{ + struct Code : Xbyak::CodeGenerator { + Code() + { + sha1msg1(xmm15, ptr [r30+r29*8+0x12]); + sha1msg2(xmm15, ptr [r30+r29*8+0x12]); + sha1nexte(xmm15, ptr [r30+r29*8+0x12]); + sha256msg1(xmm15, ptr [r30+r29*8+0x12]); + sha256msg2(xmm15, ptr [r30+r29*8+0x12]); + sha256rnds2(xmm15, ptr [r30+r29*8+0x12]); + sha1rnds4(xmm15, ptr [r30+r29*8+0x12], 0x23); + } + } c; + const uint8_t tbl[] = { + 0x62, 0x1c, 0x78, 0x08, 0xd9, 0x7c, 0xee, 0x12, + 0x62, 0x1c, 0x78, 0x08, 0xda, 0x7c, 0xee, 0x12, + 0x62, 0x1c, 0x78, 0x08, 0xd8, 0x7c, 0xee, 0x12, + 0x62, 0x1c, 0x78, 0x08, 0xdc, 0x7c, 0xee, 0x12, + 0x62, 0x1c, 0x78, 0x08, 0xdd, 0x7c, 0xee, 0x12, + 0x62, 0x1c, 0x78, 0x08, 0xdb, 0x7c, 0xee, 0x12, + 0x62, 0x1c, 0x78, 0x08, 0xd4, 0x7c, 0xee, 0x12, 0x23, + }; + const size_t n = sizeof(tbl); + CYBOZU_TEST_EQUAL(c.getSize(), n); + CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n); +} + -- cgit v1.2.3