diff mbox series

[13/24] wolfssl: generate events when OCSP status is revoked

Message ID 20240404181630.2431991-13-juliusz@wolfssl.com
State New
Headers show
Series [01/24] wolfssl: simplify tls_get_cipher | expand

Commit Message

Juliusz Sosinowicz April 4, 2024, 6:16 p.m. UTC
Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
---
 src/crypto/tls_wolfssl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/src/crypto/tls_wolfssl.c b/src/crypto/tls_wolfssl.c
index a58e1f7607..4016b6a46b 100644
--- a/src/crypto/tls_wolfssl.c
+++ b/src/crypto/tls_wolfssl.c
@@ -1836,6 +1836,18 @@  static struct wpabuf * wolfssl_handshake(struct tls_connection *conn,
 				   wolfSSL_ERR_error_string(err, msg));
 			conn->failed++;
 		}
+
+		/* Generate extra events */
+		if (err == OCSP_CERT_REVOKED || err == BAD_CERTIFICATE_STATUS_ERROR ||
+				err == OCSP_CERT_REVOKED) {
+			char buf[256];
+			WOLFSSL_X509* err_cert = wolfSSL_get_peer_certificate(conn->ssl);
+			wolfSSL_X509_NAME_oneline(wolfSSL_X509_get_subject_name(err_cert),
+					buf, sizeof(buf));
+			wolfssl_tls_fail_event(conn, err_cert, err, 0, buf,
+						   "bad certificate status response",
+						   TLS_FAIL_UNSPECIFIED);
+		}
 	}
 
 	return conn->output.out_data;