rust: bssl-tls: Add more RPK related configurations Signed-off-by: Xiangfei Ding <xfding@google.com> Change-Id: I71d2f6925873f7cbdb65ae3c2528ae3c6a6a6964 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/97947 Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Adam Langley <agl@google.com> Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/rust/bssl-tls/src/connection/credentials.rs b/rust/bssl-tls/src/connection/credentials.rs index c492f3e..8cce65e 100644 --- a/rust/bssl-tls/src/connection/credentials.rs +++ b/rust/bssl-tls/src/connection/credentials.rs
@@ -344,6 +344,24 @@ } } +/// # Raw Public Key +impl<R, M> TlsConnectionInHandshake<'_, R, M> { + /// Set acceptable peer certificate types + pub fn set_accepted_peer_cert_types( + &mut self, + types: &[CertificateType], + ) -> Result<&mut Self, Error> { + let (types, types_len) = slice_into_ffi_raw_parts(types); + check_lib_error!(unsafe { + // Safety: + // - `self.ptr()` is a valid handle. + // - `CertificateType` is a `u8` with acceptable values by construction. + bssl_sys::SSL_set1_accepted_peer_cert_types(self.ptr(), types as *const _, types_len) + }); + Ok(self) + } +} + impl<'a, R, M> EstablishedTlsConnection<'a, R, M> { /// Export keying material from this connection into a buffer of a chosen length, /// as per [RFC 5705].