mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-10 05:27:01 +03:00
catching up (trying to) wiht CSpot
This commit is contained in:
@@ -6,10 +6,10 @@ using random_bytes_engine = std::independent_bits_engine<std::default_random_eng
|
||||
|
||||
Session::Session()
|
||||
{
|
||||
this->clientHello = ClientHello_init_default;
|
||||
this->apResponse = APResponseMessage_init_default;
|
||||
this->authRequest = ClientResponseEncrypted_init_default;
|
||||
this->clientResPlaintext = ClientResponsePlaintext_init_default;
|
||||
this->clientHello = {};
|
||||
this->apResponse = {};
|
||||
this->authRequest = {};
|
||||
this->clientResPlaintext = {};
|
||||
|
||||
// Generates the public and priv key
|
||||
this->crypto = std::make_unique<Crypto>();
|
||||
@@ -18,10 +18,9 @@ Session::Session()
|
||||
|
||||
Session::~Session()
|
||||
{
|
||||
pb_release(ClientHello_fields, clientHello);
|
||||
pb_release(APResponseMessage_fields, apResponse);
|
||||
pb_release(ClientResponseEncrypted_fields, authRequest);
|
||||
pb_release(ClientResponsePlaintext_fields, clientResPlaintext);
|
||||
pb_release(ClientHello_fields, &clientHello);
|
||||
pb_release(APResponseMessage_fields, &apResponse);
|
||||
pb_release(ClientResponsePlaintext_fields, &clientResPlaintext);
|
||||
}
|
||||
|
||||
void Session::connect(std::unique_ptr<PlainConnection> connection)
|
||||
@@ -60,6 +59,7 @@ std::vector<uint8_t> Session::authenticate(std::shared_ptr<LoginBlob> blob)
|
||||
authRequest.version_string = (char *)versionString;
|
||||
|
||||
auto data = pbEncode(ClientResponseEncrypted_fields, &authRequest);
|
||||
free(authRequest.login_credentials.auth_data);
|
||||
|
||||
// Send login request
|
||||
this->shanConn->sendPacket(LOGIN_REQUEST_COMMAND, data);
|
||||
@@ -72,7 +72,7 @@ std::vector<uint8_t> Session::authenticate(std::shared_ptr<LoginBlob> blob)
|
||||
CSPOT_LOG(debug, "Authorization successful");
|
||||
|
||||
// @TODO store the reusable credentials
|
||||
// PBWrapper<APWelcome> welcomePacket(packet->data)
|
||||
// PBWrapper<APWelcome> welcomePacket(packet->data)
|
||||
return std::vector<uint8_t>({0x1}); // TODO: return actual reusable credentaials to be stored somewhere
|
||||
break;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void Session::processAPHelloResponse(std::vector<uint8_t> &helloPacket)
|
||||
// Decode the response
|
||||
auto skipSize = std::vector<uint8_t>(data.begin() + 4, data.end());
|
||||
|
||||
pb_release(APResponseMessage_fields, apResponse);
|
||||
pb_release(APResponseMessage_fields, &apResponse);
|
||||
pbDecode(apResponse, APResponseMessage_fields, skipSize);
|
||||
|
||||
auto diffieKey = std::vector<uint8_t>(apResponse.challenge.login_crypto_challenge.diffie_hellman.gs, apResponse.challenge.login_crypto_challenge.diffie_hellman.gs + 96);
|
||||
|
||||
Reference in New Issue
Block a user