]> git.saurik.com Git - apple/security.git/blobdiff - libsecurity_ssl/lib/appleSession.c
Security-55471.14.8.tar.gz
[apple/security.git] / libsecurity_ssl / lib / appleSession.c
index 6dc76a09686b8784eb78fe07d0711551f75ef9f8..4ef22b4f8347f519ea9511bc3f862b6a2b8b5fa4 100644 (file)
@@ -58,6 +58,8 @@
 #include <pthread.h>
 #include <string.h>
 
 #include <pthread.h>
 #include <string.h>
 
+#include <utilities/SecIOFormat.h>
+
 /* default time-to-live in cache, in seconds */
 #define QUICK_CACHE_TEST       0
 #if            QUICK_CACHE_TEST
 /* default time-to-live in cache, in seconds */
 #define QUICK_CACHE_TEST       0
 #if            QUICK_CACHE_TEST
@@ -143,7 +145,7 @@ static SessionCacheEntry *SessionCacheEntryCreate(
        }
        serr = SSLCopyBuffer(sessionData, &entry->mSessionData);
        if(serr) {
        }
        serr = SSLCopyBuffer(sessionData, &entry->mSessionData);
        if(serr) {
-        SSLFreeBuffer(&entry->mKey, NULL);
+        SSLFreeBuffer(&entry->mKey);
         sslFree (entry);
         return NULL;
        }
         sslFree (entry);
         return NULL;
        }
@@ -157,8 +159,8 @@ static SessionCacheEntry *SessionCacheEntryCreate(
 static void SessionCacheEntryDelete(SessionCacheEntry *entry)
 {
        sslLogSessCacheDebug("~SessionCacheEntryDelete() %p", entry);
 static void SessionCacheEntryDelete(SessionCacheEntry *entry)
 {
        sslLogSessCacheDebug("~SessionCacheEntryDelete() %p", entry);
-       SSLFreeBuffer(&entry->mKey, NULL);              // no SSLContext
-       SSLFreeBuffer(&entry->mSessionData, NULL);
+       SSLFreeBuffer(&entry->mKey);            // no SSLContext
+       SSLFreeBuffer(&entry->mSessionData);
     sslFree(entry);
 }
 
     sslFree(entry);
 }
 
@@ -191,7 +193,7 @@ static bool SessionCacheEntryIsStaleNow(SessionCacheEntry *entry)
 static OSStatus SessionCacheEntrySetSessionData(SessionCacheEntry *entry,
        const SSLBuffer *data)
 {
 static OSStatus SessionCacheEntrySetSessionData(SessionCacheEntry *entry,
        const SSLBuffer *data)
 {
-       SSLFreeBuffer(&entry->mSessionData, NULL);
+       SSLFreeBuffer(&entry->mSessionData);
        return SSLCopyBuffer(data, &entry->mSessionData);
 }
 
        return SSLCopyBuffer(data, &entry->mSessionData);
 }
 
@@ -251,7 +253,7 @@ static OSStatus SessionCacheAddEntry(
                  */
                 sslLogSessCacheDebug("SessionCache::addEntry CACHE HIT "
                     "entry = %p", entry);
                  */
                 sslLogSessCacheDebug("SessionCache::addEntry CACHE HIT "
                     "entry = %p", entry);
-                return noErr;
+                return errSecSuccess;
             }
             else {
                 sslLogSessCacheDebug("SessionCache::addEntry CACHE REPLACE "
             }
             else {
                 sslLogSessCacheDebug("SessionCache::addEntry CACHE REPLACE "
@@ -281,7 +283,7 @@ static OSStatus SessionCacheAddEntry(
     entry->next = cache->head;
     cache->head = entry;
 
     entry->next = cache->head;
     cache->head = entry;
 
-       return noErr;
+       return errSecSuccess;
 }
 
 static OSStatus SessionCacheLookupEntry(
 }
 
 static OSStatus SessionCacheLookupEntry(
@@ -330,11 +332,11 @@ static OSStatus SessionCacheDeleteEntry(
                        #endif
             *current = entry->next;
             SessionCacheEntryDelete(entry);
                        #endif
             *current = entry->next;
             SessionCacheEntryDelete(entry);
-            return noErr;
+            return errSecSuccess;
                }
        }
 
                }
        }
 
-    return noErr;
+    return errSecSuccess;
 }
 
 /* cleanup, delete stale entries */
 }
 
 /* cleanup, delete stale entries */
@@ -415,9 +417,9 @@ OSStatus sslGetSession (
     {
         serr = SessionCacheLookupEntry(cache, &sessionKey, sessionData);
 
     {
         serr = SessionCacheLookupEntry(cache, &sessionKey, sessionData);
 
-        sslLogSessCacheDebug("sslGetSession(%d, %p): %ld",
+        sslLogSessCacheDebug("sslGetSession(%d, %p): %d",
             (int)sessionKey.length, sessionKey.data,
             (int)sessionKey.length, sessionKey.data,
-            serr);
+            (int)serr);
         if(!serr) {
             cachePrint(NULL, &sessionKey, sessionData);
         }
         if(!serr) {
             cachePrint(NULL, &sessionKey, sessionData);
         }
@@ -452,7 +454,7 @@ OSStatus sslDeleteSession (
 OSStatus sslCleanupSession(void)
 {
     SessionCache *cache = SessionCacheGetLockedInstance();
 OSStatus sslCleanupSession(void)
 {
     SessionCache *cache = SessionCacheGetLockedInstance();
-       OSStatus serr = noErr;
+       OSStatus serr = errSecSuccess;
        bool moreToGo = false;
 
     if (!cache)
        bool moreToGo = false;
 
     if (!cache)