Replace PKCS5_PBKDF2_HMAC_SHA1 with crates
Also tidies up ykpiv_util_get_derived_mgm (which was the only consumer of the function) and fixes some porting bugs.
This commit is contained in:
@@ -60,15 +60,6 @@ extern "C" {
|
||||
);
|
||||
fn DES_is_weak_key(key: *mut [u8; 8]) -> i32;
|
||||
fn DES_set_key_unchecked(key: *mut [u8; 8], schedule: *mut DesSubKey);
|
||||
fn PKCS5_PBKDF2_HMAC_SHA1(
|
||||
pass: *const u8,
|
||||
passlen: i32,
|
||||
salt: *const u8,
|
||||
saltlen: i32,
|
||||
iter: i32,
|
||||
keylen: i32,
|
||||
out: *mut u8,
|
||||
) -> i32;
|
||||
}
|
||||
|
||||
/// DES-related errors
|
||||
@@ -244,29 +235,6 @@ pub enum Pkcs5ErrorKind {
|
||||
GeneralError = -1,
|
||||
}
|
||||
|
||||
/// Decrypt a PKCS#5 key
|
||||
pub unsafe fn pkcs5_pbkdf2_sha1(
|
||||
password: *const u8,
|
||||
cb_password: usize,
|
||||
salt: *const u8,
|
||||
cb_salt: usize,
|
||||
iterations: usize,
|
||||
key: *const u8,
|
||||
cb_key: usize,
|
||||
) -> Pkcs5ErrorKind {
|
||||
PKCS5_PBKDF2_HMAC_SHA1(
|
||||
password,
|
||||
cb_password as (i32),
|
||||
salt,
|
||||
cb_salt as (i32),
|
||||
iterations as (i32),
|
||||
cb_key as (i32),
|
||||
key as (*mut u8),
|
||||
);
|
||||
|
||||
Pkcs5ErrorKind::Ok
|
||||
}
|
||||
|
||||
/// Strip whitespace
|
||||
// TODO(tarcieri): implement this
|
||||
pub unsafe fn _strip_ws(sz: *mut c_char) -> *mut c_char {
|
||||
|
||||
Reference in New Issue
Block a user