Bug 866362: Revert changeset 60da07951c17 because it caused selfserv
to crash (dereferencing a null ss->ssl3.hs.kea_def) in
ssl3_ServerSendStatusRequestXtn.
--- a/lib/ssl/ssl3con.c
+++ b/lib/ssl/ssl3con.c
@@ -8462,19 +8462,20 @@ ssl3_SendCertificateStatus(sslSocket *ss
/* Use certStatus based on the cert being used. */
if ((ss->ssl3.hs.kea_def->kea == kea_ecdhe_rsa) ||
(ss->ssl3.hs.kea_def->kea == kea_dhe_rsa)) {
certIndex = kt_rsa;
} else {
certIndex = ss->ssl3.hs.kea_def->exchKeyType;
}
-
- statusToSend = ss->certStatusArray[certIndex];
- if (!statusToSend || !statusToSend->len)
+ if (ss->certStatusArray[certIndex] && ss->certStatusArray[certIndex]->len) {
+ statusToSend = ss->certStatusArray[certIndex];
+ }
+ if (!statusToSend)
return SECSuccess;
/* Use the array's first item only (single stapling) */
len = 1 + statusToSend->items[0].len + 3;
rv = ssl3_AppendHandshakeHeader(ss, certificate_status, len);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
--- a/lib/ssl/ssl3ext.c
+++ b/lib/ssl/ssl3ext.c
@@ -677,30 +677,30 @@ static PRInt32
ssl3_ServerSendStatusRequestXtn(
sslSocket * ss,
PRBool append,
PRUint32 maxBytes)
{
PRInt32 extension_length;
SECStatus rv;
int i;
- SECItemArray *statusToSend = NULL;
- SSL3KEAType certIndex;
-
- PORT_Assert(ss->sec.isServer);
+ PRBool haveStatus = PR_FALSE;
- if ((ss->ssl3.hs.kea_def->kea == kea_ecdhe_rsa) ||
- (ss->ssl3.hs.kea_def->kea == kea_dhe_rsa)) {
- certIndex = kt_rsa;
- } else {
- certIndex = ss->ssl3.hs.kea_def->exchKeyType;
+ for (i = kt_null; i < kt_kea_size; i++) {
+ /* TODO: This is a temporary workaround.
+ * The correct code needs to see if we have an OCSP response for
+ * the server certificate being used, rather than if we have any
+ * OCSP response. See also ssl3_SendCertificateStatus.
+ */
+ if (ss->certStatusArray[i] && ss->certStatusArray[i]->len) {
+ haveStatus = PR_TRUE;
+ break;
+ }
}
-
- statusToSend = ss->certStatusArray[certIndex];
- if (!statusToSend || !statusToSend->len)
+ if (!haveStatus)
return 0;
extension_length = 2 + 2;
if (append && maxBytes >= extension_length) {
/* extension_type */
rv = ssl3_AppendHandshakeNumber(ss, ssl_cert_status_xtn, 2);
if (rv != SECSuccess)
return -1;