---
name: "EVP_CIPHER-SM4"
section: "7ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/EVP_CIPHER-SM4"
---

# EVP\_CIPHER-SM4(7ssl)

The SM4 EVP\_CIPHER implementations

## NAME

EVP\_CIPHER-SM4 - The SM4 EVP\_CIPHER implementations

## DESCRIPTION

Support for SM4 symmetric encryption using the **EVP\_CIPHER** API.

### Algorithm Names

The following algorithms are available in the default provider:

- "SM4-CBC:SM4"

  - "SM4-ECB"

  - "SM4-CTR"

  - "SM4-OFB" or "SM4-OFB128"

  - "SM4-CFB" or "SM4-CFB128"

  - "SM4-GCM"

  - "SM4-CCM"

  - "SM4-XTS"

  ### Parameters

This implementation supports the parameters described in "PARAMETERS" in **EVP\_EncryptInit**(3).

## NOTES

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. Which code path is used depends on CPU capabilities; see **OPENSSL\_armcap**(3), **OPENSSL\_ia32cap**(3) and **OPENSSL\_riscvcap**(3).

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

**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\>.
