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