Switch to the more sane RSA PUBKEY function

For differences, see:
http://openssl.6102.n7.nabble.com/difference-between-i2d-PUBKEY-and-i2d-PublicKey-td43869.html

This will break loading of *public* keys generated before this commit
This commit is contained in:
Mathijs van de Nes 2014-09-12 15:36:00 +02:00
parent 759feedb04
commit 7685a8349c
1 changed files with 4 additions and 4 deletions

View File

@ -18,8 +18,8 @@ extern {
fn EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA; fn EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA;
fn EVP_PKEY_set1_RSA(k: *mut EVP_PKEY, r: *mut RSA) -> c_int; fn EVP_PKEY_set1_RSA(k: *mut EVP_PKEY, r: *mut RSA) -> c_int;
fn i2d_RSAPublicKey(k: *mut RSA, buf: *const *mut u8) -> c_int; fn i2d_RSA_PUBKEY(k: *mut RSA, buf: *const *mut u8) -> c_int;
fn d2i_RSAPublicKey(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA; fn d2i_RSA_PUBKEY(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA;
fn i2d_RSAPrivateKey(k: *mut RSA, buf: *const *mut u8) -> c_int; fn i2d_RSAPrivateKey(k: *mut RSA, buf: *const *mut u8) -> c_int;
fn d2i_RSAPrivateKey(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA; fn d2i_RSAPrivateKey(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA;
@ -136,14 +136,14 @@ impl PKey {
* Returns a serialized form of the public key, suitable for load_pub(). * Returns a serialized form of the public key, suitable for load_pub().
*/ */
pub fn save_pub(&self) -> Vec<u8> { pub fn save_pub(&self) -> Vec<u8> {
self._tostr(i2d_RSAPublicKey) self._tostr(i2d_RSA_PUBKEY)
} }
/** /**
* Loads a serialized form of the public key, as produced by save_pub(). * Loads a serialized form of the public key, as produced by save_pub().
*/ */
pub fn load_pub(&mut self, s: &[u8]) { pub fn load_pub(&mut self, s: &[u8]) {
self._fromstr(s, d2i_RSAPublicKey); self._fromstr(s, d2i_RSA_PUBKEY);
self.parts = Public; self.parts = Public;
} }