From 0967d18cc4bc1220cf2887b44ef83d22a608f028 Mon Sep 17 00:00:00 2001 From: Cheng Date: Thu, 16 Feb 2023 13:28:10 +0800 Subject: [PATCH] minor changes to fix the original failure to compile correctly Which might have worked, but now visual studio compiler crashes on ristretto.h modified: src/frame.cpp modified: src/ristretto255.h modified: src/stdafx.h --- src/frame.cpp | 2 +- src/ristretto255.h | 9 ++++++++- src/stdafx.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) 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"