This commit is contained in:
Steven Fackler 2020-06-10 16:46:55 -07:00
parent 58a7856646
commit a12efc41d7
2 changed files with 12 additions and 11 deletions

View File

@ -2,8 +2,8 @@
use hmac::{Hmac, Mac, NewMac};
use rand::{self, Rng};
use sha2::{Digest, Sha256};
use sha2::digest::FixedOutput;
use sha2::{Digest, Sha256};
use std::fmt::Write;
use std::io;
use std::iter;
@ -271,8 +271,8 @@ impl ScramSha256 {
hmac.update(b"Server Key");
let server_key = hmac.finalize().into_bytes();
let mut hmac = Hmac::<Sha256>::new_varkey(&server_key)
.expect("HMAC is able to accept all key sizes");
let mut hmac =
Hmac::<Sha256>::new_varkey(&server_key).expect("HMAC is able to accept all key sizes");
hmac.update(auth_message.as_bytes());
hmac.verify(&verifier)
.map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "SCRAM verification error"))

View File

@ -158,16 +158,17 @@ macro_rules! accepts {
#[macro_export]
macro_rules! to_sql_checked {
() => {
fn to_sql_checked(&self,
ty: &$crate::Type,
out: &mut $crate::private::BytesMut)
-> ::std::result::Result<$crate::IsNull,
Box<dyn ::std::error::Error +
::std::marker::Sync +
::std::marker::Send>> {
fn to_sql_checked(
&self,
ty: &$crate::Type,
out: &mut $crate::private::BytesMut,
) -> ::std::result::Result<
$crate::IsNull,
Box<dyn ::std::error::Error + ::std::marker::Sync + ::std::marker::Send>,
> {
$crate::__to_sql_checked(self, ty, out)
}
}
};
}
// WARNING: this function is not considered part of this crate's public API.