LIFE_CYCLE-CIPHER(7ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’… LIFE_CYCLE-CIPHER β€” the cipher algorithm life-cycle (yes, it's an OpenSSL 7ossl page, bestie)

okay so you found life_cycle-cipher(7ossl), the OpenSSL manpage that maps out the entire ~journey~ a symmetric cipher goes on. Think of it as the group chat history of a CIPHER: who added it, when it got set up, when it started actually doing stuff, and when it got yeeted out of memory. Sit down, bestie, we're going through all of it. πŸ¦‹


✨ NAME ✨

life_cycle-cipher β€” The cipher algorithm life-cycle. literally the whole plot. πŸ‘‘


🌸 DESCRIPTION 🌸

All symmetric ciphers (CIPHERs) go through a number of stages in their life-cycle, and no cap, each one has main character energy at a different moment:

  • start β€” This state represents the CIPHER before it has been allocated. It is the starting state for any life-cycle transitions.
  • newed β€” This state represents the CIPHER after it has been allocated.
  • initialised β€” These states represent the CIPHER when it is 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
  • updated β€” These states represent the CIPHER when it is set up and capable of processing additional input or generating output. The three possible states directly correspond to those for initialised above. The three different streams should not be mixed. 🚫 (fr fr, don't mix them, that's not the vibe)
  • finaled β€” This state represents the CIPHER when it has generated output. slay, it did the thing.
  • freed β€” This state is entered when the CIPHER is freed. It is the terminal state for all life-cycle transitions. goodbye forever bestie 🫢

πŸŽ€ State Transition Diagram πŸŽ€

The usual life-cycle of a CIPHER is illustrated:

                                        +---------------------------+
                                        |                           |
                                        |           start           |
                                        |                           |
                                        +---------------------------+   + - - -
       - - - - - - - - - - +
                                              |                         '  any
       of the initialised   '
                                              | EVP_CIPHER_CTX_new      '
       updated or finaled states '
                                              v                         '
       '
                                        +---------------------------+   + - - -
       - - - - - - - - - - +
                                        |                           |      |
                                        |           newed           |      |
       EVP_CIPHER_CTX_reset
                                        |                           | <----+
                                        +---------------------------+
                                           |   |                 |
                                 +---------+   |                 +---------+
                 EVP_DecryptInit |             | EVP_CipherInit            |
       EVP_EncryptInit
                                 v             v                           v
        +---------------------------+   +---------------------------+   +---------------------------+
        |                           |   |                           |   |
        |        initialised        |   |        initialised        |   |
       initialised        |
        |       for decryption      |   |                           |   |
       for encryption      |
        +---------------------------+   +---------------------------+   +---------------------------+
          |                                   |                           |
          | EVP_DecryptUpdate                 | EVP_CipherUpdate          | EVP_EncryptUpdate |
          |                                   v                           |
          |                             +---------------------------+   |
          |                             |                           |--------------------+        |
          |                             |          updated          |   EVP_CipherUpdate |        |
          |                             |                           | <------------------+        |
          v                             +---------------------------+   v
        +---------------------------+                         |   +---------------------------+
        |                           |---------------------+   |   |         |
        |          updated          |   EVP_DecryptUpdate |   |   |         | updated          |------+
        |       for decryption      | <-------------------+   |   |         | for encryption      |      |
        +---------------------------+                         |   +---------------------------+      |
                                 |            EVP_CipherFinal ^            |                   |
                                 +-------+                    |   +--------+                   |
                        EVP_DecryptFinal |                    |   |       EVP_EncryptFinal   +-------------------+
                                         v                    v   v       EVP_EncryptUpdate
                                        +---------------------------+   |-----------------------------+
                                        |                           |   |
                                        |          finaled          |   <---------------------------+
                                        |                           |       EVP_CIPHER_CTX_get_params
                                        +---------------------------+
                                              |       (AEAD encryption)
                                              | EVP_CIPHER_CTX_free
                                              v
                                        +---------------------------+
                                        |                           |
                                        |           freed           |
                                        |                           |
                                        +---------------------------+

πŸ’œ Formal State Transitions πŸ’œ

This section defines all of the legal state transitions. This is the canonical list. it's giving receipts, it's giving lore, it's giving iykyk.

        Function Call
       ---------------------------------------------- Current State
       -----------------------------------------------
                                     start   newed    initialised   updated
       finaled   initialised   updated    initialised   updated    freed
                                                                                           decryption
       decryption   encryption  encryption
        EVP_CIPHER_CTX_new           newed
        EVP_CipherInit                    initialised initialised initialised
       initialised initialised initialised  initialised initialised
        EVP_DecryptInit                   initialised initialised initialised
       initialised initialised initialised  initialised initialised
                                           decryption  decryption  decryption
       decryption  decryption  decryption  decryption  decryption
        EVP_EncryptInit                   initialised initialised initialised
       initialised initialised initialised  initialised initialised
                                           encryption  encryption  encryption
       encryption  encryption  encryption  encryption  encryption
        EVP_CipherUpdate                                updated     updated
        EVP_DecryptUpdate
       updated     updated
                                                                                           decryption
       decryption
        EVP_EncryptUpdate
       updated     updated
                                                                                                                    encryption
       encryption
        EVP_CipherFinal                                             finaled
        EVP_DecryptFinal
       finaled
        EVP_EncryptFinal
       finaled
        EVP_CIPHER_CTX_free          freed   freed       freed       freed
       freed       freed       freed        freed       freed
        EVP_CIPHER_CTX_reset                 newed       newed       newed
       newed       newed       newed        newed       newed
        EVP_CIPHER_CTX_get_params            newed    initialised   updated
       initialised   updated    initialised   updated
                                                                                           decryption
       decryption   encryption  encryption
        EVP_CIPHER_CTX_set_params            newed    initialised   updated
       initialised   updated    initialised   updated
                                                                                           decryption
       decryption   encryption  encryption
        EVP_CIPHER_CTX_gettable_params       newed    initialised   updated
       initialised   updated    initialised   updated
                                                                                           decryption
       decryption   encryption  encryption
        EVP_CIPHER_CTX_settable_params       newed    initialised   updated
       initialised   updated    initialised   updated
                                                                                           decryption
       decryption   encryption  encryption

so yeah, that's the canonical chart β€” function call on the left, current state across the top, resulting state in the cell. read it like a grid and you're golden. ⭐


πŸ”₯ NOTES πŸ”₯

At some point the EVP layer will begin enforcing the transitions described herein. so like… these aren't just suggestions forever, bestie. behave. 😭


🌈 SEE ALSO 🌈

go read those too, they're iconic in their own right πŸ’–


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


k bye bestie πŸ’… this little masterpiece is OpenSSL version 3.5.6, dated 2026-04-07, and you can find it chilling under the name LIFE_CYCLE-CIPHER(7ossl). ily, go initialise something πŸŽ€βœ¨

πŸ“¦ where this page comes from