From 2cb830b341ea49e9c69ec332b060e165ad75e1a7 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 17 May 2016 11:25:55 +0200 Subject: [PATCH] Typically used classes variations defined with sanitizing_allocator --- include/WinStd/Common.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/include/WinStd/Common.h b/include/WinStd/Common.h index 55a807a8..ec12842b 100644 --- a/include/WinStd/Common.h +++ b/include/WinStd/Common.h @@ -27,6 +27,7 @@ #include #include +#include /// @@ -914,5 +915,45 @@ namespace winstd #pragma warning(pop) + + /// + /// A sanitizing variant of std::vector + /// + /// \note + /// `sanitizing_vector` introduces a performance penalty. However, it provides an additional level of security. + /// Use for security sensitive data memory storage only. + /// + template + class sanitizing_vector : public std::vector<_Ty, sanitizing_allocator<_Ty> > + { + }; + + + /// + /// A sanitizing variant of std::string + /// + /// \note + /// `sanitizing_string` introduces a performance penalty. However, it provides an additional level of security. + /// Use for security sensitive data memory storage only. + /// + typedef std::basic_string, sanitizing_allocator > sanitizing_string; + + + /// + /// A sanitizing variant of std::wstring + /// + /// \note + /// `sanitizing_wstring` introduces a performance penalty. However, it provides an additional level of security. + /// Use for security sensitive data memory storage only. + /// + typedef std::basic_string, sanitizing_allocator > sanitizing_wstring; + + +#ifdef _UNICODE + typedef sanitizing_wstring sanitizing_tstring; +#else + typedef sanitizing_string sanitizing_tstring; +#endif + /// @} }