Skip to content

Commit

Permalink
Bug 867795: Fix bugs in the code in ssl3_HandleHandshakeMessage that
Browse files Browse the repository at this point in the history
handles a certificate_status message. Fix indentation. r=bsmith,sleevi.
  • Loading branch information
wantehchang committed May 3, 2013
1 parent ac7c1d6 commit d2fc8a1
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions lib/ssl/ssl3con.c
Expand Up @@ -9538,21 +9538,32 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, SSL3Opaque *b, PRUint32 length)
* get one when it is allowed, but otherwise we just carry on.
*/
if (ss->ssl3.hs.ws == wait_certificate_status) {
/* We must process any CertificateStatus message before we call
* ssl3_AuthCertificate, as ssl3_AuthCertificate needs any stapled OCSP
* response we get.
*/
if (ss->ssl3.hs.msg_type == certificate_status) {
rv = ssl3_HandleCertificateStatus(ss, b, length);
if (rv != SECSuccess)
return rv;
}
/* We must process any CertificateStatus message before we call
* ssl3_AuthCertificate, as ssl3_AuthCertificate needs any stapled
* OCSP response we get.
*/
if (ss->ssl3.hs.msg_type == certificate_status) {
rv = ssl3_HandleCertificateStatus(ss, b, length);
if (rv != SECSuccess)
return rv;
if (IS_DTLS(ss)) {
/* Increment the expected sequence number */
ss->ssl3.hs.recvMessageSeq++;
}
}

/* Regardless of whether we got a CertificateStatus message, we must
* authenticate the cert before we handle any more handshake messages.
*/
rv = ssl3_AuthCertificate(ss); /* sets ss->ssl3.hs.ws */
} else switch (ss->ssl3.hs.msg_type) {
/* Regardless of whether we got a CertificateStatus message, we must
* authenticate the cert before we handle any more handshake messages.
*/
rv = ssl3_AuthCertificate(ss); /* sets ss->ssl3.hs.ws */

if (rv != SECSuccess || ss->ssl3.hs.msg_type == certificate_status) {
PORT_Assert(rv == SECFailure); /* Not SECWouldBlock */
return rv;
}
}

switch (ss->ssl3.hs.msg_type) {
case hello_request:
if (length != 0) {
(void)ssl3_DecodeError(ss);
Expand Down Expand Up @@ -9594,10 +9605,10 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, SSL3Opaque *b, PRUint32 length)
rv = ssl3_HandleCertificate(ss, b, length);
break;
case certificate_status:
/* The good case is handled above */
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CERT_STATUS);
rv = SECFailure;
break;
/* The good case is handled above */
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CERT_STATUS);
return SECFailure;
case server_key_exchange:
if (ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
Expand Down

0 comments on commit d2fc8a1

Please sign in to comment.