EVP_CIPHER-SM4(7ossl)
π EVP_CIPHER-SM4 π
okay so bestie, this is the 7ossl manual page for EVP_CIPHER-SM4 β the whole vibe is The SM4 EVP_CIPHER implementations β¨ like, that's literally the NAME, and we're gonna get into it.
πΈ DESCRIPTION πΈ
So basically: this is all about support for SM4 symmetric encryption using the EVP_CIPHER API. That's the whole deal. Slay.
π Algorithm Names π
The following algorithms are available in the default provider β like, these are the actual strings you type, no cap:
"SM4-CBC:SM4""SM4-ECB""SM4-CTR""SM4-OFB"or"SM4-OFB128""SM4-CFB"or"SM4-CFB128""SM4-GCM""SM4-CCM""SM4-XTS"
iykyk what to do with these π
π¦ Parameters π¦
This implementation supports the parameters described in "PARAMETERS" in EVP_EncryptInit(3). that's it, that's the section, go read that one, it's giving very cross-reference β¨
π NOTES π
okay this part is the serious one, bestie, so listen up fr fr π
SM4 implementations in OpenSSL may use secret-dependent table lookups and are not guaranteed to be constant-time. and like, that's not me being dramatic, that's literally in there π In particular, the portable C implementation uses S-box and T-table lookups and may be vulnerable to cache-timing side-channel attacks. so yeah, that's a real thing to care about.
Which code path is used depends on CPU capabilities β see OPENSSL_armcap(3), OPENSSL_ia32cap(3) and OPENSSL_riscvcap(3). π§
ngl this next bit is the sneaky one. TheSM4-XTSimplementation allows streaming to be performed, but eachEVP_EncryptUpdate(3)orEVP_DecryptUpdate(3)call requires each input to be a multiple of the blocksize. Only the finalEVP_EncryptUpdate()orEVP_DecryptUpdate()call can optionally have an input that is not a multiple of the blocksize but is larger than one block. In that case ciphertext stealing (CTS) is used to fill the block. π β¨
π SEE ALSO π
go be nosy, these are all iconic:
OPENSSL_armcap(3)OPENSSL_ia32cap(3)OPENSSL_riscvcap(3)OSSL_PROVIDER-default(7)provider-cipher(7)
π COPYRIGHT π
Copyright 2021-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. π«Ά
and that's the page, bestie!! this one's from version 3.5.9, dated 2026-09-29, filed under EVP_CIPHER-SM4(7ossl) β main character energy, periodt. πππ¦
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms