mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-04 10:19:27 +02:00
Almost eliminate util module
This commit is contained in:
parent
9378ae5b6f
commit
e688e7e886
9 changed files with 59 additions and 67 deletions
|
@ -1,7 +1,7 @@
|
|||
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
|
||||
use hmac::{Hmac, Mac, NewMac};
|
||||
use protobuf::{self, Message};
|
||||
use rand::thread_rng;
|
||||
use rand::{thread_rng, RngCore};
|
||||
use sha1::Sha1;
|
||||
use std::io;
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
|
@ -11,7 +11,6 @@ use super::codec::ApCodec;
|
|||
use crate::diffie_hellman::DhLocalKeys;
|
||||
use crate::protocol;
|
||||
use crate::protocol::keyexchange::{APResponseMessage, ClientHello, ClientResponsePlaintext};
|
||||
use crate::util;
|
||||
|
||||
pub async fn handshake<T: AsyncRead + AsyncWrite + Unpin>(
|
||||
mut connection: T,
|
||||
|
@ -40,6 +39,9 @@ async fn client_hello<T>(connection: &mut T, gc: Vec<u8>) -> io::Result<Vec<u8>>
|
|||
where
|
||||
T: AsyncWrite + Unpin,
|
||||
{
|
||||
let mut client_nonce = vec![0; 0x10];
|
||||
thread_rng().fill_bytes(&mut client_nonce);
|
||||
|
||||
let mut packet = ClientHello::new();
|
||||
packet
|
||||
.mut_build_info()
|
||||
|
@ -59,7 +61,7 @@ where
|
|||
.mut_login_crypto_hello()
|
||||
.mut_diffie_hellman()
|
||||
.set_server_keys_known(1);
|
||||
packet.set_client_nonce(util::rand_vec(&mut thread_rng(), 0x10));
|
||||
packet.set_client_nonce(client_nonce);
|
||||
packet.set_padding(vec![0x1e]);
|
||||
|
||||
let mut buffer = vec![0, 4];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue