hane 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/README.md +32 -32
  2. package/binding.gyp +77 -50
  3. package/deps/win-nodeapi/node_api.def +158 -0
  4. package/deps/win-nodeapi/node_api.lib +0 -0
  5. package/dist/index.js +1 -1
  6. package/package.json +34 -33
  7. package/src/native/addon.cc +247 -207
  8. package/src/native/zsign_driver.cc +87 -87
  9. package/src/native/zsign_driver.h +38 -38
  10. package/vendor/zlib/.cmake-format.yaml +245 -245
  11. package/vendor/zlib/.github/workflows/c-std.yml +230 -230
  12. package/vendor/zlib/.github/workflows/cmake.yml +112 -112
  13. package/vendor/zlib/.github/workflows/configure.yml +136 -136
  14. package/vendor/zlib/.github/workflows/fuzz.yml +25 -25
  15. package/vendor/zlib/.github/workflows/msys-cygwin.yml +77 -77
  16. package/vendor/zlib/BUILD.bazel +134 -134
  17. package/vendor/zlib/CMakeLists.txt +330 -330
  18. package/vendor/zlib/ChangeLog +1621 -1621
  19. package/vendor/zlib/FAQ +367 -367
  20. package/vendor/zlib/INDEX +68 -68
  21. package/vendor/zlib/LICENSE +22 -22
  22. package/vendor/zlib/MODULE.bazel +9 -9
  23. package/vendor/zlib/Makefile.in +419 -419
  24. package/vendor/zlib/README +115 -115
  25. package/vendor/zlib/README-cmake.md +83 -83
  26. package/vendor/zlib/adler32.c +164 -164
  27. package/vendor/zlib/amiga/Makefile.pup +69 -69
  28. package/vendor/zlib/amiga/Makefile.sas +68 -68
  29. package/vendor/zlib/compress.c +75 -75
  30. package/vendor/zlib/configure +966 -966
  31. package/vendor/zlib/contrib/README.contrib +57 -57
  32. package/vendor/zlib/contrib/ada/buffer_demo.adb +106 -106
  33. package/vendor/zlib/contrib/ada/mtest.adb +156 -156
  34. package/vendor/zlib/contrib/ada/read.adb +156 -156
  35. package/vendor/zlib/contrib/ada/readme.txt +65 -65
  36. package/vendor/zlib/contrib/ada/test.adb +463 -463
  37. package/vendor/zlib/contrib/ada/zlib-streams.adb +225 -225
  38. package/vendor/zlib/contrib/ada/zlib-streams.ads +114 -114
  39. package/vendor/zlib/contrib/ada/zlib-thin.adb +142 -142
  40. package/vendor/zlib/contrib/ada/zlib-thin.ads +450 -450
  41. package/vendor/zlib/contrib/ada/zlib.adb +701 -701
  42. package/vendor/zlib/contrib/ada/zlib.ads +328 -328
  43. package/vendor/zlib/contrib/ada/zlib.gpr +20 -20
  44. package/vendor/zlib/contrib/blast/Makefile +8 -8
  45. package/vendor/zlib/contrib/blast/README +4 -4
  46. package/vendor/zlib/contrib/blast/blast.c +466 -466
  47. package/vendor/zlib/contrib/blast/blast.h +83 -83
  48. package/vendor/zlib/contrib/delphi/ZLib.pas +557 -557
  49. package/vendor/zlib/contrib/delphi/ZLibConst.pas +11 -11
  50. package/vendor/zlib/contrib/delphi/readme.txt +76 -76
  51. package/vendor/zlib/contrib/delphi/zlibd32.mak +99 -99
  52. package/vendor/zlib/contrib/gcc_gvmat64/gvmat64.S +574 -574
  53. package/vendor/zlib/contrib/infback9/README +1 -1
  54. package/vendor/zlib/contrib/infback9/infback9.c +603 -603
  55. package/vendor/zlib/contrib/infback9/infback9.h +37 -37
  56. package/vendor/zlib/contrib/infback9/inffix9.h +107 -107
  57. package/vendor/zlib/contrib/infback9/inflate9.h +47 -47
  58. package/vendor/zlib/contrib/infback9/inftree9.c +319 -319
  59. package/vendor/zlib/contrib/infback9/inftree9.h +61 -61
  60. package/vendor/zlib/contrib/iostream/test.cpp +24 -24
  61. package/vendor/zlib/contrib/iostream/zfstream.cpp +329 -329
  62. package/vendor/zlib/contrib/iostream/zfstream.h +128 -128
  63. package/vendor/zlib/contrib/iostream2/zstream.h +307 -307
  64. package/vendor/zlib/contrib/iostream2/zstream_test.cpp +25 -25
  65. package/vendor/zlib/contrib/iostream3/README +35 -35
  66. package/vendor/zlib/contrib/iostream3/TODO +17 -17
  67. package/vendor/zlib/contrib/iostream3/test.cc +50 -50
  68. package/vendor/zlib/contrib/iostream3/zfstream.cc +479 -479
  69. package/vendor/zlib/contrib/iostream3/zfstream.h +466 -466
  70. package/vendor/zlib/contrib/minizip/CMakeLists.txt +380 -380
  71. package/vendor/zlib/contrib/minizip/Makefile +37 -37
  72. package/vendor/zlib/contrib/minizip/Makefile.am +45 -45
  73. package/vendor/zlib/contrib/minizip/MiniZip64_Changes.txt +6 -6
  74. package/vendor/zlib/contrib/minizip/MiniZip64_info.txt +74 -74
  75. package/vendor/zlib/contrib/minizip/configure.ac +32 -32
  76. package/vendor/zlib/contrib/minizip/crypt.h +128 -128
  77. package/vendor/zlib/contrib/minizip/ints.h +57 -57
  78. package/vendor/zlib/contrib/minizip/ioapi.c +231 -231
  79. package/vendor/zlib/contrib/minizip/ioapi.h +183 -183
  80. package/vendor/zlib/contrib/minizip/iowin32.c +448 -448
  81. package/vendor/zlib/contrib/minizip/iowin32.h +28 -28
  82. package/vendor/zlib/contrib/minizip/make_vms.com +25 -25
  83. package/vendor/zlib/contrib/minizip/miniunz.c +647 -647
  84. package/vendor/zlib/contrib/minizip/miniunzip.1 +63 -63
  85. package/vendor/zlib/contrib/minizip/minizip.1 +46 -46
  86. package/vendor/zlib/contrib/minizip/minizip.c +512 -512
  87. package/vendor/zlib/contrib/minizip/minizip.pc.in +12 -12
  88. package/vendor/zlib/contrib/minizip/minizip.pc.txt +13 -13
  89. package/vendor/zlib/contrib/minizip/minizipConfig.cmake.in +35 -35
  90. package/vendor/zlib/contrib/minizip/mztools.c +288 -288
  91. package/vendor/zlib/contrib/minizip/mztools.h +37 -37
  92. package/vendor/zlib/contrib/minizip/skipset.h +361 -361
  93. package/vendor/zlib/contrib/minizip/test/CMakeLists.txt +121 -121
  94. package/vendor/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in +29 -29
  95. package/vendor/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in +28 -28
  96. package/vendor/zlib/contrib/minizip/test/find_package_test.cmake.in +25 -25
  97. package/vendor/zlib/contrib/minizip/test/test_helper.cm +32 -32
  98. package/vendor/zlib/contrib/minizip/unzip.c +1981 -1981
  99. package/vendor/zlib/contrib/minizip/unzip.h +441 -441
  100. package/vendor/zlib/contrib/minizip/zip.c +2199 -2199
  101. package/vendor/zlib/contrib/minizip/zip.h +370 -370
  102. package/vendor/zlib/contrib/nuget/nuget.csproj +43 -43
  103. package/vendor/zlib/contrib/nuget/nuget.sln +22 -22
  104. package/vendor/zlib/contrib/pascal/example.pas +599 -599
  105. package/vendor/zlib/contrib/pascal/readme.txt +76 -76
  106. package/vendor/zlib/contrib/pascal/zlibd32.mak +99 -99
  107. package/vendor/zlib/contrib/pascal/zlibpas.pas +276 -276
  108. package/vendor/zlib/contrib/puff/Makefile +42 -42
  109. package/vendor/zlib/contrib/puff/README +63 -63
  110. package/vendor/zlib/contrib/puff/puff.c +840 -840
  111. package/vendor/zlib/contrib/puff/puff.h +35 -35
  112. package/vendor/zlib/contrib/puff/pufftest.c +169 -169
  113. package/vendor/zlib/contrib/untgz/Makefile +14 -14
  114. package/vendor/zlib/contrib/untgz/Makefile.msc +17 -17
  115. package/vendor/zlib/contrib/untgz/untgz.c +667 -667
  116. package/vendor/zlib/contrib/vstudio/readme.txt +81 -81
  117. package/vendor/zlib/contrib/vstudio/vc12/miniunz.vcxproj +315 -315
  118. package/vendor/zlib/contrib/vstudio/vc12/minizip.vcxproj +312 -312
  119. package/vendor/zlib/contrib/vstudio/vc12/testzlib.vcxproj +421 -421
  120. package/vendor/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj +315 -315
  121. package/vendor/zlib/contrib/vstudio/vc12/zlib.rc +32 -32
  122. package/vendor/zlib/contrib/vstudio/vc12/zlibstat.vcxproj +458 -458
  123. package/vendor/zlib/contrib/vstudio/vc12/zlibvc.sln +119 -119
  124. package/vendor/zlib/contrib/vstudio/vc12/zlibvc.vcxproj +667 -667
  125. package/vendor/zlib/contrib/vstudio/vc14/miniunz.vcxproj +315 -315
  126. package/vendor/zlib/contrib/vstudio/vc14/minizip.vcxproj +312 -312
  127. package/vendor/zlib/contrib/vstudio/vc14/testzlib.vcxproj +421 -421
  128. package/vendor/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj +315 -315
  129. package/vendor/zlib/contrib/vstudio/vc14/zlib.rc +32 -32
  130. package/vendor/zlib/contrib/vstudio/vc14/zlibstat.vcxproj +458 -458
  131. package/vendor/zlib/contrib/vstudio/vc14/zlibvc.sln +119 -119
  132. package/vendor/zlib/contrib/vstudio/vc14/zlibvc.vcxproj +667 -667
  133. package/vendor/zlib/contrib/vstudio/vc17/miniunz.vcxproj +408 -408
  134. package/vendor/zlib/contrib/vstudio/vc17/minizip.vcxproj +404 -404
  135. package/vendor/zlib/contrib/vstudio/vc17/testzlib.vcxproj +472 -472
  136. package/vendor/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj +408 -408
  137. package/vendor/zlib/contrib/vstudio/vc17/zlib.rc +32 -32
  138. package/vendor/zlib/contrib/vstudio/vc17/zlibstat.vcxproj +601 -601
  139. package/vendor/zlib/contrib/vstudio/vc17/zlibvc.sln +179 -179
  140. package/vendor/zlib/contrib/vstudio/vc17/zlibvc.vcxproj +874 -874
  141. package/vendor/zlib/crc32.c +1049 -1049
  142. package/vendor/zlib/crc32.h +9446 -9446
  143. package/vendor/zlib/deflate.c +2152 -2152
  144. package/vendor/zlib/deflate.h +380 -380
  145. package/vendor/zlib/doc/algorithm.txt +209 -209
  146. package/vendor/zlib/doc/rfc1950.txt +619 -619
  147. package/vendor/zlib/doc/rfc1951.txt +955 -955
  148. package/vendor/zlib/doc/rfc1952.txt +675 -675
  149. package/vendor/zlib/doc/txtvsbin.txt +107 -107
  150. package/vendor/zlib/examples/README.examples +54 -54
  151. package/vendor/zlib/examples/enough.c +597 -597
  152. package/vendor/zlib/examples/fitblk.c +233 -233
  153. package/vendor/zlib/examples/gun.c +702 -702
  154. package/vendor/zlib/examples/gzappend.c +504 -504
  155. package/vendor/zlib/examples/gzjoin.c +449 -449
  156. package/vendor/zlib/examples/gzlog.c +1061 -1061
  157. package/vendor/zlib/examples/gzlog.h +91 -91
  158. package/vendor/zlib/examples/gznorm.c +474 -474
  159. package/vendor/zlib/examples/zlib_how.html +549 -549
  160. package/vendor/zlib/examples/zpipe.c +209 -209
  161. package/vendor/zlib/examples/zran.c +550 -550
  162. package/vendor/zlib/examples/zran.h +53 -53
  163. package/vendor/zlib/gzclose.c +23 -23
  164. package/vendor/zlib/gzguts.h +215 -215
  165. package/vendor/zlib/gzlib.c +585 -585
  166. package/vendor/zlib/gzread.c +603 -603
  167. package/vendor/zlib/gzwrite.c +631 -631
  168. package/vendor/zlib/infback.c +628 -628
  169. package/vendor/zlib/inffast.c +320 -320
  170. package/vendor/zlib/inffast.h +11 -11
  171. package/vendor/zlib/inffixed.h +94 -94
  172. package/vendor/zlib/inflate.c +1526 -1526
  173. package/vendor/zlib/inflate.h +126 -126
  174. package/vendor/zlib/inftrees.c +299 -299
  175. package/vendor/zlib/inftrees.h +62 -62
  176. package/vendor/zlib/make_vms.com +867 -867
  177. package/vendor/zlib/msdos/Makefile.bor +115 -115
  178. package/vendor/zlib/msdos/Makefile.dj2 +104 -104
  179. package/vendor/zlib/msdos/Makefile.emx +69 -69
  180. package/vendor/zlib/msdos/Makefile.msc +112 -112
  181. package/vendor/zlib/msdos/Makefile.tc +100 -100
  182. package/vendor/zlib/nintendods/Makefile +126 -126
  183. package/vendor/zlib/nintendods/README +5 -5
  184. package/vendor/zlib/old/Makefile.emx +69 -69
  185. package/vendor/zlib/old/Makefile.riscos +151 -151
  186. package/vendor/zlib/old/README +3 -3
  187. package/vendor/zlib/old/descrip.mms +48 -48
  188. package/vendor/zlib/old/os2/Makefile.os2 +136 -136
  189. package/vendor/zlib/old/os2/zlib.def +51 -51
  190. package/vendor/zlib/old/visual-basic.txt +160 -160
  191. package/vendor/zlib/os400/README400 +48 -48
  192. package/vendor/zlib/os400/bndsrc +133 -133
  193. package/vendor/zlib/os400/make.sh +366 -366
  194. package/vendor/zlib/os400/zlib.inc +531 -531
  195. package/vendor/zlib/qnx/package.qpg +141 -141
  196. package/vendor/zlib/test/CMakeLists.txt +265 -265
  197. package/vendor/zlib/test/add_subdirectory_exclude_test.cmake.in +29 -29
  198. package/vendor/zlib/test/add_subdirectory_test.cmake.in +28 -28
  199. package/vendor/zlib/test/example.c +552 -552
  200. package/vendor/zlib/test/find_package_test.cmake.in +26 -26
  201. package/vendor/zlib/test/infcover.c +672 -672
  202. package/vendor/zlib/test/minigzip.c +590 -590
  203. package/vendor/zlib/treebuild.xml +116 -116
  204. package/vendor/zlib/trees.c +1119 -1119
  205. package/vendor/zlib/trees.h +128 -128
  206. package/vendor/zlib/uncompr.c +85 -85
  207. package/vendor/zlib/watcom/watcom_f.mak +43 -43
  208. package/vendor/zlib/watcom/watcom_l.mak +43 -43
  209. package/vendor/zlib/win32/DLL_FAQ.txt +381 -381
  210. package/vendor/zlib/win32/Makefile.bor +109 -109
  211. package/vendor/zlib/win32/Makefile.gcc +177 -177
  212. package/vendor/zlib/win32/Makefile.msc +159 -159
  213. package/vendor/zlib/win32/README-WIN32.txt +103 -103
  214. package/vendor/zlib/win32/VisualC.txt +3 -3
  215. package/vendor/zlib/win32/zlib1.rc +37 -37
  216. package/vendor/zlib/zconf.h.in +544 -544
  217. package/vendor/zlib/zlib.3 +149 -149
  218. package/vendor/zlib/zlib.h +1957 -1957
  219. package/vendor/zlib/zlib.map +103 -103
  220. package/vendor/zlib/zlib.pc.cmakein +13 -13
  221. package/vendor/zlib/zlib.pc.in +13 -13
  222. package/vendor/zlib/zlibConfig.cmake.in +26 -26
  223. package/vendor/zlib/zutil.c +299 -299
  224. package/vendor/zlib/zutil.h +257 -257
  225. package/vendor/zsign/.gitattributes +3 -3
  226. package/vendor/zsign/LICENSE +20 -20
  227. package/vendor/zsign/README.md +142 -142
  228. package/vendor/zsign/build/linux/Makefile +43 -43
  229. package/vendor/zsign/build/macos/Makefile +43 -43
  230. package/vendor/zsign/build/windows/vs2022/include/minizip/crypt.h +128 -128
  231. package/vendor/zsign/build/windows/vs2022/include/minizip/ioapi.h +216 -216
  232. package/vendor/zsign/build/windows/vs2022/include/minizip/iowin32.h +28 -28
  233. package/vendor/zsign/build/windows/vs2022/include/minizip/mztools.h +37 -37
  234. package/vendor/zsign/build/windows/vs2022/include/minizip/unzip.h +437 -437
  235. package/vendor/zsign/build/windows/vs2022/include/minizip/zip.h +364 -364
  236. package/vendor/zsign/build/windows/vs2022/include/openssl/__DECC_INCLUDE_EPILOGUE.H +22 -22
  237. package/vendor/zsign/build/windows/vs2022/include/openssl/__DECC_INCLUDE_PROLOGUE.H +26 -26
  238. package/vendor/zsign/build/windows/vs2022/include/openssl/aes.h +111 -111
  239. package/vendor/zsign/build/windows/vs2022/include/openssl/applink.c +153 -153
  240. package/vendor/zsign/build/windows/vs2022/include/openssl/asn1_mac.h +10 -10
  241. package/vendor/zsign/build/windows/vs2022/include/openssl/asn1err.h +142 -142
  242. package/vendor/zsign/build/windows/vs2022/include/openssl/async.h +104 -104
  243. package/vendor/zsign/build/windows/vs2022/include/openssl/asyncerr.h +29 -29
  244. package/vendor/zsign/build/windows/vs2022/include/openssl/bioerr.h +72 -72
  245. package/vendor/zsign/build/windows/vs2022/include/openssl/blowfish.h +78 -78
  246. package/vendor/zsign/build/windows/vs2022/include/openssl/bn.h +590 -590
  247. package/vendor/zsign/build/windows/vs2022/include/openssl/bnerr.h +47 -47
  248. package/vendor/zsign/build/windows/vs2022/include/openssl/buffer.h +62 -62
  249. package/vendor/zsign/build/windows/vs2022/include/openssl/buffererr.h +25 -25
  250. package/vendor/zsign/build/windows/vs2022/include/openssl/camellia.h +117 -117
  251. package/vendor/zsign/build/windows/vs2022/include/openssl/cast.h +71 -71
  252. package/vendor/zsign/build/windows/vs2022/include/openssl/cmac.h +52 -52
  253. package/vendor/zsign/build/windows/vs2022/include/openssl/cmp_util.h +56 -56
  254. package/vendor/zsign/build/windows/vs2022/include/openssl/cmperr.h +131 -131
  255. package/vendor/zsign/build/windows/vs2022/include/openssl/cmserr.h +125 -125
  256. package/vendor/zsign/build/windows/vs2022/include/openssl/comperr.h +38 -38
  257. package/vendor/zsign/build/windows/vs2022/include/openssl/conf_api.h +46 -46
  258. package/vendor/zsign/build/windows/vs2022/include/openssl/conferr.h +52 -52
  259. package/vendor/zsign/build/windows/vs2022/include/openssl/conftypes.h +44 -44
  260. package/vendor/zsign/build/windows/vs2022/include/openssl/core.h +236 -236
  261. package/vendor/zsign/build/windows/vs2022/include/openssl/core_dispatch.h +1022 -1022
  262. package/vendor/zsign/build/windows/vs2022/include/openssl/core_object.h +41 -41
  263. package/vendor/zsign/build/windows/vs2022/include/openssl/crmferr.h +50 -50
  264. package/vendor/zsign/build/windows/vs2022/include/openssl/cryptoerr.h +56 -56
  265. package/vendor/zsign/build/windows/vs2022/include/openssl/cryptoerr_legacy.h +1466 -1466
  266. package/vendor/zsign/build/windows/vs2022/include/openssl/cterr.h +45 -45
  267. package/vendor/zsign/build/windows/vs2022/include/openssl/decoder.h +133 -133
  268. package/vendor/zsign/build/windows/vs2022/include/openssl/decodererr.h +28 -28
  269. package/vendor/zsign/build/windows/vs2022/include/openssl/des.h +211 -211
  270. package/vendor/zsign/build/windows/vs2022/include/openssl/dh.h +339 -339
  271. package/vendor/zsign/build/windows/vs2022/include/openssl/dherr.h +59 -59
  272. package/vendor/zsign/build/windows/vs2022/include/openssl/dsa.h +280 -280
  273. package/vendor/zsign/build/windows/vs2022/include/openssl/dsaerr.h +44 -44
  274. package/vendor/zsign/build/windows/vs2022/include/openssl/dtls1.h +57 -57
  275. package/vendor/zsign/build/windows/vs2022/include/openssl/e_os2.h +310 -310
  276. package/vendor/zsign/build/windows/vs2022/include/openssl/e_ostime.h +38 -38
  277. package/vendor/zsign/build/windows/vs2022/include/openssl/ebcdic.h +39 -39
  278. package/vendor/zsign/build/windows/vs2022/include/openssl/ec.h +1588 -1588
  279. package/vendor/zsign/build/windows/vs2022/include/openssl/ecdh.h +10 -10
  280. package/vendor/zsign/build/windows/vs2022/include/openssl/ecdsa.h +10 -10
  281. package/vendor/zsign/build/windows/vs2022/include/openssl/ecerr.h +104 -104
  282. package/vendor/zsign/build/windows/vs2022/include/openssl/encoder.h +124 -124
  283. package/vendor/zsign/build/windows/vs2022/include/openssl/encodererr.h +28 -28
  284. package/vendor/zsign/build/windows/vs2022/include/openssl/engine.h +833 -833
  285. package/vendor/zsign/build/windows/vs2022/include/openssl/engineerr.h +63 -63
  286. package/vendor/zsign/build/windows/vs2022/include/openssl/esserr.h +32 -32
  287. package/vendor/zsign/build/windows/vs2022/include/openssl/evp.h +2231 -2231
  288. package/vendor/zsign/build/windows/vs2022/include/openssl/evperr.h +140 -140
  289. package/vendor/zsign/build/windows/vs2022/include/openssl/fips_names.h +50 -50
  290. package/vendor/zsign/build/windows/vs2022/include/openssl/hmac.h +62 -62
  291. package/vendor/zsign/build/windows/vs2022/include/openssl/hpke.h +169 -169
  292. package/vendor/zsign/build/windows/vs2022/include/openssl/http.h +118 -118
  293. package/vendor/zsign/build/windows/vs2022/include/openssl/httperr.h +56 -56
  294. package/vendor/zsign/build/windows/vs2022/include/openssl/idea.h +82 -82
  295. package/vendor/zsign/build/windows/vs2022/include/openssl/indicator.h +31 -31
  296. package/vendor/zsign/build/windows/vs2022/include/openssl/kdf.h +138 -138
  297. package/vendor/zsign/build/windows/vs2022/include/openssl/kdferr.h +16 -16
  298. package/vendor/zsign/build/windows/vs2022/include/openssl/macros.h +338 -338
  299. package/vendor/zsign/build/windows/vs2022/include/openssl/md2.h +56 -56
  300. package/vendor/zsign/build/windows/vs2022/include/openssl/md4.h +63 -63
  301. package/vendor/zsign/build/windows/vs2022/include/openssl/md5.h +62 -62
  302. package/vendor/zsign/build/windows/vs2022/include/openssl/mdc2.h +55 -55
  303. package/vendor/zsign/build/windows/vs2022/include/openssl/modes.h +219 -219
  304. package/vendor/zsign/build/windows/vs2022/include/openssl/obj_mac.h +5820 -5820
  305. package/vendor/zsign/build/windows/vs2022/include/openssl/objects.h +184 -184
  306. package/vendor/zsign/build/windows/vs2022/include/openssl/objectserr.h +28 -28
  307. package/vendor/zsign/build/windows/vs2022/include/openssl/ocsperr.h +53 -53
  308. package/vendor/zsign/build/windows/vs2022/include/openssl/opensslconf.h +17 -17
  309. package/vendor/zsign/build/windows/vs2022/include/openssl/ossl_typ.h +16 -16
  310. package/vendor/zsign/build/windows/vs2022/include/openssl/param_build.h +63 -63
  311. package/vendor/zsign/build/windows/vs2022/include/openssl/params.h +160 -160
  312. package/vendor/zsign/build/windows/vs2022/include/openssl/pem.h +543 -543
  313. package/vendor/zsign/build/windows/vs2022/include/openssl/pem2.h +19 -19
  314. package/vendor/zsign/build/windows/vs2022/include/openssl/pemerr.h +58 -58
  315. package/vendor/zsign/build/windows/vs2022/include/openssl/pkcs12err.h +46 -46
  316. package/vendor/zsign/build/windows/vs2022/include/openssl/pkcs7err.h +63 -63
  317. package/vendor/zsign/build/windows/vs2022/include/openssl/prov_ssl.h +38 -38
  318. package/vendor/zsign/build/windows/vs2022/include/openssl/proverr.h +162 -162
  319. package/vendor/zsign/build/windows/vs2022/include/openssl/provider.h +66 -66
  320. package/vendor/zsign/build/windows/vs2022/include/openssl/quic.h +70 -70
  321. package/vendor/zsign/build/windows/vs2022/include/openssl/rand.h +125 -125
  322. package/vendor/zsign/build/windows/vs2022/include/openssl/randerr.h +69 -69
  323. package/vendor/zsign/build/windows/vs2022/include/openssl/rc2.h +68 -68
  324. package/vendor/zsign/build/windows/vs2022/include/openssl/rc4.h +47 -47
  325. package/vendor/zsign/build/windows/vs2022/include/openssl/rc5.h +79 -79
  326. package/vendor/zsign/build/windows/vs2022/include/openssl/ripemd.h +59 -59
  327. package/vendor/zsign/build/windows/vs2022/include/openssl/rsa.h +615 -615
  328. package/vendor/zsign/build/windows/vs2022/include/openssl/rsaerr.h +107 -107
  329. package/vendor/zsign/build/windows/vs2022/include/openssl/seed.h +113 -113
  330. package/vendor/zsign/build/windows/vs2022/include/openssl/self_test.h +98 -98
  331. package/vendor/zsign/build/windows/vs2022/include/openssl/sha.h +139 -139
  332. package/vendor/zsign/build/windows/vs2022/include/openssl/srtp.h +68 -68
  333. package/vendor/zsign/build/windows/vs2022/include/openssl/ssl2.h +30 -30
  334. package/vendor/zsign/build/windows/vs2022/include/openssl/ssl3.h +357 -357
  335. package/vendor/zsign/build/windows/vs2022/include/openssl/sslerr.h +379 -379
  336. package/vendor/zsign/build/windows/vs2022/include/openssl/sslerr_legacy.h +467 -467
  337. package/vendor/zsign/build/windows/vs2022/include/openssl/stack.h +90 -90
  338. package/vendor/zsign/build/windows/vs2022/include/openssl/store.h +377 -377
  339. package/vendor/zsign/build/windows/vs2022/include/openssl/storeerr.h +49 -49
  340. package/vendor/zsign/build/windows/vs2022/include/openssl/symhacks.h +39 -39
  341. package/vendor/zsign/build/windows/vs2022/include/openssl/thread.h +31 -31
  342. package/vendor/zsign/build/windows/vs2022/include/openssl/tls1.h +1220 -1220
  343. package/vendor/zsign/build/windows/vs2022/include/openssl/trace.h +320 -320
  344. package/vendor/zsign/build/windows/vs2022/include/openssl/ts.h +522 -522
  345. package/vendor/zsign/build/windows/vs2022/include/openssl/tserr.h +67 -67
  346. package/vendor/zsign/build/windows/vs2022/include/openssl/txt_db.h +63 -63
  347. package/vendor/zsign/build/windows/vs2022/include/openssl/types.h +245 -245
  348. package/vendor/zsign/build/windows/vs2022/include/openssl/uierr.h +38 -38
  349. package/vendor/zsign/build/windows/vs2022/include/openssl/whrlpool.h +62 -62
  350. package/vendor/zsign/build/windows/vs2022/include/openssl/x509err.h +70 -70
  351. package/vendor/zsign/build/windows/vs2022/include/openssl/x509v3err.h +96 -96
  352. package/vendor/zsign/src/archo.cpp +742 -742
  353. package/vendor/zsign/src/archo.h +61 -61
  354. package/vendor/zsign/src/bundle.cpp +589 -589
  355. package/vendor/zsign/src/bundle.h +46 -46
  356. package/vendor/zsign/src/common/archive.cpp +246 -246
  357. package/vendor/zsign/src/common/archive.h +22 -22
  358. package/vendor/zsign/src/common/common.h +56 -56
  359. package/vendor/zsign/src/common/fs.cpp +573 -573
  360. package/vendor/zsign/src/common/fs.h +50 -50
  361. package/vendor/zsign/src/common/log.cpp +145 -145
  362. package/vendor/zsign/src/common/log.h +37 -37
  363. package/vendor/zsign/src/common/mach-o.h +585 -585
  364. package/vendor/zsign/src/common/sha.cpp +133 -133
  365. package/vendor/zsign/src/common/sha.h +24 -24
  366. package/vendor/zsign/src/common/timer.cpp +28 -28
  367. package/vendor/zsign/src/common/timer.h +17 -17
  368. package/vendor/zsign/src/common/util.cpp +185 -185
  369. package/vendor/zsign/src/common/util.h +25 -25
  370. package/vendor/zsign/src/macho.cpp +273 -273
  371. package/vendor/zsign/src/macho.h +38 -38
  372. package/vendor/zsign/src/openssl.cpp +698 -698
  373. package/vendor/zsign/src/openssl.h +71 -71
  374. package/vendor/zsign/src/signing.cpp +745 -745
  375. package/vendor/zsign/src/signing.h +59 -59
  376. package/vendor/zsign/src/zsign.cpp +317 -317
  377. package/vendor/zsign/test/dylib/demo/Makefile +12 -12
  378. package/vendor/zsign/test/dylib/demo/control +9 -9
  379. package/vendor/zsign/test/dylib/demo/demo.m +21 -21
  380. package/vendor/zsign/test/linux/test.sh +19 -19
  381. package/vendor/zsign/test/macos/test.sh +19 -19
@@ -1,585 +1,585 @@
1
- #pragma once
2
-
3
- typedef int cpu_type_t;
4
- typedef int cpu_subtype_t;
5
- typedef int vm_prot_t;
6
-
7
- /*
8
- * Capability bits used in the definition of cpu_type.
9
- */
10
- #define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
11
- #define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
12
- #define CPU_ARCH_ABI64_32 0x02000000
13
-
14
- /*
15
- * Machine types known by all.
16
- */
17
- #define CPU_TYPE_ANY -1
18
- #define CPU_TYPE_VAX 1
19
- #define CPU_TYPE_MC680x0 6
20
- #define CPU_TYPE_X86 7
21
- #define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
22
- #define CPU_TYPE_MIPS 8
23
- #define CPU_TYPE_MC98000 10
24
- #define CPU_TYPE_HPPA 11
25
- #define CPU_TYPE_ARM 12
26
- #define CPU_TYPE_MC88000 13
27
- #define CPU_TYPE_SPARC 14
28
- #define CPU_TYPE_I860 15
29
- #define CPU_TYPE_ALPHA 16
30
- #define CPU_TYPE_POWERPC 18
31
- #define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
32
- #define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
33
- #define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
34
- #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
35
-
36
- /*
37
- * Machine subtypes (these are defined here, instead of in a machine
38
- * dependent directory, so that any program can get all definitions
39
- * regardless of where is it compiled).
40
- */
41
-
42
- /*
43
- * Capability bits used in the definition of cpu_subtype.
44
- */
45
- #define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
46
- #define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
47
-
48
- /*
49
- * Object files that are hand-crafted to run on any
50
- * implementation of an architecture are tagged with
51
- * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
52
- * the "ALL" subtype of an architecture except that it allows us
53
- * to easily find object files that may need to be modified
54
- * whenever a new implementation of an architecture comes out.
55
- *
56
- * It is the responsibility of the implementor to make sure the
57
- * software handles unsupported implementations elegantly.
58
- */
59
- #define CPU_SUBTYPE_MULTIPLE -1
60
- #define CPU_SUBTYPE_LITTLE_ENDIAN 0
61
- #define CPU_SUBTYPE_BIG_ENDIAN 1
62
-
63
- /*
64
- * I386 subtypes
65
- */
66
-
67
- #define CPU_SUBTYPE_INTEL(f, m) ((f) + ((m) << 4))
68
-
69
- #define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
70
- #define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
71
- #define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
72
- #define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
73
- #define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
74
- #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
75
- #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
76
- #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
77
- #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
78
- #define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
79
- #define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
80
- #define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
81
- #define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
82
- #define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
83
- #define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
84
- #define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
85
- #define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
86
- #define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
87
- #define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
88
- #define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
89
- #define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
90
-
91
- #define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
92
- #define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
93
-
94
- #define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
95
- #define CPU_SUBTYPE_INTEL_MODEL_ALL 0
96
-
97
- /*
98
- * X86 subtypes.
99
- */
100
-
101
- #define CPU_SUBTYPE_X86_ALL 3
102
- #define CPU_SUBTYPE_X86_64_ALL 3
103
- #define CPU_SUBTYPE_X86_ARCH1 4
104
- #define CPU_SUBTYPE_X86_64_H 8
105
-
106
- #define CPU_SUBTYPE_ARM_ALL 0
107
- #define CPU_SUBTYPE_ARM_A500_ARCH 1
108
- #define CPU_SUBTYPE_ARM_A500 2
109
- #define CPU_SUBTYPE_ARM_A440 3
110
- #define CPU_SUBTYPE_ARM_M4 4
111
- #define CPU_SUBTYPE_ARM_V4T 5
112
- #define CPU_SUBTYPE_ARM_V6 6
113
- #define CPU_SUBTYPE_ARM_V5 7
114
- #define CPU_SUBTYPE_ARM_V5TEJ 7
115
- #define CPU_SUBTYPE_ARM_XSCALE 8
116
- #define CPU_SUBTYPE_ARM_V7 9
117
- #define CPU_SUBTYPE_ARM_V7S 11
118
- #define CPU_SUBTYPE_ARM_V7K 12
119
- #define CPU_SUBTYPE_ARM_V8 13
120
- #define CPU_SUBTYPE_ARM_V6M 14
121
- #define CPU_SUBTYPE_ARM_V7M 15
122
- #define CPU_SUBTYPE_ARM_V7EM 16
123
-
124
- #define CPU_SUBTYPE_ARM64_ALL 0
125
- #define CPU_SUBTYPE_ARM64_V8 1
126
- #define CPU_SUBTYPE_ARM64E 2
127
- #define CPU_SUBTYPE_ARM64_32_V8 1
128
-
129
-
130
- #define FAT_MAGIC 0xcafebabe
131
- #define FAT_CIGAM 0xbebafeca
132
-
133
- #define MH_MAGIC 0xfeedface
134
- #define MH_CIGAM 0xcefaedfe
135
- #define MH_MAGIC_64 0xfeedfacf
136
- #define MH_CIGAM_64 0xcffaedfe
137
-
138
-
139
- /* Constants for the cmd field of new load commands, the type */
140
-
141
- #define MH_OBJECT 0x1 /* relocatable object file */
142
- #define MH_EXECUTE 0x2 /* demand paged executable file */
143
- #define MH_FVMLIB 0x3 /* fixed VM shared library file */
144
- #define MH_CORE 0x4 /* core file */
145
- #define MH_PRELOAD 0x5 /* preloaded executable file */
146
- #define MH_DYLIB 0x6 /* dynamicly bound shared library file*/
147
- #define MH_DYLINKER 0x7 /* dynamic link editor */
148
- #define MH_BUNDLE 0x8 /* dynamicly bound bundle file */
149
- #define MH_DYLIB_STUB 0x9 // Dynamic shared library stub
150
- #define MH_DSYM 0xa // Companion debug sections file
151
- #define MH_KEXT_BUNDLE 0xb // Kernel extension
152
-
153
- /* Constants for the flags field of the mach_header */
154
- #define MH_NOUNDEFS 0x00000001 /* the object file has no undefined references, can be executed */
155
- #define MH_INCRLINK 0x00000002 /* the object file is the output of an incremental link against a base file and can't be link edited again */
156
- #define MH_DYLDLINK 0x00000004 /* the object file is input for the dynamic linker and can't be staticly link edited again */
157
- #define MH_BINDATLOAD 0x00000008 /* the object file's undefined references are bound by the dynamic linker when loaded. */
158
- #define MH_PREBOUND 0x00000010 /* the file has it's dynamic undefined references prebound. */
159
- #define MH_SPLIT_SEGS 0x00000020
160
- #define MH_LAZY_INIT 0x00000040
161
- #define MH_TWOLEVEL 0x00000080
162
- #define MH_FORCE_FLAT 0x00000100
163
- #define MH_NOMULTIDEFS 0x00000200
164
- #define MH_NOFIXPREBINDING 0x00000400
165
- #define MH_PREBINDABLE 0x00000800
166
- #define MH_ALLMODSBOUND 0x00001000
167
- #define MH_SUBSECTIONS_VIA_SYMBOLS 0x00002000
168
- #define MH_CANONICAL 0x00004000
169
- #define MH_WEAK_DEFINES 0x00008000
170
- #define MH_BINDS_TO_WEAK 0x00010000
171
- #define MH_ALLOW_STACK_EXECUTION 0x00020000
172
- #define MH_ROOT_SAFE 0x00040000
173
- #define MH_SETUID_SAFE 0x00080000
174
- #define MH_NO_REEXPORTED_DYLIBS 0x00100000
175
- #define MH_PIE 0x00200000
176
- #define MH_DEAD_STRIPPABLE_DYLIB 0x00400000
177
- #define MH_HAS_TLV_DESCRIPTORS 0x00800000
178
- #define MH_NO_HEAP_EXECUTION 0x01000000
179
- #define MH_APP_EXTENSION_SAFE 0x02000000
180
-
181
-
182
- /* Constants for the cmd field of all load commands, the type */
183
- #define LC_SEGMENT 0x00000001 /* segment of this file to be mapped */
184
- #define LC_SYMTAB 0x00000002 /* link-edit stab symbol table info */
185
- #define LC_SYMSEG 0x00000003 /* link-edit gdb symbol table info (obsolete) */
186
- #define LC_THREAD 0x00000004 /* thread */
187
- #define LC_UNIXTHREAD 0x00000005 /* unix thread (includes a stack) */
188
- #define LC_LOADFVMLIB 0x00000006 /* load a specified fixed VM shared library */
189
- #define LC_IDFVMLIB 0x00000007 /* fixed VM shared library identification */
190
- #define LC_IDENT 0x00000008 /* object identification info (obsolete) */
191
- #define LC_FVMFILE 0x00000009 /* fixed VM file inclusion (internal use) */
192
- #define LC_PREPAGE 0x0000000a /* prepage command (internal use) */
193
- #define LC_DYSYMTAB 0x0000000b /* dynamic link-edit symbol table info */
194
- #define LC_LOAD_DYLIB 0x0000000c /* load a dynamicly linked shared library */
195
- #define LC_ID_DYLIB 0x0000000d /* dynamicly linked shared lib identification */
196
- #define LC_LOAD_DYLINKER 0x0000000e /* load a dynamic linker */
197
- #define LC_ID_DYLINKER 0x0000000f /* dynamic linker identification */
198
- #define LC_PREBOUND_DYLIB 0x00000010 /* modules prebound for a dynamicly */
199
- #define LC_ROUTINES 0x00000011
200
- #define LC_SUB_FRAMEWORK 0x00000012
201
- #define LC_SUB_UMBRELLA 0x00000013
202
- #define LC_SUB_CLIENT 0x00000014
203
- #define LC_SUB_LIBRARY 0x00000015
204
- #define LC_TWOLEVEL_HINTS 0x00000016
205
- #define LC_PREBIND_CKSUM 0x00000017
206
- #define LC_LOAD_WEAK_DYLIB 0x80000018
207
- #define LC_SEGMENT_64 0x00000019
208
- #define LC_ROUTINES_64 0x0000001A
209
- #define LC_UUID 0x0000001B
210
- #define LC_RPATH 0x8000001C
211
- #define LC_CODE_SIGNATURE 0x0000001D
212
- #define LC_SEGMENT_SPLIT_INFO 0x0000001E
213
- #define LC_REEXPORT_DYLIB 0x8000001F
214
- #define LC_LAZY_LOAD_DYLIB 0x00000020
215
- #define LC_ENCRYPTION_INFO 0x00000021
216
- #define LC_DYLD_INFO 0x00000022
217
- #define LC_DYLD_INFO_ONLY 0x80000022
218
- #define LC_LOAD_UPWARD_DYLIB 0x80000023
219
- #define LC_VERSION_MIN_MACOSX 0x00000024
220
- #define LC_VERSION_MIN_IPHONEOS 0x00000025
221
- #define LC_FUNCTION_STARTS 0x00000026
222
- #define LC_DYLD_ENVIRONMENT 0x00000027
223
- #define LC_MAIN 0x80000028
224
- #define LC_DATA_IN_CODE 0x00000029
225
- #define LC_SOURCE_VERSION 0x0000002A
226
- #define LC_DYLIB_CODE_SIGN_DRS 0x0000002B
227
- #define LC_ENCRYPTION_INFO_64 0x0000002C
228
- #define LC_LINKER_OPTION 0x0000002D
229
- #define LC_LINKER_OPTIMIZATION_HINT 0x0000002E
230
- #define LC_VERSION_MIN_TVOS 0x0000002F
231
- #define LC_VERSION_MIN_WATCHOS 0x00000030
232
-
233
- /* Constants for the flags field of the segment_command */
234
- #define SG_HIGHVM 0x00000001 /* the file contents for this segment is for
235
- the high part of the VM space, the low part
236
- is zero filled (for stacks in core files) */
237
- #define SG_FVMLIB 0x00000002 /* this segment is the VM that is allocated by
238
- a fixed VM library, for overlap checking in
239
- the link editor */
240
- #define SG_NORELOC 0x00000004 /* this segment has nothing that was relocated
241
- in it and nothing relocated to it, that is
242
- it maybe safely replaced without relocation*/
243
- #define SG_PROTECTED_VERSION_1 0x00000008 // Segment is encryption protected
244
-
245
-
246
- // Section flag masks
247
- #define SECTION_TYPE 0x000000ff // Section type mask
248
- #define SECTION_ATTRIBUTES 0xffffff00 // Section attributes mask
249
-
250
- // Section type (use SECTION_TYPE mask)
251
-
252
- #define S_REGULAR 0x00
253
- #define S_ZEROFILL 0x01
254
- #define S_CSTRING_LITERALS 0x02
255
- #define S_4BYTE_LITERALS 0x03
256
- #define S_8BYTE_LITERALS 0x04
257
- #define S_LITERAL_POINTERS 0x05
258
- #define S_NON_LAZY_SYMBOL_POINTERS 0x06
259
- #define S_LAZY_SYMBOL_POINTERS 0x07
260
- #define S_SYMBOL_STUBS 0x08
261
- #define S_MOD_INIT_FUNC_POINTERS 0x09
262
- #define S_MOD_TERM_FUNC_POINTERS 0x0a
263
- #define S_COALESCED 0x0b
264
- #define S_GB_ZEROFILL 0x0c
265
- #define S_INTERPOSING 0x0d
266
- #define S_16BYTE_LITERALS 0x0e
267
- #define S_DTRACE_DOF 0x0f
268
- #define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10
269
- #define S_THREAD_LOCAL_REGULAR 0x11
270
- #define S_THREAD_LOCAL_ZEROFILL 0x12
271
- #define S_THREAD_LOCAL_VARIABLES 0x13
272
- #define S_THREAD_LOCAL_VARIABLE_POINTERS 0x14
273
- #define S_THREAD_LOCAL_INIT_FUNCTION_POINTERS 0x15
274
-
275
- // Section attributes (use SECTION_ATTRIBUTES mask)
276
-
277
- #define S_ATTR_PURE_INSTRUCTIONS 0x80000000 // Only pure instructions
278
- #define S_ATTR_NO_TOC 0x40000000 // Contains coalesced symbols
279
- #define S_ATTR_STRIP_STATIC_SYMS 0x20000000 // Can strip static symbols
280
- #define S_ATTR_NO_DEAD_STRIP 0x10000000 // No dead stripping
281
- #define S_ATTR_LIVE_SUPPORT 0x08000000 // Live blocks support
282
- #define S_ATTR_SELF_MODIFYING_CODE 0x04000000 // Self modifying code
283
- #define S_ATTR_DEBUG 0x02000000 // Debug section
284
- #define S_ATTR_SOME_INSTRUCTIONS 0x00000400 // Some machine instructions
285
- #define S_ATTR_EXT_RELOC 0x00000200 // Has external relocations
286
- #define S_ATTR_LOC_RELOC 0x00000100 // Has local relocations
287
-
288
-
289
- //struct define
290
-
291
- #pragma pack(push, 1)
292
-
293
- struct fat_header
294
- {
295
- uint32_t magic; /* FAT_MAGIC */
296
- uint32_t nfat_arch; /* number of structs that follow */
297
- };
298
-
299
- struct fat_arch
300
- {
301
- cpu_type_t cputype; /* cpu specifier (int) */
302
- cpu_subtype_t cpusubtype; /* machine specifier (int) */
303
- uint32_t offset; /* file offset to this object file */
304
- uint32_t size; /* size of this object file */
305
- uint32_t align; /* alignment as a power of 2 */
306
- };
307
-
308
- struct mach_header
309
- {
310
- uint32_t magic; /* mach magic number identifier */
311
- cpu_type_t cputype; /* cpu specifier */
312
- cpu_subtype_t cpusubtype; /* machine specifier */
313
- uint32_t filetype; /* type of file */
314
- uint32_t ncmds; /* number of load commands */
315
- uint32_t sizeofcmds; /* the size of all the load commands */
316
- uint32_t flags; /* flags */
317
- };
318
-
319
- struct mach_header_64
320
- {
321
- uint32_t magic; /* mach magic number identifier */
322
- cpu_type_t cputype; /* cpu specifier */
323
- cpu_subtype_t cpusubtype; /* machine specifier */
324
- uint32_t filetype; /* type of file */
325
- uint32_t ncmds; /* number of load commands */
326
- uint32_t sizeofcmds; /* the size of all the load commands */
327
- uint32_t flags; /* flags */
328
- uint32_t reserved; /* reserved */
329
- };
330
-
331
- struct load_command
332
- {
333
- uint32_t cmd; /* type of load command */
334
- uint32_t cmdsize; /* total size of command in bytes */
335
- };
336
-
337
- struct uuid_command {
338
- uint32_t cmd;
339
- uint32_t cmdsize;
340
- uint8_t uuid[16];
341
- };
342
-
343
- struct entry_point_command {
344
- uint32_t cmd;
345
- uint32_t cmdsize;
346
- uint64_t entryoff;
347
- uint64_t stacksize;
348
- };
349
-
350
- struct codesignature_command {
351
- uint32_t cmd;
352
- uint32_t cmdsize;
353
- uint32_t dataoff;
354
- uint32_t datasize;
355
- };
356
-
357
- struct encryption_info_command {
358
- uint32_t cmd;
359
- uint32_t cmdsize;
360
- uint32_t cryptoff;
361
- uint32_t cryptsize;
362
- uint32_t cryptid;
363
- };
364
-
365
- struct encryption_info_command_64
366
- {
367
- uint32_t cmd;
368
- uint32_t cmdsize;
369
- uint32_t cryptoff;
370
- uint32_t cryptsize;
371
- uint32_t cryptid;
372
- uint32_t pad;
373
- };
374
-
375
- struct segment_command { /* for 32-bit architectures */
376
- uint32_t cmd; /* LC_SEGMENT */
377
- uint32_t cmdsize; /* includes sizeof section structs */
378
- char segname[16]; /* segment name */
379
- uint32_t vmaddr; /* memory address of this segment */
380
- uint32_t vmsize; /* memory size of this segment */
381
- uint32_t fileoff; /* file offset of this segment */
382
- uint32_t filesize; /* amount to map from the file */
383
- vm_prot_t maxprot; /* maximum VM protection */
384
- vm_prot_t initprot; /* initial VM protection */
385
- uint32_t nsects; /* number of sections in segment */
386
- uint32_t flags; /* flags */
387
- };
388
-
389
- struct segment_command_64 { /* for 64-bit architectures */
390
- uint32_t cmd; /* LC_SEGMENT_64 */
391
- uint32_t cmdsize; /* includes sizeof section_64 structs */
392
- char segname[16]; /* segment name */
393
- uint64_t vmaddr; /* memory address of this segment */
394
- uint64_t vmsize; /* memory size of this segment */
395
- uint64_t fileoff; /* file offset of this segment */
396
- uint64_t filesize; /* amount to map from the file */
397
- vm_prot_t maxprot; /* maximum VM protection */
398
- vm_prot_t initprot; /* initial VM protection */
399
- uint32_t nsects; /* number of sections in segment */
400
- uint32_t flags; /* flags */
401
- };
402
-
403
- struct section { /* for 32-bit architectures */
404
- char sectname[16]; /* name of this section */
405
- char segname[16]; /* segment this section goes in */
406
- uint32_t addr; /* memory address of this section */
407
- uint32_t size; /* size in bytes of this section */
408
- uint32_t offset; /* file offset of this section */
409
- uint32_t align; /* section alignment (power of 2) */
410
- uint32_t reloff; /* file offset of relocation entries */
411
- uint32_t nreloc; /* number of relocation entries */
412
- uint32_t flags; /* flags (section type and attributes)*/
413
- uint32_t reserved1; /* reserved */
414
- uint32_t reserved2; /* reserved */
415
- };
416
-
417
- struct section_64 { /* for 64-bit architectures */
418
- char sectname[16]; /* name of this section */
419
- char segname[16]; /* segment this section goes in */
420
- uint64_t addr; /* memory address of this section */
421
- uint64_t size; /* size in bytes of this section */
422
- uint32_t offset; /* file offset of this section */
423
- uint32_t align; /* section alignment (power of 2) */
424
- uint32_t reloff; /* file offset of relocation entries */
425
- uint32_t nreloc; /* number of relocation entries */
426
- uint32_t flags; /* flags (section type and attributes)*/
427
- uint32_t reserved1; /* reserved (for offset or index) */
428
- uint32_t reserved2; /* reserved (for count or sizeof) */
429
- uint32_t reserved3; /* reserved */
430
- };
431
-
432
- union lc_str {
433
- uint32_t offset; /* offset to the string */
434
- };
435
-
436
- struct dylib {
437
- union lc_str name; /* library's path name */
438
- uint32_t timestamp; /* library's build time stamp */
439
- uint32_t current_version; /* library's current version number */
440
- uint32_t compatibility_version; /* library's compatibility vers number*/
441
- };
442
-
443
- struct dylib_command {
444
- uint32_t cmd; /* LC_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB,LC_REEXPORT_DYLIB */
445
- uint32_t cmdsize; /* includes pathname string */
446
- struct dylib dylib; /* the library identification */
447
- };
448
-
449
- #pragma pack(pop)
450
-
451
- //////CodeSignature
452
-
453
- enum eCSFLAGS
454
- {
455
- CSMAGIC_REQUIREMENT = 0xfade0c00, /* single Requirement blob */
456
- CSMAGIC_REQUIREMENTS = 0xfade0c01, /* Requirements vector (internal requirements) */
457
- CSMAGIC_CODEDIRECTORY = 0xfade0c02, /* CodeDirectory blob */
458
- CSMAGIC_EMBEDDED_SIGNATURE = 0xfade0cc0, /* embedded form of signature data */
459
- CSMAGIC_EMBEDDED_SIGNATURE_OLD = 0xfade0b02, /* XXX */
460
- CSMAGIC_EMBEDDED_ENTITLEMENTS = 0xfade7171, /* embedded entitlements */
461
- CSMAGIC_EMBEDDED_DER_ENTITLEMENTS = 0xfade7172, /* der format entitlements */
462
- CSMAGIC_DETACHED_SIGNATURE = 0xfade0cc1, /* multi-arch collection of embedded signatures */
463
- CSMAGIC_BLOBWRAPPER = 0xfade0b01, /* CMS Signature, among other things */
464
- CS_SUPPORTSSCATTER = 0x20100,
465
- CS_SUPPORTSTEAMID = 0x20200,
466
- CS_SUPPORTSCODELIMIT64 = 0x20300,
467
- CS_SUPPORTSEXECSEG = 0x20400,
468
- CSSLOT_CODEDIRECTORY = 0, /* slot index for CodeDirectory */
469
- CSSLOT_INFOSLOT = 1,
470
- CSSLOT_REQUIREMENTS = 2,
471
- CSSLOT_RESOURCEDIR = 3,
472
- CSSLOT_APPLICATION = 4,
473
- CSSLOT_ENTITLEMENTS = 5,
474
- CSSLOT_DER_ENTITLEMENTS = 7, /* der format entitlement type */
475
- CSSLOT_ALTERNATE_CODEDIRECTORIES = 0x1000, /* first alternate CodeDirectory, if any */
476
- CSSLOT_ALTERNATE_CODEDIRECTORY_MAX = 5, /* max number of alternate CD slots */
477
- CSSLOT_ALTERNATE_CODEDIRECTORY_LIMIT = CSSLOT_ALTERNATE_CODEDIRECTORIES + CSSLOT_ALTERNATE_CODEDIRECTORY_MAX, /* one past the last */
478
- CSSLOT_SIGNATURESLOT = 0x10000, /* CMS Signature */
479
- CSSLOT_IDENTIFICATIONSLOT = 0x10001,
480
- CSSLOT_TICKETSLOT = 0x10002,
481
- CSTYPE_INDEX_REQUIREMENTS = 0x00000002, /* compat with amfi */
482
- CSTYPE_INDEX_ENTITLEMENTS = 0x00000005, /* compat with amfi */
483
- CS_HASHTYPE_SHA1 = 1,
484
- CS_HASHTYPE_SHA256 = 2,
485
- CS_HASHTYPE_SHA256_TRUNCATED = 3,
486
- CS_HASHTYPE_SHA384 = 4,
487
- CS_SHA1_LEN = 20,
488
- CS_SHA256_LEN = 32,
489
- CS_SHA256_TRUNCATED_LEN = 20,
490
- CS_CDHASH_LEN = 20, /* always - larger hashes are truncated */
491
- CS_HASH_MAX_SIZE = 48, /* max size of the hash we'll support */
492
- CS_EXECSEG_MAIN_BINARY = 0x1,
493
- CS_EXECSEG_ALLOW_UNSIGNED = 0x10,
494
-
495
- /*
496
- * Currently only to support Legacy VPN plugins,
497
- * but intended to replace all the various platform code, dev code etc. bits.
498
- */
499
- CS_SIGNER_TYPE_UNKNOWN = 0,
500
- CS_SIGNER_TYPE_LEGACYVPN = 5,
501
-
502
- /*
503
- * Flags that can be specified in `CS_CodeDirectory::flags`.
504
- */
505
- CS_SEC_CODESIGNATURE_ADHOC = 0x0002, /* kSecCodeSignatureAdhoc */
506
- };
507
-
508
- #pragma pack(push, 1)
509
-
510
- /*
511
- * Structure of an embedded-signature SuperBlob
512
- */
513
- struct CS_BlobIndex {
514
- uint32_t type; /* type of entry */
515
- uint32_t offset; /* offset of entry */
516
- };
517
-
518
- struct CS_SuperBlob {
519
- uint32_t magic; /* magic number */
520
- uint32_t length; /* total length of SuperBlob */
521
- uint32_t count; /* number of index entries following */
522
- //CS_BlobIndex index[]; /* (count) entries */
523
- /* followed by Blobs in no particular order as indicated by offsets in index */
524
- };
525
-
526
- /*
527
- * C form of a CodeDirectory.
528
- */
529
- struct CS_CodeDirectory {
530
- uint32_t magic; /* magic number (CSMAGIC_CODEDIRECTORY) */
531
- uint32_t length; /* total length of CodeDirectory blob */
532
- uint32_t version; /* compatibility version */
533
- uint32_t flags; /* setup and mode flags */
534
- uint32_t hashOffset; /* offset of hash slot element at index zero */
535
- uint32_t identOffset; /* offset of identifier string */
536
- uint32_t nSpecialSlots; /* number of special hash slots */
537
- uint32_t nCodeSlots; /* number of ordinary (code) hash slots */
538
- uint32_t codeLimit; /* limit to main image signature range */
539
- uint8_t hashSize; /* size of each hash in bytes */
540
- uint8_t hashType; /* type of hash (cdHashType* constants) */
541
- uint8_t spare1; /* unused (must be zero) */
542
- uint8_t pageSize; /* log2(page size in bytes); 0 => infinite */
543
- uint32_t spare2; /* unused (must be zero) */
544
- //char end_earliest[0];
545
-
546
- /* Version 0x20100 */
547
- uint32_t scatterOffset; /* offset of optional scatter vector */
548
- //char end_withScatter[0];
549
-
550
- /* Version 0x20200 */
551
- uint32_t teamOffset; /* offset of optional team identifier */
552
- //char end_withTeam[0];
553
-
554
- /* Version 0x20300 */
555
- uint32_t spare3; /* unused (must be zero) */
556
- uint64_t codeLimit64; /* limit to main image signature range, 64 bits */
557
- //char end_withCodeLimit64[0];
558
-
559
- /* Version 0x20400 */
560
- uint64_t execSegBase; /* offset of executable segment */
561
- uint64_t execSegLimit; /* limit of executable segment */
562
- uint64_t execSegFlags; /* executable segment flags */
563
- //char end_withExecSeg[0];
564
-
565
- /* followed by dynamic content as located by offset fields above */
566
- };
567
-
568
- struct CS_Entitlement {
569
- uint32_t magic;
570
- uint32_t length;
571
- };
572
-
573
- struct CS_GenericBlob {
574
- uint32_t magic; /* magic number */
575
- uint32_t length; /* total length of blob */
576
- };
577
-
578
- struct CS_Scatter {
579
- uint32_t count; // number of pages; zero for sentinel (only)
580
- uint32_t base; // first page number
581
- uint64_t targetOffset; // offset in target
582
- uint64_t spare; // reserved
583
- };
584
-
585
- #pragma pack(pop)
1
+ #pragma once
2
+
3
+ typedef int cpu_type_t;
4
+ typedef int cpu_subtype_t;
5
+ typedef int vm_prot_t;
6
+
7
+ /*
8
+ * Capability bits used in the definition of cpu_type.
9
+ */
10
+ #define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
11
+ #define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
12
+ #define CPU_ARCH_ABI64_32 0x02000000
13
+
14
+ /*
15
+ * Machine types known by all.
16
+ */
17
+ #define CPU_TYPE_ANY -1
18
+ #define CPU_TYPE_VAX 1
19
+ #define CPU_TYPE_MC680x0 6
20
+ #define CPU_TYPE_X86 7
21
+ #define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
22
+ #define CPU_TYPE_MIPS 8
23
+ #define CPU_TYPE_MC98000 10
24
+ #define CPU_TYPE_HPPA 11
25
+ #define CPU_TYPE_ARM 12
26
+ #define CPU_TYPE_MC88000 13
27
+ #define CPU_TYPE_SPARC 14
28
+ #define CPU_TYPE_I860 15
29
+ #define CPU_TYPE_ALPHA 16
30
+ #define CPU_TYPE_POWERPC 18
31
+ #define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
32
+ #define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
33
+ #define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
34
+ #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
35
+
36
+ /*
37
+ * Machine subtypes (these are defined here, instead of in a machine
38
+ * dependent directory, so that any program can get all definitions
39
+ * regardless of where is it compiled).
40
+ */
41
+
42
+ /*
43
+ * Capability bits used in the definition of cpu_subtype.
44
+ */
45
+ #define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
46
+ #define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
47
+
48
+ /*
49
+ * Object files that are hand-crafted to run on any
50
+ * implementation of an architecture are tagged with
51
+ * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
52
+ * the "ALL" subtype of an architecture except that it allows us
53
+ * to easily find object files that may need to be modified
54
+ * whenever a new implementation of an architecture comes out.
55
+ *
56
+ * It is the responsibility of the implementor to make sure the
57
+ * software handles unsupported implementations elegantly.
58
+ */
59
+ #define CPU_SUBTYPE_MULTIPLE -1
60
+ #define CPU_SUBTYPE_LITTLE_ENDIAN 0
61
+ #define CPU_SUBTYPE_BIG_ENDIAN 1
62
+
63
+ /*
64
+ * I386 subtypes
65
+ */
66
+
67
+ #define CPU_SUBTYPE_INTEL(f, m) ((f) + ((m) << 4))
68
+
69
+ #define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
70
+ #define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
71
+ #define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
72
+ #define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
73
+ #define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
74
+ #define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
75
+ #define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
76
+ #define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
77
+ #define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
78
+ #define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
79
+ #define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
80
+ #define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
81
+ #define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
82
+ #define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
83
+ #define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
84
+ #define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
85
+ #define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
86
+ #define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
87
+ #define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
88
+ #define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
89
+ #define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
90
+
91
+ #define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
92
+ #define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
93
+
94
+ #define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
95
+ #define CPU_SUBTYPE_INTEL_MODEL_ALL 0
96
+
97
+ /*
98
+ * X86 subtypes.
99
+ */
100
+
101
+ #define CPU_SUBTYPE_X86_ALL 3
102
+ #define CPU_SUBTYPE_X86_64_ALL 3
103
+ #define CPU_SUBTYPE_X86_ARCH1 4
104
+ #define CPU_SUBTYPE_X86_64_H 8
105
+
106
+ #define CPU_SUBTYPE_ARM_ALL 0
107
+ #define CPU_SUBTYPE_ARM_A500_ARCH 1
108
+ #define CPU_SUBTYPE_ARM_A500 2
109
+ #define CPU_SUBTYPE_ARM_A440 3
110
+ #define CPU_SUBTYPE_ARM_M4 4
111
+ #define CPU_SUBTYPE_ARM_V4T 5
112
+ #define CPU_SUBTYPE_ARM_V6 6
113
+ #define CPU_SUBTYPE_ARM_V5 7
114
+ #define CPU_SUBTYPE_ARM_V5TEJ 7
115
+ #define CPU_SUBTYPE_ARM_XSCALE 8
116
+ #define CPU_SUBTYPE_ARM_V7 9
117
+ #define CPU_SUBTYPE_ARM_V7S 11
118
+ #define CPU_SUBTYPE_ARM_V7K 12
119
+ #define CPU_SUBTYPE_ARM_V8 13
120
+ #define CPU_SUBTYPE_ARM_V6M 14
121
+ #define CPU_SUBTYPE_ARM_V7M 15
122
+ #define CPU_SUBTYPE_ARM_V7EM 16
123
+
124
+ #define CPU_SUBTYPE_ARM64_ALL 0
125
+ #define CPU_SUBTYPE_ARM64_V8 1
126
+ #define CPU_SUBTYPE_ARM64E 2
127
+ #define CPU_SUBTYPE_ARM64_32_V8 1
128
+
129
+
130
+ #define FAT_MAGIC 0xcafebabe
131
+ #define FAT_CIGAM 0xbebafeca
132
+
133
+ #define MH_MAGIC 0xfeedface
134
+ #define MH_CIGAM 0xcefaedfe
135
+ #define MH_MAGIC_64 0xfeedfacf
136
+ #define MH_CIGAM_64 0xcffaedfe
137
+
138
+
139
+ /* Constants for the cmd field of new load commands, the type */
140
+
141
+ #define MH_OBJECT 0x1 /* relocatable object file */
142
+ #define MH_EXECUTE 0x2 /* demand paged executable file */
143
+ #define MH_FVMLIB 0x3 /* fixed VM shared library file */
144
+ #define MH_CORE 0x4 /* core file */
145
+ #define MH_PRELOAD 0x5 /* preloaded executable file */
146
+ #define MH_DYLIB 0x6 /* dynamicly bound shared library file*/
147
+ #define MH_DYLINKER 0x7 /* dynamic link editor */
148
+ #define MH_BUNDLE 0x8 /* dynamicly bound bundle file */
149
+ #define MH_DYLIB_STUB 0x9 // Dynamic shared library stub
150
+ #define MH_DSYM 0xa // Companion debug sections file
151
+ #define MH_KEXT_BUNDLE 0xb // Kernel extension
152
+
153
+ /* Constants for the flags field of the mach_header */
154
+ #define MH_NOUNDEFS 0x00000001 /* the object file has no undefined references, can be executed */
155
+ #define MH_INCRLINK 0x00000002 /* the object file is the output of an incremental link against a base file and can't be link edited again */
156
+ #define MH_DYLDLINK 0x00000004 /* the object file is input for the dynamic linker and can't be staticly link edited again */
157
+ #define MH_BINDATLOAD 0x00000008 /* the object file's undefined references are bound by the dynamic linker when loaded. */
158
+ #define MH_PREBOUND 0x00000010 /* the file has it's dynamic undefined references prebound. */
159
+ #define MH_SPLIT_SEGS 0x00000020
160
+ #define MH_LAZY_INIT 0x00000040
161
+ #define MH_TWOLEVEL 0x00000080
162
+ #define MH_FORCE_FLAT 0x00000100
163
+ #define MH_NOMULTIDEFS 0x00000200
164
+ #define MH_NOFIXPREBINDING 0x00000400
165
+ #define MH_PREBINDABLE 0x00000800
166
+ #define MH_ALLMODSBOUND 0x00001000
167
+ #define MH_SUBSECTIONS_VIA_SYMBOLS 0x00002000
168
+ #define MH_CANONICAL 0x00004000
169
+ #define MH_WEAK_DEFINES 0x00008000
170
+ #define MH_BINDS_TO_WEAK 0x00010000
171
+ #define MH_ALLOW_STACK_EXECUTION 0x00020000
172
+ #define MH_ROOT_SAFE 0x00040000
173
+ #define MH_SETUID_SAFE 0x00080000
174
+ #define MH_NO_REEXPORTED_DYLIBS 0x00100000
175
+ #define MH_PIE 0x00200000
176
+ #define MH_DEAD_STRIPPABLE_DYLIB 0x00400000
177
+ #define MH_HAS_TLV_DESCRIPTORS 0x00800000
178
+ #define MH_NO_HEAP_EXECUTION 0x01000000
179
+ #define MH_APP_EXTENSION_SAFE 0x02000000
180
+
181
+
182
+ /* Constants for the cmd field of all load commands, the type */
183
+ #define LC_SEGMENT 0x00000001 /* segment of this file to be mapped */
184
+ #define LC_SYMTAB 0x00000002 /* link-edit stab symbol table info */
185
+ #define LC_SYMSEG 0x00000003 /* link-edit gdb symbol table info (obsolete) */
186
+ #define LC_THREAD 0x00000004 /* thread */
187
+ #define LC_UNIXTHREAD 0x00000005 /* unix thread (includes a stack) */
188
+ #define LC_LOADFVMLIB 0x00000006 /* load a specified fixed VM shared library */
189
+ #define LC_IDFVMLIB 0x00000007 /* fixed VM shared library identification */
190
+ #define LC_IDENT 0x00000008 /* object identification info (obsolete) */
191
+ #define LC_FVMFILE 0x00000009 /* fixed VM file inclusion (internal use) */
192
+ #define LC_PREPAGE 0x0000000a /* prepage command (internal use) */
193
+ #define LC_DYSYMTAB 0x0000000b /* dynamic link-edit symbol table info */
194
+ #define LC_LOAD_DYLIB 0x0000000c /* load a dynamicly linked shared library */
195
+ #define LC_ID_DYLIB 0x0000000d /* dynamicly linked shared lib identification */
196
+ #define LC_LOAD_DYLINKER 0x0000000e /* load a dynamic linker */
197
+ #define LC_ID_DYLINKER 0x0000000f /* dynamic linker identification */
198
+ #define LC_PREBOUND_DYLIB 0x00000010 /* modules prebound for a dynamicly */
199
+ #define LC_ROUTINES 0x00000011
200
+ #define LC_SUB_FRAMEWORK 0x00000012
201
+ #define LC_SUB_UMBRELLA 0x00000013
202
+ #define LC_SUB_CLIENT 0x00000014
203
+ #define LC_SUB_LIBRARY 0x00000015
204
+ #define LC_TWOLEVEL_HINTS 0x00000016
205
+ #define LC_PREBIND_CKSUM 0x00000017
206
+ #define LC_LOAD_WEAK_DYLIB 0x80000018
207
+ #define LC_SEGMENT_64 0x00000019
208
+ #define LC_ROUTINES_64 0x0000001A
209
+ #define LC_UUID 0x0000001B
210
+ #define LC_RPATH 0x8000001C
211
+ #define LC_CODE_SIGNATURE 0x0000001D
212
+ #define LC_SEGMENT_SPLIT_INFO 0x0000001E
213
+ #define LC_REEXPORT_DYLIB 0x8000001F
214
+ #define LC_LAZY_LOAD_DYLIB 0x00000020
215
+ #define LC_ENCRYPTION_INFO 0x00000021
216
+ #define LC_DYLD_INFO 0x00000022
217
+ #define LC_DYLD_INFO_ONLY 0x80000022
218
+ #define LC_LOAD_UPWARD_DYLIB 0x80000023
219
+ #define LC_VERSION_MIN_MACOSX 0x00000024
220
+ #define LC_VERSION_MIN_IPHONEOS 0x00000025
221
+ #define LC_FUNCTION_STARTS 0x00000026
222
+ #define LC_DYLD_ENVIRONMENT 0x00000027
223
+ #define LC_MAIN 0x80000028
224
+ #define LC_DATA_IN_CODE 0x00000029
225
+ #define LC_SOURCE_VERSION 0x0000002A
226
+ #define LC_DYLIB_CODE_SIGN_DRS 0x0000002B
227
+ #define LC_ENCRYPTION_INFO_64 0x0000002C
228
+ #define LC_LINKER_OPTION 0x0000002D
229
+ #define LC_LINKER_OPTIMIZATION_HINT 0x0000002E
230
+ #define LC_VERSION_MIN_TVOS 0x0000002F
231
+ #define LC_VERSION_MIN_WATCHOS 0x00000030
232
+
233
+ /* Constants for the flags field of the segment_command */
234
+ #define SG_HIGHVM 0x00000001 /* the file contents for this segment is for
235
+ the high part of the VM space, the low part
236
+ is zero filled (for stacks in core files) */
237
+ #define SG_FVMLIB 0x00000002 /* this segment is the VM that is allocated by
238
+ a fixed VM library, for overlap checking in
239
+ the link editor */
240
+ #define SG_NORELOC 0x00000004 /* this segment has nothing that was relocated
241
+ in it and nothing relocated to it, that is
242
+ it maybe safely replaced without relocation*/
243
+ #define SG_PROTECTED_VERSION_1 0x00000008 // Segment is encryption protected
244
+
245
+
246
+ // Section flag masks
247
+ #define SECTION_TYPE 0x000000ff // Section type mask
248
+ #define SECTION_ATTRIBUTES 0xffffff00 // Section attributes mask
249
+
250
+ // Section type (use SECTION_TYPE mask)
251
+
252
+ #define S_REGULAR 0x00
253
+ #define S_ZEROFILL 0x01
254
+ #define S_CSTRING_LITERALS 0x02
255
+ #define S_4BYTE_LITERALS 0x03
256
+ #define S_8BYTE_LITERALS 0x04
257
+ #define S_LITERAL_POINTERS 0x05
258
+ #define S_NON_LAZY_SYMBOL_POINTERS 0x06
259
+ #define S_LAZY_SYMBOL_POINTERS 0x07
260
+ #define S_SYMBOL_STUBS 0x08
261
+ #define S_MOD_INIT_FUNC_POINTERS 0x09
262
+ #define S_MOD_TERM_FUNC_POINTERS 0x0a
263
+ #define S_COALESCED 0x0b
264
+ #define S_GB_ZEROFILL 0x0c
265
+ #define S_INTERPOSING 0x0d
266
+ #define S_16BYTE_LITERALS 0x0e
267
+ #define S_DTRACE_DOF 0x0f
268
+ #define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10
269
+ #define S_THREAD_LOCAL_REGULAR 0x11
270
+ #define S_THREAD_LOCAL_ZEROFILL 0x12
271
+ #define S_THREAD_LOCAL_VARIABLES 0x13
272
+ #define S_THREAD_LOCAL_VARIABLE_POINTERS 0x14
273
+ #define S_THREAD_LOCAL_INIT_FUNCTION_POINTERS 0x15
274
+
275
+ // Section attributes (use SECTION_ATTRIBUTES mask)
276
+
277
+ #define S_ATTR_PURE_INSTRUCTIONS 0x80000000 // Only pure instructions
278
+ #define S_ATTR_NO_TOC 0x40000000 // Contains coalesced symbols
279
+ #define S_ATTR_STRIP_STATIC_SYMS 0x20000000 // Can strip static symbols
280
+ #define S_ATTR_NO_DEAD_STRIP 0x10000000 // No dead stripping
281
+ #define S_ATTR_LIVE_SUPPORT 0x08000000 // Live blocks support
282
+ #define S_ATTR_SELF_MODIFYING_CODE 0x04000000 // Self modifying code
283
+ #define S_ATTR_DEBUG 0x02000000 // Debug section
284
+ #define S_ATTR_SOME_INSTRUCTIONS 0x00000400 // Some machine instructions
285
+ #define S_ATTR_EXT_RELOC 0x00000200 // Has external relocations
286
+ #define S_ATTR_LOC_RELOC 0x00000100 // Has local relocations
287
+
288
+
289
+ //struct define
290
+
291
+ #pragma pack(push, 1)
292
+
293
+ struct fat_header
294
+ {
295
+ uint32_t magic; /* FAT_MAGIC */
296
+ uint32_t nfat_arch; /* number of structs that follow */
297
+ };
298
+
299
+ struct fat_arch
300
+ {
301
+ cpu_type_t cputype; /* cpu specifier (int) */
302
+ cpu_subtype_t cpusubtype; /* machine specifier (int) */
303
+ uint32_t offset; /* file offset to this object file */
304
+ uint32_t size; /* size of this object file */
305
+ uint32_t align; /* alignment as a power of 2 */
306
+ };
307
+
308
+ struct mach_header
309
+ {
310
+ uint32_t magic; /* mach magic number identifier */
311
+ cpu_type_t cputype; /* cpu specifier */
312
+ cpu_subtype_t cpusubtype; /* machine specifier */
313
+ uint32_t filetype; /* type of file */
314
+ uint32_t ncmds; /* number of load commands */
315
+ uint32_t sizeofcmds; /* the size of all the load commands */
316
+ uint32_t flags; /* flags */
317
+ };
318
+
319
+ struct mach_header_64
320
+ {
321
+ uint32_t magic; /* mach magic number identifier */
322
+ cpu_type_t cputype; /* cpu specifier */
323
+ cpu_subtype_t cpusubtype; /* machine specifier */
324
+ uint32_t filetype; /* type of file */
325
+ uint32_t ncmds; /* number of load commands */
326
+ uint32_t sizeofcmds; /* the size of all the load commands */
327
+ uint32_t flags; /* flags */
328
+ uint32_t reserved; /* reserved */
329
+ };
330
+
331
+ struct load_command
332
+ {
333
+ uint32_t cmd; /* type of load command */
334
+ uint32_t cmdsize; /* total size of command in bytes */
335
+ };
336
+
337
+ struct uuid_command {
338
+ uint32_t cmd;
339
+ uint32_t cmdsize;
340
+ uint8_t uuid[16];
341
+ };
342
+
343
+ struct entry_point_command {
344
+ uint32_t cmd;
345
+ uint32_t cmdsize;
346
+ uint64_t entryoff;
347
+ uint64_t stacksize;
348
+ };
349
+
350
+ struct codesignature_command {
351
+ uint32_t cmd;
352
+ uint32_t cmdsize;
353
+ uint32_t dataoff;
354
+ uint32_t datasize;
355
+ };
356
+
357
+ struct encryption_info_command {
358
+ uint32_t cmd;
359
+ uint32_t cmdsize;
360
+ uint32_t cryptoff;
361
+ uint32_t cryptsize;
362
+ uint32_t cryptid;
363
+ };
364
+
365
+ struct encryption_info_command_64
366
+ {
367
+ uint32_t cmd;
368
+ uint32_t cmdsize;
369
+ uint32_t cryptoff;
370
+ uint32_t cryptsize;
371
+ uint32_t cryptid;
372
+ uint32_t pad;
373
+ };
374
+
375
+ struct segment_command { /* for 32-bit architectures */
376
+ uint32_t cmd; /* LC_SEGMENT */
377
+ uint32_t cmdsize; /* includes sizeof section structs */
378
+ char segname[16]; /* segment name */
379
+ uint32_t vmaddr; /* memory address of this segment */
380
+ uint32_t vmsize; /* memory size of this segment */
381
+ uint32_t fileoff; /* file offset of this segment */
382
+ uint32_t filesize; /* amount to map from the file */
383
+ vm_prot_t maxprot; /* maximum VM protection */
384
+ vm_prot_t initprot; /* initial VM protection */
385
+ uint32_t nsects; /* number of sections in segment */
386
+ uint32_t flags; /* flags */
387
+ };
388
+
389
+ struct segment_command_64 { /* for 64-bit architectures */
390
+ uint32_t cmd; /* LC_SEGMENT_64 */
391
+ uint32_t cmdsize; /* includes sizeof section_64 structs */
392
+ char segname[16]; /* segment name */
393
+ uint64_t vmaddr; /* memory address of this segment */
394
+ uint64_t vmsize; /* memory size of this segment */
395
+ uint64_t fileoff; /* file offset of this segment */
396
+ uint64_t filesize; /* amount to map from the file */
397
+ vm_prot_t maxprot; /* maximum VM protection */
398
+ vm_prot_t initprot; /* initial VM protection */
399
+ uint32_t nsects; /* number of sections in segment */
400
+ uint32_t flags; /* flags */
401
+ };
402
+
403
+ struct section { /* for 32-bit architectures */
404
+ char sectname[16]; /* name of this section */
405
+ char segname[16]; /* segment this section goes in */
406
+ uint32_t addr; /* memory address of this section */
407
+ uint32_t size; /* size in bytes of this section */
408
+ uint32_t offset; /* file offset of this section */
409
+ uint32_t align; /* section alignment (power of 2) */
410
+ uint32_t reloff; /* file offset of relocation entries */
411
+ uint32_t nreloc; /* number of relocation entries */
412
+ uint32_t flags; /* flags (section type and attributes)*/
413
+ uint32_t reserved1; /* reserved */
414
+ uint32_t reserved2; /* reserved */
415
+ };
416
+
417
+ struct section_64 { /* for 64-bit architectures */
418
+ char sectname[16]; /* name of this section */
419
+ char segname[16]; /* segment this section goes in */
420
+ uint64_t addr; /* memory address of this section */
421
+ uint64_t size; /* size in bytes of this section */
422
+ uint32_t offset; /* file offset of this section */
423
+ uint32_t align; /* section alignment (power of 2) */
424
+ uint32_t reloff; /* file offset of relocation entries */
425
+ uint32_t nreloc; /* number of relocation entries */
426
+ uint32_t flags; /* flags (section type and attributes)*/
427
+ uint32_t reserved1; /* reserved (for offset or index) */
428
+ uint32_t reserved2; /* reserved (for count or sizeof) */
429
+ uint32_t reserved3; /* reserved */
430
+ };
431
+
432
+ union lc_str {
433
+ uint32_t offset; /* offset to the string */
434
+ };
435
+
436
+ struct dylib {
437
+ union lc_str name; /* library's path name */
438
+ uint32_t timestamp; /* library's build time stamp */
439
+ uint32_t current_version; /* library's current version number */
440
+ uint32_t compatibility_version; /* library's compatibility vers number*/
441
+ };
442
+
443
+ struct dylib_command {
444
+ uint32_t cmd; /* LC_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB,LC_REEXPORT_DYLIB */
445
+ uint32_t cmdsize; /* includes pathname string */
446
+ struct dylib dylib; /* the library identification */
447
+ };
448
+
449
+ #pragma pack(pop)
450
+
451
+ //////CodeSignature
452
+
453
+ enum eCSFLAGS
454
+ {
455
+ CSMAGIC_REQUIREMENT = 0xfade0c00, /* single Requirement blob */
456
+ CSMAGIC_REQUIREMENTS = 0xfade0c01, /* Requirements vector (internal requirements) */
457
+ CSMAGIC_CODEDIRECTORY = 0xfade0c02, /* CodeDirectory blob */
458
+ CSMAGIC_EMBEDDED_SIGNATURE = 0xfade0cc0, /* embedded form of signature data */
459
+ CSMAGIC_EMBEDDED_SIGNATURE_OLD = 0xfade0b02, /* XXX */
460
+ CSMAGIC_EMBEDDED_ENTITLEMENTS = 0xfade7171, /* embedded entitlements */
461
+ CSMAGIC_EMBEDDED_DER_ENTITLEMENTS = 0xfade7172, /* der format entitlements */
462
+ CSMAGIC_DETACHED_SIGNATURE = 0xfade0cc1, /* multi-arch collection of embedded signatures */
463
+ CSMAGIC_BLOBWRAPPER = 0xfade0b01, /* CMS Signature, among other things */
464
+ CS_SUPPORTSSCATTER = 0x20100,
465
+ CS_SUPPORTSTEAMID = 0x20200,
466
+ CS_SUPPORTSCODELIMIT64 = 0x20300,
467
+ CS_SUPPORTSEXECSEG = 0x20400,
468
+ CSSLOT_CODEDIRECTORY = 0, /* slot index for CodeDirectory */
469
+ CSSLOT_INFOSLOT = 1,
470
+ CSSLOT_REQUIREMENTS = 2,
471
+ CSSLOT_RESOURCEDIR = 3,
472
+ CSSLOT_APPLICATION = 4,
473
+ CSSLOT_ENTITLEMENTS = 5,
474
+ CSSLOT_DER_ENTITLEMENTS = 7, /* der format entitlement type */
475
+ CSSLOT_ALTERNATE_CODEDIRECTORIES = 0x1000, /* first alternate CodeDirectory, if any */
476
+ CSSLOT_ALTERNATE_CODEDIRECTORY_MAX = 5, /* max number of alternate CD slots */
477
+ CSSLOT_ALTERNATE_CODEDIRECTORY_LIMIT = CSSLOT_ALTERNATE_CODEDIRECTORIES + CSSLOT_ALTERNATE_CODEDIRECTORY_MAX, /* one past the last */
478
+ CSSLOT_SIGNATURESLOT = 0x10000, /* CMS Signature */
479
+ CSSLOT_IDENTIFICATIONSLOT = 0x10001,
480
+ CSSLOT_TICKETSLOT = 0x10002,
481
+ CSTYPE_INDEX_REQUIREMENTS = 0x00000002, /* compat with amfi */
482
+ CSTYPE_INDEX_ENTITLEMENTS = 0x00000005, /* compat with amfi */
483
+ CS_HASHTYPE_SHA1 = 1,
484
+ CS_HASHTYPE_SHA256 = 2,
485
+ CS_HASHTYPE_SHA256_TRUNCATED = 3,
486
+ CS_HASHTYPE_SHA384 = 4,
487
+ CS_SHA1_LEN = 20,
488
+ CS_SHA256_LEN = 32,
489
+ CS_SHA256_TRUNCATED_LEN = 20,
490
+ CS_CDHASH_LEN = 20, /* always - larger hashes are truncated */
491
+ CS_HASH_MAX_SIZE = 48, /* max size of the hash we'll support */
492
+ CS_EXECSEG_MAIN_BINARY = 0x1,
493
+ CS_EXECSEG_ALLOW_UNSIGNED = 0x10,
494
+
495
+ /*
496
+ * Currently only to support Legacy VPN plugins,
497
+ * but intended to replace all the various platform code, dev code etc. bits.
498
+ */
499
+ CS_SIGNER_TYPE_UNKNOWN = 0,
500
+ CS_SIGNER_TYPE_LEGACYVPN = 5,
501
+
502
+ /*
503
+ * Flags that can be specified in `CS_CodeDirectory::flags`.
504
+ */
505
+ CS_SEC_CODESIGNATURE_ADHOC = 0x0002, /* kSecCodeSignatureAdhoc */
506
+ };
507
+
508
+ #pragma pack(push, 1)
509
+
510
+ /*
511
+ * Structure of an embedded-signature SuperBlob
512
+ */
513
+ struct CS_BlobIndex {
514
+ uint32_t type; /* type of entry */
515
+ uint32_t offset; /* offset of entry */
516
+ };
517
+
518
+ struct CS_SuperBlob {
519
+ uint32_t magic; /* magic number */
520
+ uint32_t length; /* total length of SuperBlob */
521
+ uint32_t count; /* number of index entries following */
522
+ //CS_BlobIndex index[]; /* (count) entries */
523
+ /* followed by Blobs in no particular order as indicated by offsets in index */
524
+ };
525
+
526
+ /*
527
+ * C form of a CodeDirectory.
528
+ */
529
+ struct CS_CodeDirectory {
530
+ uint32_t magic; /* magic number (CSMAGIC_CODEDIRECTORY) */
531
+ uint32_t length; /* total length of CodeDirectory blob */
532
+ uint32_t version; /* compatibility version */
533
+ uint32_t flags; /* setup and mode flags */
534
+ uint32_t hashOffset; /* offset of hash slot element at index zero */
535
+ uint32_t identOffset; /* offset of identifier string */
536
+ uint32_t nSpecialSlots; /* number of special hash slots */
537
+ uint32_t nCodeSlots; /* number of ordinary (code) hash slots */
538
+ uint32_t codeLimit; /* limit to main image signature range */
539
+ uint8_t hashSize; /* size of each hash in bytes */
540
+ uint8_t hashType; /* type of hash (cdHashType* constants) */
541
+ uint8_t spare1; /* unused (must be zero) */
542
+ uint8_t pageSize; /* log2(page size in bytes); 0 => infinite */
543
+ uint32_t spare2; /* unused (must be zero) */
544
+ //char end_earliest[0];
545
+
546
+ /* Version 0x20100 */
547
+ uint32_t scatterOffset; /* offset of optional scatter vector */
548
+ //char end_withScatter[0];
549
+
550
+ /* Version 0x20200 */
551
+ uint32_t teamOffset; /* offset of optional team identifier */
552
+ //char end_withTeam[0];
553
+
554
+ /* Version 0x20300 */
555
+ uint32_t spare3; /* unused (must be zero) */
556
+ uint64_t codeLimit64; /* limit to main image signature range, 64 bits */
557
+ //char end_withCodeLimit64[0];
558
+
559
+ /* Version 0x20400 */
560
+ uint64_t execSegBase; /* offset of executable segment */
561
+ uint64_t execSegLimit; /* limit of executable segment */
562
+ uint64_t execSegFlags; /* executable segment flags */
563
+ //char end_withExecSeg[0];
564
+
565
+ /* followed by dynamic content as located by offset fields above */
566
+ };
567
+
568
+ struct CS_Entitlement {
569
+ uint32_t magic;
570
+ uint32_t length;
571
+ };
572
+
573
+ struct CS_GenericBlob {
574
+ uint32_t magic; /* magic number */
575
+ uint32_t length; /* total length of blob */
576
+ };
577
+
578
+ struct CS_Scatter {
579
+ uint32_t count; // number of pages; zero for sentinel (only)
580
+ uint32_t base; // first page number
581
+ uint64_t targetOffset; // offset in target
582
+ uint64_t spare; // reserved
583
+ };
584
+
585
+ #pragma pack(pop)