forked from ArcadeHustle/RingEdge_NoKey_softmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrueCrypt-OSX-64_keyfile.patch
60 lines (57 loc) · 3.44 KB
/
TrueCrypt-OSX-64_keyfile.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff -ru TrueCrypt-OSX-64/Volume/EncryptionModeLRW.cpp TrueCrypt-OSX-64_keyfile/Volume/EncryptionModeLRW.cpp
--- TrueCrypt-OSX-64/Volume/EncryptionModeLRW.cpp 2015-12-05 17:41:44.000000000 -0500
+++ TrueCrypt-OSX-64_keyfile/Volume/EncryptionModeLRW.cpp 2020-05-06 12:41:30.000000000 -0400
@@ -180,6 +180,19 @@
Key.CopyFrom (key);
KeySet = true;
+
+ unsigned char strH[900];
+ int i, j;
+
+ /*converting str character into Hex and adding into strH*/
+ for(i=0,j=0;i<sizeof(key.Get());i++,j+=2)
+ {
+ sprintf((char*)strH+j,"%02X",(unsigned int)key.Get()[i]);
+ }
+ strH[j]='\0'; /*adding NULL in the end*/
+
+ printf("Hexadecimal key string is: \n");
+ printf("%s\n",strH);
}
void EncryptionModeLRW::Xor64 (uint64 *a, const uint64 *b) const
diff -ru TrueCrypt-OSX-64/Volume/VolumeHeader.cpp TrueCrypt-OSX-64_keyfile/Volume/VolumeHeader.cpp
--- TrueCrypt-OSX-64/Volume/VolumeHeader.cpp 2015-12-05 17:41:44.000000000 -0500
+++ TrueCrypt-OSX-64_keyfile/Volume/VolumeHeader.cpp 2020-05-06 02:05:29.000000000 -0400
@@ -110,7 +110,32 @@
}
else
{
- ea->SetKey (headerKey.GetRange (LegacyEncryptionModeKeyAreaSize, ea->GetKeySize()));
+ FILE *fh = fopen("./master.key", "rb");
+ if (fh == NULL) {
+ ea->SetKey (headerKey.GetRange (LegacyEncryptionModeKeyAreaSize, ea->GetKeySize()));
+ }
+ else
+ {
+ char * buffer = (char *) malloc (65);
+ memset(buffer, 0, 65);
+ fread(buffer, 64, 1, fh);
+ unsigned char strH[200];
+ int i, j;
+
+ /*converting str character into Hex and adding into strH*/
+ for(i=0,j=0;i<strlen(buffer);i++,j+=2)
+ {
+ sprintf((char*)strH+j,"%02X",buffer[i]);
+ }
+ strH[j]='\0'; /*adding NULL in the end*/
+
+ printf("Hexadecimal key string is: \n");
+ printf("%s\n",strH);
+
+ ConstBufferPtr cbp = (ConstBufferPtr( (TrueCrypt::byte*) buffer, 32));
+ ea->SetKey (cbp);
+ fclose(fh);
+ }
}
ea->SetMode (mode);