X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/79b9da22a1f4b26279940d285c1bc28ce4e99252..refs/heads/master:/OSX/libsecurity_codesigning/lib/SecStaticCode.cpp diff --git a/OSX/libsecurity_codesigning/lib/SecStaticCode.cpp b/OSX/libsecurity_codesigning/lib/SecStaticCode.cpp index 6e54a079..13d7b0f7 100644 --- a/OSX/libsecurity_codesigning/lib/SecStaticCode.cpp +++ b/OSX/libsecurity_codesigning/lib/SecStaticCode.cpp @@ -117,24 +117,32 @@ OSStatus SecStaticCodeCheckValidityWithErrors(SecStaticCodeRef staticCodeRef, Se | kSecCSNoNetworkAccess | kSecCSCheckNestedCode | kSecCSStrictValidate + | kSecCSStrictValidateStructure | kSecCSRestrictSidebandData | kSecCSCheckGatekeeperArchitectures | kSecCSRestrictSymlinks | kSecCSRestrictToAppLike - | kSecCSUseSoftwareSigningCert - | kSecCSValidatePEH + | kSecCSUseSoftwareSigningCert + | kSecCSValidatePEH + | kSecCSSingleThreaded + | kSecCSApplyEmbeddedPolicy + | kSecCSSkipRootVolumeExceptions + | kSecCSSkipXattrFiles ); if (errors) flags |= kSecCSFullReport; // internal-use flag +#if !TARGET_OS_OSX + flags |= kSecCSApplyEmbeddedPolicy; +#endif + SecPointer code = SecStaticCode::requiredStatic(staticCodeRef); code->setValidationFlags(flags); const SecRequirement *req = SecRequirement::optional(requirementRef); DTRACK(CODESIGN_EVAL_STATIC, code, (char*)code->mainExecutablePath().c_str()); code->staticValidate(flags, req); -#if TARGET_OS_IPHONE // Everything checked out correctly but we need to make sure that when // we validated the code directory, we trusted the signer. We defer this // until now because the caller may still trust the signer via a @@ -142,10 +150,9 @@ OSStatus SecStaticCodeCheckValidityWithErrors(SecStaticCodeRef staticCodeRef, Se // the directory, we potentially skip resource validation even though the // caller will go on to trust the signature // Applications that are validated against a provisioning profile do not have their resources checked - if (code->trustedSigningCertChain() == false) { + if ((flags & kSecCSApplyEmbeddedPolicy) && code->trustedSigningCertChain() == false) { return CSError::cfError(errors, errSecCSSignatureUntrusted); } -#endif END_CSAPI_ERRORS @@ -249,7 +256,7 @@ OSStatus SecCodeMapMemory(SecStaticCodeRef codeRef, SecCSFlags flags) MacOSError::throwMe(errSecCSNoMainExecutable); } - auto_ptr arch(execImage->architecture()); + unique_ptr arch(execImage->architecture()); if (arch.get() == NULL) { MacOSError::throwMe(errSecCSNoMainExecutable); }