LIFE_CYCLE-CIPHER(7ossl)
π NAME π
life_cycle-cipher β The cipher algorithm life-cycle β¨
π¦ DESCRIPTION π¦
okay so literally all symmetric ciphers (the page calls them CIPHERs, all caps, main-character energy π ) go through a whole little journey of stages in their life-cycle. It's giving coming-of-age arc. Here's the lineup:
startβ this state is the CIPHER before it has been allocated. It's the starting state for any life-cycle transitions. She doesn't exist yet, she's just potential π¦newedβ this state is the CIPHER after it has been allocated. she's here. she's real.initialisedβ these states are the CIPHER when it's set up and capable of processing input. There are three possible initialised states:- initialised using
EVP_CipherInit - initialised for decryption using
EVP_DecryptInit - initialised for encryption using
EVP_EncryptInit
- initialised using
updatedβ these states are the CIPHER when it's set up and capable of processing additional input or generating output. The three possible states correspond directly to those forinitialisedabove. β οΈ The three different streams should not be mixed β not me warning you twice, it literally says that, do not mix them bestie πfinaledβ this state is the CIPHER when it has generated output. she ate and left no crumbs πfreedβ this state is entered when the CIPHER is freed. It is the terminal state for all life-cycle transitions. π rest in peace queen, no coming back from this one
π State Transition Diagram π
The usual life-cycle of a CIPHER is illustrated:
start
β EVP_CIPHER_CTX_new
βΌ
newed βββββββββββββββββββββββββββββββ
β EVP_CipherInit β
β EVP_DecryptInit β EVP_CIPHER_CTX_reset
β EVP_EncryptInit β
βΌ β
initialised βββββββββββββββββββββββββ€
β EVP_CipherUpdate β
β EVP_DecryptUpdate β
β EVP_EncryptUpdate β
βΌ β
updated βββββββββββββββββββββββββββββ€
β EVP_CipherFinal β
β EVP_DecryptFinal β
β EVP_EncryptFinal β
βΌ β
finaled βββββββββββββββββββββββββββββ
β
β EVP_CIPHER_CTX_free
βΌ
freed
and the little dotted-arrow footnote from the original, iykyk: EVP_CIPHER_CTX_reset can swoop in from any of the initialised, updated or finaled states and drop her right back at newed. Also EVP_CIPHER_CTX_get_params shows up on the finaled β freed stretch for AEAD encryption π«Ά
π«Ά Formal State Transitions π«Ά
This section defines all of the legal state transitions. This is the canonical list. π (Translation below is just me being helpful β the list is the list.)
EVP_CIPHER_CTX_newβstartβnewedEVP_CipherInitβ βinitialisedEVP_DecryptInitβ βinitialised for decryptionEVP_EncryptInitβ βinitialised for encryptionEVP_CipherUpdateβ βupdatedEVP_DecryptUpdateβ βupdated for decryptionEVP_EncryptUpdateβ βupdated for encryptionEVP_CipherFinalβ βfinaledEVP_DecryptFinalβ βfinaledEVP_EncryptFinalβ βfinaledEVP_CIPHER_CTX_freeβ βfreedπEVP_CIPHER_CTX_resetβ βnewedEVP_CIPHER_CTX_get_paramsβ βnewed,initialised,updated(plain, decryption and encryption flavours all in play)EVP_CIPHER_CTX_set_paramsβ βnewed,initialised,updated(plain, decryption and encryption flavours all in play)EVP_CIPHER_CTX_gettable_paramsβ βnewed,initialised,updated(plain, decryption and encryption flavours all in play)EVP_CIPHER_CTX_settable_paramsβ βnewed,initialised,updated(plain, decryption and encryption flavours all in play)
The full grid in the original is a big wide table ofFunction CallΓCurrent State(start,newed,initialised,updated,finaled,initialised decryption,updated decryption,initialised encryption,updated encryption,freed) β the bullets above are the same tea, just poured into a cup you can actually read π
β NOTES β
At some point the EVP layer will begin enforcing the transitions described herein. So likeβ¦ behave now, bestie π
πΈ SEE ALSO πΈ
provider-cipher(7), EVP_EncryptInit(3)
π COPYRIGHT π
Copyright 2021 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, no cap π«Ά kisses from OpenSSL 3.5.9, dated 2026-09-29 β this has been LIFE_CYCLE-CIPHER(7ossl), mwah πβ¨
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms