Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3073435

Browse files
authored
Merge pull request#761 from sfackler/dependabot/cargo/hmac-0.11
Update hmac requirement from 0.10 to 0.11
2 parents939218c +4e8b907 commit3073435

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

‎postgres-protocol/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ base64 = "0.13"
1313
byteorder ="1.0"
1414
bytes ="1.0"
1515
fallible-iterator ="0.2"
16-
hmac ="0.10"
16+
hmac ="0.11"
1717
md-5 ="0.9"
1818
memchr ="2.0"
1919
rand ="0.8"

‎postgres-protocol/src/authentication/sasl.rs‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ fn normalize(pass: &[u8]) -> Vec<u8> {
3333
}
3434

3535
pub(crate)fnhi(str:&[u8],salt:&[u8],i:u32) ->[u8;32]{
36-
letmut hmac =Hmac::<Sha256>::new_varkey(str).expect("HMAC is able to accept all key sizes");
36+
letmut hmac =
37+
Hmac::<Sha256>::new_from_slice(str).expect("HMAC is able to accept all key sizes");
3738
hmac.update(salt);
3839
hmac.update(&[0,0,0,1]);
3940
letmut prev = hmac.finalize().into_bytes();
4041

4142
letmut hi = prev;
4243

4344
for _in1..i{
44-
letmut hmac =Hmac::<Sha256>::new_varkey(str).expect("already checked above");
45+
letmut hmac =Hmac::<Sha256>::new_from_slice(str).expect("already checked above");
4546
hmac.update(&prev);
4647
prev = hmac.finalize().into_bytes();
4748

@@ -195,7 +196,7 @@ impl ScramSha256 {
195196

196197
let salted_password =hi(&password,&salt, parsed.iteration_count);
197198

198-
letmut hmac =Hmac::<Sha256>::new_varkey(&salted_password)
199+
letmut hmac =Hmac::<Sha256>::new_from_slice(&salted_password)
199200
.expect("HMAC is able to accept all key sizes");
200201
hmac.update(b"Client Key");
201202
let client_key = hmac.finalize().into_bytes();
@@ -214,8 +215,8 @@ impl ScramSha256 {
214215

215216
let auth_message =format!("n=,r={},{},{}", client_nonce, message,self.message);
216217

217-
letmut hmac =
218-
Hmac::<Sha256>::new_varkey(&stored_key).expect("HMAC is able to accept all key sizes");
218+
letmut hmac =Hmac::<Sha256>::new_from_slice(&stored_key)
219+
.expect("HMAC is able to accept all key sizes");
219220
hmac.update(auth_message.as_bytes());
220221
let client_signature = hmac.finalize().into_bytes();
221222

@@ -266,13 +267,13 @@ impl ScramSha256 {
266267
Err(e) =>returnErr(io::Error::new(io::ErrorKind::InvalidInput, e)),
267268
};
268269

269-
letmut hmac =Hmac::<Sha256>::new_varkey(&salted_password)
270+
letmut hmac =Hmac::<Sha256>::new_from_slice(&salted_password)
270271
.expect("HMAC is able to accept all key sizes");
271272
hmac.update(b"Server Key");
272273
let server_key = hmac.finalize().into_bytes();
273274

274-
letmut hmac =
275-
Hmac::<Sha256>::new_varkey(&server_key).expect("HMAC is able to accept all key sizes");
275+
letmut hmac =Hmac::<Sha256>::new_from_slice(&server_key)
276+
.expect("HMAC is able to accept all key sizes");
276277
hmac.update(auth_message.as_bytes());
277278
hmac.verify(&verifier)
278279
.map_err(|_| io::Error::new(io::ErrorKind::InvalidInput,"SCRAM verification error"))

‎postgres-protocol/src/password/mod.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ pub(crate) fn scram_sha_256_salt(password: &[u8], salt: [u8; SCRAM_DEFAULT_SALT_
6161
let salted_password = sasl::hi(&prepared,&salt,SCRAM_DEFAULT_ITERATIONS);
6262

6363
// client key
64-
letmut hmac =
65-
Hmac::<Sha256>::new_varkey(&salted_password).expect("HMAC is able to accept all key sizes");
64+
letmut hmac =Hmac::<Sha256>::new_from_slice(&salted_password)
65+
.expect("HMAC is able to accept all key sizes");
6666
hmac.update(b"Client Key");
6767
let client_key = hmac.finalize().into_bytes();
6868

@@ -72,8 +72,8 @@ pub(crate) fn scram_sha_256_salt(password: &[u8], salt: [u8; SCRAM_DEFAULT_SALT_
7272
let stored_key = hash.finalize_fixed();
7373

7474
// server key
75-
letmut hmac =
76-
Hmac::<Sha256>::new_varkey(&salted_password).expect("HMAC is able to accept all key sizes");
75+
letmut hmac =Hmac::<Sha256>::new_from_slice(&salted_password)
76+
.expect("HMAC is able to accept all key sizes");
7777
hmac.update(b"Server Key");
7878
let server_key = hmac.finalize().into_bytes();
7979

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp