VeraCrypt
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2016-10-17Securely erase and protect buffer holding decrypted volume header.Mounir IDRASSI1-0/+3
2016-10-17MacOSX: remove MacFUSE dependency and link against OSXFuse library. Now, only...Mounir IDRASSI4-73/+17
2016-10-17Windows: Perform Shutdown instead of Reboot during Pre-Test of UEFI system en...Mounir IDRASSI5-8/+8
2016-10-17Linux/MacOSX: display error message when entered PIM is too big in the Volume...Mounir IDRASSI1-0/+1
2016-10-17Use properly aligned memory in code using Streebog hash implementation that u...Mounir IDRASSI7-23/+65
2016-10-17Update copyrights in legal notices and license file.Mounir IDRASSI8-145/+478
2016-10-17Windows: fix compilation warningMounir IDRASSI1-3/+3
2016-10-17Windows MBR Bootloader: compress Camellia Rescue Disk bootloader to reduce si...Mounir IDRASSI1-1/+1
2016-10-17Windows: exclude unused libzip source files from build.Mounir IDRASSI4-24/+132
2016-10-17Windows Setup: correct call to CryptAcquireContext to use memory only contain...Mounir IDRASSI1-6/+2
2016-10-17Windows: check for malloc failures and report error in such cases.Mounir IDRASSI1-12/+39
2016-10-17Add test vectors for Kuznyechik and GOST89 (the later is deprecated)Mounir IDRASSI8-30/+338
2016-10-17Crypto: deprecate GOST89 so that it can't be used to create new volumes. Keep...Mounir IDRASSI2-2/+2
2016-10-17Linux/MacOSX: add missing check for PIM max value on volume creation wizardMounir IDRASSI1-1/+2
2016-10-17Windows Bootloader: for MBR bootloader, reset position pointers to keystroke ...Mounir IDRASSI1-0/+6
2016-10-17Windows Driver: Erase sensitive boot memory before throwing fatal exceptionMounir IDRASSI1-0/+9
2016-10-17Crypto: remove specific PBKDF2 optimization for block index encoding (except ...Mounir IDRASSI2-6/+19
2016-10-17Crypto: clarify PRF code by removing unused parameters in functions hmac_XXX_...Mounir IDRASSI1-39/+31
2016-10-17Crypto: make HMAC-SHA512 code more clear by removing the memory usage optimiz...Mounir IDRASSI1-7/+3
2016-10-17Readme: remove PKCS#11 headers as requirement since they are included in Vera...Mounir IDRASSI2-28/+8
2016-10-17GOST89 parameters swap (6.3)kavsrf2-87/+90
2016-10-17Windows: use zlib compress/uncompress functions directly in the Setup instead...Mounir IDRASSI1-136/+21
2016-10-17Windows: Replace XZip/XUnzip library with zlib and libzip and include the sou...Mounir IDRASSI154-8504/+29709
2016-09-11Language XML files: update Czech translation (contributed by Lagardere)Mounir IDRASSI1-368/+368
2016-09-11Language XML files: fix invalid escape sequence in German XML file caused by ...Mounir IDRASSI1-1/+1
2016-09-11Windows: in case of In-Place encryption, encrypt random data instead of exist...Mounir IDRASSI6-13/+9
2016-09-03Language XML files: update German translation (Ettore Atalan)Mounir IDRASSI1-83/+83
2016-08-21Increment version to 1.19 BETA2 (1.19.2)Mounir IDRASSI49-67/+67
2016-08-21Windows: Update driver files of 1.19 BETA2Mounir IDRASSI2-0/+0
2016-08-21Windows: force the update of rescue disk from version 1.18 because of the fix...Mounir IDRASSI1-1/+1
2016-08-21Windows Boot: About EFI Bootloader files linked against latest sourcesMounir IDRASSI3-0/+0
2016-08-21Windows: fix crash caused by previous Streebog fix.Mounir IDRASSI1-1/+1
2016-08-20Language XML files: update Russian XML file by Dmitry Yerokhin.Mounir IDRASSI1-26/+26
2016-08-20Windows: Fix crash on 32-bit machines when using Streebog on a CPU that suppo...Mounir IDRASSI1-1/+1
2016-08-19Windows: Add driver files of version 1.18 that have been signed by Microsoft ...Mounir IDRASSI2-0/+0
2016-08-19Linux: don't use SSE/AES switched of gcc if the architecture is not x86 or x6...Mounir IDRASSI1-15/+17
2016-08-17Windows: Fix compilation error caused by latest MacOSX change.VeraCrypt_1.18aVeraCrypt_1.18Mounir IDRASSI1-2/+2
2016-08-17Windows Boot: update EFI Boot Loader file after correction made to wrong pass...Mounir IDRASSI2-0/+0
2016-08-17Add reference of new algorithms introduced in version 1.18 (Camellia, Streebo...Mounir IDRASSI2-0/+0
2016-08-17Update License.txt with additional copyrights.Mounir IDRASSI1-0/+60
2016-08-17MacOSX: fix compiler warning about ALIGN macro being already definedMounir IDRASSI2-16/+16
2016-08-17Add reference to VeraCrypt-DCS EFI Boot loader in Readme. Update copyrights.Mounir IDRASSI5-522/+118
2016-08-17Windows: Increase text size limit in RichEdit control to avoid truncating Leg...Mounir IDRASSI1-0/+3
2016-08-17Windows Bootloader: Update EFI bootloader files built using the latest source...Mounir IDRASSI3-0/+0
2016-08-17Windows: correct handle failure of TranslateVolumeID function (should not hap...Mounir IDRASSI1-1/+2
2016-08-17Update 1.18 release dateMounir IDRASSI3-1/+1
2016-08-17Linux/MacOSX: Add Streebog to the list of supported hash algorithms used for ...Mounir IDRASSI1-0/+1
2016-08-17Linux: Disable Kernel crypto if volume encrypted using Kuznyechik or MagmaMounir IDRASSI1-0/+3
2016-08-17Linux: Add parameter to Makefile for enabling SSSE3 and SSE4.1 support in com...Mounir IDRASSI1-0/+16
2016-08-17Linux: fix compilation error on Streebog.c if SSE4.1 not enabled in compilerMounir IDRASSI2-2/+10
ss="n">openVolume->GetPkcs5Kdf()->GetTrueCryptMode ()) { newPkcs5Kdf.reset (openVolume->GetPkcs5Kdf()->Clone()); newPkcs5Kdf->SetTrueCryptMode (false); } else newPkcs5Kdf = openVolume->GetPkcs5Kdf(); } if ((openVolume->GetHeader()->GetFlags() & TC_HEADER_FLAG_ENCRYPTED_SYSTEM) != 0 && openVolume->GetType() == VolumeType::Hidden && openVolume->GetPath().IsDevice()) { throw EncryptedSystemRequired (SRC_POS); } RandomNumberGenerator::SetHash (newPkcs5Kdf->GetHash()); SecureBuffer newSalt (openVolume->GetSaltSize()); SecureBuffer newHeaderKey (VolumeHeader::GetLargestSerializedKeySize()); shared_ptr <VolumePassword> password (Keyfile::ApplyListToPassword (newKeyfiles, newPassword)); bool backupHeader = false; while (true) { for (int i = 1; i <= wipeCount; i++) { if (i == wipeCount) RandomNumberGenerator::GetData (newSalt); else RandomNumberGenerator::GetDataFast (newSalt); newPkcs5Kdf->DeriveKey (newHeaderKey, *password, newPim, newSalt); openVolume->ReEncryptHeader (backupHeader, newSalt, newHeaderKey, newPkcs5Kdf); openVolume->GetFile()->Flush(); } if (!openVolume->GetLayout()->HasBackupHeader() || backupHeader) break; backupHeader = true; } } void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const { shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles); ChangePassword (volume, newPassword, newPim, newKeyfiles, newPkcs5Kdf, wipeCount); } void CoreBase::CoalesceSlotNumberAndMountPoint (MountOptions &options) const { if (options.SlotNumber < GetFirstSlotNumber()) { if (options.MountPoint && !options.MountPoint->IsEmpty()) options.SlotNumber = MountPointToSlotNumber (*options.MountPoint); else options.SlotNumber = GetFirstFreeSlotNumber(); } if (!IsSlotNumberAvailable (options.SlotNumber)) #ifdef TC_WINDOWS throw DriveLetterUnavailable (SRC_POS); #else throw VolumeSlotUnavailable (SRC_POS); #endif if (!options.NoFilesystem && (!options.MountPoint || options.MountPoint->IsEmpty())) options.MountPoint.reset (new DirectoryPath (SlotNumberToMountPoint (options.SlotNumber))); } void CoreBase::CreateKeyfile (const FilePath &keyfilePath) const { SecureBuffer keyfileBuffer (VolumePassword::MaxSize); RandomNumberGenerator::GetData (keyfileBuffer); File keyfile; keyfile.Open (keyfilePath, File::CreateWrite); keyfile.Write (keyfileBuffer); } VolumeSlotNumber CoreBase::GetFirstFreeSlotNumber (VolumeSlotNumber startFrom) const { if (startFrom < GetFirstSlotNumber()) startFrom = GetFirstSlotNumber(); set <VolumeSlotNumber> usedSlotNumbers; foreach_ref (const VolumeInfo &volume, GetMountedVolumes()) usedSlotNumbers.insert (volume.SlotNumber); for (VolumeSlotNumber slotNumber = startFrom; slotNumber <= GetLastSlotNumber(); ++slotNumber) { if (usedSlotNumbers.find (slotNumber) == usedSlotNumbers.end() && IsMountPointAvailable (SlotNumberToMountPoint (slotNumber))) return slotNumber; } #ifdef TC_WINDOWS throw DriveLetterUnavailable (SRC_POS); #else throw VolumeSlotUnavailable (SRC_POS); #endif } uint64 CoreBase::GetMaxHiddenVolumeSize (shared_ptr <Volume> outerVolume) const { uint32 sectorSize = outerVolume->GetSectorSize(); SecureBuffer bootSectorBuffer (sectorSize); outerVolume->ReadSectors (bootSectorBuffer, 0); int fatType; byte *bootSector = bootSectorBuffer.Ptr(); if (memcmp (bootSector + 54, "FAT12", 5) == 0) fatType = 12; else if (memcmp (bootSector + 54, "FAT16", 5) == 0) fatType = 16; else if (memcmp (bootSector + 82, "FAT32", 5) == 0) fatType = 32; else throw ParameterIncorrect (SRC_POS); uint32 clusterSize = bootSector[13] * sectorSize; uint32 reservedSectorCount = Endian::Little (*(uint16 *) (bootSector + 14)); uint32 fatCount = bootSector[16]; uint64 fatSectorCount; if (fatType == 32) fatSectorCount = Endian::Little (*(uint32 *) (bootSector + 36)); else fatSectorCount = Endian::Little (*(uint16 *) (bootSector + 22)); uint64 fatSize = fatSectorCount * sectorSize; uint64 fatStartOffset = reservedSectorCount * sectorSize; uint64 dataAreaOffset = reservedSectorCount * sectorSize + fatSize * fatCount; if (fatType < 32) dataAreaOffset += Endian::Little (*(uint16 *) (bootSector + 17)) * 32; SecureBuffer sector (sectorSize); // Find last used cluster for (uint64 readOffset = fatStartOffset + fatSize - sectorSize; readOffset >= fatStartOffset; readOffset -= sectorSize) { outerVolume->ReadSectors (sector, readOffset); for (int offset = sectorSize - 4; offset >= 0; offset -= 4) { if (*(uint32 *) (sector.Ptr() + offset)) { uint64 clusterNumber = readOffset - fatStartOffset + offset; if (fatType == 12) clusterNumber = (clusterNumber * 8) / 12; else if (fatType == 16) clusterNumber /= 2; else if (fatType == 32) clusterNumber /= 4; uint64 maxSize = outerVolume->GetSize() - dataAreaOffset; // Some FAT entries may span over sector boundaries if (maxSize >= clusterSize) maxSize -= clusterSize; uint64 clusterOffset = clusterNumber * clusterSize; if (maxSize < clusterOffset) return 0; return maxSize - clusterOffset; } } } return 0; } shared_ptr <VolumeInfo> CoreBase::GetMountedVolume (const VolumePath &volumePath) const { VolumeInfoList volumes = GetMountedVolumes (volumePath); if (volumes.empty()) return shared_ptr <VolumeInfo> (); else return volumes.front(); } shared_ptr <VolumeInfo> CoreBase::GetMountedVolume (VolumeSlotNumber slot) const { foreach (shared_ptr <VolumeInfo> volume, GetMountedVolumes()) { if (volume->SlotNumber == slot) return volume; } return shared_ptr <VolumeInfo> (); } bool CoreBase::IsSlotNumberAvailable (VolumeSlotNumber slotNumber) const { if (!IsMountPointAvailable (SlotNumberToMountPoint (slotNumber))) return false; foreach_ref (const VolumeInfo &volume, GetMountedVolumes()) { if (volume.SlotNumber == slotNumber) return false; } return true; } bool CoreBase::IsVolumeMounted (const VolumePath &volumePath) const { return GetMountedVolume (volumePath); } shared_ptr <Volume> CoreBase::OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr<Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const { make_shared_auto (Volume, volume); volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope); return volume; } void CoreBase::RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const { SecureBuffer eaKey (encryptionAlgorithm->GetKeySize()); RandomNumberGenerator::GetData (eaKey); encryptionAlgorithm->SetKey (eaKey); SecureBuffer modeKey (encryptionAlgorithm->GetMode()->GetKeySize()); RandomNumberGenerator::GetData (modeKey); encryptionAlgorithm->GetMode()->SetKey (modeKey); } void CoreBase::ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles) const { shared_ptr <Pkcs5Kdf> pkcs5Kdf = header->GetPkcs5Kdf(); RandomNumberGenerator::SetHash (pkcs5Kdf->GetHash()); SecureBuffer newSalt (header->GetSaltSize()); SecureBuffer newHeaderKey (VolumeHeader::GetLargestSerializedKeySize()); shared_ptr <VolumePassword> passwordKey (Keyfile::ApplyListToPassword (keyfiles, password)); RandomNumberGenerator::GetData (newSalt); pkcs5Kdf->DeriveKey (newHeaderKey, *passwordKey, pim, newSalt); header->EncryptNew (newHeaderBuffer, newSalt, newHeaderKey, pkcs5Kdf); } }