From 1662641b25fdf120a6fb326f85ba9efbaeb06e8d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 27 Feb 2025 22:34:47 +0000 Subject: [PATCH] Revert high CPU password hashing until separate threads are used --- CMakeLists.txt | 3 ++- config.mk | 3 --- libcommon/password_common.c | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e1f4bd0..744ca555 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,8 @@ endif() find_package(cJSON REQUIRED) find_package(argon2) if(ARGON2_FOUND) - add_definitions("-DWITH_ARGON2") + # Disable until separate password handling thread is implemented + #add_definitions("-DWITH_ARGON2") endif() option(WITH_LTO "Build with link time optimizations (IPO) / interprocedural optimization (IPO) enabled." ON) diff --git a/config.mk b/config.mk index afbecb03..a7742473 100644 --- a/config.mk +++ b/config.mk @@ -146,9 +146,6 @@ WITH_SQLITE=yes # currently only suitable for use with oss-fuzz. WITH_FUZZING=no -# Build with argon2id support for password hashing. -WITH_ARGON2=yes - # Build using clang and with address sanitiser enabled WITH_ASAN=no diff --git a/libcommon/password_common.c b/libcommon/password_common.c index 63382809..fb9e2a15 100644 --- a/libcommon/password_common.c +++ b/libcommon/password_common.c @@ -44,7 +44,7 @@ Contributors: # define MOSQ_ARGON2_P 1 #endif -#define PW_DEFAULT_ITERATIONS 210000 +#define PW_DEFAULT_ITERATIONS 1000 static int pw__encode(struct mosquitto_pw *pw); struct mosquitto_pw{ @@ -530,10 +530,10 @@ int mosquitto_pw_hash_encoded(struct mosquitto_pw *pw, const char *password) int rc = MOSQ_ERR_INVAL; switch(pw->hashtype){ - case MOSQ_PW_DEFAULT: case MOSQ_PW_ARGON2ID: rc = pw__create_argon2id(pw, password); break; + case MOSQ_PW_DEFAULT: case MOSQ_PW_SHA512_PBKDF2: rc = pw__create_sha512_pbkdf2(pw, password); break;