OLD | NEW |
1 /* | 1 /* |
2 * Gather (Read) entire SSL3 records from socket into buffer. | 2 * Gather (Read) entire SSL3 records from socket into buffer. |
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 18 matching lines...) Expand all Loading... |
29 * in which case the provisions of the GPL or the LGPL are applicable instead | 29 * in which case the provisions of the GPL or the LGPL are applicable instead |
30 * of those above. If you wish to allow use of your version of this file only | 30 * of those above. If you wish to allow use of your version of this file only |
31 * under the terms of either the GPL or the LGPL, and not to allow others to | 31 * under the terms of either the GPL or the LGPL, and not to allow others to |
32 * use your version of this file under the terms of the MPL, indicate your | 32 * use your version of this file under the terms of the MPL, indicate your |
33 * decision by deleting the provisions above and replace them with the notice | 33 * decision by deleting the provisions above and replace them with the notice |
34 * and other provisions required by the GPL or the LGPL. If you do not delete | 34 * and other provisions required by the GPL or the LGPL. If you do not delete |
35 * the provisions above, a recipient may use your version of this file under | 35 * the provisions above, a recipient may use your version of this file under |
36 * the terms of any one of the MPL, the GPL or the LGPL. | 36 * the terms of any one of the MPL, the GPL or the LGPL. |
37 * | 37 * |
38 * ***** END LICENSE BLOCK ***** */ | 38 * ***** END LICENSE BLOCK ***** */ |
39 /* $Id: ssl3gthr.c,v 1.9 2008/11/20 07:37:25 nelson%bolyard.com Exp $ */ | 39 /* $Id: ssl3gthr.c,v 1.9.20.1 2010/07/31 04:33:52 wtc%google.com Exp $ */ |
40 | 40 |
41 #include "cert.h" | 41 #include "cert.h" |
42 #include "ssl.h" | 42 #include "ssl.h" |
43 #include "sslimpl.h" | 43 #include "sslimpl.h" |
44 #include "ssl3prot.h" | 44 #include "ssl3prot.h" |
45 | 45 |
46 /* | 46 /* |
47 * Attempt to read in an entire SSL3 record. | 47 * Attempt to read in an entire SSL3 record. |
48 * Blocks here for blocking sockets, otherwise returns -1 with | 48 * Blocks here for blocking sockets, otherwise returns -1 with |
49 * PR_WOULD_BLOCK_ERROR when socket would block. | 49 * PR_WOULD_BLOCK_ERROR when socket would block. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); | 193 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); |
194 do { | 194 do { |
195 /* bring in the next sslv3 record. */ | 195 /* bring in the next sslv3 record. */ |
196 rv = ssl3_GatherData(ss, &ss->gs, flags); | 196 rv = ssl3_GatherData(ss, &ss->gs, flags); |
197 if (rv <= 0) { | 197 if (rv <= 0) { |
198 return rv; | 198 return rv; |
199 } | 199 } |
200 | 200 |
201 /* decipher it, and handle it if it's a handshake. | 201 /* decipher it, and handle it if it's a handshake. |
202 * If it's application data, ss->gs.buf will not be empty upon return. | 202 * If it's application data, ss->gs.buf will not be empty upon return. |
| 203 * If it's a change cipher spec, alert, or handshake message, |
| 204 * ss->gs.buf.len will be 0 when ssl3_HandleRecord returns SECSuccess. |
203 */ | 205 */ |
204 cText.type = (SSL3ContentType)ss->gs.hdr[0]; | 206 cText.type = (SSL3ContentType)ss->gs.hdr[0]; |
205 cText.version = (ss->gs.hdr[1] << 8) | ss->gs.hdr[2]; | 207 cText.version = (ss->gs.hdr[1] << 8) | ss->gs.hdr[2]; |
206 cText.buf = &ss->gs.inbuf; | 208 cText.buf = &ss->gs.inbuf; |
207 rv = ssl3_HandleRecord(ss, &cText, &ss->gs.buf); | 209 rv = ssl3_HandleRecord(ss, &cText, &ss->gs.buf); |
208 if (rv < 0) { | 210 if (rv < 0) { |
209 return ss->recvdCloseNotify ? 0 : rv; | 211 return ss->recvdCloseNotify ? 0 : rv; |
210 } | 212 } |
211 | 213 |
212 /* If we kicked off a false start in ssl3_HandleServerHelloDone, break | 214 /* If we kicked off a false start in ssl3_HandleServerHelloDone, break |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 { | 246 { |
245 int rv; | 247 int rv; |
246 | 248 |
247 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); | 249 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); |
248 do { | 250 do { |
249 rv = ssl3_GatherCompleteHandshake(ss, flags); | 251 rv = ssl3_GatherCompleteHandshake(ss, flags); |
250 } while (rv > 0 && ss->gs.buf.len == 0); | 252 } while (rv > 0 && ss->gs.buf.len == 0); |
251 | 253 |
252 return rv; | 254 return rv; |
253 } | 255 } |
OLD | NEW |