LIFE_CYCLE-MAC(7ossl)
π LIFE_CYCLE-MAC(7ossl) β the MAC algorithm life-cycle, explained
okay bestie, so this page is from the OpenSSL manual set (the 7ossl one, yes), and it's basically the β¨ character arc β¨ of a MAC. Not the makeup kind β we're talking message authentication codes here. Every single MAC goes through a whole little journey of stages, and this is the map. πΊοΈ
πΈ DESCRIPTION πΈ
Every message authentication code (a MAC, for short) lives through a bunch of stages in its life-cycle. Let's meet the cast:
startβ the MAC before it's been allocated. Like, it doesn't exist yet. This is the starting state for any life-cycle transitions. π«newedβ the MAC right after it's been allocated. It exists now! Baby's first state.initialisedβ the MAC is all set up and capable of processing input. Ready, setβ¦ πupdatedβ it's set up and capable of processing additional input or generating output. It's in the zone.finaledβ it has generated output. It did the thing! πfreedβ the MAC is freed. This is the terminal state for all life-cycle transitions. RIP little guy, we hardly knew ye π
π¦ State Transition Diagram π¦
The usual life-cycle of a MAC, pictured:
+-------------------+
| start |
+-------------------+
|
| EVP_MAC_CTX_new
v
+-------------------+
| newed |
+-------------------+
|
| EVP_MAC_init
v
+-------------------+
+> | initialised | <+
| +-------------------+ |
| | |
| | EVP_MAC_update | EVP_MAC_init
| v |
EVP_MAC_init | +-------------------+ |
| | updated | -+
| +-------------------+
| | |
| | EVP_MAC_final | EVP_MAC_finalXOF
| v v
| +-------------------+
+- | finaled |
+-------------------+
|
| EVP_MAC_CTX_free
v
+-------------------+
| freed |
+-------------------+
Look at those loops, it's giving main character energy tbh π₯
π§ Formal State Transitions π§
This section defines all of the legal state transitions. This right here is the canonical list β no vibes-based guessing, this is the source of truth. The states are start, newed, initialised, updated, finaled, and freed, so here's each function call and where it takes you:
EVP_MAC_CTX_newβ start β newedEVP_MAC_initβ newed, initialised, updated, or finaled β initialisedEVP_MAC_updateβ initialised or updated β updatedEVP_MAC_finalβ updated β finaledEVP_MAC_finalXOFβ updated β finaledEVP_MAC_CTX_freeβ start, newed, initialised, updated, or finaled β freedEVP_MAC_CTX_get_paramsβ allowed from newed, initialised, or updatedEVP_MAC_CTX_set_paramsβ allowed from newed, initialised, or updatedEVP_MAC_CTX_gettable_paramsβ allowed from newed, initialised, or updatedEVP_MAC_CTX_settable_paramsβ allowed from newed, initialised, or updated
(and yeah, start isn't listed in that original table's column header row for the very first entry in a super obvious way, but EVP_MAC_CTX_new is the thing that moves you out of start. iykyk π«Ά)
β NOTES β
Lowkey important: at some point the EVP layer will begin enforcing the transitions described herein. So don't be out here doing illegal transitions, bestie, they're gonna start checking. π¨
fr fr, treat the state machine as law, not a suggestion.
π SEE ALSO π
π HISTORY π
The provider MAC interface was introduced in OpenSSL 3.0. So it's not even that old, she's fresh. β¨
π 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>.
okay that's the whole page, and yes you read it right: this was OpenSSL 3.5.9, dated 2026-09-29, and the manual page is LIFE_CYCLE-MAC(7ossl). slay, go forth and MAC responsibly π
ππ¦
π¦ 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