Commit c1b7cd24 authored by Jonas Schievink's avatar Jonas Schievink
Browse files

Make the callback take a `&mut [c_char]`

parent c399c247
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
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::prelude::*;
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
    /// placed into the buffer.
    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);

+2 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ use std::fmt;
use ssl::error::{SslError, StreamError};
use std::ptr;
use std::io::{self, Read, Write};
use libc::{c_int, c_void};
use libc::{c_int, c_void, c_char};

use bn::BigNum;
use bio::MemBio;
@@ -79,7 +79,7 @@ impl RSA {

    /// 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>
        where R: Read, F: FnMut(&mut [i8]) -> usize
        where R: Read, F: FnMut(&mut [c_char]) -> usize
    {
        let mut cb = CallbackState::new(pass_cb);