SM4 (cipher)
Chinese block cipher

ShāngMì 4 (SM4, 商密4) (formerly SMS4) is a block cipher, standardised for commercial cryptography in China. It is used in the Chinese National Standard for Wireless LAN WAPI (WLAN Authentication and Privacy Infrastructure), and with Transport Layer Security.
SM4 was a cipher proposed for the IEEE 802.11i standard, but it has so far been rejected. One of the reasons for the rejection has been opposition to the WAPI fast-track proposal by the IEEE.
SM4 was published as GM/T 0002 in 2012 and ISO/IEC 18033-3/Amd 1 in 2021.
The SM4 algorithm was drafted by Data Assurance & Communication Security Center, Chinese Academy of Sciences (CAS), and Commercial Cryptography Testing Center, National Cryptography Administration. It is mainly developed by Lü Shuwang (Chinese: 吕述望). The algorithm was declassified in January, 2006, and it became a national standard (GB/T 32907-2016) in August 2016.
01Cipher detail
The SM4 cipher has a key size and a block size of 128 bits each. Encryption or decryption of one block of data is composed of 32 rounds. A non-linear key schedule is used to produce the round keys and the decryption uses the same round keys as for encryption, except that they are in reversed order.
Keys and key parameters
The length of encryption keys is 128 bits, represented as , in which
is a 32-bit word. The round keys are represented by
, where each
is a 32-bit word. It is generated by the encryption key and the following parameters:
and
are 32-bit words used to generate the round keys.
Round
Each round are computed from the four previous round outputs such that:
Where is a substitution function composed of a non-linear transform, the S-box and linear transform
S-box
SM4's S-box is fixed for 8-bit input and 8-bit output, noted as Sbox(). As with Advanced Encryption Standard (AES), the S-box is based on the multiplicative inverse over GF(28). The affine transforms and polynomial bases are different from that of AES, but due to affine isomorphism it can be calculated efficiently given an AES S-Box.
02History
On March 21, 2012, the Chinese government published the industrial standard "GM/T 0002-2012 SM4 Block Cipher Algorithm", officially renaming SMS4 to SM4.
A description of SM4 in English is available as an Internet Draft. It contains a reference implementation in ANSI C.
SM4 is part of the ARMv8.4-A expansion to the ARM architecture. SM4 support for the RISC-V architecture was ratified in 2021 as the Zksed extension.
SM4 is supported by Intel processors, starting from Arrow Lake S, Lunar Lake, Diamond Rapids and Clearwater Forest.
Sources and credits
This article is adapted from the Wikipedia article “SM4 (cipher)”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Images, from Wikimedia Commons:
- SM4 round.svg by Ipolite, CC BY-SA 4.0
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.