---
name: "EVP_aes"
section: "3ssl"
platform: "linux"
package: "libssl-doc"
version: "1.1.1w-0+deb11u1"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/EVP_aes"
---

# EVP\_aes(3ssl)

EVP AES cipher

## NAME

EVP\_aes\_128\_cbc, EVP\_aes\_192\_cbc, EVP\_aes\_256\_cbc, EVP\_aes\_128\_cfb, EVP\_aes\_192\_cfb, EVP\_aes\_256\_cfb, EVP\_aes\_128\_cfb1, EVP\_aes\_192\_cfb1, EVP\_aes\_256\_cfb1, EVP\_aes\_128\_cfb8, EVP\_aes\_192\_cfb8, EVP\_aes\_256\_cfb8, EVP\_aes\_128\_cfb128, EVP\_aes\_192\_cfb128, EVP\_aes\_256\_cfb128, EVP\_aes\_128\_ctr, EVP\_aes\_192\_ctr, EVP\_aes\_256\_ctr, EVP\_aes\_128\_ecb, EVP\_aes\_192\_ecb, EVP\_aes\_256\_ecb, EVP\_aes\_128\_ofb, EVP\_aes\_192\_ofb, EVP\_aes\_256\_ofb, EVP\_aes\_128\_cbc\_hmac\_sha1, EVP\_aes\_256\_cbc\_hmac\_sha1, EVP\_aes\_128\_cbc\_hmac\_sha256, EVP\_aes\_256\_cbc\_hmac\_sha256, EVP\_aes\_128\_ccm, EVP\_aes\_192\_ccm, EVP\_aes\_256\_ccm, EVP\_aes\_128\_gcm, EVP\_aes\_192\_gcm, EVP\_aes\_256\_gcm, EVP\_aes\_128\_ocb, EVP\_aes\_192\_ocb, EVP\_aes\_256\_ocb, EVP\_aes\_128\_wrap, EVP\_aes\_192\_wrap, EVP\_aes\_256\_wrap, EVP\_aes\_128\_wrap\_pad, EVP\_aes\_192\_wrap\_pad, EVP\_aes\_256\_wrap\_pad, EVP\_aes\_128\_xts, EVP\_aes\_256\_xts - EVP AES cipher

## SYNOPSIS

```
 #include <openssl/evp.h>
 const EVP_CIPHER *EVP_ciphername(void)
```

*EVP\_ciphername* is used a placeholder for any of the described cipher functions, such as *EVP\_aes\_128\_cbc*.

## DESCRIPTION

The AES encryption algorithm for EVP.

- **EVP\_aes\_128\_cbc()**, **EVP\_aes\_192\_cbc()**, **EVP\_aes\_256\_cbc()**, **EVP\_aes\_128\_cfb()**, **EVP\_aes\_192\_cfb()**, **EVP\_aes\_256\_cfb()**, **EVP\_aes\_128\_cfb1()**, **EVP\_aes\_192\_cfb1()**, **EVP\_aes\_256\_cfb1()**, **EVP\_aes\_128\_cfb8()**, **EVP\_aes\_192\_cfb8()**, **EVP\_aes\_256\_cfb8()**, **EVP\_aes\_128\_cfb128()**, **EVP\_aes\_192\_cfb128()**, **EVP\_aes\_256\_cfb128()**, **EVP\_aes\_128\_ctr()**, **EVP\_aes\_192\_ctr()**, **EVP\_aes\_256\_ctr()**, **EVP\_aes\_128\_ecb()**, **EVP\_aes\_192\_ecb()**, **EVP\_aes\_256\_ecb()**, **EVP\_aes\_128\_ofb()**, **EVP\_aes\_192\_ofb()**, **EVP\_aes\_256\_ofb()**

  AES for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB, and OFB.

- **EVP\_aes\_128\_cbc\_hmac\_sha1()**, **EVP\_aes\_256\_cbc\_hmac\_sha1()**

  Authenticated encryption with AES in CBC mode using SHA-1 as HMAC, with keys of 128 and 256 bits length respectively. The authentication tag is 160 bits long.

  WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

- **EVP\_aes\_128\_cbc\_hmac\_sha256()**, **EVP\_aes\_256\_cbc\_hmac\_sha256()**

  Authenticated encryption with AES in CBC mode using SHA256 (SHA-2, 256-bits) as HMAC, with keys of 128 and 256 bits length respectively. The authentication tag is 256 bits long.

  WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

- **EVP\_aes\_128\_ccm()**, **EVP\_aes\_192\_ccm()**, **EVP\_aes\_256\_ccm()**, **EVP\_aes\_128\_gcm()**, **EVP\_aes\_192\_gcm()**, **EVP\_aes\_256\_gcm()**, **EVP\_aes\_128\_ocb()**, **EVP\_aes\_192\_ocb()**, **EVP\_aes\_256\_ocb()**

  AES for 128, 192 and 256 bit keys in CBC-MAC Mode (CCM), Galois Counter Mode (GCM) and OCB Mode respectively. These ciphers require additional control operations to function correctly, see the "AEAD Interface" in **EVP\_EncryptInit**(3) section for details.

- **EVP\_aes\_128\_wrap()**, **EVP\_aes\_192\_wrap()**, **EVP\_aes\_256\_wrap()**, **EVP\_aes\_128\_wrap\_pad()**, **EVP\_aes\_128\_wrap()**, **EVP\_aes\_192\_wrap()**, **EVP\_aes\_256\_wrap()**, **EVP\_aes\_192\_wrap\_pad()**, **EVP\_aes\_128\_wrap()**, **EVP\_aes\_192\_wrap()**, **EVP\_aes\_256\_wrap()**, **EVP\_aes\_256\_wrap\_pad()**

  AES key wrap with 128, 192 and 256 bit keys, as according to RFC 3394 section 2.2.1 ("wrap") and RFC 5649 section 4.1 ("wrap with padding") respectively.

- **EVP\_aes\_128\_xts()**, **EVP\_aes\_256\_xts()**

  AES XTS mode (XTS-AES) is standardized in IEEE Std. 1619-2007 and described in NIST SP 800-38E. The XTS (XEX-based tweaked-codebook mode with ciphertext stealing) mode was designed by Prof. Phillip Rogaway of University of California, Davis, intended for encrypting data on a storage device.

  XTS-AES provides confidentiality but not authentication of data. It also requires a key of double-length for protection of a certain key size. In particular, XTS-AES-128 (**EVP\_aes\_128\_xts**) takes input of a 256-bit key to achieve AES 128-bit security, and XTS-AES-256 (**EVP\_aes\_256\_xts**) takes input of a 512-bit key to achieve AES 256-bit security.

  The XTS implementation in OpenSSL does not support streaming. That is there must only be one **EVP\_EncryptUpdate**(3) call per **EVP\_EncryptInit\_ex**(3) call (and similarly with the "Decrypt" functions).

  The *iv* parameter to **EVP\_EncryptInit\_ex**(3) or **EVP\_DecryptInit\_ex**(3) is the XTS "tweak" value.

## RETURN VALUES

These functions return an **EVP\_CIPHER** structure that contains the implementation of the symmetric cipher. See **EVP\_CIPHER\_meth\_new**(3) for details of the **EVP\_CIPHER** structure.

## SEE ALSO

**evp**(7), **EVP\_EncryptInit**(3), **EVP\_CIPHER\_meth\_new**(3)

## COPYRIGHT

Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (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\>.
