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

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

Issue 9764001: Add DTLS support to NSS, contributed by Eric Rescorla. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Made a second pass, reviewed dtls1con.c only for coding style Created 8 years, 9 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
OLDNEW
1 /* 1 /*
2 * Gather (Read) entire SSL2 records from socket into buffer. 2 * Gather (Read) entire SSL2 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 /* Caller should hold RecvBufLock. */ 428 /* Caller should hold RecvBufLock. */
429 SECStatus 429 SECStatus
430 ssl_InitGather(sslGather *gs) 430 ssl_InitGather(sslGather *gs)
431 { 431 {
432 SECStatus status; 432 SECStatus status;
433 433
434 gs->state = GS_INIT; 434 gs->state = GS_INIT;
435 gs->writeOffset = 0; 435 gs->writeOffset = 0;
436 gs->readOffset = 0; 436 gs->readOffset = 0;
437 gs->dtlsPacketOffset = 0;
Ryan Sleevi 2012/03/22 22:26:37 What about gs->dtlsPacket.len ?
wtc 2012/03/23 00:21:18 I don't fully understand this code, so I am provin
Ryan Sleevi 2012/03/23 00:38:28 Yes, but neither PORT_Free resets gs->inbuf.len /
ekr 2012/03/23 12:46:41 So your concern here is the initial state of gs->d
wtc 2012/03/23 13:48:49 I analyzed this last night and have fixed this in
437 status = sslBuffer_Grow(&gs->buf, 4096); 438 status = sslBuffer_Grow(&gs->buf, 4096);
438 return status; 439 return status;
439 } 440 }
440 441
441 /* Caller must hold RecvBufLock. */ 442 /* Caller must hold RecvBufLock. */
442 void 443 void
443 ssl_DestroyGather(sslGather *gs) 444 ssl_DestroyGather(sslGather *gs)
444 { 445 {
445 if (gs) { /* the PORT_*Free functions check for NULL pointers. */ 446 if (gs) { /* the PORT_*Free functions check for NULL pointers. */
446 PORT_ZFree(gs->buf.buf, gs->buf.space); 447 PORT_ZFree(gs->buf.buf, gs->buf.space);
447 PORT_Free(gs->inbuf.buf); 448 PORT_Free(gs->inbuf.buf);
449 PORT_Free(gs->dtlsPacket.buf);
448 } 450 }
449 } 451 }
450 452
451 /* Caller must hold RecvBufLock. */ 453 /* Caller must hold RecvBufLock. */
452 static SECStatus 454 static SECStatus
453 ssl2_HandleV3HandshakeRecord(sslSocket *ss) 455 ssl2_HandleV3HandshakeRecord(sslSocket *ss)
454 { 456 {
455 SECStatus rv; 457 SECStatus rv;
456 458
457 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); 459 PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) );
(...skipping 16 matching lines...) Expand all
474 rv = ssl3_NegotiateVersion(ss, SSL_LIBRARY_VERSION_MAX_SUPPORTED, 476 rv = ssl3_NegotiateVersion(ss, SSL_LIBRARY_VERSION_MAX_SUPPORTED,
475 PR_TRUE); 477 PR_TRUE);
476 if (rv != SECSuccess) { 478 if (rv != SECSuccess) {
477 return rv; 479 return rv;
478 } 480 }
479 481
480 ss->sec.send = ssl3_SendApplicationData; 482 ss->sec.send = ssl3_SendApplicationData;
481 483
482 return SECSuccess; 484 return SECSuccess;
483 } 485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698