#include <kern/cs_blobs.h>

kern/cs_blobs.h Kernel.framework

includes: Kernel/stdint.h, Kernel/string.h
41 macros · 8 typedefs · 7 structs · 4 enums · 1 variable

macroCS_VALID

code signing attributes of a process
#define CS_VALID 0x00000001
dynamically valid

macroCS_ADHOC

#define CS_ADHOC 0x00000002
ad hoc signed

macroCS_GET_TASK_ALLOW

#define CS_GET_TASK_ALLOW 0x00000004
has get-task-allow entitlement

macroCS_INSTALLER

#define CS_INSTALLER 0x00000008
has installer entitlement

macroCS_FORCED_LV

#define CS_FORCED_LV 0x00000010
Library Validation required by Hardened System Policy

macroCS_INVALID_ALLOWED

#define CS_INVALID_ALLOWED 0x00000020
(macOS Only) Page invalidation allowed by task port policy

macroCS_HARD

#define CS_HARD 0x00000100
don't load invalid pages

macroCS_KILL

#define CS_KILL 0x00000200
kill process if it becomes invalid

macroCS_CHECK_EXPIRATION

#define CS_CHECK_EXPIRATION 0x00000400
force expiration checking

macroCS_RESTRICT

#define CS_RESTRICT 0x00000800
tell dyld to treat restricted

macroCS_ENFORCEMENT

#define CS_ENFORCEMENT 0x00001000
require enforcement

macroCS_REQUIRE_LV

#define CS_REQUIRE_LV 0x00002000
require library validation

macroCS_ENTITLEMENTS_VALIDATED

#define CS_ENTITLEMENTS_VALIDATED 0x00004000
code signature permits restricted entitlements

macroCS_NVRAM_UNRESTRICTED

#define CS_NVRAM_UNRESTRICTED 0x00008000
has com.apple.rootless.restricted-nvram-variables.heritable entitlement

macroCS_RUNTIME

#define CS_RUNTIME 0x00010000
Apply hardened runtime policies

macroCS_LINKER_SIGNED

#define CS_LINKER_SIGNED 0x00020000
Automatically signed by the linker

macroCS_EXEC_SET_HARD

#define CS_EXEC_SET_HARD 0x00100000
set CS_HARD on any exec'ed process

macroCS_EXEC_SET_KILL

#define CS_EXEC_SET_KILL 0x00200000
set CS_KILL on any exec'ed process

macroCS_EXEC_SET_ENFORCEMENT

#define CS_EXEC_SET_ENFORCEMENT 0x00400000
set CS_ENFORCEMENT on any exec'ed process

macroCS_EXEC_INHERIT_SIP

#define CS_EXEC_INHERIT_SIP 0x00800000
set CS_INSTALLER on any exec'ed process

macroCS_KILLED

#define CS_KILLED 0x01000000
was killed by kernel for invalidity

macroCS_NO_UNTRUSTED_HELPERS

#define CS_NO_UNTRUSTED_HELPERS 0x02000000
kernel did not load a non-platform-binary dyld or Rosetta runtime

macroCS_DYLD_PLATFORM

#define CS_DYLD_PLATFORM CS_NO_UNTRUSTED_HELPERS
old name

macroCS_PLATFORM_BINARY

#define CS_PLATFORM_BINARY 0x04000000
this is a platform binary

macroCS_PLATFORM_PATH

#define CS_PLATFORM_PATH 0x08000000
platform binary by the fact of path (osx only)

macroCS_DEBUGGED

#define CS_DEBUGGED 0x10000000
process is currently or has previously been debugged and allowed to run with invalid pages

macroCS_SIGNED

#define CS_SIGNED 0x20000000
process has a signature (may have gone invalid)

macroCS_DEV_CODE

#define CS_DEV_CODE 0x40000000
code is dev signed, cannot be loaded into prod signed code (will go away with rdar://problem/28322552)

macroCS_DATAVAULT_CONTROLLER

#define CS_DATAVAULT_CONTROLLER 0x80000000
has Data Vault controller entitlement

macroCS_EXECSEG_MAIN_BINARY

#define CS_EXECSEG_MAIN_BINARY 0x1
executable segment denotes main binary

macroCS_EXECSEG_ALLOW_UNSIGNED

#define CS_EXECSEG_ALLOW_UNSIGNED 0x10
allow unsigned pages (for debugging)

macroCS_EXECSEG_DEBUGGER

#define CS_EXECSEG_DEBUGGER 0x20
main binary is debugger

macroCS_EXECSEG_JIT

#define CS_EXECSEG_JIT 0x40
JIT enabled

macroCS_EXECSEG_SKIP_LV

#define CS_EXECSEG_SKIP_LV 0x80
OBSOLETE: skip library validation

macroCS_EXECSEG_CAN_LOAD_CDHASH

#define CS_EXECSEG_CAN_LOAD_CDHASH 0x100
can bless cdhash for execution

macroCS_EXECSEG_CAN_EXEC_CDHASH

#define CS_EXECSEG_CAN_EXEC_CDHASH 0x200
can execute blessed cdhash

enum(anonymous)

Magic numbers used by Code Signing
underlying type unsigned int
CSMAGIC_REQUIREMENT4208856064single Requirement blob
CSMAGIC_REQUIREMENTS4208856065Requirements vector (internal requirements)
CSMAGIC_CODEDIRECTORY4208856066CodeDirectory blob
CSMAGIC_EMBEDDED_SIGNATURE4208856256embedded form of signature data
CSMAGIC_EMBEDDED_SIGNATURE_OLD4208855810XXX
CSMAGIC_EMBEDDED_ENTITLEMENTS4208882033embedded entitlements
CSMAGIC_EMBEDDED_DER_ENTITLEMENTS4208882034embedded DER encoded entitlements
CSMAGIC_DETACHED_SIGNATURE4208856257multi-arch collection of embedded signatures
CSMAGIC_BLOBWRAPPER4208855809CMS Signature, among other things
CSMAGIC_EMBEDDED_LAUNCH_CONSTRAINT4208886145Light weight code requirement
CS_SUPPORTSSCATTER131328
CS_SUPPORTSTEAMID131584
CS_SUPPORTSCODELIMIT64131840
CS_SUPPORTSEXECSEG132096
CS_SUPPORTSRUNTIME132352
CS_SUPPORTSLINKAGE132608
CSSLOT_CODEDIRECTORY0slot index for CodeDirectory
CSSLOT_INFOSLOT1
CSSLOT_REQUIREMENTS2
CSSLOT_RESOURCEDIR3
CSSLOT_APPLICATION4
CSSLOT_ENTITLEMENTS5
CSSLOT_DER_ENTITLEMENTS7
CSSLOT_LAUNCH_CONSTRAINT_SELF8
CSSLOT_LAUNCH_CONSTRAINT_PARENT9
CSSLOT_LAUNCH_CONSTRAINT_RESPONSIBLE10
CSSLOT_LIBRARY_CONSTRAINT11
CSSLOT_ALTERNATE_CODEDIRECTORIES4096first alternate CodeDirectory, if any
CSSLOT_ALTERNATE_CODEDIRECTORY_MAX5max number of alternate CD slots
CSSLOT_ALTERNATE_CODEDIRECTORY_LIMIT4101one past the last
CSSLOT_SIGNATURESLOT65536CMS Signature
CSSLOT_IDENTIFICATIONSLOT65537
CSSLOT_TICKETSLOT65538
CSTYPE_INDEX_REQUIREMENTS2compat with amfi
CSTYPE_INDEX_ENTITLEMENTS5compat with amfi
CS_HASHTYPE_SHA11
CS_HASHTYPE_SHA2562
CS_HASHTYPE_SHA256_TRUNCATED3
CS_HASHTYPE_SHA3844
CS_SHA1_LEN20
CS_SHA256_LEN32
CS_SHA256_TRUNCATED_LEN20
CS_CDHASH_LEN20always - larger hashes are truncated
CS_HASH_MAX_SIZE48max size of the hash we'll support
CS_SIGNER_TYPE_UNKNOWN0Currently only to support Legacy VPN plugins, and Mac App Store but intended to replace all the various platform code, dev code etc. bits.
CS_SIGNER_TYPE_LEGACYVPN5
CS_SIGNER_TYPE_MAC_APP_STORE6
CS_SUPPL_SIGNER_TYPE_UNKNOWN0
CS_SUPPL_SIGNER_TYPE_TRUSTCACHE7
CS_SUPPL_SIGNER_TYPE_LOCAL8
CS_SIGNER_TYPE_OOPJIT9
CS_VALIDATION_CATEGORY_INVALID0Validation categories used for trusted launch environment
CS_VALIDATION_CATEGORY_PLATFORM1
CS_VALIDATION_CATEGORY_TESTFLIGHT2
CS_VALIDATION_CATEGORY_DEVELOPMENT3
CS_VALIDATION_CATEGORY_APP_STORE4
CS_VALIDATION_CATEGORY_ENTERPRISE5
CS_VALIDATION_CATEGORY_DEVELOPER_ID6
CS_VALIDATION_CATEGORY_LOCAL_SIGNING7
CS_VALIDATION_CATEGORY_ROSETTA8
CS_VALIDATION_CATEGORY_OOPJIT9
CS_VALIDATION_CATEGORY_NONE10

enum(anonymous)

The set of application types we support for linkage signatures
underlying type unsigned int
CS_LINKAGE_APPLICATION_INVALID0
CS_LINKAGE_APPLICATION_ROSETTA1
CS_LINKAGE_APPLICATION_XOJIT2XOJIT has been renamed to OOP-JIT
CS_LINKAGE_APPLICATION_OOPJIT2

enum(anonymous)

The set of application sub-types we support for linkage signatures
underlying type unsigned int
CS_LINKAGE_APPLICATION_ROSETTA_AOT0For backwards compatibility with older signatures, the AOT sub-type is kept as 0.
CS_LINKAGE_APPLICATION_XOJIT_PREVIEWS1OOP-JIT sub-types -- XOJIT type kept for external dependencies
CS_LINKAGE_APPLICATION_OOPJIT_INVALID0
CS_LINKAGE_APPLICATION_OOPJIT_PREVIEWS1
CS_LINKAGE_APPLICATION_OOPJIT_MLCOMPILER2
CS_LINKAGE_APPLICATION_OOPJIT_TOTAL3

variableoop_jit_conversion

Integer to string conversion of OOP-JIT types
static const char *oop_jit_conversion[CS_LINKAGE_APPLICATION_OOPJIT_TOTAL] = { [CS_LINKAGE_APPLICATION_OOPJIT_INVALID] = NULL, [CS_LINKAGE_APPLICATION_OOPJIT_PREVIEWS] = "previews", [CS_LINKAGE_APPLICATION_OOPJIT_MLCOMPILER] = "ml-compiler", }

macroKERNEL_HAVE_CS_CODEDIRECTORY

#define KERNEL_HAVE_CS_CODEDIRECTORY 1

macroKERNEL_CS_CODEDIRECTORY_HAVE_PLATFORM

#define KERNEL_CS_CODEDIRECTORY_HAVE_PLATFORM 1

struct__CodeDirectory

C form of a CodeDirectory.
size 112, align 8
uint32_tmagicmagic number (CSMAGIC_CODEDIRECTORY)
uint32_tlengthtotal length of CodeDirectory blob
uint32_tversioncompatibility version
uint32_tflagssetup and mode flags
uint32_thashOffsetoffset of hash slot element at index zero
uint32_tidentOffsetoffset of identifier string
uint32_tnSpecialSlotsnumber of special hash slots
uint32_tnCodeSlotsnumber of ordinary (code) hash slots
uint32_tcodeLimitlimit to main image signature range
uint8_thashSizesize of each hash in bytes
uint8_thashTypetype of hash (cdHashType* constants)
uint8_tplatformplatform identifier; zero if not platform binary
uint8_tpageSizelog2(page size in bytes); 0 => infinite
uint32_tspare2unused (must be zero)
char[0]end_earliest
uint32_tscatterOffsetVersion 0x20100 offset of optional scatter vector
char[0]end_withScatter
uint32_tteamOffsetVersion 0x20200 offset of optional team identifier
char[0]end_withTeam
uint32_tspare3Version 0x20300 unused (must be zero)
uint64_tcodeLimit64limit to main image signature range, 64 bits
char[0]end_withCodeLimit64
uint64_texecSegBaseVersion 0x20400 offset of executable segment
uint64_texecSegLimitlimit of executable segment
uint64_texecSegFlagsexecutable segment flags
char[0]end_withExecSeg
uint32_truntimeVersion 0x20500
uint32_tpreEncryptOffset
char[0]end_withPreEncryptOffset
uint8_tlinkageHashTypeVersion 0x20600
uint8_tlinkageApplicationType
uint16_tlinkageApplicationSubType
uint32_tlinkageOffset
uint32_tlinkageSize
char[0]end_withLinkage

typedefCS_CodeDirectory

typedef struct __CodeDirectory CS_CodeDirectory;

struct__BlobIndex

size 8, align 4
uint32_ttypetype of entry
uint32_toffsetoffset of entry

typedefCS_BlobIndex

typedef struct __BlobIndex CS_BlobIndex;

struct__SC_SuperBlob

size 12, align 4
uint32_tmagicmagic number
uint32_tlengthtotal length of SuperBlob
uint32_tcountnumber of index entries following
CS_BlobIndex[]index(count) entries

typedefCS_SuperBlob

typedef struct __SC_SuperBlob CS_SuperBlob;

macroKERNEL_HAVE_CS_GENERICBLOB

#define KERNEL_HAVE_CS_GENERICBLOB 1

struct__SC_GenericBlob

size 8, align 4
uint32_tmagicmagic number
uint32_tlengthtotal length of blob
char[]data

typedefCS_GenericBlob

typedef struct __SC_GenericBlob CS_GenericBlob;

struct__SC_Scatter

size 24, align 8
uint32_tcountnumber of pages; zero for sentinel (only)
uint32_tbasefirst page number
uint64_ttargetOffsetoffset in target
uint64_tsparereserved

typedefSC_Scatter

typedef struct __SC_Scatter SC_Scatter;

enumcs_launch_type_t

Defined launch types
underlying type uint8_t
CS_LAUNCH_TYPE_NONE0
CS_LAUNCH_TYPE_SYSTEM_SERVICE1
CS_LAUNCH_TYPE_SYSDIAGNOSE2
CS_LAUNCH_TYPE_APPLICATION3

typedefcs_launch_type_t

typedef enum cs_launch_type_t cs_launch_type_t;

structlaunch_constraint_data

size 1, align 1
cs_launch_type_tlaunch_type

typedeflaunch_constraint_data_t

typedef struct launch_constraint_data* launch_constraint_data_t

struct_csops_cdhash

Ideally, this definition should live within sys/codesign.h, but adding it there causes an issue with compiling certain Swift projects due to some ambigious macro definition error on CD_CDHASH_LEN. Thus, we keep it here. For more information: rdar://145187726.
size 21, align 1
uint8_t[20]hash
uint8_ttype

typedefcsops_cdhash_t

typedef struct _csops_cdhash csops_cdhash_t;