EVP_CIPHER-SM4(7ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’… 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 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