EVP_CIPHER-SM4(7ossl)
π EVP_CIPHER-SM4 π
okay so this is a page from the OpenSSL manual set, bestie β it's EVP_CIPHER-SM4(7ossl), and it's literally all about the SM4 EVP_CIPHER implementations. buckle up, it's short but it's iconic π
β¨ NAME β¨
EVP_CIPHER-SM4 β the SM4 EVP_CIPHER implementations. that's it, that's the whole vibe π
πΈ DESCRIPTION πΈ
so this is all about support for SM4 symmetric encryption using the EVP_CIPHER API. yes queen, symmetric encryption, we love to see it π₯
π¦ Algorithm Names π¦
the following algorithms are available in the default provider, 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"
that's eight entries, i counted, you're welcome π
π Parameters π
this implementation supports the parameters described in "PARAMETERS" in EVP_EncryptInit(3). go read that one too, i'm not doing your homework for you (jk i literally am) π«Ά
β NOTES β
okay this is the part where you actually have to pay attention, bestie, because the SM4-XTS implementation allows streaming to be performed β BUT (big but) each EVP_EncryptUpdate(3) or EVP_DecryptUpdate(3) call requires each input to be a multiple of the blocksize. like, every single one. no exceptions π
only the final EVP_EncryptUpdate() or EVP_DecryptUpdate() call can optionally have an input that is not a multiple of the blocksize, but it has to be larger than one block. in that case ciphertext stealing (CTS) is used to fill the block. cute name, serious business π
ngl if you send a non-multiple-of-blocksize input in a non-final call, that's not the moment. read it again. i'll wait. β
π SEE ALSO π
go click around, it's giving rabbit hole and honestly i'm obsessed πβ¨
π COPYRIGHT π
Copyright 2021 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>.
k bye bestie, go encrypt something symmetric π this was EVP_CIPHER-SM4(7ossl) from OpenSSL 3.5.6, dated 2026-04-07 β stay slaying, protect your keys, and remember: multiple of the blocksize. periodt. π
ππ¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms