(cipher: *const sys::SSL_CIPHER)
| 3966 | } |
| 3967 | |
| 3968 | fn cipher_description(cipher: *const sys::SSL_CIPHER) -> String { |
| 3969 | unsafe { |
| 3970 | // SSL_CIPHER_description writes up to 128 bytes |
| 3971 | let mut buf = vec![0u8; 256]; |
| 3972 | let result = sys::SSL_CIPHER_description( |
| 3973 | cipher, |
| 3974 | buf.as_mut_ptr() as *mut libc::c_char, |
| 3975 | buf.len() as i32, |
| 3976 | ); |
| 3977 | if result.is_null() { |
| 3978 | return String::from("No description available"); |
| 3979 | } |
| 3980 | // Find the null terminator |
| 3981 | let len = buf.iter().position(|&c| c == 0).unwrap_or(buf.len()); |
| 3982 | String::from_utf8_lossy(&buf[..len]).trim().to_string() |
| 3983 | } |
| 3984 | } |
| 3985 | |
| 3986 | impl Read for SocketStream { |
| 3987 | fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { |
no test coverage detected