| OLD | NEW |
| 1 /* | 1 /* |
| 2 * SSL v2 handshake functions, and functions common to SSL2 and SSL3. | 2 * SSL v2 handshake functions, and functions common to SSL2 and SSL3. |
| 3 * | 3 * |
| 4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
| 5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 7 | 7 |
| 8 #include "nssrenam.h" | 8 #include "nssrenam.h" |
| 9 #include "cert.h" | 9 #include "cert.h" |
| 10 #include "secitem.h" | 10 #include "secitem.h" |
| 11 #include "sechash.h" | 11 #include "sechash.h" |
| 12 #include "cryptohi.h" /* for SGN_ funcs */ | 12 #include "cryptohi.h" /* for SGN_ funcs */ |
| 13 #include "keyhi.h" /* for SECKEY_ high level functions. */ | 13 #include "keyhi.h" /* for SECKEY_ high level functions. */ |
| 14 #include "ssl.h" | 14 #include "ssl.h" |
| 15 #include "sslimpl.h" | 15 #include "sslimpl.h" |
| 16 #include "sslproto.h" | 16 #include "sslproto.h" |
| 17 #include "ssl3prot.h" | 17 #include "ssl3prot.h" |
| 18 #include "sslerr.h" | 18 #include "sslerr.h" |
| 19 #include "pk11func.h" | 19 #include "pk11func.h" |
| 20 #include "prinit.h" | 20 #include "prinit.h" |
| 21 #include "prtime.h" /* for PR_Now() */ | 21 #include "prtime.h" /* for PR_Now() */ |
| 22 | 22 |
| 23 #define XXX | |
| 24 static PRBool policyWasSet; | 23 static PRBool policyWasSet; |
| 25 | 24 |
| 26 /* This ordered list is indexed by (SSL_CK_xx * 3) */ | 25 /* This ordered list is indexed by (SSL_CK_xx * 3) */ |
| 27 /* Second and third bytes are MSB and LSB of master key length. */ | 26 /* Second and third bytes are MSB and LSB of master key length. */ |
| 28 static const PRUint8 allCipherSuites[] = { | 27 static const PRUint8 allCipherSuites[] = { |
| 29 0, 0, 0, | 28 0, 0, 0, |
| 30 SSL_CK_RC4_128_WITH_MD5, 0x00, 0x80, | 29 SSL_CK_RC4_128_WITH_MD5, 0x00, 0x80, |
| 31 SSL_CK_RC4_128_EXPORT40_WITH_MD5, 0x00, 0x80, | 30 SSL_CK_RC4_128_EXPORT40_WITH_MD5, 0x00, 0x80, |
| 32 SSL_CK_RC2_128_CBC_WITH_MD5, 0x00, 0x80, | 31 SSL_CK_RC2_128_CBC_WITH_MD5, 0x00, 0x80, |
| 33 SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5, 0x00, 0x80, | 32 SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5, 0x00, 0x80, |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 620 |
| 622 DUMP_MSG(29, (ss, msg, sendLen)); | 621 DUMP_MSG(29, (ss, msg, sendLen)); |
| 623 sent = (*ss->sec.send)(ss, msg, sendLen, 0); | 622 sent = (*ss->sec.send)(ss, msg, sendLen, 0); |
| 624 | 623 |
| 625 if (sent < 0) { | 624 if (sent < 0) { |
| 626 /* If send failed, it is now a bogus session-id */ | 625 /* If send failed, it is now a bogus session-id */ |
| 627 if (ss->sec.uncache) | 626 if (ss->sec.uncache) |
| 628 (*ss->sec.uncache)(sid); | 627 (*ss->sec.uncache)(sid); |
| 629 rv = (SECStatus)sent; | 628 rv = (SECStatus)sent; |
| 630 } else if (!ss->opt.noCache) { | 629 } else if (!ss->opt.noCache) { |
| 631 » /* Put the sid in session-id cache, (may already be there) */ | 630 » if (sid->cached == never_cached) { |
| 632 » (*ss->sec.cache)(sid); | 631 » » (*ss->sec.cache)(sid); |
| 632 » } |
| 633 rv = SECSuccess; | 633 rv = SECSuccess; |
| 634 } | 634 } |
| 635 ssl_FreeSID(sid); | 635 ssl_FreeSID(sid); |
| 636 ss->sec.ci.sid = 0; | 636 ss->sec.ci.sid = 0; |
| 637 } | 637 } |
| 638 done: | 638 done: |
| 639 ssl_ReleaseXmitBufLock(ss); /***************************************/ | 639 ssl_ReleaseXmitBufLock(ss); /***************************************/ |
| 640 return rv; | 640 return rv; |
| 641 } | 641 } |
| 642 | 642 |
| (...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 ssl2_ClientRegSessionID(sslSocket *ss, PRUint8 *s) | 2164 ssl2_ClientRegSessionID(sslSocket *ss, PRUint8 *s) |
| 2165 { | 2165 { |
| 2166 sslSessionID *sid = ss->sec.ci.sid; | 2166 sslSessionID *sid = ss->sec.ci.sid; |
| 2167 | 2167 |
| 2168 /* Record entry in nonce cache */ | 2168 /* Record entry in nonce cache */ |
| 2169 if (sid->peerCert == NULL) { | 2169 if (sid->peerCert == NULL) { |
| 2170 PORT_Memcpy(sid->u.ssl2.sessionID, s, sizeof(sid->u.ssl2.sessionID)); | 2170 PORT_Memcpy(sid->u.ssl2.sessionID, s, sizeof(sid->u.ssl2.sessionID)); |
| 2171 sid->peerCert = CERT_DupCertificate(ss->sec.peerCert); | 2171 sid->peerCert = CERT_DupCertificate(ss->sec.peerCert); |
| 2172 | 2172 |
| 2173 } | 2173 } |
| 2174 if (!ss->opt.noCache) | 2174 if (!ss->opt.noCache && sid->cached == never_cached) |
| 2175 (*ss->sec.cache)(sid); | 2175 (*ss->sec.cache)(sid); |
| 2176 } | 2176 } |
| 2177 | 2177 |
| 2178 /* Called from ssl2_HandleMessage() */ | 2178 /* Called from ssl2_HandleMessage() */ |
| 2179 static SECStatus | 2179 static SECStatus |
| 2180 ssl2_TriggerNextMessage(sslSocket *ss) | 2180 ssl2_TriggerNextMessage(sslSocket *ss) |
| 2181 { | 2181 { |
| 2182 SECStatus rv; | 2182 SECStatus rv; |
| 2183 | 2183 |
| 2184 PORT_Assert( ss->opt.noLocks || ssl_Have1stHandshakeLock(ss) ); | 2184 PORT_Assert( ss->opt.noLocks || ssl_Have1stHandshakeLock(ss) ); |
| (...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3687 | 3687 |
| 3688 c = __nss_ssl_rcsid[0] + __nss_ssl_sccsid[0]; | 3688 c = __nss_ssl_rcsid[0] + __nss_ssl_sccsid[0]; |
| 3689 return NSS_VersionCheck(importedVersion); | 3689 return NSS_VersionCheck(importedVersion); |
| 3690 } | 3690 } |
| 3691 | 3691 |
| 3692 const char * | 3692 const char * |
| 3693 NSSSSL_GetVersion(void) | 3693 NSSSSL_GetVersion(void) |
| 3694 { | 3694 { |
| 3695 return NSS_VERSION; | 3695 return NSS_VERSION; |
| 3696 } | 3696 } |
| OLD | NEW |