OLD | NEW |
---|---|
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | 1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 /* | 2 /* |
3 * SSL3 Protocol | 3 * SSL3 Protocol |
4 * | 4 * |
5 * This Source Code Form is subject to the terms of the Mozilla Public | 5 * This Source Code Form is subject to the terms of the Mozilla Public |
6 * License, v. 2.0. If a copy of the MPL was not distributed with this | 6 * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
8 | 8 |
9 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ | 9 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ |
10 | 10 |
(...skipping 4956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4967 { | 4967 { |
4968 sslSessionID * sid; | 4968 sslSessionID * sid; |
4969 ssl3CipherSpec * cwSpec; | 4969 ssl3CipherSpec * cwSpec; |
4970 SECStatus rv; | 4970 SECStatus rv; |
4971 int i; | 4971 int i; |
4972 int length; | 4972 int length; |
4973 int num_suites; | 4973 int num_suites; |
4974 int actual_count = 0; | 4974 int actual_count = 0; |
4975 PRBool isTLS = PR_FALSE; | 4975 PRBool isTLS = PR_FALSE; |
4976 PRBool requestingResume = PR_FALSE; | 4976 PRBool requestingResume = PR_FALSE; |
4977 PRInt32 total_exten_len = 0; | 4977 PRInt32 total_exten_len = 0, balloonExtensionLen; |
4978 unsigned numCompressionMethods; | 4978 unsigned numCompressionMethods; |
4979 PRInt32 flags; | 4979 PRInt32 flags; |
4980 | 4980 |
4981 SSL_TRC(3, ("%d: SSL3[%d]: send client_hello handshake", SSL_GETPID(), | 4981 SSL_TRC(3, ("%d: SSL3[%d]: send client_hello handshake", SSL_GETPID(), |
4982 ss->fd)); | 4982 ss->fd)); |
4983 | 4983 |
4984 PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss) ); | 4984 PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss) ); |
4985 PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss) ); | 4985 PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss) ); |
4986 | 4986 |
4987 rv = ssl3_InitState(ss); | 4987 rv = ssl3_InitState(ss); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5234 } | 5234 } |
5235 | 5235 |
5236 length = sizeof(SSL3ProtocolVersion) + SSL3_RANDOM_LENGTH + | 5236 length = sizeof(SSL3ProtocolVersion) + SSL3_RANDOM_LENGTH + |
5237 1 + ((sid == NULL) ? 0 : sid->u.ssl3.sessionIDLength) + | 5237 1 + ((sid == NULL) ? 0 : sid->u.ssl3.sessionIDLength) + |
5238 2 + num_suites*sizeof(ssl3CipherSuite) + | 5238 2 + num_suites*sizeof(ssl3CipherSuite) + |
5239 1 + numCompressionMethods + total_exten_len; | 5239 1 + numCompressionMethods + total_exten_len; |
5240 if (IS_DTLS(ss)) { | 5240 if (IS_DTLS(ss)) { |
5241 length += 1 + ss->ssl3.hs.cookieLen; | 5241 length += 1 + ss->ssl3.hs.cookieLen; |
5242 } | 5242 } |
5243 | 5243 |
5244 balloonExtensionLen = ssl3_CalculateBalloonExtensionLength(length); | |
5245 total_exten_len += balloonExtensionLen; | |
5246 length += balloonExtensionLen; | |
wtc
2013/11/06 21:51:58
This workaround should be disabled if IS_DTLS(ss)
wtc
2013/11/06 22:25:07
This workaround can also be turned off for renegot
agl
2013/11/08 19:39:17
Done.
I've tested various sizes of renegotiation
wtc
2013/11/08 20:10:06
Thank you for the experiments. I guess they don't
| |
5247 | |
5244 rv = ssl3_AppendHandshakeHeader(ss, client_hello, length); | 5248 rv = ssl3_AppendHandshakeHeader(ss, client_hello, length); |
5245 if (rv != SECSuccess) { | 5249 if (rv != SECSuccess) { |
5246 return rv; /* err set by ssl3_AppendHandshake* */ | 5250 return rv; /* err set by ssl3_AppendHandshake* */ |
5247 } | 5251 } |
5248 | 5252 |
5249 if (ss->firstHsDone) { | 5253 if (ss->firstHsDone) { |
5250 /* The client hello version must stay unchanged to work around | 5254 /* The client hello version must stay unchanged to work around |
5251 * the Windows SChannel bug described above. */ | 5255 * the Windows SChannel bug described above. */ |
5252 PORT_Assert(ss->version == ss->clientHelloVersion); | 5256 PORT_Assert(ss->version == ss->clientHelloVersion); |
5253 } | 5257 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5353 rv = ssl3_AppendHandshakeNumber(ss, maxBytes, 2); | 5357 rv = ssl3_AppendHandshakeNumber(ss, maxBytes, 2); |
5354 if (rv != SECSuccess) { | 5358 if (rv != SECSuccess) { |
5355 return rv; /* err set by AppendHandshake. */ | 5359 return rv; /* err set by AppendHandshake. */ |
5356 } | 5360 } |
5357 | 5361 |
5358 extLen = ssl3_CallHelloExtensionSenders(ss, PR_TRUE, maxBytes, NULL); | 5362 extLen = ssl3_CallHelloExtensionSenders(ss, PR_TRUE, maxBytes, NULL); |
5359 if (extLen < 0) { | 5363 if (extLen < 0) { |
5360 return SECFailure; | 5364 return SECFailure; |
5361 } | 5365 } |
5362 maxBytes -= extLen; | 5366 maxBytes -= extLen; |
5367 | |
5368 extLen = ssl3_AppendBalloonExtension(ss, balloonExtensionLen, maxBytes); | |
5369 if (extLen < 0) { | |
5370 return SECFailure; | |
5371 } | |
5372 maxBytes -= extLen; | |
5373 | |
5363 PORT_Assert(!maxBytes); | 5374 PORT_Assert(!maxBytes); |
5364 } | 5375 } |
5365 if (ss->ssl3.hs.sendingSCSV) { | 5376 if (ss->ssl3.hs.sendingSCSV) { |
5366 /* Since we sent the SCSV, pretend we sent empty RI extension. */ | 5377 /* Since we sent the SCSV, pretend we sent empty RI extension. */ |
5367 TLSExtensionData *xtnData = &ss->xtnData; | 5378 TLSExtensionData *xtnData = &ss->xtnData; |
5368 xtnData->advertised[xtnData->numAdvertised++] = | 5379 xtnData->advertised[xtnData->numAdvertised++] = |
5369 ssl_renegotiation_info_xtn; | 5380 ssl_renegotiation_info_xtn; |
5370 } | 5381 } |
5371 | 5382 |
5372 flags = 0; | 5383 flags = 0; |
(...skipping 7195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12568 PORT_Free(ss->ssl3.hs.recvdFragments.buf); | 12579 PORT_Free(ss->ssl3.hs.recvdFragments.buf); |
12569 } | 12580 } |
12570 } | 12581 } |
12571 | 12582 |
12572 ss->ssl3.initialized = PR_FALSE; | 12583 ss->ssl3.initialized = PR_FALSE; |
12573 | 12584 |
12574 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); | 12585 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); |
12575 } | 12586 } |
12576 | 12587 |
12577 /* End of ssl3con.c */ | 12588 /* End of ssl3con.c */ |
OLD | NEW |