add crypto/generators for direct access to canonical fixed generators

This commit is contained in:
koe 2022-12-01 17:32:40 -06:00
parent 0a1eaf26f9
commit 16d17f6707
4 changed files with 258 additions and 0 deletions

View file

@ -32,8 +32,15 @@
#include <sstream>
#include <string>
extern "C"
{
#include "crypto/crypto-ops.h"
}
#include "crypto/generators.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_basic/merge_mining.h"
#include "ringct/rctOps.h"
#include "ringct/rctTypes.h"
namespace
{
@ -312,3 +319,20 @@ TEST(Crypto, tree_branch)
}
}
}
TEST(Crypto, generator_consistency)
{
// crypto/generators.h
const crypto::public_key G{crypto::get_G()};
const crypto::public_key H{crypto::get_H()};
const ge_p3 H_p3 = crypto::get_H_p3();
// crypto/crypto-ops.h
ASSERT_TRUE(memcmp(&H_p3, &ge_p3_H, sizeof(ge_p3)) == 0);
// ringct/rctOps.h
ASSERT_TRUE(memcmp(G.data, rct::G.bytes, 32) == 0);
// ringct/rctTypes.h
ASSERT_TRUE(memcmp(H.data, rct::H.bytes, 32) == 0);
}