X-Git-Url: https://git.saurik.com/apple/libsecurity_codesigning.git/blobdiff_plain/7d31e9289af373b98c8a36838bd41fab5ad01b44..6aae018b5d43c30038cfa4003e5d4bcc81f134cf:/lib/SecCodeHostLib.c?ds=sidebyside diff --git a/lib/SecCodeHostLib.c b/lib/SecCodeHostLib.c index a79c85d..50dadf1 100644 --- a/lib/SecCodeHostLib.c +++ b/lib/SecCodeHostLib.c @@ -20,7 +20,7 @@ * * @APPLE_LICENSE_HEADER_END@ */ -//#include +#include "SecCodeHost.h" #include "SecCodeHostLib.h" #include #include @@ -64,8 +64,7 @@ OSStatus SecHostLibInit(SecCSFlags flags) if (KERN_SUCCESS != task_get_bootstrap_port(mach_task_self(), &bootstrapPort)) return errSecCSInternalError; static char serverName[BOOTSTRAP_MAX_NAME_LEN] = SECURITYSERVER_BOOTSTRAP_NAME; - if (KERN_SUCCESS != bootstrap_look_up(bootstrapPort, - serverName, &gServerPort)) + if (KERN_SUCCESS != bootstrap_look_up(bootstrapPort, serverName, &gServerPort)) return errSecCSInternalError; ClientSetupInfo info = { 0x1234, SSPROTOVERSION }; @@ -80,12 +79,19 @@ OSStatus SecHostLibInit(SecCSFlags flags) OSStatus SecHostLibCreateGuest(SecGuestRef host, uint32_t status, const char *path, const char *attributeXML, SecCSFlags flags, SecGuestRef *newGuest) +{ + return SecHostLibCreateGuest2(host, status, path, "", 0, attributeXML, flags, newGuest); +} + +OSStatus SecHostLibCreateGuest2(SecGuestRef host, + uint32_t status, const char *path, const void *cdhash, size_t cdhashLength, const char *attributeXML, + SecCSFlags flags, SecGuestRef *newGuest) { if (flags != kSecCSDedicatedHost) return errSecCSInvalidFlags; CALL(ucsp_client_createGuest(UCSP_ARGS, host, status, path, - ATTRDATA(attributeXML), flags, newGuest)); + (void *)cdhash, cdhashLength, ATTRDATA(attributeXML), flags, newGuest)); } @@ -107,3 +113,12 @@ OSStatus SecHostSetHostingPort(mach_port_t hostingPort, SecCSFlags flags) { CALL(ucsp_client_registerHosting(UCSP_ARGS, hostingPort, flags)); } + + +// +// Helper for checked incorporation of code. +// +OSStatus SecHostLibCheckLoad(const char *path, SecRequirementType type) +{ + CALL(ucsp_client_helpCheckLoad(UCSP_ARGS, path, type)); +}