EVP_AES_128_GCM(3ossl)
π EVP_AES_128_GCM β the 3ossl glow-up π
okay bestie, so this is one of those pages where the title is EVP_AES_128_GCM but likeβ¦ it's actually the group chat for every EVP AES cipher function. fr fr, EVP_AES_128_GCM is just the one whose name got put on the door π«Ά. It's from the OpenSSL 3ossl manual set, and honestly? iconic. Let's get into it β¨
πΈ NAME πΈ
The whole AES crew, one big happy family ππ:
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 are they? literally just: EVP AES cipher π that's the whole vibe check.
β¨ SYNOPSIS β¨
#include <openssl/evp.h>
const EVP_CIPHER *EVP_ciphername(void)
so bestie, EVP_ciphername is a placeholder, right? like a little β¨templateβ¨ for any of the cipher functions we're about to talk about β think EVP_aes_128_cbc as your example bestie. don't actually go looking for a function literally called EVP_ciphername, it's not real, it's giving "insert name here" energy π
π¦ DESCRIPTION π¦
okay so the whole thing is: the AES encryption algorithm for EVP. periodt. That's the thesis statement π and now the sub-groups, because AES comes in flavours:
πΈ the classic modes: CBC, CFB, CTR, ECB, OFB
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, all together now π«: - CBC - CFB with 128-bit shift - CFB with 1-bit shift - CFB with 8-bit shift - CTR - ECB - OFB
like, pick your fighter, they're all here π«Ά
π the HMAC-SHA1 CBC girlies (TLS only, beware π)
EVP_aes_128_cbc_hmac_sha1(), EVP_aes_256_cbc_hmac_sha1()
Authenticated encryption, 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. slay for its era, but read the next bit π
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. likeβ¦ no cap, don't just vibe with these on a random Tuesday π
π§ the HMAC-SHA256 CBC girlies (also TLS only, also beware π)
EVP_aes_128_cbc_hmac_sha256(), EVP_aes_256_cbc_hmac_sha256()
Authenticated encryption, AES in CBC mode, using SHA256 (SHA-2, 256-bits) as HMAC, keys of 128 and 256 bits length respectively. The authentication tag is 256 bits long β upgrade era π
WARNING: again, 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. fr fr, same deal π
π₯ the AEAD main characters: CCM, GCM, OCB
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 ones are highkey the famous ones bestie π
β οΈ important: these ciphers require additional control operations to function correctly. see the "AEAD INTERFACE" section in EVP_EncryptInit(3) for the details. like they will not work if you just wing it, iykyk π
π the key wrap crew
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. cute, documented, standards-compliant, we love to see it π
π XTS β the storage device queen
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. main character origin story ngl β
okay now the important bits, bestie, read carefully:
- XTS-AES provides confidentiality but not authentication of data. so it hides your stuff, it does not prove nobody touched it π
- 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 - XTS-AES-256 (
EVP_aes_256_xts) takes input of a 512-bit key to achieve AES 256-bit security
- XTS-AES-128 (
- The XTS implementation in OpenSSL does not support streaming. That is, there must only be one
EVP_EncryptUpdate(3)call perEVP_EncryptInit_ex(3)call (and similarly with the "Decrypt" functions). literally one update, that's the rule π - The iv parameter to
EVP_EncryptInit_ex(3)orEVP_DecryptInit_ex(3)is the XTS "tweak" value β¨
π NOTES π
developers should be aware of the negative performance implications of calling these functions multiple times π and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-AES(7) instead. See "Performance" in crypto(7) for further information. like, cache your cipher, it's 2026 babe π«Ά
π 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. so yeah β you get a struct back, go read that page for the lore π
π¦ SEE ALSO π¦
go read them, they're the supporting cast and they ate π
π COPYRIGHT π
Copyright 2017-2025 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, no notes π
πΈ version 3.5.6 Β· dated 2026-04-07 Β· page EVP_AES_128_GCM(3ossl) β ty for coming to my ted talk, mwah πβ¨π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms