OLD | NEW |
1 /* This file implements the SERVER Session ID cache. | 1 /* This file implements the SERVER Session ID cache. |
2 * NOTE: The contents of this file are NOT used by the client. | 2 * NOTE: The contents of this file are NOT used by the client. |
3 * | 3 * |
4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
6 * | 6 * |
7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
(...skipping 18 matching lines...) Expand all Loading... |
29 * in which case the provisions of the GPL or the LGPL are applicable instead | 29 * in which case the provisions of the GPL or the LGPL are applicable instead |
30 * of those above. If you wish to allow use of your version of this file only | 30 * of those above. If you wish to allow use of your version of this file only |
31 * under the terms of either the GPL or the LGPL, and not to allow others to | 31 * under the terms of either the GPL or the LGPL, and not to allow others to |
32 * use your version of this file under the terms of the MPL, indicate your | 32 * use your version of this file under the terms of the MPL, indicate your |
33 * decision by deleting the provisions above and replace them with the notice | 33 * decision by deleting the provisions above and replace them with the notice |
34 * and other provisions required by the GPL or the LGPL. If you do not delete | 34 * and other provisions required by the GPL or the LGPL. If you do not delete |
35 * the provisions above, a recipient may use your version of this file under | 35 * the provisions above, a recipient may use your version of this file under |
36 * the terms of any one of the MPL, the GPL or the LGPL. | 36 * the terms of any one of the MPL, the GPL or the LGPL. |
37 * | 37 * |
38 * ***** END LICENSE BLOCK ***** */ | 38 * ***** END LICENSE BLOCK ***** */ |
39 /* $Id: sslsnce.c,v 1.54 2010/07/05 19:31:56 alexei.volkov.bugs%sun.com Exp $ */ | 39 /* $Id: sslsnce.c,v 1.59 2011/10/22 16:45:40 emaldona%redhat.com Exp $ */ |
40 | 40 |
41 /* Note: ssl_FreeSID() in sslnonce.c gets used for both client and server | 41 /* Note: ssl_FreeSID() in sslnonce.c gets used for both client and server |
42 * cache sids! | 42 * cache sids! |
43 * | 43 * |
44 * About record locking among different server processes: | 44 * About record locking among different server processes: |
45 * | 45 * |
46 * All processes that are part of the same conceptual server (serving on | 46 * All processes that are part of the same conceptual server (serving on |
47 * the same address and port) MUST share a common SSL session cache. | 47 * the same address and port) MUST share a common SSL session cache. |
48 * This code makes the content of the shared cache accessible to all | 48 * This code makes the content of the shared cache accessible to all |
49 * processes on the same "server". This code works on Unix and Win32 only. | 49 * processes on the same "server". This code works on Unix and Win32 only. |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 return ((long)ptib->tib_ordinal); /* thread id */ | 1019 return ((long)ptib->tib_ordinal); /* thread id */ |
1020 } | 1020 } |
1021 #endif | 1021 #endif |
1022 | 1022 |
1023 static void | 1023 static void |
1024 CloseCache(cacheDesc *cache) | 1024 CloseCache(cacheDesc *cache) |
1025 { | 1025 { |
1026 int locks_initialized = cache->numSIDCacheLocksInitialized; | 1026 int locks_initialized = cache->numSIDCacheLocksInitialized; |
1027 | 1027 |
1028 if (cache->cacheMem) { | 1028 if (cache->cacheMem) { |
1029 » /* If everInherited is true, this shared cache was (and may still | 1029 » if (cache->sharedCache) { |
1030 » ** be) in use by multiple processes. We do not wish to destroy | |
1031 » ** the mutexes while they are still in use. | |
1032 » */ | |
1033 » if (cache->sharedCache && | |
1034 PR_FALSE == cache->sharedCache->everInherited) { | |
1035 sidCacheLock *pLock = cache->sidCacheLocks; | 1030 sidCacheLock *pLock = cache->sidCacheLocks; |
1036 for (; locks_initialized > 0; --locks_initialized, ++pLock ) { | 1031 for (; locks_initialized > 0; --locks_initialized, ++pLock ) { |
1037 » » sslMutex_Destroy(&pLock->mutex); | 1032 » » /* If everInherited is true, this shared cache was (and may |
| 1033 » » ** still be) in use by multiple processes. We do not wish to |
| 1034 » » ** destroy the mutexes while they are still in use, but we do |
| 1035 » » ** want to free mutex resources associated with this process. |
| 1036 » » */ |
| 1037 » » sslMutex_Destroy(&pLock->mutex, |
| 1038 » » » » cache->sharedCache->everInherited); |
1038 } | 1039 } |
1039 } | 1040 } |
1040 if (cache->shared) { | 1041 if (cache->shared) { |
1041 PR_MemUnmap(cache->cacheMem, cache->cacheMemSize); | 1042 PR_MemUnmap(cache->cacheMem, cache->cacheMemSize); |
1042 } else { | 1043 } else { |
1043 PORT_Free(cache->cacheMem); | 1044 PORT_Free(cache->cacheMem); |
1044 } | 1045 } |
1045 cache->cacheMem = NULL; | 1046 cache->cacheMem = NULL; |
1046 } | 1047 } |
1047 if (cache->cacheMemMap) { | 1048 if (cache->cacheMemMap) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 int maxCacheEntries, | 1325 int maxCacheEntries, |
1325 int maxCertCacheEntries, | 1326 int maxCertCacheEntries, |
1326 int maxSrvNameCacheEntries) | 1327 int maxSrvNameCacheEntries) |
1327 { | 1328 { |
1328 SECStatus rv; | 1329 SECStatus rv; |
1329 | 1330 |
1330 PORT_Assert(sizeof(sidCacheEntry) == 224); | 1331 PORT_Assert(sizeof(sidCacheEntry) == 224); |
1331 PORT_Assert(sizeof(certCacheEntry) == 4096); | 1332 PORT_Assert(sizeof(certCacheEntry) == 4096); |
1332 PORT_Assert(sizeof(srvNameCacheEntry) == 1072); | 1333 PORT_Assert(sizeof(srvNameCacheEntry) == 1072); |
1333 | 1334 |
| 1335 rv = ssl_Init(); |
| 1336 if (rv != SECSuccess) { |
| 1337 return rv; |
| 1338 } |
| 1339 |
1334 myPid = SSL_GETPID(); | 1340 myPid = SSL_GETPID(); |
1335 if (!directory) { | 1341 if (!directory) { |
1336 directory = DEFAULT_CACHE_DIRECTORY; | 1342 directory = DEFAULT_CACHE_DIRECTORY; |
1337 } | 1343 } |
1338 rv = InitCache(cache, maxCacheEntries, maxCertCacheEntries, | 1344 rv = InitCache(cache, maxCacheEntries, maxCertCacheEntries, |
1339 maxSrvNameCacheEntries, ssl2_timeout, ssl3_timeout, | 1345 maxSrvNameCacheEntries, ssl2_timeout, ssl3_timeout, |
1340 directory, shared); | 1346 directory, shared); |
1341 if (rv) { | 1347 if (rv) { |
1342 SET_ERROR_CODE | 1348 SET_ERROR_CODE |
1343 return SECFailure; | 1349 return SECFailure; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 char * myEnvString = NULL; | 1510 char * myEnvString = NULL; |
1505 unsigned int decoLen; | 1511 unsigned int decoLen; |
1506 ptrdiff_t ptr; | 1512 ptrdiff_t ptr; |
1507 inheritance inherit; | 1513 inheritance inherit; |
1508 cacheDesc my; | 1514 cacheDesc my; |
1509 #ifdef WINNT | 1515 #ifdef WINNT |
1510 sidCacheLock* newLocks; | 1516 sidCacheLock* newLocks; |
1511 int locks_initialized = 0; | 1517 int locks_initialized = 0; |
1512 int locks_to_initialize = 0; | 1518 int locks_to_initialize = 0; |
1513 #endif | 1519 #endif |
| 1520 SECStatus status = ssl_Init(); |
| 1521 |
| 1522 if (status != SECSuccess) { |
| 1523 return status; |
| 1524 } |
1514 | 1525 |
1515 myPid = SSL_GETPID(); | 1526 myPid = SSL_GETPID(); |
1516 | 1527 |
1517 /* If this child was created by fork(), and not by exec() on unix, | 1528 /* If this child was created by fork(), and not by exec() on unix, |
1518 ** then isMultiProcess will already be set. | 1529 ** then isMultiProcess will already be set. |
1519 ** If not, we'll set it below. | 1530 ** If not, we'll set it below. |
1520 */ | 1531 */ |
1521 if (isMultiProcess) { | 1532 if (isMultiProcess) { |
1522 if (cache && cache->sharedCache) { | 1533 if (cache && cache->sharedCache) { |
1523 cache->sharedCache->everInherited = PR_TRUE; | 1534 cache->sharedCache->everInherited = PR_TRUE; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 != SECSuccess) { | 1867 != SECSuccess) { |
1857 SSL_DBG(("%d: SSL[%s]: Unable to wrap session ticket %s.", | 1868 SSL_DBG(("%d: SSL[%s]: Unable to wrap session ticket %s.", |
1858 SSL_GETPID(), "unknown", keyName)); | 1869 SSL_GETPID(), "unknown", keyName)); |
1859 return PR_FALSE; | 1870 return PR_FALSE; |
1860 } | 1871 } |
1861 cacheEntry->length = wrappedKey.len; | 1872 cacheEntry->length = wrappedKey.len; |
1862 return PR_TRUE; | 1873 return PR_TRUE; |
1863 } | 1874 } |
1864 | 1875 |
1865 static PRBool | 1876 static PRBool |
1866 GenerateAndWrapTicketKeys(SECKEYPublicKey *svrPubKey, void *pwArg, | 1877 GenerateTicketKeys(void *pwArg, unsigned char *keyName, PK11SymKey **aesKey, |
1867 unsigned char *keyName, PK11SymKey **aesKey, | 1878 PK11SymKey **macKey) |
1868 PK11SymKey **macKey) | |
1869 { | 1879 { |
1870 PK11SlotInfo *slot; | 1880 PK11SlotInfo *slot; |
1871 CK_MECHANISM_TYPE mechanismArray[2]; | 1881 CK_MECHANISM_TYPE mechanismArray[2]; |
1872 PK11SymKey *aesKeyTmp = NULL; | 1882 PK11SymKey *aesKeyTmp = NULL; |
1873 PK11SymKey *macKeyTmp = NULL; | 1883 PK11SymKey *macKeyTmp = NULL; |
1874 cacheDesc *cache = &globalCache; | 1884 cacheDesc *cache = &globalCache; |
| 1885 uint8 ticketKeyNameSuffixLocal[SESS_TICKET_KEY_VAR_NAME_LEN]; |
| 1886 uint8 *ticketKeyNameSuffix; |
1875 | 1887 |
1876 if (PK11_GenerateRandom(cache->ticketKeyNameSuffix, | 1888 if (!cache->cacheMem) { |
| 1889 /* cache is not initalized. Use stack buffer */ |
| 1890 ticketKeyNameSuffix = ticketKeyNameSuffixLocal; |
| 1891 } else { |
| 1892 ticketKeyNameSuffix = cache->ticketKeyNameSuffix; |
| 1893 } |
| 1894 |
| 1895 if (PK11_GenerateRandom(ticketKeyNameSuffix, |
1877 SESS_TICKET_KEY_VAR_NAME_LEN) != SECSuccess) { | 1896 SESS_TICKET_KEY_VAR_NAME_LEN) != SECSuccess) { |
1878 SSL_DBG(("%d: SSL[%s]: Unable to generate random key name bytes.", | 1897 SSL_DBG(("%d: SSL[%s]: Unable to generate random key name bytes.", |
1879 SSL_GETPID(), "unknown")); | 1898 SSL_GETPID(), "unknown")); |
1880 goto loser; | 1899 goto loser; |
1881 } | 1900 } |
1882 | 1901 |
1883 mechanismArray[0] = CKM_AES_CBC; | 1902 mechanismArray[0] = CKM_AES_CBC; |
1884 mechanismArray[1] = CKM_SHA256_HMAC; | 1903 mechanismArray[1] = CKM_SHA256_HMAC; |
1885 | 1904 |
1886 slot = PK11_GetBestSlotMultiple(mechanismArray, 2, pwArg); | 1905 slot = PK11_GetBestSlotMultiple(mechanismArray, 2, pwArg); |
1887 if (slot) { | 1906 if (slot) { |
1888 » aesKeyTmp = PK11_KeyGen(slot, mechanismArray[0], NULL, 32, pwArg); | 1907 » aesKeyTmp = PK11_KeyGen(slot, mechanismArray[0], NULL, |
1889 » macKeyTmp = PK11_KeyGen(slot, mechanismArray[1], NULL, SHA256_LENGTH, | 1908 AES_256_KEY_LENGTH, pwArg); |
1890 » » » » pwArg); | 1909 » macKeyTmp = PK11_KeyGen(slot, mechanismArray[1], NULL, |
| 1910 SHA256_LENGTH, pwArg); |
1891 PK11_FreeSlot(slot); | 1911 PK11_FreeSlot(slot); |
1892 } | 1912 } |
1893 | 1913 |
1894 if (aesKeyTmp == NULL || macKeyTmp == NULL) { | 1914 if (aesKeyTmp == NULL || macKeyTmp == NULL) { |
1895 SSL_DBG(("%d: SSL[%s]: Unable to generate session ticket keys.", | 1915 SSL_DBG(("%d: SSL[%s]: Unable to generate session ticket keys.", |
1896 SSL_GETPID(), "unknown")); | 1916 SSL_GETPID(), "unknown")); |
1897 goto loser; | 1917 goto loser; |
1898 } | 1918 } |
1899 | 1919 PORT_Memcpy(keyName, ticketKeyNameSuffix, SESS_TICKET_KEY_VAR_NAME_LEN); |
1900 /* Export the keys to the shared cache in wrapped form. */ | |
1901 if (!WrapTicketKey(svrPubKey, aesKeyTmp, "enc key", cache->ticketEncKey)) | |
1902 » goto loser; | |
1903 if (!WrapTicketKey(svrPubKey, macKeyTmp, "mac key", cache->ticketMacKey)) | |
1904 » goto loser; | |
1905 | |
1906 PORT_Memcpy(keyName, cache->ticketKeyNameSuffix, | |
1907 » SESS_TICKET_KEY_VAR_NAME_LEN); | |
1908 *aesKey = aesKeyTmp; | 1920 *aesKey = aesKeyTmp; |
1909 *macKey = macKeyTmp; | 1921 *macKey = macKeyTmp; |
1910 return PR_TRUE; | 1922 return PR_TRUE; |
| 1923 |
| 1924 loser: |
| 1925 if (aesKeyTmp) |
| 1926 PK11_FreeSymKey(aesKeyTmp); |
| 1927 if (macKeyTmp) |
| 1928 PK11_FreeSymKey(macKeyTmp); |
| 1929 return PR_FALSE; |
| 1930 } |
| 1931 |
| 1932 static PRBool |
| 1933 GenerateAndWrapTicketKeys(SECKEYPublicKey *svrPubKey, void *pwArg, |
| 1934 unsigned char *keyName, PK11SymKey **aesKey, |
| 1935 PK11SymKey **macKey) |
| 1936 { |
| 1937 PK11SymKey *aesKeyTmp = NULL; |
| 1938 PK11SymKey *macKeyTmp = NULL; |
| 1939 cacheDesc *cache = &globalCache; |
| 1940 |
| 1941 if (!GenerateTicketKeys(pwArg, keyName, &aesKeyTmp, &macKeyTmp)) { |
| 1942 goto loser; |
| 1943 } |
| 1944 |
| 1945 if (cache->cacheMem) { |
| 1946 /* Export the keys to the shared cache in wrapped form. */ |
| 1947 if (!WrapTicketKey(svrPubKey, aesKeyTmp, "enc key", cache->ticketEncKey)
) |
| 1948 goto loser; |
| 1949 if (!WrapTicketKey(svrPubKey, macKeyTmp, "mac key", cache->ticketMacKey)
) |
| 1950 goto loser; |
| 1951 } |
| 1952 *aesKey = aesKeyTmp; |
| 1953 *macKey = macKeyTmp; |
| 1954 return PR_TRUE; |
1911 | 1955 |
1912 loser: | 1956 loser: |
1913 if (aesKeyTmp) | 1957 if (aesKeyTmp) |
1914 PK11_FreeSymKey(aesKeyTmp); | 1958 PK11_FreeSymKey(aesKeyTmp); |
1915 if (macKeyTmp) | 1959 if (macKeyTmp) |
1916 PK11_FreeSymKey(macKeyTmp); | 1960 PK11_FreeSymKey(macKeyTmp); |
1917 return PR_FALSE; | 1961 return PR_FALSE; |
1918 } | 1962 } |
1919 | 1963 |
1920 static PRBool | 1964 static PRBool |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 ssl_GetSessionTicketKeysPKCS11(SECKEYPrivateKey *svrPrivKey, | 2008 ssl_GetSessionTicketKeysPKCS11(SECKEYPrivateKey *svrPrivKey, |
1965 SECKEYPublicKey *svrPubKey, void *pwArg, | 2009 SECKEYPublicKey *svrPubKey, void *pwArg, |
1966 unsigned char *keyName, PK11SymKey **aesKey, | 2010 unsigned char *keyName, PK11SymKey **aesKey, |
1967 PK11SymKey **macKey) | 2011 PK11SymKey **macKey) |
1968 { | 2012 { |
1969 PRUint32 now = 0; | 2013 PRUint32 now = 0; |
1970 PRBool rv = PR_FALSE; | 2014 PRBool rv = PR_FALSE; |
1971 PRBool keysGenerated = PR_FALSE; | 2015 PRBool keysGenerated = PR_FALSE; |
1972 cacheDesc *cache = &globalCache; | 2016 cacheDesc *cache = &globalCache; |
1973 | 2017 |
| 2018 if (!cache->cacheMem) { |
| 2019 /* cache is uninitialized. Generate keys and return them |
| 2020 * without caching. */ |
| 2021 return GenerateTicketKeys(pwArg, keyName, aesKey, macKey); |
| 2022 } |
| 2023 |
1974 now = LockSidCacheLock(cache->keyCacheLock, now); | 2024 now = LockSidCacheLock(cache->keyCacheLock, now); |
1975 if (!now) | 2025 if (!now) |
1976 return rv; | 2026 return rv; |
1977 | 2027 |
1978 if (!*(cache->ticketKeysValid)) { | 2028 if (!*(cache->ticketKeysValid)) { |
1979 /* Keys do not exist, create them. */ | 2029 /* Keys do not exist, create them. */ |
1980 if (!GenerateAndWrapTicketKeys(svrPubKey, pwArg, keyName, | 2030 if (!GenerateAndWrapTicketKeys(svrPubKey, pwArg, keyName, |
1981 aesKey, macKey)) | 2031 aesKey, macKey)) |
1982 goto loser; | 2032 goto loser; |
1983 keysGenerated = PR_TRUE; | 2033 keysGenerated = PR_TRUE; |
1984 *(cache->ticketKeysValid) = 1; | 2034 *(cache->ticketKeysValid) = 1; |
1985 } | 2035 } |
1986 | 2036 |
1987 rv = PR_TRUE; | 2037 rv = PR_TRUE; |
1988 | 2038 |
1989 loser: | 2039 loser: |
1990 UnlockSidCacheLock(cache->keyCacheLock); | 2040 UnlockSidCacheLock(cache->keyCacheLock); |
1991 if (rv && !keysGenerated) | 2041 if (rv && !keysGenerated) |
1992 rv = UnwrapCachedTicketKeys(svrPrivKey, keyName, aesKey, macKey); | 2042 rv = UnwrapCachedTicketKeys(svrPrivKey, keyName, aesKey, macKey); |
1993 return rv; | 2043 return rv; |
1994 } | 2044 } |
1995 | 2045 |
1996 PRBool | 2046 PRBool |
1997 ssl_GetSessionTicketKeys(unsigned char *keyName, unsigned char *encKey, | 2047 ssl_GetSessionTicketKeys(unsigned char *keyName, unsigned char *encKey, |
1998 unsigned char *macKey) | 2048 unsigned char *macKey) |
1999 { | 2049 { |
2000 PRBool rv = PR_FALSE; | 2050 PRBool rv = PR_FALSE; |
2001 PRUint32 now = 0; | 2051 PRUint32 now = 0; |
2002 cacheDesc *cache = &globalCache; | 2052 cacheDesc *cache = &globalCache; |
| 2053 uint8 ticketMacKey[AES_256_KEY_LENGTH], ticketEncKey[SHA256_LENGTH]; |
| 2054 uint8 ticketKeyNameSuffixLocal[SESS_TICKET_KEY_VAR_NAME_LEN]; |
| 2055 uint8 *ticketMacKeyPtr, *ticketEncKeyPtr, *ticketKeyNameSuffix; |
| 2056 PRBool cacheIsEnabled = PR_TRUE; |
2003 | 2057 |
2004 /* Grab lock. */ | 2058 if (!cache->cacheMem) { /* cache is uninitialized */ |
2005 now = LockSidCacheLock(cache->keyCacheLock, now); | 2059 cacheIsEnabled = PR_FALSE; |
2006 if (!now) | 2060 ticketKeyNameSuffix = ticketKeyNameSuffixLocal; |
2007 » return rv; | 2061 ticketEncKeyPtr = ticketEncKey; |
| 2062 ticketMacKeyPtr = ticketMacKey; |
| 2063 } else { |
| 2064 /* these values have constant memory locations in the cache. |
| 2065 * Ok to reference them without holding the lock. */ |
| 2066 ticketKeyNameSuffix = cache->ticketKeyNameSuffix; |
| 2067 ticketEncKeyPtr = cache->ticketEncKey->bytes; |
| 2068 ticketMacKeyPtr = cache->ticketMacKey->bytes; |
| 2069 } |
2008 | 2070 |
2009 if (!*(cache->ticketKeysValid)) { | 2071 if (cacheIsEnabled) { |
2010 » if (PK11_GenerateRandom(cache->ticketKeyNameSuffix, | 2072 /* Grab lock if initialized. */ |
| 2073 now = LockSidCacheLock(cache->keyCacheLock, now); |
| 2074 if (!now) |
| 2075 return rv; |
| 2076 } |
| 2077 /* Going to regenerate keys on every call if cache was not |
| 2078 * initialized. */ |
| 2079 if (!cacheIsEnabled || !*(cache->ticketKeysValid)) { |
| 2080 » if (PK11_GenerateRandom(ticketKeyNameSuffix, |
2011 SESS_TICKET_KEY_VAR_NAME_LEN) != SECSuccess) | 2081 SESS_TICKET_KEY_VAR_NAME_LEN) != SECSuccess) |
2012 goto loser; | 2082 goto loser; |
2013 » if (PK11_GenerateRandom(cache->ticketEncKey->bytes, 32) != SECSuccess) | 2083 » if (PK11_GenerateRandom(ticketEncKeyPtr, |
| 2084 AES_256_KEY_LENGTH) != SECSuccess) |
2014 goto loser; | 2085 goto loser; |
2015 » if (PK11_GenerateRandom(cache->ticketMacKey->bytes, | 2086 » if (PK11_GenerateRandom(ticketMacKeyPtr, |
2016 » » SHA256_LENGTH) != SECSuccess) | 2087 SHA256_LENGTH) != SECSuccess) |
2017 goto loser; | 2088 goto loser; |
2018 » *(cache->ticketKeysValid) = 1; | 2089 if (cacheIsEnabled) { |
| 2090 *(cache->ticketKeysValid) = 1; |
| 2091 } |
2019 } | 2092 } |
2020 | 2093 |
2021 rv = PR_TRUE; | 2094 rv = PR_TRUE; |
2022 | 2095 |
2023 loser: | 2096 loser: |
2024 UnlockSidCacheLock(cache->keyCacheLock); | 2097 if (cacheIsEnabled) { |
| 2098 UnlockSidCacheLock(cache->keyCacheLock); |
| 2099 } |
2025 if (rv) { | 2100 if (rv) { |
2026 » PORT_Memcpy(keyName, cache->ticketKeyNameSuffix, | 2101 » PORT_Memcpy(keyName, ticketKeyNameSuffix, |
2027 » SESS_TICKET_KEY_VAR_NAME_LEN); | 2102 SESS_TICKET_KEY_VAR_NAME_LEN); |
2028 » PORT_Memcpy(encKey, cache->ticketEncKey->bytes, 32); | 2103 » PORT_Memcpy(encKey, ticketEncKeyPtr, AES_256_KEY_LENGTH); |
2029 » PORT_Memcpy(macKey, cache->ticketMacKey->bytes, SHA256_LENGTH); | 2104 » PORT_Memcpy(macKey, ticketMacKeyPtr, SHA256_LENGTH); |
2030 } | 2105 } |
2031 return rv; | 2106 return rv; |
2032 } | 2107 } |
2033 | 2108 |
2034 /* The caller passes in the new value it wants | 2109 /* The caller passes in the new value it wants |
2035 * to set. This code tests the wrapped sym key entry in the shared memory. | 2110 * to set. This code tests the wrapped sym key entry in the shared memory. |
2036 * If it is uninitialized, this function writes the caller's value into | 2111 * If it is uninitialized, this function writes the caller's value into |
2037 * the disk entry, and returns false. | 2112 * the disk entry, and returns false. |
2038 * Otherwise, it overwrites the caller's wswk with the value obtained from | 2113 * Otherwise, it overwrites the caller's wswk with the value obtained from |
2039 * the disk, and returns PR_TRUE. | 2114 * the disk, and returns PR_TRUE. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 } | 2228 } |
2154 | 2229 |
2155 SECStatus | 2230 SECStatus |
2156 SSL_SetMaxServerCacheLocks(PRUint32 maxLocks) | 2231 SSL_SetMaxServerCacheLocks(PRUint32 maxLocks) |
2157 { | 2232 { |
2158 PR_ASSERT(!"SSL servers are not supported on this platform. (SSL_SetMaxServe
rCacheLocks)"); | 2233 PR_ASSERT(!"SSL servers are not supported on this platform. (SSL_SetMaxServe
rCacheLocks)"); |
2159 return SECFailure; | 2234 return SECFailure; |
2160 } | 2235 } |
2161 | 2236 |
2162 #endif /* XP_UNIX || XP_WIN32 */ | 2237 #endif /* XP_UNIX || XP_WIN32 */ |
OLD | NEW |