+ /* If an out-of-band error occurred, handle it here and then terminate
+ the connection as needed. */
+ if (ctx->state == SSL_HdskStateOutOfBandError) {
+ bool shouldClose = true;
+ switch (ctx->outOfBandError) {
+ case errSecCertificateExpired:
+ SSLSendAlert(ctx, tls_handshake_alert_level_fatal, tls_handshake_alert_CertExpired);
+ break;
+ case errSecCertificateRevoked:
+ SSLSendAlert(ctx, tls_handshake_alert_level_fatal, tls_handshake_alert_CertRevoked);
+ break;
+ default:
+ shouldClose = false;
+ break;
+ }
+
+ if (shouldClose) {
+ return SSLClose(ctx);
+ }
+ }
+