From 4c75fd775072a494811db3cf8537d9062d385d81 Mon Sep 17 00:00:00 2001 From: Ake Hedman Date: Sun, 5 May 2024 21:06:46 +0200 Subject: [PATCH] Removed dependency of fastpbkdf2 --- CMakeLists.txt | 14 ++++-------- src/vscp/common/vscphelper.cpp | 39 +++++++++++++++++----------------- src/vscp/common/vscphelper.h | 8 +++---- 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ad887c95..bc7798453 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,10 +89,10 @@ set(APP_VERSION, "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") endif() # Man build and install -if(NOT DEFINED WIN32) - add_subdirectory(man) - add_subdirectory(src/vscp/vscp-mkpasswd) -endif() +#if(NOT DEFINED WIN32) +# add_subdirectory(man) +# add_subdirectory(src/vscp/vscp-mkpasswd) +#endif() option(USE_SSL "Use SSL" TRUE) @@ -297,8 +297,6 @@ if (WIN32) src/common/crc8.c src/common/vscpmd5.h src/common/vscpmd5.c - ./third_party/fastpbkdf2/fastpbkdf2.h - ./third_party/fastpbkdf2/fastpbkdf2.c src/common/randpassword.h src/common/randpassword.cpp ) @@ -348,8 +346,6 @@ else() src/common/crc8.c src/common/vscpmd5.h src/common/vscpmd5.c - ./third_party/fastpbkdf2/fastpbkdf2.h - ./third_party/fastpbkdf2/fastpbkdf2.c src/common/randpassword.h src/common/randpassword.cpp ) @@ -368,7 +364,6 @@ if (WIN32) ./third_party/sqlite3/ ./third_party/spdlog/include/ ./third_party/mustache/ - ./third_party/fastpbkdf2/ ./src/common/windows ${PThreads4W_INCLUDE_DIR} ${CMAKE_BINARY_DIR} @@ -387,7 +382,6 @@ else() ./third_party/sqlite3/ ./third_party/mustache/ ./third_party/spdlog/include/ - ./third_party/fastpbkdf2/ ${PThreads4W_INCLUDE_DIR} ${CMAKE_BINARY_DIR} ${OPENSSL_INCLUDE_DIR} diff --git a/src/vscp/common/vscphelper.cpp b/src/vscp/common/vscphelper.cpp index 8fd9bf073..1758670bb 100644 --- a/src/vscp/common/vscphelper.cpp +++ b/src/vscp/common/vscphelper.cpp @@ -63,7 +63,7 @@ #include #include #include -#include +//#include #include #include #include @@ -7379,7 +7379,7 @@ vscp_getHashPasswordComponents(uint8_t *pSalt, uint8_t *pHash, const std::string //////////////////////////////////////////////////////////////////////////////// // vscp_makePasswordHash // - +/* bool vscp_makePasswordHash(std::string &result, const std::string &password, uint8_t *pSalt) { @@ -7419,32 +7419,33 @@ vscp_makePasswordHash(std::string &result, const std::string &password, uint8_t return true; } +*/ //////////////////////////////////////////////////////////////////////////////// // vscp_isPasswordValid // -bool -vscp_isPasswordValid(const std::string &stored_pw, const std::string &password) -{ - std::string calcHash; // Calculated hash - uint8_t salt[16]; // Stored salt - uint8_t hash[32]; // Stored hash +// bool +// vscp_isPasswordValid(const std::string &stored_pw, const std::string &password) +// { +// std::string calcHash; // Calculated hash +// uint8_t salt[16]; // Stored salt +// uint8_t hash[32]; // Stored hash - if (!vscp_getHashPasswordComponents(salt, hash, stored_pw)) { - return false; - } +// if (!vscp_getHashPasswordComponents(salt, hash, stored_pw)) { +// return false; +// } - if (!vscp_makePasswordHash(calcHash, password, salt)) { - return false; - } +// if (!vscp_makePasswordHash(calcHash, password, salt)) { +// return false; +// } - if (stored_pw != calcHash) { - return false; - } +// if (stored_pw != calcHash) { +// return false; +// } - return true; -} +// return true; +// } /////////////////////////////////////////////////////////////////////////////// // vscp_getSalt diff --git a/src/vscp/common/vscphelper.h b/src/vscp/common/vscphelper.h index 074a2278e..0e71149a1 100644 --- a/src/vscp/common/vscphelper.h +++ b/src/vscp/common/vscphelper.h @@ -2229,8 +2229,8 @@ vscp_getHashPasswordComponents(uint8_t *pSalt, uint8_t *pHash, const std::string * @param password Clear text password to be hashed. * @return true on success, false otherwise. */ -bool -vscp_makePasswordHash(std::string &result, const std::string &password, uint8_t *pSalt = NULL); +//bool +//vscp_makePasswordHash(std::string &result, const std::string &password, uint8_t *pSalt = NULL); /*! * Validate password @@ -2240,8 +2240,8 @@ vscp_makePasswordHash(std::string &result, const std::string &password, uint8_t * @return true on success, false otherwise. */ -bool -vscp_isPasswordValid(const std::string &stored_pw, const std::string &password); +//bool +//vscp_isPasswordValid(const std::string &stored_pw, const std::string &password); /*! * Get salt