Code Directory, runtime options, code segment and special structure hashes.
| 214 | |
| 215 | /// Code Directory, runtime options, code segment and special structure hashes. |
| 216 | class CodeSignCodeDirectory : public CodeSignBlob { |
| 217 | public: |
| 218 | enum Slot { |
| 219 | SLOT_INFO_PLIST = -1, |
| 220 | SLOT_REQUIREMENTS = -2, |
| 221 | SLOT_RESOURCES = -3, |
| 222 | SLOT_APP_SPECIFIC = -4, ///< Unused. |
| 223 | SLOT_ENTITLEMENTS = -5, |
| 224 | SLOT_RESERVER1 = -6, ///< Unused. |
| 225 | SLOT_DER_ENTITLEMENTS = -7, |
| 226 | }; |
| 227 | |
| 228 | enum CodeSignExecSegFlags { |
| 229 | EXECSEG_MAIN_BINARY = 0x1, |
| 230 | EXECSEG_ALLOW_UNSIGNED = 0x10, |
| 231 | EXECSEG_DEBUGGER = 0x20, |
| 232 | EXECSEG_JIT = 0x40, |
| 233 | EXECSEG_SKIP_LV = 0x80, |
| 234 | EXECSEG_CAN_LOAD_CDHASH = 0x100, |
| 235 | EXECSEG_CAN_EXEC_CDHASH = 0x200, |
| 236 | }; |
| 237 | |
| 238 | enum CodeSignatureFlags { |
| 239 | SIGNATURE_HOST = 0x0001, |
| 240 | SIGNATURE_ADHOC = 0x0002, |
| 241 | SIGNATURE_TASK_ALLOW = 0x0004, |
| 242 | SIGNATURE_INSTALLER = 0x0008, |
| 243 | SIGNATURE_FORCED_LV = 0x0010, |
| 244 | SIGNATURE_INVALID_ALLOWED = 0x0020, |
| 245 | SIGNATURE_FORCE_HARD = 0x0100, |
| 246 | SIGNATURE_FORCE_KILL = 0x0200, |
| 247 | SIGNATURE_FORCE_EXPIRATION = 0x0400, |
| 248 | SIGNATURE_RESTRICT = 0x0800, |
| 249 | SIGNATURE_ENFORCEMENT = 0x1000, |
| 250 | SIGNATURE_LIBRARY_VALIDATION = 0x2000, |
| 251 | SIGNATURE_ENTITLEMENTS_VALIDATED = 0x4000, |
| 252 | SIGNATURE_NVRAM_UNRESTRICTED = 0x8000, |
| 253 | SIGNATURE_RUNTIME = 0x10000, |
| 254 | SIGNATURE_LINKER_SIGNED = 0x20000, |
| 255 | }; |
| 256 | |
| 257 | private: |
| 258 | PackedByteArray blob; |
| 259 | |
| 260 | struct CodeDirectoryHeader { |
| 261 | uint32_t version; ///< Using version 0x0020500. |
| 262 | uint32_t flags; ///< Option flags. |
| 263 | uint32_t hash_offset; ///< Slot zero offset. |
| 264 | uint32_t ident_offset; ///< Identifier string offset. |
| 265 | uint32_t special_slots; ///< Nr. of slots with negative index. |
| 266 | uint32_t code_slots; ///< Nr. of slots with index >= 0, (code_limit / page_size). |
| 267 | uint32_t code_limit; ///< Everything before code signature load command offset. |
| 268 | uint8_t hash_size; ///< 20 (SHA-1) or 32 (SHA-256). |
| 269 | uint8_t hash_type; ///< 1 (SHA-1) or 2 (SHA-256). |
| 270 | uint8_t platform; ///< Not used. |
| 271 | uint8_t page_size; ///< Page size, power of two, 2^12 (4096). |
| 272 | uint32_t spare2; ///< Not used. |
| 273 | // Version 0x20100 |