aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/utility.cpp
blob: e1ed101c76f55d841937b025d2b8777c34c7efea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "utility.h"

#ifdef _MSC_VER
    #include <Windows.h>
#endif

void SecureZero(void* pointer, size_t count) noexcept {
#ifdef _MSC_VER
    SecureZeroMemory(pointer, count);
#elif defined(memset_s)
    memset_s(pointer, count, 0, count);
#else
    volatile char* vPointer = (volatile char*)pointer;

    while (count) {
        *vPointer = 0;
        vPointer++;
        count--;
    }
#endif
}