QUIC: Add handling of SSL_get_shutdown()
[openssl.git] / ssl / quic / quic_impl.c
index 29a283dca0b27707fc91bb9ffce1af047c8e65e4..bdf5d5fea882dea4cce5f73a741b8bf89352c8f1 100644 (file)
@@ -3571,6 +3571,27 @@ const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u)
     return NULL;
 }
 
+/*
+ * SSL_get_shutdown()
+ * ------------------
+ */
+int ossl_quic_get_shutdown(const SSL *s)
+{
+    QCTX ctx;
+    int shut = 0;
+
+    if (!expect_quic_conn_only(s, &ctx))
+        return 0;
+
+    if (ossl_quic_channel_is_term_any(ctx.qc->ch)) {
+        shut |= SSL_SENT_SHUTDOWN;
+        if (!ossl_quic_channel_is_closing(ctx.qc->ch))
+            shut |= SSL_RECEIVED_SHUTDOWN;
+    }
+
+    return shut;
+}
+
 /*
  * Internal Testing APIs
  * =====================