| OLD | NEW |
| 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 Loading... |
| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 345 ssl_GetRecvBufLock(ss); |
| 380 ssl_GetSSL3HandshakeLock(ss); | 346 ssl_GetSSL3HandshakeLock(ss); |
| 381 | 347 |
| 382 if (ss->version < SSL_LIBRARY_VERSION_3_1_TLS) { | 348 if (ss->version < SSL_LIBRARY_VERSION_3_1_TLS) { |
| 383 » PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION); | 349 » PORT_SetError(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERSION); |
| 384 ssl_ReleaseSSL3HandshakeLock(ss); | 350 ssl_ReleaseSSL3HandshakeLock(ss); |
| 385 ssl_ReleaseRecvBufLock(ss); | 351 ssl_ReleaseRecvBufLock(ss); |
| 386 return SECFailure; | 352 return SECFailure; |
| 387 } | 353 } |
| 388 | 354 |
| 389 /* construct PRF arguments */ | 355 /* construct PRF arguments */ |
| 390 valLen = SSL3_RANDOM_LENGTH * 2; | 356 valLen = SSL3_RANDOM_LENGTH * 2; |
| 391 if (hasContext) { | 357 if (hasContext) { |
| 392 valLen += 2 /* uint16 length */ + contextLen; | 358 valLen += 2 /* uint16 length */ + contextLen; |
| 393 } | 359 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 423 rv = ssl3_TLSPRFWithMasterSecret(ss->ssl3.cwSpec, label, labelLen, val, | 389 rv = ssl3_TLSPRFWithMasterSecret(ss->ssl3.cwSpec, label, labelLen, val, |
| 424 valLen, out, outLen); | 390 valLen, out, outLen); |
| 425 } | 391 } |
| 426 ssl_ReleaseSpecReadLock(ss); | 392 ssl_ReleaseSpecReadLock(ss); |
| 427 ssl_ReleaseSSL3HandshakeLock(ss); | 393 ssl_ReleaseSSL3HandshakeLock(ss); |
| 428 ssl_ReleaseRecvBufLock(ss); | 394 ssl_ReleaseRecvBufLock(ss); |
| 429 | 395 |
| 430 PORT_ZFree(val, valLen); | 396 PORT_ZFree(val, valLen); |
| 431 return rv; | 397 return rv; |
| 432 } | 398 } |
| OLD | NEW |