mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
don't show calculation time over expectations in test builds
This commit is contained in:
parent
0d71a37601
commit
ad5ff66157
@ -34,10 +34,12 @@ SecretKeyCryptography::ResultType SecretKeyCryptography::createKey(const std::st
|
||||
assert(app_secret);
|
||||
Profiler timeUsed;
|
||||
std::unique_lock<std::shared_mutex> _lock(mWorkingMutex);
|
||||
#ifndef _TEST_BUILD
|
||||
if (timeUsed.millis() > 10) {
|
||||
printf("[AuthenticatedEncryption::createKey] wait %s on getting lock\n", timeUsed.string().data());
|
||||
printf("[SecretKeyCryptography::createKey] wait %s on getting lock\n", timeUsed.string().data());
|
||||
timeUsed.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
// use hash512 because existing data where calculated with that, but could be also changed to hash256
|
||||
auto hash512_salt = mm->getFreeMemory(crypto_hash_sha512_BYTES); // need at least crypto_pwhash_SALTBYTES 16U
|
||||
@ -49,10 +51,12 @@ SecretKeyCryptography::ResultType SecretKeyCryptography::createKey(const std::st
|
||||
crypto_hash_sha512_update(&state, *app_secret, app_secret->size());
|
||||
crypto_hash_sha512_final(&state, *hash512_salt);
|
||||
|
||||
#ifndef _TEST_BUILD
|
||||
if (timeUsed.millis() > 200) {
|
||||
printf("[AuthenticatedEncryption::createKey] %s calculating sha512\n", timeUsed.string().data());
|
||||
printf("[SecretKeyCryptography::createKey] %s calculating sha512\n", timeUsed.string().data());
|
||||
timeUsed.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
//unsigned char* key = (unsigned char *)malloc(crypto_box_SEEDBYTES); // 32U
|
||||
//ObfusArray* key = new ObfusArray(crypto_box_SEEDBYTES);
|
||||
@ -68,9 +72,11 @@ SecretKeyCryptography::ResultType SecretKeyCryptography::createKey(const std::st
|
||||
|
||||
return AUTH_CREATE_ENCRYPTION_KEY_FAILED;
|
||||
}
|
||||
#ifndef _TEST_BUILD
|
||||
if (timeUsed.millis() > 400) {
|
||||
printf("[AuthenticatedEncryption::createKey] %s calculating pwd hash\n", timeUsed.string().data());
|
||||
printf("[SecretKeyCryptography::createKey] %s calculating pwd hash\n", timeUsed.string().data());
|
||||
}
|
||||
#endif
|
||||
// generate hash from key for compare
|
||||
assert(sizeof(KeyHashed) >= crypto_shorthash_BYTES);
|
||||
assert(ServerConfig::g_ServerCryptoKey);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user