@@ -4,7 +4,7 @@ use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
44use hmac:: { Hmac , Mac } ;
55use protobuf:: { self , Message } ;
66use rand:: { thread_rng, RngCore } ;
7- use rsa:: { BigUint , PublicKey } ;
7+ use rsa:: { BigUint , Pkcs1v15Sign , PublicKey } ;
88use sha1:: { Digest , Sha1 } ;
99use thiserror:: Error ;
1010use tokio:: io:: { AsyncRead , AsyncReadExt , AsyncWrite , AsyncWriteExt } ;
@@ -83,11 +83,9 @@ pub async fn handshake<T: AsyncRead + AsyncWrite + Unpin>(
8383 } ) ?;
8484
8585 let hash = Sha1 :: digest ( & remote_key) ;
86- let padding = PaddingScheme ( rsa:: padding:: PaddingScheme :: new_pkcs1v15_sign ( Some (
87- rsa:: hash:: Hash :: SHA1 ,
88- ) ) ) ;
86+ let padding = Pkcs1v15Sign :: new :: < Sha1 > ( ) ;
8987 public_key
90- . verify ( padding. 0 , & hash, & remote_signature)
88+ . verify ( padding, & hash, & remote_signature)
9189 . map_err ( |_| {
9290 io:: Error :: new (
9391 io:: ErrorKind :: InvalidData ,
@@ -105,13 +103,6 @@ pub async fn handshake<T: AsyncRead + AsyncWrite + Unpin>(
105103 Ok ( codec. framed ( connection) )
106104}
107105
108- // Workaround for https://github.com/RustCrypto/RSA/issues/214
109- struct PaddingScheme ( rsa:: padding:: PaddingScheme ) ;
110-
111- /// # Safety
112- /// The `rsa::padding::PaddingScheme` variant we use is actually `Send`.
113- unsafe impl Send for PaddingScheme { }
114-
115106async fn client_hello < T > ( connection : & mut T , gc : Vec < u8 > ) -> io:: Result < Vec < u8 > >
116107where
117108 T : AsyncWrite + Unpin ,
0 commit comments