+
+#ifndef LDID_NOPLIST
+ auto entitlements(plist(baton.entitlements_));
+ _scope({ plist_free(entitlements); });
+ _assert(plist_get_node_type(entitlements) == PLIST_DICT);
+
+ const auto entitled([&](const char *key) {
+ auto item(plist_dict_get_item(entitlements, key));
+ if (plist_get_node_type(item) != PLIST_BOOLEAN)
+ return false;
+ uint8_t value(0);
+ plist_get_bool_val(item, &value);
+ return value != 0;
+ });
+
+ if (entitled("get-task-allow"))
+ execs |= kSecCodeExecSegAllowUnsigned;
+ if (entitled("run-unsigned-code"))
+ execs |= kSecCodeExecSegAllowUnsigned;
+ if (entitled("com.apple.private.cs.debugger"))
+ execs |= kSecCodeExecSegDebugger;
+ if (entitled("dynamic-codesigning"))
+ execs |= kSecCodeExecSegJit;
+ if (entitled("com.apple.private.skip-library-validation"))
+ execs |= kSecCodeExecSegSkipLibraryVal;
+ if (entitled("com.apple.private.amfi.can-load-cdhash"))
+ execs |= kSecCodeExecSegCanLoadCdHash;
+ if (entitled("com.apple.private.amfi.can-execute-cdhash"))
+ execs |= kSecCodeExecSegCanExecCdHash;
+#endif