Skip to content

nqwipe(3)

nqwipe — erase secret data from memory

libnoqtis, -lnoqtis

#include <noqtis.h>

void
nqwipe(void *p, size_t len);

() 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 () 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);

explicit_bzero(3), noqtis(3), nqcteq(3)

nqwipe() cannot erase copies outside the buffer it is given: registers, swap, core dumps or copies the caller made.