Skip to content

SM4 is a block encryption algorithm

Notifications You must be signed in to change notification settings

hushunkui/SM4-FPGA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SM4-FPGA

Implementation of high-speed SM4 encryption and decryption on FPGA.

Please see this blog post for details.

Toplevel module

Signal Name Description
CLK_i System clock
RST_N_i Asynchronous reset input (falling edge valid)
MK_i 128bit key input
MK_VALID_i Indicates whether the key input is valid
DAT_i 128 bit plaintext (ciphertext) block input
DAT_VALID_i Indicates whether the block input is valid
DAT_o 128 bit ciphertext (plaintext) block output
DAT_READY_o Indicates whether the block output is valid

Overview of internal modules

keyexp implements key expansion algorithm.

decenc implements nonlinear iterative algorithm for encryption / decryption.

Parameters

The top module can implement both encryption and decryption. In addition, it can be configured to use a fixed round key to save the resources.

Parameters Description Default
MODE 0: Encryption; 1: Decryption
ENABLE_FIXED_RK 0: Do not use fixed round key; 1: Use fixed round key 0
FIXED_RK If fixed round key is used (ENABLE_FIXED_RK=1), specify 1024bit round key 128’h0

Note: If you set ENABLE_FIXED_RK=1, then fixed round key is used, and the port MK_I and MK_VALID_I are out of function.

Resource utilization

Timing(Fclk=100MHz)

$ F_{max} = \frac{1}{T-WNS} = 130 MHz $

Power

About

SM4 is a block encryption algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published