Make the callback take a `&mut [c_char]`
This commit is contained in:
parent
c399c2475d
commit
c1b7cd2420
|
|
@ -1,4 +1,4 @@
|
||||||
use libc::{c_int, c_uint, c_ulong, c_void};
|
use libc::{c_int, c_uint, c_ulong, c_void, c_char};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
|
|
@ -100,7 +100,7 @@ impl PKey {
|
||||||
/// The callback will be passed the password buffer and should return the number of characters
|
/// The callback will be passed the password buffer and should return the number of characters
|
||||||
/// placed into the buffer.
|
/// placed into the buffer.
|
||||||
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<PKey, SslError>
|
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<PKey, SslError>
|
||||||
where R: Read, F: FnMut(&mut [i8]) -> usize
|
where R: Read, F: FnMut(&mut [c_char]) -> usize
|
||||||
{
|
{
|
||||||
let mut cb = CallbackState::new(pass_cb);
|
let mut cb = CallbackState::new(pass_cb);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::fmt;
|
||||||
use ssl::error::{SslError, StreamError};
|
use ssl::error::{SslError, StreamError};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use libc::{c_int, c_void};
|
use libc::{c_int, c_void, c_char};
|
||||||
|
|
||||||
use bn::BigNum;
|
use bn::BigNum;
|
||||||
use bio::MemBio;
|
use bio::MemBio;
|
||||||
|
|
@ -79,7 +79,7 @@ impl RSA {
|
||||||
|
|
||||||
/// Reads an RSA private key from PEM formatted data and supplies a password callback.
|
/// Reads an RSA private key from PEM formatted data and supplies a password callback.
|
||||||
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<RSA, SslError>
|
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<RSA, SslError>
|
||||||
where R: Read, F: FnMut(&mut [i8]) -> usize
|
where R: Read, F: FnMut(&mut [c_char]) -> usize
|
||||||
{
|
{
|
||||||
let mut cb = CallbackState::new(pass_cb);
|
let mut cb = CallbackState::new(pass_cb);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue