[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 4/6] target/riscv: rvk: add implementation of instructions for

From: liweiwei
Subject: Re: [RFC 4/6] target/riscv: rvk: add implementation of instructions for Zk*
Date: Wed, 3 Nov 2021 09:08:33 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

在 2021/11/3 上午2:56, Richard Henderson 写道:
On 11/1/21 11:11 PM, liweiwei wrote:
+uint8_t AES_ENC_SBOX[] = {
+  0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
+  0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
+  0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
+  0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,

Use "crypto/aes.h".

OK. I'll reuse this.

+/* SM4 forward SBox. SM4 has no inverse sbox. */
+static const uint8_t sm4_sbox[256] = {
+    0xD6, 0x90, 0xE9, 0xFE, 0xCC, 0xE1, 0x3D, 0xB7, 0x16, 0xB6, 0x14, 0xC2, +    0x28, 0xFB, 0x2C, 0x05, 0x2B, 0x67, 0x9A, 0x76, 0x2A, 0xBE, 0x04, 0xC3, +    0xAA, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99, 0x9C, 0x42, 0x50, 0xF4,

Hmm.  We have an existing copy of this in target/arm/crypto_helper.c.  I think we should move that code out to a shared location like aes.
OK. I'll try to move it.

+#define sext_xlen(x) (((int64_t)(x) << (XLEN - 32)) >> (XLEN  - 32))

This is (target_ulong)(int32_t)(x).

OK. I'll improve this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]