diff options
| author | Steven Fackler <[email protected]> | 2016-10-26 22:13:10 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-10-26 22:13:10 -0700 |
| commit | 63b1ec1a12847c3361a11e33f4836b16c4b87cde (patch) | |
| tree | da0f3f7e848afb520d4978063f330da141ef8f88 /openssl/src | |
| parent | Merge pull request #494 from sfackler/crypto-string (diff) | |
| download | rust-openssl-63b1ec1a12847c3361a11e33f4836b16c4b87cde.tar.xz rust-openssl-63b1ec1a12847c3361a11e33f4836b16c4b87cde.zip | |
Stop returning an Option from cipher description
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/ssl/mod.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index b6f24529..f2224b1e 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -784,17 +784,12 @@ impl SslCipherRef { } /// Returns a textual description of the cipher used - pub fn description(&self) -> Option<String> { + pub fn description(&self) -> String { unsafe { // SSL_CIPHER_description requires a buffer of at least 128 bytes. let mut buf = [0; 128]; - let desc_ptr = ffi::SSL_CIPHER_description(self.as_ptr(), buf.as_mut_ptr(), 128); - - if !desc_ptr.is_null() { - String::from_utf8(CStr::from_ptr(desc_ptr as *const _).to_bytes().to_vec()).ok() - } else { - None - } + ffi::SSL_CIPHER_description(self.as_ptr(), buf.as_mut_ptr(), 128); + String::from_utf8(CStr::from_ptr(buf.as_ptr() as *const _).to_bytes().to_vec()).unwrap() } } } |