Merge branch 'master' into 'master'

update base64 and openssl deps

See merge request lumi/sasl-rs!4
This commit is contained in:
lumi 2018-05-19 10:29:33 +00:00
commit 76635ba782
2 changed files with 6 additions and 6 deletions

View file

@ -18,8 +18,8 @@ default = ["scram"]
scram = ["openssl"] scram = ["openssl"]
[dependencies] [dependencies]
base64 = "0.6.0" base64 = "0.9.0"
[dependencies.openssl] [dependencies.openssl]
version = "0.9.13" version = "0.10.4"
optional = true optional = true

View file

@ -46,14 +46,14 @@ impl ScramProvider for Sha1 { // TODO: look at all these unwraps
fn name() -> &'static str { "SHA-1" } fn name() -> &'static str { "SHA-1" }
fn hash(data: &[u8]) -> Vec<u8> { fn hash(data: &[u8]) -> Vec<u8> {
hash(MessageDigest::sha1(), data).unwrap() hash(MessageDigest::sha1(), data).unwrap().to_vec()
} }
fn hmac(data: &[u8], key: &[u8]) -> Vec<u8> { fn hmac(data: &[u8], key: &[u8]) -> Vec<u8> {
let pkey = PKey::hmac(key).unwrap(); let pkey = PKey::hmac(key).unwrap();
let mut signer = Signer::new(MessageDigest::sha1(), &pkey).unwrap(); let mut signer = Signer::new(MessageDigest::sha1(), &pkey).unwrap();
signer.update(data).unwrap(); signer.update(data).unwrap();
signer.finish().unwrap() signer.sign_to_vec().unwrap()
} }
fn derive(password: &Password, salt: &[u8], iterations: usize) -> Result<Vec<u8>, String> { fn derive(password: &Password, salt: &[u8], iterations: usize) -> Result<Vec<u8>, String> {
@ -90,14 +90,14 @@ impl ScramProvider for Sha256 { // TODO: look at all these unwraps
fn name() -> &'static str { "SHA-256" } fn name() -> &'static str { "SHA-256" }
fn hash(data: &[u8]) -> Vec<u8> { fn hash(data: &[u8]) -> Vec<u8> {
hash(MessageDigest::sha256(), data).unwrap() hash(MessageDigest::sha256(), data).unwrap().to_vec()
} }
fn hmac(data: &[u8], key: &[u8]) -> Vec<u8> { fn hmac(data: &[u8], key: &[u8]) -> Vec<u8> {
let pkey = PKey::hmac(key).unwrap(); let pkey = PKey::hmac(key).unwrap();
let mut signer = Signer::new(MessageDigest::sha256(), &pkey).unwrap(); let mut signer = Signer::new(MessageDigest::sha256(), &pkey).unwrap();
signer.update(data).unwrap(); signer.update(data).unwrap();
signer.finish().unwrap() signer.sign_to_vec().unwrap()
} }
fn derive(password: &Password, salt: &[u8], iterations: usize) -> Result<Vec<u8>, String> { fn derive(password: &Password, salt: &[u8], iterations: usize) -> Result<Vec<u8>, String> {