Now it compiles, but still fails unit test
So, though it compiles, the hashing code is compiling to the wrong thing. I conclude that my investment in template coding has been excessive. It is time to switch to rust. Template coding contains too much logically incoherent and internally inconsistent backward compatibility making it fragile to subtle changes in the compiler.
This commit is contained in:
parent
0967d18cc4
commit
5a9296e529
@ -1,28 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
void randombytes_buf(std::span<byte> in) { randombytes_buf(&in[0], in.size_bytes()); }
|
void randombytes_buf(std::span<byte> in) { randombytes_buf(&in[0], in.size_bytes()); }
|
||||||
void randombytes_buf(std::span< char> 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<byte>& p, const std::span<byte>& 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<byte>& p, const std::span<byte>& q) {
|
|
||||||
bool breturn{ false };
|
|
||||||
for (auto xq = q.begin(); auto xp:p) {
|
|
||||||
if (xp != *xq++) {
|
|
||||||
breturn = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return breturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ristretto255 {
|
namespace ristretto255 {
|
||||||
bool scalar::constant_time_required{ true };
|
bool scalar::constant_time_required{ true };
|
||||||
bool point::constant_time_required{ true };
|
bool point::constant_time_required{ true };
|
||||||
|
@ -54,8 +54,6 @@
|
|||||||
|
|
||||||
void randombytes_buf(std::span<byte> in);
|
void randombytes_buf(std::span<byte> in);
|
||||||
void randombytes_buf(std::span<char > in);
|
void randombytes_buf(std::span<char > in);
|
||||||
bool operator !=(const std::span<byte>&, const std::span<byte>&);
|
|
||||||
bool operator ==(const std::span<byte>&, const std::span<byte>&);
|
|
||||||
namespace ro {
|
namespace ro {
|
||||||
|
|
||||||
// Decay to pointer is dangerously convenient,
|
// Decay to pointer is dangerously convenient,
|
||||||
@ -497,7 +495,7 @@ namespace ristretto255 {
|
|||||||
auto sj = ro::serialize(j);
|
auto sj = ro::serialize(j);
|
||||||
int i = crypto_generichash_blake2b_update(
|
int i = crypto_generichash_blake2b_update(
|
||||||
&u.st,
|
&u.st,
|
||||||
&sj[0],
|
(const unsigned char*)&sj[0],
|
||||||
sj.size()
|
sj.size()
|
||||||
);
|
);
|
||||||
if (i) throw HashReuseException();
|
if (i) throw HashReuseException();
|
||||||
|
@ -612,6 +612,28 @@ static bool TestShareSecretGenerationSpeed(void) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator ==(const std::span<byte>& p, const std::span<byte>& 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<byte>& p, const std::span<byte>& q) {
|
||||||
|
bool breturn{ false };
|
||||||
|
for (auto xq = q.begin(); auto xp:p) {
|
||||||
|
if (xp != *xq++) {
|
||||||
|
breturn = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return breturn;
|
||||||
|
}
|
||||||
|
|
||||||
static bool TestSignatures(void) {
|
static bool TestSignatures(void) {
|
||||||
try {
|
try {
|
||||||
ILogMessage("\tTest Schnorr signatures.");
|
ILogMessage("\tTest Schnorr signatures.");
|
||||||
|
Loading…
Reference in New Issue
Block a user