mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Merge pull request #1066 from gdesmott/send-workaround
core: workaround for Session::connect() future being !Send
This commit is contained in:
commit
b1e1e61a94
1 changed files with 11 additions and 2 deletions
|
@ -77,9 +77,11 @@ pub async fn handshake<T: AsyncRead + AsyncWrite + Unpin>(
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let hash = Sha1::digest(&remote_key);
|
let hash = Sha1::digest(&remote_key);
|
||||||
let padding = rsa::padding::PaddingScheme::new_pkcs1v15_sign(Some(rsa::hash::Hash::SHA1));
|
let padding = PaddingScheme(rsa::padding::PaddingScheme::new_pkcs1v15_sign(Some(
|
||||||
|
rsa::hash::Hash::SHA1,
|
||||||
|
)));
|
||||||
public_key
|
public_key
|
||||||
.verify(padding, &hash, &remote_signature)
|
.verify(padding.0, &hash, &remote_signature)
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
io::ErrorKind::InvalidData,
|
io::ErrorKind::InvalidData,
|
||||||
|
@ -97,6 +99,13 @@ pub async fn handshake<T: AsyncRead + AsyncWrite + Unpin>(
|
||||||
Ok(codec.framed(connection))
|
Ok(codec.framed(connection))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround for https://github.com/RustCrypto/RSA/issues/214
|
||||||
|
struct PaddingScheme(rsa::padding::PaddingScheme);
|
||||||
|
|
||||||
|
/// # Safety
|
||||||
|
/// The `rsa::padding::PaddingScheme` variant we use is actually `Send`.
|
||||||
|
unsafe impl Send for PaddingScheme {}
|
||||||
|
|
||||||
async fn client_hello<T>(connection: &mut T, gc: Vec<u8>) -> io::Result<Vec<u8>>
|
async fn client_hello<T>(connection: &mut T, gc: Vec<u8>) -> io::Result<Vec<u8>>
|
||||||
where
|
where
|
||||||
T: AsyncWrite + Unpin,
|
T: AsyncWrite + Unpin,
|
||||||
|
|
Loading…
Reference in a new issue