|
|
1.1.1.2 ! root 1: /* ! 2: Copyright (c) TrueCrypt Foundation. All rights reserved. 1.1 root 3: 1.1.1.2 ! root 4: Covered by the TrueCrypt License 2.2 the full text of which is contained ! 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: 46: static BOOL CheckAdminPrivileges (); 47: static void DropEffectiveUserId (); 48: static BOOL LockMemory (); 49: static BOOL WaitChild (BOOL quiet, char *execName); 50: static BOOL Execute (BOOL quiet, char *execName, ...); 51: static BOOL IsFile (char *path); 52: static BOOL IsBlockDevice (char *path); 53: static BOOL RestoreFileTime (char *path, time_t modTime, time_t acTime); 54: static BOOL LoadKernelModule (); 55: static BOOL UnloadKernelModule (BOOL quiet); 56: static BOOL CheckKernelModuleVersion (BOOL wait, BOOL quiet); 57: static void OpenMiceDevice (); 58: static BOOL GetMountList (BOOL force); 1.1.1.2 ! root 59: static BOOL IsMountPointAvailable (char *mountPoint); 1.1 root 60: static BOOL IsVolumeMounted (char *volumePath); 61: static int GetFreeMapDevice (); 62: static BOOL DeleteLoopDevice (int loopDeviceNo); 63: static int AskSelection (int defaultChoice, int min, int max); 64: static BOOL AskYesNo (char *prompt, BOOL defaultNo); 65: static char *AskString (char *prompt, char *buf, int maxSize); 66: static void AskPassword (char *prompt, char *volumePath, Password *password); 67: static char *AskVolumePath (char *volumePath, char *prompt); 68: static BOOL AskKeyFiles (char *prompt, KeyFile **firstKeyFile); 69: 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); 70: static char *EscapeSpaces (char *string); 71: static BOOL MountVolume (char *volumePath, char *mountPoint); 72: static void HexDump (unsigned __int8 *data, unsigned int length); 73: static uint64_t GetTimeUsec (); 74: static double GetTime (); 75: static BOOL RandFillPool (); 76: static BOOL ParseSize (char *string, unsigned long long *size); 77: static BOOL CreateVolume (char *hostPath); 78: static BOOL ChangePassword (char *volumePath); 79: static BOOL BackupVolumeHeaders (char *backupFile, char *volumePath); 80: static BOOL RestoreVolumeHeader (char *backupFile, char *volumePath); 81: static BOOL CreateKeyfile (char *path); 82: static time_t WindowsFileTime2UnixTime (uint64_t wTime); 83: static BOOL DumpVolumeProperties (char *volumePath); 84: static void DumpVersion (FILE *f); 85: static void DumpUsage (FILE *f); 86: static void DumpHelp (); 87: static BOOL DumpMountList (int devNo); 88: static BOOL DismountFileSystem (char *device); 89: static BOOL DismountVolume (int devNo); 1.1.1.2 ! root 90: static BOOL EnumMountPoints (char *device, char *mountPoint); 1.1 root 91: static BOOL ToDeviceNumber (char *text, int *deviceNumber); 1.1.1.2 ! root 92: static BOOL ValidatePassword (Password *password);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.