|
|
1.1.1.2 root 1: /*
2: Copyright (c) TrueCrypt Foundation. All rights reserved.
1.1 root 3:
1.1.1.3 ! root 4: Covered by the TrueCrypt License 2.3 the full text of which is contained
1.1.1.2 root 5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
1.1 root 7: */
8:
9: #define TC_REQUIRED_MOUSE_EVENTS 5000
10: #define TC_REQUIRED_KEYSTROKES RNG_POOL_SIZE
11:
12: #define TC_MAX_VOLUMES 256
13: #define TC_MAX_MINOR 256
14:
15: #define TC_MAP_DEV "/dev/mapper/truecrypt"
16: #define TC_LOOP_DEV "/dev/loop"
17: #define TC_MICE_DEVICE "/dev/input/mice"
18: #define TC_SHARE_KERNEL "/usr/share/truecrypt/kernel"
19:
20: #ifdef TC_MAX_PATH
21: #undef TC_MAX_PATH
22: #endif
23: #define TC_MAX_PATH 260
24: #define TC_MAX_PATH_STR "259"
25:
1.1.1.2 root 26: #define error(fmt, args...) IsTerminal ? fprintf (stderr, fmt, ## args) : fprintf (stderr, "truecrypt: " fmt, ## args)
1.1 root 27:
28: typedef struct
29: {
30: int DeviceNumber;
31: int DeviceMajor;
32: int DeviceMinor;
33: unsigned long long VolumeSize;
34: char VolumePath[TC_MAX_PATH];
35: int EA;
36: int Mode;
37: BOOL Hidden;
38: unsigned long long ReadOnlyStart;
39: unsigned long long ReadOnlyEnd;
1.1.1.2 root 40: unsigned long long UserId;
1.1 root 41: unsigned long long ModTime;
42: unsigned long long AcTime;
43: int Flags;
44: } MountListEntry;
45:
1.1.1.3 ! root 46: static BOOL CheckAdminPrivileges (int argc, char **argv);
1.1 root 47: static BOOL LockMemory ();
48: static BOOL WaitChild (BOOL quiet, char *execName);
49: static BOOL Execute (BOOL quiet, char *execName, ...);
50: static BOOL IsFile (char *path);
51: static BOOL IsBlockDevice (char *path);
52: static BOOL RestoreFileTime (char *path, time_t modTime, time_t acTime);
53: static BOOL LoadKernelModule ();
54: static BOOL UnloadKernelModule (BOOL quiet);
55: static BOOL CheckKernelModuleVersion (BOOL wait, BOOL quiet);
56: static void OpenMiceDevice ();
57: static BOOL GetMountList (BOOL force);
1.1.1.2 root 58: static BOOL IsMountPointAvailable (char *mountPoint);
1.1 root 59: static BOOL IsVolumeMounted (char *volumePath);
60: static int GetFreeMapDevice ();
61: static BOOL DeleteLoopDevice (int loopDeviceNo);
62: static int AskSelection (int defaultChoice, int min, int max);
63: static BOOL AskYesNo (char *prompt, BOOL defaultNo);
64: static char *AskString (char *prompt, char *buf, int maxSize);
1.1.1.3 ! root 65: static void AskPassword (char *prompt, char *volumePath, Password *password, BOOL requireAscii);
1.1 root 66: static char *AskVolumePath (char *volumePath, char *prompt);
67: static BOOL AskKeyFiles (char *prompt, KeyFile **firstKeyFile);
68: static BOOL OpenVolume (char *volumePath, char *prompt, char *promptArg, BOOL secondaryPassword, PCRYPTO_INFO *cryptoInfo, unsigned long long *startSector, unsigned long long *totalSectors, time_t *modTime, time_t *acTime);
69: static char *EscapeSpaces (char *string);
70: static BOOL MountVolume (char *volumePath, char *mountPoint);
71: static void HexDump (unsigned __int8 *data, unsigned int length);
72: static uint64_t GetTimeUsec ();
73: static double GetTime ();
74: static BOOL RandFillPool ();
75: static BOOL ParseSize (char *string, unsigned long long *size);
76: static BOOL CreateVolume (char *hostPath);
77: static BOOL ChangePassword (char *volumePath);
78: static BOOL BackupVolumeHeaders (char *backupFile, char *volumePath);
79: static BOOL RestoreVolumeHeader (char *backupFile, char *volumePath);
80: static BOOL CreateKeyfile (char *path);
81: static time_t WindowsFileTime2UnixTime (uint64_t wTime);
82: static BOOL DumpVolumeProperties (char *volumePath);
83: static void DumpVersion (FILE *f);
84: static void DumpUsage (FILE *f);
85: static void DumpHelp ();
86: static BOOL DumpMountList (int devNo);
87: static BOOL DismountFileSystem (char *device);
88: static BOOL DismountVolume (int devNo);
1.1.1.2 root 89: static BOOL EnumMountPoints (char *device, char *mountPoint);
1.1 root 90: static BOOL ToDeviceNumber (char *text, int *deviceNumber);
1.1.1.3 ! root 91: static BOOL ValidatePassword (Password *password, BOOL requireAscii);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.