LIBKECCAK_STATE_FREE(3)

πŸ“¦ version 1.4.3, in arch rolling, opensuse-leap 16.0

πŸ’… LIBKECCAK_STATE_FREE(3) β€” bestie, it's time to say goodbye πŸ’…

okay so real talk, this page lives in the Library Functions Manual (the libkeccak girlies know ✨), and it's about one lil function that cleans up your hash state and erases the evidence. literally the Marie Kondo of the libkeccak world πŸŽ€


✨ SYNOPSIS ✨

#include <libkeccak.h>

void libkeccak_state_free(struct libkeccak_state *state);

and bestie, don't forget to link with -lkeccak or it's giving nothing πŸ”₯


🫢 DESCRIPTION 🫢

so libkeccak_state_free() does two things and it does them both:

  • it releases the allocations stored in *state πŸ’–
  • and then it also releases the allocation of state itself β€” yes, the whole thing, gone, iconic πŸ‘‘

and here's the part where she's actually the main character: libkeccak_state_free() securely erases sensitive data. no cap. the secrets do not survive this. πŸ•΅οΈβ€β™€οΈβœ¨


🌸 RETURN VALUES 🌸

libkeccak_state_free() does not return any value. it's a void, she simply leaves. no dramatic exit speech, just vibes πŸ’…


πŸ¦‹ ERRORS πŸ¦‹

libkeccak_state_free() cannot fail. literally cannot. she's unbothered, moisturized, thriving 🌈


πŸ’€ NOTES πŸ’€

okay this is the important one, pay attention bestie 😭

a double call to libkeccak_state_free() will either:

  • result in a double free, which is must likely to crash the process πŸ’€ β€” like, full on RIP
  • or free an allocation (that was created between the calls) that was not intended to be freed β€” resulting in undefined behaviour πŸ™ˆπŸš«

so yeah. call it once. once. periodt. πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, fr fr:


and that's the page, bestie 🧚 this came to you straight from LIBKECCAK (source, version and date all folded into that footer, which we are not copy-pasting, respectfully πŸ’–) β€” go forth and free responsibly πŸŒŸπŸ’œ

πŸ“¦ where this page comes from