diff --git a/login_server/src/cpp/Crypto/SecretKeyCryptography.cpp b/login_server/src/cpp/Crypto/SecretKeyCryptography.cpp index 8710a5b8c..5b30f74ad 100644 --- a/login_server/src/cpp/Crypto/SecretKeyCryptography.cpp +++ b/login_server/src/cpp/Crypto/SecretKeyCryptography.cpp @@ -34,10 +34,12 @@ SecretKeyCryptography::ResultType SecretKeyCryptography::createKey(const std::st assert(app_secret); Profiler timeUsed; std::unique_lock _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);