VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/BootEncryption.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-16 01:17:03 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-16 01:33:19 +0200
commit9e1e128b14dd51de4e036a8002d2cad40efaaf54 (patch)
tree1d93e7317f8a7afd86989dca4e475918e97295eb /src/Common/BootEncryption.cpp
parent52c7445a795a623bc326699a5c465e8fa5294425 (diff)
downloadVeraCrypt-9e1e128b14dd51de4e036a8002d2cad40efaaf54.tar.gz
VeraCrypt-9e1e128b14dd51de4e036a8002d2cad40efaaf54.zip
Windows: Add functionality to verify Rescue Disk ISO image file.
Diffstat (limited to 'src/Common/BootEncryption.cpp')
-rw-r--r--src/Common/BootEncryption.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index d84dd05d..8b8c122c 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -1795,6 +1795,31 @@ namespace VeraCrypt
return false;
}
+ bool BootEncryption::VerifyRescueDiskIsoImage (const char* imageFile)
+ {
+ if (!RescueIsoImage)
+ throw ParameterIncorrect (SRC_POS);
+
+ try
+ {
+ File isoFile (imageFile, true);
+ isoFile.CheckOpened (SRC_POS);
+ size_t verifiedSectorCount = (TC_CD_BOOTSECTOR_OFFSET + TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET + TC_BOOT_LOADER_AREA_SIZE) / 2048;
+ Buffer buffer ((verifiedSectorCount + 1) * 2048);
+
+ DWORD bytesRead = isoFile.Read (buffer.Ptr(), (DWORD) buffer.Size());
+ if ( (bytesRead == buffer.Size())
+ && (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0)
+ )
+ {
+ return true;
+ }
+ }
+ catch (...) { }
+
+ return false;
+ }
+
#ifndef SETUP