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