]> git.saurik.com Git - apple/securityd.git/blobdiff - src/localkey.cpp
securityd-55199.3.tar.gz
[apple/securityd.git] / src / localkey.cpp
index e50d82f93a94df91249ee2e1d3c769b0b2331c4a..c8cb9fe5cf46c74db67e5401a0083b4125447ac2 100644 (file)
@@ -39,7 +39,7 @@ LocalKey::LocalKey(Database &db, const CssmKey &newKey, CSSM_KEYATTR_FLAGS moreA
 {
        mValidKey = true;
        setup(newKey, moreAttributes);
-    secdebug("SSkey", "%p (handle 0x%lx) created from key alg=%ld use=0x%lx attr=0x%lx db=%p",
+    secdebug("SSkey", "%p (handle %#x) created from key alg=%u use=0x%x attr=0x%x db=%p",
         this, handle(), mKey.header().algorithm(), mKey.header().usage(), mAttributes, &db);
 }
 
@@ -101,6 +101,7 @@ LocalDatabase &LocalKey::database() const
 //
 CssmClient::Key LocalKey::keyValue()
 {
+       StLock<Mutex> _(*this);
     if (!mValidKey) {
                getKey();
                mValidKey = true;
@@ -121,8 +122,10 @@ CSSM_KEYATTR_FLAGS LocalKey::attributes()
 //
 // Return a key's handle and header in external form
 //
-void LocalKey::returnKey(Handle &h, CssmKey::Header &hdr)
+void LocalKey::returnKey(U32HandleObject::Handle &h, CssmKey::Header &hdr)
 {
+       StLock<Mutex> _(*this);
+
     // return handle
     h = this->handle();
        
@@ -145,6 +148,7 @@ void LocalKey::returnKey(Handle &h, CssmKey::Header &hdr)
 //
 const CssmData &LocalKey::canonicalDigest()
 {
+       StLock<Mutex> _(*this);
        if (!mDigest) {
                CssmClient::PassThrough ctx(Server::csp());
                ctx.key(keyValue());