CRYPTO_WIPE(3MONOCYPHER)

πŸ“¦
version 3.1.2 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– CRYPTO_WIPE πŸ’–

okay bestie, so this one's from the Monocypher crew β€” it lives in section 3MONOCYPHER, and it's called crypto_wipe. yes the name is giving "delete but make it secure" and honestly? that's exactly what it is. 🧚


✨ NAME ✨

crypto_wipe β€” wipe data from memory 🧽✨


🌸 SYNOPSIS 🌸

#include <monocypher.h>

void
crypto_wipe(void *secret, size_t secret_size);

πŸŽ€ DESCRIPTION πŸŽ€

crypto_wipe() securely erases sensitive data in memory. like, actually erases it. no leftovers, no crumbs. πŸ’…

Sensitive data (think cryptographic keys or secret plaintexts) should be erased from memory as early as possible, to minimise the window in which it can be leaked. and listen β€” standard functions like memset and bzero are not safe to use here, because the compiler may decide they have no effect and just… optimise them out. 😭 it literally ghosts your wipe. do not trust them.

The arguments are:

  • secret β€” the buffer to erase. bye bye buffer 🫢
  • secret_size β€” the number of bytes to erase from the buffer. normally this is the size of the entire buffer.

Monocypher will wipe its context structs when finalizing an operation such as signing or decrypting. when you're using direct interfaces like crypto_lock(3monocypher), these context structs are invisible to you β€” you don't even see them, they're lowkey doing their own thing. they are exposed in incremental interfaces like crypto_blake2b_init(3monocypher) though. and heads up: the original key buffer does not get automatically wiped. so when you're using incremental interfaces, you may want to wipe the original key buffers immediately after calling the respective init function. πŸ‘‘

Using crypto_wipe() alone may not suffice for security. it's recommended to lock down relevant memory regions as well β€” refer to intro(3monocypher) for instructions on how to lock down memory on common operating systems. no cap, one wipe is not the whole vibe check. πŸ”₯

⭐ RETURN VALUES ⭐

This function returns nothing. it just does the thing and leaves. main character energy, no receipts. πŸ’€


🌈 SEE ALSO 🌈


πŸ‘‘ HISTORY πŸ‘‘

The crypto_wipe() function first appeared in Monocypher 1.1.0. iconic behaviour since day one fr fr. πŸŽ€


and that's the whole page bestie!! this one came from the Debian edition of the Monocypher manual, dated December 12, 2019. stay safe, wipe your secrets, and lock down that memory πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from