rust/bssl-tls: Expose an option to disable ticket resumption

This would allow servers to save memory when ticket resumption is not
used, by skipping the session cache.

Signed-off-by: Xiangfei Ding <xfding@google.com>
Change-Id: Id08c3ae8be56ddc4860fe5416a348f706a6a6964
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/106668
Reviewed-by: Adam Langley <agl@google.com>
Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/rust/bssl-tls/src/context.rs b/rust/bssl-tls/src/context.rs
index 3ad0851..70f0ae6 100644
--- a/rust/bssl-tls/src/context.rs
+++ b/rust/bssl-tls/src/context.rs
@@ -465,6 +465,20 @@
         }
         self
     }
+
+    /// Switch off session ticket support.
+    ///
+    /// Session resumption through tickets support per [RFC 5077] is enable by default. Server with
+    /// memory restricts could disable this feature.
+    ///
+    /// [RFC 5077]: <https://datatracker.ietf.org/doc/html/rfc5077>
+    pub fn without_ticket_support(&mut self) -> &mut Self {
+        unsafe {
+            // Safety: the validity of the handle `self.ptr` is witnessed by `self`.
+            bssl_sys::SSL_CTX_set_options(self.ptr(), bssl_sys::SSL_OP_NO_TICKET as u32);
+        }
+        self
+    }
 }
 
 #[cfg(feature = "std")]