codesign.h 2.6 KB

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