mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-10 20:58:37 +02:00
Change HMACAuth::calculateHash to just call existing methods
This commit is contained in:
parent
9ef56c44a3
commit
00d2f9494b
2 changed files with 5 additions and 14 deletions
|
@ -106,21 +106,12 @@ HMACAuth::HMACHash HMACAuth::result() {
|
||||||
|
|
||||||
bool HMACAuth::calculateHash(HMACHash& hashResult, const char* data, int dataLen) {
|
bool HMACAuth::calculateHash(HMACHash& hashResult, const char* data, int dataLen) {
|
||||||
QMutexLocker lock(&_lock);
|
QMutexLocker lock(&_lock);
|
||||||
if (!HMAC_Update(_hmacContext, reinterpret_cast<const unsigned char*>(data), dataLen)) {
|
if (!addData(data, dataLen)) {
|
||||||
qCWarning(networking) << "Error occured calling HMAC_Update";
|
qCWarning(networking) << "Error occured calling HMACAuth::addData()";
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashResult.resize(EVP_MAX_MD_SIZE);
|
hashResult = result();
|
||||||
unsigned int hashLen;
|
return true;
|
||||||
if (HMAC_Final(_hmacContext, &hashResult[0], &hashLen)) {
|
|
||||||
hashResult.resize((size_t)hashLen);
|
|
||||||
// Clear state for possible reuse.
|
|
||||||
HMAC_Init_ex(_hmacContext, nullptr, 0, nullptr, nullptr);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
qCWarning(networking) << "Error occured calling HMAC_Final";
|
|
||||||
assert(false);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
HMACHash result();
|
HMACHash result();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMutex _lock;
|
QMutex _lock { QMutex::Recursive };
|
||||||
struct hmac_ctx_st* _hmacContext;
|
struct hmac_ctx_st* _hmacContext;
|
||||||
AuthMethod _authMethod;
|
AuthMethod _authMethod;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue