Skip to content

Commit 75a67fd

Browse files
committed
Remove unneeded generic-array dependency
1 parent 7413ffb commit 75a67fd

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

postgres-protocol/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ base64 = "0.11"
1313
byteorder = "1.0"
1414
bytes = "0.5"
1515
fallible-iterator = "0.2"
16-
generic-array = "0.13"
1716
hmac = "0.7"
1817
md5 = "0.7"
1918
memchr = "2.0"

postgres-protocol/src/authentication/sasl.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! SASL-based authentication support.
22
3-
use generic_array::typenum::U32;
4-
use generic_array::GenericArray;
53
use hmac::{Hmac, Mac};
64
use rand::{self, Rng};
75
use sha2::{Digest, Sha256};
@@ -33,13 +31,13 @@ fn normalize(pass: &[u8]) -> Vec<u8> {
3331
}
3432
}
3533

36-
fn hi(str: &[u8], salt: &[u8], i: u32) -> GenericArray<u8, U32> {
34+
fn hi(str: &[u8], salt: &[u8], i: u32) -> [u8; 32] {
3735
let mut hmac = Hmac::<Sha256>::new_varkey(str).expect("HMAC is able to accept all key sizes");
3836
hmac.input(salt);
3937
hmac.input(&[0, 0, 0, 1]);
4038
let mut prev = hmac.result().code();
4139

42-
let mut hi = GenericArray::<u8, U32>::clone_from_slice(&prev);
40+
let mut hi = prev;
4341

4442
for _ in 1..i {
4543
let mut hmac = Hmac::<Sha256>::new_varkey(str).expect("already checked above");
@@ -51,7 +49,7 @@ fn hi(str: &[u8], salt: &[u8], i: u32) -> GenericArray<u8, U32> {
5149
}
5250
}
5351

54-
hi
52+
hi.into()
5553
}
5654

5755
enum ChannelBindingInner {
@@ -103,7 +101,7 @@ enum State {
103101
channel_binding: ChannelBinding,
104102
},
105103
Finish {
106-
salted_password: GenericArray<u8, U32>,
104+
salted_password: [u8; 32],
107105
auth_message: String,
108106
},
109107
Done,
@@ -220,7 +218,7 @@ impl ScramSha256 {
220218
hmac.input(auth_message.as_bytes());
221219
let client_signature = hmac.result();
222220

223-
let mut client_proof = GenericArray::<u8, U32>::clone_from_slice(&client_key);
221+
let mut client_proof = client_key;
224222
for (proof, signature) in client_proof.iter_mut().zip(client_signature.code()) {
225223
*proof ^= signature;
226224
}

0 commit comments

Comments
 (0)