Skip to content

Commit

Permalink
Remove set_rsa
Browse files Browse the repository at this point in the history
PKey is reference counted so allowing mutation is unsound
  • Loading branch information
sfackler committed Nov 6, 2016
1 parent 96a5ccf commit 8ad1e55
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions openssl/src/pkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ffi;
use {cvt, cvt_p};
use bio::{MemBio, MemBioSlice};
use dsa::Dsa;
use rsa::{Rsa, RsaRef};
use rsa::Rsa;
use error::ErrorStack;
use util::{CallbackState, invoke_passwd_cb};
use types::{OpenSslType, OpenSslTypeRef};
Expand Down Expand Up @@ -146,16 +146,6 @@ impl PKey {
Ok(PKey::from_ptr(evp))
}
}

/// Assign an RSA key to this pkey.
pub fn set_rsa(&mut self, rsa: &RsaRef) -> Result<(), ErrorStack> {
unsafe {
// this needs to be a reference as the set1_RSA ups the reference count
let rsa_ptr = rsa.as_ptr();
try!(cvt(ffi::EVP_PKEY_set1_RSA(self.0, rsa_ptr)));
Ok(())
}
}
}

#[cfg(test)]
Expand Down

0 comments on commit 8ad1e55

Please sign in to comment.