VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Volumes.c')
-rw-r--r--src/Common/Volumes.c83
1 files changed, 3 insertions, 80 deletions
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 15ee8fe6..9a0d3efc 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -240,10 +240,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, PCR
240 240
241 // Test all available PKCS5 PRFs 241 // Test all available PKCS5 PRFs
242 for (enqPkcs5Prf = FIRST_PRF_ID; enqPkcs5Prf <= LAST_PRF_ID || queuedWorkItems > 0; ++enqPkcs5Prf) 242 for (enqPkcs5Prf = FIRST_PRF_ID; enqPkcs5Prf <= LAST_PRF_ID || queuedWorkItems > 0; ++enqPkcs5Prf)
243 { 243 {
244 BOOL lrw64InitDone = FALSE; // Deprecated/legacy
245 BOOL lrw128InitDone = FALSE; // Deprecated/legacy
246
247 if (encryptionThreadCount > 1) 244 if (encryptionThreadCount > 1)
248 { 245 {
249 // Enqueue key derivation on thread pool 246 // Enqueue key derivation on thread pool
@@ -314,12 +311,6 @@ KeyReady: ;
314 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); 311 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
315 break; 312 break;
316 313
317 case SHA1:
318 // Deprecated/legacy
319 derive_key_sha1 (keyInfo.userKey, keyInfo.keyLength, keyInfo.salt,
320 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
321 break;
322
323 case WHIRLPOOL: 314 case WHIRLPOOL:
324 derive_key_whirlpool (keyInfo.userKey, keyInfo.keyLength, keyInfo.salt, 315 derive_key_whirlpool (keyInfo.userKey, keyInfo.keyLength, keyInfo.salt,
325 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); 316 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
@@ -338,16 +329,6 @@ KeyReady: ;
338 { 329 {
339 switch (cryptoInfo->mode) 330 switch (cryptoInfo->mode)
340 { 331 {
341 case LRW:
342 case CBC:
343 case INNER_CBC:
344 case OUTER_CBC:
345
346 // For LRW (deprecated/legacy), copy the tweak key
347 // For CBC (deprecated/legacy), copy the IV/whitening seed
348 memcpy (cryptoInfo->k2, dk, LEGACY_VOL_IV_SIZE);
349 primaryKeyOffset = LEGACY_VOL_IV_SIZE;
350 break;
351 332
352 default: 333 default:
353 primaryKeyOffset = 0; 334 primaryKeyOffset = 0;
@@ -383,21 +364,9 @@ KeyReady: ;
383 goto err; 364 goto err;
384 } 365 }
385 } 366 }
386 else if (cryptoInfo->mode == LRW 367 else
387 && (blockSize == 8 && !lrw64InitDone || blockSize == 16 && !lrw128InitDone))
388 { 368 {
389 // Deprecated/legacy 369 continue;
390
391 if (!EAInitMode (cryptoInfo))
392 {
393 status = ERR_MODE_INIT_FAILED;
394 goto err;
395 }
396
397 if (blockSize == 8)
398 lrw64InitDone = TRUE;
399 else if (blockSize == 16)
400 lrw128InitDone = TRUE;
401 } 370 }
402 371
403 // Copy the header for decryption 372 // Copy the header for decryption
@@ -519,15 +488,6 @@ KeyReady: ;
519 488
520 switch (cryptoInfo->mode) 489 switch (cryptoInfo->mode)
521 { 490 {
522 case LRW:
523 case CBC:
524 case INNER_CBC:
525 case OUTER_CBC:
526
527 // For LRW (deprecated/legacy), the tweak key
528 // For CBC (deprecated/legacy), the IV/whitening seed
529 memcpy (cryptoInfo->k2, keyInfo.master_keydata, LEGACY_VOL_IV_SIZE);
530 break;
531 491
532 default: 492 default:
533 // The secondary master key (if cascade, multiple concatenated) 493 // The secondary master key (if cascade, multiple concatenated)
@@ -721,18 +681,6 @@ int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Pass
721 681
722 switch (mode) 682 switch (mode)
723 { 683 {
724 case LRW:
725 case CBC:
726 case INNER_CBC:
727 case OUTER_CBC:
728
729 // Deprecated/legacy modes of operation
730 bytesNeeded = LEGACY_VOL_IV_SIZE + EAGetKeySize (ea);
731
732 // In fact, this should never be the case since volumes being newly created are not
733 // supposed to use any deprecated mode of operation.
734 TC_THROW_FATAL_EXCEPTION;
735 break;
736 684
737 default: 685 default:
738 bytesNeeded = EAGetKeySize (ea) * 2; // Size of primary + secondary key(s) 686 bytesNeeded = EAGetKeySize (ea) * 2; // Size of primary + secondary key(s)
@@ -770,12 +718,6 @@ int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Pass
770 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); 718 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
771 break; 719 break;
772 720
773 case SHA1:
774 // Deprecated/legacy
775 derive_key_sha1 (keyInfo.userKey, keyInfo.keyLength, keyInfo.salt,
776 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
777 break;
778
779 case RIPEMD160: 721 case RIPEMD160:
780 derive_key_ripemd160 (TRUE, keyInfo.userKey, keyInfo.keyLength, keyInfo.salt, 722 derive_key_ripemd160 (TRUE, keyInfo.userKey, keyInfo.keyLength, keyInfo.salt,
781 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); 723 PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
@@ -859,16 +801,6 @@ int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Pass
859 801
860 switch (mode) 802 switch (mode)
861 { 803 {
862 case LRW:
863 case CBC:
864 case INNER_CBC:
865 case OUTER_CBC:
866
867 // For LRW (deprecated/legacy), the tweak key
868 // For CBC (deprecated/legacy), the IV/whitening seed
869 memcpy (cryptoInfo->k2, dk, LEGACY_VOL_IV_SIZE);
870 primaryKeyOffset = LEGACY_VOL_IV_SIZE;
871 break;
872 804
873 default: 805 default:
874 // The secondary key (if cascade, multiple concatenated) 806 // The secondary key (if cascade, multiple concatenated)
@@ -902,15 +834,6 @@ int CreateVolumeHeaderInMemory (BOOL bBoot, char *header, int ea, int mode, Pass
902 834
903 switch (cryptoInfo->mode) 835 switch (cryptoInfo->mode)
904 { 836 {
905 case LRW:
906 case CBC:
907 case INNER_CBC:
908 case OUTER_CBC:
909
910 // For LRW (deprecated/legacy), the tweak key
911 // For CBC (deprecated/legacy), the IV/whitening seed
912 memcpy (cryptoInfo->k2, keyInfo.master_keydata, LEGACY_VOL_IV_SIZE);
913 break;
914 837
915 default: 838 default:
916 // The secondary master key (if cascade, multiple concatenated) 839 // The secondary master key (if cascade, multiple concatenated)