1 /* Mach-O support for BFD.
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
22 #ifndef _MACH_O_CODESIGN_H
23 #define _MACH_O_CODESIGN_H
25 /* Codesign blob magics. */
27 /* Superblob containing all the components. */
28 #define BFD_MACH_O_CS_MAGIC_EMBEDDED_SIGNATURE 0xfade0cc0
30 /* Individual code requirement. */
31 #define BFD_MACH_O_CS_MAGIC_REQUIREMENT 0xfade0c00
33 /* Collection of code requirements, indexed by type. */
34 #define BFD_MACH_O_CS_MAGIC_REQUIREMENTS 0xfade0c01
37 #define BFD_MACH_O_CS_MAGIC_CODEDIRECTORY 0xfade0c02
39 /* Entitlements blob. */
40 #define BFD_MACH_O_CS_MAGIC_EMBEDDED_ENTITLEMENTS 0xfade7171
43 #define BFD_MACH_O_CS_MAGIC_BLOB_WRAPPER 0xfade0b01
45 struct mach_o_codesign_codedirectory_external_v1
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];
62 struct mach_o_codesign_codedirectory_v1
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
;
74 unsigned char page_size
;
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 */
85 #endif /* _MACH_O_CODESIGN_H */