LIFE_CYCLE-DIGEST(7ossl)
π¦ LIFE_CYCLE-DIGEST(7ossl) β the digest algorithm life-cycle β¨
Okay bestie, welcome to life_cycle-digest from section 7ossl of the OpenSSL manual π
this one is a whole mood board of states β every message digest goes through a lil journey and this page is its β¨character arcβ¨.
π NAME π
life_cycle-digest β the digest algorithm life-cycle. That's it, that's the whole name, she's simple but she's iconic π«Ά
πΈ DESCRIPTION πΈ
okay so literally all message digests (MDs, for short) go through a handful of stages in their life-cycle, and here's the full roster π
startβ this is the MD before it's been allocated. It's the starting state for every single life-cycle transition, the "before they were famous" era π«newedβ this is the MD after it's been allocated. Fresh out the box, new phone who dis π±initialisedβ the MD is all set up and ready to process input. She's ready, she's prepared, she's giving main character energy π₯updatedβ the MD is set up and can process additional input or generate output. Multi-tasking queen πfinaledβ the MD has generated output. And ngl, for an XOF digest this state means the MD has generated a single-shot output π―squeezedβ okay so for an XOF digest, this is the state where it has generated output, and you can call it multiple times to generate more output π the output length is variable for each call, no capfreedβ this is when the MD is freed. It's the terminal state for all life-cycle transitions, the final boss, the end of the era π
π§ State Transition Diagram
the usual life-cycle of a MD is illustrated here β fair warning, this diagram is a little cursed in the original, but we keep it 100% intact because every detail matters π«Ά
+--------------------+
| start |
+--------------------+
|
EVP_MD_CTX_reset
| EVP_MD_CTX_new
+-------------------------------------------------+
v v
|
EVP_MD_CTX_reset + - - - - - - - - - - - - - - - - - -
- - - - + EVP_MD_CTX_reset |
+-------------------> ' newed
' <--------------------+ |
| + - - - - - - - - - - - - - - - - - -
- - - - + | |
| |
| |
| | EVP_DigestInit
| |
| v
| |
| EVP_DigestInit + - - - - - - - - - - - - - - - - - -
- - - - + | |
+----+-------------------> ' initialised
' <+ EVP_DigestInit | |
| | + - - - - - - - - - - - - - - - - - -
- - - - + | | |
| | | ^
| | |
| | | EVP_DigestUpdate |
EVP_DigestInit | | |
| | v |
| | |
| |
+---------------------------------------------+ | |
|
| +-------------------- |
| | | |
| |
| | | |
| EVP_DigestUpdate |
| | | |
| +-------------------- |
| | | |
| | | updated
| | | |
| +-------------------> |
| | | |
| |
| | | |
| |
| | | |
+----+------------------------- |
| -+-------------------+----+ |
| |
+---------------------------------------------+ | |
| |
| | |
| | | |
| | | EVP_DigestSqueeze
+-------------------+ | | |
| | v |
| | |
| | EVP_DigestSqueeze
+---------------------------------------------+ |
| |
| | +-------------------- |
| | | |
| | | | squeezed
| | | |
| | +-------------------> |
| ---------------------+ | |
| |
+---------------------------------------------+
| |
| | |
| |
| |
+---------------------------------------+ | |
| |
| | |
| |
+---------------------------------------------+ EVP_DigestFinalXOF |
| |
| +------------------------- | finaled
| <--------------------+----+ |
|
+---------------------------------------------+ |
|
| EVP_DigestFinal ^ | |
| |
+---------------------------------+ | |
EVP_MD_CTX_free | |
| v
| |
|
+------------------+ EVP_MD_CTX_free | |
| |
freed | <--------------------+ |
|
+------------------+ |
|
|
+------------------------------------------------------+
π Formal State Transitions
this section defines all of the legal state transitions β it's the canonical list, the source of truth, the moment of truth fr fr π
Function Call --------------------- Current State
-----------------------------------
start newed initialised updated
finaled squeezed freed
EVP_MD_CTX_new newed
EVP_DigestInit initialised initialised initialised
initialised initialised
EVP_DigestUpdate updated updated
EVP_DigestFinal finaled
EVP_DigestFinalXOF finaled
EVP_DigestSqueeze squeezed
squeezed
EVP_MD_CTX_free freed freed freed freed
freed
EVP_MD_CTX_reset newed newed newed
newed
EVP_MD_CTX_get_params newed initialised updated
EVP_MD_CTX_set_params newed initialised updated
EVP_MD_CTX_gettable_params newed initialised updated
EVP_MD_CTX_settable_params newed initialised updated
EVP_MD_CTX_copy_ex newed initialised updated
squeezed
so like, reading down the function column and across the state columns is the whole game here π― EVP_MD_CTX_new takes you to newed, EVP_MD_CTX_reset lands you in newed too, EVP_MD_CTX_free puts you in freed, and the EVP_DigestUpdate / EVP_DigestFinal / EVP_DigestFinalXOF / EVP_DigestSqueeze crew move you through updated, finaled and squeezed respectively. EVP_MD_CTX_get_params, EVP_MD_CTX_set_params, EVP_MD_CTX_gettable_params and EVP_MD_CTX_settable_params all chill in newed / initialised / updated, and EVP_MD_CTX_copy_ex hangs out in newed / initialised / updated / squeezed. The table above is the canonical one though β trust her, not my lil recap π
β NOTES β
at some point the EVP layer will begin enforcing the transitions described herein π so likeβ¦ don't be messy about it, bestie
π SEE ALSO π
go read those too, they're the supporting cast and they ate π«Ά
π COPYRIGHT π
Copyright 2021-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>.
and that's the whole page, bestie πβ¨ this was LIFE_CYCLE-DIGEST(7ossl), version 3.5.0, dated 2026-09-25 β go forth and squeeze your XOFs responsibly π
π¦π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms