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
bs
31:30
11010
29:25
rs2
24:20
rs1
19:15
000
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x34000033
Extension Zksh

Operands

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