aboutsummaryrefslogblamecommitdiffstats
path: root/util/generic/utility.cpp
blob: e1ed101c76f55d841937b025d2b8777c34c7efea (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
                    
               
                        






                                                       
                                                      






                      
#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
}