Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: net/third_party/nss/ssl/sslinfo.c

Issue 10454066: Move the core state machine of SSLClientSocketNSS into a thread-safe Core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win_rel by not caching the current threads task runner. See added comment Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | remoting/protocol/authenticator_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* ***** BEGIN LICENSE BLOCK ***** 1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 * 3 *
4 * The contents of this file are subject to the Mozilla Public License Version 4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with 5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at 6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/ 7 * http://www.mozilla.org/MPL/
8 * 8 *
9 * Software distributed under the License is distributed on an "AS IS" basis, 9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 unsigned int valLen, i; 369 unsigned int valLen, i;
370 SECStatus rv = SECFailure; 370 SECStatus rv = SECFailure;
371 371
372 ss = ssl_FindSocket(fd); 372 ss = ssl_FindSocket(fd);
373 if (!ss) { 373 if (!ss) {
374 SSL_DBG(("%d: SSL[%d]: bad socket in ExportKeyingMaterial", 374 SSL_DBG(("%d: SSL[%d]: bad socket in ExportKeyingMaterial",
375 SSL_GETPID(), fd)); 375 SSL_GETPID(), fd));
376 return SECFailure; 376 return SECFailure;
377 } 377 }
378 378
379 ssl_GetRecvBufLock(ss);
380 ssl_GetSSL3HandshakeLock(ss);
381
379 if (ss->version < SSL_LIBRARY_VERSION_3_1_TLS) { 382 if (ss->version < SSL_LIBRARY_VERSION_3_1_TLS) {
380 PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION); 383 PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION);
384 ssl_ReleaseSSL3HandshakeLock(ss);
385 ssl_ReleaseRecvBufLock(ss);
381 return SECFailure; 386 return SECFailure;
382 } 387 }
383 388
384 /* construct PRF arguments */ 389 /* construct PRF arguments */
385 valLen = SSL3_RANDOM_LENGTH * 2; 390 valLen = SSL3_RANDOM_LENGTH * 2;
386 if (hasContext) { 391 if (hasContext) {
387 valLen += 2 /* uint16 length */ + contextLen; 392 valLen += 2 /* uint16 length */ + contextLen;
388 } 393 }
389 val = PORT_Alloc(valLen); 394 val = PORT_Alloc(valLen);
390 if (!val) { 395 if (!val) {
396 ssl_ReleaseSSL3HandshakeLock(ss);
397 ssl_ReleaseRecvBufLock(ss);
391 return SECFailure; 398 return SECFailure;
392 } 399 }
393 i = 0; 400 i = 0;
401
394 PORT_Memcpy(val + i, &ss->ssl3.hs.client_random.rand, SSL3_RANDOM_LENGTH); 402 PORT_Memcpy(val + i, &ss->ssl3.hs.client_random.rand, SSL3_RANDOM_LENGTH);
395 i += SSL3_RANDOM_LENGTH; 403 i += SSL3_RANDOM_LENGTH;
396 PORT_Memcpy(val + i, &ss->ssl3.hs.server_random.rand, SSL3_RANDOM_LENGTH); 404 PORT_Memcpy(val + i, &ss->ssl3.hs.server_random.rand, SSL3_RANDOM_LENGTH);
397 i += SSL3_RANDOM_LENGTH; 405 i += SSL3_RANDOM_LENGTH;
406
398 if (hasContext) { 407 if (hasContext) {
399 val[i++] = contextLen >> 8; 408 val[i++] = contextLen >> 8;
400 val[i++] = contextLen; 409 val[i++] = contextLen;
401 PORT_Memcpy(val + i, context, contextLen); 410 PORT_Memcpy(val + i, context, contextLen);
402 i += contextLen; 411 i += contextLen;
403 } 412 }
404 PORT_Assert(i == valLen); 413 PORT_Assert(i == valLen);
405 414
406 /* Allow TLS keying material to be exported sooner, when the master 415 /* Allow TLS keying material to be exported sooner, when the master
407 * secret is available and we have sent ChangeCipherSpec. 416 * secret is available and we have sent ChangeCipherSpec.
408 */ 417 */
409 ssl_GetSpecReadLock(ss); 418 ssl_GetSpecReadLock(ss);
410 if (!ss->ssl3.cwSpec->master_secret && !ss->ssl3.cwSpec->msItem.len) { 419 if (!ss->ssl3.cwSpec->master_secret && !ss->ssl3.cwSpec->msItem.len) {
411 PORT_SetError(SSL_ERROR_HANDSHAKE_NOT_COMPLETED); 420 PORT_SetError(SSL_ERROR_HANDSHAKE_NOT_COMPLETED);
412 rv = SECFailure; 421 rv = SECFailure;
413 } else { 422 } else {
414 rv = ssl3_TLSPRFWithMasterSecret(ss->ssl3.cwSpec, label, labelLen, val, 423 rv = ssl3_TLSPRFWithMasterSecret(ss->ssl3.cwSpec, label, labelLen, val,
415 valLen, out, outLen); 424 valLen, out, outLen);
416 } 425 }
417 ssl_ReleaseSpecReadLock(ss); 426 ssl_ReleaseSpecReadLock(ss);
427 ssl_ReleaseSSL3HandshakeLock(ss);
428 ssl_ReleaseRecvBufLock(ss);
418 429
419 PORT_ZFree(val, valLen); 430 PORT_ZFree(val, valLen);
420 return rv; 431 return rv;
421 } 432 }
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | remoting/protocol/authenticator_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698