mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-10-26 22:06:06 +03:00
feat(net): finish handling logon proof
This commit is contained in:
parent
098d8cd82f
commit
613b2724e2
@ -233,8 +233,40 @@ int32_t Grunt::ClientLink::CmdAuthLogonProof(CDataStore& msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auth success
|
// Auth success
|
||||||
|
if (msg.m_read <= msg.m_size && msg.m_size - msg.m_read >= 24) {
|
||||||
|
void* serverProof;
|
||||||
|
msg.GetDataInSitu(serverProof, 20);
|
||||||
|
|
||||||
// TODO
|
uint32_t v17 = 0;
|
||||||
|
msg.Get(v17);
|
||||||
|
|
||||||
|
uint32_t v14;
|
||||||
|
msg.Get(v14);
|
||||||
|
|
||||||
|
if (msg.m_read <= msg.m_size && msg.m_size - msg.m_read >= 2) {
|
||||||
|
uint16_t v16 = 0;
|
||||||
|
msg.Get(v16);
|
||||||
|
|
||||||
|
if (msg.m_read <= msg.m_size) {
|
||||||
|
if (this->m_srpClient.VerifyServerProof(static_cast<uint8_t*>(serverProof), 20)) {
|
||||||
|
this->SetState(2);
|
||||||
|
this->m_clientResponse->LogonResult(Grunt::GRUNT_RESULT_11, nullptr, 0, 0);
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
// this->uint98 = v17;
|
||||||
|
// this->uint94 = 0;
|
||||||
|
// this->uint9C = v14;
|
||||||
|
|
||||||
|
this->SetState(6);
|
||||||
|
this->m_clientResponse->LogonResult(Grunt::GRUNT_RESULT_0, this->m_srpClient.sessionKey, 40, v16);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,3 +174,16 @@ cleanup:
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t SRP6_Client::VerifyServerProof(const uint8_t* serverProof, uint32_t serverProofLen) {
|
||||||
|
if (serverProofLen != 20) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate expected server proof
|
||||||
|
uint8_t localServerProof[SHA1_DIGEST_SIZE];
|
||||||
|
SHA1_Final(localServerProof, &this->ctx);
|
||||||
|
|
||||||
|
// Compare expected server proof with given server proof
|
||||||
|
return memcmp(localServerProof, serverProof, sizeof(localServerProof));
|
||||||
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class SRP6_Client {
|
|||||||
// Member functions
|
// Member functions
|
||||||
int32_t BeginAuthentication(const char* accountName, const char* password);
|
int32_t BeginAuthentication(const char* accountName, const char* password);
|
||||||
int32_t CalculateProof(const uint8_t* largeSafePrime, uint32_t largeSafePrimeLen, const uint8_t* generator, uint32_t generatorLen, const uint8_t* salt, uint32_t saltLen, const uint8_t* publicKey, uint32_t publicKeyLen, SRP6_Random& random);
|
int32_t CalculateProof(const uint8_t* largeSafePrime, uint32_t largeSafePrimeLen, const uint8_t* generator, uint32_t generatorLen, const uint8_t* salt, uint32_t saltLen, const uint8_t* publicKey, uint32_t publicKeyLen, SRP6_Random& random);
|
||||||
|
int32_t VerifyServerProof(const uint8_t* serverProof, uint32_t serverProofLen);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user