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.
This commit is contained in:
Tristan Gingold 2011-12-16 10:23:01 +00:00
parent 08e4b6acb7
commit 6625879aa6
2 changed files with 89 additions and 0 deletions

View File

@ -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

85
include/mach-o/codesign.h Normal file
View File

@ -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 */