if ((ss->ssl3->hs.ws == wait_server_hello) &&
if ((ss->ssl3.hs.ws == wait_server_hello) &&
ssl3_HandleAlert(sslSocket *ss, sslBuffer *buf){    SSL3AlertLevel       level;    SSL3AlertDescription desc;    int                  error;    PORT_Assert( ssl_HaveRecvBufLock(ss) );    PORT_Assert( ssl_HaveSSL3HandshakeLock(ss) );    SSL_TRC(3, ("%d: SSL3[%d]: handle alert record", SSL_GETPID(), ss->fd));    if (buf->len != 2) {	(void)ssl3_DecodeError(ss);	PORT_SetError(SSL_ERROR_RX_MALFORMED_ALERT);	return SECFailure;    }    level = (SSL3AlertLevel)buf->buf[0];    desc  = (SSL3AlertDescription)buf->buf[1];    buf->len = 0;    SSL_TRC(5, ("%d: SSL3[%d] received alert, level = %d, description = %d",        SSL_GETPID(), ss->fd, level, desc));    switch (desc) {    case close_notify:		ss->recvdCloseNotify = 1;		        	error = SSL_ERROR_CLOSE_NOTIFY_ALERT;     break;    case unexpected_message: 	error = SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT;									  break;    case bad_record_mac: 	error = SSL_ERROR_BAD_MAC_ALERT; 	  break;    case decryption_failed: 	error = SSL_ERROR_DECRYPTION_FAILED_ALERT;     									  break;    case record_overflow: 	error = SSL_ERROR_RECORD_OVERFLOW_ALERT;  break;    case decompression_failure: error = SSL_ERROR_DECOMPRESSION_FAILURE_ALERT;									  break;    case handshake_failure: 	error = SSL_ERROR_HANDSHAKE_FAILURE_ALERT;			        					  break;    case no_certificate: 	error = SSL_ERROR_NO_CERTIFICATE;	  break;    case bad_certificate: 	error = SSL_ERROR_BAD_CERT_ALERT; 	  break;    case unsupported_certificate:error = SSL_ERROR_UNSUPPORTED_CERT_ALERT;break;    case certificate_revoked: 	error = SSL_ERROR_REVOKED_CERT_ALERT; 	  break;    case certificate_expired: 	error = SSL_ERROR_EXPIRED_CERT_ALERT; 	  break;    case certificate_unknown: 	error = SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT;			        					  break;    case illegal_parameter: 	error = SSL_ERROR_ILLEGAL_PARAMETER_ALERT;break;    /* All alerts below are TLS only. */    case unknown_ca: 		error = SSL_ERROR_UNKNOWN_CA_ALERT;       break;    case access_denied: 	error = SSL_ERROR_ACCESS_DENIED_ALERT;    break;    case decode_error: 		error = SSL_ERROR_DECODE_ERROR_ALERT;     break;    case decrypt_error: 	error = SSL_ERROR_DECRYPT_ERROR_ALERT;    break;    case export_restriction: 	error = SSL_ERROR_EXPORT_RESTRICTION_ALERT;     									  break;    case protocol_version: 	error = SSL_ERROR_PROTOCOL_VERSION_ALERT; break;    case insufficient_security: error = SSL_ERROR_INSUFFICIENT_SECURITY_ALERT;     									  break;    case internal_error: 	error = SSL_ERROR_INTERNAL_ERROR_ALERT;   break;    case user_canceled: 	error = SSL_ERROR_USER_CANCELED_ALERT;    break;    case no_renegotiation: 	error = SSL_ERROR_NO_RENEGOTIATION_ALERT; break;    default: 			error = SSL_ERROR_RX_UNKNOWN_ALERT; 	  break;    }    if (level == alert_fatal) {	ss->sec.uncache(ss->sec.ci.sid);	if ((ss->ssl3->hs.ws == wait_server_hello) &&	    (desc == handshake_failure)) {	    /* XXX This is a hack.  We're assuming that any handshake failure	     * XXX on the client hello is a failure to match ciphers.	     */	    error = SSL_ERROR_NO_CYPHER_OVERLAP;	}	PORT_SetError(error);	return SECFailure;    }    if ((desc == no_certificate) && (ss->ssl3->hs.ws == wait_client_cert)) {    	/* I'm a server. I've requested a client cert. He hasn't got one. */	SECStatus rv;	PORT_Assert(ss->sec.isServer);	ss->ssl3->hs.ws = wait_client_key;	rv = ssl3_HandleNoCertificate(ss);	return rv;    }    return SECSuccess;}