OLD | NEW |
1 /* | 1 /* |
2 * TLS Snap Start | 2 * TLS Snap Start |
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 30 matching lines...) Expand all Loading... |
41 /* $Id: ssl3snap.c,v 1.0 2010/08/09 13:00:00 agl%google.com Exp $ */ | 41 /* $Id: ssl3snap.c,v 1.0 2010/08/09 13:00:00 agl%google.com Exp $ */ |
42 | 42 |
43 | 43 |
44 /* TODO(agl): Refactor ssl3_CompressMACEncryptRecord so that it can write to | 44 /* TODO(agl): Refactor ssl3_CompressMACEncryptRecord so that it can write to |
45 ** |sendBuf| directly and fix ssl3_AppendSnapStartHandshakeRecord and | 45 ** |sendBuf| directly and fix ssl3_AppendSnapStartHandshakeRecord and |
46 ** ssl3_AppendSnapStartApplicationData. | 46 ** ssl3_AppendSnapStartApplicationData. |
47 */ | 47 */ |
48 | 48 |
49 /* TODO(agl): Add support for snap starting with compression. */ | 49 /* TODO(agl): Add support for snap starting with compression. */ |
50 | 50 |
51 /* TODO(agl): Free snapStartApplicationData as soon as the handshake has | |
52 ** completed. | |
53 */ | |
54 | |
55 #include "pk11pub.h" | 51 #include "pk11pub.h" |
56 #include "ssl.h" | 52 #include "ssl.h" |
57 #include "sslimpl.h" | 53 #include "sslimpl.h" |
58 #include "sslproto.h" | 54 #include "sslproto.h" |
59 | 55 |
60 static unsigned int GetBE16(const void *in) | 56 static unsigned int GetBE16(const void *in) |
61 { | 57 { |
62 const unsigned char *p = in; | 58 const unsigned char *p = in; |
63 return ((unsigned) p[0]) << 8 | | 59 return ((unsigned) p[0]) << 8 | |
64 p[1]; | 60 p[1]; |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 rv = ssl3_AppendSnapStartHandshakeRecord(ss, ssl3_SendSnapStartFinished, | 810 rv = ssl3_AppendSnapStartHandshakeRecord(ss, ssl3_SendSnapStartFinished, |
815 PR_TRUE /* encrypt */); | 811 PR_TRUE /* encrypt */); |
816 if (rv != SECSuccess) | 812 if (rv != SECSuccess) |
817 goto loser; | 813 goto loser; |
818 | 814 |
819 /* Write application data */ | 815 /* Write application data */ |
820 if (ss->ssl3.snapStartApplicationData.data) { | 816 if (ss->ssl3.snapStartApplicationData.data) { |
821 rv = ssl3_AppendSnapStartApplicationData( | 817 rv = ssl3_AppendSnapStartApplicationData( |
822 ss, ss->ssl3.snapStartApplicationData.data, | 818 ss, ss->ssl3.snapStartApplicationData.data, |
823 ss->ssl3.snapStartApplicationData.len); | 819 ss->ssl3.snapStartApplicationData.len); |
| 820 SECITEM_FreeItem(&ss->ssl3.snapStartApplicationData, PR_FALSE); |
824 if (rv != SECSuccess) | 821 if (rv != SECSuccess) |
825 goto loser; | 822 goto loser; |
826 } | 823 } |
827 | 824 |
828 /* Revert the write cipher spec because the ClientHello will get encrypted | 825 /* Revert the write cipher spec because the ClientHello will get encrypted |
829 * with it otherwise. */ | 826 * with it otherwise. */ |
830 ssl_GetSpecWriteLock(ss); | 827 ssl_GetSpecWriteLock(ss); |
831 temp = ss->ssl3.cwSpec; | 828 temp = ss->ssl3.cwSpec; |
832 ss->ssl3.cwSpec = ss->ssl3.pwSpec; | 829 ss->ssl3.cwSpec = ss->ssl3.pwSpec; |
833 ss->ssl3.pwSpec = temp; | 830 ss->ssl3.pwSpec = temp; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 if (ss->ssl3.hs.snapStartType == snap_start_full) { | 1050 if (ss->ssl3.hs.snapStartType == snap_start_full) { |
1054 ss->ssl3.hs.snapStartType = snap_start_recovery; | 1051 ss->ssl3.hs.snapStartType = snap_start_recovery; |
1055 } else { | 1052 } else { |
1056 ss->ssl3.hs.snapStartType = snap_start_resume_recovery; | 1053 ss->ssl3.hs.snapStartType = snap_start_resume_recovery; |
1057 } | 1054 } |
1058 | 1055 |
1059 ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_TRUE/*freeSrvName*/); | 1056 ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_TRUE/*freeSrvName*/); |
1060 | 1057 |
1061 return SECSuccess; | 1058 return SECSuccess; |
1062 } | 1059 } |
OLD | NEW |