diff options
| author | Valerii Hiora <[email protected]> | 2014-09-28 08:15:51 +0300 |
|---|---|---|
| committer | Valerii Hiora <[email protected]> | 2014-09-30 08:21:31 +0300 |
| commit | 02637ec7d451c38792c42c5c2cb4d59505e13ced (patch) | |
| tree | 12a842f098c7cdbea5190097647666d34eabc093 /src/crypto/pkcs5.rs | |
| parent | Merge pull request #53 from vhbit/cert-gen (diff) | |
| download | rust-openssl-02637ec7d451c38792c42c5c2cb4d59505e13ced.tar.xz rust-openssl-02637ec7d451c38792c42c5c2cb4d59505e13ced.zip | |
single `ffi` module
Diffstat (limited to 'src/crypto/pkcs5.rs')
| -rw-r--r-- | src/crypto/pkcs5.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/crypto/pkcs5.rs b/src/crypto/pkcs5.rs index b795d84a..ec6e0cef 100644 --- a/src/crypto/pkcs5.rs +++ b/src/crypto/pkcs5.rs @@ -1,12 +1,5 @@ use libc::c_int; - -#[link(name = "crypto")] -extern { - fn PKCS5_PBKDF2_HMAC_SHA1(pass: *const u8, passlen: c_int, - salt: *const u8, saltlen: c_int, - iter: c_int, keylen: c_int, - out: *mut u8) -> c_int; -} +use ffi; /// Derives a key from a password and salt using the PBKDF2-HMAC-SHA1 algorithm. pub fn pbkdf2_hmac_sha1(pass: &str, salt: &[u8], iter: uint, keylen: uint) -> Vec<u8> { @@ -16,7 +9,7 @@ pub fn pbkdf2_hmac_sha1(pass: &str, salt: &[u8], iter: uint, keylen: uint) -> Ve let mut out = Vec::with_capacity(keylen); - let r = PKCS5_PBKDF2_HMAC_SHA1( + let r = ffi::PKCS5_PBKDF2_HMAC_SHA1( pass.as_ptr(), pass.len() as c_int, salt.as_ptr(), salt.len() as c_int, iter as c_int, keylen as c_int, |