| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Various SSL functions. | 2 * Various SSL functions. |
| 3 * | 3 * |
| 4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
| 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 6 * | 6 * |
| 7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
| 8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
| 9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
| 10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * in which case the provisions of the GPL or the LGPL are applicable instead | 30 * in which case the provisions of the GPL or the LGPL are applicable instead |
| 31 * of those above. If you wish to allow use of your version of this file only | 31 * of those above. If you wish to allow use of your version of this file only |
| 32 * under the terms of either the GPL or the LGPL, and not to allow others to | 32 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 33 * use your version of this file under the terms of the MPL, indicate your | 33 * use your version of this file under the terms of the MPL, indicate your |
| 34 * decision by deleting the provisions above and replace them with the notice | 34 * decision by deleting the provisions above and replace them with the notice |
| 35 * and other provisions required by the GPL or the LGPL. If you do not delete | 35 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 36 * the provisions above, a recipient may use your version of this file under | 36 * the provisions above, a recipient may use your version of this file under |
| 37 * the terms of any one of the MPL, the GPL or the LGPL. | 37 * the terms of any one of the MPL, the GPL or the LGPL. |
| 38 * | 38 * |
| 39 * ***** END LICENSE BLOCK ***** */ | 39 * ***** END LICENSE BLOCK ***** */ |
| 40 /* $Id: sslsecur.c,v 1.43 2010/01/14 22:15:25 alexei.volkov.bugs%sun.com Exp $ *
/ | 40 /* $Id: sslsecur.c,v 1.43.2.2 2010/08/26 18:06:55 wtc%google.com Exp $ */ |
| 41 #include "cert.h" | 41 #include "cert.h" |
| 42 #include "secitem.h" | 42 #include "secitem.h" |
| 43 #include "keyhi.h" | 43 #include "keyhi.h" |
| 44 #include "ssl.h" | 44 #include "ssl.h" |
| 45 #include "sslimpl.h" | 45 #include "sslimpl.h" |
| 46 #include "sslproto.h" | 46 #include "sslproto.h" |
| 47 #include "secoid.h" /* for SECOID_GetALgorithmTag */ | 47 #include "secoid.h" /* for SECOID_GetALgorithmTag */ |
| 48 #include "pk11func.h" /* for PK11_GenerateRandom */ | 48 #include "pk11func.h" /* for PK11_GenerateRandom */ |
| 49 #include "nss.h" /* for NSS_RegisterShutdown */ | 49 #include "nss.h" /* for NSS_RegisterShutdown */ |
| 50 #include "prinit.h" /* for PR_CallOnceWithArg */ | 50 #include "prinit.h" /* for PR_CallOnceWithArg */ |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 */ | 1356 */ |
| 1357 int | 1357 int |
| 1358 SSL_DataPending(PRFileDesc *fd) | 1358 SSL_DataPending(PRFileDesc *fd) |
| 1359 { | 1359 { |
| 1360 sslSocket *ss; | 1360 sslSocket *ss; |
| 1361 int rv = 0; | 1361 int rv = 0; |
| 1362 | 1362 |
| 1363 ss = ssl_FindSocket(fd); | 1363 ss = ssl_FindSocket(fd); |
| 1364 | 1364 |
| 1365 if (ss && ss->opt.useSecurity) { | 1365 if (ss && ss->opt.useSecurity) { |
| 1366 | |
| 1367 ssl_Get1stHandshakeLock(ss); | |
| 1368 ssl_GetSSL3HandshakeLock(ss); | |
| 1369 | |
| 1370 ssl_GetRecvBufLock(ss); | 1366 ssl_GetRecvBufLock(ss); |
| 1371 rv = ss->gs.writeOffset - ss->gs.readOffset; | 1367 rv = ss->gs.writeOffset - ss->gs.readOffset; |
| 1372 ssl_ReleaseRecvBufLock(ss); | 1368 ssl_ReleaseRecvBufLock(ss); |
| 1373 | |
| 1374 ssl_ReleaseSSL3HandshakeLock(ss); | |
| 1375 ssl_Release1stHandshakeLock(ss); | |
| 1376 } | 1369 } |
| 1377 | 1370 |
| 1378 return rv; | 1371 return rv; |
| 1379 } | 1372 } |
| 1380 | 1373 |
| 1381 SECStatus | 1374 SECStatus |
| 1382 SSL_InvalidateSession(PRFileDesc *fd) | 1375 SSL_InvalidateSession(PRFileDesc *fd) |
| 1383 { | 1376 { |
| 1384 sslSocket * ss = ssl_FindSocket(fd); | 1377 sslSocket * ss = ssl_FindSocket(fd); |
| 1385 SECStatus rv = SECFailure; | 1378 SECStatus rv = SECFailure; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 if (!ss) { | 1523 if (!ss) { |
| 1531 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", | 1524 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", |
| 1532 SSL_GETPID(), fd)); | 1525 SSL_GETPID(), fd)); |
| 1533 return SECFailure; | 1526 return SECFailure; |
| 1534 } | 1527 } |
| 1535 | 1528 |
| 1536 ss->sniSocketConfig = func; | 1529 ss->sniSocketConfig = func; |
| 1537 ss->sniSocketConfigArg = arg; | 1530 ss->sniSocketConfigArg = arg; |
| 1538 return SECSuccess; | 1531 return SECSuccess; |
| 1539 } | 1532 } |
| OLD | NEW |