1139749Simp/* Mach-O support for BFD.
250770Sdfr   Copyright (C) 2011-2022 Free Software Foundation, Inc.
350770Sdfr
450770Sdfr   This file is part of BFD, the Binary File Descriptor library.
550770Sdfr
650770Sdfr   This program is free software; you can redistribute it and/or modify
750770Sdfr   it under the terms of the GNU General Public License as published by
850770Sdfr   the Free Software Foundation; either version 3 of the License, or
950770Sdfr   (at your option) any later version.
1050770Sdfr
1150770Sdfr   This program is distributed in the hope that it will be useful,
1250770Sdfr   but WITHOUT ANY WARRANTY; without even the implied warranty of
1350770Sdfr   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1450770Sdfr   GNU General Public License for more details.
1550770Sdfr
1650770Sdfr   You should have received a copy of the GNU General Public License
1750770Sdfr   along with this program; if not, write to the Free Software
1850770Sdfr   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
1950770Sdfr   MA 02110-1301, USA.  */
2050770Sdfr
2150770Sdfr#ifndef _MACH_O_CODESIGN_H
2250770Sdfr#define _MACH_O_CODESIGN_H
2350770Sdfr
2450770Sdfr/* Codesign blob magics.  */
2550770Sdfr
2650770Sdfr/* Superblob containing all the components.  */
2750959Speter#define BFD_MACH_O_CS_MAGIC_EMBEDDED_SIGNATURE 0xfade0cc0
2850770Sdfr
2950770Sdfr/* Individual code requirement.  */
3070355Simp#define BFD_MACH_O_CS_MAGIC_REQUIREMENT 0xfade0c00
3170355Simp
3250770Sdfr/* Collection of code requirements, indexed by type.  */
3350770Sdfr#define BFD_MACH_O_CS_MAGIC_REQUIREMENTS 0xfade0c01
3450770Sdfr
3550770Sdfr/* Directory.  */
36147256Sbrooks#define BFD_MACH_O_CS_MAGIC_CODEDIRECTORY 0xfade0c02
37149558Simp
38149558Simp/* Entitlements blob.  */
39149558Simp#define BFD_MACH_O_CS_MAGIC_EMBEDDED_ENTITLEMENTS 0xfade7171
4050770Sdfr
4150770Sdfr/* Blob container.  */
4250770Sdfr#define BFD_MACH_O_CS_MAGIC_BLOB_WRAPPER 0xfade0b01
4350770Sdfr
44141877Simpstruct mach_o_codesign_codedirectory_external_v1
45141877Simp{
46141877Simp  /* All the fields are in network byte order (big endian).  */
47141877Simp  unsigned char version[4];
48147256Sbrooks  unsigned char flags[4];
4950770Sdfr  unsigned char hash_offset[4];
5050770Sdfr  unsigned char ident_offset[4];
5150770Sdfr  unsigned char nbr_special_slots[4];
52191299Simp  unsigned char nbr_code_slots[4];
53142202Simp  unsigned char code_limit[4];
54142202Simp  unsigned char hash_size[1];
5550770Sdfr  unsigned char hash_type[1];
5650770Sdfr  unsigned char spare1[1];
57142202Simp  unsigned char page_size[1];
58142202Simp  unsigned char spare2[4];
5950770Sdfr};
6050770Sdfr
61150300Simpstruct mach_o_codesign_codedirectory_v1
62150300Simp{
63150300Simp  unsigned int version;
6473374Simp  unsigned int flags;
6592739Salfred  unsigned int hash_offset;
6692739Salfred  unsigned int ident_offset;
67149558Simp  unsigned int nbr_special_slots;
68150300Simp  unsigned int nbr_code_slots;
69149558Simp  unsigned int code_limit;
70149558Simp  unsigned char hash_size;
71154924Simp  unsigned char hash_type;
7250770Sdfr  unsigned char spare1;
7364777Snyan  unsigned char page_size;
7464777Snyan  unsigned int spare2;
7564630Stanimura};
7650770Sdfr
7750770Sdfr/* Value for hash_type.  */
7850770Sdfr#define BFD_MACH_O_CS_NO_HASH 0
7950770Sdfr#define BFD_MACH_O_CS_HASH_SHA1 1
8050770Sdfr#define BFD_MACH_O_CS_HASH_SHA256 2
8150770Sdfr#define BFD_MACH_O_CS_HASH_PRESTANDARD_SKEIN_160x256 32 /* Skein, 160 bits */
8250770Sdfr#define BFD_MACH_O_CS_HASH_PRESTANDARD_SKEIN_256x512 33 /* Skein, 256 bits */
8350770Sdfr
8450770Sdfr#endif /* _MACH_O_CODESIGN_H */
8550770Sdfr