|
|
1.1 root 1: /*
2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
3:
1.1.1.4 ! root 4: Governed by the TrueCrypt License 2.5 the full text of which is contained
1.1 root 5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
7: */
8:
1.1.1.3 root 9: #ifndef TC_HEADER_Boot_BootDefs
10: #define TC_HEADER_Boot_BootDefs
11:
1.1.1.2 root 12: // Total memory required (CODE + DATA + BSS + STACK + 0x100) in KBytes - determined from linker map.
13: #define TC__BOOT_MEMORY_REQUIRED 42
1.1 root 14:
1.1.1.3 root 15: #ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
16: # undef TC__BOOT_MEMORY_REQUIRED
17:
18: # ifdef TC_WINDOWS_BOOT_AES
1.1.1.4 ! root 19: # ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
! 20: # define TC__BOOT_MEMORY_REQUIRED 28
! 21: # else
! 22: # define TC__BOOT_MEMORY_REQUIRED 27
! 23: # endif
1.1.1.3 root 24: # elif defined (TC_WINDOWS_BOOT_SERPENT)
25: # define TC__BOOT_MEMORY_REQUIRED 32
26: # elif defined (TC_WINDOWS_BOOT_TWOFISH)
27: # define TC__BOOT_MEMORY_REQUIRED 40
28: # endif
29:
30: #endif
31:
1.1 root 32: // Windows Vista boot loader uses memory up to 8000:FFFF, disregarding the BIOS memory map and the amount
1.1.1.3 root 33: // of available memory at 40:0013. Therefore, the code has to be loaded at or above 9000:0000.
1.1 root 34:
35: // Modifying this value can introduce incompatibility with previous versions
1.1.1.3 root 36: #define TC__BOOT_LOADER_SEGMENT TC_HEX (9000)
37: #define TC__COM_EXECUTABLE_OFFSET TC_HEX (100)
1.1 root 38:
1.1.1.3 root 39: #define TC__BOOT_LOADER_LOWMEM_SEGMENT TC_HEX (2000)
40: #define TC__BOOT_LOADER_BUFFER_SEGMENT TC_HEX (5000)
1.1 root 41:
1.1.1.3 root 42: #define TC__BOOT_LOADER_STACK_TOP (TC_BOOT_MEMORY_REQUIRED * TC_UNSIGNED (1024) - 4)
43:
44: #define TC__LB_SIZE 512
1.1 root 45: #define TC__BOOT_LOADER_AREA_SECTOR_COUNT 63
46:
1.1.1.3 root 47: #define TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET 432
48: #define TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET 434
1.1.1.4 ! root 49: #define TC__BOOT_SECTOR_CONFIG_OFFSET 439 // The last byte that is reserved for the boot loader
1.1 root 50:
1.1.1.3 root 51: #define TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR 2
52: #define TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT 4
53: #define TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE 32768
54: #define TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET (TC_COM_EXECUTABLE_OFFSET + 3072)
55:
56: #define TC__BOOT_LOADER_START_SECTOR (TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT)
57: #define TC__MAX_BOOT_LOADER_SECTOR_COUNT (TC_BOOT_LOADER_AREA_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT - 2)
58: #define TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE ((TC_BOOT_LOADER_AREA_SECTOR_COUNT - 2) * TC_LB_SIZE)
59:
60: #define TC__BOOT_LOADER_BACKUP_SECTOR_COUNT 30
61:
62: #define TC__GZIP_HEADER_SIZE 10
63:
1.1.1.4 ! root 64: #define TC__BOOT_CFG_FLAG_AREA_SIZE 1 // In bytes
! 65:
! 66: // If you add more flags, revise TC__BOOT_CFG_FLAG_AREA_SIZE
1.1.1.3 root 67: #define TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC_HEX (02)
68: #define TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC_HEX (04)
69: #define TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC_HEX (20)
70:
1.1.1.4 ! root 71: #define TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE (TC_HEX (40) + TC_HEX (80))
! 72:
! 73: // The following items are treated as a 2-bit value (apply TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE to obtain the value)
! 74: #define TC__HIDDEN_OS_CREATION_PHASE_NONE 0
! 75: #define TC__HIDDEN_OS_CREATION_PHASE_CLONING TC_HEX (40) // The boot loader is to copy the content of the system partition to the hidden volume
! 76: #define TC__HIDDEN_OS_CREATION_PHASE_DECOY_OS TC_HEX (80) // The boot loader has successfully copied the content of the system partition to the hidden volume (the decoy OS is to be encrypted now)
! 77: #define TC__HIDDEN_OS_CREATION_PHASE_RESERVED (TC_HEX (40) + TC_HEX (80)) // Reserved for possible future use
! 78:
1.1.1.3 root 79:
1.1 root 80: #ifdef TC_ASM_PREPROCESS
81:
82: #define TC_HEX(N) 0##N##h
1.1.1.3 root 83: #define TC_UNSIGNED(N) N
1.1 root 84:
85: TC_BOOT_MEMORY_REQUIRED = TC__BOOT_MEMORY_REQUIRED
86: TC_BOOT_LOADER_SEGMENT = TC__BOOT_LOADER_SEGMENT
1.1.1.3 root 87: TC_COM_EXECUTABLE_OFFSET = TC__COM_EXECUTABLE_OFFSET
1.1 root 88: TC_BOOT_LOADER_LOWMEM_SEGMENT = TC__BOOT_LOADER_LOWMEM_SEGMENT
1.1.1.3 root 89: TC_BOOT_LOADER_BUFFER_SEGMENT = TC__BOOT_LOADER_BUFFER_SEGMENT
90: TC_BOOT_LOADER_STACK_TOP = TC__BOOT_LOADER_STACK_TOP
91: TC_LB_SIZE = TC__LB_SIZE
1.1 root 92: TC_BOOT_LOADER_AREA_SECTOR_COUNT = TC__BOOT_LOADER_AREA_SECTOR_COUNT
1.1.1.3 root 93: TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET = TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
94: TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET = TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
1.1 root 95: TC_BOOT_SECTOR_CONFIG_OFFSET = TC__BOOT_SECTOR_CONFIG_OFFSET
1.1.1.3 root 96: TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR = TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
97: TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT = TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
98: TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE = TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
99: TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET = TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
100: TC_BOOT_LOADER_START_SECTOR = TC__BOOT_LOADER_START_SECTOR
101: TC_MAX_BOOT_LOADER_SECTOR_COUNT = TC__MAX_BOOT_LOADER_SECTOR_COUNT
102: TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE = TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
103: TC_BOOT_LOADER_BACKUP_SECTOR_COUNT = TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
104: TC_GZIP_HEADER_SIZE = TC__GZIP_HEADER_SIZE
1.1.1.4 ! root 105: TC_BOOT_CFG_FLAG_AREA_SIZE = TC__BOOT_CFG_FLAG_AREA_SIZE
1.1.1.3 root 106: TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE = TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
107: TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER = TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
108: TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER = TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
1.1.1.4 ! root 109: TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE = TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
! 110: TC_HIDDEN_OS_CREATION_PHASE_NONE = TC__HIDDEN_OS_CREATION_PHASE_NONE
! 111: TC_HIDDEN_OS_CREATION_PHASE_CLONING = TC__HIDDEN_OS_CREATION_PHASE_CLONING
! 112: TC_HIDDEN_OS_CREATION_PHASE_DECOY_OS = TC__HIDDEN_OS_CREATION_PHASE_DECOY_OS
1.1 root 113:
1.1.1.4 ! root 114: #else // TC_ASM_PREPROCESS
1.1 root 115:
116: #define TC_HEX(N) 0x##N
1.1.1.3 root 117: #define TC_UNSIGNED(N) N##U
1.1 root 118:
119: #define TC_BOOT_MEMORY_REQUIRED TC__BOOT_MEMORY_REQUIRED
120: #define TC_BOOT_LOADER_SEGMENT TC__BOOT_LOADER_SEGMENT
1.1.1.3 root 121: #define TC_COM_EXECUTABLE_OFFSET TC__COM_EXECUTABLE_OFFSET
1.1 root 122: #define TC_BOOT_LOADER_LOWMEM_SEGMENT TC__BOOT_LOADER_LOWMEM_SEGMENT
123: #define TC_BOOT_LOADER_BUFFER_SEGMENT TC__BOOT_LOADER_BUFFER_SEGMENT
1.1.1.3 root 124: #define TC_BOOT_LOADER_STACK_TOP (TC__BOOT_LOADER_STACK_TOP)
1.1 root 125: #define TC_BOOT_LOADER_AREA_SECTOR_COUNT TC__BOOT_LOADER_AREA_SECTOR_COUNT
1.1.1.3 root 126: #define TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
127: #define TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
128: #define TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
129: #define TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
1.1 root 130: #define TC_BOOT_SECTOR_CONFIG_OFFSET TC__BOOT_SECTOR_CONFIG_OFFSET
1.1.1.3 root 131: #define TC_BOOT_LOADER_START_SECTOR TC__BOOT_LOADER_START_SECTOR
132: #define TC_LB_SIZE TC__LB_SIZE
133: #define TC_MAX_BOOT_LOADER_SECTOR_COUNT TC__MAX_BOOT_LOADER_SECTOR_COUNT
134: #define TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
135: #define TC_BOOT_LOADER_BACKUP_SECTOR_COUNT TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
136: #define TC_GZIP_HEADER_SIZE TC__GZIP_HEADER_SIZE
1.1.1.4 ! root 137: #define TC_BOOT_CFG_FLAG_AREA_SIZE TC__BOOT_CFG_FLAG_AREA_SIZE
1.1.1.3 root 138: #define TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
139: #define TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
140: #define TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
1.1.1.4 ! root 141: #define TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
! 142: #define TC_HIDDEN_OS_CREATION_PHASE_NONE TC__HIDDEN_OS_CREATION_PHASE_NONE
! 143: #define TC_HIDDEN_OS_CREATION_PHASE_CLONING TC__HIDDEN_OS_CREATION_PHASE_CLONING
! 144: #define TC_HIDDEN_OS_CREATION_PHASE_DECOY_OS TC__HIDDEN_OS_CREATION_PHASE_DECOY_OS
1.1 root 145:
1.1.1.4 ! root 146: #endif // TC_ASM_PREPROCESS
1.1.1.3 root 147:
148: #endif // TC_HEADER_Boot_BootDefs
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.