From d96e828be83f7adf0fe88001da865169cfd573c7 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Tue, 22 Oct 2024 02:45:53 -0400 Subject: Refactor AES functions to use mbedtls Signed-off-by: Malfurious --- Cryptor.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Cryptor.h') diff --git a/Cryptor.h b/Cryptor.h index 8ba1c16..1fcac36 100644 --- a/Cryptor.h +++ b/Cryptor.h @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef WIN32 #include @@ -12,17 +13,16 @@ #include #endif // WIN32 -#include "cryptopp562/osrng.h" -#include "cryptopp562/cryptlib.h" -#include "cryptopp562/hex.h" -#include "cryptopp562/filters.h" -#include "cryptopp562/aes.h" -#include "cryptopp562/ccm.h" +#include "mbedtls/cipher.h" +#include "mbedtls/ctr_drbg.h" +#include "mbedtls/entropy.h" #include "Socket.h" #define DEF_PASSWD_LENGTH 50 +#define AES_BLOCK_LENGTH 16 + #define KEYCHAIN_FILE ".compasskeychain" #define PASSWORD_PROMPT "ComPASS Password: " #define PASSWORD_CONF "Confirm Password: " @@ -49,9 +49,10 @@ public: private: static bool haveKey; - static unsigned char key[CryptoPP::AES::DEFAULT_KEYLENGTH]; + static unsigned char key[AES_BLOCK_LENGTH]; static void sha256(std::string str); + static void generateRandom(void *output, size_t size); static std::string readPassword(bool confirm); static std::string readPassword(); static void assembleKey(bool confirm); -- cgit v1.2.3