Commit | Line | Data |
---|---|---|
2634e8c8 TG |
1 | /* Mach-O support for BFD. |
2 | Copyright 2011 | |
3 | Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
20 | MA 02110-1301, USA. */ | |
21 | ||
22 | #ifndef _MACH_O_CODESIGN_H | |
23 | #define _MACH_O_CODESIGN_H | |
24 | ||
25 | /* Codesign blob magics. */ | |
26 | ||
27 | /* Superblob containing all the components. */ | |
28 | #define BFD_MACH_O_CS_MAGIC_EMBEDDED_SIGNATURE 0xfade0cc0 | |
29 | ||
30 | /* Individual code requirement. */ | |
31 | #define BFD_MACH_O_CS_MAGIC_REQUIREMENT 0xfade0c00 | |
32 | ||
33 | /* Collection of code requirements, indexed by type. */ | |
34 | #define BFD_MACH_O_CS_MAGIC_REQUIREMENTS 0xfade0c01 | |
35 | ||
36 | /* Directory. */ | |
37 | #define BFD_MACH_O_CS_MAGIC_CODEDIRECTORY 0xfade0c02 | |
38 | ||
39 | /* Entitlements blob. */ | |
40 | #define BFD_MACH_O_CS_MAGIC_EMBEDDED_ENTITLEMENTS 0xfade7171 | |
41 | ||
42 | /* Blob container. */ | |
43 | #define BFD_MACH_O_CS_MAGIC_BLOB_WRAPPER 0xfade0b01 | |
44 | ||
45 | struct mach_o_codesign_codedirectory_external_v1 | |
46 | { | |
47 | /* All the fields are in network byte order (big endian). */ | |
48 | unsigned char version[4]; | |
49 | unsigned char flags[4]; | |
50 | unsigned char hash_offset[4]; | |
51 | unsigned char ident_offset[4]; | |
52 | unsigned char nbr_special_slots[4]; | |
53 | unsigned char nbr_code_slots[4]; | |
54 | unsigned char code_limit[4]; | |
55 | unsigned char hash_size[1]; | |
56 | unsigned char hash_type[1]; | |
57 | unsigned char spare1[1]; | |
58 | unsigned char page_size[1]; | |
59 | unsigned char spare2[4]; | |
60 | }; | |
61 | ||
62 | struct mach_o_codesign_codedirectory_v1 | |
63 | { | |
64 | unsigned int version; | |
65 | unsigned int flags; | |
66 | unsigned int hash_offset; | |
67 | unsigned int ident_offset; | |
68 | unsigned int nbr_special_slots; | |
69 | unsigned int nbr_code_slots; | |
70 | unsigned int code_limit; | |
71 | unsigned char hash_size; | |
72 | unsigned char hash_type; | |
73 | unsigned char spare1; | |
74 | unsigned char page_size; | |
75 | unsigned int spare2; | |
76 | }; | |
77 | ||
78 | /* Value for hash_type. */ | |
79 | #define BFD_MACH_O_CS_NO_HASH 0 | |
80 | #define BFD_MACH_O_CS_HASH_SHA1 1 | |
81 | #define BFD_MACH_O_CS_HASH_SHA256 2 | |
82 | #define BFD_MACH_O_CS_HASH_PRESTANDARD_SKEIN_160x256 32 /* Skein, 160 bits */ | |
83 | #define BFD_MACH_O_CS_HASH_PRESTANDARD_SKEIN_256x512 33 /* Skein, 256 bits */ | |
84 | ||
85 | #endif /* _MACH_O_CODESIGN_H */ |