| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Various SSL functions. | 2 * Various SSL functions. |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 (!ss->firstHsDone) && /* only first time */ | 141 (!ss->firstHsDone) && /* only first time */ |
| 142 (ss->version < SSL_LIBRARY_VERSION_3_0)) { /* not ssl3 */ | 142 (ss->version < SSL_LIBRARY_VERSION_3_0)) { /* not ssl3 */ |
| 143 ss->firstHsDone = PR_TRUE; | 143 ss->firstHsDone = PR_TRUE; |
| 144 (ss->handshakeCallback)(ss->fd, ss->handshakeCallbackData); | 144 (ss->handshakeCallback)(ss->fd, ss->handshakeCallbackData); |
| 145 } | 145 } |
| 146 ss->firstHsDone = PR_TRUE; | 146 ss->firstHsDone = PR_TRUE; |
| 147 ss->gs.writeOffset = 0; | 147 ss->gs.writeOffset = 0; |
| 148 ss->gs.readOffset = 0; | 148 ss->gs.readOffset = 0; |
| 149 break; | 149 break; |
| 150 } | 150 } |
| 151 if (ss->version >= SSL_LIBRARY_VERSION_3_0 && | |
| 152 (ss->ssl3.hs.ws == wait_change_cipher || | |
| 153 ss->ssl3.hs.ws == wait_new_session_ticket) && | |
| 154 ssl3_CanFalseStart(ss)) { | |
| 155 break; | |
| 156 } | |
| 157 rv = (*ss->handshake)(ss); | 151 rv = (*ss->handshake)(ss); |
| 158 ++loopCount; | 152 ++loopCount; |
| 159 /* This code must continue to loop on SECWouldBlock, | 153 /* This code must continue to loop on SECWouldBlock, |
| 160 * or any positive value. See XXX_1 comments. | 154 * or any positive value. See XXX_1 comments. |
| 161 */ | 155 */ |
| 162 } while (rv != SECFailure); /* was (rv >= 0); XXX_1 */ | 156 } while (rv != SECFailure); /* was (rv >= 0); XXX_1 */ |
| 163 | 157 |
| 164 PORT_Assert(ss->opt.noLocks || !ssl_HaveRecvBufLock(ss)); | 158 PORT_Assert(ss->opt.noLocks || !ssl_HaveRecvBufLock(ss)); |
| 165 PORT_Assert(ss->opt.noLocks || !ssl_HaveXmitBufLock(ss)); | 159 PORT_Assert(ss->opt.noLocks || !ssl_HaveXmitBufLock(ss)); |
| 166 | 160 |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 } | 1192 } |
| 1199 ssl_ReleaseXmitBufLock(ss); | 1193 ssl_ReleaseXmitBufLock(ss); |
| 1200 if (rv < 0) { | 1194 if (rv < 0) { |
| 1201 goto done; | 1195 goto done; |
| 1202 } | 1196 } |
| 1203 | 1197 |
| 1204 if (len > 0) | 1198 if (len > 0) |
| 1205 ss->writerThread = PR_GetCurrentThread(); | 1199 ss->writerThread = PR_GetCurrentThread(); |
| 1206 /* If any of these is non-zero, the initial handshake is not done. */ | 1200 /* If any of these is non-zero, the initial handshake is not done. */ |
| 1207 if (!ss->firstHsDone) { | 1201 if (!ss->firstHsDone) { |
| 1202 PRBool canFalseStart = PR_FALSE; |
| 1208 ssl_Get1stHandshakeLock(ss); | 1203 ssl_Get1stHandshakeLock(ss); |
| 1209 » if (ss->handshake || ss->nextHandshake || ss->securityHandshake) { | 1204 » if (ss->version >= SSL_LIBRARY_VERSION_3_0 && |
| 1205 » (ss->ssl3.hs.ws == wait_change_cipher || |
| 1206 » ss->ssl3.hs.ws == wait_finished || |
| 1207 » ss->ssl3.hs.ws == wait_new_session_ticket) && |
| 1208 » ssl3_CanFalseStart(ss)) { |
| 1209 » canFalseStart = PR_TRUE; |
| 1210 » } |
| 1211 » if (!canFalseStart && |
| 1212 » (ss->handshake || ss->nextHandshake || ss->securityHandshake)) { |
| 1210 rv = ssl_Do1stHandshake(ss); | 1213 rv = ssl_Do1stHandshake(ss); |
| 1211 } | 1214 } |
| 1212 ssl_Release1stHandshakeLock(ss); | 1215 ssl_Release1stHandshakeLock(ss); |
| 1213 } | 1216 } |
| 1214 if (rv < 0) { | 1217 if (rv < 0) { |
| 1215 ss->writerThread = NULL; | 1218 ss->writerThread = NULL; |
| 1216 goto done; | 1219 goto done; |
| 1217 } | 1220 } |
| 1218 | 1221 |
| 1219 /* Check for zero length writes after we do housekeeping so we make forward | 1222 /* Check for zero length writes after we do housekeeping so we make forward |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 if (!ss) { | 1530 if (!ss) { |
| 1528 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", | 1531 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", |
| 1529 SSL_GETPID(), fd)); | 1532 SSL_GETPID(), fd)); |
| 1530 return SECFailure; | 1533 return SECFailure; |
| 1531 } | 1534 } |
| 1532 | 1535 |
| 1533 ss->sniSocketConfig = func; | 1536 ss->sniSocketConfig = func; |
| 1534 ss->sniSocketConfigArg = arg; | 1537 ss->sniSocketConfigArg = arg; |
| 1535 return SECSuccess; | 1538 return SECSuccess; |
| 1536 } | 1539 } |
| OLD | NEW |