nqwipe(3)
NAME
nqwipe — erase
secret data from memory
LIBRARY
libnoqtis, -lnoqtis
SYNOPSIS
#include
<noqtis.h>
void
nqwipe(void
*p, size_t
len);
DESCRIPTION
nqwipe()
sets the len bytes at p to zero
in a way the compiler cannot remove as dead stores, even just before the
memory is freed or goes out of scope: with C23's
memset_explicit()
when the library is built as C23 or later and the C library has it, and
otherwise through a volatile pointer. p may be
NULL, and then nothing happens.
The library wipes every secret it holds (keys, seeds, shared secrets, intermediate state, freed memory of the capsule layer) before it returns, on every path. Callers wipe their own copies: secret keys, seeds and shared secrets they no longer need.
RETURN VALUES
None.
EXAMPLES
static uint8_t sk[4032]; /* ... sign with sk ... */ nqwipe(sk, sizeof sk);
SEE ALSO
CAVEATS
nqwipe() cannot erase copies outside the
buffer it is given: registers, swap, core dumps or copies the caller
made.