mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-05 16:46:35 -05:00
Merge commit from fork
* Harden serializer deserialization bounds * Finalize Unix serializer hardening Validate object types before parsing and release owned objects on failure. Enforce nesting limits through shared serialization entry points. Mirror read/write size limits and reject embedded NULs while preserving the wire format. Add regression tests for bounds, types, and cleanup. Validated Linux self-tests, C++03 platform tests, and ASan/UBSan with leak detection. Co-authored-by: Damian Rickard <damian@rickard.us> --------- Co-authored-by: Damian Rickard <damian@rickard.us> Co-authored-by: Mounir IDRASSI <mounir.idrassi@amcrypto.jp>
This commit is contained in:
25 files changed
+738
-171
No files matched your search
@@ -13,6 +13,7 @@
|
||||
OBJS :=
|
||||
OBJS += CoreBase.o
|
||||
OBJS += CoreException.o
|
||||
OBJS += CoreTest.o
|
||||
OBJS += FatFormatter.o
|
||||
OBJS += HostDevice.o
|
||||
OBJS += MountOptions.o
|
||||
|
||||
@@ -15,24 +15,24 @@
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
void ElevationFailed::Deserialize (shared_ptr <Stream> stream)
|
||||
void ElevationFailed::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
ExecutedProcessFailed::Deserialize (stream);
|
||||
ExecutedProcessFailed::DeserializeData (stream);
|
||||
}
|
||||
|
||||
void ElevationFailed::Serialize (shared_ptr <Stream> stream) const
|
||||
void ElevationFailed::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
ExecutedProcessFailed::Serialize (stream);
|
||||
ExecutedProcessFailed::SerializeData (stream);
|
||||
}
|
||||
|
||||
void FilesystemDismountFailed::Deserialize (shared_ptr <Stream> stream)
|
||||
void FilesystemDismountFailed::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
ExecutedProcessFailed::Deserialize (stream);
|
||||
ExecutedProcessFailed::DeserializeData (stream);
|
||||
}
|
||||
|
||||
void FilesystemDismountFailed::Serialize (shared_ptr <Stream> stream) const
|
||||
void FilesystemDismountFailed::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
ExecutedProcessFailed::Serialize (stream);
|
||||
ExecutedProcessFailed::SerializeData (stream);
|
||||
}
|
||||
|
||||
#define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright (c) 2026 AM Crypto. All rights reserved.
|
||||
|
||||
Governed by the Apache License 2.0, the full text of which is contained in
|
||||
the file License.txt included in VeraCrypt binary and source distributions.
|
||||
*/
|
||||
|
||||
#include "CoreTest.h"
|
||||
#include "HostDevice.h"
|
||||
#include "Platform/MemoryStream.h"
|
||||
#include "Unix/CoreServiceRequest.h"
|
||||
#include "Volume/VolumePassword.h"
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
void CoreTest::HostDeviceTest ()
|
||||
{
|
||||
HostDevice device;
|
||||
device.Name = L"Device";
|
||||
device.SystemNumber = 0;
|
||||
shared_ptr <HostDevice> partition (new HostDevice);
|
||||
partition->Name = L"Partition";
|
||||
partition->SystemNumber = 1;
|
||||
device.Partitions.push_back (partition);
|
||||
|
||||
// Exercise real parent/child serialization at the nesting boundary using a
|
||||
// shallow tree and reserved scopes, without constructing a deep input tree.
|
||||
for (int attempt = 0; attempt < 2; ++attempt)
|
||||
{
|
||||
shared_ptr <Stream> stream (new MemoryStream);
|
||||
vector < shared_ptr <SerializationScope> > scopes;
|
||||
if (attempt != 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < Serializer::MaxNestingDepth - 2; ++i)
|
||||
scopes.push_back (shared_ptr <SerializationScope> (new SerializationScope (stream)));
|
||||
}
|
||||
device.Serialize (stream);
|
||||
shared_ptr <HostDevice> result = Serializable::DeserializeNew <HostDevice> (stream);
|
||||
if (result->Name != device.Name || result->Partitions.size() != 1
|
||||
|| result->Partitions.front()->Name != partition->Name
|
||||
|| result->Partitions.front()->SystemNumber != partition->SystemNumber)
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
|
||||
for (int direction = 0; direction < 2; ++direction)
|
||||
{
|
||||
shared_ptr <Stream> stream (new MemoryStream);
|
||||
device.Serialize (stream);
|
||||
vector < shared_ptr <SerializationScope> > scopes;
|
||||
for (unsigned int i = 0; i < Serializer::MaxNestingDepth - 1; ++i)
|
||||
scopes.push_back (shared_ptr <SerializationScope> (new SerializationScope (stream)));
|
||||
try
|
||||
{
|
||||
if (direction == 0)
|
||||
Serializable::DeserializeNew <HostDevice> (stream);
|
||||
else
|
||||
device.Serialize (stream);
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
catch (ParameterIncorrect &) { }
|
||||
scopes.clear();
|
||||
SerializationScope reusable (stream);
|
||||
}
|
||||
|
||||
device.Partitions.assign ((size_t) Serializer::MaxCollectionSize + 1, partition);
|
||||
try
|
||||
{
|
||||
shared_ptr <Stream> stream (new MemoryStream);
|
||||
device.Serialize (stream);
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
catch (ParameterIncorrect &) { }
|
||||
}
|
||||
|
||||
void CoreTest::VolumePasswordTest ()
|
||||
{
|
||||
SecureBuffer password (VolumePassword::MaxSize);
|
||||
for (size_t i = 0; i < password.Size(); ++i)
|
||||
password[i] = (uint8) i;
|
||||
const size_t sizes[] = { 0, VolumePassword::MaxLegacySize, VolumePassword::MaxSize };
|
||||
for (size_t i = 0; i < array_capacity (sizes); ++i)
|
||||
{
|
||||
shared_ptr <Stream> stream (new MemoryStream);
|
||||
VolumePassword original (password.Ptr(), sizes[i]);
|
||||
original.Serialize (stream);
|
||||
shared_ptr <VolumePassword> result = Serializable::DeserializeNew <VolumePassword> (stream);
|
||||
if (*result != original)
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
|
||||
shared_ptr <Stream> stream (new MemoryStream);
|
||||
Serializer sr (stream);
|
||||
Serializable::SerializeHeader (sr, "VolumePassword");
|
||||
sr.Serialize ("PasswordSize", (uint64) VolumePassword::MaxSize + 1);
|
||||
try
|
||||
{
|
||||
Serializable::DeserializeNew <VolumePassword> (stream);
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
catch (ParameterIncorrect &) { }
|
||||
try
|
||||
{
|
||||
VolumePassword invalid (password.Ptr(), VolumePassword::MaxSize + 1);
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
catch (PasswordTooLong &) { }
|
||||
}
|
||||
|
||||
void CoreTest::ServiceRequestTest ()
|
||||
{
|
||||
shared_ptr <Stream> stream (new MemoryStream);
|
||||
GetDeviceSizeRequest request (DevicePath (L"/dev/test"));
|
||||
request.Serialize (stream);
|
||||
shared_ptr <CoreServiceRequest> result = Serializable::DeserializeNew <CoreServiceRequest> (stream);
|
||||
GetDeviceSizeRequest *deviceRequest = dynamic_cast <GetDeviceSizeRequest *> (result.get());
|
||||
if (!deviceRequest || deviceRequest->Path != request.Path)
|
||||
throw TestFailed (SRC_POS);
|
||||
}
|
||||
|
||||
void CoreTest::TestAll ()
|
||||
{
|
||||
HostDeviceTest();
|
||||
VolumePasswordTest();
|
||||
ServiceRequestTest();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (c) 2026 AM Crypto. All rights reserved.
|
||||
|
||||
Governed by the Apache License 2.0, the full text of which is contained in
|
||||
the file License.txt included in VeraCrypt binary and source distributions.
|
||||
*/
|
||||
|
||||
#ifndef TC_HEADER_Core_CoreTest
|
||||
#define TC_HEADER_Core_CoreTest
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
class CoreTest
|
||||
{
|
||||
public:
|
||||
static void TestAll ();
|
||||
|
||||
private:
|
||||
CoreTest ();
|
||||
static void HostDeviceTest ();
|
||||
static void VolumePasswordTest ();
|
||||
static void ServiceRequestTest ();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TC_HEADER_Core_CoreTest
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
void HostDevice::Deserialize (shared_ptr <Stream> stream)
|
||||
void HostDevice::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializer sr (stream);
|
||||
MountPoint = sr.DeserializeWString ("MountPoint");
|
||||
@@ -27,13 +27,16 @@ namespace VeraCrypt
|
||||
|
||||
uint32 partitionCount;
|
||||
sr.Deserialize ("Partitions", partitionCount);
|
||||
Serializer::ValidateCollectionSize (partitionCount);
|
||||
HostDeviceList partitions;
|
||||
for (uint32 i = 0; i < partitionCount; i++)
|
||||
Partitions.push_back (Serializable::DeserializeNew <HostDevice> (stream));
|
||||
partitions.push_back (Serializable::DeserializeNew <HostDevice> (stream));
|
||||
Partitions.swap (partitions);
|
||||
}
|
||||
|
||||
void HostDevice::Serialize (shared_ptr <Stream> stream) const
|
||||
void HostDevice::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer::ValidateCollectionSize (Partitions.size());
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("MountPoint", wstring (MountPoint));
|
||||
sr.Serialize ("Name", Name);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace VeraCrypt
|
||||
TC_CLONE (EMVSupportEnabled);
|
||||
}
|
||||
|
||||
void MountOptions::Deserialize (shared_ptr <Stream> stream)
|
||||
void MountOptions::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializer sr (stream);
|
||||
wstring nameValue;
|
||||
@@ -132,9 +132,8 @@ namespace VeraCrypt
|
||||
sr.Deserialize ("ProtectionPim", ProtectionPim);
|
||||
}
|
||||
|
||||
void MountOptions::Serialize (shared_ptr <Stream> stream) const
|
||||
void MountOptions::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
|
||||
sr.Serialize ("CachePassword", CachePassword);
|
||||
|
||||
@@ -574,14 +574,12 @@ namespace VeraCrypt
|
||||
if (errOutput.empty())
|
||||
return;
|
||||
|
||||
unique_ptr <Serializable> deserializedObject;
|
||||
Exception *deserializedException = nullptr;
|
||||
shared_ptr <Exception> deserializedException;
|
||||
|
||||
try
|
||||
{
|
||||
shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((uint8 *) &errOutput[0], errOutput.size())));
|
||||
deserializedObject.reset (Serializable::DeserializeNew (stream));
|
||||
deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
|
||||
deserializedException = Serializable::DeserializeNew <Exception> (stream);
|
||||
}
|
||||
catch (...) { }
|
||||
|
||||
@@ -1076,9 +1074,21 @@ namespace VeraCrypt
|
||||
}
|
||||
#endif
|
||||
|
||||
unique_ptr <Serializable> CoreService::GetResponseObject ()
|
||||
template <class T>
|
||||
static bool IsResponseType (const Serializable &object)
|
||||
{
|
||||
unique_ptr <Serializable> deserializedObject (Serializable::DeserializeNew (ServiceOutputStream));
|
||||
return Serializable::IsType <T> (object) || Serializable::IsType <Exception> (object);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static bool IsInitialResponseType (const Serializable &object)
|
||||
{
|
||||
return IsResponseType <T> (object) || Serializable::IsType <ElevatedServiceStartedResponse> (object);
|
||||
}
|
||||
|
||||
unique_ptr <Serializable> CoreService::GetResponseObject (Serializable::TypeValidator isExpectedType)
|
||||
{
|
||||
unique_ptr <Serializable> deserializedObject (Serializable::DeserializeNew (ServiceOutputStream, isExpectedType));
|
||||
|
||||
Exception *deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
|
||||
if (deserializedException)
|
||||
@@ -1090,7 +1100,7 @@ namespace VeraCrypt
|
||||
template <class T>
|
||||
unique_ptr <T> CoreService::GetResponse ()
|
||||
{
|
||||
unique_ptr <Serializable> deserializedObject (GetResponseObject());
|
||||
unique_ptr <Serializable> deserializedObject (GetResponseObject (&IsResponseType <T>));
|
||||
|
||||
if (dynamic_cast <T *> (deserializedObject.get()) == nullptr)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
@@ -1206,7 +1216,7 @@ namespace VeraCrypt
|
||||
ElevatedServiceStartedResponse().Serialize (outputStream);
|
||||
|
||||
request->Serialize (ServiceInputStream);
|
||||
GetResponse <Serializable>()->Serialize (outputStream);
|
||||
GetResponse <CoreServiceResponse>()->Serialize (outputStream);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1500,7 +1510,7 @@ namespace VeraCrypt
|
||||
{
|
||||
request.Serialize (ServiceInputStream);
|
||||
|
||||
unique_ptr <Serializable> response (GetResponseObject());
|
||||
unique_ptr <Serializable> response (GetResponseObject (&IsInitialResponseType <T>));
|
||||
if (dynamic_cast <ElevatedServiceStartedResponse *> (response.get()) != nullptr)
|
||||
{
|
||||
// The elevated channel is usable even if the forwarded request fails.
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace VeraCrypt
|
||||
static void Stop ();
|
||||
|
||||
protected:
|
||||
static unique_ptr <Serializable> GetResponseObject ();
|
||||
static unique_ptr <Serializable> GetResponseObject (Serializable::TypeValidator isExpectedType);
|
||||
template <class T> static unique_ptr <T> GetResponse ();
|
||||
template <class T> static unique_ptr <T> SendRequest (CoreServiceRequest &request);
|
||||
static void StartElevated (const CoreServiceRequest &request);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace VeraCrypt
|
||||
{
|
||||
void CoreServiceRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void CoreServiceRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializer sr (stream);
|
||||
sr.Deserialize ("AdminPassword", AdminPassword);
|
||||
@@ -28,9 +28,8 @@ namespace VeraCrypt
|
||||
sr.Deserialize ("AllowInsecureMount", AllowInsecureMount);
|
||||
}
|
||||
|
||||
void CoreServiceRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void CoreServiceRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("AdminPassword", AdminPassword);
|
||||
sr.Serialize ("ApplicationExecutablePath", wstring (ApplicationExecutablePath));
|
||||
@@ -42,9 +41,9 @@ namespace VeraCrypt
|
||||
}
|
||||
|
||||
// CheckFilesystemRequest
|
||||
void CheckFilesystemRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void CheckFilesystemRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
MountedVolumeInfo = Serializable::DeserializeNew <VolumeInfo> (stream);
|
||||
sr.Deserialize ("Repair", Repair);
|
||||
@@ -58,18 +57,18 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void CheckFilesystemRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void CheckFilesystemRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
MountedVolumeInfo->Serialize (stream);
|
||||
sr.Serialize ("Repair", Repair);
|
||||
}
|
||||
|
||||
// DismountFilesystemRequest
|
||||
void DismountFilesystemRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void DismountFilesystemRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Deserialize ("Force", Force);
|
||||
MountPoint = sr.DeserializeWString ("MountPoint");
|
||||
@@ -80,18 +79,18 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void DismountFilesystemRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void DismountFilesystemRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Force", Force);
|
||||
sr.Serialize ("MountPoint", wstring (MountPoint));
|
||||
}
|
||||
|
||||
// DismountVolumeRequest
|
||||
void DismountVolumeRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void DismountVolumeRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Deserialize ("IgnoreOpenFiles", IgnoreOpenFiles);
|
||||
sr.Deserialize ("SyncVolumeInfo", SyncVolumeInfo);
|
||||
@@ -119,9 +118,9 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void DismountVolumeRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void DismountVolumeRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("IgnoreOpenFiles", IgnoreOpenFiles);
|
||||
sr.Serialize ("SyncVolumeInfo", SyncVolumeInfo);
|
||||
@@ -130,9 +129,9 @@ namespace VeraCrypt
|
||||
|
||||
#ifdef TC_LINUX
|
||||
// EmergencyDismountVolumeRequest
|
||||
void EmergencyDismountVolumeRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void EmergencyDismountVolumeRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
MountedVolumeInfo = Serializable::DeserializeNew <VolumeInfo> (stream);
|
||||
}
|
||||
|
||||
@@ -141,17 +140,17 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void EmergencyDismountVolumeRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void EmergencyDismountVolumeRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
MountedVolumeInfo->Serialize (stream);
|
||||
}
|
||||
#endif
|
||||
|
||||
// GetDeviceSectorSizeRequest
|
||||
void GetDeviceSectorSizeRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void GetDeviceSectorSizeRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
Path = sr.DeserializeWString ("Path");
|
||||
}
|
||||
@@ -161,17 +160,17 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void GetDeviceSectorSizeRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void GetDeviceSectorSizeRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Path", wstring (Path));
|
||||
}
|
||||
|
||||
// GetDeviceSizeRequest
|
||||
void GetDeviceSizeRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void GetDeviceSizeRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
Path = sr.DeserializeWString ("Path");
|
||||
}
|
||||
@@ -181,17 +180,17 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void GetDeviceSizeRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void GetDeviceSizeRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Path", wstring (Path));
|
||||
}
|
||||
|
||||
// GetHostDevicesRequest
|
||||
void GetHostDevicesRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void GetHostDevicesRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Deserialize ("PathListOnly", PathListOnly);
|
||||
}
|
||||
@@ -201,29 +200,29 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void GetHostDevicesRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void GetHostDevicesRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("PathListOnly", PathListOnly);
|
||||
}
|
||||
|
||||
// ExitRequest
|
||||
void ExitRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void ExitRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
}
|
||||
|
||||
void ExitRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void ExitRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
// ExecuteMacOSXAPFSFormatterRequest
|
||||
void ExecuteMacOSXAPFSFormatterRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void ExecuteMacOSXAPFSFormatterRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
Device = sr.DeserializeWString ("Device");
|
||||
sr.Deserialize ("OwnerGroupId", OwnerGroupId);
|
||||
@@ -235,9 +234,9 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void ExecuteMacOSXAPFSFormatterRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void ExecuteMacOSXAPFSFormatterRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Device", wstring (Device));
|
||||
sr.Serialize ("OwnerGroupId", OwnerGroupId);
|
||||
@@ -247,9 +246,9 @@ namespace VeraCrypt
|
||||
|
||||
#ifdef TC_OPENBSD
|
||||
// ExecuteOpenBSDFFSFormatterRequest
|
||||
void ExecuteOpenBSDFFSFormatterRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void ExecuteOpenBSDFFSFormatterRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
Device = sr.DeserializeWString ("Device");
|
||||
sr.Deserialize ("OwnerGroupId", OwnerGroupId);
|
||||
@@ -261,9 +260,9 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void ExecuteOpenBSDFFSFormatterRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void ExecuteOpenBSDFFSFormatterRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Device", wstring (Device));
|
||||
sr.Serialize ("OwnerGroupId", OwnerGroupId);
|
||||
@@ -272,9 +271,9 @@ namespace VeraCrypt
|
||||
#endif
|
||||
|
||||
// MountVolumeRequest
|
||||
void MountVolumeRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void MountVolumeRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
DeserializedOptions = Serializable::DeserializeNew <MountOptions> (stream);
|
||||
Options = DeserializedOptions.get();
|
||||
@@ -301,17 +300,17 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void MountVolumeRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void MountVolumeRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
Options->Serialize (stream);
|
||||
}
|
||||
|
||||
// SetFileOwnerRequest
|
||||
void SetFileOwnerRequest::Deserialize (shared_ptr <Stream> stream)
|
||||
void SetFileOwnerRequest::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
CoreServiceRequest::Deserialize (stream);
|
||||
CoreServiceRequest::DeserializeData (stream);
|
||||
Serializer sr (stream);
|
||||
|
||||
uint64 owner;
|
||||
@@ -326,9 +325,9 @@ namespace VeraCrypt
|
||||
return !Core->HasAdminPrivileges();
|
||||
}
|
||||
|
||||
void SetFileOwnerRequest::Serialize (shared_ptr <Stream> stream) const
|
||||
void SetFileOwnerRequest::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
CoreServiceRequest::Serialize (stream);
|
||||
CoreServiceRequest::SerializeData (stream);
|
||||
Serializer sr (stream);
|
||||
|
||||
uint64 owner = Owner.SystemId;
|
||||
|
||||
@@ -16,134 +16,123 @@
|
||||
namespace VeraCrypt
|
||||
{
|
||||
// ElevatedServiceStartedResponse
|
||||
void ElevatedServiceStartedResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void ElevatedServiceStartedResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void ElevatedServiceStartedResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void ElevatedServiceStartedResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
|
||||
// CheckFilesystemResponse
|
||||
void CheckFilesystemResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void CheckFilesystemResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void CheckFilesystemResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void CheckFilesystemResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
|
||||
// DismountFilesystemResponse
|
||||
void DismountFilesystemResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void DismountFilesystemResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void DismountFilesystemResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void DismountFilesystemResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
|
||||
// DismountVolumeResponse
|
||||
void DismountVolumeResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void DismountVolumeResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
DismountedVolumeInfo = Serializable::DeserializeNew <VolumeInfo> (stream);
|
||||
}
|
||||
|
||||
void DismountVolumeResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void DismountVolumeResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
DismountedVolumeInfo->Serialize (stream);
|
||||
}
|
||||
|
||||
// GetDeviceSectorSizeResponse
|
||||
void GetDeviceSectorSizeResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void GetDeviceSectorSizeResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializer sr (stream);
|
||||
sr.Deserialize ("Size", Size);
|
||||
}
|
||||
|
||||
void GetDeviceSectorSizeResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void GetDeviceSectorSizeResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Size", Size);
|
||||
}
|
||||
|
||||
// GetDeviceSizeResponse
|
||||
void GetDeviceSizeResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void GetDeviceSizeResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializer sr (stream);
|
||||
sr.Deserialize ("Size", Size);
|
||||
}
|
||||
|
||||
void GetDeviceSizeResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void GetDeviceSizeResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
sr.Serialize ("Size", Size);
|
||||
}
|
||||
|
||||
// GetHostDevicesResponse
|
||||
void GetHostDevicesResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void GetHostDevicesResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializable::DeserializeList (stream, HostDevices);
|
||||
}
|
||||
|
||||
void GetHostDevicesResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void GetHostDevicesResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializable::SerializeList (stream, HostDevices);
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
// ExecuteMacOSXAPFSFormatterResponse
|
||||
void ExecuteMacOSXAPFSFormatterResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void ExecuteMacOSXAPFSFormatterResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void ExecuteMacOSXAPFSFormatterResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void ExecuteMacOSXAPFSFormatterResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TC_OPENBSD
|
||||
// ExecuteOpenBSDFFSFormatterResponse
|
||||
void ExecuteOpenBSDFFSFormatterResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void ExecuteOpenBSDFFSFormatterResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void ExecuteOpenBSDFFSFormatterResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void ExecuteOpenBSDFFSFormatterResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
#endif
|
||||
|
||||
// MountVolumeResponse
|
||||
void MountVolumeResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void MountVolumeResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
Serializer sr (stream);
|
||||
MountedVolumeInfo = Serializable::DeserializeNew <VolumeInfo> (stream);
|
||||
}
|
||||
|
||||
void MountVolumeResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void MountVolumeResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
Serializer sr (stream);
|
||||
MountedVolumeInfo->Serialize (stream);
|
||||
}
|
||||
|
||||
// SetFileOwnerResponse
|
||||
void SetFileOwnerResponse::Deserialize (shared_ptr <Stream> stream)
|
||||
void SetFileOwnerResponse::DeserializeData (shared_ptr <Stream> stream)
|
||||
{
|
||||
}
|
||||
|
||||
void SetFileOwnerResponse::Serialize (shared_ptr <Stream> stream) const
|
||||
void SetFileOwnerResponse::SerializeData (shared_ptr <Stream> stream) const
|
||||
{
|
||||
Serializable::Serialize (stream);
|
||||
}
|
||||
|
||||
TC_SERIALIZER_FACTORY_ADD_CLASS (ElevatedServiceStartedResponse);
|
||||
|
||||
Reference in new issue
Block a user