Index: net/third_party/nss/ssl/ssl3con.c |
diff --git a/net/third_party/nss/ssl/ssl3con.c b/net/third_party/nss/ssl/ssl3con.c |
index ff93bf4f4d4def4433ac61b8598eca5c8c7dea81..f90838259c35acdfc0563fd2e0dcf02181d144b3 100644 |
--- a/net/third_party/nss/ssl/ssl3con.c |
+++ b/net/third_party/nss/ssl/ssl3con.c |
@@ -85,6 +85,7 @@ static SECStatus ssl3_InitState( sslSocket *ss); |
static SECStatus ssl3_SendCertificate( sslSocket *ss); |
static SECStatus ssl3_SendEmptyCertificate( sslSocket *ss); |
static SECStatus ssl3_SendCertificateRequest(sslSocket *ss); |
+static SECStatus ssl3_SendNextProto( sslSocket *ss); |
static SECStatus ssl3_SendFinished( sslSocket *ss, PRInt32 flags); |
static SECStatus ssl3_SendServerHello( sslSocket *ss); |
static SECStatus ssl3_SendServerHelloDone( sslSocket *ss); |
@@ -5619,6 +5620,12 @@ ssl3_HandleServerHelloDone(sslSocket *ss) |
if (rv != SECSuccess) { |
goto loser; /* err code was set. */ |
} |
+ |
+ rv = ssl3_SendNextProto(ss); |
+ if (rv != SECSuccess) { |
+ goto loser; /* err code was set. */ |
+ } |
+ |
rv = ssl3_SendFinished(ss, 0); |
if (rv != SECSuccess) { |
goto loser; /* err code was set. */ |
@@ -7797,6 +7804,40 @@ ssl3_ComputeTLSFinished(ssl3CipherSpec *spec, |
} |
/* called from ssl3_HandleServerHelloDone |
+ */ |
+static SECStatus |
+ssl3_SendNextProto(sslSocket *ss) |
+{ |
+ SECStatus rv; |
+ int padding_len; |
+ static const unsigned char padding[32] = {0}; |
+ |
+ if (ss->ssl3.nextProtoState == SSL_NEXT_PROTO_NO_SUPPORT) |
+ return SECSuccess; |
+ |
+ PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss)); |
+ PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); |
+ |
+ padding_len = 32 - ((ss->ssl3.nextProto.len + 2) % 32); |
+ |
+ rv = ssl3_AppendHandshakeHeader(ss, next_proto, ss->ssl3.nextProto.len + |
+ 2 + padding_len); |
+ if (rv != SECSuccess) { |
+ return rv; /* error code set by AppendHandshakeHeader */ |
+ } |
+ rv = ssl3_AppendHandshakeVariable(ss, ss->ssl3.nextProto.data, |
+ ss->ssl3.nextProto.len, 1); |
+ if (rv != SECSuccess) { |
+ return rv; /* error code set by AppendHandshake */ |
+ } |
+ rv = ssl3_AppendHandshakeVariable(ss, padding, padding_len, 1); |
+ if (rv != SECSuccess) { |
+ return rv; /* error code set by AppendHandshake */ |
+ } |
+ return rv; |
+} |
+ |
+/* called from ssl3_HandleServerHelloDone |
* ssl3_HandleClientHello |
* ssl3_HandleFinished |
*/ |
@@ -9072,6 +9113,11 @@ ssl3_DestroySSL3Info(sslSocket *ss) |
ssl3_DestroyCipherSpec(&ss->ssl3.specs[1]); |
ss->ssl3.initialized = PR_FALSE; |
+ |
+ if (ss->ssl3.nextProto.data) { |
+ PORT_Free(ss->ssl3.nextProto.data); |
+ ss->ssl3.nextProto.data = NULL; |
+ } |
} |
/* End of ssl3con.c */ |