diff --git a/src/ristretto255.cpp b/src/ristretto255.cpp index 8e2e37c..620610a 100644 --- a/src/ristretto255.cpp +++ b/src/ristretto255.cpp @@ -1,28 +1,6 @@ #include "stdafx.h" void randombytes_buf(std::span in) { randombytes_buf(&in[0], in.size_bytes()); } void randombytes_buf(std::span< char> in) { randombytes_buf(&in[0], in.size_bytes()); } -bool operator ==(const std::span& p, const std::span& q) { - bool breturn{ true }; - for (auto xq = q.begin(); auto xp:p) { - if (xp != *xq++) { - breturn = false; - break; - } - } - return breturn; -} - -bool operator !=(const std::span& p, const std::span& q) { - bool breturn{ false }; - for (auto xq = q.begin(); auto xp:p) { - if (xp != *xq++) { - breturn = true; - break; - } - } - return breturn; -} - namespace ristretto255 { bool scalar::constant_time_required{ true }; bool point::constant_time_required{ true }; diff --git a/src/ristretto255.h b/src/ristretto255.h index 6ee40a4..1d98037 100644 --- a/src/ristretto255.h +++ b/src/ristretto255.h @@ -54,8 +54,6 @@ void randombytes_buf(std::span in); void randombytes_buf(std::span in); -bool operator !=(const std::span&, const std::span&); -bool operator ==(const std::span&, const std::span&); namespace ro { // Decay to pointer is dangerously convenient, @@ -497,7 +495,7 @@ namespace ristretto255 { auto sj = ro::serialize(j); int i = crypto_generichash_blake2b_update( &u.st, - &sj[0], + (const unsigned char*)&sj[0], sj.size() ); if (i) throw HashReuseException(); diff --git a/src/unit_test.cpp b/src/unit_test.cpp index dd473d1..ae8fb26 100644 --- a/src/unit_test.cpp +++ b/src/unit_test.cpp @@ -612,6 +612,28 @@ static bool TestShareSecretGenerationSpeed(void) { return true; } + bool operator ==(const std::span& p, const std::span& q) { + bool breturn{ true }; + for (auto xq = q.begin(); auto xp:p) { + if (xp != *xq++) { + breturn = false; + break; + } + } + return breturn; + } + + bool operator !=(const std::span& p, const std::span& q) { + bool breturn{ false }; + for (auto xq = q.begin(); auto xp:p) { + if (xp != *xq++) { + breturn = true; + break; + } + } + return breturn; + } + static bool TestSignatures(void) { try { ILogMessage("\tTest Schnorr signatures.");