VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Common/Apidrvr.h4
-rw-r--r--src/Common/Crypto.c874
-rw-r--r--src/Common/Crypto.h28
-rw-r--r--src/Common/Dlgcode.c53
-rw-r--r--src/Common/EncryptionThreadPool.c5
-rw-r--r--src/Common/GfMul.c110
-rw-r--r--src/Common/GfMul.h2
-rw-r--r--src/Common/Pkcs5.c153
-rw-r--r--src/Common/Tests.c646
-rw-r--r--src/Common/Volumes.c83
-rw-r--r--src/Crypto/Blowfish.c382
-rw-r--r--src/Crypto/Blowfish.h25
-rw-r--r--src/Crypto/Cast.c703
-rw-r--r--src/Crypto/Cast.h24
-rw-r--r--src/Crypto/Crypto.vcproj16
-rw-r--r--src/Crypto/Des.c406
-rw-r--r--src/Crypto/Des.h28
-rw-r--r--src/Crypto/Sha1.c282
-rw-r--r--src/Crypto/Sha1.h80
-rw-r--r--src/Driver/Driver.vcproj16
-rw-r--r--src/Mount/Mount.c80
21 files changed, 21 insertions, 3979 deletions
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index 1c7460eb..1a28dec0 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -133,10 +133,6 @@ typedef struct
133 BOOL readOnly; 133 BOOL readOnly;
134 BOOL removable; 134 BOOL removable;
135 BOOL partitionInInactiveSysEncScope; 135 BOOL partitionInInactiveSysEncScope;
136#if 0
137 unsigned __int64 volumeCreationTime; // Deprecated in v6.0
138 unsigned __int64 headerCreationTime; // Deprecated in v6.0
139#endif
140 uint32 volumeHeaderFlags; 136 uint32 volumeHeaderFlags;
141 unsigned __int64 totalBytesRead; 137 unsigned __int64 totalBytesRead;
142 unsigned __int64 totalBytesWritten; 138 unsigned __int64 totalBytesWritten;
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index dd30e488..d8f8ae3a 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -45,38 +45,27 @@ static Cipher Ciphers[] =
45 { AES, "AES", 16, 32, AES_KS }, 45 { AES, "AES", 16, 32, AES_KS },
46 { SERPENT, "Serpent", 16, 32, 140*4 }, 46 { SERPENT, "Serpent", 16, 32, 140*4 },
47 { TWOFISH, "Twofish", 16, 32, TWOFISH_KS }, 47 { TWOFISH, "Twofish", 16, 32, TWOFISH_KS },
48#ifndef TC_WINDOWS_BOOT
49 { BLOWFISH, "Blowfish", 8, 56, sizeof (BF_KEY) }, // Deprecated/legacy
50 { CAST, "CAST5", 8, 16, sizeof (CAST_KEY) }, // Deprecated/legacy
51 { TRIPLEDES,"Triple DES", 8, 8*3, sizeof (TDES_KEY) }, // Deprecated/legacy
52#endif
53 { 0, 0, 0, 0, 0 } 48 { 0, 0, 0, 0, 0 }
54}; 49};
55 50
56 51
57// Encryption algorithm configuration 52// Encryption algorithm configuration
58// The following modes have been deprecated (legacy): LRW, CBC, INNER_CBC, OUTER_CBC
59static EncryptionAlgorithm EncryptionAlgorithms[] = 53static EncryptionAlgorithm EncryptionAlgorithms[] =
60{ 54{
61 // Cipher(s) Modes FormatEnabled 55 // Cipher(s) Modes FormatEnabled
62 56
63#ifndef TC_WINDOWS_BOOT 57#ifndef TC_WINDOWS_BOOT
64 58
65 { { 0, 0 }, { 0, 0, 0, 0 }, 0 }, // Must be all-zero 59 { { 0, 0 }, { 0, 0}, 0 }, // Must be all-zero
66 { { AES, 0 }, { XTS, LRW, CBC, 0 }, 1 }, 60 { { AES, 0 }, { XTS, 0 }, 1 },
67 { { SERPENT, 0 }, { XTS, LRW, CBC, 0 }, 1 }, 61 { { SERPENT, 0 }, { XTS, 0 }, 1 },
68 { { TWOFISH, 0 }, { XTS, LRW, CBC, 0 }, 1 }, 62 { { TWOFISH, 0 }, { XTS, 0 }, 1 },
69 { { TWOFISH, AES, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, 63 { { TWOFISH, AES, 0 }, { XTS, 0 }, 1 },
70 { { SERPENT, TWOFISH, AES, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, 64 { { SERPENT, TWOFISH, AES, 0 }, { XTS, 0 }, 1 },
71 { { AES, SERPENT, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, 65 { { AES, SERPENT, 0 }, { XTS, 0 }, 1 },
72 { { AES, TWOFISH, SERPENT, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, 66 { { AES, TWOFISH, SERPENT, 0 }, { XTS, 0 }, 1 },
73 { { SERPENT, TWOFISH, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, 67 { { SERPENT, TWOFISH, 0 }, { XTS, 0 }, 1 },
74 { { BLOWFISH, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy 68 { { 0, 0 }, { 0, 0}, 0 } // Must be all-zero
75 { { CAST, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy
76 { { TRIPLEDES, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy
77 { { BLOWFISH, AES, 0 }, { INNER_CBC, 0, 0, 0 }, 0 }, // Deprecated/legacy
78 { { SERPENT, BLOWFISH, AES, 0 }, { INNER_CBC, 0, 0, 0 }, 0 }, // Deprecated/legacy
79 { { 0, 0 }, { 0, 0, 0, 0 }, 0 } // Must be all-zero
80 69
81#else // TC_WINDOWS_BOOT 70#else // TC_WINDOWS_BOOT
82 71
@@ -105,7 +94,6 @@ static Hash Hashes[] =
105#ifndef TC_WINDOWS_BOOT 94#ifndef TC_WINDOWS_BOOT
106 { SHA512, "SHA-512", FALSE, FALSE }, 95 { SHA512, "SHA-512", FALSE, FALSE },
107 { WHIRLPOOL, "Whirlpool", FALSE, FALSE }, 96 { WHIRLPOOL, "Whirlpool", FALSE, FALSE },
108 { SHA1, "SHA-1", TRUE, FALSE }, // Deprecated/legacy
109#endif 97#endif
110 { 0, 0, 0 } 98 { 0, 0, 0 }
111}; 99};
@@ -138,32 +126,6 @@ int CipherInit (int cipher, unsigned char *key, unsigned __int8 *ks)
138 twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key, CipherGetKeySize(TWOFISH) * 8); 126 twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key, CipherGetKeySize(TWOFISH) * 8);
139 break; 127 break;
140 128
141#ifndef TC_WINDOWS_BOOT
142
143 case BLOWFISH:
144 /* Deprecated/legacy */
145 BlowfishSetKey ((BF_KEY *)ks, CipherGetKeySize(BLOWFISH), key);
146 break;
147
148 case CAST:
149 /* Deprecated/legacy */
150 Cast5SetKey ((CAST_KEY *) ks, CipherGetKeySize(CAST), key);
151 break;
152
153 case TRIPLEDES:
154 /* Deprecated/legacy */
155 TripleDesSetKey (key, CipherGetKeySize (TRIPLEDES), (TDES_KEY *) ks);
156
157 // Verify whether all three DES keys are mutually different
158 if (((*((__int64 *) key) ^ *((__int64 *) key+1)) & 0xFEFEFEFEFEFEFEFEULL) == 0
159 || ((*((__int64 *) key+1) ^ *((__int64 *) key+2)) & 0xFEFEFEFEFEFEFEFEULL) == 0
160 || ((*((__int64 *) key) ^ *((__int64 *) key+2)) & 0xFEFEFEFEFEFEFEFEULL) == 0)
161 retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error
162
163 break;
164
165#endif // TC_WINDOWS_BOOT
166
167 default: 129 default:
168 // Unknown/wrong cipher ID 130 // Unknown/wrong cipher ID
169 return ERR_CIPHER_INIT_FAILURE; 131 return ERR_CIPHER_INIT_FAILURE;
@@ -188,11 +150,6 @@ void EncipherBlock(int cipher, void *data, void *ks)
188 150
189 case TWOFISH: twofish_encrypt (ks, data, data); break; 151 case TWOFISH: twofish_encrypt (ks, data, data); break;
190 case SERPENT: serpent_encrypt (data, data, ks); break; 152 case SERPENT: serpent_encrypt (data, data, ks); break;
191#ifndef TC_WINDOWS_BOOT
192 case BLOWFISH: BlowfishEncryptLE (data, data, ks, 1); break; // Deprecated/legacy
193 case CAST: Cast5Encrypt (data, data, ks); break; // Deprecated/legacy
194 case TRIPLEDES: TripleDesEncrypt (data, data, ks, 1); break; // Deprecated/legacy
195#endif
196 default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID 153 default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID
197 } 154 }
198} 155}
@@ -256,9 +213,6 @@ void DecipherBlock(int cipher, void *data, void *ks)
256 aes_decrypt (data, data, (void *) ((char *) ks + sizeof(aes_encrypt_ctx))); 213 aes_decrypt (data, data, (void *) ((char *) ks + sizeof(aes_encrypt_ctx)));
257 break; 214 break;
258 215
259 case BLOWFISH: BlowfishEncryptLE (data, data, ks, 0); break; // Deprecated/legacy
260 case CAST: Cast5Decrypt (data, data, ks); break; // Deprecated/legacy
261 case TRIPLEDES: TripleDesEncrypt (data, data, ks, 0); break; // Deprecated/legacy
262#else 216#else
263 case AES: aes_decrypt (data, data, ks); break; 217 case AES: aes_decrypt (data, data, ks); break;
264#endif 218#endif
@@ -427,28 +381,6 @@ BOOL EAInitMode (PCRYPTO_INFO ci)
427 that the size of each of the volumes is 1024 terabytes). */ 381 that the size of each of the volumes is 1024 terabytes). */
428 break; 382 break;
429 383
430 case LRW:
431 switch (CipherGetBlockSize (EAGetFirstCipher (ci->ea)))
432 {
433 case 8:
434 /* Deprecated/legacy */
435 return Gf64TabInit (ci->k2, &ci->gf_ctx);
436
437 case 16:
438 return Gf128Tab64Init (ci->k2, &ci->gf_ctx);
439
440 default:
441 TC_THROW_FATAL_EXCEPTION;
442 }
443
444 break;
445
446 case CBC:
447 case INNER_CBC:
448 case OUTER_CBC:
449 // The mode does not need to be initialized or is initialized elsewhere
450 return TRUE;
451
452 default: 384 default:
453 // Unknown/wrong ID 385 // Unknown/wrong ID
454 TC_THROW_FATAL_EXCEPTION; 386 TC_THROW_FATAL_EXCEPTION;
@@ -537,37 +469,6 @@ char *EAGetModeName (int ea, int mode, BOOL capitalLetters)
537 469
538 return "XTS"; 470 return "XTS";
539 471
540 case LRW:
541
542 /* Deprecated/legacy */
543
544 return "LRW";
545
546 case CBC:
547 {
548 /* Deprecated/legacy */
549
550 char eaName[100];
551 EAGetName (eaName, ea);
552
553 if (strcmp (eaName, "Triple DES") == 0)
554 return capitalLetters ? "Outer-CBC" : "outer-CBC";
555
556 return "CBC";
557 }
558
559 case OUTER_CBC:
560
561 /* Deprecated/legacy */
562
563 return capitalLetters ? "Outer-CBC" : "outer-CBC";
564
565 case INNER_CBC:
566
567 /* Deprecated/legacy */
568
569 return capitalLetters ? "Inner-CBC" : "inner-CBC";
570
571 } 472 }
572 return "[unknown]"; 473 return "[unknown]";
573} 474}
@@ -805,441 +706,6 @@ void crypto_close (PCRYPTO_INFO cryptoInfo)
805#ifndef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE 706#ifndef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
806 707
807 708
808#ifndef TC_NO_COMPILER_INT64
809void Xor128 (unsigned __int64 *a, unsigned __int64 *b)
810{
811 *a++ ^= *b++;
812 *a ^= *b;
813}
814
815
816void Xor64 (unsigned __int64 *a, unsigned __int64 *b)
817{
818 *a ^= *b;
819}
820
821
822void EncryptBufferLRW128 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo)
823{
824 /* Deprecated/legacy */
825
826 int cipher = EAGetFirstCipher (cryptoInfo->ea);
827 int cipherCount = EAGetCipherCount (cryptoInfo->ea);
828 unsigned __int8 *p = buffer;
829 unsigned __int8 *ks = cryptoInfo->ks;
830 unsigned __int8 i[8];
831 unsigned __int8 t[16];
832 unsigned __int64 b;
833
834 *(unsigned __int64 *)i = BE64(blockIndex);
835
836 if (length % 16)
837 TC_THROW_FATAL_EXCEPTION;
838
839 // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes).
840
841 for (b = 0; b < length >> 4; b++)
842 {
843 Gf128MulBy64Tab (i, t, &cryptoInfo->gf_ctx);
844 Xor128 ((unsigned __int64 *)p, (unsigned __int64 *)t);
845
846 if (cipherCount > 1)
847 {
848 // Cipher cascade
849 for (cipher = EAGetFirstCipher (cryptoInfo->ea);
850 cipher != 0;
851 cipher = EAGetNextCipher (cryptoInfo->ea, cipher))
852 {
853 EncipherBlock (cipher, p, ks);
854 ks += CipherGetKeyScheduleSize (cipher);
855 }
856 ks = cryptoInfo->ks;
857 }
858 else
859 {
860 EncipherBlock (cipher, p, ks);
861 }
862
863 Xor128 ((unsigned __int64 *)p, (unsigned __int64 *)t);
864
865 p += 16;
866
867 if (i[7] != 0xff)
868 i[7]++;
869 else
870 *(unsigned __int64 *)i = BE64 ( BE64(*(unsigned __int64 *)i) + 1 );
871 }
872
873 FAST_ERASE64 (t, sizeof(t));
874}
875
876
877void EncryptBufferLRW64 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo)
878{
879 /* Deprecated/legacy */
880
881 int cipher = EAGetFirstCipher (cryptoInfo->ea);
882 unsigned __int8 *p = buffer;
883 unsigned __int8 *ks = cryptoInfo->ks;
884 unsigned __int8 i[8];
885 unsigned __int8 t[8];
886 unsigned __int64 b;
887
888 *(unsigned __int64 *)i = BE64(blockIndex);
889
890 if (length % 8)
891 TC_THROW_FATAL_EXCEPTION;
892
893 for (b = 0; b < length >> 3; b++)
894 {
895 Gf64MulTab (i, t, &cryptoInfo->gf_ctx);
896 Xor64 ((unsigned __int64 *)p, (unsigned __int64 *)t);
897
898 EncipherBlock (cipher, p, ks);
899
900 Xor64 ((unsigned __int64 *)p, (unsigned __int64 *)t);
901
902 p += 8;
903
904 if (i[7] != 0xff)
905 i[7]++;
906 else
907 *(unsigned __int64 *)i = BE64 ( BE64(*(unsigned __int64 *)i) + 1 );
908 }
909
910 FAST_ERASE64 (t, sizeof(t));
911}
912
913
914void DecryptBufferLRW128 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo)
915{
916 /* Deprecated/legacy */
917
918 int cipher = EAGetFirstCipher (cryptoInfo->ea);
919 int cipherCount = EAGetCipherCount (cryptoInfo->ea);
920 unsigned __int8 *p = buffer;
921 unsigned __int8 *ks = cryptoInfo->ks;
922 unsigned __int8 i[8];
923 unsigned __int8 t[16];
924 unsigned __int64 b;
925
926 *(unsigned __int64 *)i = BE64(blockIndex);
927
928 if (length % 16)
929 TC_THROW_FATAL_EXCEPTION;
930
931 // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes).
932
933 for (b = 0; b < length >> 4; b++)
934 {
935 Gf128MulBy64Tab (i, t, &cryptoInfo->gf_ctx);
936 Xor128 ((unsigned __int64 *)p, (unsigned __int64 *)t);
937
938 if (cipherCount > 1)
939 {
940 // Cipher cascade
941 ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea);
942
943 for (cipher = EAGetLastCipher (cryptoInfo->ea);
944 cipher != 0;
945 cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher))
946 {
947 ks -= CipherGetKeyScheduleSize (cipher);
948 DecipherBlock (cipher, p, ks);
949 }
950 }
951 else
952 {
953 DecipherBlock (cipher, p, ks);
954 }
955
956 Xor128 ((unsigned __int64 *)p, (unsigned __int64 *)t);
957
958 p += 16;
959
960 if (i[7] != 0xff)
961 i[7]++;
962 else
963 *(unsigned __int64 *)i = BE64 ( BE64(*(unsigned __int64 *)i) + 1 );
964 }
965
966 FAST_ERASE64 (t, sizeof(t));
967}
968
969
970
971void DecryptBufferLRW64 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo)
972{
973 /* Deprecated/legacy */
974
975 int cipher = EAGetFirstCipher (cryptoInfo->ea);
976 unsigned __int8 *p = buffer;
977 unsigned __int8 *ks = cryptoInfo->ks;
978 unsigned __int8 i[8];
979 unsigned __int8 t[8];
980 unsigned __int64 b;
981
982 *(unsigned __int64 *)i = BE64(blockIndex);
983
984 if (length % 8)
985 TC_THROW_FATAL_EXCEPTION;
986
987 for (b = 0; b < length >> 3; b++)
988 {
989 Gf64MulTab (i, t, &cryptoInfo->gf_ctx);
990 Xor64 ((unsigned __int64 *)p, (unsigned __int64 *)t);
991
992 DecipherBlock (cipher, p, ks);
993
994 Xor64 ((unsigned __int64 *)p, (unsigned __int64 *)t);
995
996 p += 8;
997
998 if (i[7] != 0xff)
999 i[7]++;
1000 else
1001 *(unsigned __int64 *)i = BE64 ( BE64(*(unsigned __int64 *)i) + 1 );
1002 }
1003
1004 FAST_ERASE64 (t, sizeof(t));
1005}
1006
1007
1008// Initializes IV and whitening values for sector encryption/decryption in CBC mode.
1009// IMPORTANT: This function has been deprecated (legacy).
1010static void
1011InitSectorIVAndWhitening (unsigned __int64 unitNo,
1012 int blockSize,
1013 unsigned __int32 *iv,
1014 unsigned __int64 *ivSeed,
1015 unsigned __int32 *whitening)
1016{
1017
1018 /* IMPORTANT: This function has been deprecated (legacy) */
1019
1020 unsigned __int64 iv64[4];
1021 unsigned __int32 *iv32 = (unsigned __int32 *) iv64;
1022
1023 iv64[0] = ivSeed[0] ^ LE64(unitNo);
1024 iv64[1] = ivSeed[1] ^ LE64(unitNo);
1025 iv64[2] = ivSeed[2] ^ LE64(unitNo);
1026 if (blockSize == 16)
1027 {
1028 iv64[3] = ivSeed[3] ^ LE64(unitNo);
1029 }
1030
1031 iv[0] = iv32[0];
1032 iv[1] = iv32[1];
1033
1034 switch (blockSize)
1035 {
1036 case 16:
1037
1038 // 128-bit block
1039
1040 iv[2] = iv32[2];
1041 iv[3] = iv32[3];
1042
1043 whitening[0] = LE32( crc32int ( &iv32[4] ) ^ crc32int ( &iv32[7] ) );
1044 whitening[1] = LE32( crc32int ( &iv32[5] ) ^ crc32int ( &iv32[6] ) );
1045 break;
1046
1047 case 8:
1048
1049 // 64-bit block
1050
1051 whitening[0] = LE32( crc32int ( &iv32[2] ) ^ crc32int ( &iv32[5] ) );
1052 whitening[1] = LE32( crc32int ( &iv32[3] ) ^ crc32int ( &iv32[4] ) );
1053 break;
1054
1055 default:
1056 TC_THROW_FATAL_EXCEPTION;
1057 }
1058}
1059
1060
1061// EncryptBufferCBC (deprecated/legacy)
1062//
1063// data: data to be encrypted
1064// len: number of bytes to encrypt (must be divisible by the largest cipher block size)
1065// ks: scheduled key
1066// iv: IV
1067// whitening: whitening constants
1068// ea: outer-CBC cascade ID (0 = CBC/inner-CBC)
1069// cipher: CBC/inner-CBC cipher ID (0 = outer-CBC)
1070
1071static void
1072EncryptBufferCBC (unsigned __int32 *data,
1073 unsigned int len,
1074 unsigned __int8 *ks,
1075 unsigned __int32 *iv,
1076 unsigned __int32 *whitening,
1077 int ea,
1078 int cipher)
1079{
1080 /* IMPORTANT: This function has been deprecated (legacy) */
1081
1082 unsigned __int32 bufIV[4];
1083 unsigned __int64 i;
1084 int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher);
1085
1086 if (len % blockSize)
1087 TC_THROW_FATAL_EXCEPTION;
1088
1089 // IV
1090 bufIV[0] = iv[0];
1091 bufIV[1] = iv[1];
1092 if (blockSize == 16)
1093 {
1094 bufIV[2] = iv[2];
1095 bufIV[3] = iv[3];
1096 }
1097
1098 // Encrypt each block
1099 for (i = 0; i < len/blockSize; i++)
1100 {
1101 // CBC
1102 data[0] ^= bufIV[0];
1103 data[1] ^= bufIV[1];
1104 if (blockSize == 16)
1105 {
1106 data[2] ^= bufIV[2];
1107 data[3] ^= bufIV[3];
1108 }
1109
1110 if (ea != 0)
1111 {
1112 // Outer-CBC
1113 for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher))
1114 {
1115 EncipherBlock (cipher, data, ks);
1116 ks += CipherGetKeyScheduleSize (cipher);
1117 }
1118 ks -= EAGetKeyScheduleSize (ea);
1119 }
1120 else
1121 {
1122 // CBC/inner-CBC
1123 EncipherBlock (cipher, data, ks);
1124 }
1125
1126 // CBC
1127 bufIV[0] = data[0];
1128 bufIV[1] = data[1];
1129 if (blockSize == 16)
1130 {
1131 bufIV[2] = data[2];
1132 bufIV[3] = data[3];
1133 }
1134
1135 // Whitening
1136 data[0] ^= whitening[0];
1137 data[1] ^= whitening[1];
1138 if (blockSize == 16)
1139 {
1140 data[2] ^= whitening[0];
1141 data[3] ^= whitening[1];
1142 }
1143
1144 data += blockSize / sizeof(*data);
1145 }
1146}
1147
1148
1149// DecryptBufferCBC (deprecated/legacy)
1150//
1151// data: data to be decrypted
1152// len: number of bytes to decrypt (must be divisible by the largest cipher block size)
1153// ks: scheduled key
1154// iv: IV
1155// whitening: whitening constants
1156// ea: outer-CBC cascade ID (0 = CBC/inner-CBC)
1157// cipher: CBC/inner-CBC cipher ID (0 = outer-CBC)
1158
1159static void
1160DecryptBufferCBC (unsigned __int32 *data,
1161 unsigned int len,
1162 unsigned __int8 *ks,
1163 unsigned __int32 *iv,
1164 unsigned __int32 *whitening,
1165 int ea,
1166 int cipher)
1167{
1168
1169 /* IMPORTANT: This function has been deprecated (legacy) */
1170
1171 unsigned __int32 bufIV[4];
1172 unsigned __int64 i;
1173 unsigned __int32 ct[4];
1174 int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher);
1175
1176 if (len % blockSize)
1177 TC_THROW_FATAL_EXCEPTION;
1178
1179 // IV
1180 bufIV[0] = iv[0];
1181 bufIV[1] = iv[1];
1182 if (blockSize == 16)
1183 {
1184 bufIV[2] = iv[2];
1185 bufIV[3] = iv[3];
1186 }
1187
1188 // Decrypt each block
1189 for (i = 0; i < len/blockSize; i++)
1190 {
1191 // Dewhitening
1192 data[0] ^= whitening[0];
1193 data[1] ^= whitening[1];
1194 if (blockSize == 16)
1195 {
1196 data[2] ^= whitening[0];
1197 data[3] ^= whitening[1];
1198 }
1199
1200 // CBC
1201 ct[0] = data[0];
1202 ct[1] = data[1];
1203 if (blockSize == 16)
1204 {
1205 ct[2] = data[2];
1206 ct[3] = data[3];
1207 }
1208
1209 if (ea != 0)
1210 {
1211 // Outer-CBC
1212 ks += EAGetKeyScheduleSize (ea);
1213 for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher))
1214 {
1215 ks -= CipherGetKeyScheduleSize (cipher);
1216 DecipherBlock (cipher, data, ks);
1217 }
1218 }
1219 else
1220 {
1221 // CBC/inner-CBC
1222 DecipherBlock (cipher, data, ks);
1223 }
1224
1225 // CBC
1226 data[0] ^= bufIV[0];
1227 data[1] ^= bufIV[1];
1228 bufIV[0] = ct[0];
1229 bufIV[1] = ct[1];
1230 if (blockSize == 16)
1231 {
1232 data[2] ^= bufIV[2];
1233 data[3] ^= bufIV[3];
1234 bufIV[2] = ct[2];
1235 bufIV[3] = ct[3];
1236 }
1237
1238 data += blockSize / sizeof(*data);
1239 }
1240}
1241#endif // #ifndef TC_NO_COMPILER_INT64
1242
1243 709
1244// EncryptBuffer 710// EncryptBuffer
1245// 711//
@@ -1275,100 +741,12 @@ void EncryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_
1275 } 741 }
1276 break; 742 break;
1277 743
1278#ifndef TC_NO_COMPILER_INT64
1279 case LRW:
1280
1281 /* Deprecated/legacy */
1282
1283 switch (CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea)))
1284 {
1285 case 8:
1286 EncryptBufferLRW64 ((unsigned __int8 *)buf, (unsigned __int64) len, 1, cryptoInfo);
1287 break;
1288
1289 case 16:
1290 EncryptBufferLRW128 ((unsigned __int8 *)buf, (unsigned __int64) len, 1, cryptoInfo);
1291 break;
1292
1293 default:
1294 TC_THROW_FATAL_EXCEPTION;
1295 }
1296 break;
1297
1298 case CBC:
1299 case INNER_CBC:
1300 {
1301 /* Deprecated/legacy */
1302
1303 unsigned __int8 *ks = cryptoInfo->ks;
1304 int cipher;
1305
1306 for (cipher = EAGetFirstCipher (cryptoInfo->ea);
1307 cipher != 0;
1308 cipher = EAGetNextCipher (cryptoInfo->ea, cipher))
1309 {
1310 EncryptBufferCBC ((unsigned __int32 *) buf,
1311 (unsigned int) len,
1312 ks,
1313 (unsigned __int32 *) cryptoInfo->k2,
1314 (unsigned __int32 *) &cryptoInfo->k2[8],
1315 0,
1316 cipher);
1317
1318 ks += CipherGetKeyScheduleSize (cipher);
1319 }
1320 }
1321 break;
1322
1323 case OUTER_CBC:
1324
1325 /* Deprecated/legacy */
1326
1327 EncryptBufferCBC ((unsigned __int32 *) buf,
1328 (unsigned int) len,
1329 cryptoInfo->ks,
1330 (unsigned __int32 *) cryptoInfo->k2,
1331 (unsigned __int32 *) &cryptoInfo->k2[8],
1332 cryptoInfo->ea,
1333 0);
1334
1335 break;
1336#endif // #ifndef TC_NO_COMPILER_INT64
1337
1338 default: 744 default:
1339 // Unknown/wrong ID 745 // Unknown/wrong ID
1340 TC_THROW_FATAL_EXCEPTION; 746 TC_THROW_FATAL_EXCEPTION;
1341 } 747 }
1342} 748}
1343 749
1344#ifndef TC_NO_COMPILER_INT64
1345// Converts a data unit number to the index of the first LRW block in the data unit.
1346// Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes).
1347uint64 DataUnit2LRWIndex (uint64 dataUnit, int blockSize, PCRYPTO_INFO ci)
1348{
1349 /* Deprecated/legacy */
1350
1351 if (ci->hiddenVolume)
1352 dataUnit -= ci->hiddenVolumeOffset / ENCRYPTION_DATA_UNIT_SIZE;
1353 else
1354 dataUnit -= TC_VOLUME_HEADER_SIZE_LEGACY / ENCRYPTION_DATA_UNIT_SIZE; // Compensate for the volume header size
1355
1356 switch (blockSize)
1357 {
1358 case 8:
1359 return (dataUnit << 6) | 1;
1360
1361 case 16:
1362 return (dataUnit << 5) | 1;
1363
1364 default:
1365 TC_THROW_FATAL_EXCEPTION;
1366 }
1367
1368 return 0;
1369}
1370#endif // #ifndef TC_NO_COMPILER_INT64
1371
1372 750
1373// buf: data to be encrypted 751// buf: data to be encrypted
1374// unitNo: sequential number of the data unit with which the buffer starts 752// unitNo: sequential number of the data unit with which the buffer starts
@@ -1387,14 +765,6 @@ void EncryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
1387 unsigned __int8 *ks2 = ci->ks2; 765 unsigned __int8 *ks2 = ci->ks2;
1388 int cipher; 766 int cipher;
1389 767
1390#ifndef TC_NO_COMPILER_INT64
1391 void *iv = ci->k2; // Deprecated/legacy
1392 unsigned __int64 unitNo = structUnitNo->Value;
1393 unsigned __int64 *iv64 = (unsigned __int64 *) iv; // Deprecated/legacy
1394 unsigned __int32 sectorIV[4]; // Deprecated/legacy
1395 unsigned __int32 secWhitening[2]; // Deprecated/legacy
1396#endif
1397
1398 switch (ci->mode) 768 switch (ci->mode)
1399 { 769 {
1400 case XTS: 770 case XTS:
@@ -1413,81 +783,6 @@ void EncryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
1413 } 783 }
1414 break; 784 break;
1415 785
1416#ifndef TC_NO_COMPILER_INT64
1417 case LRW:
1418
1419 /* Deprecated/legacy */
1420
1421 switch (CipherGetBlockSize (EAGetFirstCipher (ea)))
1422 {
1423 case 8:
1424 EncryptBufferLRW64 (buf,
1425 (unsigned __int64) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE,
1426 DataUnit2LRWIndex (unitNo, 8, ci),
1427 ci);
1428 break;
1429
1430 case 16:
1431 EncryptBufferLRW128 (buf,
1432 (unsigned __int64) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE,
1433 DataUnit2LRWIndex (unitNo, 16, ci),
1434 ci);
1435 break;
1436
1437 default:
1438 TC_THROW_FATAL_EXCEPTION;
1439 }
1440 break;
1441
1442 case CBC:
1443 case INNER_CBC:
1444
1445 /* Deprecated/legacy */
1446
1447 while (nbrUnits--)
1448 {
1449 for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher))
1450 {
1451 InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening);
1452
1453 EncryptBufferCBC ((unsigned __int32 *) buf,
1454 ENCRYPTION_DATA_UNIT_SIZE,
1455 ks,
1456 sectorIV,
1457 secWhitening,
1458 0,
1459 cipher);
1460
1461 ks += CipherGetKeyScheduleSize (cipher);
1462 }
1463 ks -= EAGetKeyScheduleSize (ea);
1464 buf += ENCRYPTION_DATA_UNIT_SIZE;
1465 unitNo++;
1466 }
1467 break;
1468
1469 case OUTER_CBC:
1470
1471 /* Deprecated/legacy */
1472
1473 while (nbrUnits--)
1474 {
1475 InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (EAGetFirstCipher (ea)), sectorIV, iv64, secWhitening);
1476
1477 EncryptBufferCBC ((unsigned __int32 *) buf,
1478 ENCRYPTION_DATA_UNIT_SIZE,
1479 ks,
1480 sectorIV,
1481 secWhitening,
1482 ea,
1483 0);
1484
1485 buf += ENCRYPTION_DATA_UNIT_SIZE;
1486 unitNo++;
1487 }
1488 break;
1489#endif // #ifndef TC_NO_COMPILER_INT64
1490
1491 default: 786 default:
1492 // Unknown/wrong ID 787 // Unknown/wrong ID
1493 TC_THROW_FATAL_EXCEPTION; 788 TC_THROW_FATAL_EXCEPTION;
@@ -1528,65 +823,6 @@ void DecryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_
1528 } 823 }
1529 break; 824 break;
1530 825
1531#ifndef TC_NO_COMPILER_INT64
1532 case LRW:
1533
1534 /* Deprecated/legacy */
1535
1536 switch (CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea)))
1537 {
1538 case 8:
1539 DecryptBufferLRW64 (buf, (unsigned __int64) len, 1, cryptoInfo);
1540 break;
1541
1542 case 16:
1543 DecryptBufferLRW128 (buf, (unsigned __int64) len, 1, cryptoInfo);
1544 break;
1545
1546 default:
1547 TC_THROW_FATAL_EXCEPTION;
1548 }
1549 break;
1550
1551 case CBC:
1552 case INNER_CBC:
1553 {
1554 /* Deprecated/legacy */
1555
1556 unsigned __int8 *ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea);
1557 int cipher;
1558 for (cipher = EAGetLastCipher (cryptoInfo->ea);
1559 cipher != 0;
1560 cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher))
1561 {
1562 ks -= CipherGetKeyScheduleSize (cipher);
1563
1564 DecryptBufferCBC ((unsigned __int32 *) buf,
1565 (unsigned int) len,
1566 ks,
1567 (unsigned __int32 *) cryptoInfo->k2,
1568 (unsigned __int32 *) &cryptoInfo->k2[8],
1569 0,
1570 cipher);
1571 }
1572 }
1573 break;
1574
1575 case OUTER_CBC:
1576
1577 /* Deprecated/legacy */
1578
1579 DecryptBufferCBC ((unsigned __int32 *) buf,
1580 (unsigned int) len,
1581 cryptoInfo->ks,
1582 (unsigned __int32 *) cryptoInfo->k2,
1583 (unsigned __int32 *) &cryptoInfo->k2[8],
1584 cryptoInfo->ea,
1585 0);
1586
1587 break;
1588#endif // #ifndef TC_NO_COMPILER_INT64
1589
1590 default: 826 default:
1591 // Unknown/wrong ID 827 // Unknown/wrong ID
1592 TC_THROW_FATAL_EXCEPTION; 828 TC_THROW_FATAL_EXCEPTION;
@@ -1610,14 +846,6 @@ void DecryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
1610 unsigned __int8 *ks2 = ci->ks2; 846 unsigned __int8 *ks2 = ci->ks2;
1611 int cipher; 847 int cipher;
1612 848
1613#ifndef TC_NO_COMPILER_INT64
1614 void *iv = ci->k2; // Deprecated/legacy
1615 unsigned __int64 unitNo = structUnitNo->Value;
1616 unsigned __int64 *iv64 = (unsigned __int64 *) iv; // Deprecated/legacy
1617 unsigned __int32 sectorIV[4]; // Deprecated/legacy
1618 unsigned __int32 secWhitening[2]; // Deprecated/legacy
1619#endif // #ifndef TC_NO_COMPILER_INT64
1620
1621 849
1622 switch (ci->mode) 850 switch (ci->mode)
1623 { 851 {
@@ -1640,81 +868,6 @@ void DecryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
1640 } 868 }
1641 break; 869 break;
1642 870
1643#ifndef TC_NO_COMPILER_INT64
1644 case LRW:
1645
1646 /* Deprecated/legacy */
1647
1648 switch (CipherGetBlockSize (EAGetFirstCipher (ea)))
1649 {
1650 case 8:
1651 DecryptBufferLRW64 (buf,
1652 (unsigned __int64) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE,
1653 DataUnit2LRWIndex (unitNo, 8, ci),
1654 ci);
1655 break;
1656
1657 case 16:
1658 DecryptBufferLRW128 (buf,
1659 (unsigned __int64) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE,
1660 DataUnit2LRWIndex (unitNo, 16, ci),
1661 ci);
1662 break;
1663
1664 default:
1665 TC_THROW_FATAL_EXCEPTION;
1666 }
1667 break;
1668
1669 case CBC:
1670 case INNER_CBC:
1671
1672 /* Deprecated/legacy */
1673
1674 while (nbrUnits--)
1675 {
1676 ks += EAGetKeyScheduleSize (ea);
1677 for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher))
1678 {
1679 InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening);
1680
1681 ks -= CipherGetKeyScheduleSize (cipher);
1682
1683 DecryptBufferCBC ((unsigned __int32 *) buf,
1684 ENCRYPTION_DATA_UNIT_SIZE,
1685 ks,
1686 sectorIV,
1687 secWhitening,
1688 0,
1689 cipher);
1690 }
1691 buf += ENCRYPTION_DATA_UNIT_SIZE;
1692 unitNo++;
1693 }
1694 break;
1695
1696 case OUTER_CBC:
1697
1698 /* Deprecated/legacy */
1699
1700 while (nbrUnits--)
1701 {
1702 InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (EAGetFirstCipher (ea)), sectorIV, iv64, secWhitening);
1703
1704 DecryptBufferCBC ((unsigned __int32 *) buf,
1705 ENCRYPTION_DATA_UNIT_SIZE,
1706 ks,
1707 sectorIV,
1708 secWhitening,
1709 ea,
1710 0);
1711
1712 buf += ENCRYPTION_DATA_UNIT_SIZE;
1713 unitNo++;
1714 }
1715 break;
1716#endif // #ifndef TC_NO_COMPILER_INT64
1717
1718 default: 871 default:
1719 // Unknown/wrong ID 872 // Unknown/wrong ID
1720 TC_THROW_FATAL_EXCEPTION; 873 TC_THROW_FATAL_EXCEPTION;
@@ -1729,13 +882,6 @@ int GetMaxPkcs5OutSize (void)
1729 882
1730 size = max (size, EAGetLargestKeyForMode (XTS) * 2); // Sizes of primary + secondary keys 883 size = max (size, EAGetLargestKeyForMode (XTS) * 2); // Sizes of primary + secondary keys
1731 884
1732#ifndef TC_WINDOWS_BOOT
1733 size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (LRW)); // Deprecated/legacy
1734 size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (CBC)); // Deprecated/legacy
1735 size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (OUTER_CBC)); // Deprecated/legacy
1736 size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (INNER_CBC)); // Deprecated/legacy
1737#endif
1738
1739 return size; 885 return size;
1740} 886}
1741 887
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 4f47ec04..f183a436 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -42,9 +42,6 @@ extern "C" {
42// Size of the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode) 42// Size of the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode)
43#define MASTER_KEYDATA_SIZE 256 43#define MASTER_KEYDATA_SIZE 256
44 44
45// Size of the deprecated volume header item containing either an IV seed (CBC mode) or tweak key (LRW mode)
46#define LEGACY_VOL_IV_SIZE 32
47
48// The first PRF to try when mounting 45// The first PRF to try when mounting
49#define FIRST_PRF_ID 1 46#define FIRST_PRF_ID 1
50 47
@@ -55,7 +52,6 @@ enum
55#ifndef TC_WINDOWS_BOOT 52#ifndef TC_WINDOWS_BOOT
56 SHA512, 53 SHA512,
57 WHIRLPOOL, 54 WHIRLPOOL,
58 SHA1, // Deprecated/legacy
59#endif 55#endif
60 HASH_ENUM_END_ID 56 HASH_ENUM_END_ID
61}; 57};
@@ -89,12 +85,6 @@ enum
89 /* If you add/remove a mode, update the following: GetMaxPkcs5OutSize(), EAInitMode() */ 85 /* If you add/remove a mode, update the following: GetMaxPkcs5OutSize(), EAInitMode() */
90 86
91 XTS = FIRST_MODE_OF_OPERATION_ID, 87 XTS = FIRST_MODE_OF_OPERATION_ID,
92#ifndef TC_WINDOWS_BOOT
93 LRW, // Deprecated/legacy
94 CBC, // Deprecated/legacy
95 OUTER_CBC, // Deprecated/legacy
96 INNER_CBC, // Deprecated/legacy
97#endif
98 MODE_ENUM_END_ID 88 MODE_ENUM_END_ID
99}; 89};
100 90
@@ -115,12 +105,7 @@ enum
115 NONE = 0, 105 NONE = 0,
116 AES, 106 AES,
117 SERPENT, 107 SERPENT,
118 TWOFISH, 108 TWOFISH
119#ifndef TC_WINDOWS_BOOT
120 BLOWFISH, // Deprecated/legacy
121 CAST, // Deprecated/legacy
122 TRIPLEDES // Deprecated/legacy
123#endif
124}; 109};
125 110
126typedef struct 111typedef struct
@@ -184,15 +169,11 @@ typedef struct
184#endif 169#endif
185 170
186#include "Aes_hw_cpu.h" 171#include "Aes_hw_cpu.h"
187#include "Blowfish.h"
188#include "Cast.h"
189#include "Des.h"
190#include "Serpent.h" 172#include "Serpent.h"
191#include "Twofish.h" 173#include "Twofish.h"
192 174
193#include "Rmd160.h" 175#include "Rmd160.h"
194#ifndef TC_WINDOWS_BOOT 176#ifndef TC_WINDOWS_BOOT
195# include "Sha1.h"
196# include "Sha2.h" 177# include "Sha2.h"
197# include "Whirlpool.h" 178# include "Whirlpool.h"
198#endif 179#endif
@@ -313,13 +294,6 @@ void DecryptDataUnits (unsigned __int8 *buf, const UINT64_STRUCT *structUnitNo,
313void DecryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci); 294void DecryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci);
314void EncryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo); 295void EncryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo);
315void DecryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo); 296void DecryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo);
316#ifndef TC_NO_COMPILER_INT64
317void EncryptBufferLRW128 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo);
318void DecryptBufferLRW128 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo);
319void EncryptBufferLRW64 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo);
320void DecryptBufferLRW64 (byte *buffer, uint64 length, uint64 blockIndex, PCRYPTO_INFO cryptoInfo);
321uint64 DataUnit2LRWIndex (uint64 dataUnit, int blockSize, PCRYPTO_INFO ci);
322#endif // #ifndef TC_NO_COMPILER_INT64
323 297
324BOOL IsAesHwCpuSupported (); 298BOOL IsAesHwCpuSupported ();
325void EnableHwEncryption (BOOL enable); 299void EnableHwEncryption (BOOL enable);
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 071ed8e2..b40a41cd 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -5366,15 +5366,6 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
5366 } 5366 }
5367 else 5367 else
5368 { 5368 {
5369 if (idTestCipher == BLOWFISH)
5370 {
5371 /* Deprecated/legacy */
5372
5373 /* Convert to little-endian, this is needed here and not in
5374 above auto-tests because BF_ecb_encrypt above correctly converts
5375 from big to little endian, and EncipherBlock does not! */
5376 LongReverse((unsigned int *) tmp, pt);
5377 }
5378 5369
5379 CipherInit2(idTestCipher, key, ks_tmp, ks); 5370 CipherInit2(idTestCipher, key, ks_tmp, ks);
5380 5371
@@ -5387,13 +5378,6 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
5387 DecipherBlock(idTestCipher, tmp, ks_tmp); 5378 DecipherBlock(idTestCipher, tmp, ks_tmp);
5388 } 5379 }
5389 5380
5390 if (idTestCipher == BLOWFISH)
5391 {
5392 /* Deprecated/legacy */
5393
5394 /* Convert back to big-endian */
5395 LongReverse((unsigned int *) tmp, pt);
5396 }
5397 } 5381 }
5398 *szTmp = 0; 5382 *szTmp = 0;
5399 5383
@@ -5464,43 +5448,6 @@ ResetCipherTest(HWND hwndDlg, int idTestCipher)
5464 5448
5465 SetWindowText(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), "0000000000000000000000000000000000000000000000000000000000000000"); 5449 SetWindowText(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), "0000000000000000000000000000000000000000000000000000000000000000");
5466 SetWindowText(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), "0"); 5450 SetWindowText(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), "0");
5467
5468 if (idTestCipher == BLOWFISH)
5469 {
5470 /* Deprecated/legacy */
5471
5472 ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "448");
5473 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 56);
5474 ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "256");
5475 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 32);
5476 ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "128");
5477 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 16);
5478 ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "64");
5479 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 8);
5480 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETCURSEL, 0,0);
5481 SetWindowText(GetDlgItem(hwndDlg, IDC_KEY), "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
5482 }
5483
5484
5485 if (idTestCipher == CAST)
5486 {
5487 /* Deprecated/legacy */
5488
5489 ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "128");
5490 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 16);
5491 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETCURSEL, ndx,0);
5492 SetWindowText(GetDlgItem(hwndDlg, IDC_KEY), "00000000000000000000000000000000");
5493 }
5494
5495 if (idTestCipher == TRIPLEDES)
5496 {
5497 /* Deprecated/legacy */
5498
5499 ndx = SendMessage (GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_ADDSTRING, 0,(LPARAM) "168");
5500 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETITEMDATA, ndx,(LPARAM) 24);
5501 SendMessage(GetDlgItem(hwndDlg, IDC_KEY_SIZE), CB_SETCURSEL, ndx,0);
5502 SetWindowText(GetDlgItem(hwndDlg, IDC_KEY), "000000000000000000000000000000000000000000000000");
5503 }
5504 5451
5505 SetWindowText(GetDlgItem(hwndDlg, IDC_PLAINTEXT), "0000000000000000"); 5452 SetWindowText(GetDlgItem(hwndDlg, IDC_PLAINTEXT), "0000000000000000");
5506 SetWindowText(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), "0000000000000000"); 5453 SetWindowText(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), "0000000000000000");
diff --git a/src/Common/EncryptionThreadPool.c b/src/Common/EncryptionThreadPool.c
index fdedf36f..f213ea34 100644
--- a/src/Common/EncryptionThreadPool.c
+++ b/src/Common/EncryptionThreadPool.c
@@ -173,11 +173,6 @@ static TC_THREAD_PROC EncryptionThreadProc (void *threadArg)
173 workItem->KeyDerivation.IterationCount, workItem->KeyDerivation.DerivedKey, GetMaxPkcs5OutSize()); 173 workItem->KeyDerivation.IterationCount, workItem->KeyDerivation.DerivedKey, GetMaxPkcs5OutSize());
174 break; 174 break;
175 175
176 case SHA1:
177 derive_key_sha1 (workItem->KeyDerivation.Password, workItem->KeyDerivation.PasswordLength, workItem->KeyDerivation.Salt, PKCS5_SALT_SIZE,
178 workItem->KeyDerivation.IterationCount, workItem->KeyDerivation.DerivedKey, GetMaxPkcs5OutSize());
179 break;
180
181 default: 176 default:
182 TC_THROW_FATAL_EXCEPTION; 177 TC_THROW_FATAL_EXCEPTION;
183 } 178 }
diff --git a/src/Common/GfMul.c b/src/Common/GfMul.c
index 7e170bc1..7cc36ec1 100644
--- a/src/Common/GfMul.c
+++ b/src/Common/GfMul.c
@@ -651,43 +651,6 @@ int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx)
651 return TRUE; 651 return TRUE;
652} 652}
653 653
654int Gf64TabInit (unsigned __int8 *a, GfCtx *ctx)
655{
656 /* Deprecated/legacy */
657
658 GfCtx4k64 *ctx4k;
659 unsigned __int8 am[8];
660 int i, j;
661
662 ctx4k = (GfCtx4k64 *) TCalloc (sizeof (GfCtx4k64));
663 if (!ctx4k)
664 return FALSE;
665
666 memcpy (am, a, 8);
667 MirrorBits64 (am);
668 compile_4k_table64 (am, ctx4k);
669
670 /* Convert LSB-first table to MSB-first */
671 for (i = 0; i < 16; i++)
672 {
673 for (j = 0; j < 16; j++)
674 {
675 int jm = 0;
676 jm |= (j & 0x1) << 3;
677 jm |= (j & 0x2) << 1;
678 jm |= (j & 0x4) >> 1;
679 jm |= (j & 0x8) >> 3;
680
681 memcpy (&ctx->gf_t64[i][jm], (unsigned char *)&ctx4k->gf_t4k[15-i][j], 8);
682 MirrorBits64 ((unsigned char *)&ctx->gf_t64[i][jm]);
683 }
684 }
685
686 burn (ctx4k,sizeof (*ctx4k));
687 burn (am, sizeof (am));
688 TCfree (ctx4k);
689 return TRUE;
690}
691 654
692#define xor_8kt64(i) \ 655#define xor_8kt64(i) \
693 xor_block_aligned(r, ctx->gf_t128[i + i][a[i] & 15]); \ 656 xor_block_aligned(r, ctx->gf_t128[i + i][a[i] & 15]); \
@@ -718,36 +681,6 @@ void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx)
718 move_block_aligned(p, r); 681 move_block_aligned(p, r);
719} 682}
720 683
721#define xor_8k64(i) \
722 xor_block_aligned64(r, ctx->gf_t64[i + i][a[i] & 15]); \
723 xor_block_aligned64(r, ctx->gf_t64[i + i + 1][a[i] >> 4])
724
725/* Multiply two 64-bit numbers in the finite field GF(2^64) */
726void Gf64MulTab (unsigned char a[8], unsigned char p[8], GfCtx *ctx)
727{
728 /* Deprecated/legacy */
729
730 unsigned __int32 r[CBLK_LEN8 >> 2];
731
732 move_block_aligned64(r, ctx->gf_t64[7*2][a[7] & 15]);
733 xor_block_aligned64(r, ctx->gf_t64[7*2+1][a[7] >> 4]);
734
735 if (*(unsigned __int16 *)a)
736 {
737 xor_8k64(0);
738 xor_8k64(1);
739 }
740 if (a[2])
741 {
742 xor_8k64(2);
743 }
744 xor_8k64(3);
745 xor_8k64(4);
746 xor_8k64(5);
747 xor_8k64(6);
748
749 move_block_aligned64(p, r);
750}
751 684
752 685
753/* Basic algorithms for testing of optimized algorithms */ 686/* Basic algorithms for testing of optimized algorithms */
@@ -809,32 +742,6 @@ static void shl64 (unsigned __int8 *a)
809 } 742 }
810} 743}
811 744
812static void GfMul64Basic (unsigned __int8 *a, unsigned __int8 *b, unsigned __int8* p)
813{
814 /* Deprecated/legacy */
815
816 int i;
817 unsigned __int8 la[8];
818 memcpy (la, a, 8);
819 memset (p, 0, 8);
820
821 for (i = 0; i < 64; i++)
822 {
823 if (IsBitSet64 (i, b))
824 xor64 ((uint64 *)p, (uint64 *)la);
825
826 if (la[0] & 0x80)
827 {
828 shl64 (la);
829 la[7] ^= 0x1b;
830 }
831 else
832 {
833 shl64 (la);
834 }
835 }
836}
837
838 745
839BOOL GfMulSelfTest () 746BOOL GfMulSelfTest ()
840{ 747{
@@ -849,23 +756,6 @@ BOOL GfMulSelfTest ()
849 if (!gfCtx) 756 if (!gfCtx)
850 return FALSE; 757 return FALSE;
851 758
852 /* GF(2^64) - deprecated/legacy */
853 for (i = 0; i < 0x100; i++)
854 {
855 for (j = 0; j < 8; j++)
856 {
857 a[j] = (unsigned __int8) i;
858 b[j] = a[j] ^ 0xff;
859 }
860
861 GfMul64Basic (a, b, p1);
862
863 Gf64TabInit (a, gfCtx);
864 Gf64MulTab (b, p2, gfCtx);
865
866 if (memcmp (p1, p2, 8) != 0)
867 result = FALSE;
868 }
869 759
870 /* GF(2^128) */ 760 /* GF(2^128) */
871 for (i = 0; i < 0x100; i++) 761 for (i = 0; i < 0x100; i++)
diff --git a/src/Common/GfMul.h b/src/Common/GfMul.h
index ce5aa022..12dc864f 100644
--- a/src/Common/GfMul.h
+++ b/src/Common/GfMul.h
@@ -63,8 +63,6 @@ void GfMul128 (void *a, const void* b);
63void GfMul128Tab(unsigned char a[16], GfCtx8k *ctx); 63void GfMul128Tab(unsigned char a[16], GfCtx8k *ctx);
64int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx); 64int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx);
65void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx); 65void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx);
66int Gf64TabInit (unsigned __int8 *a, GfCtx *ctx);
67void Gf64MulTab (unsigned char a[8], unsigned char p[8], GfCtx *ctx);
68void MirrorBits128 (unsigned __int8 *a); 66void MirrorBits128 (unsigned __int8 *a);
69void MirrorBits64 (unsigned __int8 *a); 67void MirrorBits64 (unsigned __int8 *a);
70BOOL GfMulSelfTest (); 68BOOL GfMulSelfTest ();
diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c
index 00cf7941..8f21bb80 100644
--- a/src/Common/Pkcs5.c
+++ b/src/Common/Pkcs5.c
@@ -14,7 +14,6 @@
14#include <memory.h> 14#include <memory.h>
15#include "Rmd160.h" 15#include "Rmd160.h"
16#ifndef TC_WINDOWS_BOOT 16#ifndef TC_WINDOWS_BOOT
17#include "Sha1.h"
18#include "Sha2.h" 17#include "Sha2.h"
19#include "Whirlpool.h" 18#include "Whirlpool.h"
20#endif 19#endif
@@ -175,150 +174,6 @@ void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int it
175 burn (u, sizeof(u)); 174 burn (u, sizeof(u));
176} 175}
177 176
178
179/* Deprecated/legacy */
180void hmac_sha1
181(
182 char *k, /* secret key */
183 int lk, /* length of the key in bytes */
184 char *d, /* data */
185 int ld, /* length of data in bytes */
186 char *out, /* output buffer, at least "t" bytes */
187 int t
188)
189{
190 sha1_ctx ictx, octx;
191 char isha[SHA1_DIGESTSIZE], osha[SHA1_DIGESTSIZE];
192 char key[SHA1_DIGESTSIZE];
193 char buf[SHA1_BLOCKSIZE];
194 int i;
195
196 /* If the key is longer than the hash algorithm block size,
197 let key = sha1(key), as per HMAC specifications. */
198 if (lk > SHA1_BLOCKSIZE)
199 {
200 sha1_ctx tctx;
201
202 sha1_begin (&tctx);
203 sha1_hash ((unsigned char *) k, lk, &tctx);
204 sha1_end ((unsigned char *) key, &tctx);
205
206 k = key;
207 lk = SHA1_DIGESTSIZE;
208
209 burn (&tctx, sizeof(tctx)); // Prevent leaks
210 }
211
212 /**** Inner Digest ****/
213
214 sha1_begin (&ictx);
215
216 /* Pad the key for inner digest */
217 for (i = 0; i < lk; ++i)
218 buf[i] = (char) (k[i] ^ 0x36);
219 for (i = lk; i < SHA1_BLOCKSIZE; ++i)
220 buf[i] = 0x36;
221
222 sha1_hash ((unsigned char *) buf, SHA1_BLOCKSIZE, &ictx);
223 sha1_hash ((unsigned char *) d, ld, &ictx);
224
225 sha1_end ((unsigned char *) isha, &ictx);
226
227 /**** Outer Digest ****/
228
229 sha1_begin (&octx);
230
231 for (i = 0; i < lk; ++i)
232 buf[i] = (char) (k[i] ^ 0x5C);
233 for (i = lk; i < SHA1_BLOCKSIZE; ++i)
234 buf[i] = 0x5C;
235
236 sha1_hash ((unsigned char *) buf, SHA1_BLOCKSIZE, &octx);
237 sha1_hash ((unsigned char *) isha, SHA1_DIGESTSIZE, &octx);
238
239 sha1_end ((unsigned char *) osha, &octx);
240
241 /* truncate and print the results */
242 t = t > SHA1_DIGESTSIZE ? SHA1_DIGESTSIZE : t;
243 hmac_truncate (osha, out, t);
244
245 /* Prevent leaks */
246 burn (&ictx, sizeof(ictx));
247 burn (&octx, sizeof(octx));
248 burn (isha, sizeof(isha));
249 burn (osha, sizeof(osha));
250 burn (buf, sizeof(buf));
251 burn (key, sizeof(key));
252}
253
254
255/* Deprecated/legacy */
256void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b)
257{
258 char j[SHA1_DIGESTSIZE], k[SHA1_DIGESTSIZE];
259 char init[128];
260 char counter[4];
261 int c, i;
262
263 /* iteration 1 */
264 memset (counter, 0, 4);
265 counter[3] = (char) b;
266 memcpy (init, salt, salt_len); /* salt */
267 memcpy (&init[salt_len], counter, 4); /* big-endian block number */
268 hmac_sha1 (pwd, pwd_len, init, salt_len + 4, j, SHA1_DIGESTSIZE);
269 memcpy (u, j, SHA1_DIGESTSIZE);
270
271 /* remaining iterations */
272 for (c = 1; c < iterations; c++)
273 {
274 hmac_sha1 (pwd, pwd_len, j, SHA1_DIGESTSIZE, k, SHA1_DIGESTSIZE);
275 for (i = 0; i < SHA1_DIGESTSIZE; i++)
276 {
277 u[i] ^= k[i];
278 j[i] = k[i];
279 }
280 }
281
282 /* Prevent possible leaks. */
283 burn (j, sizeof(j));
284 burn (k, sizeof(k));
285}
286
287
288/* Deprecated/legacy */
289void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen)
290{
291 char u[SHA1_DIGESTSIZE];
292 int b, l, r;
293
294 if (dklen % SHA1_DIGESTSIZE)
295 {
296 l = 1 + dklen / SHA1_DIGESTSIZE;
297 }
298 else
299 {
300 l = dklen / SHA1_DIGESTSIZE;
301 }
302
303 r = dklen - (l - 1) * SHA1_DIGESTSIZE;
304
305 /* first l - 1 blocks */
306 for (b = 1; b < l; b++)
307 {
308 derive_u_sha1 (pwd, pwd_len, salt, salt_len, iterations, u, b);
309 memcpy (dk, u, SHA1_DIGESTSIZE);
310 dk += SHA1_DIGESTSIZE;
311 }
312
313 /* last block */
314 derive_u_sha1 (pwd, pwd_len, salt, salt_len, iterations, u, b);
315 memcpy (dk, u, r);
316
317
318 /* Prevent possible leaks. */
319 burn (u, sizeof(u));
320}
321
322#endif // TC_WINDOWS_BOOT 177#endif // TC_WINDOWS_BOOT
323 178
324void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest) 179void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest)
@@ -618,9 +473,6 @@ char *get_pkcs5_prf_name (int pkcs5_prf_id)
618 case SHA512: 473 case SHA512:
619 return "HMAC-SHA-512"; 474 return "HMAC-SHA-512";
620 475
621 case SHA1: // Deprecated/legacy
622 return "HMAC-SHA-1";
623
624 case RIPEMD160: 476 case RIPEMD160:
625 return "HMAC-RIPEMD-160"; 477 return "HMAC-RIPEMD-160";
626 478
@@ -646,10 +498,7 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, BOOL bBoot)
646#ifndef TC_WINDOWS_BOOT 498#ifndef TC_WINDOWS_BOOT
647 499
648 case SHA512: 500 case SHA512:
649 return 500000; 501 return 500000;
650
651 case SHA1: // Deprecated/legacy
652 return 1000000;
653 502
654 case WHIRLPOOL: 503 case WHIRLPOOL:
655 return 500000; 504 return 500000;
diff --git a/src/Common/Tests.c b/src/Common/Tests.c
index dd4f1621..226b3e09 100644
--- a/src/Common/Tests.c
+++ b/src/Common/Tests.c
@@ -290,91 +290,6 @@ BOOL XTSAesTest (PCRYPTO_INFO ci)
290 return TRUE; 290 return TRUE;
291} 291}
292 292
293/* Blowfish Test Vectors (deprecated/legacy) */
294
295/* Blowfish test vectors from www.counterpane.com/blowfish.html */
296
297#define BF_TEST_COUNT 34
298
299typedef struct {
300 unsigned char key[8];
301 unsigned char plaintext[8];
302 unsigned char ciphertext[8];
303 } BF_TEST;
304
305#pragma warning(disable:4295)
306
307BF_TEST bf_ecb_vectors[BF_TEST_COUNT] = {
308"\x00\x00\x00\x00\x00\x00\x00\x00","\x00\x00\x00\x00\x00\x00\x00\x00","\x4E\xF9\x97\x45\x61\x98\xDD\x78",
309"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF","\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF","\x51\x86\x6F\xD5\xB8\x5E\xCB\x8A",
310"\x30\x00\x00\x00\x00\x00\x00\x00","\x10\x00\x00\x00\x00\x00\x00\x01","\x7D\x85\x6F\x9A\x61\x30\x63\xF2",
311"\x11\x11\x11\x11\x11\x11\x11\x11","\x11\x11\x11\x11\x11\x11\x11\x11","\x24\x66\xDD\x87\x8B\x96\x3C\x9D",
312"\x01\x23\x45\x67\x89\xAB\xCD\xEF","\x11\x11\x11\x11\x11\x11\x11\x11","\x61\xF9\xC3\x80\x22\x81\xB0\x96",
313"\x11\x11\x11\x11\x11\x11\x11\x11","\x01\x23\x45\x67\x89\xAB\xCD\xEF","\x7D\x0C\xC6\x30\xAF\xDA\x1E\xC7",
314"\x00\x00\x00\x00\x00\x00\x00\x00","\x00\x00\x00\x00\x00\x00\x00\x00","\x4E\xF9\x97\x45\x61\x98\xDD\x78",
315"\xFE\xDC\xBA\x98\x76\x54\x32\x10","\x01\x23\x45\x67\x89\xAB\xCD\xEF","\x0A\xCE\xAB\x0F\xC6\xA0\xA2\x8D",
316"\x7C\xA1\x10\x45\x4A\x1A\x6E\x57","\x01\xA1\xD6\xD0\x39\x77\x67\x42","\x59\xC6\x82\x45\xEB\x05\x28\x2B",
317"\x01\x31\xD9\x61\x9D\xC1\x37\x6E","\x5C\xD5\x4C\xA8\x3D\xEF\x57\xDA","\xB1\xB8\xCC\x0B\x25\x0F\x09\xA0",
318"\x07\xA1\x13\x3E\x4A\x0B\x26\x86","\x02\x48\xD4\x38\x06\xF6\x71\x72","\x17\x30\xE5\x77\x8B\xEA\x1D\xA4",
319"\x38\x49\x67\x4C\x26\x02\x31\x9E","\x51\x45\x4B\x58\x2D\xDF\x44\x0A","\xA2\x5E\x78\x56\xCF\x26\x51\xEB",
320"\x04\xB9\x15\xBA\x43\xFE\xB5\xB6","\x42\xFD\x44\x30\x59\x57\x7F\xA2","\x35\x38\x82\xB1\x09\xCE\x8F\x1A",
321"\x01\x13\xB9\x70\xFD\x34\xF2\xCE","\x05\x9B\x5E\x08\x51\xCF\x14\x3A","\x48\xF4\xD0\x88\x4C\x37\x99\x18",
322"\x01\x70\xF1\x75\x46\x8F\xB5\xE6","\x07\x56\xD8\xE0\x77\x47\x61\xD2","\x43\x21\x93\xB7\x89\x51\xFC\x98",
323"\x43\x29\x7F\xAD\x38\xE3\x73\xFE","\x76\x25\x14\xB8\x29\xBF\x48\x6A","\x13\xF0\x41\x54\xD6\x9D\x1A\xE5",
324"\x07\xA7\x13\x70\x45\xDA\x2A\x16","\x3B\xDD\x11\x90\x49\x37\x28\x02","\x2E\xED\xDA\x93\xFF\xD3\x9C\x79",
325"\x04\x68\x91\x04\xC2\xFD\x3B\x2F","\x26\x95\x5F\x68\x35\xAF\x60\x9A","\xD8\x87\xE0\x39\x3C\x2D\xA6\xE3",
326"\x37\xD0\x6B\xB5\x16\xCB\x75\x46","\x16\x4D\x5E\x40\x4F\x27\x52\x32","\x5F\x99\xD0\x4F\x5B\x16\x39\x69",
327"\x1F\x08\x26\x0D\x1A\xC2\x46\x5E","\x6B\x05\x6E\x18\x75\x9F\x5C\xCA","\x4A\x05\x7A\x3B\x24\xD3\x97\x7B",
328"\x58\x40\x23\x64\x1A\xBA\x61\x76","\x00\x4B\xD6\xEF\x09\x17\x60\x62","\x45\x20\x31\xC1\xE4\xFA\xDA\x8E",
329"\x02\x58\x16\x16\x46\x29\xB0\x07","\x48\x0D\x39\x00\x6E\xE7\x62\xF2","\x75\x55\xAE\x39\xF5\x9B\x87\xBD",
330"\x49\x79\x3E\xBC\x79\xB3\x25\x8F","\x43\x75\x40\xC8\x69\x8F\x3C\xFA","\x53\xC5\x5F\x9C\xB4\x9F\xC0\x19",
331"\x4F\xB0\x5E\x15\x15\xAB\x73\xA7","\x07\x2D\x43\xA0\x77\x07\x52\x92","\x7A\x8E\x7B\xFA\x93\x7E\x89\xA3",
332"\x49\xE9\x5D\x6D\x4C\xA2\x29\xBF","\x02\xFE\x55\x77\x81\x17\xF1\x2A","\xCF\x9C\x5D\x7A\x49\x86\xAD\xB5",
333"\x01\x83\x10\xDC\x40\x9B\x26\xD6","\x1D\x9D\x5C\x50\x18\xF7\x28\xC2","\xD1\xAB\xB2\x90\x65\x8B\xC7\x78",
334"\x1C\x58\x7F\x1C\x13\x92\x4F\xEF","\x30\x55\x32\x28\x6D\x6F\x29\x5A","\x55\xCB\x37\x74\xD1\x3E\xF2\x01",
335"\x01\x01\x01\x01\x01\x01\x01\x01","\x01\x23\x45\x67\x89\xAB\xCD\xEF","\xFA\x34\xEC\x48\x47\xB2\x68\xB2",
336"\x1F\x1F\x1F\x1F\x0E\x0E\x0E\x0E","\x01\x23\x45\x67\x89\xAB\xCD\xEF","\xA7\x90\x79\x51\x08\xEA\x3C\xAE",
337"\xE0\xFE\xE0\xFE\xF1\xFE\xF1\xFE","\x01\x23\x45\x67\x89\xAB\xCD\xEF","\xC3\x9E\x07\x2D\x9F\xAC\x63\x1D",
338"\x00\x00\x00\x00\x00\x00\x00\x00","\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF","\x01\x49\x33\xE0\xCD\xAF\xF6\xE4",
339"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF","\x00\x00\x00\x00\x00\x00\x00\x00","\xF2\x1E\x9A\x77\xB7\x1C\x49\xBC",
340"\x01\x23\x45\x67\x89\xAB\xCD\xEF","\x00\x00\x00\x00\x00\x00\x00\x00","\x24\x59\x46\x88\x57\x54\x36\x9A",
341"\xFE\xDC\xBA\x98\x76\x54\x32\x10","\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF","\x6B\x5C\x5A\x9C\x5D\x9E\x0A\x5A"
342};
343
344
345#define TRIPLEDES_TEST_COUNT 1
346
347typedef struct {
348 unsigned char key[24];
349 unsigned char plaintext[8];
350 unsigned char ciphertext[8];
351 } TRIPLEDES_TEST;
352
353TRIPLEDES_TEST tripledes_vectors[TRIPLEDES_TEST_COUNT] = {
3540x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98,
3550x76, 0x54, 0x32, 0x10, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67,
356
3570x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
358
3590xde, 0x0b, 0x7c, 0x06, 0xae, 0x5e, 0x0e, 0xd5
360};
361
362/* CAST-128 Test Vectors from RFC2144 (deprecated/legacy) */
363
364#define CAST_TEST_COUNT 1
365
366typedef struct {
367 unsigned char key[16];
368 unsigned char plaintext[8];
369 unsigned char ciphertext[8];
370 } CAST_TEST;
371
372
373CAST_TEST cast_ecb_vectors[CAST_TEST_COUNT] = {
374 "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A",
375 "\x01\x23\x45\x67\x89\xAB\xCD\xEF",
376 "\x23\x8B\x4F\xE5\x84\x7E\x44\xB2"
377 };
378 293
379// AES ECB test vectors FIPS-197 294// AES ECB test vectors FIPS-197
380 295
@@ -463,35 +378,6 @@ char *hmac_sha512_test_vectors[] =
463 "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44\xb6\x02\x2c\xac\x3c\x49\x82\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15\x13\x46\x76\xfb\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58", 378 "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44\xb6\x02\x2c\xac\x3c\x49\x82\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15\x13\x46\x76\xfb\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58",
464}; 379};
465 380
466char *hmac_sha1_test_keys[] =
467{
468 // Deprecated/legacy
469 "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3",
470 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
471 "Jefe",
472 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
473};
474
475char *hmac_sha1_test_data[] =
476{
477 // Deprecated/legacy
478 "Sample #3",
479 "Hi There",
480 "what do ya want for nothing?",
481 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
482 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
483 "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
484};
485
486char *hmac_sha1_test_vectors[] =
487{
488 // Deprecated/legacy
489 "\xbc\xf4\x1e\xab\x8b\xb2\xd8\x02\xf3\xd0\x5c\xaf\x7c\xb0\x92\xec\xf8\xd1\xa3\xaa",
490 "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00",
491 "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79",
492 "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3"
493};
494
495char *hmac_ripemd160_test_keys[] = 381char *hmac_ripemd160_test_keys[] =
496{ 382{
497 "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff\x01\x23\x45\x67", 383 "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff\x01\x23\x45\x67",
@@ -534,29 +420,15 @@ void CipherInit2(int cipher, void* key, void* ks, int key_len)
534{ 420{
535 switch (cipher) 421 switch (cipher)
536 { 422 {
537 case BLOWFISH:
538 /* Deprecated/legacy */
539 BlowfishSetKey (ks, key_len, key);
540 break;
541 423
542 case AES: 424 case AES:
543 CipherInit(cipher,key,ks); 425 CipherInit(cipher,key,ks);
544 break; 426 break;
545 427
546 case CAST:
547 /* Deprecated/legacy */
548 CipherInit(cipher,key,ks);
549 break;
550
551 case SERPENT: 428 case SERPENT:
552 CipherInit(cipher,key,ks); 429 CipherInit(cipher,key,ks);
553 break; 430 break;
554 431
555 case TRIPLEDES:
556 /* Deprecated/legacy */
557 CipherInit(cipher,key,ks);
558 break;
559
560 case TWOFISH: 432 case TWOFISH:
561 CipherInit(cipher,key,ks); 433 CipherInit(cipher,key,ks);
562 break; 434 break;
@@ -568,72 +440,6 @@ void CipherInit2(int cipher, void* key, void* ks, int key_len)
568} 440}
569 441
570 442
571/* Deprecated/legacy */
572typedef struct {
573 unsigned __int8 key1[32];
574 unsigned __int8 key2[16];
575 unsigned __int8 index[16];
576 unsigned __int8 plaintext[16];
577 unsigned __int8 ciphertext[16];
578} LRW_TEST;
579
580#define LRW_TEST_COUNT 2
581
582/* Deprecated/legacy */
583LRW_TEST lrw_vectors[LRW_TEST_COUNT] = {
584 {
585 { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c, 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d,
586 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21, 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89 },
587 { 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1, 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e },
588 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
589 { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
590 { 0xbd, 0x06, 0xb8, 0xe1, 0xdb, 0x98, 0x89, 0x9e, 0xc4, 0x98, 0xe4, 0x91, 0xcf, 0x1c, 0x70, 0x2b }
591 },
592 {
593 { 0xfb, 0x76, 0x15, 0xb2, 0x3d, 0x80, 0x89, 0x1d, 0xd4, 0x70, 0x98, 0x0b, 0xc7, 0x95, 0x84, 0xc8,
594 0xb2, 0xfb, 0x64, 0xce, 0x60, 0x97, 0x87, 0x8d, 0x17, 0xfc, 0xe4, 0x5a, 0x49, 0xe8, 0x30, 0xb7 },
595 { 0x6e, 0x78, 0x17, 0xe7, 0x2d, 0x5e, 0x12, 0xd4, 0x60, 0x64, 0x04, 0x7a, 0xf1, 0x2f, 0x9e, 0x0c },
596 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
597 { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
598 { 0x5b, 0x90, 0x8e, 0xc1, 0xab, 0xdd, 0x67, 0x5f, 0x3d, 0x69, 0x8a, 0x95, 0x53, 0xc8, 0x9c, 0xe5 }
599 }
600};
601
602
603BOOL LRWAesTest (PCRYPTO_INFO ci)
604{
605 /* Deprecated/legacy */
606
607 unsigned __int8 p[16];
608 int i;
609
610 for (i = 0; i < LRW_TEST_COUNT; i++)
611 {
612 ci->ea = EAGetByName ("AES");
613 if (ci->ea == 0)
614 return FALSE;
615
616 ci->mode = LRW;
617
618 if (EAInit (ci->ea, lrw_vectors[i].key1, ci->ks) != ERR_SUCCESS)
619 return FALSE;
620
621 memcpy (&ci->k2, lrw_vectors[i].key2, sizeof (lrw_vectors[i].key2));
622 if (!EAInitMode (ci))
623 return FALSE;
624
625 memcpy (p, lrw_vectors[i].plaintext, sizeof (p));
626
627 EncryptBufferLRW128 (p, sizeof (p), BE64(((unsigned __int64 *)(lrw_vectors[i].index))[1]), ci);
628
629 if (memcmp (lrw_vectors[i].ciphertext, p, sizeof (p)) != 0)
630 return FALSE;
631 }
632
633 return TRUE;
634}
635
636
637BOOL TestSectorBufEncryption (PCRYPTO_INFO ci) 443BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
638{ 444{
639 unsigned char buf [ENCRYPTION_DATA_UNIT_SIZE * 4]; 445 unsigned char buf [ENCRYPTION_DATA_UNIT_SIZE * 4];
@@ -653,15 +459,12 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
653 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 459 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13
654 }; 460 };
655 461
656 if (!TestLegacySectorBufEncryption (ci))
657 return FALSE;
658
659 462
660 /* Encryption/decryption of data units (typically, volume data sectors) */ 463 /* Encryption/decryption of data units (typically, volume data sectors) */
661 464
662 nbrUnits = sizeof (buf) / ENCRYPTION_DATA_UNIT_SIZE; 465 nbrUnits = sizeof (buf) / ENCRYPTION_DATA_UNIT_SIZE;
663 466
664 ci->mode = XTS; // Other modes of operation are tested in TestLegacySectorBufEncryption() 467 ci->mode = XTS; // we only implement XTS
665 468
666 /* The buffer can accommodate 4 data units and we'll test 4 cases by "scrolling". The data unit 0xFFFFFFFFFF 469 /* The buffer can accommodate 4 data units and we'll test 4 cases by "scrolling". The data unit 0xFFFFFFFFFF
667 will "move" from the start of the buffer to its end. For a 512-byte data unit, the byte offset 562949953420800 470 will "move" from the start of the buffer to its end. For a 512-byte data unit, the byte offset 562949953420800
@@ -1029,340 +832,6 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
1029 return (nTestsPerformed == 80); 832 return (nTestsPerformed == 80);
1030} 833}
1031 834
1032
1033BOOL TestLegacySectorBufEncryption (PCRYPTO_INFO ci)
1034{
1035 unsigned char buf [ENCRYPTION_DATA_UNIT_SIZE * 2];
1036 unsigned int i;
1037 char name[64];
1038 unsigned __int32 crc;
1039 UINT64_STRUCT unitNo;
1040 uint32 nbrUnits;
1041 int blockSize;
1042 BOOL lrw64InitDone = FALSE;
1043 BOOL lrw128InitDone = FALSE;
1044 int nTestsPerformed = 0;
1045
1046 unitNo.Value = 0x0234567890ABCDEFull;
1047 nbrUnits = sizeof (buf) / ENCRYPTION_DATA_UNIT_SIZE;
1048
1049 for (i = 0; i < sizeof (buf); i++)
1050 buf[i] = (unsigned char) i;
1051
1052 for (i = 0; i < sizeof (ci->k2); i++)
1053 ci->k2[i] = (unsigned char) i;
1054
1055 // Test all EAs
1056 for (ci->ea = EAGetFirst (); ci->ea != 0; ci->ea = EAGetNext (ci->ea))
1057 {
1058 EAGetName (name, ci->ea);
1059 blockSize = CipherGetBlockSize (EAGetFirstCipher (ci->ea));
1060
1061 if (EAInit (ci->ea, (unsigned char *)buf, ci->ks) == ERR_CIPHER_INIT_FAILURE)
1062 return FALSE;
1063
1064 // Test all deprecated modes of operation
1065 for (ci->mode = EAGetFirstMode (ci->ea);
1066 ci->mode != 0;
1067 ci->mode = EAGetNextMode (ci->ea, ci->mode))
1068 {
1069 // Skip modes that are not deprecated
1070 if (ci->mode == XTS)
1071 continue;
1072
1073 if (ci->mode == LRW
1074 && (blockSize == 8 && !lrw64InitDone || blockSize == 16 && !lrw128InitDone ))
1075 {
1076 if (!EAInitMode (ci))
1077 return FALSE;
1078
1079 if (blockSize == 8)
1080 lrw64InitDone = TRUE;
1081 else if (blockSize == 16)
1082 lrw128InitDone = TRUE;
1083 }
1084
1085 EncryptDataUnits (buf, &unitNo, nbrUnits, ci);
1086 crc = GetCrc32 (buf, sizeof (buf));
1087
1088 switch (ci->mode)
1089 {
1090 case LRW: // Deprecated/legacy
1091 if (strcmp (name, "AES") == 0)
1092 {
1093 if (crc != 0x5237acf9)
1094 return FALSE;
1095 nTestsPerformed++;
1096 }
1097 else if (strcmp (name, "Blowfish") == 0) // Deprecated/legacy
1098 {
1099 if (crc != 0xf94d5300)
1100 return FALSE;
1101 nTestsPerformed++;
1102 }
1103 else if (strcmp (name, "CAST5") == 0) // Deprecated/legacy
1104 {
1105 if (crc != 0x33971e82)
1106 return FALSE;
1107 nTestsPerformed++;
1108 }
1109 else if (strcmp (name, "Serpent") == 0)
1110 {
1111 if (crc != 0x7fb86805)
1112 return FALSE;
1113 nTestsPerformed++;
1114 }
1115 else if (strcmp (name, "Triple DES") == 0) // Deprecated/legacy
1116 {
1117 if (crc != 0x2b20bb84)
1118 return FALSE;
1119 nTestsPerformed++;
1120 }
1121 else if (strcmp (name, "Twofish") == 0)
1122 {
1123 if (crc != 0xa9de0f0b)
1124 return FALSE;
1125 nTestsPerformed++;
1126 }
1127 else if (strcmp (name, "AES-Twofish") == 0)
1128 {
1129 if (crc != 0x4ed0fd80)
1130 return FALSE;
1131 nTestsPerformed++;
1132 }
1133 else if (strcmp (name, "AES-Twofish-Serpent") == 0)
1134 {
1135 if (crc != 0xea04b3cf)
1136 return FALSE;
1137 nTestsPerformed++;
1138 }
1139 else if (strcmp (name, "Serpent-AES") == 0)
1140 {
1141 if (crc != 0x0d33596a)
1142 return FALSE;
1143 nTestsPerformed++;
1144 }
1145 else if (strcmp (name, "Serpent-Twofish-AES") == 0)
1146 {
1147 if (crc != 0x2845d0e3)
1148 return FALSE;
1149 nTestsPerformed++;
1150 }
1151 else if (strcmp (name, "Twofish-Serpent") == 0)
1152 {
1153 if (crc != 0xca65c5cd)
1154 return FALSE;
1155 nTestsPerformed++;
1156 }
1157 break;
1158
1159 case CBC: // Deprecated/legacy
1160 case INNER_CBC: // Deprecated/legacy
1161 case OUTER_CBC: // Deprecated/legacy
1162 if (strcmp (name, "AES") == 0)
1163 {
1164 if (crc != 0x2274f53d)
1165 return FALSE;
1166 nTestsPerformed++;
1167 }
1168 else if (strcmp (name, "Blowfish") == 0) // Deprecated/legacy
1169 {
1170 if (crc != 0x033899a1)
1171 return FALSE;
1172 nTestsPerformed++;
1173 }
1174 else if (strcmp (name, "CAST5") == 0) // Deprecated/legacy
1175 {
1176 if (crc != 0x331cecc7)
1177 return FALSE;
1178 nTestsPerformed++;
1179 }
1180 else if (strcmp (name, "Serpent") == 0)
1181 {
1182 if (crc != 0x42dff3d4)
1183 return FALSE;
1184 nTestsPerformed++;
1185 }
1186 else if (strcmp (name, "Triple DES") == 0) // Deprecated/legacy
1187 {
1188 if (crc != 0xfe497d0c)
1189 return FALSE;
1190 nTestsPerformed++;
1191 }
1192 else if (strcmp (name, "AES-Blowfish") == 0) // Deprecated/legacy
1193 {
1194 if (crc != 0xa7a80c84)
1195 return FALSE;
1196 nTestsPerformed++;
1197 }
1198 else if (strcmp (name, "AES-Blowfish-Serpent") == 0) // Deprecated/legacy
1199 {
1200 if (crc != 0xa0584562)
1201 return FALSE;
1202 nTestsPerformed++;
1203 }
1204 else if (strcmp (name, "AES-Twofish") == 0)
1205 {
1206 if (crc != 0x3c226444)
1207 return FALSE;
1208 nTestsPerformed++;
1209 }
1210 else if (strcmp (name, "AES-Twofish-Serpent") == 0)
1211 {
1212 if (crc != 0x5e5e77fd)
1213 return FALSE;
1214 nTestsPerformed++;
1215 }
1216 else if (strcmp (name, "Serpent-AES") == 0)
1217 {
1218 if (crc != 0x57c612d5)
1219 return FALSE;
1220 nTestsPerformed++;
1221 }
1222 else if (strcmp (name, "Serpent-Twofish-AES") == 0)
1223 {
1224 if (crc != 0x081e045a)
1225 return FALSE;
1226 nTestsPerformed++;
1227 }
1228 else if (strcmp (name, "Twofish-Serpent") == 0)
1229 {
1230 if (crc != 0xa7b659f3)
1231 return FALSE;
1232 nTestsPerformed++;
1233 }
1234 break;
1235 }
1236
1237 if (crc == 0xb70b4c26)
1238 return FALSE;
1239
1240 DecryptDataUnits (buf, &unitNo, nbrUnits, ci);
1241
1242 if (GetCrc32 (buf, sizeof (buf)) != 0xb70b4c26)
1243 return FALSE;
1244
1245 nTestsPerformed++;
1246
1247 EncryptBuffer (buf, sizeof (buf), ci);
1248 crc = GetCrc32 (buf, sizeof (buf));
1249
1250 switch (ci->mode)
1251 {
1252 case LRW: // Deprecated/legacy
1253 if (strcmp (name, "AES") == 0)
1254 {
1255 if (crc != 0x5ae1e3d8)
1256 return FALSE;
1257 nTestsPerformed++;
1258 }
1259 else if (strcmp (name, "Blowfish") == 0) // Deprecated/legacy
1260 {
1261 if (crc != 0x2738426f)
1262 return FALSE;
1263 nTestsPerformed++;
1264 }
1265 else if (strcmp (name, "AES-Twofish-Serpent") == 0)
1266 {
1267 if (crc != 0x14f2948a)
1268 return FALSE;
1269 nTestsPerformed++;
1270 }
1271 break;
1272
1273 case CBC: // Deprecated/legacy
1274 case INNER_CBC: // Deprecated/legacy
1275 case OUTER_CBC: // Deprecated/legacy
1276 if (strcmp (name, "AES") == 0)
1277 {
1278 if (crc != 0x960f740e)
1279 return FALSE;
1280 nTestsPerformed++;
1281 }
1282 else if (strcmp (name, "Blowfish") == 0) // Deprecated/legacy
1283 {
1284 if (crc != 0x7e1cfabb)
1285 return FALSE;
1286 nTestsPerformed++;
1287 }
1288 else if (strcmp (name, "CAST5") == 0) // Deprecated/legacy
1289 {
1290 if (crc != 0xeaae21c8)
1291 return FALSE;
1292 nTestsPerformed++;
1293 }
1294 else if (strcmp (name, "Serpent") == 0)
1295 {
1296 if (crc != 0xa8139d62)
1297 return FALSE;
1298 nTestsPerformed++;
1299 }
1300 else if (strcmp (name, "Triple DES") == 0) // Deprecated/legacy
1301 {
1302 if (crc != 0xecf5d7d0)
1303 return FALSE;
1304 nTestsPerformed++;
1305 }
1306 else if (strcmp (name, "AES-Blowfish") == 0) // Deprecated/legacy
1307 {
1308 if (crc != 0xb70171b6)
1309 return FALSE;
1310 nTestsPerformed++;
1311 }
1312 else if (strcmp (name, "AES-Blowfish-Serpent") == 0) // Deprecated/legacy
1313 {
1314 if (crc != 0x1e749a87)
1315 return FALSE;
1316 nTestsPerformed++;
1317 }
1318 else if (strcmp (name, "AES-Twofish") == 0)
1319 {
1320 if (crc != 0xb4b8bb9b)
1321 return FALSE;
1322 nTestsPerformed++;
1323 }
1324 else if (strcmp (name, "AES-Twofish-Serpent") == 0)
1325 {
1326 if (crc != 0x76b6c1cb)
1327 return FALSE;
1328 nTestsPerformed++;
1329 }
1330 else if (strcmp (name, "Serpent-AES") == 0)
1331 {
1332 if (crc != 0x634f12ed)
1333 return FALSE;
1334 nTestsPerformed++;
1335 }
1336 else if (strcmp (name, "Serpent-Twofish-AES") == 0)
1337 {
1338 if (crc != 0xe54bc1b9)
1339 return FALSE;
1340 nTestsPerformed++;
1341 }
1342 else if (strcmp (name, "Twofish-Serpent") == 0)
1343 {
1344 if (crc != 0x21cdb382)
1345 return FALSE;
1346 nTestsPerformed++;
1347 }
1348 break;
1349 }
1350
1351 if (crc == 0xb70b4c26)
1352 return FALSE;
1353
1354 DecryptBuffer (buf, sizeof (buf), ci);
1355
1356 if (GetCrc32 (buf, sizeof (buf)) != 0xb70b4c26)
1357 return FALSE;
1358
1359 nTestsPerformed++;
1360 }
1361 }
1362 return (nTestsPerformed == 86);
1363}
1364
1365
1366static BOOL DoAutoTestAlgorithms (void) 835static BOOL DoAutoTestAlgorithms (void)
1367{ 836{
1368 PCRYPTO_INFO ci; 837 PCRYPTO_INFO ci;
@@ -1377,74 +846,6 @@ static BOOL DoAutoTestAlgorithms (void)
1377 846
1378 memset (ci, 0, sizeof (*ci)); 847 memset (ci, 0, sizeof (*ci));
1379 848
1380 /* Blowfish (deprecated/legacy) */
1381
1382 for (i=0;i<BF_TEST_COUNT;i++)
1383 {
1384 memcpy(key, bf_ecb_vectors[i].key, 8);
1385 memcpy(tmp, bf_ecb_vectors[i].plaintext, 8);
1386 CipherInit2(BLOWFISH, key, ks_tmp, 8);
1387
1388 ((uint32 *)tmp)[0] = BE32 (((uint32 *)tmp)[0]);
1389 ((uint32 *)tmp)[1] = BE32 (((uint32 *)tmp)[1]);
1390
1391 BlowfishEncryptLE (tmp,tmp,(BF_KEY *)ks_tmp,1);
1392 BlowfishEncryptLE (tmp,tmp,(BF_KEY *)ks_tmp,0);
1393 BlowfishEncryptLE (tmp,tmp,(BF_KEY *)ks_tmp,1);
1394
1395 ((uint32 *)tmp)[0] = BE32 (((uint32 *)tmp)[0]);
1396 ((uint32 *)tmp)[1] = BE32 (((uint32 *)tmp)[1]);
1397
1398 if (memcmp(bf_ecb_vectors[i].ciphertext,tmp,8)!=0)
1399 break;
1400 }
1401
1402 if (i != BF_TEST_COUNT)
1403 bFailed = TRUE;
1404
1405 /* CAST5 (deprecated/legacy) */
1406
1407 for (i=0;i<CAST_TEST_COUNT;i++)
1408 {
1409 int cipher = CAST;
1410 memcpy(key, cast_ecb_vectors[i].key, 16);
1411 memcpy(tmp, cast_ecb_vectors[i].plaintext, 8);
1412 CipherInit2(cipher, key, ks_tmp, 16);
1413
1414 EncipherBlock(cipher, tmp, ks_tmp);
1415 DecipherBlock(cipher, tmp, ks_tmp);
1416 EncipherBlock(cipher, tmp, ks_tmp);
1417
1418 if (memcmp(cast_ecb_vectors[i].ciphertext, tmp,8)!=0)
1419 break;
1420 }
1421
1422 if (i!=CAST_TEST_COUNT)
1423 bFailed = TRUE;
1424
1425
1426 /* Triple DES (TECB, EDE) - deprecated/legacy */
1427
1428 for (i = 0; i < TRIPLEDES_TEST_COUNT; i++)
1429 {
1430 int cipher = TRIPLEDES;
1431 memcpy(key, tripledes_vectors[i].key, sizeof(tripledes_vectors->key));
1432 memcpy(tmp, tripledes_vectors[i].plaintext, sizeof(tripledes_vectors->plaintext));
1433
1434 CipherInit(cipher, key, ks_tmp);
1435
1436 EncipherBlock(cipher, tmp, ks_tmp);
1437 if (memcmp(tripledes_vectors[i].ciphertext, tmp, sizeof(tripledes_vectors->ciphertext)) != 0)
1438 break;
1439
1440 DecipherBlock(cipher, tmp, ks_tmp);
1441 if (memcmp(tripledes_vectors[i].plaintext, tmp, sizeof(tripledes_vectors->plaintext)) != 0)
1442 break;
1443 }
1444 if (i != TRIPLEDES_TEST_COUNT)
1445 bFailed = TRUE;
1446
1447
1448 /* AES */ 849 /* AES */
1449 850
1450 for (i = 0; i < AES_TEST_COUNT; i++) 851 for (i = 0; i < AES_TEST_COUNT; i++)
@@ -1550,10 +951,6 @@ static BOOL DoAutoTestAlgorithms (void)
1550 if (!XTSAesTest (ci)) 951 if (!XTSAesTest (ci))
1551 bFailed = TRUE; 952 bFailed = TRUE;
1552 953
1553 /* LRW-AES (deprecated/legacy) */
1554 if (!LRWAesTest (ci))
1555 bFailed = TRUE;
1556
1557 /* Sector and buffer related algorithms */ 954 /* Sector and buffer related algorithms */
1558 if (!TestSectorBufEncryption (ci)) 955 if (!TestSectorBufEncryption (ci))
1559 bFailed = TRUE; 956 bFailed = TRUE;
@@ -1601,26 +998,6 @@ BOOL test_hmac_sha512 ()
1601 return (nTestsPerformed == 6); 998 return (nTestsPerformed == 6);
1602} 999}
1603 1000
1604BOOL test_hmac_sha1 ()
1605{
1606 // Deprecated/legacy
1607
1608 int nTestsPerformed = 0;
1609 int i;
1610
1611 for (i = 0; i < 3; i++)
1612 {
1613 char digest[SHA1_DIGESTSIZE];
1614 hmac_sha1 (hmac_sha1_test_keys[i], (int) strlen (hmac_sha1_test_keys[i]), hmac_sha1_test_data[i], (int) strlen (hmac_sha1_test_data[i]), digest, SHA1_DIGESTSIZE);
1615 if (memcmp (digest, hmac_sha1_test_vectors[i], SHA1_DIGESTSIZE) != 0)
1616 return FALSE;
1617 else
1618 nTestsPerformed++;
1619 }
1620
1621 return (nTestsPerformed == 3);
1622}
1623
1624BOOL test_hmac_ripemd160 () 1001BOOL test_hmac_ripemd160 ()
1625{ 1002{
1626 int nTestsPerformed = 0; 1003 int nTestsPerformed = 0;
@@ -1658,10 +1035,6 @@ BOOL test_pkcs5 ()
1658 if (!test_hmac_sha512()) 1035 if (!test_hmac_sha512())
1659 return FALSE; 1036 return FALSE;
1660 1037
1661 /* HMAC-SHA-1 tests (deprecated/legacy) */
1662 if (test_hmac_sha1() == FALSE)
1663 return FALSE;
1664
1665 /* HMAC-RIPEMD-160 tests */ 1038 /* HMAC-RIPEMD-160 tests */
1666 if (test_hmac_ripemd160() == FALSE) 1039 if (test_hmac_ripemd160() == FALSE)
1667 return FALSE; 1040 return FALSE;
@@ -1681,23 +1054,6 @@ BOOL test_pkcs5 ()
1681 if (memcmp (dk, "\x13\x64\xae\xf8\x0d\xf5\x57\x6c\x30\xd5\x71\x4c\xa7\x75\x3f\xfd\x00\xe5\x25\x8b\x39\xc7\x44\x7f\xce\x23\x3d\x08\x75\xe0\x2f\x48\xd6\x30\xd7\x00\xb6\x24\xdb\xe0\x5a\xd7\x47\xef\x52\xca\xa6\x34\x83\x47\xe5\xcb\xe9\x87\xf1\x20\x59\x6a\xe6\xa9\xcf\x51\x78\xc6\xb6\x23\xa6\x74\x0d\xe8\x91\xbe\x1a\xd0\x28\xcc\xce\x16\x98\x9a\xbe\xfb\xdc\x78\xc9\xe1\x7d\x72\x67\xce\xe1\x61\x56\x5f\x96\x68\xe6\xe1\xdd\xf4\xbf\x1b\x80\xe0\x19\x1c\xf4\xc4\xd3\xdd\xd5\xd5\x57\x2d\x83\xc7\xa3\x37\x87\xf4\x4e\xe0\xf6\xd8\x6d\x65\xdc\xa0\x52\xa3\x13\xbe\x81\xfc\x30\xbe\x7d\x69\x58\x34\xb6\xdd\x41\xc6", 144) != 0) 1054 if (memcmp (dk, "\x13\x64\xae\xf8\x0d\xf5\x57\x6c\x30\xd5\x71\x4c\xa7\x75\x3f\xfd\x00\xe5\x25\x8b\x39\xc7\x44\x7f\xce\x23\x3d\x08\x75\xe0\x2f\x48\xd6\x30\xd7\x00\xb6\x24\xdb\xe0\x5a\xd7\x47\xef\x52\xca\xa6\x34\x83\x47\xe5\xcb\xe9\x87\xf1\x20\x59\x6a\xe6\xa9\xcf\x51\x78\xc6\xb6\x23\xa6\x74\x0d\xe8\x91\xbe\x1a\xd0\x28\xcc\xce\x16\x98\x9a\xbe\xfb\xdc\x78\xc9\xe1\x7d\x72\x67\xce\xe1\x61\x56\x5f\x96\x68\xe6\xe1\xdd\xf4\xbf\x1b\x80\xe0\x19\x1c\xf4\xc4\xd3\xdd\xd5\xd5\x57\x2d\x83\xc7\xa3\x37\x87\xf4\x4e\xe0\xf6\xd8\x6d\x65\xdc\xa0\x52\xa3\x13\xbe\x81\xfc\x30\xbe\x7d\x69\x58\x34\xb6\xdd\x41\xc6", 144) != 0)
1682 return FALSE; 1055 return FALSE;
1683 1056
1684 /* PKCS-5 test 1 with HMAC-SHA-1 (deprecated/legacy) used as the PRF (derives a key longer than the underlying hash) */
1685 derive_key_sha1 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 48);
1686 if (memcmp (dk, "\x5c\x75\xce\xf0\x1a\x96\x0d\xf7\x4c\xb6\xb4\x9b\x9e\x38\xe6\xb5\x3b\x11\x80\xe3\x2f\xf7\xe0\xdd\xaa\xca\x8f\x81\x27\xf6\x9f\x4f\x1d\xc8\x2f\x48\x2d\xdb\x1a\x0a\xca\x90\xcb\x80\xb9\x2e\x90\x9e", 48) != 0)
1687 return FALSE;
1688
1689 /* PKCS-5 test 2 with HMAC-SHA-1 (deprecated/legacy) used as the PRF */
1690 derive_key_sha1 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
1691 if (memcmp (dk, "\x5c\x75\xce\xf0", 4) != 0)
1692 return FALSE;
1693
1694#if 0 // This test is disabled because it uses 1200 iterations (to prevent startup slowdown)
1695 /* PKCS-5 test 3 with HMAC-SHA-1 (deprecated/legacy) used as the PRF */
1696 derive_key_sha1 ("password", 8, "ATHENA.MIT.EDUraeburn", 21, 1200, dk, 16);
1697 if (memcmp (dk, "\x5c\x08\xeb\x61\xfd\xf7\x1e\x4e\x4e\xc3\xcf\x6b\xa1\xf5\x51\x2b", 16) != 0)
1698 return FALSE;
1699#endif
1700
1701 /* PKCS-5 test 1 with HMAC-RIPEMD-160 used as the PRF */ 1057 /* PKCS-5 test 1 with HMAC-RIPEMD-160 used as the PRF */
1702 derive_key_ripemd160 (FALSE, "password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4); 1058 derive_key_ripemd160 (FALSE, "password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
1703 if (memcmp (dk, "\x7a\x3d\x7c\x03", 4) != 0) 1059 if (memcmp (dk, "\x7a\x3d\x7c\x03", 4) != 0)
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)
diff --git a/src/Crypto/Blowfish.c b/src/Crypto/Blowfish.c
deleted file mode 100644
index 54754e05..00000000
--- a/src/Crypto/Blowfish.c
+++ /dev/null
@@ -1,382 +0,0 @@
1/* Deprecated/legacy */
2
3
4// blowfish.cpp - written and placed in the public domain by Wei Dai
5
6/* Adapted for TrueCrypt */
7
8#include <memory.h>
9#include "Common/Tcdefs.h"
10#include "Common/Endian.h"
11#include "Blowfish.h"
12
13#define word32 unsigned __int32
14#define byte unsigned __int8
15#define GETBYTE(x, y) (unsigned int)(byte)((x)>>(8*(y)))
16#define ROUNDS 16
17
18static const unsigned __int32 p_init[16+2] =
19{
20 608135816U, 2242054355U, 320440878U, 57701188U,
21 2752067618U, 698298832U, 137296536U, 3964562569U,
22 1160258022U, 953160567U, 3193202383U, 887688300U,
23 3232508343U, 3380367581U, 1065670069U, 3041331479U,
24 2450970073U, 2306472731U
25} ;
26
27static const unsigned __int32 s_init[4*256] = {
28 3509652390U, 2564797868U, 805139163U, 3491422135U,
29 3101798381U, 1780907670U, 3128725573U, 4046225305U,
30 614570311U, 3012652279U, 134345442U, 2240740374U,
31 1667834072U, 1901547113U, 2757295779U, 4103290238U,
32 227898511U, 1921955416U, 1904987480U, 2182433518U,
33 2069144605U, 3260701109U, 2620446009U, 720527379U,
34 3318853667U, 677414384U, 3393288472U, 3101374703U,
35 2390351024U, 1614419982U, 1822297739U, 2954791486U,
36 3608508353U, 3174124327U, 2024746970U, 1432378464U,
37 3864339955U, 2857741204U, 1464375394U, 1676153920U,
38 1439316330U, 715854006U, 3033291828U, 289532110U,
39 2706671279U, 2087905683U, 3018724369U, 1668267050U,
40 732546397U, 1947742710U, 3462151702U, 2609353502U,
41 2950085171U, 1814351708U, 2050118529U, 680887927U,
42 999245976U, 1800124847U, 3300911131U, 1713906067U,
43 1641548236U, 4213287313U, 1216130144U, 1575780402U,
44 4018429277U, 3917837745U, 3693486850U, 3949271944U,
45 596196993U, 3549867205U, 258830323U, 2213823033U,
46 772490370U, 2760122372U, 1774776394U, 2652871518U,
47 566650946U, 4142492826U, 1728879713U, 2882767088U,
48 1783734482U, 3629395816U, 2517608232U, 2874225571U,
49 1861159788U, 326777828U, 3124490320U, 2130389656U,
50 2716951837U, 967770486U, 1724537150U, 2185432712U,
51 2364442137U, 1164943284U, 2105845187U, 998989502U,
52 3765401048U, 2244026483U, 1075463327U, 1455516326U,
53 1322494562U, 910128902U, 469688178U, 1117454909U,
54 936433444U, 3490320968U, 3675253459U, 1240580251U,
55 122909385U, 2157517691U, 634681816U, 4142456567U,
56 3825094682U, 3061402683U, 2540495037U, 79693498U,
57 3249098678U, 1084186820U, 1583128258U, 426386531U,
58 1761308591U, 1047286709U, 322548459U, 995290223U,
59 1845252383U, 2603652396U, 3431023940U, 2942221577U,
60 3202600964U, 3727903485U, 1712269319U, 422464435U,
61 3234572375U, 1170764815U, 3523960633U, 3117677531U,
62 1434042557U, 442511882U, 3600875718U, 1076654713U,
63 1738483198U, 4213154764U, 2393238008U, 3677496056U,
64 1014306527U, 4251020053U, 793779912U, 2902807211U,
65 842905082U, 4246964064U, 1395751752U, 1040244610U,
66 2656851899U, 3396308128U, 445077038U, 3742853595U,
67 3577915638U, 679411651U, 2892444358U, 2354009459U,
68 1767581616U, 3150600392U, 3791627101U, 3102740896U,
69 284835224U, 4246832056U, 1258075500U, 768725851U,
70 2589189241U, 3069724005U, 3532540348U, 1274779536U,
71 3789419226U, 2764799539U, 1660621633U, 3471099624U,
72 4011903706U, 913787905U, 3497959166U, 737222580U,
73 2514213453U, 2928710040U, 3937242737U, 1804850592U,
74 3499020752U, 2949064160U, 2386320175U, 2390070455U,
75 2415321851U, 4061277028U, 2290661394U, 2416832540U,
76 1336762016U, 1754252060U, 3520065937U, 3014181293U,
77 791618072U, 3188594551U, 3933548030U, 2332172193U,
78 3852520463U, 3043980520U, 413987798U, 3465142937U,
79 3030929376U, 4245938359U, 2093235073U, 3534596313U,
80 375366246U, 2157278981U, 2479649556U, 555357303U,
81 3870105701U, 2008414854U, 3344188149U, 4221384143U,
82 3956125452U, 2067696032U, 3594591187U, 2921233993U,
83 2428461U, 544322398U, 577241275U, 1471733935U,
84 610547355U, 4027169054U, 1432588573U, 1507829418U,
85 2025931657U, 3646575487U, 545086370U, 48609733U,
86 2200306550U, 1653985193U, 298326376U, 1316178497U,
87 3007786442U, 2064951626U, 458293330U, 2589141269U,
88 3591329599U, 3164325604U, 727753846U, 2179363840U,
89 146436021U, 1461446943U, 4069977195U, 705550613U,
90 3059967265U, 3887724982U, 4281599278U, 3313849956U,
91 1404054877U, 2845806497U, 146425753U, 1854211946U,
92
93 1266315497U, 3048417604U, 3681880366U, 3289982499U,
94 2909710000U, 1235738493U, 2632868024U, 2414719590U,
95 3970600049U, 1771706367U, 1449415276U, 3266420449U,
96 422970021U, 1963543593U, 2690192192U, 3826793022U,
97 1062508698U, 1531092325U, 1804592342U, 2583117782U,
98 2714934279U, 4024971509U, 1294809318U, 4028980673U,
99 1289560198U, 2221992742U, 1669523910U, 35572830U,
100 157838143U, 1052438473U, 1016535060U, 1802137761U,
101 1753167236U, 1386275462U, 3080475397U, 2857371447U,
102 1040679964U, 2145300060U, 2390574316U, 1461121720U,
103 2956646967U, 4031777805U, 4028374788U, 33600511U,
104 2920084762U, 1018524850U, 629373528U, 3691585981U,
105 3515945977U, 2091462646U, 2486323059U, 586499841U,
106 988145025U, 935516892U, 3367335476U, 2599673255U,
107 2839830854U, 265290510U, 3972581182U, 2759138881U,
108 3795373465U, 1005194799U, 847297441U, 406762289U,
109 1314163512U, 1332590856U, 1866599683U, 4127851711U,
110 750260880U, 613907577U, 1450815602U, 3165620655U,
111 3734664991U, 3650291728U, 3012275730U, 3704569646U,
112 1427272223U, 778793252U, 1343938022U, 2676280711U,
113 2052605720U, 1946737175U, 3164576444U, 3914038668U,
114 3967478842U, 3682934266U, 1661551462U, 3294938066U,
115 4011595847U, 840292616U, 3712170807U, 616741398U,
116 312560963U, 711312465U, 1351876610U, 322626781U,
117 1910503582U, 271666773U, 2175563734U, 1594956187U,
118 70604529U, 3617834859U, 1007753275U, 1495573769U,
119 4069517037U, 2549218298U, 2663038764U, 504708206U,
120 2263041392U, 3941167025U, 2249088522U, 1514023603U,
121 1998579484U, 1312622330U, 694541497U, 2582060303U,
122 2151582166U, 1382467621U, 776784248U, 2618340202U,
123 3323268794U, 2497899128U, 2784771155U, 503983604U,
124 4076293799U, 907881277U, 423175695U, 432175456U,
125 1378068232U, 4145222326U, 3954048622U, 3938656102U,
126 3820766613U, 2793130115U, 2977904593U, 26017576U,
127 3274890735U, 3194772133U, 1700274565U, 1756076034U,
128 4006520079U, 3677328699U, 720338349U, 1533947780U,
129 354530856U, 688349552U, 3973924725U, 1637815568U,
130 332179504U, 3949051286U, 53804574U, 2852348879U,
131 3044236432U, 1282449977U, 3583942155U, 3416972820U,
132 4006381244U, 1617046695U, 2628476075U, 3002303598U,
133 1686838959U, 431878346U, 2686675385U, 1700445008U,
134 1080580658U, 1009431731U, 832498133U, 3223435511U,
135 2605976345U, 2271191193U, 2516031870U, 1648197032U,
136 4164389018U, 2548247927U, 300782431U, 375919233U,
137 238389289U, 3353747414U, 2531188641U, 2019080857U,
138 1475708069U, 455242339U, 2609103871U, 448939670U,
139 3451063019U, 1395535956U, 2413381860U, 1841049896U,
140 1491858159U, 885456874U, 4264095073U, 4001119347U,
141 1565136089U, 3898914787U, 1108368660U, 540939232U,
142 1173283510U, 2745871338U, 3681308437U, 4207628240U,
143 3343053890U, 4016749493U, 1699691293U, 1103962373U,
144 3625875870U, 2256883143U, 3830138730U, 1031889488U,
145 3479347698U, 1535977030U, 4236805024U, 3251091107U,
146 2132092099U, 1774941330U, 1199868427U, 1452454533U,
147 157007616U, 2904115357U, 342012276U, 595725824U,
148 1480756522U, 206960106U, 497939518U, 591360097U,
149 863170706U, 2375253569U, 3596610801U, 1814182875U,
150 2094937945U, 3421402208U, 1082520231U, 3463918190U,
151 2785509508U, 435703966U, 3908032597U, 1641649973U,
152 2842273706U, 3305899714U, 1510255612U, 2148256476U,
153 2655287854U, 3276092548U, 4258621189U, 236887753U,
154 3681803219U, 274041037U, 1734335097U, 3815195456U,
155 3317970021U, 1899903192U, 1026095262U, 4050517792U,
156 356393447U, 2410691914U, 3873677099U, 3682840055U,
157
158 3913112168U, 2491498743U, 4132185628U, 2489919796U,
159 1091903735U, 1979897079U, 3170134830U, 3567386728U,
160 3557303409U, 857797738U, 1136121015U, 1342202287U,
161 507115054U, 2535736646U, 337727348U, 3213592640U,
162 1301675037U, 2528481711U, 1895095763U, 1721773893U,
163 3216771564U, 62756741U, 2142006736U, 835421444U,
164 2531993523U, 1442658625U, 3659876326U, 2882144922U,
165 676362277U, 1392781812U, 170690266U, 3921047035U,
166 1759253602U, 3611846912U, 1745797284U, 664899054U,
167 1329594018U, 3901205900U, 3045908486U, 2062866102U,
168 2865634940U, 3543621612U, 3464012697U, 1080764994U,
169 553557557U, 3656615353U, 3996768171U, 991055499U,
170 499776247U, 1265440854U, 648242737U, 3940784050U,
171 980351604U, 3713745714U, 1749149687U, 3396870395U,
172 4211799374U, 3640570775U, 1161844396U, 3125318951U,
173 1431517754U, 545492359U, 4268468663U, 3499529547U,
174 1437099964U, 2702547544U, 3433638243U, 2581715763U,
175 2787789398U, 1060185593U, 1593081372U, 2418618748U,
176 4260947970U, 69676912U, 2159744348U, 86519011U,
177 2512459080U, 3838209314U, 1220612927U, 3339683548U,
178 133810670U, 1090789135U, 1078426020U, 1569222167U,
179 845107691U, 3583754449U, 4072456591U, 1091646820U,
180 628848692U, 1613405280U, 3757631651U, 526609435U,
181 236106946U, 48312990U, 2942717905U, 3402727701U,
182 1797494240U, 859738849U, 992217954U, 4005476642U,
183 2243076622U, 3870952857U, 3732016268U, 765654824U,
184 3490871365U, 2511836413U, 1685915746U, 3888969200U,
185 1414112111U, 2273134842U, 3281911079U, 4080962846U,
186 172450625U, 2569994100U, 980381355U, 4109958455U,
187 2819808352U, 2716589560U, 2568741196U, 3681446669U,
188 3329971472U, 1835478071U, 660984891U, 3704678404U,
189 4045999559U, 3422617507U, 3040415634U, 1762651403U,
190 1719377915U, 3470491036U, 2693910283U, 3642056355U,
191 3138596744U, 1364962596U, 2073328063U, 1983633131U,
192 926494387U, 3423689081U, 2150032023U, 4096667949U,
193 1749200295U, 3328846651U, 309677260U, 2016342300U,
194 1779581495U, 3079819751U, 111262694U, 1274766160U,
195 443224088U, 298511866U, 1025883608U, 3806446537U,
196 1145181785U, 168956806U, 3641502830U, 3584813610U,
197 1689216846U, 3666258015U, 3200248200U, 1692713982U,
198 2646376535U, 4042768518U, 1618508792U, 1610833997U,
199 3523052358U, 4130873264U, 2001055236U, 3610705100U,
200 2202168115U, 4028541809U, 2961195399U, 1006657119U,
201 2006996926U, 3186142756U, 1430667929U, 3210227297U,
202 1314452623U, 4074634658U, 4101304120U, 2273951170U,
203 1399257539U, 3367210612U, 3027628629U, 1190975929U,
204 2062231137U, 2333990788U, 2221543033U, 2438960610U,
205 1181637006U, 548689776U, 2362791313U, 3372408396U,
206 3104550113U, 3145860560U, 296247880U, 1970579870U,
207 3078560182U, 3769228297U, 1714227617U, 3291629107U,
208 3898220290U, 166772364U, 1251581989U, 493813264U,
209 448347421U, 195405023U, 2709975567U, 677966185U,
210 3703036547U, 1463355134U, 2715995803U, 1338867538U,
211 1343315457U, 2802222074U, 2684532164U, 233230375U,
212 2599980071U, 2000651841U, 3277868038U, 1638401717U,
213 4028070440U, 3237316320U, 6314154U, 819756386U,
214 300326615U, 590932579U, 1405279636U, 3267499572U,
215 3150704214U, 2428286686U, 3959192993U, 3461946742U,
216 1862657033U, 1266418056U, 963775037U, 2089974820U,
217 2263052895U, 1917689273U, 448879540U, 3550394620U,
218 3981727096U, 150775221U, 3627908307U, 1303187396U,
219 508620638U, 2975983352U, 2726630617U, 1817252668U,
220 1876281319U, 1457606340U, 908771278U, 3720792119U,
221 3617206836U, 2455994898U, 1729034894U, 1080033504U,
222
223 976866871U, 3556439503U, 2881648439U, 1522871579U,
224 1555064734U, 1336096578U, 3548522304U, 2579274686U,
225 3574697629U, 3205460757U, 3593280638U, 3338716283U,
226 3079412587U, 564236357U, 2993598910U, 1781952180U,
227 1464380207U, 3163844217U, 3332601554U, 1699332808U,
228 1393555694U, 1183702653U, 3581086237U, 1288719814U,
229 691649499U, 2847557200U, 2895455976U, 3193889540U,
230 2717570544U, 1781354906U, 1676643554U, 2592534050U,
231 3230253752U, 1126444790U, 2770207658U, 2633158820U,
232 2210423226U, 2615765581U, 2414155088U, 3127139286U,
233 673620729U, 2805611233U, 1269405062U, 4015350505U,
234 3341807571U, 4149409754U, 1057255273U, 2012875353U,
235 2162469141U, 2276492801U, 2601117357U, 993977747U,
236 3918593370U, 2654263191U, 753973209U, 36408145U,
237 2530585658U, 25011837U, 3520020182U, 2088578344U,
238 530523599U, 2918365339U, 1524020338U, 1518925132U,
239 3760827505U, 3759777254U, 1202760957U, 3985898139U,
240 3906192525U, 674977740U, 4174734889U, 2031300136U,
241 2019492241U, 3983892565U, 4153806404U, 3822280332U,
242 352677332U, 2297720250U, 60907813U, 90501309U,
243 3286998549U, 1016092578U, 2535922412U, 2839152426U,
244 457141659U, 509813237U, 4120667899U, 652014361U,
245 1966332200U, 2975202805U, 55981186U, 2327461051U,
246 676427537U, 3255491064U, 2882294119U, 3433927263U,
247 1307055953U, 942726286U, 933058658U, 2468411793U,
248 3933900994U, 4215176142U, 1361170020U, 2001714738U,
249 2830558078U, 3274259782U, 1222529897U, 1679025792U,
250 2729314320U, 3714953764U, 1770335741U, 151462246U,
251 3013232138U, 1682292957U, 1483529935U, 471910574U,
252 1539241949U, 458788160U, 3436315007U, 1807016891U,
253 3718408830U, 978976581U, 1043663428U, 3165965781U,
254 1927990952U, 4200891579U, 2372276910U, 3208408903U,
255 3533431907U, 1412390302U, 2931980059U, 4132332400U,
256 1947078029U, 3881505623U, 4168226417U, 2941484381U,
257 1077988104U, 1320477388U, 886195818U, 18198404U,
258 3786409000U, 2509781533U, 112762804U, 3463356488U,
259 1866414978U, 891333506U, 18488651U, 661792760U,
260 1628790961U, 3885187036U, 3141171499U, 876946877U,
261 2693282273U, 1372485963U, 791857591U, 2686433993U,
262 3759982718U, 3167212022U, 3472953795U, 2716379847U,
263 445679433U, 3561995674U, 3504004811U, 3574258232U,
264 54117162U, 3331405415U, 2381918588U, 3769707343U,
265 4154350007U, 1140177722U, 4074052095U, 668550556U,
266 3214352940U, 367459370U, 261225585U, 2610173221U,
267 4209349473U, 3468074219U, 3265815641U, 314222801U,
268 3066103646U, 3808782860U, 282218597U, 3406013506U,
269 3773591054U, 379116347U, 1285071038U, 846784868U,
270 2669647154U, 3771962079U, 3550491691U, 2305946142U,
271 453669953U, 1268987020U, 3317592352U, 3279303384U,
272 3744833421U, 2610507566U, 3859509063U, 266596637U,
273 3847019092U, 517658769U, 3462560207U, 3443424879U,
274 370717030U, 4247526661U, 2224018117U, 4143653529U,
275 4112773975U, 2788324899U, 2477274417U, 1456262402U,
276 2901442914U, 1517677493U, 1846949527U, 2295493580U,
277 3734397586U, 2176403920U, 1280348187U, 1908823572U,
278 3871786941U, 846861322U, 1172426758U, 3287448474U,
279 3383383037U, 1655181056U, 3139813346U, 901632758U,
280 1897031941U, 2986607138U, 3066810236U, 3447102507U,
281 1393639104U, 373351379U, 950779232U, 625454576U,
282 3124240540U, 4148612726U, 2007998917U, 544563296U,
283 2244738638U, 2330496472U, 2058025392U, 1291430526U,
284 424198748U, 50039436U, 29584100U, 3605783033U,
285 2429876329U, 2791104160U, 1057563949U, 3255363231U,
286 3075367218U, 3463963227U, 1469046755U, 985887462U
287};
288
289
290// this version is only used to make pbox and sbox
291static void crypt_block(BF_KEY *key, const word32 in[2], word32 out[2])
292{
293 word32 left = in[0];
294 word32 right = in[1];
295
296 const word32 *const s=key->sbox;
297 const word32 *p=key->pbox;
298
299 unsigned i;
300
301 left ^= p[0];
302
303 for (i=0; i<ROUNDS/2; i++)
304 {
305 right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
306 ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
307 ^ p[2*i+1];
308
309 left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
310 ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
311 ^ p[2*i+2];
312 }
313
314 right ^= p[ROUNDS+1];
315
316 out[0] = right;
317 out[1] = left;
318}
319
320
321void BlowfishSetKey (BF_KEY *key, int keylength, unsigned char *key_string)
322{
323 unsigned i, j=0, k;
324 word32 data, dspace[2] = {0, 0};
325 word32 *sbox = key->sbox;
326 word32 *pbox = key->pbox;
327
328 memcpy(pbox, p_init, sizeof(p_init));
329 memcpy(sbox, s_init, sizeof(s_init));
330
331 // Xor key string into encryption key vector
332 for (i=0 ; i<ROUNDS+2 ; ++i)
333 {
334 data = 0 ;
335 for (k=0 ; k<4 ; ++k )
336 data = (data << 8) | key_string[j++ % keylength];
337 pbox[i] ^= data;
338 }
339
340 crypt_block(key, dspace, pbox);
341
342 for (i=0; i<ROUNDS; i+=2)
343 crypt_block(key, pbox+i, pbox+i+2);
344
345 crypt_block(key, pbox+ROUNDS, sbox);
346
347 for (i=0; i<4*256-2; i+=2)
348 crypt_block(key, sbox+i, sbox+i+2);
349
350 for (i=0; i < ROUNDS+2; i++)
351 key->pbox_dec[ROUNDS+1-i] = pbox[i];
352}
353
354
355void BlowfishEncryptLE (unsigned char *inBlock, unsigned char *outBlock, BF_KEY *key, int encrypt)
356{
357 word32 left = LE32 (((word32 *) inBlock)[0]);
358 word32 right = LE32 (((word32 *) inBlock)[1]);
359
360 const word32 *const s = key->sbox;
361 const word32 * p = encrypt ? key->pbox : key->pbox_dec;
362
363 unsigned i;
364
365 left ^= p[0];
366
367 for (i=0; i<ROUNDS/2; i++)
368 {
369 right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
370 ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
371 ^ p[2*i+1];
372
373 left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
374 ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
375 ^ p[2*i+2];
376 }
377
378 right ^= p[ROUNDS+1];
379
380 ((word32 *) outBlock)[0] = LE32 (right);
381 ((word32 *) outBlock)[1] = LE32 (left);
382}
diff --git a/src/Crypto/Blowfish.h b/src/Crypto/Blowfish.h
deleted file mode 100644
index d9cf4bc5..00000000
--- a/src/Crypto/Blowfish.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* Deprecated/legacy */
2
3
4#ifndef TC_HEADER_Crypto_Blowfish
5#define TC_HEADER_Crypto_Blowfish
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef struct BF_KEY_STRUCT
12{
13 unsigned __int32 pbox[18];
14 unsigned __int32 pbox_dec[18];
15 unsigned __int32 sbox[4*256];
16} BF_KEY;
17
18void BlowfishSetKey (BF_KEY *key, int keylength, unsigned char *key_string);
19void BlowfishEncryptLE (unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt);
20
21#ifdef __cplusplus
22}
23#endif
24
25#endif // TC_HEADER_Crypto_Blowfish
diff --git a/src/Crypto/Cast.c b/src/Crypto/Cast.c
deleted file mode 100644
index 1edceaec..00000000
--- a/src/Crypto/Cast.c
+++ /dev/null
@@ -1,703 +0,0 @@
1/* Deprecated/legacy */
2
3
4// cast.cpp - written and placed in the public domain by Wei Dai and Leonard Janke
5// based on Steve Reid's public domain cast.c
6
7/* Adapted for TrueCrypt */
8
9#include <memory.h>
10#include "Common/Tcdefs.h"
11#include "Common/Endian.h"
12#include "Cast.h"
13
14#define word32 unsigned __int32
15#define byte unsigned __int8
16#define GETBYTE(x, y) (unsigned int)(byte)((x)>>(8*(y)))
17
18/* Macros to access 8-bit bytes out of a 32-bit word */
19#define U8a(x) GETBYTE(x,3)
20#define U8b(x) GETBYTE(x,2)
21#define U8c(x) GETBYTE(x,1)
22#define U8d(x) GETBYTE(x,0)
23
24static word32 rotlVariable (word32 x, unsigned int y)
25{
26 return (word32)((x<<y) | (x>>(sizeof(word32)*8-y)));
27}
28
29
30// CAST S-boxes
31
32static const word32 S[8][256] = {
33{
34 0x30FB40D4UL, 0x9FA0FF0BUL, 0x6BECCD2FUL, 0x3F258C7AUL,
35 0x1E213F2FUL, 0x9C004DD3UL, 0x6003E540UL, 0xCF9FC949UL,
36 0xBFD4AF27UL, 0x88BBBDB5UL, 0xE2034090UL, 0x98D09675UL,
37 0x6E63A0E0UL, 0x15C361D2UL, 0xC2E7661DUL, 0x22D4FF8EUL,
38 0x28683B6FUL, 0xC07FD059UL, 0xFF2379C8UL, 0x775F50E2UL,
39 0x43C340D3UL, 0xDF2F8656UL, 0x887CA41AUL, 0xA2D2BD2DUL,
40 0xA1C9E0D6UL, 0x346C4819UL, 0x61B76D87UL, 0x22540F2FUL,
41 0x2ABE32E1UL, 0xAA54166BUL, 0x22568E3AUL, 0xA2D341D0UL,
42 0x66DB40C8UL, 0xA784392FUL, 0x004DFF2FUL, 0x2DB9D2DEUL,
43 0x97943FACUL, 0x4A97C1D8UL, 0x527644B7UL, 0xB5F437A7UL,
44 0xB82CBAEFUL, 0xD751D159UL, 0x6FF7F0EDUL, 0x5A097A1FUL,
45 0x827B68D0UL, 0x90ECF52EUL, 0x22B0C054UL, 0xBC8E5935UL,
46 0x4B6D2F7FUL, 0x50BB64A2UL, 0xD2664910UL, 0xBEE5812DUL,
47 0xB7332290UL, 0xE93B159FUL, 0xB48EE411UL, 0x4BFF345DUL,
48 0xFD45C240UL, 0xAD31973FUL, 0xC4F6D02EUL, 0x55FC8165UL,
49 0xD5B1CAADUL, 0xA1AC2DAEUL, 0xA2D4B76DUL, 0xC19B0C50UL,
50 0x882240F2UL, 0x0C6E4F38UL, 0xA4E4BFD7UL, 0x4F5BA272UL,
51 0x564C1D2FUL, 0xC59C5319UL, 0xB949E354UL, 0xB04669FEUL,
52 0xB1B6AB8AUL, 0xC71358DDUL, 0x6385C545UL, 0x110F935DUL,
53 0x57538AD5UL, 0x6A390493UL, 0xE63D37E0UL, 0x2A54F6B3UL,
54 0x3A787D5FUL, 0x6276A0B5UL, 0x19A6FCDFUL, 0x7A42206AUL,
55 0x29F9D4D5UL, 0xF61B1891UL, 0xBB72275EUL, 0xAA508167UL,
56 0x38901091UL, 0xC6B505EBUL, 0x84C7CB8CUL, 0x2AD75A0FUL,
57 0x874A1427UL, 0xA2D1936BUL, 0x2AD286AFUL, 0xAA56D291UL,
58 0xD7894360UL, 0x425C750DUL, 0x93B39E26UL, 0x187184C9UL,
59 0x6C00B32DUL, 0x73E2BB14UL, 0xA0BEBC3CUL, 0x54623779UL,
60 0x64459EABUL, 0x3F328B82UL, 0x7718CF82UL, 0x59A2CEA6UL,
61 0x04EE002EUL, 0x89FE78E6UL, 0x3FAB0950UL, 0x325FF6C2UL,
62 0x81383F05UL, 0x6963C5C8UL, 0x76CB5AD6UL, 0xD49974C9UL,
63 0xCA180DCFUL, 0x380782D5UL, 0xC7FA5CF6UL, 0x8AC31511UL,
64 0x35E79E13UL, 0x47DA91D0UL, 0xF40F9086UL, 0xA7E2419EUL,
65 0x31366241UL, 0x051EF495UL, 0xAA573B04UL, 0x4A805D8DUL,
66 0x548300D0UL, 0x00322A3CUL, 0xBF64CDDFUL, 0xBA57A68EUL,
67 0x75C6372BUL, 0x50AFD341UL, 0xA7C13275UL, 0x915A0BF5UL,
68 0x6B54BFABUL, 0x2B0B1426UL, 0xAB4CC9D7UL, 0x449CCD82UL,
69 0xF7FBF265UL, 0xAB85C5F3UL, 0x1B55DB94UL, 0xAAD4E324UL,
70 0xCFA4BD3FUL, 0x2DEAA3E2UL, 0x9E204D02UL, 0xC8BD25ACUL,
71 0xEADF55B3UL, 0xD5BD9E98UL, 0xE31231B2UL, 0x2AD5AD6CUL,
72 0x954329DEUL, 0xADBE4528UL, 0xD8710F69UL, 0xAA51C90FUL,
73 0xAA786BF6UL, 0x22513F1EUL, 0xAA51A79BUL, 0x2AD344CCUL,
74 0x7B5A41F0UL, 0xD37CFBADUL, 0x1B069505UL, 0x41ECE491UL,
75 0xB4C332E6UL, 0x032268D4UL, 0xC9600ACCUL, 0xCE387E6DUL,
76 0xBF6BB16CUL, 0x6A70FB78UL, 0x0D03D9C9UL, 0xD4DF39DEUL,
77 0xE01063DAUL, 0x4736F464UL, 0x5AD328D8UL, 0xB347CC96UL,
78 0x75BB0FC3UL, 0x98511BFBUL, 0x4FFBCC35UL, 0xB58BCF6AUL,
79 0xE11F0ABCUL, 0xBFC5FE4AUL, 0xA70AEC10UL, 0xAC39570AUL,
80 0x3F04442FUL, 0x6188B153UL, 0xE0397A2EUL, 0x5727CB79UL,
81 0x9CEB418FUL, 0x1CACD68DUL, 0x2AD37C96UL, 0x0175CB9DUL,
82 0xC69DFF09UL, 0xC75B65F0UL, 0xD9DB40D8UL, 0xEC0E7779UL,
83 0x4744EAD4UL, 0xB11C3274UL, 0xDD24CB9EUL, 0x7E1C54BDUL,
84 0xF01144F9UL, 0xD2240EB1UL, 0x9675B3FDUL, 0xA3AC3755UL,
85 0xD47C27AFUL, 0x51C85F4DUL, 0x56907596UL, 0xA5BB15E6UL,
86 0x580304F0UL, 0xCA042CF1UL, 0x011A37EAUL, 0x8DBFAADBUL,
87 0x35BA3E4AUL, 0x3526FFA0UL, 0xC37B4D09UL, 0xBC306ED9UL,
88 0x98A52666UL, 0x5648F725UL, 0xFF5E569DUL, 0x0CED63D0UL,
89 0x7C63B2CFUL, 0x700B45E1UL, 0xD5EA50F1UL, 0x85A92872UL,
90 0xAF1FBDA7UL, 0xD4234870UL, 0xA7870BF3UL, 0x2D3B4D79UL,
91 0x42E04198UL, 0x0CD0EDE7UL, 0x26470DB8UL, 0xF881814CUL,
92 0x474D6AD7UL, 0x7C0C5E5CUL, 0xD1231959UL, 0x381B7298UL,
93 0xF5D2F4DBUL, 0xAB838653UL, 0x6E2F1E23UL, 0x83719C9EUL,
94 0xBD91E046UL, 0x9A56456EUL, 0xDC39200CUL, 0x20C8C571UL,
95 0x962BDA1CUL, 0xE1E696FFUL, 0xB141AB08UL, 0x7CCA89B9UL,
96 0x1A69E783UL, 0x02CC4843UL, 0xA2F7C579UL, 0x429EF47DUL,
97 0x427B169CUL, 0x5AC9F049UL, 0xDD8F0F00UL, 0x5C8165BFUL
98},
99
100{
101 0x1F201094UL, 0xEF0BA75BUL, 0x69E3CF7EUL, 0x393F4380UL,
102 0xFE61CF7AUL, 0xEEC5207AUL, 0x55889C94UL, 0x72FC0651UL,
103 0xADA7EF79UL, 0x4E1D7235UL, 0xD55A63CEUL, 0xDE0436BAUL,
104 0x99C430EFUL, 0x5F0C0794UL, 0x18DCDB7DUL, 0xA1D6EFF3UL,
105 0xA0B52F7BUL, 0x59E83605UL, 0xEE15B094UL, 0xE9FFD909UL,
106 0xDC440086UL, 0xEF944459UL, 0xBA83CCB3UL, 0xE0C3CDFBUL,
107 0xD1DA4181UL, 0x3B092AB1UL, 0xF997F1C1UL, 0xA5E6CF7BUL,
108 0x01420DDBUL, 0xE4E7EF5BUL, 0x25A1FF41UL, 0xE180F806UL,
109 0x1FC41080UL, 0x179BEE7AUL, 0xD37AC6A9UL, 0xFE5830A4UL,
110 0x98DE8B7FUL, 0x77E83F4EUL, 0x79929269UL, 0x24FA9F7BUL,
111 0xE113C85BUL, 0xACC40083UL, 0xD7503525UL, 0xF7EA615FUL,
112 0x62143154UL, 0x0D554B63UL, 0x5D681121UL, 0xC866C359UL,
113 0x3D63CF73UL, 0xCEE234C0UL, 0xD4D87E87UL, 0x5C672B21UL,
114 0x071F6181UL, 0x39F7627FUL, 0x361E3084UL, 0xE4EB573BUL,
115 0x602F64A4UL, 0xD63ACD9CUL, 0x1BBC4635UL, 0x9E81032DUL,
116 0x2701F50CUL, 0x99847AB4UL, 0xA0E3DF79UL, 0xBA6CF38CUL,
117 0x10843094UL, 0x2537A95EUL, 0xF46F6FFEUL, 0xA1FF3B1FUL,
118 0x208CFB6AUL, 0x8F458C74UL, 0xD9E0A227UL, 0x4EC73A34UL,
119 0xFC884F69UL, 0x3E4DE8DFUL, 0xEF0E0088UL, 0x3559648DUL,
120 0x8A45388CUL, 0x1D804366UL, 0x721D9BFDUL, 0xA58684BBUL,
121 0xE8256333UL, 0x844E8212UL, 0x128D8098UL, 0xFED33FB4UL,
122 0xCE280AE1UL, 0x27E19BA5UL, 0xD5A6C252UL, 0xE49754BDUL,
123 0xC5D655DDUL, 0xEB667064UL, 0x77840B4DUL, 0xA1B6A801UL,
124 0x84DB26A9UL, 0xE0B56714UL, 0x21F043B7UL, 0xE5D05860UL,
125 0x54F03084UL, 0x066FF472UL, 0xA31AA153UL, 0xDADC4755UL,
126 0xB5625DBFUL, 0x68561BE6UL, 0x83CA6B94UL, 0x2D6ED23BUL,
127 0xECCF01DBUL, 0xA6D3D0BAUL, 0xB6803D5CUL, 0xAF77A709UL,
128 0x33B4A34CUL, 0x397BC8D6UL, 0x5EE22B95UL, 0x5F0E5304UL,
129 0x81ED6F61UL, 0x20E74364UL, 0xB45E1378UL, 0xDE18639BUL,
130 0x881CA122UL, 0xB96726D1UL, 0x8049A7E8UL, 0x22B7DA7BUL,
131 0x5E552D25UL, 0x5272D237UL, 0x79D2951CUL, 0xC60D894CUL,
132 0x488CB402UL, 0x1BA4FE5BUL, 0xA4B09F6BUL, 0x1CA815CFUL,
133 0xA20C3005UL, 0x8871DF63UL, 0xB9DE2FCBUL, 0x0CC6C9E9UL,
134 0x0BEEFF53UL, 0xE3214517UL, 0xB4542835UL, 0x9F63293CUL,
135 0xEE41E729UL, 0x6E1D2D7CUL, 0x50045286UL, 0x1E6685F3UL,
136 0xF33401C6UL, 0x30A22C95UL, 0x31A70850UL, 0x60930F13UL,
137 0x73F98417UL, 0xA1269859UL, 0xEC645C44UL, 0x52C877A9UL,
138 0xCDFF33A6UL, 0xA02B1741UL, 0x7CBAD9A2UL, 0x2180036FUL,
139 0x50D99C08UL, 0xCB3F4861UL, 0xC26BD765UL, 0x64A3F6ABUL,
140 0x80342676UL, 0x25A75E7BUL, 0xE4E6D1FCUL, 0x20C710E6UL,
141 0xCDF0B680UL, 0x17844D3BUL, 0x31EEF84DUL, 0x7E0824E4UL,
142 0x2CCB49EBUL, 0x846A3BAEUL, 0x8FF77888UL, 0xEE5D60F6UL,
143 0x7AF75673UL, 0x2FDD5CDBUL, 0xA11631C1UL, 0x30F66F43UL,
144 0xB3FAEC54UL, 0x157FD7FAUL, 0xEF8579CCUL, 0xD152DE58UL,
145 0xDB2FFD5EUL, 0x8F32CE19UL, 0x306AF97AUL, 0x02F03EF8UL,
146 0x99319AD5UL, 0xC242FA0FUL, 0xA7E3EBB0UL, 0xC68E4906UL,
147 0xB8DA230CUL, 0x80823028UL, 0xDCDEF3C8UL, 0xD35FB171UL,
148 0x088A1BC8UL, 0xBEC0C560UL, 0x61A3C9E8UL, 0xBCA8F54DUL,
149 0xC72FEFFAUL, 0x22822E99UL, 0x82C570B4UL, 0xD8D94E89UL,
150 0x8B1C34BCUL, 0x301E16E6UL, 0x273BE979UL, 0xB0FFEAA6UL,
151 0x61D9B8C6UL, 0x00B24869UL, 0xB7FFCE3FUL, 0x08DC283BUL,
152 0x43DAF65AUL, 0xF7E19798UL, 0x7619B72FUL, 0x8F1C9BA4UL,
153 0xDC8637A0UL, 0x16A7D3B1UL, 0x9FC393B7UL, 0xA7136EEBUL,
154 0xC6BCC63EUL, 0x1A513742UL, 0xEF6828BCUL, 0x520365D6UL,
155 0x2D6A77ABUL, 0x3527ED4BUL, 0x821FD216UL, 0x095C6E2EUL,
156 0xDB92F2FBUL, 0x5EEA29CBUL, 0x145892F5UL, 0x91584F7FUL,
157 0x5483697BUL, 0x2667A8CCUL, 0x85196048UL, 0x8C4BACEAUL,
158 0x833860D4UL, 0x0D23E0F9UL, 0x6C387E8AUL, 0x0AE6D249UL,
159 0xB284600CUL, 0xD835731DUL, 0xDCB1C647UL, 0xAC4C56EAUL,
160 0x3EBD81B3UL, 0x230EABB0UL, 0x6438BC87UL, 0xF0B5B1FAUL,
161 0x8F5EA2B3UL, 0xFC184642UL, 0x0A036B7AUL, 0x4FB089BDUL,
162 0x649DA589UL, 0xA345415EUL, 0x5C038323UL, 0x3E5D3BB9UL,
163 0x43D79572UL, 0x7E6DD07CUL, 0x06DFDF1EUL, 0x6C6CC4EFUL,
164 0x7160A539UL, 0x73BFBE70UL, 0x83877605UL, 0x4523ECF1UL
165},
166
167{
168 0x8DEFC240UL, 0x25FA5D9FUL, 0xEB903DBFUL, 0xE810C907UL,
169 0x47607FFFUL, 0x369FE44BUL, 0x8C1FC644UL, 0xAECECA90UL,
170 0xBEB1F9BFUL, 0xEEFBCAEAUL, 0xE8CF1950UL, 0x51DF07AEUL,
171 0x920E8806UL, 0xF0AD0548UL, 0xE13C8D83UL, 0x927010D5UL,
172 0x11107D9FUL, 0x07647DB9UL, 0xB2E3E4D4UL, 0x3D4F285EUL,
173 0xB9AFA820UL, 0xFADE82E0UL, 0xA067268BUL, 0x8272792EUL,
174 0x553FB2C0UL, 0x489AE22BUL, 0xD4EF9794UL, 0x125E3FBCUL,
175 0x21FFFCEEUL, 0x825B1BFDUL, 0x9255C5EDUL, 0x1257A240UL,
176 0x4E1A8302UL, 0xBAE07FFFUL, 0x528246E7UL, 0x8E57140EUL,
177 0x3373F7BFUL, 0x8C9F8188UL, 0xA6FC4EE8UL, 0xC982B5A5UL,
178 0xA8C01DB7UL, 0x579FC264UL, 0x67094F31UL, 0xF2BD3F5FUL,
179 0x40FFF7C1UL, 0x1FB78DFCUL, 0x8E6BD2C1UL, 0x437BE59BUL,
180 0x99B03DBFUL, 0xB5DBC64BUL, 0x638DC0E6UL, 0x55819D99UL,
181 0xA197C81CUL, 0x4A012D6EUL, 0xC5884A28UL, 0xCCC36F71UL,
182 0xB843C213UL, 0x6C0743F1UL, 0x8309893CUL, 0x0FEDDD5FUL,
183 0x2F7FE850UL, 0xD7C07F7EUL, 0x02507FBFUL, 0x5AFB9A04UL,
184 0xA747D2D0UL, 0x1651192EUL, 0xAF70BF3EUL, 0x58C31380UL,
185 0x5F98302EUL, 0x727CC3C4UL, 0x0A0FB402UL, 0x0F7FEF82UL,
186 0x8C96FDADUL, 0x5D2C2AAEUL, 0x8EE99A49UL, 0x50DA88B8UL,
187 0x8427F4A0UL, 0x1EAC5790UL, 0x796FB449UL, 0x8252DC15UL,
188 0xEFBD7D9BUL, 0xA672597DUL, 0xADA840D8UL, 0x45F54504UL,
189 0xFA5D7403UL, 0xE83EC305UL, 0x4F91751AUL, 0x925669C2UL,
190 0x23EFE941UL, 0xA903F12EUL, 0x60270DF2UL, 0x0276E4B6UL,
191 0x94FD6574UL, 0x927985B2UL, 0x8276DBCBUL, 0x02778176UL,
192 0xF8AF918DUL, 0x4E48F79EUL, 0x8F616DDFUL, 0xE29D840EUL,
193 0x842F7D83UL, 0x340CE5C8UL, 0x96BBB682UL, 0x93B4B148UL,
194 0xEF303CABUL, 0x984FAF28UL, 0x779FAF9BUL, 0x92DC560DUL,
195 0x224D1E20UL, 0x8437AA88UL, 0x7D29DC96UL, 0x2756D3DCUL,
196 0x8B907CEEUL, 0xB51FD240UL, 0xE7C07CE3UL, 0xE566B4A1UL,
197 0xC3E9615EUL, 0x3CF8209DUL, 0x6094D1E3UL, 0xCD9CA341UL,
198 0x5C76460EUL, 0x00EA983BUL, 0xD4D67881UL, 0xFD47572CUL,
199 0xF76CEDD9UL, 0xBDA8229CUL, 0x127DADAAUL, 0x438A074EUL,
200 0x1F97C090UL, 0x081BDB8AUL, 0x93A07EBEUL, 0xB938CA15UL,
201 0x97B03CFFUL, 0x3DC2C0F8UL, 0x8D1AB2ECUL, 0x64380E51UL,
202 0x68CC7BFBUL, 0xD90F2788UL, 0x12490181UL, 0x5DE5FFD4UL,
203 0xDD7EF86AUL, 0x76A2E214UL, 0xB9A40368UL, 0x925D958FUL,
204 0x4B39FFFAUL, 0xBA39AEE9UL, 0xA4FFD30BUL, 0xFAF7933BUL,
205 0x6D498623UL, 0x193CBCFAUL, 0x27627545UL, 0x825CF47AUL,
206 0x61BD8BA0UL, 0xD11E42D1UL, 0xCEAD04F4UL, 0x127EA392UL,
207 0x10428DB7UL, 0x8272A972UL, 0x9270C4A8UL, 0x127DE50BUL,
208 0x285BA1C8UL, 0x3C62F44FUL, 0x35C0EAA5UL, 0xE805D231UL,
209 0x428929FBUL, 0xB4FCDF82UL, 0x4FB66A53UL, 0x0E7DC15BUL,
210 0x1F081FABUL, 0x108618AEUL, 0xFCFD086DUL, 0xF9FF2889UL,
211 0x694BCC11UL, 0x236A5CAEUL, 0x12DECA4DUL, 0x2C3F8CC5UL,
212 0xD2D02DFEUL, 0xF8EF5896UL, 0xE4CF52DAUL, 0x95155B67UL,
213 0x494A488CUL, 0xB9B6A80CUL, 0x5C8F82BCUL, 0x89D36B45UL,
214 0x3A609437UL, 0xEC00C9A9UL, 0x44715253UL, 0x0A874B49UL,
215 0xD773BC40UL, 0x7C34671CUL, 0x02717EF6UL, 0x4FEB5536UL,
216 0xA2D02FFFUL, 0xD2BF60C4UL, 0xD43F03C0UL, 0x50B4EF6DUL,
217 0x07478CD1UL, 0x006E1888UL, 0xA2E53F55UL, 0xB9E6D4BCUL,
218 0xA2048016UL, 0x97573833UL, 0xD7207D67UL, 0xDE0F8F3DUL,
219 0x72F87B33UL, 0xABCC4F33UL, 0x7688C55DUL, 0x7B00A6B0UL,
220 0x947B0001UL, 0x570075D2UL, 0xF9BB88F8UL, 0x8942019EUL,
221 0x4264A5FFUL, 0x856302E0UL, 0x72DBD92BUL, 0xEE971B69UL,
222 0x6EA22FDEUL, 0x5F08AE2BUL, 0xAF7A616DUL, 0xE5C98767UL,
223 0xCF1FEBD2UL, 0x61EFC8C2UL, 0xF1AC2571UL, 0xCC8239C2UL,
224 0x67214CB8UL, 0xB1E583D1UL, 0xB7DC3E62UL, 0x7F10BDCEUL,
225 0xF90A5C38UL, 0x0FF0443DUL, 0x606E6DC6UL, 0x60543A49UL,
226 0x5727C148UL, 0x2BE98A1DUL, 0x8AB41738UL, 0x20E1BE24UL,
227 0xAF96DA0FUL, 0x68458425UL, 0x99833BE5UL, 0x600D457DUL,
228 0x282F9350UL, 0x8334B362UL, 0xD91D1120UL, 0x2B6D8DA0UL,
229 0x642B1E31UL, 0x9C305A00UL, 0x52BCE688UL, 0x1B03588AUL,
230 0xF7BAEFD5UL, 0x4142ED9CUL, 0xA4315C11UL, 0x83323EC5UL,
231 0xDFEF4636UL, 0xA133C501UL, 0xE9D3531CUL, 0xEE353783UL
232},
233
234{
235 0x9DB30420UL, 0x1FB6E9DEUL, 0xA7BE7BEFUL, 0xD273A298UL,
236 0x4A4F7BDBUL, 0x64AD8C57UL, 0x85510443UL, 0xFA020ED1UL,
237 0x7E287AFFUL, 0xE60FB663UL, 0x095F35A1UL, 0x79EBF120UL,
238 0xFD059D43UL, 0x6497B7B1UL, 0xF3641F63UL, 0x241E4ADFUL,
239 0x28147F5FUL, 0x4FA2B8CDUL, 0xC9430040UL, 0x0CC32220UL,
240 0xFDD30B30UL, 0xC0A5374FUL, 0x1D2D00D9UL, 0x24147B15UL,
241 0xEE4D111AUL, 0x0FCA5167UL, 0x71FF904CUL, 0x2D195FFEUL,
242 0x1A05645FUL, 0x0C13FEFEUL, 0x081B08CAUL, 0x05170121UL,
243 0x80530100UL, 0xE83E5EFEUL, 0xAC9AF4F8UL, 0x7FE72701UL,
244 0xD2B8EE5FUL, 0x06DF4261UL, 0xBB9E9B8AUL, 0x7293EA25UL,
245 0xCE84FFDFUL, 0xF5718801UL, 0x3DD64B04UL, 0xA26F263BUL,
246 0x7ED48400UL, 0x547EEBE6UL, 0x446D4CA0UL, 0x6CF3D6F5UL,
247 0x2649ABDFUL, 0xAEA0C7F5UL, 0x36338CC1UL, 0x503F7E93UL,
248 0xD3772061UL, 0x11B638E1UL, 0x72500E03UL, 0xF80EB2BBUL,
249 0xABE0502EUL, 0xEC8D77DEUL, 0x57971E81UL, 0xE14F6746UL,
250 0xC9335400UL, 0x6920318FUL, 0x081DBB99UL, 0xFFC304A5UL,
251 0x4D351805UL, 0x7F3D5CE3UL, 0xA6C866C6UL, 0x5D5BCCA9UL,
252 0xDAEC6FEAUL, 0x9F926F91UL, 0x9F46222FUL, 0x3991467DUL,
253 0xA5BF6D8EUL, 0x1143C44FUL, 0x43958302UL, 0xD0214EEBUL,
254 0x022083B8UL, 0x3FB6180CUL, 0x18F8931EUL, 0x281658E6UL,
255 0x26486E3EUL, 0x8BD78A70UL, 0x7477E4C1UL, 0xB506E07CUL,
256 0xF32D0A25UL, 0x79098B02UL, 0xE4EABB81UL, 0x28123B23UL,
257 0x69DEAD38UL, 0x1574CA16UL, 0xDF871B62UL, 0x211C40B7UL,
258 0xA51A9EF9UL, 0x0014377BUL, 0x041E8AC8UL, 0x09114003UL,
259 0xBD59E4D2UL, 0xE3D156D5UL, 0x4FE876D5UL, 0x2F91A340UL,
260 0x557BE8DEUL, 0x00EAE4A7UL, 0x0CE5C2ECUL, 0x4DB4BBA6UL,
261 0xE756BDFFUL, 0xDD3369ACUL, 0xEC17B035UL, 0x06572327UL,
262 0x99AFC8B0UL, 0x56C8C391UL, 0x6B65811CUL, 0x5E146119UL,
263 0x6E85CB75UL, 0xBE07C002UL, 0xC2325577UL, 0x893FF4ECUL,
264 0x5BBFC92DUL, 0xD0EC3B25UL, 0xB7801AB7UL, 0x8D6D3B24UL,
265 0x20C763EFUL, 0xC366A5FCUL, 0x9C382880UL, 0x0ACE3205UL,
266 0xAAC9548AUL, 0xECA1D7C7UL, 0x041AFA32UL, 0x1D16625AUL,
267 0x6701902CUL, 0x9B757A54UL, 0x31D477F7UL, 0x9126B031UL,
268 0x36CC6FDBUL, 0xC70B8B46UL, 0xD9E66A48UL, 0x56E55A79UL,
269 0x026A4CEBUL, 0x52437EFFUL, 0x2F8F76B4UL, 0x0DF980A5UL,
270 0x8674CDE3UL, 0xEDDA04EBUL, 0x17A9BE04UL, 0x2C18F4DFUL,
271 0xB7747F9DUL, 0xAB2AF7B4UL, 0xEFC34D20UL, 0x2E096B7CUL,
272 0x1741A254UL, 0xE5B6A035UL, 0x213D42F6UL, 0x2C1C7C26UL,
273 0x61C2F50FUL, 0x6552DAF9UL, 0xD2C231F8UL, 0x25130F69UL,
274 0xD8167FA2UL, 0x0418F2C8UL, 0x001A96A6UL, 0x0D1526ABUL,
275 0x63315C21UL, 0x5E0A72ECUL, 0x49BAFEFDUL, 0x187908D9UL,
276 0x8D0DBD86UL, 0x311170A7UL, 0x3E9B640CUL, 0xCC3E10D7UL,
277 0xD5CAD3B6UL, 0x0CAEC388UL, 0xF73001E1UL, 0x6C728AFFUL,
278 0x71EAE2A1UL, 0x1F9AF36EUL, 0xCFCBD12FUL, 0xC1DE8417UL,
279 0xAC07BE6BUL, 0xCB44A1D8UL, 0x8B9B0F56UL, 0x013988C3UL,
280 0xB1C52FCAUL, 0xB4BE31CDUL, 0xD8782806UL, 0x12A3A4E2UL,
281 0x6F7DE532UL, 0x58FD7EB6UL, 0xD01EE900UL, 0x24ADFFC2UL,
282 0xF4990FC5UL, 0x9711AAC5UL, 0x001D7B95UL, 0x82E5E7D2UL,
283 0x109873F6UL, 0x00613096UL, 0xC32D9521UL, 0xADA121FFUL,
284 0x29908415UL, 0x7FBB977FUL, 0xAF9EB3DBUL, 0x29C9ED2AUL,
285 0x5CE2A465UL, 0xA730F32CUL, 0xD0AA3FE8UL, 0x8A5CC091UL,
286 0xD49E2CE7UL, 0x0CE454A9UL, 0xD60ACD86UL, 0x015F1919UL,
287 0x77079103UL, 0xDEA03AF6UL, 0x78A8565EUL, 0xDEE356DFUL,
288 0x21F05CBEUL, 0x8B75E387UL, 0xB3C50651UL, 0xB8A5C3EFUL,
289 0xD8EEB6D2UL, 0xE523BE77UL, 0xC2154529UL, 0x2F69EFDFUL,
290 0xAFE67AFBUL, 0xF470C4B2UL, 0xF3E0EB5BUL, 0xD6CC9876UL,
291 0x39E4460CUL, 0x1FDA8538UL, 0x1987832FUL, 0xCA007367UL,
292 0xA99144F8UL, 0x296B299EUL, 0x492FC295UL, 0x9266BEABUL,
293 0xB5676E69UL, 0x9BD3DDDAUL, 0xDF7E052FUL, 0xDB25701CUL,
294 0x1B5E51EEUL, 0xF65324E6UL, 0x6AFCE36CUL, 0x0316CC04UL,
295 0x8644213EUL, 0xB7DC59D0UL, 0x7965291FUL, 0xCCD6FD43UL,
296 0x41823979UL, 0x932BCDF6UL, 0xB657C34DUL, 0x4EDFD282UL,
297 0x7AE5290CUL, 0x3CB9536BUL, 0x851E20FEUL, 0x9833557EUL,
298 0x13ECF0B0UL, 0xD3FFB372UL, 0x3F85C5C1UL, 0x0AEF7ED2UL
299},
300
301{
302 0x7EC90C04UL, 0x2C6E74B9UL, 0x9B0E66DFUL, 0xA6337911UL,
303 0xB86A7FFFUL, 0x1DD358F5UL, 0x44DD9D44UL, 0x1731167FUL,
304 0x08FBF1FAUL, 0xE7F511CCUL, 0xD2051B00UL, 0x735ABA00UL,
305 0x2AB722D8UL, 0x386381CBUL, 0xACF6243AUL, 0x69BEFD7AUL,
306 0xE6A2E77FUL, 0xF0C720CDUL, 0xC4494816UL, 0xCCF5C180UL,
307 0x38851640UL, 0x15B0A848UL, 0xE68B18CBUL, 0x4CAADEFFUL,
308 0x5F480A01UL, 0x0412B2AAUL, 0x259814FCUL, 0x41D0EFE2UL,
309 0x4E40B48DUL, 0x248EB6FBUL, 0x8DBA1CFEUL, 0x41A99B02UL,
310 0x1A550A04UL, 0xBA8F65CBUL, 0x7251F4E7UL, 0x95A51725UL,
311 0xC106ECD7UL, 0x97A5980AUL, 0xC539B9AAUL, 0x4D79FE6AUL,
312 0xF2F3F763UL, 0x68AF8040UL, 0xED0C9E56UL, 0x11B4958BUL,
313 0xE1EB5A88UL, 0x8709E6B0UL, 0xD7E07156UL, 0x4E29FEA7UL,
314 0x6366E52DUL, 0x02D1C000UL, 0xC4AC8E05UL, 0x9377F571UL,
315 0x0C05372AUL, 0x578535F2UL, 0x2261BE02UL, 0xD642A0C9UL,
316 0xDF13A280UL, 0x74B55BD2UL, 0x682199C0UL, 0xD421E5ECUL,
317 0x53FB3CE8UL, 0xC8ADEDB3UL, 0x28A87FC9UL, 0x3D959981UL,
318 0x5C1FF900UL, 0xFE38D399UL, 0x0C4EFF0BUL, 0x062407EAUL,
319 0xAA2F4FB1UL, 0x4FB96976UL, 0x90C79505UL, 0xB0A8A774UL,
320 0xEF55A1FFUL, 0xE59CA2C2UL, 0xA6B62D27UL, 0xE66A4263UL,
321 0xDF65001FUL, 0x0EC50966UL, 0xDFDD55BCUL, 0x29DE0655UL,
322 0x911E739AUL, 0x17AF8975UL, 0x32C7911CUL, 0x89F89468UL,
323 0x0D01E980UL, 0x524755F4UL, 0x03B63CC9UL, 0x0CC844B2UL,
324 0xBCF3F0AAUL, 0x87AC36E9UL, 0xE53A7426UL, 0x01B3D82BUL,
325 0x1A9E7449UL, 0x64EE2D7EUL, 0xCDDBB1DAUL, 0x01C94910UL,
326 0xB868BF80UL, 0x0D26F3FDUL, 0x9342EDE7UL, 0x04A5C284UL,
327 0x636737B6UL, 0x50F5B616UL, 0xF24766E3UL, 0x8ECA36C1UL,
328 0x136E05DBUL, 0xFEF18391UL, 0xFB887A37UL, 0xD6E7F7D4UL,
329 0xC7FB7DC9UL, 0x3063FCDFUL, 0xB6F589DEUL, 0xEC2941DAUL,
330 0x26E46695UL, 0xB7566419UL, 0xF654EFC5UL, 0xD08D58B7UL,
331 0x48925401UL, 0xC1BACB7FUL, 0xE5FF550FUL, 0xB6083049UL,
332 0x5BB5D0E8UL, 0x87D72E5AUL, 0xAB6A6EE1UL, 0x223A66CEUL,
333 0xC62BF3CDUL, 0x9E0885F9UL, 0x68CB3E47UL, 0x086C010FUL,
334 0xA21DE820UL, 0xD18B69DEUL, 0xF3F65777UL, 0xFA02C3F6UL,
335 0x407EDAC3UL, 0xCBB3D550UL, 0x1793084DUL, 0xB0D70EBAUL,
336 0x0AB378D5UL, 0xD951FB0CUL, 0xDED7DA56UL, 0x4124BBE4UL,
337 0x94CA0B56UL, 0x0F5755D1UL, 0xE0E1E56EUL, 0x6184B5BEUL,
338 0x580A249FUL, 0x94F74BC0UL, 0xE327888EUL, 0x9F7B5561UL,
339 0xC3DC0280UL, 0x05687715UL, 0x646C6BD7UL, 0x44904DB3UL,
340 0x66B4F0A3UL, 0xC0F1648AUL, 0x697ED5AFUL, 0x49E92FF6UL,
341 0x309E374FUL, 0x2CB6356AUL, 0x85808573UL, 0x4991F840UL,
342 0x76F0AE02UL, 0x083BE84DUL, 0x28421C9AUL, 0x44489406UL,
343 0x736E4CB8UL, 0xC1092910UL, 0x8BC95FC6UL, 0x7D869CF4UL,
344 0x134F616FUL, 0x2E77118DUL, 0xB31B2BE1UL, 0xAA90B472UL,
345 0x3CA5D717UL, 0x7D161BBAUL, 0x9CAD9010UL, 0xAF462BA2UL,
346 0x9FE459D2UL, 0x45D34559UL, 0xD9F2DA13UL, 0xDBC65487UL,
347 0xF3E4F94EUL, 0x176D486FUL, 0x097C13EAUL, 0x631DA5C7UL,
348 0x445F7382UL, 0x175683F4UL, 0xCDC66A97UL, 0x70BE0288UL,
349 0xB3CDCF72UL, 0x6E5DD2F3UL, 0x20936079UL, 0x459B80A5UL,
350 0xBE60E2DBUL, 0xA9C23101UL, 0xEBA5315CUL, 0x224E42F2UL,
351 0x1C5C1572UL, 0xF6721B2CUL, 0x1AD2FFF3UL, 0x8C25404EUL,
352 0x324ED72FUL, 0x4067B7FDUL, 0x0523138EUL, 0x5CA3BC78UL,
353 0xDC0FD66EUL, 0x75922283UL, 0x784D6B17UL, 0x58EBB16EUL,
354 0x44094F85UL, 0x3F481D87UL, 0xFCFEAE7BUL, 0x77B5FF76UL,
355 0x8C2302BFUL, 0xAAF47556UL, 0x5F46B02AUL, 0x2B092801UL,
356 0x3D38F5F7UL, 0x0CA81F36UL, 0x52AF4A8AUL, 0x66D5E7C0UL,
357 0xDF3B0874UL, 0x95055110UL, 0x1B5AD7A8UL, 0xF61ED5ADUL,
358 0x6CF6E479UL, 0x20758184UL, 0xD0CEFA65UL, 0x88F7BE58UL,
359 0x4A046826UL, 0x0FF6F8F3UL, 0xA09C7F70UL, 0x5346ABA0UL,
360 0x5CE96C28UL, 0xE176EDA3UL, 0x6BAC307FUL, 0x376829D2UL,
361 0x85360FA9UL, 0x17E3FE2AUL, 0x24B79767UL, 0xF5A96B20UL,
362 0xD6CD2595UL, 0x68FF1EBFUL, 0x7555442CUL, 0xF19F06BEUL,
363 0xF9E0659AUL, 0xEEB9491DUL, 0x34010718UL, 0xBB30CAB8UL,
364 0xE822FE15UL, 0x88570983UL, 0x750E6249UL, 0xDA627E55UL,
365 0x5E76FFA8UL, 0xB1534546UL, 0x6D47DE08UL, 0xEFE9E7D4UL
366},
367
368{
369 0xF6FA8F9DUL, 0x2CAC6CE1UL, 0x4CA34867UL, 0xE2337F7CUL,
370 0x95DB08E7UL, 0x016843B4UL, 0xECED5CBCUL, 0x325553ACUL,
371 0xBF9F0960UL, 0xDFA1E2EDUL, 0x83F0579DUL, 0x63ED86B9UL,
372 0x1AB6A6B8UL, 0xDE5EBE39UL, 0xF38FF732UL, 0x8989B138UL,
373 0x33F14961UL, 0xC01937BDUL, 0xF506C6DAUL, 0xE4625E7EUL,
374 0xA308EA99UL, 0x4E23E33CUL, 0x79CBD7CCUL, 0x48A14367UL,
375 0xA3149619UL, 0xFEC94BD5UL, 0xA114174AUL, 0xEAA01866UL,
376 0xA084DB2DUL, 0x09A8486FUL, 0xA888614AUL, 0x2900AF98UL,
377 0x01665991UL, 0xE1992863UL, 0xC8F30C60UL, 0x2E78EF3CUL,
378 0xD0D51932UL, 0xCF0FEC14UL, 0xF7CA07D2UL, 0xD0A82072UL,
379 0xFD41197EUL, 0x9305A6B0UL, 0xE86BE3DAUL, 0x74BED3CDUL,
380 0x372DA53CUL, 0x4C7F4448UL, 0xDAB5D440UL, 0x6DBA0EC3UL,
381 0x083919A7UL, 0x9FBAEED9UL, 0x49DBCFB0UL, 0x4E670C53UL,
382 0x5C3D9C01UL, 0x64BDB941UL, 0x2C0E636AUL, 0xBA7DD9CDUL,
383 0xEA6F7388UL, 0xE70BC762UL, 0x35F29ADBUL, 0x5C4CDD8DUL,
384 0xF0D48D8CUL, 0xB88153E2UL, 0x08A19866UL, 0x1AE2EAC8UL,
385 0x284CAF89UL, 0xAA928223UL, 0x9334BE53UL, 0x3B3A21BFUL,
386 0x16434BE3UL, 0x9AEA3906UL, 0xEFE8C36EUL, 0xF890CDD9UL,
387 0x80226DAEUL, 0xC340A4A3UL, 0xDF7E9C09UL, 0xA694A807UL,
388 0x5B7C5ECCUL, 0x221DB3A6UL, 0x9A69A02FUL, 0x68818A54UL,
389 0xCEB2296FUL, 0x53C0843AUL, 0xFE893655UL, 0x25BFE68AUL,
390 0xB4628ABCUL, 0xCF222EBFUL, 0x25AC6F48UL, 0xA9A99387UL,
391 0x53BDDB65UL, 0xE76FFBE7UL, 0xE967FD78UL, 0x0BA93563UL,
392 0x8E342BC1UL, 0xE8A11BE9UL, 0x4980740DUL, 0xC8087DFCUL,
393 0x8DE4BF99UL, 0xA11101A0UL, 0x7FD37975UL, 0xDA5A26C0UL,
394 0xE81F994FUL, 0x9528CD89UL, 0xFD339FEDUL, 0xB87834BFUL,
395 0x5F04456DUL, 0x22258698UL, 0xC9C4C83BUL, 0x2DC156BEUL,
396 0x4F628DAAUL, 0x57F55EC5UL, 0xE2220ABEUL, 0xD2916EBFUL,
397 0x4EC75B95UL, 0x24F2C3C0UL, 0x42D15D99UL, 0xCD0D7FA0UL,
398 0x7B6E27FFUL, 0xA8DC8AF0UL, 0x7345C106UL, 0xF41E232FUL,
399 0x35162386UL, 0xE6EA8926UL, 0x3333B094UL, 0x157EC6F2UL,
400 0x372B74AFUL, 0x692573E4UL, 0xE9A9D848UL, 0xF3160289UL,
401 0x3A62EF1DUL, 0xA787E238UL, 0xF3A5F676UL, 0x74364853UL,
402 0x20951063UL, 0x4576698DUL, 0xB6FAD407UL, 0x592AF950UL,
403 0x36F73523UL, 0x4CFB6E87UL, 0x7DA4CEC0UL, 0x6C152DAAUL,
404 0xCB0396A8UL, 0xC50DFE5DUL, 0xFCD707ABUL, 0x0921C42FUL,
405 0x89DFF0BBUL, 0x5FE2BE78UL, 0x448F4F33UL, 0x754613C9UL,
406 0x2B05D08DUL, 0x48B9D585UL, 0xDC049441UL, 0xC8098F9BUL,
407 0x7DEDE786UL, 0xC39A3373UL, 0x42410005UL, 0x6A091751UL,
408 0x0EF3C8A6UL, 0x890072D6UL, 0x28207682UL, 0xA9A9F7BEUL,
409 0xBF32679DUL, 0xD45B5B75UL, 0xB353FD00UL, 0xCBB0E358UL,
410 0x830F220AUL, 0x1F8FB214UL, 0xD372CF08UL, 0xCC3C4A13UL,
411 0x8CF63166UL, 0x061C87BEUL, 0x88C98F88UL, 0x6062E397UL,
412 0x47CF8E7AUL, 0xB6C85283UL, 0x3CC2ACFBUL, 0x3FC06976UL,
413 0x4E8F0252UL, 0x64D8314DUL, 0xDA3870E3UL, 0x1E665459UL,
414 0xC10908F0UL, 0x513021A5UL, 0x6C5B68B7UL, 0x822F8AA0UL,
415 0x3007CD3EUL, 0x74719EEFUL, 0xDC872681UL, 0x073340D4UL,
416 0x7E432FD9UL, 0x0C5EC241UL, 0x8809286CUL, 0xF592D891UL,
417 0x08A930F6UL, 0x957EF305UL, 0xB7FBFFBDUL, 0xC266E96FUL,
418 0x6FE4AC98UL, 0xB173ECC0UL, 0xBC60B42AUL, 0x953498DAUL,
419 0xFBA1AE12UL, 0x2D4BD736UL, 0x0F25FAABUL, 0xA4F3FCEBUL,
420 0xE2969123UL, 0x257F0C3DUL, 0x9348AF49UL, 0x361400BCUL,
421 0xE8816F4AUL, 0x3814F200UL, 0xA3F94043UL, 0x9C7A54C2UL,
422 0xBC704F57UL, 0xDA41E7F9UL, 0xC25AD33AUL, 0x54F4A084UL,
423 0xB17F5505UL, 0x59357CBEUL, 0xEDBD15C8UL, 0x7F97C5ABUL,
424 0xBA5AC7B5UL, 0xB6F6DEAFUL, 0x3A479C3AUL, 0x5302DA25UL,
425 0x653D7E6AUL, 0x54268D49UL, 0x51A477EAUL, 0x5017D55BUL,
426 0xD7D25D88UL, 0x44136C76UL, 0x0404A8C8UL, 0xB8E5A121UL,
427 0xB81A928AUL, 0x60ED5869UL, 0x97C55B96UL, 0xEAEC991BUL,
428 0x29935913UL, 0x01FDB7F1UL, 0x088E8DFAUL, 0x9AB6F6F5UL,
429 0x3B4CBF9FUL, 0x4A5DE3ABUL, 0xE6051D35UL, 0xA0E1D855UL,
430 0xD36B4CF1UL, 0xF544EDEBUL, 0xB0E93524UL, 0xBEBB8FBDUL,
431 0xA2D762CFUL, 0x49C92F54UL, 0x38B5F331UL, 0x7128A454UL,
432 0x48392905UL, 0xA65B1DB8UL, 0x851C97BDUL, 0xD675CF2FUL
433},
434
435{
436 0x85E04019UL, 0x332BF567UL, 0x662DBFFFUL, 0xCFC65693UL,
437 0x2A8D7F6FUL, 0xAB9BC912UL, 0xDE6008A1UL, 0x2028DA1FUL,
438 0x0227BCE7UL, 0x4D642916UL, 0x18FAC300UL, 0x50F18B82UL,
439 0x2CB2CB11UL, 0xB232E75CUL, 0x4B3695F2UL, 0xB28707DEUL,
440 0xA05FBCF6UL, 0xCD4181E9UL, 0xE150210CUL, 0xE24EF1BDUL,
441 0xB168C381UL, 0xFDE4E789UL, 0x5C79B0D8UL, 0x1E8BFD43UL,
442 0x4D495001UL, 0x38BE4341UL, 0x913CEE1DUL, 0x92A79C3FUL,
443 0x089766BEUL, 0xBAEEADF4UL, 0x1286BECFUL, 0xB6EACB19UL,
444 0x2660C200UL, 0x7565BDE4UL, 0x64241F7AUL, 0x8248DCA9UL,
445 0xC3B3AD66UL, 0x28136086UL, 0x0BD8DFA8UL, 0x356D1CF2UL,
446 0x107789BEUL, 0xB3B2E9CEUL, 0x0502AA8FUL, 0x0BC0351EUL,
447 0x166BF52AUL, 0xEB12FF82UL, 0xE3486911UL, 0xD34D7516UL,
448 0x4E7B3AFFUL, 0x5F43671BUL, 0x9CF6E037UL, 0x4981AC83UL,
449 0x334266CEUL, 0x8C9341B7UL, 0xD0D854C0UL, 0xCB3A6C88UL,
450 0x47BC2829UL, 0x4725BA37UL, 0xA66AD22BUL, 0x7AD61F1EUL,
451 0x0C5CBAFAUL, 0x4437F107UL, 0xB6E79962UL, 0x42D2D816UL,
452 0x0A961288UL, 0xE1A5C06EUL, 0x13749E67UL, 0x72FC081AUL,
453 0xB1D139F7UL, 0xF9583745UL, 0xCF19DF58UL, 0xBEC3F756UL,
454 0xC06EBA30UL, 0x07211B24UL, 0x45C28829UL, 0xC95E317FUL,
455 0xBC8EC511UL, 0x38BC46E9UL, 0xC6E6FA14UL, 0xBAE8584AUL,
456 0xAD4EBC46UL, 0x468F508BUL, 0x7829435FUL, 0xF124183BUL,
457 0x821DBA9FUL, 0xAFF60FF4UL, 0xEA2C4E6DUL, 0x16E39264UL,
458 0x92544A8BUL, 0x009B4FC3UL, 0xABA68CEDUL, 0x9AC96F78UL,
459 0x06A5B79AUL, 0xB2856E6EUL, 0x1AEC3CA9UL, 0xBE838688UL,
460 0x0E0804E9UL, 0x55F1BE56UL, 0xE7E5363BUL, 0xB3A1F25DUL,
461 0xF7DEBB85UL, 0x61FE033CUL, 0x16746233UL, 0x3C034C28UL,
462 0xDA6D0C74UL, 0x79AAC56CUL, 0x3CE4E1ADUL, 0x51F0C802UL,
463 0x98F8F35AUL, 0x1626A49FUL, 0xEED82B29UL, 0x1D382FE3UL,
464 0x0C4FB99AUL, 0xBB325778UL, 0x3EC6D97BUL, 0x6E77A6A9UL,
465 0xCB658B5CUL, 0xD45230C7UL, 0x2BD1408BUL, 0x60C03EB7UL,
466 0xB9068D78UL, 0xA33754F4UL, 0xF430C87DUL, 0xC8A71302UL,
467 0xB96D8C32UL, 0xEBD4E7BEUL, 0xBE8B9D2DUL, 0x7979FB06UL,
468 0xE7225308UL, 0x8B75CF77UL, 0x11EF8DA4UL, 0xE083C858UL,
469 0x8D6B786FUL, 0x5A6317A6UL, 0xFA5CF7A0UL, 0x5DDA0033UL,
470 0xF28EBFB0UL, 0xF5B9C310UL, 0xA0EAC280UL, 0x08B9767AUL,
471 0xA3D9D2B0UL, 0x79D34217UL, 0x021A718DUL, 0x9AC6336AUL,
472 0x2711FD60UL, 0x438050E3UL, 0x069908A8UL, 0x3D7FEDC4UL,
473 0x826D2BEFUL, 0x4EEB8476UL, 0x488DCF25UL, 0x36C9D566UL,
474 0x28E74E41UL, 0xC2610ACAUL, 0x3D49A9CFUL, 0xBAE3B9DFUL,
475 0xB65F8DE6UL, 0x92AEAF64UL, 0x3AC7D5E6UL, 0x9EA80509UL,
476 0xF22B017DUL, 0xA4173F70UL, 0xDD1E16C3UL, 0x15E0D7F9UL,
477 0x50B1B887UL, 0x2B9F4FD5UL, 0x625ABA82UL, 0x6A017962UL,
478 0x2EC01B9CUL, 0x15488AA9UL, 0xD716E740UL, 0x40055A2CUL,
479 0x93D29A22UL, 0xE32DBF9AUL, 0x058745B9UL, 0x3453DC1EUL,
480 0xD699296EUL, 0x496CFF6FUL, 0x1C9F4986UL, 0xDFE2ED07UL,
481 0xB87242D1UL, 0x19DE7EAEUL, 0x053E561AUL, 0x15AD6F8CUL,
482 0x66626C1CUL, 0x7154C24CUL, 0xEA082B2AUL, 0x93EB2939UL,
483 0x17DCB0F0UL, 0x58D4F2AEUL, 0x9EA294FBUL, 0x52CF564CUL,
484 0x9883FE66UL, 0x2EC40581UL, 0x763953C3UL, 0x01D6692EUL,
485 0xD3A0C108UL, 0xA1E7160EUL, 0xE4F2DFA6UL, 0x693ED285UL,
486 0x74904698UL, 0x4C2B0EDDUL, 0x4F757656UL, 0x5D393378UL,
487 0xA132234FUL, 0x3D321C5DUL, 0xC3F5E194UL, 0x4B269301UL,
488 0xC79F022FUL, 0x3C997E7EUL, 0x5E4F9504UL, 0x3FFAFBBDUL,
489 0x76F7AD0EUL, 0x296693F4UL, 0x3D1FCE6FUL, 0xC61E45BEUL,
490 0xD3B5AB34UL, 0xF72BF9B7UL, 0x1B0434C0UL, 0x4E72B567UL,
491 0x5592A33DUL, 0xB5229301UL, 0xCFD2A87FUL, 0x60AEB767UL,
492 0x1814386BUL, 0x30BCC33DUL, 0x38A0C07DUL, 0xFD1606F2UL,
493 0xC363519BUL, 0x589DD390UL, 0x5479F8E6UL, 0x1CB8D647UL,
494 0x97FD61A9UL, 0xEA7759F4UL, 0x2D57539DUL, 0x569A58CFUL,
495 0xE84E63ADUL, 0x462E1B78UL, 0x6580F87EUL, 0xF3817914UL,
496 0x91DA55F4UL, 0x40A230F3UL, 0xD1988F35UL, 0xB6E318D2UL,
497 0x3FFA50BCUL, 0x3D40F021UL, 0xC3C0BDAEUL, 0x4958C24CUL,
498 0x518F36B2UL, 0x84B1D370UL, 0x0FEDCE83UL, 0x878DDADAUL,
499 0xF2A279C7UL, 0x94E01BE8UL, 0x90716F4BUL, 0x954B8AA3UL
500},
501
502{
503 0xE216300DUL, 0xBBDDFFFCUL, 0xA7EBDABDUL, 0x35648095UL,
504 0x7789F8B7UL, 0xE6C1121BUL, 0x0E241600UL, 0x052CE8B5UL,
505 0x11A9CFB0UL, 0xE5952F11UL, 0xECE7990AUL, 0x9386D174UL,
506 0x2A42931CUL, 0x76E38111UL, 0xB12DEF3AUL, 0x37DDDDFCUL,
507 0xDE9ADEB1UL, 0x0A0CC32CUL, 0xBE197029UL, 0x84A00940UL,
508 0xBB243A0FUL, 0xB4D137CFUL, 0xB44E79F0UL, 0x049EEDFDUL,
509 0x0B15A15DUL, 0x480D3168UL, 0x8BBBDE5AUL, 0x669DED42UL,
510 0xC7ECE831UL, 0x3F8F95E7UL, 0x72DF191BUL, 0x7580330DUL,
511 0x94074251UL, 0x5C7DCDFAUL, 0xABBE6D63UL, 0xAA402164UL,
512 0xB301D40AUL, 0x02E7D1CAUL, 0x53571DAEUL, 0x7A3182A2UL,
513 0x12A8DDECUL, 0xFDAA335DUL, 0x176F43E8UL, 0x71FB46D4UL,
514 0x38129022UL, 0xCE949AD4UL, 0xB84769ADUL, 0x965BD862UL,
515 0x82F3D055UL, 0x66FB9767UL, 0x15B80B4EUL, 0x1D5B47A0UL,
516 0x4CFDE06FUL, 0xC28EC4B8UL, 0x57E8726EUL, 0x647A78FCUL,
517 0x99865D44UL, 0x608BD593UL, 0x6C200E03UL, 0x39DC5FF6UL,
518 0x5D0B00A3UL, 0xAE63AFF2UL, 0x7E8BD632UL, 0x70108C0CUL,
519 0xBBD35049UL, 0x2998DF04UL, 0x980CF42AUL, 0x9B6DF491UL,
520 0x9E7EDD53UL, 0x06918548UL, 0x58CB7E07UL, 0x3B74EF2EUL,
521 0x522FFFB1UL, 0xD24708CCUL, 0x1C7E27CDUL, 0xA4EB215BUL,
522 0x3CF1D2E2UL, 0x19B47A38UL, 0x424F7618UL, 0x35856039UL,
523 0x9D17DEE7UL, 0x27EB35E6UL, 0xC9AFF67BUL, 0x36BAF5B8UL,
524 0x09C467CDUL, 0xC18910B1UL, 0xE11DBF7BUL, 0x06CD1AF8UL,
525 0x7170C608UL, 0x2D5E3354UL, 0xD4DE495AUL, 0x64C6D006UL,
526 0xBCC0C62CUL, 0x3DD00DB3UL, 0x708F8F34UL, 0x77D51B42UL,
527 0x264F620FUL, 0x24B8D2BFUL, 0x15C1B79EUL, 0x46A52564UL,
528 0xF8D7E54EUL, 0x3E378160UL, 0x7895CDA5UL, 0x859C15A5UL,
529 0xE6459788UL, 0xC37BC75FUL, 0xDB07BA0CUL, 0x0676A3ABUL,
530 0x7F229B1EUL, 0x31842E7BUL, 0x24259FD7UL, 0xF8BEF472UL,
531 0x835FFCB8UL, 0x6DF4C1F2UL, 0x96F5B195UL, 0xFD0AF0FCUL,
532 0xB0FE134CUL, 0xE2506D3DUL, 0x4F9B12EAUL, 0xF215F225UL,
533 0xA223736FUL, 0x9FB4C428UL, 0x25D04979UL, 0x34C713F8UL,
534 0xC4618187UL, 0xEA7A6E98UL, 0x7CD16EFCUL, 0x1436876CUL,
535 0xF1544107UL, 0xBEDEEE14UL, 0x56E9AF27UL, 0xA04AA441UL,
536 0x3CF7C899UL, 0x92ECBAE6UL, 0xDD67016DUL, 0x151682EBUL,
537 0xA842EEDFUL, 0xFDBA60B4UL, 0xF1907B75UL, 0x20E3030FUL,
538 0x24D8C29EUL, 0xE139673BUL, 0xEFA63FB8UL, 0x71873054UL,
539 0xB6F2CF3BUL, 0x9F326442UL, 0xCB15A4CCUL, 0xB01A4504UL,
540 0xF1E47D8DUL, 0x844A1BE5UL, 0xBAE7DFDCUL, 0x42CBDA70UL,
541 0xCD7DAE0AUL, 0x57E85B7AUL, 0xD53F5AF6UL, 0x20CF4D8CUL,
542 0xCEA4D428UL, 0x79D130A4UL, 0x3486EBFBUL, 0x33D3CDDCUL,
543 0x77853B53UL, 0x37EFFCB5UL, 0xC5068778UL, 0xE580B3E6UL,
544 0x4E68B8F4UL, 0xC5C8B37EUL, 0x0D809EA2UL, 0x398FEB7CUL,
545 0x132A4F94UL, 0x43B7950EUL, 0x2FEE7D1CUL, 0x223613BDUL,
546 0xDD06CAA2UL, 0x37DF932BUL, 0xC4248289UL, 0xACF3EBC3UL,
547 0x5715F6B7UL, 0xEF3478DDUL, 0xF267616FUL, 0xC148CBE4UL,
548 0x9052815EUL, 0x5E410FABUL, 0xB48A2465UL, 0x2EDA7FA4UL,
549 0xE87B40E4UL, 0xE98EA084UL, 0x5889E9E1UL, 0xEFD390FCUL,
550 0xDD07D35BUL, 0xDB485694UL, 0x38D7E5B2UL, 0x57720101UL,
551 0x730EDEBCUL, 0x5B643113UL, 0x94917E4FUL, 0x503C2FBAUL,
552 0x646F1282UL, 0x7523D24AUL, 0xE0779695UL, 0xF9C17A8FUL,
553 0x7A5B2121UL, 0xD187B896UL, 0x29263A4DUL, 0xBA510CDFUL,
554 0x81F47C9FUL, 0xAD1163EDUL, 0xEA7B5965UL, 0x1A00726EUL,
555 0x11403092UL, 0x00DA6D77UL, 0x4A0CDD61UL, 0xAD1F4603UL,
556 0x605BDFB0UL, 0x9EEDC364UL, 0x22EBE6A8UL, 0xCEE7D28AUL,
557 0xA0E736A0UL, 0x5564A6B9UL, 0x10853209UL, 0xC7EB8F37UL,
558 0x2DE705CAUL, 0x8951570FUL, 0xDF09822BUL, 0xBD691A6CUL,
559 0xAA12E4F2UL, 0x87451C0FUL, 0xE0F6A27AUL, 0x3ADA4819UL,
560 0x4CF1764FUL, 0x0D771C2BUL, 0x67CDB156UL, 0x350D8384UL,
561 0x5938FA0FUL, 0x42399EF3UL, 0x36997B07UL, 0x0E84093DUL,
562 0x4AA93E61UL, 0x8360D87BUL, 0x1FA98B0CUL, 0x1149382CUL,
563 0xE97625A5UL, 0x0614D1B7UL, 0x0E25244BUL, 0x0C768347UL,
564 0x589E8D82UL, 0x0D2059D1UL, 0xA466BB1EUL, 0xF8DA0A82UL,
565 0x04F19130UL, 0xBA6E4EC0UL, 0x99265164UL, 0x1EE7230DUL,
566 0x50B2AD80UL, 0xEAEE6801UL, 0x8DB2A283UL, 0xEA8BF59EUL
567}};
568
569/* CAST uses three different round functions */
570#define f1(l, r, km, kr) \
571 t = rotlVariable(km + r, kr); \
572 l ^= ((S[0][U8a(t)] ^ S[1][U8b(t)]) - \
573 S[2][U8c(t)]) + S[3][U8d(t)];
574#define f2(l, r, km, kr) \
575 t = rotlVariable(km ^ r, kr); \
576 l ^= ((S[0][U8a(t)] - S[1][U8b(t)]) + \
577 S[2][U8c(t)]) ^ S[3][U8d(t)];
578#define f3(l, r, km, kr) \
579 t = rotlVariable(km - r, kr); \
580 l ^= ((S[0][U8a(t)] + S[1][U8b(t)]) ^ \
581 S[2][U8c(t)]) - S[3][U8d(t)];
582
583#define F1(l, r, i, j) f1(l, r, K[i], K[i+j])
584#define F2(l, r, i, j) f2(l, r, K[i], K[i+j])
585#define F3(l, r, i, j) f3(l, r, K[i], K[i+j])
586
587
588void Cast5Encrypt (const byte *inBlock, byte *outBlock, CAST_KEY *key)
589{
590 word32 l = BE32 (((word32 *)inBlock)[0]);
591 word32 r = BE32 (((word32 *)inBlock)[1]);
592 word32 *K = key->K;
593 word32 t;
594
595 /* Do the work */
596 F1(l, r, 0, 16);
597 F2(r, l, 1, 16);
598 F3(l, r, 2, 16);
599 F1(r, l, 3, 16);
600 F2(l, r, 4, 16);
601 F3(r, l, 5, 16);
602 F1(l, r, 6, 16);
603 F2(r, l, 7, 16);
604 F3(l, r, 8, 16);
605 F1(r, l, 9, 16);
606 F2(l, r, 10, 16);
607 F3(r, l, 11, 16);
608 F1(l, r, 12, 16);
609 F2(r, l, 13, 16);
610 F3(l, r, 14, 16);
611 F1(r, l, 15, 16);
612
613 /* Put l,r into outblock */
614 ((word32 *)outBlock)[0] = BE32 (r);
615 ((word32 *)outBlock)[1] = BE32 (l);
616}
617
618
619void Cast5Decrypt (const byte *inBlock, byte *outBlock, CAST_KEY *key)
620{
621 word32 r = BE32 (((word32 *)inBlock)[0]);
622 word32 l = BE32 (((word32 *)inBlock)[1]);
623 word32 *K = key->K;
624 word32 t;
625
626 /* Only do full 16 rounds if key length > 80 bits */
627 F1(r, l, 15, 16);
628 F3(l, r, 14, 16);
629 F2(r, l, 13, 16);
630 F1(l, r, 12, 16);
631 F3(r, l, 11, 16);
632 F2(l, r, 10, 16);
633 F1(r, l, 9, 16);
634 F3(l, r, 8, 16);
635 F2(r, l, 7, 16);
636 F1(l, r, 6, 16);
637 F3(r, l, 5, 16);
638 F2(l, r, 4, 16);
639 F1(r, l, 3, 16);
640 F3(l, r, 2, 16);
641 F2(r, l, 1, 16);
642 F1(l, r, 0, 16);
643 /* Put l,r into outblock */
644 ((word32 *)outBlock)[0] = BE32 (l);
645 ((word32 *)outBlock)[1] = BE32 (r);
646 /* Wipe clean */
647 t = l = r = 0;
648}
649
650void Cast5SetKey (CAST_KEY *key, unsigned int keylength, const byte *userKey)
651{
652 unsigned int i;
653 word32 *K = key->K;
654 word32 X[4], Z[4];
655
656 X[0] = BE32 (((word32 *)userKey)[0]);
657 X[1] = BE32 (((word32 *)userKey)[1]);
658 X[2] = BE32 (((word32 *)userKey)[2]);
659 X[3] = BE32 (((word32 *)userKey)[3]);
660
661#define x(i) GETBYTE(X[i/4], 3-i%4)
662#define z(i) GETBYTE(Z[i/4], 3-i%4)
663
664 for (i=0; i<=16; i+=16)
665 {
666 // this part is copied directly from RFC 2144 (with some search and replace) by Wei Dai
667 Z[0] = X[0] ^ S[4][x(0xD)] ^ S[5][x(0xF)] ^ S[6][x(0xC)] ^ S[7][x(0xE)] ^ S[6][x(0x8)];
668 Z[1] = X[2] ^ S[4][z(0x0)] ^ S[5][z(0x2)] ^ S[6][z(0x1)] ^ S[7][z(0x3)] ^ S[7][x(0xA)];
669 Z[2] = X[3] ^ S[4][z(0x7)] ^ S[5][z(0x6)] ^ S[6][z(0x5)] ^ S[7][z(0x4)] ^ S[4][x(0x9)];
670 Z[3] = X[1] ^ S[4][z(0xA)] ^ S[5][z(0x9)] ^ S[6][z(0xB)] ^ S[7][z(0x8)] ^ S[5][x(0xB)];
671 K[i+0] = S[4][z(0x8)] ^ S[5][z(0x9)] ^ S[6][z(0x7)] ^ S[7][z(0x6)] ^ S[4][z(0x2)];
672 K[i+1] = S[4][z(0xA)] ^ S[5][z(0xB)] ^ S[6][z(0x5)] ^ S[7][z(0x4)] ^ S[5][z(0x6)];
673 K[i+2] = S[4][z(0xC)] ^ S[5][z(0xD)] ^ S[6][z(0x3)] ^ S[7][z(0x2)] ^ S[6][z(0x9)];
674 K[i+3] = S[4][z(0xE)] ^ S[5][z(0xF)] ^ S[6][z(0x1)] ^ S[7][z(0x0)] ^ S[7][z(0xC)];
675 X[0] = Z[2] ^ S[4][z(0x5)] ^ S[5][z(0x7)] ^ S[6][z(0x4)] ^ S[7][z(0x6)] ^ S[6][z(0x0)];
676 X[1] = Z[0] ^ S[4][x(0x0)] ^ S[5][x(0x2)] ^ S[6][x(0x1)] ^ S[7][x(0x3)] ^ S[7][z(0x2)];
677 X[2] = Z[1] ^ S[4][x(0x7)] ^ S[5][x(0x6)] ^ S[6][x(0x5)] ^ S[7][x(0x4)] ^ S[4][z(0x1)];
678 X[3] = Z[3] ^ S[4][x(0xA)] ^ S[5][x(0x9)] ^ S[6][x(0xB)] ^ S[7][x(0x8)] ^ S[5][z(0x3)];
679 K[i+4] = S[4][x(0x3)] ^ S[5][x(0x2)] ^ S[6][x(0xC)] ^ S[7][x(0xD)] ^ S[4][x(0x8)];
680 K[i+5] = S[4][x(0x1)] ^ S[5][x(0x0)] ^ S[6][x(0xE)] ^ S[7][x(0xF)] ^ S[5][x(0xD)];
681 K[i+6] = S[4][x(0x7)] ^ S[5][x(0x6)] ^ S[6][x(0x8)] ^ S[7][x(0x9)] ^ S[6][x(0x3)];
682 K[i+7] = S[4][x(0x5)] ^ S[5][x(0x4)] ^ S[6][x(0xA)] ^ S[7][x(0xB)] ^ S[7][x(0x7)];
683 Z[0] = X[0] ^ S[4][x(0xD)] ^ S[5][x(0xF)] ^ S[6][x(0xC)] ^ S[7][x(0xE)] ^ S[6][x(0x8)];
684 Z[1] = X[2] ^ S[4][z(0x0)] ^ S[5][z(0x2)] ^ S[6][z(0x1)] ^ S[7][z(0x3)] ^ S[7][x(0xA)];
685 Z[2] = X[3] ^ S[4][z(0x7)] ^ S[5][z(0x6)] ^ S[6][z(0x5)] ^ S[7][z(0x4)] ^ S[4][x(0x9)];
686 Z[3] = X[1] ^ S[4][z(0xA)] ^ S[5][z(0x9)] ^ S[6][z(0xB)] ^ S[7][z(0x8)] ^ S[5][x(0xB)];
687 K[i+8] = S[4][z(0x3)] ^ S[5][z(0x2)] ^ S[6][z(0xC)] ^ S[7][z(0xD)] ^ S[4][z(0x9)];
688 K[i+9] = S[4][z(0x1)] ^ S[5][z(0x0)] ^ S[6][z(0xE)] ^ S[7][z(0xF)] ^ S[5][z(0xC)];
689 K[i+10] = S[4][z(0x7)] ^ S[5][z(0x6)] ^ S[6][z(0x8)] ^ S[7][z(0x9)] ^ S[6][z(0x2)];
690 K[i+11] = S[4][z(0x5)] ^ S[5][z(0x4)] ^ S[6][z(0xA)] ^ S[7][z(0xB)] ^ S[7][z(0x6)];
691 X[0] = Z[2] ^ S[4][z(0x5)] ^ S[5][z(0x7)] ^ S[6][z(0x4)] ^ S[7][z(0x6)] ^ S[6][z(0x0)];
692 X[1] = Z[0] ^ S[4][x(0x0)] ^ S[5][x(0x2)] ^ S[6][x(0x1)] ^ S[7][x(0x3)] ^ S[7][z(0x2)];
693 X[2] = Z[1] ^ S[4][x(0x7)] ^ S[5][x(0x6)] ^ S[6][x(0x5)] ^ S[7][x(0x4)] ^ S[4][z(0x1)];
694 X[3] = Z[3] ^ S[4][x(0xA)] ^ S[5][x(0x9)] ^ S[6][x(0xB)] ^ S[7][x(0x8)] ^ S[5][z(0x3)];
695 K[i+12] = S[4][x(0x8)] ^ S[5][x(0x9)] ^ S[6][x(0x7)] ^ S[7][x(0x6)] ^ S[4][x(0x3)];
696 K[i+13] = S[4][x(0xA)] ^ S[5][x(0xB)] ^ S[6][x(0x5)] ^ S[7][x(0x4)] ^ S[5][x(0x7)];
697 K[i+14] = S[4][x(0xC)] ^ S[5][x(0xD)] ^ S[6][x(0x3)] ^ S[7][x(0x2)] ^ S[6][x(0x8)];
698 K[i+15] = S[4][x(0xE)] ^ S[5][x(0xF)] ^ S[6][x(0x1)] ^ S[7][x(0x0)] ^ S[7][x(0xD)];
699 }
700
701 for (i=16; i<32; i++)
702 K[i] &= 0x1f;
703}
diff --git a/src/Crypto/Cast.h b/src/Crypto/Cast.h
deleted file mode 100644
index 5c744494..00000000
--- a/src/Crypto/Cast.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* Deprecated/legacy */
2
3
4#ifndef HEADER_CAST_H
5#define HEADER_CAST_H
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef struct CAST_KEY_STRUCT
12{
13 unsigned __int32 K[32];
14} CAST_KEY;
15
16void Cast5Decrypt (const byte *inBlock, byte *outBlock, CAST_KEY *key);
17void Cast5Encrypt (const byte *inBlock, byte *outBlock, CAST_KEY *key);
18void Cast5SetKey (CAST_KEY *key, unsigned int keylength, const byte *userKey);
19
20#ifdef __cplusplus
21}
22#endif
23
24#endif
diff --git a/src/Crypto/Crypto.vcproj b/src/Crypto/Crypto.vcproj
index e1d2e410..72e6f645 100644
--- a/src/Crypto/Crypto.vcproj
+++ b/src/Crypto/Crypto.vcproj
@@ -212,18 +212,6 @@
212 > 212 >
213 </File> 213 </File>
214 <File 214 <File
215 RelativePath=".\Blowfish.c"
216 >
217 </File>
218 <File
219 RelativePath=".\Cast.c"
220 >
221 </File>
222 <File
223 RelativePath=".\Des.c"
224 >
225 </File>
226 <File
227 RelativePath=".\Rmd160.c" 215 RelativePath=".\Rmd160.c"
228 > 216 >
229 </File> 217 </File>
@@ -232,10 +220,6 @@
232 > 220 >
233 </File> 221 </File>
234 <File 222 <File
235 RelativePath=".\Sha1.c"
236 >
237 </File>
238 <File
239 RelativePath=".\Sha2.c" 223 RelativePath=".\Sha2.c"
240 > 224 >
241 </File> 225 </File>
diff --git a/src/Crypto/Des.c b/src/Crypto/Des.c
deleted file mode 100644
index 8f14d6c0..00000000
--- a/src/Crypto/Des.c
+++ /dev/null
@@ -1,406 +0,0 @@
1/* Deprecated/legacy */
2
3
4// des.cpp - modified by Wei Dai from Phil Karn's des.c
5// The original code and all modifications are in the public domain.
6
7/*
8 * This is a major rewrite of my old public domain DES code written
9 * circa 1987, which in turn borrowed heavily from Jim Gillogly's 1977
10 * public domain code. I pretty much kept my key scheduling code, but
11 * the actual encrypt/decrypt routines are taken from from Richard
12 * Outerbridge's DES code as printed in Schneier's "Applied Cryptography."
13 *
14 * This code is in the public domain. I would appreciate bug reports and
15 * enhancements.
16 *
17 * Phil Karn KA9Q, karn@unix.ka9q.ampr.org, August 1994.
18 */
19
20/* Adapted for TrueCrypt */
21
22#include <memory.h>
23#include "Common/Tcdefs.h"
24#include "Common/Endian.h"
25#include "Des.h"
26
27#define word32 unsigned __int32
28#define byte unsigned __int8
29
30static word32 rotlFixed (word32 x, unsigned int y)
31{
32 return (word32)((x<<y) | (x>>(sizeof(word32)*8-y)));
33}
34
35static word32 rotrFixed (word32 x, unsigned int y)
36{
37 return (word32)((x>>y) | (x<<(sizeof(word32)*8-y)));
38}
39
40
41/* Tables defined in the Data Encryption Standard documents
42 * Three of these tables, the initial permutation, the final
43 * permutation and the expansion operator, are regular enough that
44 * for speed, we hard-code them. They're here for reference only.
45 * Also, the S and P boxes are used by a separate program, gensp.c,
46 * to build the combined SP box, Spbox[]. They're also here just
47 * for reference.
48 */
49#ifdef notdef
50/* initial permutation IP */
51static byte ip[] = {
52 58, 50, 42, 34, 26, 18, 10, 2,
53 60, 52, 44, 36, 28, 20, 12, 4,
54 62, 54, 46, 38, 30, 22, 14, 6,
55 64, 56, 48, 40, 32, 24, 16, 8,
56 57, 49, 41, 33, 25, 17, 9, 1,
57 59, 51, 43, 35, 27, 19, 11, 3,
58 61, 53, 45, 37, 29, 21, 13, 5,
59 63, 55, 47, 39, 31, 23, 15, 7
60};
61
62/* final permutation IP^-1 */
63static byte fp[] = {
64 40, 8, 48, 16, 56, 24, 64, 32,
65 39, 7, 47, 15, 55, 23, 63, 31,
66 38, 6, 46, 14, 54, 22, 62, 30,
67 37, 5, 45, 13, 53, 21, 61, 29,
68 36, 4, 44, 12, 52, 20, 60, 28,
69 35, 3, 43, 11, 51, 19, 59, 27,
70 34, 2, 42, 10, 50, 18, 58, 26,
71 33, 1, 41, 9, 49, 17, 57, 25
72};
73/* expansion operation matrix */
74static byte ei[] = {
75 32, 1, 2, 3, 4, 5,
76 4, 5, 6, 7, 8, 9,
77 8, 9, 10, 11, 12, 13,
78 12, 13, 14, 15, 16, 17,
79 16, 17, 18, 19, 20, 21,
80 20, 21, 22, 23, 24, 25,
81 24, 25, 26, 27, 28, 29,
82 28, 29, 30, 31, 32, 1
83};
84/* The (in)famous S-boxes */
85static byte sbox[8][64] = {
86 /* S1 */
87 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
88 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
89 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
90 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,
91
92 /* S2 */
93 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
94 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
95 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
96 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,
97
98 /* S3 */
99 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
100 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
101 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
102 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,
103
104 /* S4 */
105 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
106 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
107 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
108 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,
109
110 /* S5 */
111 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
112 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
113 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
114 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,
115
116 /* S6 */
117 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
118 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
119 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
120 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,
121
122 /* S7 */
123 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
124 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
125 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
126 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,
127
128 /* S8 */
129 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
130 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
131 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
132 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
133};
134
135/* 32-bit permutation function P used on the output of the S-boxes */
136static byte p32i[] = {
137 16, 7, 20, 21,
138 29, 12, 28, 17,
139 1, 15, 23, 26,
140 5, 18, 31, 10,
141 2, 8, 24, 14,
142 32, 27, 3, 9,
143 19, 13, 30, 6,
144 22, 11, 4, 25
145};
146#endif
147
148/* permuted choice table (key) */
149static const byte pc1[] = {
150 57, 49, 41, 33, 25, 17, 9,
151 1, 58, 50, 42, 34, 26, 18,
152 10, 2, 59, 51, 43, 35, 27,
153 19, 11, 3, 60, 52, 44, 36,
154
155 63, 55, 47, 39, 31, 23, 15,
156 7, 62, 54, 46, 38, 30, 22,
157 14, 6, 61, 53, 45, 37, 29,
158 21, 13, 5, 28, 20, 12, 4
159};
160
161/* number left rotations of pc1 */
162static const byte totrot[] = {
163 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28
164};
165
166/* permuted choice key (table) */
167static const byte pc2[] = {
168 14, 17, 11, 24, 1, 5,
169 3, 28, 15, 6, 21, 10,
170 23, 19, 12, 4, 26, 8,
171 16, 7, 27, 20, 13, 2,
172 41, 52, 31, 37, 47, 55,
173 30, 40, 51, 45, 33, 48,
174 44, 49, 39, 56, 34, 53,
175 46, 42, 50, 36, 29, 32
176};
177
178/* End of DES-defined tables */
179
180/* bit 0 is left-most in byte */
181static const int bytebit[] = {
182 0200,0100,040,020,010,04,02,01
183};
184
185static const word32 Spbox[8][64] = {
186{
1870x01010400,0x00000000,0x00010000,0x01010404, 0x01010004,0x00010404,0x00000004,0x00010000,
1880x00000400,0x01010400,0x01010404,0x00000400, 0x01000404,0x01010004,0x01000000,0x00000004,
1890x00000404,0x01000400,0x01000400,0x00010400, 0x00010400,0x01010000,0x01010000,0x01000404,
1900x00010004,0x01000004,0x01000004,0x00010004, 0x00000000,0x00000404,0x00010404,0x01000000,
1910x00010000,0x01010404,0x00000004,0x01010000, 0x01010400,0x01000000,0x01000000,0x00000400,
1920x01010004,0x00010000,0x00010400,0x01000004, 0x00000400,0x00000004,0x01000404,0x00010404,
1930x01010404,0x00010004,0x01010000,0x01000404, 0x01000004,0x00000404,0x00010404,0x01010400,
1940x00000404,0x01000400,0x01000400,0x00000000, 0x00010004,0x00010400,0x00000000,0x01010004},
195{
1960x80108020,0x80008000,0x00008000,0x00108020, 0x00100000,0x00000020,0x80100020,0x80008020,
1970x80000020,0x80108020,0x80108000,0x80000000, 0x80008000,0x00100000,0x00000020,0x80100020,
1980x00108000,0x00100020,0x80008020,0x00000000, 0x80000000,0x00008000,0x00108020,0x80100000,
1990x00100020,0x80000020,0x00000000,0x00108000, 0x00008020,0x80108000,0x80100000,0x00008020,
2000x00000000,0x00108020,0x80100020,0x00100000, 0x80008020,0x80100000,0x80108000,0x00008000,
2010x80100000,0x80008000,0x00000020,0x80108020, 0x00108020,0x00000020,0x00008000,0x80000000,
2020x00008020,0x80108000,0x00100000,0x80000020, 0x00100020,0x80008020,0x80000020,0x00100020,
2030x00108000,0x00000000,0x80008000,0x00008020, 0x80000000,0x80100020,0x80108020,0x00108000},
204{
2050x00000208,0x08020200,0x00000000,0x08020008, 0x08000200,0x00000000,0x00020208,0x08000200,
2060x00020008,0x08000008,0x08000008,0x00020000, 0x08020208,0x00020008,0x08020000,0x00000208,
2070x08000000,0x00000008,0x08020200,0x00000200, 0x00020200,0x08020000,0x08020008,0x00020208,
2080x08000208,0x00020200,0x00020000,0x08000208, 0x00000008,0x08020208,0x00000200,0x08000000,
2090x08020200,0x08000000,0x00020008,0x00000208, 0x00020000,0x08020200,0x08000200,0x00000000,
2100x00000200,0x00020008,0x08020208,0x08000200, 0x08000008,0x00000200,0x00000000,0x08020008,
2110x08000208,0x00020000,0x08000000,0x08020208, 0x00000008,0x00020208,0x00020200,0x08000008,
2120x08020000,0x08000208,0x00000208,0x08020000, 0x00020208,0x00000008,0x08020008,0x00020200},
213{
2140x00802001,0x00002081,0x00002081,0x00000080, 0x00802080,0x00800081,0x00800001,0x00002001,
2150x00000000,0x00802000,0x00802000,0x00802081, 0x00000081,0x00000000,0x00800080,0x00800001,
2160x00000001,0x00002000,0x00800000,0x00802001, 0x00000080,0x00800000,0x00002001,0x00002080,
2170x00800081,0x00000001,0x00002080,0x00800080, 0x00002000,0x00802080,0x00802081,0x00000081,
2180x00800080,0x00800001,0x00802000,0x00802081, 0x00000081,0x00000000,0x00000000,0x00802000,
2190x00002080,0x00800080,0x00800081,0x00000001, 0x00802001,0x00002081,0x00002081,0x00000080,
2200x00802081,0x00000081,0x00000001,0x00002000, 0x00800001,0x00002001,0x00802080,0x00800081,
2210x00002001,0x00002080,0x00800000,0x00802001, 0x00000080,0x00800000,0x00002000,0x00802080},
222{
2230x00000100,0x02080100,0x02080000,0x42000100, 0x00080000,0x00000100,0x40000000,0x02080000,
2240x40080100,0x00080000,0x02000100,0x40080100, 0x42000100,0x42080000,0x00080100,0x40000000,
2250x02000000,0x40080000,0x40080000,0x00000000, 0x40000100,0x42080100,0x42080100,0x02000100,
2260x42080000,0x40000100,0x00000000,0x42000000, 0x02080100,0x02000000,0x42000000,0x00080100,
2270x00080000,0x42000100,0x00000100,0x02000000, 0x40000000,0x02080000,0x42000100,0x40080100,
2280x02000100,0x40000000,0x42080000,0x02080100, 0x40080100,0x00000100,0x02000000,0x42080000,
2290x42080100,0x00080100,0x42000000,0x42080100, 0x02080000,0x00000000,0x40080000,0x42000000,
2300x00080100,0x02000100,0x40000100,0x00080000, 0x00000000,0x40080000,0x02080100,0x40000100},
231{
2320x20000010,0x20400000,0x00004000,0x20404010, 0x20400000,0x00000010,0x20404010,0x00400000,
2330x20004000,0x00404010,0x00400000,0x20000010, 0x00400010,0x20004000,0x20000000,0x00004010,
2340x00000000,0x00400010,0x20004010,0x00004000, 0x00404000,0x20004010,0x00000010,0x20400010,
2350x20400010,0x00000000,0x00404010,0x20404000, 0x00004010,0x00404000,0x20404000,0x20000000,
2360x20004000,0x00000010,0x20400010,0x00404000, 0x20404010,0x00400000,0x00004010,0x20000010,
2370x00400000,0x20004000,0x20000000,0x00004010, 0x20000010,0x20404010,0x00404000,0x20400000,
2380x00404010,0x20404000,0x00000000,0x20400010, 0x00000010,0x00004000,0x20400000,0x00404010,
2390x00004000,0x00400010,0x20004010,0x00000000, 0x20404000,0x20000000,0x00400010,0x20004010},
240{
2410x00200000,0x04200002,0x04000802,0x00000000, 0x00000800,0x04000802,0x00200802,0x04200800,
2420x04200802,0x00200000,0x00000000,0x04000002, 0x00000002,0x04000000,0x04200002,0x00000802,
2430x04000800,0x00200802,0x00200002,0x04000800, 0x04000002,0x04200000,0x04200800,0x00200002,
2440x04200000,0x00000800,0x00000802,0x04200802, 0x00200800,0x00000002,0x04000000,0x00200800,
2450x04000000,0x00200800,0x00200000,0x04000802, 0x04000802,0x04200002,0x04200002,0x00000002,
2460x00200002,0x04000000,0x04000800,0x00200000, 0x04200800,0x00000802,0x00200802,0x04200800,
2470x00000802,0x04000002,0x04200802,0x04200000, 0x00200800,0x00000000,0x00000002,0x04200802,
2480x00000000,0x00200802,0x04200000,0x00000800, 0x04000002,0x04000800,0x00000800,0x00200002},
249{
2500x10001040,0x00001000,0x00040000,0x10041040, 0x10000000,0x10001040,0x00000040,0x10000000,
2510x00040040,0x10040000,0x10041040,0x00041000, 0x10041000,0x00041040,0x00001000,0x00000040,
2520x10040000,0x10000040,0x10001000,0x00001040, 0x00041000,0x00040040,0x10040040,0x10041000,
2530x00001040,0x00000000,0x00000000,0x10040040, 0x10000040,0x10001000,0x00041040,0x00040000,
2540x00041040,0x00040000,0x10041000,0x00001000, 0x00000040,0x10040040,0x00001000,0x00041040,
2550x10001000,0x00000040,0x10000040,0x10040000, 0x10040040,0x10000000,0x00040000,0x10001040,
2560x00000000,0x10041040,0x00040040,0x10000040, 0x10040000,0x10001000,0x10001040,0x00000000,
2570x10041040,0x00041000,0x00041000,0x00001040, 0x00001040,0x00040040,0x10000000,0x10041000}
258};
259
260/* Set key (initialize key schedule array) */
261static void RawSetKey (int encryption, const byte *key, word32 *scheduledKey)
262{
263 byte buffer[56+56+8];
264 byte *const pc1m=buffer; /* place to modify pc1 into */
265 byte *const pcr=pc1m+56; /* place to rotate pc1 into */
266 byte *const ks=pcr+56;
267 register int i,j,l;
268 int m;
269
270 for (j=0; j<56; j++) { /* convert pc1 to bits of key */
271 l=pc1[j]-1; /* integer bit location */
272 m = l & 07; /* find bit */
273 pc1m[j]=(key[l>>3] & /* find which key byte l is in */
274 bytebit[m]) /* and which bit of that byte */
275 ? 1 : 0; /* and store 1-bit result */
276 }
277 for (i=0; i<16; i++) { /* key chunk for each iteration */
278 memset(ks,0,8); /* Clear key schedule */
279 for (j=0; j<56; j++) /* rotate pc1 the right amount */
280 pcr[j] = pc1m[(l=j+totrot[i])<(j<28? 28 : 56) ? l: l-28];
281 /* rotate left and right halves independently */
282 for (j=0; j<48; j++){ /* select bits individually */
283 /* check bit that goes to ks[j] */
284 if (pcr[pc2[j]-1]){
285 /* mask it in if it's there */
286 l= j % 6;
287 ks[j/6] |= bytebit[l] >> 2;
288 }
289 }
290 /* Now convert to odd/even interleaved form for use in F */
291 scheduledKey[2*i] = ((word32)ks[0] << 24)
292 | ((word32)ks[2] << 16)
293 | ((word32)ks[4] << 8)
294 | ((word32)ks[6]);
295 scheduledKey[2*i+1] = ((word32)ks[1] << 24)
296 | ((word32)ks[3] << 16)
297 | ((word32)ks[5] << 8)
298 | ((word32)ks[7]);
299 }
300
301 if (!encryption) // reverse key schedule order
302 for (i=0; i<16; i+=2)
303 {
304 word32 b = scheduledKey[i];
305 scheduledKey[i] = scheduledKey[32-2-i];
306 scheduledKey[32-2-i] = b;
307
308 b = scheduledKey[i+1];
309 scheduledKey[i+1] = scheduledKey[32-1-i];
310 scheduledKey[32-1-i] = b;
311 }
312
313 burn (buffer, sizeof (buffer));
314}
315
316static void RawProcessBlock(word32 *l_, word32 *r_, const word32 *k)
317{
318 word32 l = *l_, r = *r_;
319 const word32 *kptr=k;
320 unsigned i;
321
322 for (i=0; i<8; i++)
323 {
324 word32 work = rotrFixed(r, 4U) ^ kptr[4*i+0];
325 l ^= Spbox[6][(work) & 0x3f]
326 ^ Spbox[4][(work >> 8) & 0x3f]
327 ^ Spbox[2][(work >> 16) & 0x3f]
328 ^ Spbox[0][(work >> 24) & 0x3f];
329 work = r ^ kptr[4*i+1];
330 l ^= Spbox[7][(work) & 0x3f]
331 ^ Spbox[5][(work >> 8) & 0x3f]
332 ^ Spbox[3][(work >> 16) & 0x3f]
333 ^ Spbox[1][(work >> 24) & 0x3f];
334
335 work = rotrFixed(l, 4U) ^ kptr[4*i+2];
336 r ^= Spbox[6][(work) & 0x3f]
337 ^ Spbox[4][(work >> 8) & 0x3f]
338 ^ Spbox[2][(work >> 16) & 0x3f]
339 ^ Spbox[0][(work >> 24) & 0x3f];
340 work = l ^ kptr[4*i+3];
341 r ^= Spbox[7][(work) & 0x3f]
342 ^ Spbox[5][(work >> 8) & 0x3f]
343 ^ Spbox[3][(work >> 16) & 0x3f]
344 ^ Spbox[1][(work >> 24) & 0x3f];
345 }
346
347 *l_ = l; *r_ = r;
348}
349
350void TripleDesSetKey (const byte *userKey, unsigned int length, TDES_KEY *ks)
351{
352 RawSetKey (1, userKey + 0, ks->k1);
353 RawSetKey (1, userKey + 8, ks->k2);
354 RawSetKey (1, userKey + 16, ks->k3);
355 RawSetKey (0, userKey + 16, ks->k1d);
356 RawSetKey (0, userKey + 8, ks->k2d);
357 RawSetKey (0, userKey + 0, ks->k3d);
358}
359
360void TripleDesEncrypt (byte *inBlock, byte *outBlock, TDES_KEY *key, int encrypt)
361{
362 word32 left = BE32 (((word32 *)inBlock)[0]);
363 word32 right = BE32 (((word32 *)inBlock)[1]);
364 word32 work;
365
366 right = rotlFixed(right, 4U);
367 work = (left ^ right) & 0xf0f0f0f0;
368 left ^= work;
369 right = rotrFixed(right^work, 20U);
370 work = (left ^ right) & 0xffff0000;
371 left ^= work;
372 right = rotrFixed(right^work, 18U);
373 work = (left ^ right) & 0x33333333;
374 left ^= work;
375 right = rotrFixed(right^work, 6U);
376 work = (left ^ right) & 0x00ff00ff;
377 left ^= work;
378 right = rotlFixed(right^work, 9U);
379 work = (left ^ right) & 0xaaaaaaaa;
380 left = rotlFixed(left^work, 1U);
381 right ^= work;
382
383 RawProcessBlock (&left, &right, encrypt ? key->k1 : key->k1d);
384 RawProcessBlock (&right, &left, !encrypt ? key->k2 : key->k2d);
385 RawProcessBlock (&left, &right, encrypt ? key->k3 : key->k3d);
386
387 right = rotrFixed(right, 1U);
388 work = (left ^ right) & 0xaaaaaaaa;
389 right ^= work;
390 left = rotrFixed(left^work, 9U);
391 work = (left ^ right) & 0x00ff00ff;
392 right ^= work;
393 left = rotlFixed(left^work, 6U);
394 work = (left ^ right) & 0x33333333;
395 right ^= work;
396 left = rotlFixed(left^work, 18U);
397 work = (left ^ right) & 0xffff0000;
398 right ^= work;
399 left = rotlFixed(left^work, 20U);
400 work = (left ^ right) & 0xf0f0f0f0;
401 right ^= work;
402 left = rotrFixed(left^work, 4U);
403
404 ((word32 *)outBlock)[0] = BE32 (right);
405 ((word32 *)outBlock)[1] = BE32 (left);
406}
diff --git a/src/Crypto/Des.h b/src/Crypto/Des.h
deleted file mode 100644
index 5fc2633a..00000000
--- a/src/Crypto/Des.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* Deprecated/legacy */
2
3
4#ifndef HEADER_Crypto_DES
5#define HEADER_Crypto_DES
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef struct TRIPLE_DES_KEY_STRUCT
12{
13 unsigned __int32 k1[32];
14 unsigned __int32 k2[32];
15 unsigned __int32 k3[32];
16 unsigned __int32 k1d[32];
17 unsigned __int32 k2d[32];
18 unsigned __int32 k3d[32];
19} TDES_KEY;
20
21void TripleDesEncrypt (byte *inBlock, byte *outBlock, TDES_KEY *key, int encrypt);
22void TripleDesSetKey (const byte *userKey, unsigned int length, TDES_KEY *ks);
23
24#ifdef __cplusplus
25}
26#endif
27
28#endif // HEADER_Crypto_DES
diff --git a/src/Crypto/Sha1.c b/src/Crypto/Sha1.c
deleted file mode 100644
index d2e451c6..00000000
--- a/src/Crypto/Sha1.c
+++ /dev/null
@@ -1,282 +0,0 @@
1/* Deprecated/legacy */
2
3/*
4 ---------------------------------------------------------------------------
5 Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
6
7 LICENSE TERMS
8
9 The free distribution and use of this software is allowed (with or without
10 changes) provided that:
11
12 1. source code distributions include the above copyright notice, this
13 list of conditions and the following disclaimer;
14
15 2. binary distributions include the above copyright notice, this list
16 of conditions and the following disclaimer in their documentation;
17
18 3. the name of the copyright holder is not used to endorse products
19 built using this software without specific written permission.
20
21 DISCLAIMER
22
23 This software is provided 'as is' with no explicit or implied warranties
24 in respect of its properties, including, but not limited to, correctness
25 and/or fitness for purpose.
26 ---------------------------------------------------------------------------
27 Issue Date: 18/06/2004
28
29 This is a byte oriented version of SHA1 that operates on arrays of bytes
30 stored in memory.
31*/
32
33/* Adapted for TrueCrypt */
34
35#include <string.h> /* for memcpy() etc. */
36#include <stdlib.h> /* for _lrotl with VC++ */
37
38#include "Sha1.h"
39
40#if defined(__cplusplus)
41extern "C"
42{
43#endif
44
45/*
46 To obtain the highest speed on processors with 32-bit words, this code
47 needs to determine the order in which bytes are packed into such words.
48 The following block of code is an attempt to capture the most obvious
49 ways in which various environemnts specify their endian definitions.
50 It may well fail, in which case the definitions will need to be set by
51 editing at the points marked **** EDIT HERE IF NECESSARY **** below.
52*/
53
54/* PLATFORM SPECIFIC INCLUDES */
55
56/* Original byte order detection removed */
57#include "../Common/Endian.h"
58
59#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
60#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
61
62#if BYTE_ORDER == LITTLE_ENDIAN
63# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
64#endif
65
66#if BYTE_ORDER == BIG_ENDIAN
67# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
68#endif
69
70#ifdef _MSC_VER
71#pragma intrinsic(memcpy)
72#endif
73
74#if 1 && defined(_MSC_VER) && !defined(_DEBUG)
75#define rotl32 _rotl
76#define rotr32 _rotr
77#else
78#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n)))
79#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n)))
80#endif
81
82#if !defined(bswap_32)
83#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00))
84#endif
85
86#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN)
87#define SWAP_BYTES
88#else
89#undef SWAP_BYTES
90#endif
91
92#if defined(SWAP_BYTES)
93#define bsw_32(p,n) \
94 { int _i = (n); while(_i--) ((sha1_32t*)p)[_i] = bswap_32(((sha1_32t*)p)[_i]); }
95#else
96#define bsw_32(p,n)
97#endif
98
99#define SHA1_MASK (SHA1_BLOCK_SIZE - 1)
100
101#if 0
102
103#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
104#define parity(x,y,z) ((x) ^ (y) ^ (z))
105#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
106
107#else /* Discovered by Rich Schroeppel and Colin Plumb */
108
109#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
110#define parity(x,y,z) ((x) ^ (y) ^ (z))
111#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y))))
112
113#endif
114
115/* Compile 64 bytes of hash data into SHA1 context. Note */
116/* that this routine assumes that the byte order in the */
117/* ctx->wbuf[] at this point is in such an order that low */
118/* address bytes in the ORIGINAL byte stream will go in */
119/* this buffer to the high end of 32-bit words on BOTH big */
120/* and little endian systems */
121
122#ifdef ARRAY
123#define q(v,n) v[n]
124#else
125#define q(v,n) v##n
126#endif
127
128#define one_cycle(v,a,b,c,d,e,f,k,h) \
129 q(v,e) += rotr32(q(v,a),27) + \
130 f(q(v,b),q(v,c),q(v,d)) + k + h; \
131 q(v,b) = rotr32(q(v,b), 2)
132
133#define five_cycle(v,f,k,i) \
134 one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \
135 one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \
136 one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \
137 one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \
138 one_cycle(v, 1,2,3,4,0, f,k,hf(i+4))
139
140void sha1_compile(sha1_ctx ctx[1])
141{ sha1_32t *w = ctx->wbuf;
142
143#ifdef ARRAY
144 sha1_32t v[5];
145 memcpy(v, ctx->hash, 5 * sizeof(sha1_32t));
146#else
147 sha1_32t v0, v1, v2, v3, v4;
148 v0 = ctx->hash[0]; v1 = ctx->hash[1];
149 v2 = ctx->hash[2]; v3 = ctx->hash[3];
150 v4 = ctx->hash[4];
151#endif
152
153#define hf(i) w[i]
154
155 five_cycle(v, ch, 0x5a827999, 0);
156 five_cycle(v, ch, 0x5a827999, 5);
157 five_cycle(v, ch, 0x5a827999, 10);
158 one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \
159
160#undef hf
161#define hf(i) (w[(i) & 15] = rotl32( \
162 w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \
163 ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1))
164
165 one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16));
166 one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17));
167 one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18));
168 one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19));
169
170 five_cycle(v, parity, 0x6ed9eba1, 20);
171 five_cycle(v, parity, 0x6ed9eba1, 25);
172 five_cycle(v, parity, 0x6ed9eba1, 30);
173 five_cycle(v, parity, 0x6ed9eba1, 35);
174
175 five_cycle(v, maj, 0x8f1bbcdc, 40);
176 five_cycle(v, maj, 0x8f1bbcdc, 45);
177 five_cycle(v, maj, 0x8f1bbcdc, 50);
178 five_cycle(v, maj, 0x8f1bbcdc, 55);
179
180 five_cycle(v, parity, 0xca62c1d6, 60);
181 five_cycle(v, parity, 0xca62c1d6, 65);
182 five_cycle(v, parity, 0xca62c1d6, 70);
183 five_cycle(v, parity, 0xca62c1d6, 75);
184
185#ifdef ARRAY
186 ctx->hash[0] += v[0]; ctx->hash[1] += v[1];
187 ctx->hash[2] += v[2]; ctx->hash[3] += v[3];
188 ctx->hash[4] += v[4];
189#else
190 ctx->hash[0] += v0; ctx->hash[1] += v1;
191 ctx->hash[2] += v2; ctx->hash[3] += v3;
192 ctx->hash[4] += v4;
193#endif
194}
195
196void sha1_begin(sha1_ctx ctx[1])
197{
198 ctx->count[0] = ctx->count[1] = 0;
199 ctx->hash[0] = 0x67452301;
200 ctx->hash[1] = 0xefcdab89;
201 ctx->hash[2] = 0x98badcfe;
202 ctx->hash[3] = 0x10325476;
203 ctx->hash[4] = 0xc3d2e1f0;
204}
205
206/* SHA1 hash data in an array of bytes into hash buffer and */
207/* call the hash_compile function as required. */
208
209void sha1_hash(const unsigned char data[], unsigned __int32 len, sha1_ctx ctx[1])
210{ sha1_32t pos = (sha1_32t)(ctx->count[0] & SHA1_MASK),
211 space = SHA1_BLOCK_SIZE - pos;
212 const unsigned char *sp = data;
213
214 if((ctx->count[0] += len) < len)
215 ++(ctx->count[1]);
216
217 while(len >= space) /* tranfer whole blocks if possible */
218 {
219 memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space);
220 sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0;
221 bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2);
222 sha1_compile(ctx);
223 }
224
225 memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len);
226}
227
228/* SHA1 final padding and digest calculation */
229
230void sha1_end(unsigned char hval[], sha1_ctx ctx[1])
231{ sha1_32t i = (sha1_32t)(ctx->count[0] & SHA1_MASK);
232
233 /* put bytes in the buffer in an order in which references to */
234 /* 32-bit words will put bytes with lower addresses into the */
235 /* top of 32 bit words on BOTH big and little endian machines */
236 bsw_32(ctx->wbuf, (i + 3) >> 2);
237
238 /* we now need to mask valid bytes and add the padding which is */
239 /* a single 1 bit and as many zero bits as necessary. Note that */
240 /* we can always add the first padding byte here because the */
241 /* buffer always has at least one empty slot */
242 ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3);
243 ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3);
244
245 /* we need 9 or more empty positions, one for the padding byte */
246 /* (above) and eight for the length count. If there is not */
247 /* enough space, pad and empty the buffer */
248 if(i > SHA1_BLOCK_SIZE - 9)
249 {
250 if(i < 60) ctx->wbuf[15] = 0;
251 sha1_compile(ctx);
252 i = 0;
253 }
254 else /* compute a word index for the empty buffer positions */
255 i = (i >> 2) + 1;
256
257 while(i < 14) /* and zero pad all but last two positions */
258 ctx->wbuf[i++] = 0;
259
260 /* the following 32-bit length fields are assembled in the */
261 /* wrong byte order on little endian machines but this is */
262 /* corrected later since they are only ever used as 32-bit */
263 /* word values. */
264 ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29);
265 ctx->wbuf[15] = ctx->count[0] << 3;
266 sha1_compile(ctx);
267
268 /* extract the hash value as bytes in case the hash buffer is */
269 /* misaligned for 32-bit words */
270 for(i = 0; i < SHA1_DIGEST_SIZE; ++i)
271 hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3)));
272}
273
274void sha1(unsigned char hval[], const unsigned char data[], unsigned __int32 len)
275{ sha1_ctx cx[1];
276
277 sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx);
278}
279
280#if defined(__cplusplus)
281}
282#endif
diff --git a/src/Crypto/Sha1.h b/src/Crypto/Sha1.h
deleted file mode 100644
index 130a1a41..00000000
--- a/src/Crypto/Sha1.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 ---------------------------------------------------------------------------
3 Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
4
5 LICENSE TERMS
6
7 The free distribution and use of this software is allowed (with or without
8 changes) provided that:
9
10 1. source code distributions include the above copyright notice, this
11 list of conditions and the following disclaimer;
12
13 2. binary distributions include the above copyright notice, this list
14 of conditions and the following disclaimer in their documentation;
15
16 3. the name of the copyright holder is not used to endorse products
17 built using this software without specific written permission.
18
19 DISCLAIMER
20
21 This software is provided 'as is' with no explicit or implied warranties
22 in respect of its properties, including, but not limited to, correctness
23 and/or fitness for purpose.
24 ---------------------------------------------------------------------------
25 Issue Date: 26/08/2003
26*/
27
28#ifndef _SHA1_H
29#define _SHA1_H
30
31#include <limits.h>
32#include "Common/Tcdefs.h"
33
34#define SHA1_BLOCK_SIZE 64
35#define SHA1_DIGEST_SIZE 20
36
37#if defined(__cplusplus)
38extern "C"
39{
40#endif
41
42/* define an unsigned 32-bit type */
43
44#if defined(_MSC_VER)
45 typedef unsigned __int32 sha1_32t;
46#elif defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful
47 typedef unsigned __int32 sha1_32t;
48#elif defined(UINT_MAX) && UINT_MAX == 0xffffffff
49 typedef unsigned int sha1_32t;
50#else
51# error Please define sha1_32t as an unsigned 32 bit type in sha1.h
52#endif
53
54/* type to hold the SHA256 context */
55
56typedef struct
57{ sha1_32t count[2];
58 sha1_32t hash[5];
59 sha1_32t wbuf[16];
60} sha1_ctx;
61
62/* Note that these prototypes are the same for both bit and */
63/* byte oriented implementations. However the length fields */
64/* are in bytes or bits as appropriate for the version used */
65/* and bit sequences are input as arrays of bytes in which */
66/* bit sequences run from the most to the least significant */
67/* end of each byte */
68
69void sha1_compile(sha1_ctx ctx[1]);
70
71void sha1_begin(sha1_ctx ctx[1]);
72void sha1_hash(const unsigned char data[], unsigned __int32 len, sha1_ctx ctx[1]);
73void sha1_end(unsigned char hval[], sha1_ctx ctx[1]);
74void sha1(unsigned char hval[], const unsigned char data[], unsigned __int32 len);
75
76#if defined(__cplusplus)
77}
78#endif
79
80#endif
diff --git a/src/Driver/Driver.vcproj b/src/Driver/Driver.vcproj
index 7fe1d5fc..8d28d753 100644
--- a/src/Driver/Driver.vcproj
+++ b/src/Driver/Driver.vcproj
@@ -247,18 +247,6 @@
247 > 247 >
248 </File> 248 </File>
249 <File 249 <File
250 RelativePath="..\Crypto\Blowfish.c"
251 >
252 </File>
253 <File
254 RelativePath="..\Crypto\Cast.c"
255 >
256 </File>
257 <File
258 RelativePath="..\Crypto\Des.c"
259 >
260 </File>
261 <File
262 RelativePath="..\Crypto\Rmd160.c" 250 RelativePath="..\Crypto\Rmd160.c"
263 > 251 >
264 </File> 252 </File>
@@ -267,10 +255,6 @@
267 > 255 >
268 </File> 256 </File>
269 <File 257 <File
270 RelativePath="..\Crypto\Sha1.c"
271 >
272 </File>
273 <File
274 RelativePath="..\Crypto\Sha2.c" 258 RelativePath="..\Crypto\Sha2.c"
275 > 259 >
276 </File> 260 </File>
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 2c14010e..380cd04a 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -2808,9 +2808,6 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
2808 int size = EAGetKeySize (prop.ea); 2808 int size = EAGetKeySize (prop.ea);
2809 EAGetName (name, prop.ea); 2809 EAGetName (name, prop.ea);
2810 2810
2811 if (strcmp (name, "Triple DES") == 0) /* Deprecated/legacy */
2812 size -= 3; // Compensate for parity bytes
2813
2814 // Primary key 2811 // Primary key
2815 ListItemAddW (list, i, GetString ("KEY_SIZE")); 2812 ListItemAddW (list, i, GetString ("KEY_SIZE"));
2816 StringCbPrintfW (sw, sizeof(sw), L"%d %s", size * 8, GetString ("BITS")); 2813 StringCbPrintfW (sw, sizeof(sw), L"%d %s", size * 8, GetString ("BITS"));
@@ -2823,37 +2820,12 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
2823 ListItemAddW (list, i, GetString ("SECONDARY_KEY_SIZE_XTS")); 2820 ListItemAddW (list, i, GetString ("SECONDARY_KEY_SIZE_XTS"));
2824 ListSubItemSetW (list, i++, 1, sw); 2821 ListSubItemSetW (list, i++, 1, sw);
2825 } 2822 }
2826 else if (strcmp (EAGetModeName (prop.ea, prop.mode, TRUE), "LRW") == 0)
2827 {
2828 // Tweak key (LRW)
2829
2830 ListItemAddW (list, i, GetString ("SECONDARY_KEY_SIZE_LRW"));
2831 StringCbPrintfW (sw, sizeof(sw), L"%d %s", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8, GetString ("BITS"));
2832 ListSubItemSetW (list, i++, 1, sw);
2833 }
2834 } 2823 }
2835 2824
2836 // Block size 2825 // Block size
2837 ListItemAddW (list, i, GetString ("BLOCK_SIZE")); 2826 ListItemAddW (list, i, GetString ("BLOCK_SIZE"));
2838 if (EAGetFirstMode (prop.ea) == INNER_CBC) 2827
2839 { 2828 StringCbPrintfW (sw, sizeof(sw), L"%d ", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8);
2840 // Cascaded ciphers with non-equal block sizes (deprecated/legacy)
2841 wchar_t tmpstr[64];
2842 int i = EAGetLastCipher(prop.ea);
2843
2844 StringCbPrintfW (sw, sizeof(sw), L"%d", CipherGetBlockSize(i)*8);
2845
2846 while (i = EAGetPreviousCipher(prop.ea, i))
2847 {
2848 StringCbPrintfW (tmpstr, sizeof(tmpstr), L"/%d", CipherGetBlockSize(i)*8);
2849 StringCbCatW (sw, sizeof(sw), tmpstr);
2850 }
2851 StringCbCatW (sw, sizeof(sw), L" ");
2852 }
2853 else
2854 {
2855 StringCbPrintfW (sw, sizeof(sw), L"%d ", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8);
2856 }
2857 StringCbCatW (sw, sizeof(sw), GetString ("BITS")); 2829 StringCbCatW (sw, sizeof(sw), GetString ("BITS"));
2858 ListSubItemSetW (list, i++, 1, sw); 2830 ListSubItemSetW (list, i++, 1, sw);
2859 2831
@@ -3378,7 +3350,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
3378{ 3350{
3379 BOOL status = FALSE; 3351 BOOL status = FALSE;
3380 char fileName[MAX_PATH]; 3352 char fileName[MAX_PATH];
3381 int mounted = 0, modeOfOperation; 3353 int mounted = 0;
3382 3354
3383 bPrebootPasswordDlgMode = mountOptions.PartitionInInactiveSysEncScope; 3355 bPrebootPasswordDlgMode = mountOptions.PartitionInInactiveSysEncScope;
3384 3356
@@ -3443,14 +3415,6 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
3443 3415
3444 if (mounted) 3416 if (mounted)
3445 { 3417 {
3446 // Check for deprecated CBC mode
3447 modeOfOperation = GetModeOfOperationByDriveNo (nDosDriveNo);
3448 if (modeOfOperation == CBC || modeOfOperation == OUTER_CBC)
3449 Warning("WARN_CBC_MODE");
3450
3451 // Check for deprecated 64-bit-block ciphers
3452 if (GetCipherBlockSizeByDriveNo (nDosDriveNo) == 64)
3453 Warning("WARN_64_BIT_BLOCK_CIPHER");
3454 3418
3455 // Check for problematic file extensions (exe, dll, sys) 3419 // Check for problematic file extensions (exe, dll, sys)
3456 if (CheckFileExtension(szFileName)) 3420 if (CheckFileExtension(szFileName))
@@ -3479,15 +3443,6 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName)
3479 mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, bCacheInDriver, bForceMount, &mountOptions, Silent, !Silent); 3443 mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, bCacheInDriver, bForceMount, &mountOptions, Silent, !Silent);
3480 NormalCursor (); 3444 NormalCursor ();
3481 3445
3482 // Check for deprecated CBC mode
3483 modeOfOperation = GetModeOfOperationByDriveNo (nDosDriveNo);
3484 if (modeOfOperation == CBC || modeOfOperation == OUTER_CBC)
3485 Warning("WARN_CBC_MODE");
3486
3487 // Check for deprecated 64-bit-block ciphers
3488 if (GetCipherBlockSizeByDriveNo (nDosDriveNo) == 64)
3489 Warning("WARN_64_BIT_BLOCK_CIPHER");
3490
3491 // Check for legacy non-ASCII passwords 3446 // Check for legacy non-ASCII passwords
3492 if (mounted > 0 && !KeyFilesEnable && !CheckPasswordCharEncoding (NULL, &VolumePassword)) 3447 if (mounted > 0 && !KeyFilesEnable && !CheckPasswordCharEncoding (NULL, &VolumePassword))
3493 Warning ("UNSUPPORTED_CHARS_IN_PWD_RECOM"); 3448 Warning ("UNSUPPORTED_CHARS_IN_PWD_RECOM");
@@ -3701,8 +3656,8 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
3701{ 3656{
3702 HWND driveList = GetDlgItem (hwndDlg, IDC_DRIVELIST); 3657 HWND driveList = GetDlgItem (hwndDlg, IDC_DRIVELIST);
3703 int selDrive = ListView_GetSelectionMark (driveList); 3658 int selDrive = ListView_GetSelectionMark (driveList);
3704 BOOL shared = FALSE, status = FALSE, b64BitBlockCipher = FALSE, bCBCMode = FALSE, bHeaderBakRetry = FALSE; 3659 BOOL shared = FALSE, status = FALSE, bHeaderBakRetry = FALSE;
3705 int mountedVolCount = 0, modeOfOperation; 3660 int mountedVolCount = 0;
3706 vector <HostDevice> devices; 3661 vector <HostDevice> devices;
3707 3662
3708 VolumePassword.Length = 0; 3663 VolumePassword.Length = 0;
@@ -3808,13 +3763,6 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
3808 3763
3809 status = TRUE; 3764 status = TRUE;
3810 3765
3811 // Check for deprecated CBC mode
3812 modeOfOperation = GetModeOfOperationByDriveNo (nDosDriveNo);
3813 bCBCMode = (modeOfOperation == CBC || modeOfOperation == OUTER_CBC);
3814
3815 if (GetCipherBlockSizeByDriveNo(nDosDriveNo) == 64)
3816 b64BitBlockCipher = TRUE;
3817
3818 mountedVolCount++; 3766 mountedVolCount++;
3819 3767
3820 // Skip other partitions of the disk if partition0 (whole disk) has been mounted 3768 // Skip other partitions of the disk if partition0 (whole disk) has been mounted
@@ -3889,14 +3837,6 @@ static BOOL MountAllDevices (HWND hwndDlg, BOOL bPasswordPrompt)
3889 Info ("HIDVOL_PROT_WARN_AFTER_MOUNT"); 3837 Info ("HIDVOL_PROT_WARN_AFTER_MOUNT");
3890 } 3838 }
3891 3839
3892 // Check for deprecated CBC mode
3893 if (bCBCMode)
3894 Warning("WARN_CBC_MODE");
3895
3896 // Check for deprecated 64-bit-block ciphers
3897 if (b64BitBlockCipher)
3898 Warning("WARN_64_BIT_BLOCK_CIPHER");
3899
3900 // Check for legacy non-ASCII passwords 3840 // Check for legacy non-ASCII passwords
3901 if (!KeyFilesEnable 3841 if (!KeyFilesEnable
3902 && !FirstCmdKeyFile 3842 && !FirstCmdKeyFile
@@ -4664,7 +4604,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
4664 case WM_INITDIALOG: 4604 case WM_INITDIALOG:
4665 { 4605 {
4666 int exitCode = 0; 4606 int exitCode = 0;
4667 int modeOfOperation;
4668 4607
4669 MainDlg = hwndDlg; 4608 MainDlg = hwndDlg;
4670 4609
@@ -4833,15 +4772,6 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
4833 4772
4834 if(!Silent) 4773 if(!Silent)
4835 { 4774 {
4836 // Check for deprecated CBC mode
4837 modeOfOperation = GetModeOfOperationByDriveNo (szDriveLetter[0] - 'A');
4838 if (modeOfOperation == CBC || modeOfOperation == OUTER_CBC)
4839 Warning("WARN_CBC_MODE");
4840
4841 // Check for deprecated 64-bit-block ciphers
4842 if (GetCipherBlockSizeByDriveNo (szDriveLetter[0] - 'A') == 64)
4843 Warning("WARN_64_BIT_BLOCK_CIPHER");
4844
4845 // Check for problematic file extensions (exe, dll, sys) 4775 // Check for problematic file extensions (exe, dll, sys)
4846 if (CheckFileExtension (szFileName)) 4776 if (CheckFileExtension (szFileName))
4847 Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING"); 4777 Warning ("EXE_FILE_EXTENSION_MOUNT_WARNING");