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 /* $Id: ssl3con.c,v 1.192 2012/09/28 05:10:25 wtc%google.com Exp $ */ | 8 /* $Id: ssl3con.c,v 1.192 2012/09/28 05:10:25 wtc%google.com Exp $ */ |
9 | 9 |
10 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ | 10 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1785 } | 1785 } |
1786 } else { | 1786 } else { |
1787 PORT_Assert(pwSpec->master_secret); | 1787 PORT_Assert(pwSpec->master_secret); |
1788 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); | 1788 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); |
1789 rv = SECFailure; | 1789 rv = SECFailure; |
1790 } | 1790 } |
1791 if (rv != SECSuccess) { | 1791 if (rv != SECSuccess) { |
1792 goto done; | 1792 goto done; |
1793 } | 1793 } |
1794 | 1794 |
1795 pwSpec->rc4EncryptedBytes = 0; | |
1796 | |
1795 /* Generic behaviors -- common to all crypto methods */ | 1797 /* Generic behaviors -- common to all crypto methods */ |
1796 if (!IS_DTLS(ss)) { | 1798 if (!IS_DTLS(ss)) { |
1797 pwSpec->read_seq_num.high = pwSpec->write_seq_num.high = 0; | 1799 pwSpec->read_seq_num.high = pwSpec->write_seq_num.high = 0; |
1798 } else { | 1800 } else { |
1799 if (cwSpec->epoch == PR_UINT16_MAX) { | 1801 if (cwSpec->epoch == PR_UINT16_MAX) { |
1800 /* The problem here is that we have rehandshaked too many | 1802 /* The problem here is that we have rehandshaked too many |
1801 * times (you are not allowed to wrap the epoch). The | 1803 * times (you are not allowed to wrap the epoch). The |
1802 * spec says you should be discarding the connection | 1804 * spec says you should be discarding the connection |
1803 * and start over, so not much we can do here. */ | 1805 * and start over, so not much we can do here. */ |
1804 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); | 1806 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2181 (PK11_NeedLogin(slot) && !PK11_IsLoggedIn(slot, NULL))) { | 2183 (PK11_NeedLogin(slot) && !PK11_IsLoggedIn(slot, NULL))) { |
2182 isPresent = PR_FALSE; | 2184 isPresent = PR_FALSE; |
2183 } | 2185 } |
2184 if (slot) { | 2186 if (slot) { |
2185 PK11_FreeSlot(slot); | 2187 PK11_FreeSlot(slot); |
2186 } | 2188 } |
2187 return isPresent; | 2189 return isPresent; |
2188 } | 2190 } |
2189 | 2191 |
2190 /* Caller must hold the spec read lock. */ | 2192 /* Caller must hold the spec read lock. */ |
2193 /* The function uses the three members of wrBuf as follows: | |
2194 * - Reads wrBuf->buf and wrBuf->space. Note that it does not read wrBuf->len. | |
2195 * - Writes data into the buffer that wrBuf->buf points to. | |
2196 * - Sets wrBuf->len to the number of bytes written on successful return. | |
2197 */ | |
2191 SECStatus | 2198 SECStatus |
2192 ssl3_CompressMACEncryptRecord(ssl3CipherSpec * cwSpec, | 2199 ssl3_CompressMACEncryptRecord(ssl3CipherSpec * cwSpec, |
2193 PRBool isServer, | 2200 PRBool isServer, |
2194 PRBool isDTLS, | 2201 PRBool isDTLS, |
2195 PRBool capRecordVersion, | 2202 PRBool capRecordVersion, |
2196 SSL3ContentType type, | 2203 SSL3ContentType type, |
2197 const SSL3Opaque * pIn, | 2204 const SSL3Opaque * pIn, |
2198 PRUint32 contentLen, | 2205 PRUint32 contentLen, |
2199 sslBuffer * wrBuf) | 2206 sslBuffer * wrBuf) |
2200 { | 2207 { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2356 | 2363 |
2357 if (capRecordVersion) { | 2364 if (capRecordVersion) { |
2358 version = PR_MIN(SSL_LIBRARY_VERSION_TLS_1_0, version); | 2365 version = PR_MIN(SSL_LIBRARY_VERSION_TLS_1_0, version); |
2359 } | 2366 } |
2360 wrBuf->buf[1] = MSB(version); | 2367 wrBuf->buf[1] = MSB(version); |
2361 wrBuf->buf[2] = LSB(version); | 2368 wrBuf->buf[2] = LSB(version); |
2362 wrBuf->buf[3] = MSB(cipherBytes); | 2369 wrBuf->buf[3] = MSB(cipherBytes); |
2363 wrBuf->buf[4] = LSB(cipherBytes); | 2370 wrBuf->buf[4] = LSB(cipherBytes); |
2364 } | 2371 } |
2365 | 2372 |
2373 if (type == content_handshake && | |
2374 cwSpec->cipher_def->calg == ssl_calg_rc4) { | |
2375 cwSpec->rc4EncryptedBytes += cipherBytes; | |
2376 } | |
2377 | |
2366 ssl3_BumpSequenceNumber(&cwSpec->write_seq_num); | 2378 ssl3_BumpSequenceNumber(&cwSpec->write_seq_num); |
2367 | 2379 |
2368 return SECSuccess; | 2380 return SECSuccess; |
2369 } | 2381 } |
2370 | 2382 |
2371 /* Process the plain text before sending it. | 2383 /* Process the plain text before sending it. |
2372 * Returns the number of bytes of plaintext that were successfully sent | 2384 * Returns the number of bytes of plaintext that were successfully sent |
2373 * plus the number of bytes of plaintext that were copied into the | 2385 * plus the number of bytes of plaintext that were copied into the |
2374 * output (write) buffer. | 2386 * output (write) buffer. |
2375 * Returns SECFailure on a hard IO error, memory error, or crypto error. | 2387 * Returns SECFailure on a hard IO error, memory error, or crypto error. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2409 SECStatus rv; | 2421 SECStatus rv; |
2410 PRInt32 totalSent = 0; | 2422 PRInt32 totalSent = 0; |
2411 PRBool capRecordVersion; | 2423 PRBool capRecordVersion; |
2412 | 2424 |
2413 SSL_TRC(3, ("%d: SSL3[%d] SendRecord type: %s nIn=%d", | 2425 SSL_TRC(3, ("%d: SSL3[%d] SendRecord type: %s nIn=%d", |
2414 SSL_GETPID(), ss->fd, ssl3_DecodeContentType(type), | 2426 SSL_GETPID(), ss->fd, ssl3_DecodeContentType(type), |
2415 nIn)); | 2427 nIn)); |
2416 PRINT_BUF(3, (ss, "Send record (plain text)", pIn, nIn)); | 2428 PRINT_BUF(3, (ss, "Send record (plain text)", pIn, nIn)); |
2417 | 2429 |
2418 PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss) ); | 2430 PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss) ); |
2431 PORT_Assert( wrBuf->len == 0 ); | |
2419 | 2432 |
2420 capRecordVersion = ((flags & ssl_SEND_FLAG_CAP_RECORD_VERSION) != 0); | 2433 capRecordVersion = ((flags & ssl_SEND_FLAG_CAP_RECORD_VERSION) != 0); |
2421 | 2434 |
2422 if (capRecordVersion) { | 2435 if (capRecordVersion) { |
2423 /* ssl_SEND_FLAG_CAP_RECORD_VERSION can only be used with the | 2436 /* ssl_SEND_FLAG_CAP_RECORD_VERSION can only be used with the |
2424 * TLS initial ClientHello. */ | 2437 * TLS initial ClientHello. */ |
2425 PORT_Assert(!IS_DTLS(ss)); | 2438 PORT_Assert(!IS_DTLS(ss)); |
2426 PORT_Assert(!ss->firstHsDone); | 2439 PORT_Assert(!ss->firstHsDone); |
2427 PORT_Assert(type == content_handshake); | 2440 PORT_Assert(type == content_handshake); |
2428 PORT_Assert(ss->ssl3.hs.ws == wait_server_hello); | 2441 PORT_Assert(ss->ssl3.hs.ws == wait_server_hello); |
(...skipping 13 matching lines...) Expand all Loading... | |
2442 | 2455 |
2443 /* check for Token Presence */ | 2456 /* check for Token Presence */ |
2444 if (!ssl3_ClientAuthTokenPresent(ss->sec.ci.sid)) { | 2457 if (!ssl3_ClientAuthTokenPresent(ss->sec.ci.sid)) { |
2445 PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL); | 2458 PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL); |
2446 return SECFailure; | 2459 return SECFailure; |
2447 } | 2460 } |
2448 | 2461 |
2449 while (nIn > 0) { | 2462 while (nIn > 0) { |
2450 PRUint32 contentLen = PR_MIN(nIn, MAX_FRAGMENT_LENGTH); | 2463 PRUint32 contentLen = PR_MIN(nIn, MAX_FRAGMENT_LENGTH); |
2451 unsigned int spaceNeeded; | 2464 unsigned int spaceNeeded; |
2452 » unsigned int numRecords; | 2465 » unsigned int numRecords = 1; |
2453 | 2466 |
2454 ssl_GetSpecReadLock(ss); /********************************/ | 2467 ssl_GetSpecReadLock(ss); /********************************/ |
2455 | 2468 |
2456 if (nIn > 1 && ss->opt.cbcRandomIV && | 2469 if (nIn > 1 && ss->opt.cbcRandomIV && |
2457 ss->ssl3.cwSpec->version < SSL_LIBRARY_VERSION_TLS_1_1 && | 2470 ss->ssl3.cwSpec->version < SSL_LIBRARY_VERSION_TLS_1_1 && |
2458 type == content_application_data && | 2471 type == content_application_data && |
2459 ss->ssl3.cwSpec->cipher_def->type == type_block /* CBC mode */) { | 2472 ss->ssl3.cwSpec->cipher_def->type == type_block /* CBC mode */) { |
2460 /* We will split the first byte of the record into its own record, | 2473 /* We will split the first byte of the record into its own record, |
2461 * as explained in the documentation for SSL_CBC_RANDOM_IV in ssl.h | 2474 * as explained in the documentation for SSL_CBC_RANDOM_IV in ssl.h |
2462 */ | 2475 */ |
2463 numRecords = 2; | 2476 numRecords = 2; |
2464 » } else { | 2477 » } else if (nIn > 1 && ss->opt.cbcRandomIV && |
2465 » numRecords = 1; | 2478 » type == content_application_data && |
2479 » ss->ssl3.cwSpec->cipher_def->calg == ssl_calg_rc4 && | |
2480 » ss->ssl3.cwSpec->rc4EncryptedBytes < SSL3_BIASED_RC4_BYTES) { | |
2481 » /* We will split the first few bytes of the record into their own | |
2482 » * one-byte records so that the biased RC4 keystream bytes are | |
2483 » * mostly used to encrypt record MACs. | |
2484 » */ | |
2485 » PRInt32 inBytes = nIn; | |
2486 | |
2487 » numRecords = 0; | |
2488 | |
2489 » /* Count how many one-byte records are needed to exhaust the | |
2490 » * biased RC4 keystream bytes. */ | |
2491 » while (inBytes > 0 && | |
2492 » » ss->ssl3.cwSpec->rc4EncryptedBytes < SSL3_BIASED_RC4_BYTES) { | |
2493 » » ss->ssl3.cwSpec->rc4EncryptedBytes += | |
agl
2013/03/22 13:44:46
I doesn't really matter, but these bytes will be a
wtc
2013/03/22 17:31:40
No. In ssl3_CompressMACEncryptRecord, there is a
t
| |
2494 » » 1 + ss->ssl3.cwSpec->mac_size; | |
2495 » » inBytes--; | |
2496 » » numRecords++; | |
2497 » } | |
2498 | |
2499 » /* Send any remaining bytes in one record. */ | |
2500 » if (inBytes > 0) { | |
2501 » » numRecords++; | |
2502 » } | |
2466 } | 2503 } |
2467 | 2504 |
2468 spaceNeeded = contentLen + (numRecords * SSL3_BUFFER_FUDGE); | 2505 spaceNeeded = contentLen + (numRecords * SSL3_BUFFER_FUDGE); |
2469 if (ss->ssl3.cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1 && | 2506 if (ss->ssl3.cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1 && |
2470 ss->ssl3.cwSpec->cipher_def->type == type_block) { | 2507 ss->ssl3.cwSpec->cipher_def->type == type_block) { |
2471 spaceNeeded += ss->ssl3.cwSpec->cipher_def->iv_size; | 2508 spaceNeeded += ss->ssl3.cwSpec->cipher_def->iv_size; |
2472 } | 2509 } |
2473 if (spaceNeeded > wrBuf->space) { | 2510 if (spaceNeeded > wrBuf->space) { |
2474 rv = sslBuffer_Grow(wrBuf, spaceNeeded); | 2511 rv = sslBuffer_Grow(wrBuf, spaceNeeded); |
2475 if (rv != SECSuccess) { | 2512 if (rv != SECSuccess) { |
2476 SSL_DBG(("%d: SSL3[%d]: SendRecord, tried to get %d bytes", | 2513 SSL_DBG(("%d: SSL3[%d]: SendRecord, tried to get %d bytes", |
2477 SSL_GETPID(), ss->fd, spaceNeeded)); | 2514 SSL_GETPID(), ss->fd, spaceNeeded)); |
2478 goto spec_locked_loser; /* sslBuffer_Grow set error code. */ | 2515 goto spec_locked_loser; /* sslBuffer_Grow set error code. */ |
2479 } | 2516 } |
2480 } | 2517 } |
2481 | 2518 |
2482 » if (numRecords == 2) { | 2519 » if (numRecords > 1) { |
2483 » sslBuffer secondRecord; | 2520 » sslBuffer recordBuf; |
2521 » unsigned int i; | |
2484 | 2522 |
2485 » rv = ssl3_CompressMACEncryptRecord(ss->ssl3.cwSpec, | 2523 » wrBuf->len = 0; |
2486 » » » » » ss->sec.isServer, IS_DTLS(ss), | 2524 » for (i = 0; i < numRecords; i++) { |
2487 » » » » » capRecordVersion, type, pIn, | 2525 » » recordBuf.buf = wrBuf->buf + wrBuf->len; |
2488 » » » » » 1, wrBuf); | 2526 » » recordBuf.len = 0; |
2489 » if (rv != SECSuccess) | 2527 » » recordBuf.space = wrBuf->space - wrBuf->len; |
2490 » goto spec_locked_loser; | |
2491 | 2528 |
2492 » PRINT_BUF(50, (ss, "send (encrypted) record data [1/2]:", | 2529 » » rv = ssl3_CompressMACEncryptRecord(ss->ssl3.cwSpec, |
2493 » wrBuf->buf, wrBuf->len)); | 2530 » » » » » » ss->sec.isServer, |
2531 » » » » » » IS_DTLS(ss), | |
2532 » » » » » » capRecordVersion, type, | |
2533 » » » » » » pIn + i, | |
2534 » » » » » » (i != numRecords - 1) ? | |
2535 » » » » » » 1 : contentLen - i, | |
2536 » » » » » » &recordBuf); | |
2537 » » if (rv != SECSuccess) | |
2538 » » break; | |
2494 | 2539 |
2495 » secondRecord.buf = wrBuf->buf + wrBuf->len; | 2540 » » PRINT_BUF(50, (ss, "send (encrypted) record data:", |
2496 » secondRecord.len = 0; | 2541 » » » recordBuf.buf, recordBuf.len)); |
2497 » secondRecord.space = wrBuf->space - wrBuf->len; | 2542 » » wrBuf->len += recordBuf.len; |
2498 | |
2499 » rv = ssl3_CompressMACEncryptRecord(ss->ssl3.cwSpec, | |
2500 » ss->sec.isServer, IS_DTLS(ss), | |
2501 » » » » » capRecordVersion, type, | |
2502 » » » » » pIn + 1, contentLen - 1, | |
2503 » &secondRecord); | |
2504 » if (rv == SECSuccess) { | |
2505 » PRINT_BUF(50, (ss, "send (encrypted) record data [2/2]:", | |
2506 » secondRecord.buf, secondRecord.len)); | |
2507 » wrBuf->len += secondRecord.len; | |
2508 } | 2543 } |
2509 } else { | 2544 } else { |
2510 if (!IS_DTLS(ss)) { | 2545 if (!IS_DTLS(ss)) { |
2511 rv = ssl3_CompressMACEncryptRecord(ss->ssl3.cwSpec, | 2546 rv = ssl3_CompressMACEncryptRecord(ss->ssl3.cwSpec, |
2512 ss->sec.isServer, | 2547 ss->sec.isServer, |
2513 IS_DTLS(ss), | 2548 IS_DTLS(ss), |
2514 capRecordVersion, | 2549 capRecordVersion, |
2515 type, pIn, | 2550 type, pIn, |
2516 contentLen, wrBuf); | 2551 contentLen, wrBuf); |
2517 } else { | 2552 } else { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2584 return SECFailure; | 2619 return SECFailure; |
2585 } | 2620 } |
2586 /* now take all the remaining unsent new ciphertext and | 2621 /* now take all the remaining unsent new ciphertext and |
2587 * append it to the buffer of previously unsent ciphertext. | 2622 * append it to the buffer of previously unsent ciphertext. |
2588 */ | 2623 */ |
2589 rv = ssl_SaveWriteData(ss, wrBuf->buf + sent, wrBuf->len); | 2624 rv = ssl_SaveWriteData(ss, wrBuf->buf + sent, wrBuf->len); |
2590 if (rv != SECSuccess) { | 2625 if (rv != SECSuccess) { |
2591 /* presumably a memory error, SEC_ERROR_NO_MEMORY */ | 2626 /* presumably a memory error, SEC_ERROR_NO_MEMORY */ |
2592 return SECFailure; | 2627 return SECFailure; |
2593 } | 2628 } |
2629 wrBuf->len = 0; /* All cipher text is saved away. */ | |
2594 } | 2630 } |
2595 } | 2631 } |
2596 totalSent += contentLen; | 2632 totalSent += contentLen; |
2597 } | 2633 } |
2598 return totalSent; | 2634 return totalSent; |
2599 } | 2635 } |
2600 | 2636 |
2601 #define SSL3_PENDING_HIGH_WATER 1024 | 2637 #define SSL3_PENDING_HIGH_WATER 1024 |
2602 | 2638 |
2603 /* Attempt to send the content of "in" in an SSL application_data record. | 2639 /* Attempt to send the content of "in" in an SSL application_data record. |
(...skipping 10 matching lines...) Expand all Loading... | |
2614 /* These flags for internal use only */ | 2650 /* These flags for internal use only */ |
2615 PORT_Assert(!(flags & (ssl_SEND_FLAG_USE_EPOCH | | 2651 PORT_Assert(!(flags & (ssl_SEND_FLAG_USE_EPOCH | |
2616 ssl_SEND_FLAG_NO_RETRANSMIT))); | 2652 ssl_SEND_FLAG_NO_RETRANSMIT))); |
2617 if (len < 0 || !in) { | 2653 if (len < 0 || !in) { |
2618 PORT_SetError(PR_INVALID_ARGUMENT_ERROR); | 2654 PORT_SetError(PR_INVALID_ARGUMENT_ERROR); |
2619 return SECFailure; | 2655 return SECFailure; |
2620 } | 2656 } |
2621 | 2657 |
2622 if (ss->pendingBuf.len > SSL3_PENDING_HIGH_WATER && | 2658 if (ss->pendingBuf.len > SSL3_PENDING_HIGH_WATER && |
2623 !ssl_SocketIsBlocking(ss)) { | 2659 !ssl_SocketIsBlocking(ss)) { |
2624 PORT_Assert(!ssl_SocketIsBlocking(ss)); | |
2625 PORT_SetError(PR_WOULD_BLOCK_ERROR); | 2660 PORT_SetError(PR_WOULD_BLOCK_ERROR); |
2626 return SECFailure; | 2661 return SECFailure; |
2627 } | 2662 } |
2628 | 2663 |
2629 if (ss->appDataBuffered && len) { | 2664 if (ss->appDataBuffered && len) { |
2630 PORT_Assert (in[0] == (unsigned char)(ss->appDataBuffered)); | 2665 PORT_Assert (in[0] == (unsigned char)(ss->appDataBuffered)); |
2631 if (in[0] != (unsigned char)(ss->appDataBuffered)) { | 2666 if (in[0] != (unsigned char)(ss->appDataBuffered)) { |
2632 PORT_SetError(PR_INVALID_ARGUMENT_ERROR); | 2667 PORT_SetError(PR_INVALID_ARGUMENT_ERROR); |
2633 return SECFailure; | 2668 return SECFailure; |
2634 } | 2669 } |
(...skipping 8156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10791 spec->msItem.len = 0; | 10826 spec->msItem.len = 0; |
10792 | 10827 |
10793 spec->client.write_key = NULL; | 10828 spec->client.write_key = NULL; |
10794 spec->client.write_mac_key = NULL; | 10829 spec->client.write_mac_key = NULL; |
10795 spec->client.write_mac_context = NULL; | 10830 spec->client.write_mac_context = NULL; |
10796 | 10831 |
10797 spec->server.write_key = NULL; | 10832 spec->server.write_key = NULL; |
10798 spec->server.write_mac_key = NULL; | 10833 spec->server.write_mac_key = NULL; |
10799 spec->server.write_mac_context = NULL; | 10834 spec->server.write_mac_context = NULL; |
10800 | 10835 |
10836 spec->rc4EncryptedBytes = 0; | |
10837 | |
10801 spec->write_seq_num.high = 0; | 10838 spec->write_seq_num.high = 0; |
10802 spec->write_seq_num.low = 0; | 10839 spec->write_seq_num.low = 0; |
10803 | 10840 |
10804 spec->read_seq_num.high = 0; | 10841 spec->read_seq_num.high = 0; |
10805 spec->read_seq_num.low = 0; | 10842 spec->read_seq_num.low = 0; |
10806 | 10843 |
10807 spec->epoch = 0; | 10844 spec->epoch = 0; |
10808 dtls_InitRecvdRecords(&spec->recvdRecords); | 10845 dtls_InitRecvdRecords(&spec->recvdRecords); |
10809 | 10846 |
10810 spec->version = ss->vrange.max; | 10847 spec->version = ss->vrange.max; |
(...skipping 28 matching lines...) Expand all Loading... | |
10839 ss->ssl3.hs.sendingSCSV = PR_FALSE; | 10876 ss->ssl3.hs.sendingSCSV = PR_FALSE; |
10840 ssl3_InitCipherSpec(ss, ss->ssl3.crSpec); | 10877 ssl3_InitCipherSpec(ss, ss->ssl3.crSpec); |
10841 ssl3_InitCipherSpec(ss, ss->ssl3.prSpec); | 10878 ssl3_InitCipherSpec(ss, ss->ssl3.prSpec); |
10842 | 10879 |
10843 ss->ssl3.hs.ws = (ss->sec.isServer) ? wait_client_hello : wait_server_hello; | 10880 ss->ssl3.hs.ws = (ss->sec.isServer) ? wait_client_hello : wait_server_hello; |
10844 #ifdef NSS_ENABLE_ECC | 10881 #ifdef NSS_ENABLE_ECC |
10845 ss->ssl3.hs.negotiatedECCurves = SSL3_SUPPORTED_CURVES_MASK; | 10882 ss->ssl3.hs.negotiatedECCurves = SSL3_SUPPORTED_CURVES_MASK; |
10846 #endif | 10883 #endif |
10847 ssl_ReleaseSpecWriteLock(ss); | 10884 ssl_ReleaseSpecWriteLock(ss); |
10848 | 10885 |
10886 /* XXX: move xtnData into ss->ssl3? */ | |
10849 PORT_Memset(&ss->xtnData, 0, sizeof(TLSExtensionData)); | 10887 PORT_Memset(&ss->xtnData, 0, sizeof(TLSExtensionData)); |
10850 | 10888 |
10851 if (IS_DTLS(ss)) { | 10889 if (IS_DTLS(ss)) { |
10852 ss->ssl3.hs.sendMessageSeq = 0; | 10890 ss->ssl3.hs.sendMessageSeq = 0; |
10853 ss->ssl3.hs.recvMessageSeq = 0; | 10891 ss->ssl3.hs.recvMessageSeq = 0; |
10854 ss->ssl3.hs.rtTimeoutMs = INITIAL_DTLS_TIMEOUT_MS; | 10892 ss->ssl3.hs.rtTimeoutMs = INITIAL_DTLS_TIMEOUT_MS; |
10855 ss->ssl3.hs.rtRetries = 0; | 10893 ss->ssl3.hs.rtRetries = 0; |
10856 ss->ssl3.hs.recvdHighWater = -1; | 10894 ss->ssl3.hs.recvdHighWater = -1; |
10857 PR_INIT_CLIST(&ss->ssl3.hs.lastMessageFlight); | 10895 PR_INIT_CLIST(&ss->ssl3.hs.lastMessageFlight); |
10858 dtls_SetMTU(ss, 0); /* Set the MTU to the highest plateau */ | 10896 dtls_SetMTU(ss, 0); /* Set the MTU to the highest plateau */ |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11266 PORT_Free(ss->ssl3.hs.recvdFragments.buf); | 11304 PORT_Free(ss->ssl3.hs.recvdFragments.buf); |
11267 } | 11305 } |
11268 } | 11306 } |
11269 | 11307 |
11270 ss->ssl3.initialized = PR_FALSE; | 11308 ss->ssl3.initialized = PR_FALSE; |
11271 | 11309 |
11272 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); | 11310 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); |
11273 } | 11311 } |
11274 | 11312 |
11275 /* End of ssl3con.c */ | 11313 /* End of ssl3con.c */ |
OLD | NEW |