SM4KS

SM4 Key Schedule

SM4KS rd, rs1, rs2, bs

Accelerates the SM4 key schedule generation.

Details

SM4KS performs one step of the SM4 key schedule by applying the S-box and key-schedule linear transformation to four bytes from rs2, XORing with rs1, and accumulating into rd.

Pseudocode Operation

rd = SM4_KeyGen(rs1, rs2, bs);

Example

SM4KS t0, a0, a1, bs

Encoding

Binary Layout
110100
31:26
bs
rs2
25:21
rs1
20:16
000
15:13
rd
12:8
0110011
7:1
 
Format R-Type
Opcode 0x33
Extension Zksh

Operands

  • rd
    Destination register (integer)
  • rs1
    Source register 1 (integer)
  • rs2
    Source register 2 (integer)
  • bs
    Byte Select