diff --git a/src/frame.cpp b/src/frame.cpp index f18e2c8..221b8fc 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -70,7 +70,7 @@ try { singletonFrame = this; SetIcon(wxICON(AAArho)); sqlite3_init(); - if (sodium_init() == -1) { + if (sodium_init() < 0) { szError = "Fatal Error: Encryption library did not init."; errorCode = 6; // Cannot log the error, because logging not set up yet, so logging itself causes an exception diff --git a/src/ristretto255.h b/src/ristretto255.h index 377f129..6ee40a4 100644 --- a/src/ristretto255.h +++ b/src/ristretto255.h @@ -494,7 +494,14 @@ namespace ristretto255 { return u; } else { - return u << ro::serialize(j); + auto sj = ro::serialize(j); + int i = crypto_generichash_blake2b_update( + &u.st, + &sj[0], + sj.size() + ); + if (i) throw HashReuseException(); + return u; } } diff --git a/src/stdafx.h b/src/stdafx.h index 633c3f9..d32b46b 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -79,7 +79,7 @@ std::span& operator^=(std::span&, byte *); #ifdef __WXMSW__ #include // redefines the new() operator #endif -#define SODIUM_STATIC +#define SODIUM_STATIC 1 #include #include #pragma comment(lib, "libsodium.lib") @@ -98,6 +98,7 @@ enum MyIDs { myID_MAINFRAME_PANEL, myID_TESTWINDOW, myID_WELCOME_TO_ROCOIN, myID_WALLET_UI, mID_CLOSE_WALLET, myID_MYEXIT }; + #include "localization.h" #include "db_accessors.h" #include "app.h"