VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume/VolumePassword.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Volume/VolumePassword.cpp')
-rw-r--r--src/Volume/VolumePassword.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Volume/VolumePassword.cpp b/src/Volume/VolumePassword.cpp
index a22c9388..9ba3ebce 100644
--- a/src/Volume/VolumePassword.cpp
+++ b/src/Volume/VolumePassword.cpp
@@ -33,57 +33,57 @@ namespace VeraCrypt
{
if (!PasswordBuffer.IsAllocated ())
PasswordBuffer.Allocate (MaxSize);
}
void VolumePassword::Deserialize (shared_ptr <Stream> stream)
{
Serializer sr (stream);
uint64 passwordSize;
sr.Deserialize ("PasswordSize", passwordSize);
PasswordSize = static_cast <size_t> (passwordSize);
sr.Deserialize ("PasswordBuffer", BufferPtr (PasswordBuffer));
Buffer wipeBuffer (128 * 1024);
sr.Deserialize ("WipeData", wipeBuffer);
}
void VolumePassword::Serialize (shared_ptr <Stream> stream) const
{
Serializable::Serialize (stream);
Serializer sr (stream);
sr.Serialize ("PasswordSize", static_cast <uint64> (PasswordSize));
sr.Serialize ("PasswordBuffer", ConstBufferPtr (PasswordBuffer));
// Wipe password from an eventual pipe buffer
Buffer wipeBuffer (128 * 1024);
wipeBuffer.Zero();
sr.Serialize ("WipeData", ConstBufferPtr (wipeBuffer));
}
- void VolumePassword::Set (const byte *password, size_t size)
+ void VolumePassword::Set (const uint8 *password, size_t size)
{
AllocateBuffer ();
if (size > MaxSize)
throw PasswordTooLong (SRC_POS);
PasswordBuffer.Erase ();
if (size > 0)
PasswordBuffer.CopyFrom (ConstBufferPtr (password, size));
PasswordSize = size;
}
void VolumePassword::Set (const VolumePassword &password)
{
Set (password.DataPtr(), password.Size());
}
TC_SERIALIZER_FACTORY_ADD_CLASS (VolumePassword);
#define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
#undef TC_EXCEPTION_NODECL
#define TC_EXCEPTION_NODECL(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
TC_SERIALIZER_FACTORY_ADD_EXCEPTION_SET (PasswordException);
}