From 1879e9cff0549b9474de71ee08d509a91539814e Mon Sep 17 00:00:00 2001 From: Rushil Mehra Date: Tue, 18 Jun 2024 00:10:22 -0700 Subject: [PATCH] Expose SSL_CIPHER_is_aead and SSL_CIPHER_auth_nid --- boring/src/ssl/mod.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/boring/src/ssl/mod.rs b/boring/src/ssl/mod.rs index 06532517..f05108fb 100644 --- a/boring/src/ssl/mod.rs +++ b/boring/src/ssl/mod.rs @@ -2391,6 +2391,29 @@ impl SslCipherRef { } } + /// Returns one if the cipher uses an AEAD cipher. + /// + /// This corresponds to [`SSL_CIPHER_is_aead`]. + /// + /// [`SSL_CIPHER_is_aead`]: https://www.openssl.org/docs/manmaster/man3/SSL_CIPHER_is_aead.html + pub fn cipher_is_aead(&self) -> bool { + unsafe { ffi::SSL_CIPHER_is_aead(self.as_ptr()) != 0 } + } + + /// Returns the NID corresponding to the cipher's authentication type. + /// + /// This corresponds to [`SSL_CIPHER_get_auth_nid`]. + /// + /// [`SSL_CIPHER_get_auth_nid`]: https://www.openssl.org/docs/manmaster/man3/SSL_CIPHER_get_auth_nid.html + pub fn cipher_auth_nid(&self) -> Option { + let n = unsafe { ffi::SSL_CIPHER_get_auth_nid(self.as_ptr()) }; + if n == 0 { + None + } else { + Some(Nid::from_raw(n)) + } + } + /// Returns the NID corresponding to the cipher. /// /// This corresponds to [`SSL_CIPHER_get_cipher_nid`].