diff --git a/lib/EAPBase/include/EAP.h b/lib/EAPBase/include/EAP.h index 043690b..0c6cbcf 100644 --- a/lib/EAPBase/include/EAP.h +++ b/lib/EAPBase/include/EAP.h @@ -672,6 +672,16 @@ namespace eap memcpy(data, other.data, N); } + /// + /// Moves the BLOB + /// + /// \param[inout] other BLOB to move from + /// + inline sanitizing_blob_f(_Inout_ sanitizing_blob_f &&other) + { + memcpy(data, other.data, N); + } + /// /// Moves the BLOB /// @@ -708,7 +718,21 @@ namespace eap /// /// Moves the BLOB /// - /// \param[inout] other Zero-initialized BLOB to copy from + /// \param[inout] other BLOB to move from + /// + /// \returns Reference to this object + /// + inline sanitizing_blob_f& operator=(_Inout_ sanitizing_blob_f &&other) + { + if (this != std::addressof(other)) + memcpy(data, other.data, N); + return *this; + } + + /// + /// Moves the BLOB + /// + /// \param[inout] other Zero-initialized BLOB to move from /// /// \returns Reference to this object /// @@ -791,9 +815,9 @@ namespace eap /// /// Copies a BLOB /// - /// \param[in] other BLOB to copy from + /// \param[in] other Zero-initialized BLOB to copy from /// - inline sanitizing_blob_zf(_In_ const sanitizing_blob_f &other) : + inline sanitizing_blob_zf(_In_ const sanitizing_blob_zf &other) : sanitizing_blob_f(other) { } @@ -806,6 +830,85 @@ namespace eap inline sanitizing_blob_zf(_Inout_ sanitizing_blob_zf &&other) : sanitizing_blob_f(std::move(other)) { + memset(other.data, 0, N); + } + + /// + /// Copies a BLOB + /// + /// \param[in] other BLOB to copy from + /// + inline sanitizing_blob_zf(_In_ const sanitizing_blob_f &other) : + sanitizing_blob_f(other) + { + } + + /// + /// Moves the BLOB + /// + /// \param[inout] other BLOB to move from + /// + inline sanitizing_blob_zf(_Inout_ sanitizing_blob_f &&other) : + sanitizing_blob_f(std::move(other)) + { + } + + /// + /// Copies a BLOB + /// + /// \param[in] other Zero-initialized BLOB to copy from + /// + /// \returns Reference to this object + /// + inline sanitizing_blob_zf& operator=(_In_ const sanitizing_blob_zf &other) + { + if (this != std::addressof(other)) + memcpy(data, other.data, N); + return *this; + } + + /// + /// Moves the BLOB + /// + /// \param[inout] other Zero-initialized BLOB to move from + /// + /// \returns Reference to this object + /// + inline sanitizing_blob_zf& operator=(_Inout_ sanitizing_blob_zf &&other) + { + if (this != std::addressof(other)) { + memcpy(data, other.data, N); + memset(other.data, 0, N); + } + return *this; + } + + /// + /// Copies a BLOB + /// + /// \param[in] other BLOB to copy from + /// + /// \returns Reference to this object + /// + inline sanitizing_blob_zf& operator=(_In_ const sanitizing_blob_f &other) + { + if (this != std::addressof(other)) + memcpy(data, other.data, N); + return *this; + } + + /// + /// Moves the BLOB + /// + /// \param[inout] other BLOB to move from + /// + /// \returns Reference to this object + /// + inline sanitizing_blob_zf& operator=(_Inout_ sanitizing_blob_f &&other) + { + if (this != std::addressof(other)) + memcpy(data, other.data, N); + return *this; } }; #pragma pack(pop)