summaryrefslogtreecommitdiff
path: root/libs/libaxolotl/src/curve25519/ed25519/additions/zeroize.c
blob: 187e725eb52a69838b1c6c8bcc72a05ed1580dc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "zeroize.h"

void zeroize(unsigned char* b, size_t len)
{
  size_t count = 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, ZEROIZE_STACK_SIZE);
}