LIFE_CYCLE-RAND(7ossl)

πŸŽ€ NAME πŸŽ€

LIFE_CYCLE-RAND(7ossl) β€” okay bestie, this is the OpenSSL manual page for life_cycle-rand, and it's literally The RAND algorithm life-cycle. No cap, that's the whole vibe. πŸ’–

✨ DESCRIPTION ✨

All random number generator (RANDs) go through a number of stages in their life-cycle β€” and the way that works is giving main character energy, so let's break it down:

  • start β€” this state represents the RAND before it has been allocated. It is the starting state for any life-cycle transitions. Periodt. 🌱
  • newed β€” this state represents the RAND after it has been allocated but unable to generate any output. It's new here, okay? 🐣
  • instantiated β€” this state represents the RAND when it is set up and capable of generating output. Slay, it's functional. ✨
  • uninstantiated β€” this state represents the RAND when it has been shutdown and it is no longer capable of generating output. Not it being retired, but okay. πŸ’€
  • freed β€” this state is entered when the RAND is freed. It is the terminal state for all life-cycle transitions. The final boss, fr fr. πŸ’€

πŸ¦‹ State Transition Diagram πŸ¦‹

The usual life-cycle of a RAND is illustrated like this β€” stare at it, it's iconic:

                               +-------------------------+
                               |          start          |
                               +-------------------------+
                                 |
                                 | EVP_RAND_CTX_new
                                 v
                               +-------------------------+
                               |          newed          |
                               +-------------------------+
                                 |
                                 | EVP_RAND_instantiate
                                 v
           EVP_RAND_generate   +-------------------------+
         +-------------------- |                         |
         |                     |      instantiated       |
         +-------------------> |                         | <+
                               +-------------------------+  '
                                 |                          '
                                 | EVP_RAND_uninstantiate   '
       EVP_RAND_instantiate
                                 v                          '
                               +-------------------------+  '
                               |     uninstantiated      | -+
                               +-------------------------+
                                 |
                                 | EVP_RAND_CTX_free
                                 v
                               +-------------------------+
                               |          freed          |
                               +-------------------------+

🌈 Formal State Transitions 🌈

This section defines all of the legal state transitions. This is the canonical list β€” no cap, every row matters. The current-state columns are start, newed, instantiated, uninstantiated, and freed:

        Function Call              ------------------ Current State
       ------------------
                                   start   newed   instantiated  uninstantiated
       freed
        EVP_RAND_CTX_new           newed
        EVP_RAND_instantiate            instantiated
        EVP_RAND_generate                          instantiated
        EVP_RAND_uninstantiate                    uninstantiated
        EVP_RAND_CTX_free          freed   freed      freed          freed
        EVP_RAND_CTX_get_params            newed   instantiated  uninstantiated
       freed
        EVP_RAND_CTX_set_params            newed   instantiated  uninstantiated
       freed
        EVP_RAND_CTX_gettable_params       newed   instantiated  uninstantiated
       freed
        EVP_RAND_CTX_settable_params       newed   instantiated  uninstantiated
       freed

πŸ’… NOTES πŸ’…

At some point the EVP layer will begin enforcing the transitions described herein. So bestie, don't try any illegal transitions; the vibe check is coming. πŸ‘€

πŸ”₯ SEE ALSO πŸ”₯

🌟 HISTORY 🌟

The provider RAND interface was introduced in OpenSSL 3.0. That's the origin story. 🫢

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

Okay bestie, that's the whole page! πŸ’– This OpenSSL 3.5.9 glow-up is dated 2026-09-29, and the manual page is LIFE_CYCLE-RAND(7ossl). Mwah! πŸŽ€

πŸ“¦ where this page comes from