]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_codesigning/lib/diskrep.cpp
Security-58286.41.2.tar.gz
[apple/security.git] / OSX / libsecurity_codesigning / lib / diskrep.cpp
index af0a336b2a1c436940b0a6a4045b42aed7b7f976..cc6e389a48301b1f364149a34e203bd0853959e5 100644 (file)
@@ -32,7 +32,9 @@
 #include "filediskrep.h"
 #include "bundlediskrep.h"
 #include "slcrep.h"
-
+#if TARGET_OS_OSX
+#include "diskimagerep.h"
+#endif
 
 namespace Security {
 namespace CodeSigning {
@@ -109,6 +111,10 @@ DiskRep *DiskRep::bestGuess(const char *path, const Context *ctx)
                AutoFileDesc fd(path, O_RDONLY);
                if (MachORep::candidate(fd))
                        return new MachORep(path, ctx);
+#if TARGET_OS_OSX
+               if (DiskImageRep::candidate(fd))
+                       return new DiskImageRep(path);
+#endif
                if (DYLDCacheRep::candidate(fd))
                        return new DYLDCacheRep(path);
 
@@ -178,6 +184,11 @@ void DiskRep::adjustResources(ResourceBuilder &builder)
 {
        // do nothing
 }
+       
+void DiskRep::prepareForSigning(SigningContext &state)
+{
+       // do nothing
+}
 
 Universal *DiskRep::mainExecutableImage()
 {
@@ -189,6 +200,11 @@ size_t DiskRep::signingBase()
        return 0;               // whole file (start at beginning)
 }
 
+size_t DiskRep::execSegBase(const Architecture *)
+{
+       return 0;               // whole file (start at beginning)
+}
+    
 CFArrayRef DiskRep::modifiedFiles()
 {
        // by default, claim (just) the main executable modified
@@ -201,6 +217,10 @@ void DiskRep::flush()
        // nothing cached
 }
 
+CFDictionaryRef DiskRep::diskRepInformation()
+{
+    return NULL;
+}
 
 CFDictionaryRef DiskRep::defaultResourceRules(const SigningContext &)
 {
@@ -218,9 +238,11 @@ size_t DiskRep::pageSize(const SigningContext &)
 }
 
 
-void DiskRep::strictValidate(const CodeDirectory*, const ToleratedErrors&)
+void DiskRep::strictValidate(const CodeDirectory*, const ToleratedErrors& tolerated, SecCSFlags flags)
 {
-       // do nothing
+       if (flags & kSecCSRestrictToAppLike)
+               if (tolerated.find(errSecCSNotAppLike) == tolerated.end())
+                       MacOSError::throwMe(errSecCSNotAppLike);
 }
 
 CFArrayRef DiskRep::allowedResourceOmissions()