nqwipe — erase
secret data from memory
libnoqtis, -lnoqtis
#include
<noqtis.h>
void
nqwipe(void
*p, size_t
len);
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.
None.
static uint8_t sk[4032]; /* ... sign with sk ... */ nqwipe(sk, sizeof sk);
nqwipe() cannot erase copies outside the
buffer it is given: registers, swap, core dumps or copies the caller
made.