Forget

Files CCore/inc/crypton/Forget.h CCore/src/crypton/Forget.cpp

"Forget" is a family of functions, designed to clean sensitive data. Usually these functions are called in class destructors to cleanup such data.


template <class T>
void PrepareForget(T &obj);

template <class T,ulen Len>
void PrepareForget(T (&obj)[Len]);

template <class T>
void Forget(T &obj);

template <class T>
void ForgetRange(PtrLen<T> data);

PrepareForget() cleans the given object or the given array.

Forget() performs cleanup of the given object. It calls PrepareForget() first and OptimizeBarrier() next to ensure the memory changes are really made.

ForgetRange() forgets the given range.

OptimizeBarrier


void OptimizeBarrier(void *ptr,ulen len);

OptimizeBarrier() is declared in the file PlatformBase.h, provided by the target. It ensures that memory modifications inside the given block are really made. The best way to implement this function is to hide the code in an assemble file to prevent the compiler from unwanted optimizations.