diff options
author | Tristan Gingold <gingold@adacore.com> | 2011-12-16 10:23:01 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2011-12-16 10:23:01 +0000 |
commit | 2634e8c8ff4e4f253723a34a696d8568109d3f10 (patch) | |
tree | 67bec0d3c5a14ef2271ea0128b070bf6a9a599c7 /include/mach-o | |
parent | fb35d3d8fae4422243d6803c41b5cb4d2f5e5e2a (diff) | |
download | gdb-2634e8c8ff4e4f253723a34a696d8568109d3f10.zip gdb-2634e8c8ff4e4f253723a34a696d8568109d3f10.tar.gz gdb-2634e8c8ff4e4f253723a34a696d8568109d3f10.tar.bz2 |
binutils/
2011-12-16 Tristan Gingold <gingold@adacore.com>
* od-macho.c: Include mach-o/codesign.h
(OPT_CODESIGN): Define.
(options): Add an entry for codesign.
(mach_o_help): Likewise.
(dump_header): Fix indentation.
(dump_thread): Do not test result of xmalloc.
(bfd_mach_o_cs_magic, bfd_mach_o_cs_hash_type): New.
(dump_code_signature_superblob): New function.
(swap_code_codedirectory_v1_in): Likewise.
(hexdump): Likewise.
(dump_code_signature_codedirectory): Likewise.
(dump_code_signature_blob, dump_code_signature): Likewise.
(dump_load_command): Dump code signature.
(mach_o_dump): Likewise.
include/mach-o/
2011-12-16 Tristan Gingold <gingold@adacore.com>
* codesign.h: New file.
Diffstat (limited to 'include/mach-o')
-rw-r--r-- | include/mach-o/ChangeLog | 4 | ||||
-rw-r--r-- | include/mach-o/codesign.h | 85 |
2 files changed, 89 insertions, 0 deletions
diff --git a/include/mach-o/ChangeLog b/include/mach-o/ChangeLog index 2276d01..9e51505 100644 --- a/include/mach-o/ChangeLog +++ b/include/mach-o/ChangeLog @@ -1,3 +1,7 @@ +2011-12-16 Tristan Gingold <gingold@adacore.com> + + * codesign.h: New file. + 2011-08-08 Tristan Gingold <gingold@adacore.com> * loader.h (bfd_mach_o_load_command_type): Add diff --git a/include/mach-o/codesign.h b/include/mach-o/codesign.h new file mode 100644 index 0000000..ee2f792 --- /dev/null +++ b/include/mach-o/codesign.h @@ -0,0 +1,85 @@ +/* Mach-O support for BFD. + Copyright 2011 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef _MACH_O_CODESIGN_H +#define _MACH_O_CODESIGN_H + +/* Codesign blob magics. */ + +/* Superblob containing all the components. */ +#define BFD_MACH_O_CS_MAGIC_EMBEDDED_SIGNATURE 0xfade0cc0 + +/* Individual code requirement. */ +#define BFD_MACH_O_CS_MAGIC_REQUIREMENT 0xfade0c00 + +/* Collection of code requirements, indexed by type. */ +#define BFD_MACH_O_CS_MAGIC_REQUIREMENTS 0xfade0c01 + +/* Directory. */ +#define BFD_MACH_O_CS_MAGIC_CODEDIRECTORY 0xfade0c02 + +/* Entitlements blob. */ +#define BFD_MACH_O_CS_MAGIC_EMBEDDED_ENTITLEMENTS 0xfade7171 + +/* Blob container. */ +#define BFD_MACH_O_CS_MAGIC_BLOB_WRAPPER 0xfade0b01 + +struct mach_o_codesign_codedirectory_external_v1 +{ + /* All the fields are in network byte order (big endian). */ + unsigned char version[4]; + unsigned char flags[4]; + unsigned char hash_offset[4]; + unsigned char ident_offset[4]; + unsigned char nbr_special_slots[4]; + unsigned char nbr_code_slots[4]; + unsigned char code_limit[4]; + unsigned char hash_size[1]; + unsigned char hash_type[1]; + unsigned char spare1[1]; + unsigned char page_size[1]; + unsigned char spare2[4]; +}; + +struct mach_o_codesign_codedirectory_v1 +{ + unsigned int version; + unsigned int flags; + unsigned int hash_offset; + unsigned int ident_offset; + unsigned int nbr_special_slots; + unsigned int nbr_code_slots; + unsigned int code_limit; + unsigned char hash_size; + unsigned char hash_type; + unsigned char spare1; + unsigned char page_size; + unsigned int spare2; +}; + +/* Value for hash_type. */ +#define BFD_MACH_O_CS_NO_HASH 0 +#define BFD_MACH_O_CS_HASH_SHA1 1 +#define BFD_MACH_O_CS_HASH_SHA256 2 +#define BFD_MACH_O_CS_HASH_PRESTANDARD_SKEIN_160x256 32 /* Skein, 160 bits */ +#define BFD_MACH_O_CS_HASH_PRESTANDARD_SKEIN_256x512 33 /* Skein, 256 bits */ + +#endif /* _MACH_O_CODESIGN_H */ |