OLD | NEW |
1 From a30a1a87579d0a0d2950ee685a41bae428f38284 Mon Sep 17 00:00:00 2001 | 1 diff -up a/src/net/third_party/nss/ssl/ssl.h b/src/net/third_party/nss/ssl/ssl.h |
2 From: Adam Langley <agl@chromium.org> | 2 --- a/src/net/third_party/nss/ssl/ssl.h»2012-02-29 17:12:15.720044263 -0800 |
3 Date: Mon, 3 Oct 2011 12:25:44 -0400 | 3 +++ b/src/net/third_party/nss/ssl/ssl.h»2012-02-29 17:18:04.824794558 -0800 |
4 Subject: [PATCH] secret_exporter.patch | 4 @@ -774,6 +774,19 @@ SSL_IMPORT SECStatus SSL_GetCipherSuiteI |
5 | |
6 --- | |
7 mozilla/security/nss/lib/ssl/ssl.def | 1 + | |
8 mozilla/security/nss/lib/ssl/ssl.h | 13 ++++++ | |
9 mozilla/security/nss/lib/ssl/ssl3con.c | 63 ++++++++++++++++++++----------- | |
10 mozilla/security/nss/lib/ssl/sslimpl.h | 6 +++ | |
11 mozilla/security/nss/lib/ssl/sslinfo.c | 64 ++++++++++++++++++++++++++++++++ | |
12 5 files changed, 125 insertions(+), 22 deletions(-) | |
13 | |
14 diff --git a/mozilla/security/nss/lib/ssl/ssl.def b/mozilla/security/nss/lib/ssl
/ssl.def | |
15 index 7ef15db..1993d3e 100644 | |
16 --- a/mozilla/security/nss/lib/ssl/ssl.def | |
17 +++ b/mozilla/security/nss/lib/ssl/ssl.def | |
18 @@ -154,6 +154,7 @@ SSL_SNISocketConfigHook; | |
19 ;+}; | |
20 ;+NSS_CHROMIUM { | |
21 ;+ global: | |
22 +SSL_ExportKeyingMaterial; | |
23 SSL_GetNextProto; | |
24 SSL_GetStapledOCSPResponse; | |
25 SSL_HandshakeResumedSession; | |
26 diff --git a/mozilla/security/nss/lib/ssl/ssl.h b/mozilla/security/nss/lib/ssl/s
sl.h | |
27 index 1115fa9..835d3cf 100644 | |
28 --- a/mozilla/security/nss/lib/ssl/ssl.h | |
29 +++ b/mozilla/security/nss/lib/ssl/ssl.h | |
30 @@ -653,6 +653,19 @@ SSL_IMPORT SECStatus SSL_GetCipherSuiteInfo(PRUint16 cipher
Suite, | |
31 /* Returnes negotiated through SNI host info. */ | 5 /* Returnes negotiated through SNI host info. */ |
32 SSL_IMPORT SECItem *SSL_GetNegotiatedHostInfo(PRFileDesc *fd); | 6 SSL_IMPORT SECItem *SSL_GetNegotiatedHostInfo(PRFileDesc *fd); |
33 | 7 |
34 +/* Export keying material according to RFC 5705. | 8 +/* Export keying material according to RFC 5705. |
35 +** fd must correspond to a TLS 1.0 or higher socket and out must | 9 +** fd must correspond to a TLS 1.0 or higher socket and out must |
36 +** already be allocated. If contextLen is zero it uses the no-context | 10 +** already be allocated. If contextLen is zero it uses the no-context |
37 +** construction from the RFC. | 11 +** construction from the RFC. |
38 +*/ | 12 +*/ |
39 +SSL_IMPORT SECStatus SSL_ExportKeyingMaterial(PRFileDesc *fd, | 13 +SSL_IMPORT SECStatus SSL_ExportKeyingMaterial(PRFileDesc *fd, |
40 + const char *label, | 14 + const char *label, |
41 + unsigned int labelLen, | 15 + unsigned int labelLen, |
42 + const unsigned char *context, | 16 + const unsigned char *context, |
43 + unsigned int contextLen, | 17 + unsigned int contextLen, |
44 + unsigned char *out, | 18 + unsigned char *out, |
45 + unsigned int outLen); | 19 + unsigned int outLen); |
46 + | 20 + |
47 /* | 21 /* |
48 ** Return a new reference to the certificate that was most recently sent | 22 ** Return a new reference to the certificate that was most recently sent |
49 ** to the peer on this SSL/TLS connection, or NULL if none has been sent. | 23 ** to the peer on this SSL/TLS connection, or NULL if none has been sent. |
50 diff --git a/mozilla/security/nss/lib/ssl/ssl3con.c b/mozilla/security/nss/lib/s
sl/ssl3con.c | 24 diff -up a/src/net/third_party/nss/ssl/ssl3con.c b/src/net/third_party/nss/ssl/s
sl3con.c |
51 index 2648cbe..f8838d6 100644 | 25 --- a/src/net/third_party/nss/ssl/ssl3con.c» 2012-02-28 20:34:50.114663722 -0
800 |
52 --- a/mozilla/security/nss/lib/ssl/ssl3con.c | 26 +++ b/src/net/third_party/nss/ssl/ssl3con.c» 2012-02-29 17:18:04.824794558 -0
800 |
53 +++ b/mozilla/security/nss/lib/ssl/ssl3con.c | 27 @@ -8368,33 +8368,33 @@ done: |
54 @@ -8371,33 +8371,33 @@ ssl3_RestartHandshakeAfterServerCert(sslSocket *ss) | |
55 return rv; | 28 return rv; |
56 } | 29 } |
57 | 30 |
58 -static SECStatus | 31 -static SECStatus |
59 -ssl3_ComputeTLSFinished(ssl3CipherSpec *spec, | 32 -ssl3_ComputeTLSFinished(ssl3CipherSpec *spec, |
60 - PRBool isServer, | 33 - PRBool isServer, |
61 - const SSL3Finished * hashes, | 34 - const SSL3Finished * hashes, |
62 - TLSFinished * tlsFinished) | 35 - TLSFinished * tlsFinished) |
63 +/* The calling function must acquire and release the appropriate lock (i.e., | 36 +/* The calling function must acquire and release the appropriate lock (i.e., |
64 + * ssl_GetSpecReadLock / ssl_ReleaseSpecReadLock for ss->ssl3.crSpec). Any | 37 + * ssl_GetSpecReadLock / ssl_ReleaseSpecReadLock for ss->ssl3.crSpec). Any |
(...skipping 29 matching lines...) Expand all Loading... |
94 - &len, sizeof tlsFinished->verify_data); | 67 - &len, sizeof tlsFinished->verify_data); |
95 - PORT_Assert(rv != SECSuccess || len == sizeof *tlsFinished); | 68 - PORT_Assert(rv != SECSuccess || len == sizeof *tlsFinished); |
96 + rv |= PK11_DigestOp(prf_context, (unsigned char *) label, labelLen); | 69 + rv |= PK11_DigestOp(prf_context, (unsigned char *) label, labelLen); |
97 + rv |= PK11_DigestOp(prf_context, val, valLen); | 70 + rv |= PK11_DigestOp(prf_context, val, valLen); |
98 + rv |= PK11_DigestFinal(prf_context, out, | 71 + rv |= PK11_DigestFinal(prf_context, out, |
99 + &retLen, outLen); | 72 + &retLen, outLen); |
100 + PORT_Assert(rv != SECSuccess || retLen == outLen); | 73 + PORT_Assert(rv != SECSuccess || retLen == outLen); |
101 | 74 |
102 PK11_DestroyContext(prf_context, PR_TRUE); | 75 PK11_DestroyContext(prf_context, PR_TRUE); |
103 } else { | 76 } else { |
104 @@ -8406,17 +8406,36 @@ ssl3_ComputeTLSFinished(ssl3CipherSpec *spec, | 77 @@ -8403,17 +8403,36 @@ ssl3_ComputeTLSFinished(ssl3CipherSpec * |
105 SECItem outData = { siBuffer, }; | 78 SECItem outData = { siBuffer, }; |
106 PRBool isFIPS = PR_FALSE; | 79 PRBool isFIPS = PR_FALSE; |
107 | 80 |
108 - inData.data = (unsigned char *)hashes->md5; | 81 - inData.data = (unsigned char *)hashes->md5; |
109 - inData.len = sizeof hashes[0]; | 82 - inData.len = sizeof hashes[0]; |
110 - outData.data = tlsFinished->verify_data; | 83 - outData.data = tlsFinished->verify_data; |
111 - outData.len = sizeof tlsFinished->verify_data; | 84 - outData.len = sizeof tlsFinished->verify_data; |
112 + inData.data = (unsigned char *) val; | 85 + inData.data = (unsigned char *) val; |
113 + inData.len = valLen; | 86 + inData.len = valLen; |
114 + outData.data = out; | 87 + outData.data = out; |
(...skipping 22 matching lines...) Expand all Loading... |
137 + rv = ssl3_TLSPRFWithMasterSecret(spec, label, len, hashes->md5, | 110 + rv = ssl3_TLSPRFWithMasterSecret(spec, label, len, hashes->md5, |
138 + sizeof *hashes, tlsFinished->verify_data, | 111 + sizeof *hashes, tlsFinished->verify_data, |
139 + sizeof tlsFinished->verify_data); | 112 + sizeof tlsFinished->verify_data); |
140 + | 113 + |
141 + return rv; | 114 + return rv; |
142 +} | 115 +} |
143 + | 116 + |
144 /* called from ssl3_HandleServerHelloDone | 117 /* called from ssl3_HandleServerHelloDone |
145 */ | 118 */ |
146 static SECStatus | 119 static SECStatus |
147 diff --git a/mozilla/security/nss/lib/ssl/sslimpl.h b/mozilla/security/nss/lib/s
sl/sslimpl.h | 120 diff -up a/src/net/third_party/nss/ssl/sslimpl.h b/src/net/third_party/nss/ssl/s
slimpl.h |
148 index 973a3c9..906874a 100644 | 121 --- a/src/net/third_party/nss/ssl/sslimpl.h» 2012-02-29 17:12:15.720044263 -0
800 |
149 --- a/mozilla/security/nss/lib/ssl/sslimpl.h | 122 +++ b/src/net/third_party/nss/ssl/sslimpl.h» 2012-02-29 17:16:59.143900589 -0
800 |
150 +++ b/mozilla/security/nss/lib/ssl/sslimpl.h | 123 @@ -1709,6 +1709,11 @@ SECStatus SSL_DisableDefaultExportCipher |
151 @@ -1680,6 +1680,12 @@ SECStatus SSL_DisableDefaultExportCipherSuites(void); | |
152 SECStatus SSL_DisableExportCipherSuites(PRFileDesc * fd); | 124 SECStatus SSL_DisableExportCipherSuites(PRFileDesc * fd); |
153 PRBool SSL_IsExportCipherSuite(PRUint16 cipherSuite); | 125 PRBool SSL_IsExportCipherSuite(PRUint16 cipherSuite); |
154 | 126 |
155 +SECStatus ssl3_TLSPRFWithMasterSecret( | 127 +SECStatus ssl3_TLSPRFWithMasterSecret( |
156 + ssl3CipherSpec *spec, const char *label, | 128 + ssl3CipherSpec *spec, const char *label, |
157 + unsigned int labelLen, const unsigned char *val, | 129 + unsigned int labelLen, const unsigned char *val, |
158 + unsigned int valLen, unsigned char *out, | 130 + unsigned int valLen, unsigned char *out, |
159 + unsigned int outLen); | 131 + unsigned int outLen); |
160 + | |
161 /********************** FNV hash *********************/ | |
162 | 132 |
163 void FNV1A64_Init(PRUint64 *digest); | 133 #ifdef TRACE |
164 diff --git a/mozilla/security/nss/lib/ssl/sslinfo.c b/mozilla/security/nss/lib/s
sl/sslinfo.c | 134 #define SSL_TRACE(msg) ssl_Trace msg |
165 index 96377b0..cf870c7 100644 | 135 diff -up a/src/net/third_party/nss/ssl/sslinfo.c b/src/net/third_party/nss/ssl/s
slinfo.c |
166 --- a/mozilla/security/nss/lib/ssl/sslinfo.c | 136 --- a/src/net/third_party/nss/ssl/sslinfo.c» 2010-09-01 18:12:57.000000000 -0
700 |
167 +++ b/mozilla/security/nss/lib/ssl/sslinfo.c | 137 +++ b/src/net/third_party/nss/ssl/sslinfo.c» 2012-02-29 17:18:04.824794558 -0
800 |
168 @@ -20,6 +20,7 @@ | 138 @@ -20,6 +20,7 @@ |
169 * | 139 * |
170 * Contributor(s): | 140 * Contributor(s): |
171 * Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories | 141 * Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories |
172 + * Douglas Stebila <douglas@stebila.ca> | 142 + * Douglas Stebila <douglas@stebila.ca> |
173 * | 143 * |
174 * Alternatively, the contents of this file may be used under the terms of | 144 * Alternatively, the contents of this file may be used under the terms of |
175 * either the GNU General Public License Version 2 or later (the "GPL"), or | 145 * either the GNU General Public License Version 2 or later (the "GPL"), or |
176 @@ -316,6 +317,69 @@ SSL_IsExportCipherSuite(PRUint16 cipherSuite) | 146 @@ -316,6 +317,69 @@ SSL_IsExportCipherSuite(PRUint16 cipherS |
177 return PR_FALSE; | 147 return PR_FALSE; |
178 } | 148 } |
179 | 149 |
180 +/* Export keying material according to RFC 5705. | 150 +/* Export keying material according to RFC 5705. |
181 +** fd must correspond to a TLS 1.0 or higher socket, out must | 151 +** fd must correspond to a TLS 1.0 or higher socket, out must |
182 +** be already allocated. | 152 +** be already allocated. |
183 +*/ | 153 +*/ |
184 +SECStatus | 154 +SECStatus |
185 +SSL_ExportKeyingMaterial(PRFileDesc *fd, | 155 +SSL_ExportKeyingMaterial(PRFileDesc *fd, |
186 + const char *label, | 156 + const char *label, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 + } | 206 + } |
237 + ssl_ReleaseSpecReadLock(ss); | 207 + ssl_ReleaseSpecReadLock(ss); |
238 + | 208 + |
239 + PORT_ZFree(val, valLen); | 209 + PORT_ZFree(val, valLen); |
240 + return rv; | 210 + return rv; |
241 +} | 211 +} |
242 + | 212 + |
243 SECItem* | 213 SECItem* |
244 SSL_GetNegotiatedHostInfo(PRFileDesc *fd) | 214 SSL_GetNegotiatedHostInfo(PRFileDesc *fd) |
245 { | 215 { |
OLD | NEW |