EVP_CIPHER-SM4(7SSL)

πŸ’– EVP_CIPHER-SM4 πŸ’–

okay bestie, so this is the EVP_CIPHER-SM4(7SSL) page from the OpenSSL manual set. it's giving "cipher documentation but make it cute." buckle up πŸŽ€


✨ NAME ✨

EVP_CIPHER-SM4 β€” the SM4 EVP_CIPHER implementations, aka the whole girlboss lineup of SM4 ciphers you can pull through the EVP API πŸ¦‹


🌸 DESCRIPTION 🌸

so basically? support for SM4 symmetric encryption using the EVP_CIPHER API. that's the whole vibe. symmetric, slay, encrypted. πŸ’…

πŸŽ€ Algorithm Names πŸŽ€

these are the algorithms available in the default provider β€” no cap, here's the full roster:

  • "SM4-CBC:SM4"
  • "SM4-ECB"
  • "SM4-CTR"
  • "SM4-OFB" or "SM4-OFB128"
  • "SM4-CFB" or "SM4-CFB128"
  • "SM4-GCM"
  • "SM4-CCM"
  • "SM4-XTS"

not me listing every single one because every single one matters 😀 periodt.

πŸ¦‹ Parameters πŸ¦‹

this implementation supports the parameters described in "PARAMETERS" in EVP_EncryptInit(3). iykyk πŸ’œ


πŸ‘‘ NOTES πŸ‘‘

okay listen, this part is important so pay attention bestie:

SM4 implementations in OpenSSL may use secret-dependent table lookups and are not guaranteed to be constant-time. in particular, the portable C implementation uses S-box and T-table lookups and may be vulnerable to cache-timing side-channel attacks. πŸ’€ so like… treat that accordingly.

which code path is used depends on CPU capabilities β€” check OPENSSL_armcap(3), OPENSSL_ia32cap(3) and OPENSSL_riscvcap(3). πŸ”₯

⚠️ also the SM4-XTS implementation allows streaming to be performed, but each EVP_EncryptUpdate(3) or EVP_DecryptUpdate(3) call requires each input to be a multiple of the blocksize. only the final EVP_EncryptUpdate() or EVP_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 read those too, they're iconic in their own right πŸ’…


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 whole page, bestie!! this was version 4.0.3 dated 2026-09-29 β€” thanks for reading, ily, go encrypt something responsibly βœ¨πŸ’–πŸŽ€πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from