X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..dd5fb164cf5b32c462296bc65e289e100f74b59a:/OSX/libsecurity_codesigning/lib/cdbuilder.h?ds=sidebyside diff --git a/OSX/libsecurity_codesigning/lib/cdbuilder.h b/OSX/libsecurity_codesigning/lib/cdbuilder.h index 21f92405..761dcf63 100644 --- a/OSX/libsecurity_codesigning/lib/cdbuilder.h +++ b/OSX/libsecurity_codesigning/lib/cdbuilder.h @@ -41,7 +41,8 @@ namespace CodeSigning { // CodeDirectory *result = builder.build(); // Builder is not reusable. // -class CodeDirectory::Builder { +class CodeDirectory::Builder : public RefCount { + NOCOPY(Builder) public: Builder(HashAlgorithm digestAlgorithm); ~Builder(); @@ -54,13 +55,20 @@ public: void teamID(const std::string &team) { mTeamID = team; } void flags(uint32_t f) { mFlags = f; } void platform(uint8_t p) { mPlatform = p; } + std::set filledSpecialSlots() const { return mFilledSpecialSlots; } Scatter *scatter(unsigned count); // allocate that many scatter elements (w/o sentinel) Scatter *scatter() { return mScatter; } // return already allocated scatter vector - + + void execSeg(uint64_t base, uint64_t limit, uint64_t flags) { + mExecSegOffset = base; mExecSegLimit = limit; mExecSegFlags = flags; } + void addExecSegFlags(uint64_t flags) { mExecSegFlags |= flags; } + size_t size(const uint32_t version); // calculate size CodeDirectory *build(); // build CodeDirectory and return it - const size_t fixedSize(const uint32_t version); // calculate fixed size of the CodeDirectory + size_t fixedSize(const uint32_t version); // calculate fixed size of the CodeDirectory + + uint32_t hashType() const { return mHashType; } DynamicHash *getHash() const { return CodeDirectory::hashFor(this->mHashType); } @@ -72,6 +80,7 @@ private: private: Hashing::Byte *mSpecial; // array of special slot hashes + std::set mFilledSpecialSlots; // special slots filled with values UnixPlusPlus::AutoFileDesc mExec; // main executable file size_t mExecOffset; // starting offset in mExec size_t mExecLength; // total bytes of file to sign @@ -88,7 +97,11 @@ private: Scatter *mScatter; // scatter vector size_t mScatterSize; // number of scatter elements allocated (incl. sentinel) - + + uint64_t mExecSegOffset; // starting offset of executable segment + uint64_t mExecSegLimit; // limit of executable segment + uint64_t mExecSegFlags; // executable segment flags + CodeDirectory *mDir; // what we're building };