EVP_AES_128_GCM(3SSL)
π NAME π
okay bestie, gather round, because this page is the whole AES cipher family in OpenSSL (that's the 3SSL manual, hi) and it goes by the very first of its many, many names: EVP_AES_128_GCM.
Here's everyone who answers to this page, so you know you're in the right place: 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.
And what is all of that, you ask? It's the EVP AES cipher. Periodt. π
β¨ SYNOPSIS β¨
#include <openssl/evp.h>
const EVP_CIPHER *EVP_ciphername(void)
Not me using EVP_ciphername as a little placeholder stand-in for literally any of the cipher functions described down there, like EVP_aes_128_cbc π. That's the vibe. Swap in whichever one you actually want.
π¦ DESCRIPTION π¦
It's the AES encryption algorithm, but for EVP. That's the whole plot. Now let's meet the cast, group by group πΈ.
The classic modes π
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 these modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB, and OFB. The whole lil lineup π«Ά.
CBC + HMAC-SHA1, aka the TLS-only girlies π
EVP_aes_128_cbc_hmac_sha1(), EVP_aes_256_cbc_hmac_sha1()
Authenticated encryption with AES in CBC mode, using SHA-1 as the 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 it requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface. Not me, not my business, just don't. π
CBC + HMAC-SHA256, same energy π
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 the 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 it requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface. Same deal, bestie. π
The AEAD icons π
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 β that's the order they're listed, matching up one-to-one π. These ciphers require additional control operations to function correctly, so go read the "AEAD INTERFACE" section in EVP_EncryptInit(3) for the details, okay? It's giving required reading. π
Key wrap, no notes π
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()
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. Officer, she's literally certified β¨.
XTS, the storage-device darling πΎ
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. Academic king π.
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. Yes bestie, double. That's the toll. πΈ
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). One and done, no buffers left behind. π«
The iv parameter to EVP_EncryptInit_ex(3) or EVP_DecryptInit_ex(3) is the XTS "tweak" value. Cute name, very demure.
π NOTES π
Real talk, devs: be aware of the negative performance implications of calling these functions multiple times, and consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-AES(7) instead. See "Performance" in crypto(7) for further information. It's called efficiency, look it up π
.
π«Ά RETURN VALUES π«Ά
These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. That's the gift. That's what you get. π
π₯ SEE ALSO π₯
Go read those too, they ate. β¨
π COPYRIGHT π
Copyright 2017-2023 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>.
aaaand that's the page bestie, no cap π§ β this was EVP_AES_128_GCM(3SSL) from OpenSSL 4.0.3, dated 2026-09-29, and it slayed. bye, go encrypt something safely ππΈπ¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms