aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/utility.cpp
blob: 146ba831dcc778fd3d2b4e75b5dac745554afce5 (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
}