VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
commit455a4f2176a5cfbe325e1e40cea20dd3e466b64c (patch)
tree7a84d0f768ee375ea9f648bbbdeac7a4906f13fb /src/Volume
parentbf9f3ec4f0a987ae1591ab5466f6eee599203c85 (diff)
downloadVeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.tar.gz
VeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.zip
Avoid conflict with C++17 features std::byte by using uint8 type instead of byte
Diffstat (limited to 'src/Volume')
-rw-r--r--src/Volume/Cipher.cpp68
-rw-r--r--src/Volume/Cipher.h46
-rw-r--r--src/Volume/Crc32.h6
-rw-r--r--src/Volume/EncryptionAlgorithm.cpp8
-rw-r--r--src/Volume/EncryptionAlgorithm.h8
-rw-r--r--src/Volume/EncryptionMode.cpp8
-rw-r--r--src/Volume/EncryptionMode.h16
-rw-r--r--src/Volume/EncryptionModeWolfCryptXTS.cpp16
-rw-r--r--src/Volume/EncryptionModeWolfCryptXTS.h16
-rw-r--r--src/Volume/EncryptionModeXTS.cpp36
-rw-r--r--src/Volume/EncryptionModeXTS.h16
-rw-r--r--src/Volume/EncryptionTest.cpp18
-rw-r--r--src/Volume/EncryptionTest.h10
-rw-r--r--src/Volume/EncryptionThreadPool.cpp4
-rw-r--r--src/Volume/EncryptionThreadPool.h4
-rw-r--r--src/Volume/Keyfile.cpp18
-rw-r--r--src/Volume/VolumePassword.cpp2
-rw-r--r--src/Volume/VolumePassword.h6
18 files changed, 153 insertions, 153 deletions
diff --git a/src/Volume/Cipher.cpp b/src/Volume/Cipher.cpp
index d0fb7bd5..de240544 100644
--- a/src/Volume/Cipher.cpp
+++ b/src/Volume/Cipher.cpp
@@ -49,7 +49,7 @@ namespace VeraCrypt
{
}
- void Cipher::DecryptBlock (byte *data) const
+ void Cipher::DecryptBlock (uint8 *data) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -57,7 +57,7 @@ namespace VeraCrypt
Decrypt (data);
}
- void Cipher::DecryptBlocks (byte *data, size_t blockCount) const
+ void Cipher::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -69,7 +69,7 @@ namespace VeraCrypt
}
}
- void Cipher::EncryptBlock (byte *data) const
+ void Cipher::EncryptBlock (uint8 *data) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -77,7 +77,7 @@ namespace VeraCrypt
Encrypt (data);
}
- void Cipher::EncryptBlocks (byte *data, size_t blockCount) const
+ void Cipher::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -130,7 +130,7 @@ namespace VeraCrypt
Initialized = true;
}
- void Cipher::EncryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void Cipher::EncryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -138,7 +138,7 @@ namespace VeraCrypt
EncryptXTS (data, length, startDataUnitNo);
}
- void Cipher::DecryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void Cipher::DecryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -155,7 +155,7 @@ namespace VeraCrypt
// AES
- void CipherAES::Decrypt (byte *data) const
+ void CipherAES::Decrypt (uint8 *data) const
{
#ifdef TC_AES_HW_CPU
if (IsHwSupportAvailable())
@@ -165,7 +165,7 @@ namespace VeraCrypt
aes_decrypt (data, data, (aes_decrypt_ctx *) (ScheduledKey.Ptr() + sizeof (aes_encrypt_ctx)));
}
- void CipherAES::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherAES::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -187,7 +187,7 @@ namespace VeraCrypt
Cipher::DecryptBlocks (data, blockCount);
}
- void CipherAES::Encrypt (byte *data) const
+ void CipherAES::Encrypt (uint8 *data) const
{
#ifdef TC_AES_HW_CPU
if (IsHwSupportAvailable())
@@ -197,7 +197,7 @@ namespace VeraCrypt
aes_encrypt (data, data, (aes_encrypt_ctx *) ScheduledKey.Ptr());
}
- void CipherAES::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherAES::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -219,17 +219,17 @@ namespace VeraCrypt
Cipher::EncryptBlocks (data, blockCount);
}
#ifdef WOLFCRYPT_BACKEND
- void CipherAES::EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void CipherAES::EncryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
xts_encrypt (data, data, length, startDataUnitNo, (aes_encrypt_ctx *) ScheduledKey.Ptr());
}
- void CipherAES::DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void CipherAES::DecryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
xts_decrypt (data, data, length, startDataUnitNo, (aes_decrypt_ctx *) (ScheduledKey.Ptr() + sizeof (aes_encrypt_ctx)));
}
- void CipherAES::SetCipherKeyXTS (const byte *key)
+ void CipherAES::SetCipherKeyXTS (const uint8 *key)
{
if (xts_encrypt_key256 (key, (aes_encrypt_ctx *) ScheduledKey.Ptr()) != EXIT_SUCCESS)
throw CipherInitError (SRC_POS);
@@ -261,7 +261,7 @@ namespace VeraCrypt
#endif
}
- void CipherAES::SetCipherKey (const byte *key)
+ void CipherAES::SetCipherKey (const uint8 *key)
{
if (aes_encrypt_key256 (key, (aes_encrypt_ctx *) ScheduledKey.Ptr()) != EXIT_SUCCESS)
throw CipherInitError (SRC_POS);
@@ -272,12 +272,12 @@ namespace VeraCrypt
#ifndef WOLFCRYPT_BACKEND
// Serpent
- void CipherSerpent::Decrypt (byte *data) const
+ void CipherSerpent::Decrypt (uint8 *data) const
{
serpent_decrypt (data, data, ScheduledKey);
}
- void CipherSerpent::Encrypt (byte *data) const
+ void CipherSerpent::Encrypt (uint8 *data) const
{
serpent_encrypt (data, data, ScheduledKey);
}
@@ -287,12 +287,12 @@ namespace VeraCrypt
return 140*4;
}
- void CipherSerpent::SetCipherKey (const byte *key)
+ void CipherSerpent::SetCipherKey (const uint8 *key)
{
serpent_set_key (key, ScheduledKey);
}
- void CipherSerpent::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherSerpent::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -308,7 +308,7 @@ namespace VeraCrypt
Cipher::EncryptBlocks (data, blockCount);
}
- void CipherSerpent::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherSerpent::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -343,12 +343,12 @@ namespace VeraCrypt
// Twofish
- void CipherTwofish::Decrypt (byte *data) const
+ void CipherTwofish::Decrypt (uint8 *data) const
{
twofish_decrypt ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *)data, (unsigned int *)data);
}
- void CipherTwofish::Encrypt (byte *data) const
+ void CipherTwofish::Encrypt (uint8 *data) const
{
twofish_encrypt ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *)data, (unsigned int *)data);
}
@@ -358,12 +358,12 @@ namespace VeraCrypt
return TWOFISH_KS;
}
- void CipherTwofish::SetCipherKey (const byte *key)
+ void CipherTwofish::SetCipherKey (const uint8 *key)
{
twofish_set_key ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *) key);
}
- void CipherTwofish::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherTwofish::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -375,7 +375,7 @@ namespace VeraCrypt
#endif
}
- void CipherTwofish::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherTwofish::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -397,12 +397,12 @@ namespace VeraCrypt
}
// Camellia
- void CipherCamellia::Decrypt (byte *data) const
+ void CipherCamellia::Decrypt (uint8 *data) const
{
camellia_decrypt (data, data, ScheduledKey.Ptr());
}
- void CipherCamellia::Encrypt (byte *data) const
+ void CipherCamellia::Encrypt (uint8 *data) const
{
camellia_encrypt (data, data, ScheduledKey.Ptr());
}
@@ -412,12 +412,12 @@ namespace VeraCrypt
return CAMELLIA_KS;
}
- void CipherCamellia::SetCipherKey (const byte *key)
+ void CipherCamellia::SetCipherKey (const uint8 *key)
{
camellia_set_key (key, ScheduledKey.Ptr());
}
- void CipherCamellia::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherCamellia::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -429,7 +429,7 @@ namespace VeraCrypt
#endif
}
- void CipherCamellia::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherCamellia::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -451,12 +451,12 @@ namespace VeraCrypt
}
// Kuznyechik
- void CipherKuznyechik::Decrypt (byte *data) const
+ void CipherKuznyechik::Decrypt (uint8 *data) const
{
kuznyechik_decrypt_block (data, data, (kuznyechik_kds *) ScheduledKey.Ptr());
}
- void CipherKuznyechik::Encrypt (byte *data) const
+ void CipherKuznyechik::Encrypt (uint8 *data) const
{
kuznyechik_encrypt_block (data, data, (kuznyechik_kds *) ScheduledKey.Ptr());
}
@@ -466,11 +466,11 @@ namespace VeraCrypt
return KUZNYECHIK_KS;
}
- void CipherKuznyechik::SetCipherKey (const byte *key)
+ void CipherKuznyechik::SetCipherKey (const uint8 *key)
{
kuznyechik_set_key (key, (kuznyechik_kds *) ScheduledKey.Ptr());
}
- void CipherKuznyechik::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherKuznyechik::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -486,7 +486,7 @@ namespace VeraCrypt
Cipher::EncryptBlocks (data, blockCount);
}
- void CipherKuznyechik::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherKuznyechik::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
diff --git a/src/Volume/Cipher.h b/src/Volume/Cipher.h
index 1b7fd233..c53cfbd9 100644
--- a/src/Volume/Cipher.h
+++ b/src/Volume/Cipher.h
@@ -26,18 +26,18 @@ namespace VeraCrypt
public:
virtual ~Cipher ();
- virtual void DecryptBlock (byte *data) const;
- virtual void DecryptBlocks (byte *data, size_t blockCount) const;
+ virtual void DecryptBlock (uint8 *data) const;
+ virtual void DecryptBlocks (uint8 *data, size_t blockCount) const;
#ifndef WOLFCRYPT_BACKEND
static void EnableHwSupport (bool enable) { HwSupportEnabled = enable; }
#else
static void EnableHwSupport (bool enable) { HwSupportEnabled = false; }
- virtual void EncryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const;
- virtual void DecryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const;
+ virtual void EncryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ virtual void DecryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
virtual void SetKeyXTS (const ConstBufferPtr &key);
#endif
- virtual void EncryptBlock (byte *data) const;
- virtual void EncryptBlocks (byte *data, size_t blockCount) const;
+ virtual void EncryptBlock (uint8 *data) const;
+ virtual void EncryptBlocks (uint8 *data, size_t blockCount) const;
static CipherList GetAvailableCiphers ();
virtual size_t GetBlockSize () const = 0;
virtual const SecureBuffer &GetKey () const { return Key; }
@@ -53,14 +53,14 @@ namespace VeraCrypt
protected:
Cipher ();
- virtual void Decrypt (byte *data) const = 0;
- virtual void Encrypt (byte *data) const = 0;
+ virtual void Decrypt (uint8 *data) const = 0;
+ virtual void Encrypt (uint8 *data) const = 0;
virtual size_t GetScheduledKeySize () const = 0;
- virtual void SetCipherKey (const byte *key) = 0;
+ virtual void SetCipherKey (const uint8 *key) = 0;
#ifdef WOLFCRYPT_BACKEND
- virtual void DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const = 0;
- virtual void EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const = 0;
- virtual void SetCipherKeyXTS (const byte *key) = 0;
+ virtual void DecryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const = 0;
+ virtual void EncryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const = 0;
+ virtual void SetCipherKeyXTS (const uint8 *key) = 0;
#endif
static bool HwSupportEnabled;
@@ -97,13 +97,13 @@ namespace VeraCrypt
TC_CIPHER_ADD_METHODS \
\
protected: \
- virtual void Decrypt (byte *data) const; \
- virtual void Encrypt (byte *data) const; \
+ virtual void Decrypt (uint8 *data) const; \
+ virtual void Encrypt (uint8 *data) const; \
virtual size_t GetScheduledKeySize () const; \
- virtual void SetCipherKey (const byte *key); \
- virtual void DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const; \
- virtual void SetCipherKeyXTS (const byte *key); \
- virtual void EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const; \
+ virtual void SetCipherKey (const uint8 *key); \
+ virtual void DecryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const; \
+ virtual void SetCipherKeyXTS (const uint8 *key); \
+ virtual void EncryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const; \
\
private: \
TC_JOIN (Cipher,NAME) (const TC_JOIN (Cipher,NAME) &); \
@@ -126,10 +126,10 @@ namespace VeraCrypt
TC_CIPHER_ADD_METHODS \
\
protected: \
- virtual void Decrypt (byte *data) const; \
- virtual void Encrypt (byte *data) const; \
+ virtual void Decrypt (uint8 *data) const; \
+ virtual void Encrypt (uint8 *data) const; \
virtual size_t GetScheduledKeySize () const; \
- virtual void SetCipherKey (const byte *key); \
+ virtual void SetCipherKey (const uint8 *key); \
\
private: \
TC_JOIN (Cipher,NAME) (const TC_JOIN (Cipher,NAME) &); \
@@ -139,8 +139,8 @@ namespace VeraCrypt
#endif
#define TC_CIPHER_ADD_METHODS \
- virtual void DecryptBlocks (byte *data, size_t blockCount) const; \
- virtual void EncryptBlocks (byte *data, size_t blockCount) const; \
+ virtual void DecryptBlocks (uint8 *data, size_t blockCount) const; \
+ virtual void EncryptBlocks (uint8 *data, size_t blockCount) const; \
virtual bool IsHwSupportAvailable () const;
TC_CIPHER (AES, 16, 32);
diff --git a/src/Volume/Crc32.h b/src/Volume/Crc32.h
index ced20457..ebe7aa83 100644
--- a/src/Volume/Crc32.h
+++ b/src/Volume/Crc32.h
@@ -26,14 +26,14 @@ namespace VeraCrypt
uint32 Get () const { return CrcValue ^ 0xffffFFFF; }
- uint32 Process (byte data)
+ uint32 Process (uint8 data)
{
- return CrcValue = crc_32_tab[(byte) (CrcValue ^ data)] ^ (CrcValue >> 8);
+ return CrcValue = crc_32_tab[(uint8) (CrcValue ^ data)] ^ (CrcValue >> 8);
}
static uint32 ProcessBuffer (const ConstBufferPtr &buffer)
{
- return ::GetCrc32 (const_cast<byte *> (buffer.Get()), static_cast<int> (buffer.Size()));
+ return ::GetCrc32 (const_cast<uint8 *> (buffer.Get()), static_cast<int> (buffer.Size()));
}
protected:
diff --git a/src/Volume/EncryptionAlgorithm.cpp b/src/Volume/EncryptionAlgorithm.cpp
index 0178da00..4a325fe3 100644
--- a/src/Volume/EncryptionAlgorithm.cpp
+++ b/src/Volume/EncryptionAlgorithm.cpp
@@ -26,7 +26,7 @@ namespace VeraCrypt
{
}
- void EncryptionAlgorithm::Decrypt (byte *data, uint64 length) const
+ void EncryptionAlgorithm::Decrypt (uint8 *data, uint64 length) const
{
if_debug (ValidateState ());
Mode->Decrypt (data, length);
@@ -37,13 +37,13 @@ namespace VeraCrypt
Decrypt (data, data.Size());
}
- void EncryptionAlgorithm::DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionAlgorithm::DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
if_debug (ValidateState());
Mode->DecryptSectors (data, sectorIndex, sectorCount, sectorSize);
}
- void EncryptionAlgorithm::Encrypt (byte *data, uint64 length) const
+ void EncryptionAlgorithm::Encrypt (uint8 *data, uint64 length) const
{
if_debug (ValidateState());
Mode->Encrypt (data, length);
@@ -54,7 +54,7 @@ namespace VeraCrypt
Encrypt (data, data.Size());
}
- void EncryptionAlgorithm::EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionAlgorithm::EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
if_debug (ValidateState ());
Mode->EncryptSectors (data, sectorIndex, sectorCount, sectorSize);
diff --git a/src/Volume/EncryptionAlgorithm.h b/src/Volume/EncryptionAlgorithm.h
index d60082fa..e9f9b9ef 100644
--- a/src/Volume/EncryptionAlgorithm.h
+++ b/src/Volume/EncryptionAlgorithm.h
@@ -27,12 +27,12 @@ namespace VeraCrypt
public:
virtual ~EncryptionAlgorithm ();
- virtual void Decrypt (byte *data, uint64 length) const;
+ virtual void Decrypt (uint8 *data, uint64 length) const;
virtual void Decrypt (const BufferPtr &data) const;
- virtual void DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void Encrypt (byte *data, uint64 length) const;
+ virtual void DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (uint8 *data, uint64 length) const;
virtual void Encrypt (const BufferPtr &data) const;
- virtual void EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
static EncryptionAlgorithmList GetAvailableAlgorithms ();
virtual const CipherList &GetCiphers () const { return Ciphers; }
virtual shared_ptr <EncryptionAlgorithm> GetNew () const = 0;
diff --git a/src/Volume/EncryptionMode.cpp b/src/Volume/EncryptionMode.cpp
index 81d275b6..6a63efe5 100644
--- a/src/Volume/EncryptionMode.cpp
+++ b/src/Volume/EncryptionMode.cpp
@@ -27,12 +27,12 @@ namespace VeraCrypt
{
}
- void EncryptionMode::DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionMode::DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptionThreadPool::DoWork (EncryptionThreadPool::WorkType::DecryptDataUnits, this, data, sectorIndex, sectorCount, sectorSize);
}
- void EncryptionMode::EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionMode::EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptionThreadPool::DoWork (EncryptionThreadPool::WorkType::EncryptDataUnits, this, data, sectorIndex, sectorCount, sectorSize);
}
@@ -56,13 +56,13 @@ namespace VeraCrypt
throw NotInitialized (SRC_POS);
}
- void EncryptionMode::ValidateParameters (byte *data, uint64 length) const
+ void EncryptionMode::ValidateParameters (uint8 *data, uint64 length) const
{
if ((Ciphers.size() > 0 && (length % Ciphers.front()->GetBlockSize()) != 0))
throw ParameterIncorrect (SRC_POS);
}
- void EncryptionMode::ValidateParameters (byte *data, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionMode::ValidateParameters (uint8 *data, uint64 sectorCount, size_t sectorSize) const
{
if (sectorCount == 0 || sectorSize == 0 || (sectorSize % EncryptionDataUnitSize) != 0)
throw ParameterIncorrect (SRC_POS);
diff --git a/src/Volume/EncryptionMode.h b/src/Volume/EncryptionMode.h
index a629d6b7..0da28fa7 100644
--- a/src/Volume/EncryptionMode.h
+++ b/src/Volume/EncryptionMode.h
@@ -27,12 +27,12 @@ namespace VeraCrypt
public:
virtual ~EncryptionMode ();
- virtual void Decrypt (byte *data, uint64 length) const = 0;
- virtual void DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
- virtual void Encrypt (byte *data, uint64 length) const = 0;
- virtual void EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
+ virtual void Decrypt (uint8 *data, uint64 length) const = 0;
+ virtual void DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
+ virtual void Encrypt (uint8 *data, uint64 length) const = 0;
+ virtual void EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
static EncryptionModeList GetAvailableModes ();
virtual const SecureBuffer &GetKey () const { throw NotApplicable (SRC_POS); }
virtual size_t GetKeySize () const = 0;
@@ -48,8 +48,8 @@ namespace VeraCrypt
EncryptionMode ();
virtual void ValidateState () const;
- void ValidateParameters (byte *data, uint64 length) const;
- virtual void ValidateParameters (byte *data, uint64 sectorCount, size_t sectorSize) const;
+ void ValidateParameters (uint8 *data, uint64 length) const;
+ virtual void ValidateParameters (uint8 *data, uint64 sectorCount, size_t sectorSize) const;
static const size_t EncryptionDataUnitSize = ENCRYPTION_DATA_UNIT_SIZE;
diff --git a/src/Volume/EncryptionModeWolfCryptXTS.cpp b/src/Volume/EncryptionModeWolfCryptXTS.cpp
index 891f6007..878ad042 100644
--- a/src/Volume/EncryptionModeWolfCryptXTS.cpp
+++ b/src/Volume/EncryptionModeWolfCryptXTS.cpp
@@ -6,12 +6,12 @@
namespace VeraCrypt
{
- void EncryptionModeWolfCryptXTS::Encrypt (byte *data, uint64 length) const
+ void EncryptionModeWolfCryptXTS::Encrypt (uint8 *data, uint64 length) const
{
EncryptBuffer (data, length, 0);
}
- void EncryptionModeWolfCryptXTS::EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeWolfCryptXTS::EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -26,12 +26,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.end());
}
- void EncryptionModeWolfCryptXTS::EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeWolfCryptXTS::EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
cipher.EncryptBlockXTS(buffer, length, startDataUnitNo);
}
- void EncryptionModeWolfCryptXTS::EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeWolfCryptXTS::EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
@@ -50,12 +50,12 @@ namespace VeraCrypt
return keySize;
}
- void EncryptionModeWolfCryptXTS::Decrypt (byte *data, uint64 length) const
+ void EncryptionModeWolfCryptXTS::Decrypt (uint8 *data, uint64 length) const
{
DecryptBuffer (data, length, 0);
}
- void EncryptionModeWolfCryptXTS::DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeWolfCryptXTS::DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -70,12 +70,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.begin());
}
- void EncryptionModeWolfCryptXTS::DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeWolfCryptXTS::DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
cipher.DecryptBlockXTS(buffer, length, startDataUnitNo);
}
- void EncryptionModeWolfCryptXTS::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeWolfCryptXTS::DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
DecryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
diff --git a/src/Volume/EncryptionModeWolfCryptXTS.h b/src/Volume/EncryptionModeWolfCryptXTS.h
index e432f768..c9f2d59f 100644
--- a/src/Volume/EncryptionModeWolfCryptXTS.h
+++ b/src/Volume/EncryptionModeWolfCryptXTS.h
@@ -24,10 +24,10 @@ namespace VeraCrypt
EncryptionModeWolfCryptXTS () { }
virtual ~EncryptionModeWolfCryptXTS () { }
- virtual void Decrypt (byte *data, uint64 length) const;
- virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void Encrypt (byte *data, uint64 length) const;
- virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Decrypt (uint8 *data, uint64 length) const;
+ virtual void DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (uint8 *data, uint64 length) const;
+ virtual void EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
virtual const SecureBuffer &GetKey () const { return SecondaryKey; }
virtual size_t GetKeySize () const;
virtual wstring GetName () const { return L"XTS"; };
@@ -36,10 +36,10 @@ namespace VeraCrypt
virtual void SetKey (const ConstBufferPtr &key);
protected:
- void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
- void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
void SetSecondaryCipherKeys ();
SecureBuffer SecondaryKey;
diff --git a/src/Volume/EncryptionModeXTS.cpp b/src/Volume/EncryptionModeXTS.cpp
index 56ee895c..001bfcf8 100644
--- a/src/Volume/EncryptionModeXTS.cpp
+++ b/src/Volume/EncryptionModeXTS.cpp
@@ -47,12 +47,12 @@
namespace VeraCrypt
{
- void EncryptionModeXTS::Encrypt (byte *data, uint64 length) const
+ void EncryptionModeXTS::Encrypt (uint8 *data, uint64 length) const
{
EncryptBuffer (data, length, 0);
}
- void EncryptionModeXTS::EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeXTS::EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -67,12 +67,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.end());
}
- void EncryptionModeXTS::EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeXTS::EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
- byte finalCarry;
- byte whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
- byte whiteningValue [BYTES_PER_XTS_BLOCK];
- byte byteBufUnitNo [BYTES_PER_XTS_BLOCK];
+ uint8 finalCarry;
+ uint8 whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 whiteningValue [BYTES_PER_XTS_BLOCK];
+ uint8 byteBufUnitNo [BYTES_PER_XTS_BLOCK];
uint64 *whiteningValuesPtr64 = (uint64 *) whiteningValues;
uint64 *whiteningValuePtr64 = (uint64 *) whiteningValue;
uint64 *bufPtr = (uint64 *) buffer;
@@ -182,7 +182,7 @@ namespace VeraCrypt
}
#endif
// Actual encryption
- cipher.EncryptBlocks ((byte *) dataUnitBufPtr, countBlock);
+ cipher.EncryptBlocks ((uint8 *) dataUnitBufPtr, countBlock);
bufPtr = dataUnitBufPtr;
whiteningValuesPtr64 = (uint64 *) whiteningValues;
@@ -207,7 +207,7 @@ namespace VeraCrypt
FAST_ERASE64 (whiteningValues, sizeof (whiteningValues));
}
- void EncryptionModeXTS::EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeXTS::EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
@@ -226,12 +226,12 @@ namespace VeraCrypt
return keySize;
}
- void EncryptionModeXTS::Decrypt (byte *data, uint64 length) const
+ void EncryptionModeXTS::Decrypt (uint8 *data, uint64 length) const
{
DecryptBuffer (data, length, 0);
}
- void EncryptionModeXTS::DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeXTS::DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -246,12 +246,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.begin());
}
- void EncryptionModeXTS::DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeXTS::DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
- byte finalCarry;
- byte whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
- byte whiteningValue [BYTES_PER_XTS_BLOCK];
- byte byteBufUnitNo [BYTES_PER_XTS_BLOCK];
+ uint8 finalCarry;
+ uint8 whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 whiteningValue [BYTES_PER_XTS_BLOCK];
+ uint8 byteBufUnitNo [BYTES_PER_XTS_BLOCK];
uint64 *whiteningValuesPtr64 = (uint64 *) whiteningValues;
uint64 *whiteningValuePtr64 = (uint64 *) whiteningValue;
uint64 *bufPtr = (uint64 *) buffer;
@@ -352,7 +352,7 @@ namespace VeraCrypt
*bufPtr++ ^= *whiteningValuesPtr64++;
}
#endif
- cipher.DecryptBlocks ((byte *) dataUnitBufPtr, countBlock);
+ cipher.DecryptBlocks ((uint8 *) dataUnitBufPtr, countBlock);
bufPtr = dataUnitBufPtr;
whiteningValuesPtr64 = (uint64 *) whiteningValues;
@@ -376,7 +376,7 @@ namespace VeraCrypt
FAST_ERASE64 (whiteningValues, sizeof (whiteningValues));
}
- void EncryptionModeXTS::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeXTS::DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
DecryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
diff --git a/src/Volume/EncryptionModeXTS.h b/src/Volume/EncryptionModeXTS.h
index 6f674073..cbed0d33 100644
--- a/src/Volume/EncryptionModeXTS.h
+++ b/src/Volume/EncryptionModeXTS.h
@@ -24,10 +24,10 @@ namespace VeraCrypt
EncryptionModeXTS () { }
virtual ~EncryptionModeXTS () { }
- virtual void Decrypt (byte *data, uint64 length) const;
- virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void Encrypt (byte *data, uint64 length) const;
- virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Decrypt (uint8 *data, uint64 length) const;
+ virtual void DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (uint8 *data, uint64 length) const;
+ virtual void EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
virtual const SecureBuffer &GetKey () const { return SecondaryKey; }
virtual size_t GetKeySize () const;
virtual wstring GetName () const { return L"XTS"; };
@@ -36,10 +36,10 @@ namespace VeraCrypt
virtual void SetKey (const ConstBufferPtr &key);
protected:
- void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
- void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
void SetSecondaryCipherKeys ();
SecureBuffer SecondaryKey;
diff --git a/src/Volume/EncryptionTest.cpp b/src/Volume/EncryptionTest.cpp
index c900885e..9009be66 100644
--- a/src/Volume/EncryptionTest.cpp
+++ b/src/Volume/EncryptionTest.cpp
@@ -46,9 +46,9 @@ namespace VeraCrypt
struct CipherTestVector
{
- byte Key[32];
- byte Plaintext[16];
- byte Ciphertext[16];
+ uint8 Key[32];
+ uint8 Plaintext[16];
+ uint8 Ciphertext[16];
};
static const CipherTestVector AESTestVectors[] =
@@ -179,7 +179,7 @@ namespace VeraCrypt
Buffer testData (1024);
for (size_t i = 0; i < testData.Size(); ++i)
{
- testData[i] = (byte) i;
+ testData[i] = (uint8) i;
}
uint32 origCrc = Crc32::ProcessBuffer (testData);
@@ -485,7 +485,7 @@ namespace VeraCrypt
int testCase = 0;
int nTestsPerformed = 0;
- static const byte testKey[] =
+ static const uint8 testKey[] =
{
0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
@@ -521,7 +521,7 @@ namespace VeraCrypt
Buffer modeKey (ea.GetKeySize());
for (size_t mi = 0; mi < modeKey.Size(); mi++)
- modeKey[mi] = (byte) mi;
+ modeKey[mi] = (uint8) mi;
modeKey.CopyFrom (ConstBufferPtr (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2, sizeof (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2)));
mode->SetKey (modeKey);
@@ -976,7 +976,7 @@ namespace VeraCrypt
Buffer modeKey (ea.GetKeySize());
for (size_t mi = 0; mi < modeKey.Size(); mi++)
- modeKey[mi] = (byte) mi;
+ modeKey[mi] = (uint8) mi;
modeKey.CopyFrom (ConstBufferPtr (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2, sizeof (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2)));
mode->SetKey (modeKey);
@@ -1110,8 +1110,8 @@ namespace VeraCrypt
void EncryptionTest::TestPkcs5 ()
{
- VolumePassword password ((byte*) "password", 8);
- static const byte saltData[] = { 0x12, 0x34, 0x56, 0x78 };
+ VolumePassword password ((uint8*) "password", 8);
+ static const uint8 saltData[] = { 0x12, 0x34, 0x56, 0x78 };
ConstBufferPtr salt (saltData, sizeof (saltData));
Buffer derivedKey (4);
diff --git a/src/Volume/EncryptionTest.h b/src/Volume/EncryptionTest.h
index 17e14fd7..fae07cb2 100644
--- a/src/Volume/EncryptionTest.h
+++ b/src/Volume/EncryptionTest.h
@@ -33,12 +33,12 @@ namespace VeraCrypt
struct XtsTestVector
{
- byte key1[32];
- byte key2[32];
- byte dataUnitNo[8];
+ uint8 key1[32];
+ uint8 key2[32];
+ uint8 dataUnitNo[8];
unsigned int blockNo;
- byte plaintext[ENCRYPTION_DATA_UNIT_SIZE];
- byte ciphertext[ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 plaintext[ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 ciphertext[ENCRYPTION_DATA_UNIT_SIZE];
};
static const XtsTestVector XtsTestVectors[];
diff --git a/src/Volume/EncryptionThreadPool.cpp b/src/Volume/EncryptionThreadPool.cpp
index 7c86bf49..36f8a622 100644
--- a/src/Volume/EncryptionThreadPool.cpp
+++ b/src/Volume/EncryptionThreadPool.cpp
@@ -26,13 +26,13 @@
namespace VeraCrypt
{
- void EncryptionThreadPool::DoWork (WorkType::Enum type, const EncryptionMode *encryptionMode, byte *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize)
+ void EncryptionThreadPool::DoWork (WorkType::Enum type, const EncryptionMode *encryptionMode, uint8 *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize)
{
size_t fragmentCount;
size_t unitsPerFragment;
size_t remainder;
- byte *fragmentData;
+ uint8 *fragmentData;
uint64 fragmentStartUnitNo;
WorkItem *workItem;
diff --git a/src/Volume/EncryptionThreadPool.h b/src/Volume/EncryptionThreadPool.h
index baf31e23..a78aee75 100644
--- a/src/Volume/EncryptionThreadPool.h
+++ b/src/Volume/EncryptionThreadPool.h
@@ -55,7 +55,7 @@ namespace VeraCrypt
struct
{
const EncryptionMode *Mode;
- byte *Data;
+ uint8 *Data;
uint64 StartUnitNo;
uint64 UnitCount;
size_t SectorSize;
@@ -63,7 +63,7 @@ namespace VeraCrypt
};
};
- static void DoWork (WorkType::Enum type, const EncryptionMode *mode, byte *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize);
+ static void DoWork (WorkType::Enum type, const EncryptionMode *mode, uint8 *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize);
static bool IsRunning () { return ThreadPoolRunning; }
static void Start ();
static void Stop ();
diff --git a/src/Volume/Keyfile.cpp b/src/Volume/Keyfile.cpp
index 24b40709..e756cdf1 100644
--- a/src/Volume/Keyfile.cpp
+++ b/src/Volume/Keyfile.cpp
@@ -35,7 +35,7 @@ namespace VeraCrypt
if (Token::IsKeyfilePathValid (Path, emvSupportEnabled))
{
// Apply keyfile generated by a security token
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
Token::getTokenKeyfile(wstring(Path))->GetKeyfileData(keyfileData);
if (keyfileData.size() < MinProcessedLength)
@@ -45,10 +45,10 @@ namespace VeraCrypt
{
uint32 crc = crc32.Process(keyfileData[i]);
- pool[poolPos++] += (byte)(crc >> 24);
- pool[poolPos++] += (byte)(crc >> 16);
- pool[poolPos++] += (byte)(crc >> 8);
- pool[poolPos++] += (byte) crc;
+ pool[poolPos++] += (uint8)(crc >> 24);
+ pool[poolPos++] += (uint8)(crc >> 16);
+ pool[poolPos++] += (uint8)(crc >> 8);
+ pool[poolPos++] += (uint8) crc;
if (poolPos >= pool.Size())
poolPos = 0;
@@ -69,10 +69,10 @@ namespace VeraCrypt
for (size_t i = 0; i < readLength; i++)
{
uint32 crc = crc32.Process(keyfileBuf[i]);
- pool[poolPos++] += (byte)(crc >> 24);
- pool[poolPos++] += (byte)(crc >> 16);
- pool[poolPos++] += (byte)(crc >> 8);
- pool[poolPos++] += (byte) crc;
+ pool[poolPos++] += (uint8)(crc >> 24);
+ pool[poolPos++] += (uint8)(crc >> 16);
+ pool[poolPos++] += (uint8)(crc >> 8);
+ pool[poolPos++] += (uint8) crc;
if (poolPos >= pool.Size())
poolPos = 0;
if (++totalLength >= MaxProcessedLength)
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
@@ -60,7 +60,7 @@ namespace VeraCrypt
sr.Serialize ("WipeData", ConstBufferPtr (wipeBuffer));
}
- void VolumePassword::Set (const byte *password, size_t size)
+ void VolumePassword::Set (const uint8 *password, size_t size)
{
AllocateBuffer ();
diff --git a/src/Volume/VolumePassword.h b/src/Volume/VolumePassword.h
index f4a3ccbe..c1e6b9b6 100644
--- a/src/Volume/VolumePassword.h
+++ b/src/Volume/VolumePassword.h
@@ -22,7 +22,7 @@ namespace VeraCrypt
{
public:
VolumePassword ();
- VolumePassword (const byte *password, size_t size) { Set (password, size); }
+ VolumePassword (const uint8 *password, size_t size) { Set (password, size); }
VolumePassword (const SecureBuffer &password) { Set (password.Ptr (), password.Size ()); }
VolumePassword (const VolumePassword &password) { Set (password); }
virtual ~VolumePassword ();
@@ -33,10 +33,10 @@ namespace VeraCrypt
operator BufferPtr () const { return BufferPtr (PasswordBuffer); }
- byte *DataPtr () const { return PasswordBuffer; }
+ uint8 *DataPtr () const { return PasswordBuffer; }
bool IsEmpty () const { return PasswordSize == 0; }
size_t Size () const { return PasswordSize; }
- void Set (const byte *password, size_t size);
+ void Set (const uint8 *password, size_t size);
void Set (const VolumePassword &password);
TC_SERIALIZABLE (VolumePassword);