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

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

Issue 11275240: Update net/third_party/nss/ssl to NSS 3.14. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Correct the NSS version in which EC_POINT_FORM_UNCOMPRESSED was moved to blapit.h Created 8 years, 1 month 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/third_party/nss/ssl/sslimpl.h ('k') | net/third_party/nss/ssl/sslinit.c » ('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 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 * The contents of this file are subject to the Mozilla Public License Version 4 /* $Id: sslinfo.c,v 1.31 2012/08/03 23:54:31 wtc%google.com Exp $ */
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
7 * http://www.mozilla.org/MPL/
8 *
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
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is the Netscape security libraries.
15 *
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2001
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 * Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
23 * Douglas Stebila <douglas@stebila.ca>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38 /* $Id: sslinfo.c,v 1.28 2012/03/14 00:56:43 wtc%google.com Exp $ */
39 #include "ssl.h" 5 #include "ssl.h"
40 #include "sslimpl.h" 6 #include "sslimpl.h"
41 #include "sslproto.h" 7 #include "sslproto.h"
42 8
43 static const char * 9 static const char *
44 ssl_GetCompressionMethodName(SSLCompressionMethod compression) 10 ssl_GetCompressionMethodName(SSLCompressionMethod compression)
45 { 11 {
46 switch (compression) { 12 switch (compression) {
47 case ssl_compression_null: 13 case ssl_compression_null:
48 return "NULL"; 14 return "NULL";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 inf.authKeyBits = ss->sec.authKeyBits; 57 inf.authKeyBits = ss->sec.authKeyBits;
92 inf.keaKeyBits = ss->sec.keaKeyBits; 58 inf.keaKeyBits = ss->sec.keaKeyBits;
93 if (ss->version < SSL_LIBRARY_VERSION_3_0) { /* SSL2 */ 59 if (ss->version < SSL_LIBRARY_VERSION_3_0) { /* SSL2 */
94 inf.cipherSuite = ss->sec.cipherType | 0xff00; 60 inf.cipherSuite = ss->sec.cipherType | 0xff00;
95 inf.compressionMethod = ssl_compression_null; 61 inf.compressionMethod = ssl_compression_null;
96 inf.compressionMethodName = "N/A"; 62 inf.compressionMethodName = "N/A";
97 } else if (ss->ssl3.initialized) { /* SSL3 and TLS */ 63 } else if (ss->ssl3.initialized) { /* SSL3 and TLS */
98 ssl_GetSpecReadLock(ss); 64 ssl_GetSpecReadLock(ss);
99 /* XXX The cipher suite should be in the specs and this 65 /* XXX The cipher suite should be in the specs and this
100 * function should get it from cwSpec rather than from the "hs". 66 * function should get it from cwSpec rather than from the "hs".
101 » * See bug 275744 comment 69. 67 » * See bug 275744 comment 69 and bug 766137.
102 */ 68 */
103 inf.cipherSuite = ss->ssl3.hs.cipher_suite; 69 inf.cipherSuite = ss->ssl3.hs.cipher_suite;
104 inf.compressionMethod = ss->ssl3.cwSpec->compression_method; 70 inf.compressionMethod = ss->ssl3.cwSpec->compression_method;
105 ssl_ReleaseSpecReadLock(ss); 71 ssl_ReleaseSpecReadLock(ss);
106 inf.compressionMethodName = 72 inf.compressionMethodName =
107 ssl_GetCompressionMethodName(inf.compressionMethod); 73 ssl_GetCompressionMethodName(inf.compressionMethod);
108 } 74 }
109 if (sid) { 75 if (sid) {
110 inf.creationTime = sid->creationTime; 76 inf.creationTime = sid->creationTime;
111 inf.lastAccessTime = sid->lastAccessTime; 77 inf.lastAccessTime = sid->lastAccessTime;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 unsigned int valLen, i; 335 unsigned int valLen, i;
370 SECStatus rv = SECFailure; 336 SECStatus rv = SECFailure;
371 337
372 ss = ssl_FindSocket(fd); 338 ss = ssl_FindSocket(fd);
373 if (!ss) { 339 if (!ss) {
374 SSL_DBG(("%d: SSL[%d]: bad socket in ExportKeyingMaterial", 340 SSL_DBG(("%d: SSL[%d]: bad socket in ExportKeyingMaterial",
375 SSL_GETPID(), fd)); 341 SSL_GETPID(), fd));
376 return SECFailure; 342 return SECFailure;
377 } 343 }
378 344
379 ssl_GetRecvBufLock(ss);
380 ssl_GetSSL3HandshakeLock(ss);
wtc 2012/11/12 18:31:01 I need to look into why the NSS upstream doesn't a
wtc 2012/11/13 01:18:57 I tracked this down. This code was added in https:
381
382 if (ss->version < SSL_LIBRARY_VERSION_3_1_TLS) { 345 if (ss->version < SSL_LIBRARY_VERSION_3_1_TLS) {
383 » PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION); 346 » PORT_SetError(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERSION);
384 » ssl_ReleaseSSL3HandshakeLock(ss);
385 » ssl_ReleaseRecvBufLock(ss);
386 return SECFailure; 347 return SECFailure;
387 } 348 }
388 349
389 /* construct PRF arguments */ 350 /* construct PRF arguments */
390 valLen = SSL3_RANDOM_LENGTH * 2; 351 valLen = SSL3_RANDOM_LENGTH * 2;
391 if (hasContext) { 352 if (hasContext) {
392 valLen += 2 /* uint16 length */ + contextLen; 353 valLen += 2 /* uint16 length */ + contextLen;
393 } 354 }
394 val = PORT_Alloc(valLen); 355 val = PORT_Alloc(valLen);
395 if (!val) { 356 if (!val) {
396 ssl_ReleaseSSL3HandshakeLock(ss);
397 ssl_ReleaseRecvBufLock(ss);
398 return SECFailure; 357 return SECFailure;
399 } 358 }
400 i = 0; 359 i = 0;
401
402 PORT_Memcpy(val + i, &ss->ssl3.hs.client_random.rand, SSL3_RANDOM_LENGTH); 360 PORT_Memcpy(val + i, &ss->ssl3.hs.client_random.rand, SSL3_RANDOM_LENGTH);
403 i += SSL3_RANDOM_LENGTH; 361 i += SSL3_RANDOM_LENGTH;
404 PORT_Memcpy(val + i, &ss->ssl3.hs.server_random.rand, SSL3_RANDOM_LENGTH); 362 PORT_Memcpy(val + i, &ss->ssl3.hs.server_random.rand, SSL3_RANDOM_LENGTH);
405 i += SSL3_RANDOM_LENGTH; 363 i += SSL3_RANDOM_LENGTH;
406
407 if (hasContext) { 364 if (hasContext) {
408 val[i++] = contextLen >> 8; 365 val[i++] = contextLen >> 8;
409 val[i++] = contextLen; 366 val[i++] = contextLen;
410 PORT_Memcpy(val + i, context, contextLen); 367 PORT_Memcpy(val + i, context, contextLen);
411 i += contextLen; 368 i += contextLen;
412 } 369 }
413 PORT_Assert(i == valLen); 370 PORT_Assert(i == valLen);
414 371
415 /* Allow TLS keying material to be exported sooner, when the master 372 /* Allow TLS keying material to be exported sooner, when the master
416 * secret is available and we have sent ChangeCipherSpec. 373 * secret is available and we have sent ChangeCipherSpec.
417 */ 374 */
418 ssl_GetSpecReadLock(ss); 375 ssl_GetSpecReadLock(ss);
419 if (!ss->ssl3.cwSpec->master_secret && !ss->ssl3.cwSpec->msItem.len) { 376 if (!ss->ssl3.cwSpec->master_secret && !ss->ssl3.cwSpec->msItem.len) {
420 PORT_SetError(SSL_ERROR_HANDSHAKE_NOT_COMPLETED); 377 PORT_SetError(SSL_ERROR_HANDSHAKE_NOT_COMPLETED);
421 rv = SECFailure; 378 rv = SECFailure;
422 } else { 379 } else {
423 rv = ssl3_TLSPRFWithMasterSecret(ss->ssl3.cwSpec, label, labelLen, val, 380 rv = ssl3_TLSPRFWithMasterSecret(ss->ssl3.cwSpec, label, labelLen, val,
424 valLen, out, outLen); 381 valLen, out, outLen);
425 } 382 }
426 ssl_ReleaseSpecReadLock(ss); 383 ssl_ReleaseSpecReadLock(ss);
427 ssl_ReleaseSSL3HandshakeLock(ss);
428 ssl_ReleaseRecvBufLock(ss);
429 384
430 PORT_ZFree(val, valLen); 385 PORT_ZFree(val, valLen);
431 return rv; 386 return rv;
432 } 387 }
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/sslimpl.h ('k') | net/third_party/nss/ssl/sslinit.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698