OLD | NEW |
1 /* | 1 /* |
2 * Accessor functions for SSLSocket private members. | 2 * Accessor functions for SSLSocket private members. |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 */ | 104 */ |
105 | 105 |
106 SECStatus | 106 SECStatus |
107 SSL_HandshakeNegotiatedExtension(PRFileDesc * socket, | 107 SSL_HandshakeNegotiatedExtension(PRFileDesc * socket, |
108 SSLExtensionType extId, | 108 SSLExtensionType extId, |
109 PRBool *pYes) | 109 PRBool *pYes) |
110 { | 110 { |
111 /* some decisions derived from SSL_GetChannelInfo */ | 111 /* some decisions derived from SSL_GetChannelInfo */ |
112 sslSocket * sslsocket = NULL; | 112 sslSocket * sslsocket = NULL; |
113 SECStatus rv = SECFailure; | 113 SECStatus rv = SECFailure; |
114 PRBool enoughFirstHsDone = PR_FALSE; | |
115 | 114 |
116 if (!pYes) | 115 if (!pYes) |
117 return rv; | 116 return rv; |
118 | 117 |
119 sslsocket = ssl_FindSocket(socket); | 118 sslsocket = ssl_FindSocket(socket); |
120 if (!sslsocket) { | 119 if (!sslsocket) { |
121 SSL_DBG(("%d: SSL[%d]: bad socket in HandshakeNegotiatedExtension", | 120 SSL_DBG(("%d: SSL[%d]: bad socket in HandshakeNegotiatedExtension", |
122 SSL_GETPID(), socket)); | 121 SSL_GETPID(), socket)); |
123 return rv; | 122 return rv; |
124 } | 123 } |
125 | 124 |
126 if (sslsocket->firstHsDone) { | |
127 enoughFirstHsDone = PR_TRUE; | |
128 } else if (sslsocket->ssl3.initialized && ssl3_CanFalseStart(sslsocket)) { | |
129 enoughFirstHsDone = PR_TRUE; | |
130 } | |
131 | |
132 /* according to public API SSL_GetChannelInfo, this doesn't need a lock */ | 125 /* according to public API SSL_GetChannelInfo, this doesn't need a lock */ |
133 if (sslsocket->opt.useSecurity && enoughFirstHsDone) { | 126 if (sslsocket->opt.useSecurity) { |
134 if (sslsocket->ssl3.initialized) { /* SSL3 and TLS */ | 127 if (sslsocket->ssl3.initialized) { /* SSL3 and TLS */ |
135 /* now we know this socket went through ssl3_InitState() and | 128 /* now we know this socket went through ssl3_InitState() and |
136 * ss->xtnData got initialized, which is the only member accessed by | 129 * ss->xtnData got initialized, which is the only member accessed by |
137 * ssl3_ExtensionNegotiated(); | 130 * ssl3_ExtensionNegotiated(); |
138 * Member xtnData appears to get accessed in functions that handle | 131 * Member xtnData appears to get accessed in functions that handle |
139 * the handshake (hello messages and extension sending), | 132 * the handshake (hello messages and extension sending), |
140 * therefore the handshake lock should be sufficient. | 133 * therefore the handshake lock should be sufficient. |
141 */ | 134 */ |
142 ssl_GetSSL3HandshakeLock(sslsocket); | 135 ssl_GetSSL3HandshakeLock(sslsocket); |
143 *pYes = ssl3_ExtensionNegotiated(sslsocket, extId); | 136 *pYes = ssl3_ExtensionNegotiated(sslsocket, extId); |
144 ssl_ReleaseSSL3HandshakeLock(sslsocket); | 137 ssl_ReleaseSSL3HandshakeLock(sslsocket); |
145 rv = SECSuccess; | 138 rv = SECSuccess; |
146 } | 139 } |
147 } | 140 } |
148 | 141 |
149 return rv; | 142 return rv; |
150 } | 143 } |
OLD | NEW |