| OLD | NEW |
| 1 diff -pu a/nss/lib/ssl/ssl3con.c b/nss/lib/ssl/ssl3con.c | 1 diff -pu a/nss/lib/ssl/ssl3con.c b/nss/lib/ssl/ssl3con.c |
| 2 --- a/nss/lib/ssl/ssl3con.c» 2013-07-31 12:45:11.497944276 -0700 | 2 --- a/nss/lib/ssl/ssl3con.c» 2014-01-03 19:36:09.938766379 -0800 |
| 3 +++ b/nss/lib/ssl/ssl3con.c» 2013-07-31 12:51:32.663550380 -0700 | 3 +++ b/nss/lib/ssl/ssl3con.c» 2014-01-03 19:37:50.360408300 -0800 |
| 4 @@ -55,6 +55,7 @@ static SECStatus ssl3_SendCertificateSta | 4 @@ -55,6 +55,7 @@ static SECStatus ssl3_SendCertificateSta |
| 5 static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss); | 5 static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss); |
| 6 static SECStatus ssl3_SendCertificateRequest(sslSocket *ss); | 6 static SECStatus ssl3_SendCertificateRequest(sslSocket *ss); |
| 7 static SECStatus ssl3_SendNextProto( sslSocket *ss); | 7 static SECStatus ssl3_SendNextProto( sslSocket *ss); |
| 8 +static SECStatus ssl3_SendEncryptedExtensions(sslSocket *ss); | 8 +static SECStatus ssl3_SendEncryptedExtensions(sslSocket *ss); |
| 9 static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags); | 9 static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags); |
| 10 static SECStatus ssl3_SendServerHello( sslSocket *ss); | 10 static SECStatus ssl3_SendServerHello( sslSocket *ss); |
| 11 static SECStatus ssl3_SendServerHelloDone( sslSocket *ss); | 11 static SECStatus ssl3_SendServerHelloDone( sslSocket *ss); |
| 12 @@ -5891,6 +5892,15 @@ ssl3_HandleServerHello(sslSocket *ss, SS | 12 @@ -6198,6 +6199,15 @@ ssl3_HandleServerHello(sslSocket *ss, SS |
| 13 } | 13 } |
| 14 #endif /* NSS_PLATFORM_CLIENT_AUTH */ | 14 #endif /* NSS_PLATFORM_CLIENT_AUTH */ |
| 15 | 15 |
| 16 + if (ss->ssl3.channelID != NULL) { | 16 + if (ss->ssl3.channelID != NULL) { |
| 17 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); | 17 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); |
| 18 + ss->ssl3.channelID = NULL; | 18 + ss->ssl3.channelID = NULL; |
| 19 + } | 19 + } |
| 20 + if (ss->ssl3.channelIDPub != NULL) { | 20 + if (ss->ssl3.channelIDPub != NULL) { |
| 21 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); | 21 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); |
| 22 + ss->ssl3.channelIDPub = NULL; | 22 + ss->ssl3.channelIDPub = NULL; |
| 23 + } | 23 + } |
| 24 + | 24 + |
| 25 temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length); | 25 temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length); |
| 26 if (temp < 0) { | 26 if (temp < 0) { |
| 27 goto loser; /* alert has been sent */ | 27 goto loser; /* alert has been sent */ |
| 28 @@ -6170,7 +6180,7 @@ ssl3_HandleServerHello(sslSocket *ss, SS | 28 @@ -6480,7 +6490,7 @@ ssl3_HandleServerHello(sslSocket *ss, SS |
| 29 if (rv != SECSuccess) { | 29 if (rv != SECSuccess) { |
| 30 goto alert_loser; /* err code was set */ | 30 goto alert_loser; /* err code was set */ |
| 31 } | 31 } |
| 32 - return SECSuccess; | 32 - return SECSuccess; |
| 33 + goto winner; | 33 + goto winner; |
| 34 } while (0); | 34 } while (0); |
| 35 | 35 |
| 36 if (sid_match) | 36 if (sid_match) |
| 37 @@ -6196,6 +6206,27 @@ ssl3_HandleServerHello(sslSocket *ss, SS | 37 @@ -6506,6 +6516,27 @@ ssl3_HandleServerHello(sslSocket *ss, SS |
| 38 | 38 |
| 39 ss->ssl3.hs.isResuming = PR_FALSE; | 39 ss->ssl3.hs.isResuming = PR_FALSE; |
| 40 ss->ssl3.hs.ws = wait_server_cert; | 40 ss->ssl3.hs.ws = wait_server_cert; |
| 41 + | 41 + |
| 42 +winner: | 42 +winner: |
| 43 + /* If we will need a ChannelID key then we make the callback now. This | 43 + /* If we will need a ChannelID key then we make the callback now. This |
| 44 + * allows the handshake to be restarted cleanly if the callback returns | 44 + * allows the handshake to be restarted cleanly if the callback returns |
| 45 + * SECWouldBlock. */ | 45 + * SECWouldBlock. */ |
| 46 + if (ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) { | 46 + if (ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) { |
| 47 + rv = ss->getChannelID(ss->getChannelIDArg, ss->fd, | 47 + rv = ss->getChannelID(ss->getChannelIDArg, ss->fd, |
| 48 + &ss->ssl3.channelIDPub, &ss->ssl3.channelID); | 48 + &ss->ssl3.channelIDPub, &ss->ssl3.channelID); |
| 49 + if (rv == SECWouldBlock) { | 49 + if (rv == SECWouldBlock) { |
| 50 + ssl3_SetAlwaysBlock(ss); | 50 + ssl3_SetAlwaysBlock(ss); |
| 51 + return rv; | 51 + return rv; |
| 52 + } | 52 + } |
| 53 + if (rv != SECSuccess || | 53 + if (rv != SECSuccess || |
| 54 + ss->ssl3.channelIDPub == NULL || | 54 + ss->ssl3.channelIDPub == NULL || |
| 55 + ss->ssl3.channelID == NULL) { | 55 + ss->ssl3.channelID == NULL) { |
| 56 + PORT_SetError(SSL_ERROR_GET_CHANNEL_ID_FAILED); | 56 + PORT_SetError(SSL_ERROR_GET_CHANNEL_ID_FAILED); |
| 57 + desc = internal_error; | 57 + desc = internal_error; |
| 58 + goto alert_loser; | 58 + goto alert_loser; |
| 59 + } | 59 + } |
| 60 + } | 60 + } |
| 61 + | 61 + |
| 62 return SECSuccess; | 62 return SECSuccess; |
| 63 | 63 |
| 64 alert_loser: | 64 alert_loser: |
| 65 @@ -6993,6 +7024,10 @@ ssl3_SendClientSecondRound(sslSocket *ss | 65 @@ -7467,7 +7498,14 @@ ssl3_SendClientSecondRound(sslSocket *ss |
| 66 » if (rv != SECSuccess) { |
| 66 goto loser; /* err code was set. */ | 67 goto loser; /* err code was set. */ |
| 67 } | 68 } |
| 68 } | 69 + } |
| 70 |
| 69 + rv = ssl3_SendEncryptedExtensions(ss); | 71 + rv = ssl3_SendEncryptedExtensions(ss); |
| 70 + if (rv != SECSuccess) { | 72 + if (rv != SECSuccess) { |
| 71 + goto loser; /* err code was set. */ | 73 + goto loser; /* err code was set. */ |
| 72 + } | 74 + } |
| 75 + |
| 76 + if (!ss->firstHsDone) { |
| 77 if (ss->opt.enableFalseStart) { |
| 78 if (!ss->ssl3.hs.authCertificatePending) { |
| 79 /* When we fix bug 589047, we will need to know whether we are |
| 80 @@ -7504,6 +7542,33 @@ ssl3_SendClientSecondRound(sslSocket *ss |
| 73 | 81 |
| 74 rv = ssl3_SendFinished(ss, 0); | 82 ssl_ReleaseXmitBufLock(ss);» » /*******************************
/ |
| 75 if (rv != SECSuccess) { | 83 |
| 76 @@ -9947,6 +9982,165 @@ ssl3_RecordKeyLog(sslSocket *ss) | 84 + if (!ss->ssl3.hs.isResuming && |
| 77 return; | 85 + ssl3_ExtensionNegotiated(ss, ssl_channel_id_xtn)) { |
| 86 + /* If we are negotiating ChannelID on a full handshake then we record |
| 87 + * the handshake hashes in |sid| at this point. They will be needed in |
| 88 + * the event that we resume this session and use ChannelID on the |
| 89 + * resumption handshake. */ |
| 90 + SSL3Hashes hashes; |
| 91 + SECItem *originalHandshakeHash = |
| 92 + &ss->sec.ci.sid->u.ssl3.originalHandshakeHash; |
| 93 + PORT_Assert(ss->sec.ci.sid->cached == never_cached); |
| 94 + |
| 95 + ssl_GetSpecReadLock(ss); |
| 96 + PORT_Assert(ss->version > SSL_LIBRARY_VERSION_3_0); |
| 97 + rv = ssl3_ComputeHandshakeHashes(ss, ss->ssl3.cwSpec, &hashes, 0); |
| 98 + ssl_ReleaseSpecReadLock(ss); |
| 99 + if (rv != SECSuccess) { |
| 100 + return rv; |
| 101 + } |
| 102 + |
| 103 + PORT_Assert(originalHandshakeHash->len == 0); |
| 104 + originalHandshakeHash->data = PORT_Alloc(hashes.len); |
| 105 + if (!originalHandshakeHash->data) |
| 106 + return SECFailure; |
| 107 + originalHandshakeHash->len = hashes.len; |
| 108 + memcpy(originalHandshakeHash->data, hashes.u.raw, hashes.len); |
| 109 + } |
| 110 + |
| 111 if (ssl3_ExtensionNegotiated(ss, ssl_session_ticket_xtn)) |
| 112 » ss->ssl3.hs.ws = wait_new_session_ticket; |
| 113 else |
| 114 @@ -10469,6 +10534,184 @@ ssl3_RecordKeyLog(sslSocket *ss) |
| 78 } | 115 } |
| 79 | 116 |
| 80 +/* called from ssl3_SendClientSecondRound | 117 /* called from ssl3_SendClientSecondRound |
| 81 + * ssl3_HandleFinished | 118 + * ssl3_HandleFinished |
| 82 + */ | 119 + */ |
| 83 +static SECStatus | 120 +static SECStatus |
| 84 +ssl3_SendEncryptedExtensions(sslSocket *ss) | 121 +ssl3_SendEncryptedExtensions(sslSocket *ss) |
| 85 +{ | 122 +{ |
| 86 + static const char CHANNEL_ID_MAGIC[] = "TLS Channel ID signature"; | 123 + static const char CHANNEL_ID_MAGIC[] = "TLS Channel ID signature"; |
| 124 + static const char CHANNEL_ID_RESUMPTION_MAGIC[] = "Resumption"; |
| 87 + /* This is the ASN.1 prefix for a P-256 public key. Specifically it's: | 125 + /* This is the ASN.1 prefix for a P-256 public key. Specifically it's: |
| 88 + * SEQUENCE | 126 + * SEQUENCE |
| 89 + * SEQUENCE | 127 + * SEQUENCE |
| 90 + * OID id-ecPublicKey | 128 + * OID id-ecPublicKey |
| 91 + * OID prime256v1 | 129 + * OID prime256v1 |
| 92 + * BIT STRING, length 66, 0 trailing bits: 0x04 | 130 + * BIT STRING, length 66, 0 trailing bits: 0x04 |
| 93 + * | 131 + * |
| 94 + * The 0x04 in the BIT STRING is the prefix for an uncompressed, X9.62 | 132 + * The 0x04 in the BIT STRING is the prefix for an uncompressed, X9.62 |
| 95 + * public key. Following that are the two field elements as 32-byte, | 133 + * public key. Following that are the two field elements as 32-byte, |
| 96 + * big-endian numbers, as required by the Channel ID. */ | 134 + * big-endian numbers, as required by the Channel ID. */ |
| 97 + static const unsigned char P256_SPKI_PREFIX[] = { | 135 + static const unsigned char P256_SPKI_PREFIX[] = { |
| 98 + 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, | 136 + 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, |
| 99 + 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, | 137 + 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, |
| 100 + 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, | 138 + 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, |
| 101 + 0x42, 0x00, 0x04 | 139 + 0x42, 0x00, 0x04 |
| 102 + }; | 140 + }; |
| 103 + /* ChannelIDs are always 128 bytes long: 64 bytes of P-256 public key and 6
4 | 141 + /* ChannelIDs are always 128 bytes long: 64 bytes of P-256 public key and 6
4 |
| 104 + * bytes of ECDSA signature. */ | 142 + * bytes of ECDSA signature. */ |
| 105 + static const int CHANNEL_ID_PUBLIC_KEY_LENGTH = 64; | 143 + static const int CHANNEL_ID_PUBLIC_KEY_LENGTH = 64; |
| 106 + static const int CHANNEL_ID_LENGTH = 128; | 144 + static const int CHANNEL_ID_LENGTH = 128; |
| 107 + | 145 + |
| 108 + SECStatus rv = SECFailure; | 146 + SECStatus rv = SECFailure; |
| 109 + SECItem *spki = NULL; | 147 + SECItem *spki = NULL; |
| 110 + SSL3Hashes hashes; | 148 + SSL3Hashes hashes; |
| 111 + const unsigned char *pub_bytes; | 149 + const unsigned char *pub_bytes; |
| 112 + unsigned char signed_data[sizeof(CHANNEL_ID_MAGIC) + sizeof(SSL3Hashes)]; | 150 + unsigned char signed_data[sizeof(CHANNEL_ID_MAGIC) + |
| 151 + sizeof(CHANNEL_ID_RESUMPTION_MAGIC) + |
| 152 + sizeof(SSL3Hashes)*2]; |
| 153 + size_t signed_data_len; |
| 113 + unsigned char digest[SHA256_LENGTH]; | 154 + unsigned char digest[SHA256_LENGTH]; |
| 114 + SECItem digest_item; | 155 + SECItem digest_item; |
| 115 + unsigned char signature[64]; | 156 + unsigned char signature[64]; |
| 116 + SECItem signature_item; | 157 + SECItem signature_item; |
| 117 + | 158 + |
| 118 + PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss)); | 159 + PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss)); |
| 119 + PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); | 160 + PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); |
| 120 + | 161 + |
| 121 + if (ss->ssl3.channelID == NULL) | 162 + if (ss->ssl3.channelID == NULL) |
| 122 + return SECSuccess; | 163 + return SECSuccess; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 152 + | 193 + |
| 153 + if (spki->len != sizeof(P256_SPKI_PREFIX) + CHANNEL_ID_PUBLIC_KEY_LENGTH || | 194 + if (spki->len != sizeof(P256_SPKI_PREFIX) + CHANNEL_ID_PUBLIC_KEY_LENGTH || |
| 154 + memcmp(spki->data, P256_SPKI_PREFIX, sizeof(P256_SPKI_PREFIX)) != 0) { | 195 + memcmp(spki->data, P256_SPKI_PREFIX, sizeof(P256_SPKI_PREFIX)) != 0) { |
| 155 + PORT_SetError(SSL_ERROR_INVALID_CHANNEL_ID_KEY); | 196 + PORT_SetError(SSL_ERROR_INVALID_CHANNEL_ID_KEY); |
| 156 + rv = SECFailure; | 197 + rv = SECFailure; |
| 157 + goto loser; | 198 + goto loser; |
| 158 + } | 199 + } |
| 159 + | 200 + |
| 160 + pub_bytes = spki->data + sizeof(P256_SPKI_PREFIX); | 201 + pub_bytes = spki->data + sizeof(P256_SPKI_PREFIX); |
| 161 + | 202 + |
| 162 + memcpy(signed_data, CHANNEL_ID_MAGIC, sizeof(CHANNEL_ID_MAGIC)); | 203 + signed_data_len = 0; |
| 163 + memcpy(signed_data + sizeof(CHANNEL_ID_MAGIC), hashes.u.raw, hashes.len); | 204 + memcpy(signed_data + signed_data_len, CHANNEL_ID_MAGIC, |
| 205 + sizeof(CHANNEL_ID_MAGIC)); |
| 206 + signed_data_len += sizeof(CHANNEL_ID_MAGIC); |
| 207 + if (ss->ssl3.hs.isResuming) { |
| 208 + SECItem *originalHandshakeHash = |
| 209 + &ss->sec.ci.sid->u.ssl3.originalHandshakeHash; |
| 210 + PORT_Assert(originalHandshakeHash->len > 0); |
| 164 + | 211 + |
| 165 + rv = PK11_HashBuf(SEC_OID_SHA256, digest, signed_data, | 212 + memcpy(signed_data + signed_data_len, CHANNEL_ID_RESUMPTION_MAGIC, |
| 166 +» » sizeof(CHANNEL_ID_MAGIC) + hashes.len); | 213 + sizeof(CHANNEL_ID_RESUMPTION_MAGIC)); |
| 214 + signed_data_len += sizeof(CHANNEL_ID_RESUMPTION_MAGIC); |
| 215 + memcpy(signed_data + signed_data_len, originalHandshakeHash->data, |
| 216 + originalHandshakeHash->len); |
| 217 + signed_data_len += originalHandshakeHash->len; |
| 218 + } |
| 219 + memcpy(signed_data + signed_data_len, hashes.u.raw, hashes.len); |
| 220 + signed_data_len += hashes.len; |
| 221 + |
| 222 + rv = PK11_HashBuf(SEC_OID_SHA256, digest, signed_data, signed_data_len); |
| 167 + if (rv != SECSuccess) | 223 + if (rv != SECSuccess) |
| 168 + goto loser; | 224 + goto loser; |
| 169 + | 225 + |
| 170 + digest_item.data = digest; | 226 + digest_item.data = digest; |
| 171 + digest_item.len = sizeof(digest); | 227 + digest_item.len = sizeof(digest); |
| 172 + | 228 + |
| 173 + signature_item.data = signature; | 229 + signature_item.data = signature; |
| 174 + signature_item.len = sizeof(signature); | 230 + signature_item.len = sizeof(signature); |
| 175 + | 231 + |
| 176 + rv = PK11_Sign(ss->ssl3.channelID, &signature_item, &digest_item); | 232 + rv = PK11_Sign(ss->ssl3.channelID, &signature_item, &digest_item); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 + if (ss->ssl3.channelIDPub) | 285 + if (ss->ssl3.channelIDPub) |
| 230 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); | 286 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); |
| 231 + | 287 + |
| 232 + ss->handshake = ssl_GatherRecord1stHandshake; | 288 + ss->handshake = ssl_GatherRecord1stHandshake; |
| 233 + ss->ssl3.channelID = channelID; | 289 + ss->ssl3.channelID = channelID; |
| 234 + ss->ssl3.channelIDPub = channelIDPub; | 290 + ss->ssl3.channelIDPub = channelIDPub; |
| 235 + | 291 + |
| 236 + return SECSuccess; | 292 + return SECSuccess; |
| 237 +} | 293 +} |
| 238 + | 294 + |
| 239 /* called from ssl3_HandleServerHelloDone | 295 +/* called from ssl3_SendClientSecondRound |
| 240 * ssl3_HandleClientHello | 296 * ssl3_HandleClientHello |
| 241 * ssl3_HandleFinished | 297 * ssl3_HandleFinished |
| 242 @@ -10202,11 +10396,16 @@ ssl3_HandleFinished(sslSocket *ss, SSL3O | 298 */ |
| 299 @@ -10728,11 +10971,16 @@ ssl3_HandleFinished(sslSocket *ss, SSL3O |
| 243 flags = ssl_SEND_FLAG_FORCE_INTO_BUFFER; | 300 flags = ssl_SEND_FLAG_FORCE_INTO_BUFFER; |
| 244 } | 301 } |
| 245 | 302 |
| 246 - if (!isServer && !ss->firstHsDone) { | 303 - if (!isServer && !ss->firstHsDone) { |
| 247 - rv = ssl3_SendNextProto(ss); | 304 - rv = ssl3_SendNextProto(ss); |
| 248 - if (rv != SECSuccess) { | 305 - if (rv != SECSuccess) { |
| 249 - goto xmit_loser; /* err code was set. */ | 306 - goto xmit_loser; /* err code was set. */ |
| 250 + if (!isServer) { | 307 + if (!isServer) { |
| 251 + if (!ss->firstHsDone) { | 308 + if (!ss->firstHsDone) { |
| 252 + rv = ssl3_SendNextProto(ss); | 309 + rv = ssl3_SendNextProto(ss); |
| 253 + if (rv != SECSuccess) { | 310 + if (rv != SECSuccess) { |
| 254 + goto xmit_loser; /* err code was set. */ | 311 + goto xmit_loser; /* err code was set. */ |
| 255 + } | 312 + } |
| 256 } | 313 } |
| 257 + rv = ssl3_SendEncryptedExtensions(ss); | 314 + rv = ssl3_SendEncryptedExtensions(ss); |
| 258 + if (rv != SECSuccess) | 315 + if (rv != SECSuccess) |
| 259 + goto xmit_loser; /* err code was set. */ | 316 + goto xmit_loser; /* err code was set. */ |
| 260 } | 317 } |
| 261 | 318 |
| 262 if (IS_DTLS(ss)) { | 319 if (IS_DTLS(ss)) { |
| 263 @@ -11635,6 +11834,11 @@ ssl3_DestroySSL3Info(sslSocket *ss) | 320 @@ -12212,6 +12460,11 @@ ssl3_DestroySSL3Info(sslSocket *ss) |
| 264 ssl_FreePlatformKey(ss->ssl3.platformClientKey); | 321 ssl_FreePlatformKey(ss->ssl3.platformClientKey); |
| 265 #endif /* NSS_PLATFORM_CLIENT_AUTH */ | 322 #endif /* NSS_PLATFORM_CLIENT_AUTH */ |
| 266 | 323 |
| 267 + if (ss->ssl3.channelID) | 324 + if (ss->ssl3.channelID) |
| 268 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); | 325 + SECKEY_DestroyPrivateKey(ss->ssl3.channelID); |
| 269 + if (ss->ssl3.channelIDPub) | 326 + if (ss->ssl3.channelIDPub) |
| 270 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); | 327 + SECKEY_DestroyPublicKey(ss->ssl3.channelIDPub); |
| 271 + | 328 + |
| 272 if (ss->ssl3.peerCertArena != NULL) | 329 if (ss->ssl3.peerCertArena != NULL) |
| 273 ssl3_CleanupPeerCerts(ss); | 330 ssl3_CleanupPeerCerts(ss); |
| 274 | 331 |
| 275 diff -pu a/nss/lib/ssl/ssl3ext.c b/nss/lib/ssl/ssl3ext.c | 332 diff -pu a/nss/lib/ssl/ssl3ext.c b/nss/lib/ssl/ssl3ext.c |
| 276 --- a/nss/lib/ssl/ssl3ext.c» 2013-07-31 12:40:14.493586151 -0700 | 333 --- a/nss/lib/ssl/ssl3ext.c» 2014-01-03 19:31:09.783859095 -0800 |
| 277 +++ b/nss/lib/ssl/ssl3ext.c» 2013-07-31 12:45:50.338515793 -0700 | 334 +++ b/nss/lib/ssl/ssl3ext.c» 2014-01-03 19:36:25.379018825 -0800 |
| 278 @@ -60,6 +60,10 @@ static PRInt32 ssl3_SendUseSRTPXtn(sslSo | 335 @@ -60,6 +60,10 @@ static PRInt32 ssl3_SendUseSRTPXtn(sslSo |
| 279 PRUint32 maxBytes); | 336 PRUint32 maxBytes); |
| 280 static SECStatus ssl3_HandleUseSRTPXtn(sslSocket * ss, PRUint16 ex_type, | 337 static SECStatus ssl3_HandleUseSRTPXtn(sslSocket * ss, PRUint16 ex_type, |
| 281 SECItem *data); | 338 SECItem *data); |
| 282 +static SECStatus ssl3_ClientHandleChannelIDXtn(sslSocket *ss, | 339 +static SECStatus ssl3_ClientHandleChannelIDXtn(sslSocket *ss, |
| 283 + PRUint16 ex_type, SECItem *data); | 340 + PRUint16 ex_type, SECItem *data); |
| 284 +static PRInt32 ssl3_ClientSendChannelIDXtn(sslSocket *ss, PRBool append, | 341 +static PRInt32 ssl3_ClientSendChannelIDXtn(sslSocket *ss, PRBool append, |
| 285 + PRUint32 maxBytes); | 342 + PRUint32 maxBytes); |
| 286 static SECStatus ssl3_ServerSendStatusRequestXtn(sslSocket * ss, | 343 static SECStatus ssl3_ServerSendStatusRequestXtn(sslSocket * ss, |
| 287 PRBool append, PRUint32 maxBytes); | 344 PRBool append, PRUint32 maxBytes); |
| 288 static SECStatus ssl3_ServerHandleStatusRequestXtn(sslSocket *ss, | 345 static SECStatus ssl3_ServerHandleStatusRequestXtn(sslSocket *ss, |
| 289 @@ -248,6 +252,7 @@ static const ssl3HelloExtensionHandler s | 346 @@ -248,6 +252,7 @@ static const ssl3HelloExtensionHandler s |
| 290 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, | 347 { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, |
| 291 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn }, | 348 { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn }, |
| 292 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn }, | 349 { ssl_use_srtp_xtn, &ssl3_HandleUseSRTPXtn }, |
| 293 + { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn }, | 350 + { ssl_channel_id_xtn, &ssl3_ClientHandleChannelIDXtn }, |
| 294 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn }, | 351 { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn }, |
| 295 { -1, NULL } | 352 { -1, NULL } |
| 296 }; | 353 }; |
| 297 @@ -274,6 +279,7 @@ ssl3HelloExtensionSender clientHelloSend | 354 @@ -274,6 +279,7 @@ ssl3HelloExtensionSender clientHelloSend |
| 298 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn }, | 355 { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn }, |
| 299 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn }, | 356 { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn }, |
| 300 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn }, | 357 { ssl_use_srtp_xtn, &ssl3_SendUseSRTPXtn }, |
| 301 + { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn }, | 358 + { ssl_channel_id_xtn, &ssl3_ClientSendChannelIDXtn }, |
| 302 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn }, | 359 { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn }, |
| 303 { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn } | 360 { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn } |
| 304 /* any extra entries will appear as { 0, NULL } */ | 361 /* any extra entries will appear as { 0, NULL } */ |
| 305 @@ -660,6 +666,52 @@ ssl3_ClientSendNextProtoNegoXtn(sslSocke | 362 @@ -669,6 +675,61 @@ ssl3_ClientSendNextProtoNegoXtn(sslSocke |
| 306 } | 363 } |
| 307 | 364 |
| 308 return extension_length; | 365 return extension_length; |
| 309 + | 366 + |
| 310 +loser: | 367 +loser: |
| 311 + return -1; | 368 + return -1; |
| 312 +} | 369 +} |
| 313 + | 370 + |
| 314 +static SECStatus | 371 +static SECStatus |
| 315 +ssl3_ClientHandleChannelIDXtn(sslSocket *ss, PRUint16 ex_type, | 372 +ssl3_ClientHandleChannelIDXtn(sslSocket *ss, PRUint16 ex_type, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 332 + PRInt32 extension_length = 4; | 389 + PRInt32 extension_length = 4; |
| 333 + | 390 + |
| 334 + if (!ss->getChannelID) | 391 + if (!ss->getChannelID) |
| 335 + return 0; | 392 + return 0; |
| 336 + | 393 + |
| 337 + if (maxBytes < extension_length) { | 394 + if (maxBytes < extension_length) { |
| 338 + PORT_Assert(0); | 395 + PORT_Assert(0); |
| 339 + return 0; | 396 + return 0; |
| 340 + } | 397 + } |
| 341 + | 398 + |
| 399 + if (ss->sec.ci.sid->cached != never_cached && |
| 400 + ss->sec.ci.sid->u.ssl3.originalHandshakeHash.len == 0) { |
| 401 + /* We can't do ChannelID on a connection if we're resuming and didn't |
| 402 + * do ChannelID on the original connection: without ChannelID on the |
| 403 + * original connection we didn't record the handshake hashes needed for |
| 404 + * the signature. */ |
| 405 + return 0; |
| 406 + } |
| 407 + |
| 342 + if (append) { | 408 + if (append) { |
| 343 + SECStatus rv; | 409 + SECStatus rv; |
| 344 + rv = ssl3_AppendHandshakeNumber(ss, ssl_channel_id_xtn, 2); | 410 + rv = ssl3_AppendHandshakeNumber(ss, ssl_channel_id_xtn, 2); |
| 345 + if (rv != SECSuccess) | 411 + if (rv != SECSuccess) |
| 346 + goto loser; | 412 + goto loser; |
| 347 + rv = ssl3_AppendHandshakeNumber(ss, 0, 2); | 413 + rv = ssl3_AppendHandshakeNumber(ss, 0, 2); |
| 348 + if (rv != SECSuccess) | 414 + if (rv != SECSuccess) |
| 349 + goto loser; | 415 + goto loser; |
| 350 + ss->xtnData.advertised[ss->xtnData.numAdvertised++] = | 416 + ss->xtnData.advertised[ss->xtnData.numAdvertised++] = |
| 351 + ssl_channel_id_xtn; | 417 + ssl_channel_id_xtn; |
| 352 + } | 418 + } |
| 353 + | 419 + |
| 354 + return extension_length; | 420 + return extension_length; |
| 355 | 421 |
| 356 loser: | 422 loser: |
| 357 return -1; | 423 return -1; |
| 358 diff -pu a/nss/lib/ssl/ssl3prot.h b/nss/lib/ssl/ssl3prot.h | 424 diff -pu a/nss/lib/ssl/ssl3prot.h b/nss/lib/ssl/ssl3prot.h |
| 359 --- a/nss/lib/ssl/ssl3prot.h» 2013-07-31 12:07:10.974699609 -0700 | 425 --- a/nss/lib/ssl/ssl3prot.h» 2014-01-03 19:28:03.550814608 -0800 |
| 360 +++ b/nss/lib/ssl/ssl3prot.h» 2013-07-31 12:45:50.338515793 -0700 | 426 +++ b/nss/lib/ssl/ssl3prot.h» 2014-01-03 19:36:25.379018825 -0800 |
| 361 @@ -129,7 +129,8 @@ typedef enum { | 427 @@ -129,7 +129,8 @@ typedef enum { |
| 362 client_key_exchange = 16, | 428 client_key_exchange = 16, |
| 363 finished = 20, | 429 finished = 20, |
| 364 certificate_status = 22, | 430 certificate_status = 22, |
| 365 - next_proto = 67 | 431 - next_proto = 67 |
| 366 + next_proto = 67, | 432 + next_proto = 67, |
| 367 + encrypted_extensions= 203 | 433 + encrypted_extensions= 203 |
| 368 } SSL3HandshakeType; | 434 } SSL3HandshakeType; |
| 369 | 435 |
| 370 typedef struct { | 436 typedef struct { |
| 371 diff -pu a/nss/lib/ssl/sslauth.c b/nss/lib/ssl/sslauth.c | 437 diff -pu a/nss/lib/ssl/sslauth.c b/nss/lib/ssl/sslauth.c |
| 372 --- a/nss/lib/ssl/sslauth.c» 2013-07-31 12:40:14.503586299 -0700 | 438 --- a/nss/lib/ssl/sslauth.c» 2014-01-03 19:31:09.783859095 -0800 |
| 373 +++ b/nss/lib/ssl/sslauth.c» 2013-07-31 12:45:50.338515793 -0700 | 439 +++ b/nss/lib/ssl/sslauth.c» 2014-01-03 19:36:25.379018825 -0800 |
| 374 @@ -219,6 +219,24 @@ SSL_GetClientAuthDataHook(PRFileDesc *s, | 440 @@ -216,6 +216,24 @@ SSL_GetClientAuthDataHook(PRFileDesc *s, |
| 375 return SECSuccess; | 441 return SECSuccess; |
| 376 } | 442 } |
| 377 | 443 |
| 378 +SECStatus | 444 +SECStatus |
| 379 +SSL_SetClientChannelIDCallback(PRFileDesc *fd, | 445 +SSL_SetClientChannelIDCallback(PRFileDesc *fd, |
| 380 + SSLClientChannelIDCallback callback, | 446 + SSLClientChannelIDCallback callback, |
| 381 + void *arg) { | 447 + void *arg) { |
| 382 + sslSocket *ss = ssl_FindSocket(fd); | 448 + sslSocket *ss = ssl_FindSocket(fd); |
| 383 + | 449 + |
| 384 + if (!ss) { | 450 + if (!ss) { |
| 385 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetClientChannelIDCallback", | 451 + SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetClientChannelIDCallback", |
| 386 + SSL_GETPID(), fd)); | 452 + SSL_GETPID(), fd)); |
| 387 + return SECFailure; | 453 + return SECFailure; |
| 388 + } | 454 + } |
| 389 + | 455 + |
| 390 + ss->getChannelID = callback; | 456 + ss->getChannelID = callback; |
| 391 + ss->getChannelIDArg = arg; | 457 + ss->getChannelIDArg = arg; |
| 392 + | 458 + |
| 393 + return SECSuccess; | 459 + return SECSuccess; |
| 394 +} | 460 +} |
| 395 + | 461 + |
| 396 #ifdef NSS_PLATFORM_CLIENT_AUTH | 462 #ifdef NSS_PLATFORM_CLIENT_AUTH |
| 397 /* NEED LOCKS IN HERE. */ | 463 /* NEED LOCKS IN HERE. */ |
| 398 SECStatus | 464 SECStatus |
| 399 diff -pu a/nss/lib/ssl/sslerr.h b/nss/lib/ssl/sslerr.h | 465 diff -pu a/nss/lib/ssl/sslerr.h b/nss/lib/ssl/sslerr.h |
| 400 --- a/nss/lib/ssl/sslerr.h» 2013-07-31 12:07:10.974699609 -0700 | 466 --- a/nss/lib/ssl/sslerr.h» 2014-01-03 19:28:03.550814608 -0800 |
| 401 +++ b/nss/lib/ssl/sslerr.h» 2013-07-31 12:45:50.338515793 -0700 | 467 +++ b/nss/lib/ssl/sslerr.h» 2014-01-03 19:36:25.379018825 -0800 |
| 402 @@ -193,6 +193,10 @@ SSL_ERROR_UNSUPPORTED_HASH_ALGORITHM = ( | 468 @@ -193,6 +193,10 @@ SSL_ERROR_UNSUPPORTED_HASH_ALGORITHM = ( |
| 403 SSL_ERROR_DIGEST_FAILURE = (SSL_ERROR_BASE + 127), | 469 SSL_ERROR_DIGEST_FAILURE = (SSL_ERROR_BASE + 127), |
| 404 SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM = (SSL_ERROR_BASE + 128), | 470 SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM = (SSL_ERROR_BASE + 128), |
| 405 | 471 |
| 406 +SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 129), | 472 +SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 129), |
| 407 +SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 130), | 473 +SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 130), |
| 408 +SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 131), | 474 +SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 131), |
| 409 + | 475 + |
| 410 SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */ | 476 SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */ |
| 411 } SSLErrorCodes; | 477 } SSLErrorCodes; |
| 412 #endif /* NO_SECURITY_ERROR_ENUM */ | 478 #endif /* NO_SECURITY_ERROR_ENUM */ |
| 413 diff -pu a/nss/lib/ssl/SSLerrs.h b/nss/lib/ssl/SSLerrs.h | 479 diff -pu a/nss/lib/ssl/SSLerrs.h b/nss/lib/ssl/SSLerrs.h |
| 414 --- a/nss/lib/ssl/SSLerrs.h» 2013-07-31 12:07:10.964699464 -0700 | 480 --- a/nss/lib/ssl/SSLerrs.h» 2014-01-03 19:28:03.540814444 -0800 |
| 415 +++ b/nss/lib/ssl/SSLerrs.h» 2013-07-31 12:45:50.338515793 -0700 | 481 +++ b/nss/lib/ssl/SSLerrs.h» 2014-01-03 19:36:25.379018825 -0800 |
| 416 @@ -412,3 +412,12 @@ ER3(SSL_ERROR_DIGEST_FAILURE, (SSL_ERROR | 482 @@ -412,3 +412,12 @@ ER3(SSL_ERROR_DIGEST_FAILURE, (SSL_ERROR |
| 417 | 483 |
| 418 ER3(SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM, (SSL_ERROR_BASE + 128), | 484 ER3(SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM, (SSL_ERROR_BASE + 128), |
| 419 "Incorrect signature algorithm specified in a digitally-signed element.") | 485 "Incorrect signature algorithm specified in a digitally-signed element.") |
| 420 + | 486 + |
| 421 +ER3(SSL_ERROR_BAD_CHANNEL_ID_DATA, (SSL_ERROR_BASE + 129), | 487 +ER3(SSL_ERROR_BAD_CHANNEL_ID_DATA, (SSL_ERROR_BASE + 129), |
| 422 +"SSL received a malformed TLS Channel ID extension.") | 488 +"SSL received a malformed TLS Channel ID extension.") |
| 423 + | 489 + |
| 424 +ER3(SSL_ERROR_INVALID_CHANNEL_ID_KEY, (SSL_ERROR_BASE + 130), | 490 +ER3(SSL_ERROR_INVALID_CHANNEL_ID_KEY, (SSL_ERROR_BASE + 130), |
| 425 +"The application provided an invalid TLS Channel ID key.") | 491 +"The application provided an invalid TLS Channel ID key.") |
| 426 + | 492 + |
| 427 +ER3(SSL_ERROR_GET_CHANNEL_ID_FAILED, (SSL_ERROR_BASE + 131), | 493 +ER3(SSL_ERROR_GET_CHANNEL_ID_FAILED, (SSL_ERROR_BASE + 131), |
| 428 +"The application could not get a TLS Channel ID.") | 494 +"The application could not get a TLS Channel ID.") |
| 429 diff -pu a/nss/lib/ssl/ssl.h b/nss/lib/ssl/ssl.h | 495 diff -pu a/nss/lib/ssl/ssl.h b/nss/lib/ssl/ssl.h |
| 430 --- a/nss/lib/ssl/ssl.h»2013-07-31 12:45:11.497944276 -0700 | 496 --- a/nss/lib/ssl/ssl.h»2014-01-03 19:36:09.938766379 -0800 |
| 431 +++ b/nss/lib/ssl/ssl.h»2013-07-31 12:45:50.338515793 -0700 | 497 +++ b/nss/lib/ssl/ssl.h»2014-01-03 19:36:25.379018825 -0800 |
| 432 @@ -958,6 +958,34 @@ SSL_IMPORT SECStatus SSL_HandshakeNegoti | 498 @@ -985,6 +985,34 @@ SSL_IMPORT SECStatus SSL_HandshakeNegoti |
| 433 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd, | 499 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd, |
| 434 PRBool *last_handshake_resumed
); | 500 PRBool *last_handshake_resumed
); |
| 435 | 501 |
| 436 +/* See SSL_SetClientChannelIDCallback for usage. If the callback returns | 502 +/* See SSL_SetClientChannelIDCallback for usage. If the callback returns |
| 437 + * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in | 503 + * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in |
| 438 + * the future to restart the handshake. On SECSuccess, the callback must have | 504 + * the future to restart the handshake. On SECSuccess, the callback must have |
| 439 + * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */ | 505 + * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */ |
| 440 +typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)( | 506 +typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)( |
| 441 + void *arg, | 507 + void *arg, |
| 442 + PRFileDesc *fd, | 508 + PRFileDesc *fd, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 458 + * extension to be advertised. */ | 524 + * extension to be advertised. */ |
| 459 +SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback( | 525 +SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback( |
| 460 + PRFileDesc *fd, | 526 + PRFileDesc *fd, |
| 461 + SSLClientChannelIDCallback callback, | 527 + SSLClientChannelIDCallback callback, |
| 462 + void *arg); | 528 + void *arg); |
| 463 + | 529 + |
| 464 /* | 530 /* |
| 465 ** How long should we wait before retransmitting the next flight of | 531 ** How long should we wait before retransmitting the next flight of |
| 466 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a | 532 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a |
| 467 diff -pu a/nss/lib/ssl/sslimpl.h b/nss/lib/ssl/sslimpl.h | 533 diff -pu a/nss/lib/ssl/sslimpl.h b/nss/lib/ssl/sslimpl.h |
| 468 --- a/nss/lib/ssl/sslimpl.h» 2013-07-31 12:45:11.497944276 -0700 | 534 --- a/nss/lib/ssl/sslimpl.h» 2014-01-03 19:36:09.938766379 -0800 |
| 469 +++ b/nss/lib/ssl/sslimpl.h» 2013-07-31 12:45:50.338515793 -0700 | 535 +++ b/nss/lib/ssl/sslimpl.h» 2014-01-03 19:36:25.379018825 -0800 |
| 470 @@ -921,6 +921,9 @@ struct ssl3StateStr { | 536 @@ -700,6 +700,14 @@ struct sslSessionIDStr { |
| 537 |
| 538 » SECItem srvName; |
| 539 |
| 540 + /* originalHandshakeHash contains the hash of the original, full |
| 541 + * handshake prior to the server's final flow. This is either a |
| 542 + * SHA-1/MD5 combination (for TLS < 1.2) or the TLS PRF hash (for |
| 543 + * TLS 1.2). This is recorded and used only when ChannelID is |
| 544 + * negotiated as it's used to bind the ChannelID signature on the |
| 545 + * resumption handshake to the original handshake. */ |
| 546 +» SECItem originalHandshakeHash; |
| 547 + |
| 548 » /* This lock is lazily initialized by CacheSID when a sid is first |
| 549 » * cached. Before then, there is no need to lock anything because |
| 550 » * the sid isn't being shared by anything. |
| 551 @@ -969,6 +977,9 @@ struct ssl3StateStr { |
| 471 CERTCertificateList *clientCertChain; /* used by client */ | 552 CERTCertificateList *clientCertChain; /* used by client */ |
| 472 PRBool sendEmptyCert; /* used by client */ | 553 PRBool sendEmptyCert; /* used by client */ |
| 473 | 554 |
| 474 + SECKEYPrivateKey *channelID; /* used by client */ | 555 + SECKEYPrivateKey *channelID; /* used by client */ |
| 475 + SECKEYPublicKey *channelIDPub; /* used by client */ | 556 + SECKEYPublicKey *channelIDPub; /* used by client */ |
| 476 + | 557 + |
| 477 int policy; | 558 int policy; |
| 478 /* This says what cipher suites we can do, and should | 559 /* This says what cipher suites we can do, and should |
| 479 * be either SSL_ALLOWED or SSL_RESTRICTED | 560 * be either SSL_ALLOWED or SSL_RESTRICTED |
| 480 @@ -1192,6 +1195,8 @@ const unsigned char * preferredCipher; | 561 @@ -1246,6 +1257,8 @@ const unsigned char * preferredCipher; |
| 481 void *pkcs11PinArg; | 562 void *pkcs11PinArg; |
| 482 SSLNextProtoCallback nextProtoCallback; | 563 SSLNextProtoCallback nextProtoCallback; |
| 483 void *nextProtoArg; | 564 void *nextProtoArg; |
| 484 + SSLClientChannelIDCallback getChannelID; | 565 + SSLClientChannelIDCallback getChannelID; |
| 485 + void *getChannelIDArg; | 566 + void *getChannelIDArg; |
| 486 | 567 |
| 487 PRIntervalTime rTimeout; /* timeout for NSPR I/O */ | 568 PRIntervalTime rTimeout; /* timeout for NSPR I/O */ |
| 488 PRIntervalTime wTimeout; /* timeout for NSPR I/O */ | 569 PRIntervalTime wTimeout; /* timeout for NSPR I/O */ |
| 489 @@ -1524,6 +1529,11 @@ extern SECStatus ssl3_RestartHandshakeAf | 570 @@ -1590,6 +1603,11 @@ extern SECStatus ssl3_RestartHandshakeAf |
| 490 SECKEYPrivateKey * key, | 571 SECKEYPrivateKey * key, |
| 491 CERTCertificateList *certChain); | 572 CERTCertificateList *certChain); |
| 492 | 573 |
| 493 +extern SECStatus ssl3_RestartHandshakeAfterChannelIDReq( | 574 +extern SECStatus ssl3_RestartHandshakeAfterChannelIDReq( |
| 494 + sslSocket *ss, | 575 + sslSocket *ss, |
| 495 + SECKEYPublicKey *channelIDPub, | 576 + SECKEYPublicKey *channelIDPub, |
| 496 + SECKEYPrivateKey *channelID); | 577 + SECKEYPrivateKey *channelID); |
| 497 + | 578 + |
| 498 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error)
; | 579 extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error)
; |
| 499 | 580 |
| 500 /* | 581 /* |
| 582 diff -pu a/nss/lib/ssl/sslnonce.c b/nss/lib/ssl/sslnonce.c |
| 583 --- a/nss/lib/ssl/sslnonce.c 2014-01-03 19:30:40.073373382 -0800 |
| 584 +++ b/nss/lib/ssl/sslnonce.c 2014-01-03 19:36:25.379018825 -0800 |
| 585 @@ -182,6 +182,9 @@ ssl_DestroySID(sslSessionID *sid) |
| 586 if (sid->u.ssl3.srvName.data) { |
| 587 SECITEM_FreeItem(&sid->u.ssl3.srvName, PR_FALSE); |
| 588 } |
| 589 + if (sid->u.ssl3.originalHandshakeHash.data) { |
| 590 + SECITEM_FreeItem(&sid->u.ssl3.originalHandshakeHash, PR_FALSE); |
| 591 + } |
| 592 |
| 593 if (sid->u.ssl3.lock) { |
| 594 PR_DestroyRWLock(sid->u.ssl3.lock); |
| 501 diff -pu a/nss/lib/ssl/sslsecur.c b/nss/lib/ssl/sslsecur.c | 595 diff -pu a/nss/lib/ssl/sslsecur.c b/nss/lib/ssl/sslsecur.c |
| 502 --- a/nss/lib/ssl/sslsecur.c» 2013-07-31 12:45:11.497944276 -0700 | 596 --- a/nss/lib/ssl/sslsecur.c» 2014-01-03 19:36:09.938766379 -0800 |
| 503 +++ b/nss/lib/ssl/sslsecur.c» 2013-07-31 12:45:50.338515793 -0700 | 597 +++ b/nss/lib/ssl/sslsecur.c» 2014-01-03 19:36:25.379018825 -0800 |
| 504 @@ -1502,6 +1502,42 @@ SSL_RestartHandshakeAfterCertReq(PRFileD | 598 @@ -1584,6 +1584,42 @@ SSL_RestartHandshakeAfterCertReq(PRFileD |
| 505 return ret; | 599 return ret; |
| 506 } | 600 } |
| 507 | 601 |
| 508 +SECStatus | 602 +SECStatus |
| 509 +SSL_RestartHandshakeAfterChannelIDReq(PRFileDesc * fd, | 603 +SSL_RestartHandshakeAfterChannelIDReq(PRFileDesc * fd, |
| 510 + SECKEYPublicKey * channelIDPub, | 604 + SECKEYPublicKey * channelIDPub, |
| 511 + SECKEYPrivateKey *channelID) | 605 + SECKEYPrivateKey *channelID) |
| 512 +{ | 606 +{ |
| 513 + sslSocket * ss = ssl_FindSocket(fd); | 607 + sslSocket * ss = ssl_FindSocket(fd); |
| 514 + SECStatus ret; | 608 + SECStatus ret; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 538 +loser: | 632 +loser: |
| 539 + SECKEY_DestroyPublicKey(channelIDPub); | 633 + SECKEY_DestroyPublicKey(channelIDPub); |
| 540 + SECKEY_DestroyPrivateKey(channelID); | 634 + SECKEY_DestroyPrivateKey(channelID); |
| 541 + return SECFailure; | 635 + return SECFailure; |
| 542 +} | 636 +} |
| 543 + | 637 + |
| 544 /* DO NOT USE. This function was exported in ssl.def with the wrong signature; | 638 /* DO NOT USE. This function was exported in ssl.def with the wrong signature; |
| 545 * this implementation exists to maintain link-time compatibility. | 639 * this implementation exists to maintain link-time compatibility. |
| 546 */ | 640 */ |
| 547 diff -pu a/nss/lib/ssl/sslsock.c b/nss/lib/ssl/sslsock.c | 641 diff -pu a/nss/lib/ssl/sslsock.c b/nss/lib/ssl/sslsock.c |
| 548 --- a/nss/lib/ssl/sslsock.c» 2013-07-31 12:44:32.017363288 -0700 | 642 --- a/nss/lib/ssl/sslsock.c» 2014-01-03 19:32:06.914793097 -0800 |
| 549 +++ b/nss/lib/ssl/sslsock.c» 2013-07-31 12:45:50.348515937 -0700 | 643 +++ b/nss/lib/ssl/sslsock.c» 2014-01-03 19:36:25.379018825 -0800 |
| 550 @@ -354,6 +354,8 @@ ssl_DupSocket(sslSocket *os) | 644 @@ -274,6 +274,8 @@ ssl_DupSocket(sslSocket *os) |
| 551 » ss->handshakeCallback = os->handshakeCallback; | 645 » ss->canFalseStartCallback = os->canFalseStartCallback; |
| 552 » ss->handshakeCallbackData = os->handshakeCallbackData; | 646 » ss->canFalseStartCallbackData = os->canFalseStartCallbackData; |
| 553 ss->pkcs11PinArg = os->pkcs11PinArg; | 647 ss->pkcs11PinArg = os->pkcs11PinArg; |
| 554 + ss->getChannelID = os->getChannelID; | 648 + ss->getChannelID = os->getChannelID; |
| 555 + ss->getChannelIDArg = os->getChannelIDArg; | 649 + ss->getChannelIDArg = os->getChannelIDArg; |
| 556 | 650 |
| 557 /* Create security data */ | 651 /* Create security data */ |
| 558 rv = ssl_CopySecurityInfo(ss, os); | 652 rv = ssl_CopySecurityInfo(ss, os); |
| 559 @@ -1754,6 +1756,10 @@ SSL_ReconfigFD(PRFileDesc *model, PRFile | 653 @@ -1669,6 +1671,10 @@ SSL_ReconfigFD(PRFileDesc *model, PRFile |
| 560 ss->handshakeCallbackData = sm->handshakeCallbackData; | 654 ss->handshakeCallbackData = sm->handshakeCallbackData; |
| 561 if (sm->pkcs11PinArg) | 655 if (sm->pkcs11PinArg) |
| 562 ss->pkcs11PinArg = sm->pkcs11PinArg; | 656 ss->pkcs11PinArg = sm->pkcs11PinArg; |
| 563 + if (sm->getChannelID) | 657 + if (sm->getChannelID) |
| 564 + ss->getChannelID = sm->getChannelID; | 658 + ss->getChannelID = sm->getChannelID; |
| 565 + if (sm->getChannelIDArg) | 659 + if (sm->getChannelIDArg) |
| 566 + ss->getChannelIDArg = sm->getChannelIDArg; | 660 + ss->getChannelIDArg = sm->getChannelIDArg; |
| 567 return fd; | 661 return fd; |
| 568 loser: | 662 loser: |
| 569 return NULL; | 663 return NULL; |
| 570 @@ -3027,6 +3033,8 @@ ssl_NewSocket(PRBool makeLocks, SSLProto | 664 @@ -2946,6 +2952,8 @@ ssl_NewSocket(PRBool makeLocks, SSLProto |
| 571 ss->badCertArg = NULL; | 665 ss->badCertArg = NULL; |
| 572 ss->pkcs11PinArg = NULL; | 666 ss->pkcs11PinArg = NULL; |
| 573 ss->ephemeralECDHKeyPair = NULL; | 667 ss->ephemeralECDHKeyPair = NULL; |
| 574 + ss->getChannelID = NULL; | 668 + ss->getChannelID = NULL; |
| 575 + ss->getChannelIDArg = NULL; | 669 + ss->getChannelIDArg = NULL; |
| 576 | 670 |
| 577 ssl_ChooseOps(ss); | 671 ssl_ChooseOps(ss); |
| 578 ssl2_InitSocketPolicy(ss); | 672 ssl2_InitSocketPolicy(ss); |
| 579 diff -pu a/nss/lib/ssl/sslt.h b/nss/lib/ssl/sslt.h | 673 diff -pu a/nss/lib/ssl/sslt.h b/nss/lib/ssl/sslt.h |
| 580 --- a/nss/lib/ssl/sslt.h» 2013-07-31 12:07:10.974699609 -0700 | 674 --- a/nss/lib/ssl/sslt.h» 2014-01-03 19:28:03.560814773 -0800 |
| 581 +++ b/nss/lib/ssl/sslt.h» 2013-07-31 12:45:50.348515937 -0700 | 675 +++ b/nss/lib/ssl/sslt.h» 2014-01-03 19:36:25.379018825 -0800 |
| 582 @@ -184,9 +184,10 @@ typedef enum { | 676 @@ -189,9 +189,10 @@ typedef enum { |
| 583 ssl_use_srtp_xtn = 14, | 677 ssl_use_srtp_xtn = 14, |
| 584 ssl_session_ticket_xtn = 35, | 678 ssl_session_ticket_xtn = 35, |
| 585 ssl_next_proto_nego_xtn = 13172, | 679 ssl_next_proto_nego_xtn = 13172, |
| 586 + ssl_channel_id_xtn = 30031, | 680 + ssl_channel_id_xtn = 30032, |
| 587 ssl_renegotiation_info_xtn = 0xff01 /* experimental number */ | 681 ssl_renegotiation_info_xtn = 0xff01 /* experimental number */ |
| 588 } SSLExtensionType; | 682 } SSLExtensionType; |
| 589 | 683 |
| 590 -#define SSL_MAX_EXTENSIONS 9 | 684 -#define SSL_MAX_EXTENSIONS 9 |
| 591 +#define SSL_MAX_EXTENSIONS 10 | 685 +#define SSL_MAX_EXTENSIONS 10 |
| 592 | 686 |
| 593 #endif /* __sslt_h_ */ | 687 #endif /* __sslt_h_ */ |
| OLD | NEW |