aboutsummaryrefslogtreecommitdiffstats
path: root/jni/ed25519/additions/zeroize.c
blob: 37c1f708bc145fdcac581530b3dcce6a3aa69e16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "zeroize.h"

void zeroize(unsigned char* b, size_t len)
{
  size_t count = 0;
  unsigned long retval = 0;
  volatile unsigned char *p = b;

  for (count = 0; count < len; count++)
    p[count] = 0;
}

void zeroize_stack()
{
  unsigned char m[ZEROIZE_STACK_SIZE];
  zeroize(m, sizeof m);
}