[Top][All Lists]

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

[PATCH v9 00/14] support subsets of scalar crypto extension

From: Weiwei Li
Subject: [PATCH v9 00/14] support subsets of scalar crypto extension
Date: Fri, 18 Mar 2022 12:19:30 +0800

This patchset implements RISC-V scalar crypto extension v1.0.0 version 
Partial instructions are reused from B-extension.


The port is available here:

To test rvk implementation, specify cpu argument with 'zks=true,zkn=true' or 
 to enable K-extension support. This implementation can pass the ACT tests for 
K with our extended act support for qemu (available at 

Review status:
patch 1~9 and 14 are acked or reviewed by Alistair Francis
patch 2~11 are reviewed by Richard Henderson
patch 5 is reviewed by Philippe Mathieu-Daudé

* check whether seed is accessed by a read-write instruction in helper_csrr.
* fix disas for partial scalar crypto instructions
* rebase on 

* replace large macro for trans function of sha256/512 instructions with 
parameters to gen_sha* function in patch 8,9,10
* fix tcg_const_tl to tcg_constant_tl
* fix rmw_seed function

* reuse gen_unary/gen_arith to simplify trans_* functions
* replace DEF_HELPER_* with DEF_HEPER_FLAG_*
* move aes64 related macros from patch 6 to patch 7
* create common helper gen_aes32_sm4 for aes32 and sm4 related instructions
* replace bs with shamt (bs << 3)
* optimize trans function for sha256, sha512 and sm4 instructions to be 
generated inline

* add reviewed-by tags
* rebase on upstream

* split the big patches

* drop "x-" in exposed properties
* delete unrelated changes

* add extension check for SEED csr access

* optimize implementation for brev8, xperm, zip, unzip
* use aes related sbox array from crypto/aes.h
* move sm4_sbox to crypto/sm4.c, and share it with target/arm

Weiwei Li (14):
  target/riscv: rvk: add cfg properties for zbk* and zk*
  target/riscv: rvk: add support for zbkb extension
  target/riscv: rvk: add support for zbkc extension
  target/riscv: rvk: add support for zbkx extension
  crypto: move sm4_sbox from target/arm
  target/riscv: rvk: add support for zknd/zkne extension in RV32
  target/riscv: rvk: add support for zkne/zknd extension in RV64
  target/riscv: rvk: add support for sha256 related instructions in zknh
  target/riscv: rvk: add support for sha512 related instructions for
    RV32 in zknh extension
  target/riscv: rvk: add support for sha512 related instructions for
    RV64 in zknh extension
  target/riscv: rvk: add support for zksed/zksh extension
  target/riscv: rvk: add CSR support for Zkr
  disas/riscv.c: rvk: add disas support for Zbk* and Zk* instructions
  target/riscv: rvk: expose zbk* and zk* properties

 crypto/meson.build                      |   1 +
 crypto/sm4.c                            |  49 +++
 disas/riscv.c                           | 173 ++++++++++-
 include/crypto/sm4.h                    |   6 +
 target/arm/crypto_helper.c              |  36 +--
 target/riscv/bitmanip_helper.c          |  80 +++++
 target/riscv/cpu.c                      |  36 +++
 target/riscv/cpu.h                      |  13 +
 target/riscv/cpu_bits.h                 |   9 +
 target/riscv/crypto_helper.c            | 302 +++++++++++++++++++
 target/riscv/csr.c                      |  68 +++++
 target/riscv/helper.h                   |  22 ++
 target/riscv/insn32.decode              |  97 ++++--
 target/riscv/insn_trans/trans_rvb.c.inc | 116 +++++++-
 target/riscv/insn_trans/trans_rvk.c.inc | 380 ++++++++++++++++++++++++
 target/riscv/meson.build                |   3 +-
 target/riscv/op_helper.c                |   9 +
 target/riscv/pmp.h                      |   8 +-
 target/riscv/translate.c                |   8 +
 19 files changed, 1345 insertions(+), 71 deletions(-)
 create mode 100644 crypto/sm4.c
 create mode 100644 include/crypto/sm4.h
 create mode 100644 target/riscv/crypto_helper.c
 create mode 100644 target/riscv/insn_trans/trans_rvk.c.inc


reply via email to

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