Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Feb 8, 2024
1 parent ff07abe commit 5830697
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
37 changes: 0 additions & 37 deletions src/crypto/generators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ constexpr public_key G = bytes_to<public_key>({ 0x58, 0x66, 0x66, 0x66, 0x66, 0x
//pedersen commitment generator H: toPoint(cn_fast_hash(G))
constexpr public_key H = bytes_to<public_key>({ 0x8b, 0x65, 0x59, 0x70, 0x15, 0x37, 0x99, 0xaf, 0x2a, 0xea, 0xdc, 0x9f, 0xf1,
0xad, 0xd0, 0xea, 0x6c, 0x72, 0x51, 0xd5, 0x41, 0x54, 0xcf, 0xa9, 0x2c, 0x17, 0x3a, 0x0d, 0xd3, 0x9c, 0x1f, 0x94 });
<<<<<<< HEAD
static ge_p3 G_p3;
static ge_p3 H_p3;
static ge_cached G_cached;
static ge_cached H_cached;
=======
//seraphis generator X: keccak_to_pt(keccak("seraphis_X"))
constexpr public_key X = bytes_to<public_key>({ 0xa4, 0xfb, 0x43, 0xca, 0x69, 0x5e, 0x12, 0x99, 0x88, 0x02, 0xa2, 0x0a, 0x15,
0x8f, 0x12, 0xea, 0x79, 0x47, 0x4f, 0xb9, 0x01, 0x21, 0x16, 0x95, 0x6a, 0x69, 0x76, 0x7c, 0x4d, 0x41, 0x11, 0x0f });
Expand All @@ -94,14 +88,11 @@ static ge_cached X_cached;
static ge_cached U_cached;
//X25519 generator: x = 9
static const x25519_pubkey x25519_G{ mx25519_pubkey{ .data = { 9 } } };
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)

// misc
static std::once_flag init_gens_once_flag;

//-------------------------------------------------------------------------------------------------------------------
<<<<<<< HEAD
=======
// hash-to-point: H_p(x) = 8*point_from_bytes(keccak(x))
//-------------------------------------------------------------------------------------------------------------------
static void hash_to_point(const hash &x, crypto::ec_point &point_out)
Expand All @@ -118,7 +109,6 @@ static void hash_to_point(const hash &x, crypto::ec_point &point_out)
ge_p3_tobytes(to_bytes(point_out), &temp_p3);
}
//-------------------------------------------------------------------------------------------------------------------
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)
//-------------------------------------------------------------------------------------------------------------------
static public_key reproduce_generator_G()
{
Expand Down Expand Up @@ -162,8 +152,6 @@ static public_key reproduce_generator_H()
return reproduced_H;
}
//-------------------------------------------------------------------------------------------------------------------
<<<<<<< HEAD
=======
//-------------------------------------------------------------------------------------------------------------------
static public_key reproduce_generator_X()
{
Expand All @@ -188,7 +176,6 @@ static public_key reproduce_generator_U()
return reproduced_U;
}
//-------------------------------------------------------------------------------------------------------------------
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)
// Make generators, but only once
//-------------------------------------------------------------------------------------------------------------------
static void init_gens()
Expand All @@ -199,46 +186,31 @@ static void init_gens()
// sanity check the generators
static_assert(static_cast<unsigned char>(G.data[0]) == 0x58, "compile-time constant sanity check");
static_assert(static_cast<unsigned char>(H.data[0]) == 0x8b, "compile-time constant sanity check");
<<<<<<< HEAD
=======
static_assert(static_cast<unsigned char>(X.data[0]) == 0xa4, "compile-time constant sanity check");
static_assert(static_cast<unsigned char>(U.data[0]) == 0x10, "compile-time constant sanity check");
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)

// build ge_p3 representations of generators
const int G_deserialize = ge_frombytes_vartime(&G_p3, to_bytes(G));
const int H_deserialize = ge_frombytes_vartime(&H_p3, to_bytes(H));
<<<<<<< HEAD

(void)G_deserialize; assert(G_deserialize == 0);
(void)H_deserialize; assert(H_deserialize == 0);
=======
const int X_deserialize = ge_frombytes_vartime(&X_p3, to_bytes(X));
const int U_deserialize = ge_frombytes_vartime(&U_p3, to_bytes(U));

(void)G_deserialize; assert(G_deserialize == 0);
(void)H_deserialize; assert(H_deserialize == 0);
(void)X_deserialize; assert(X_deserialize == 0);
(void)U_deserialize; assert(U_deserialize == 0);
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)

// get cached versions
ge_p3_to_cached(&G_cached, &G_p3);
ge_p3_to_cached(&H_cached, &H_p3);
<<<<<<< HEAD
=======
ge_p3_to_cached(&X_cached, &X_p3);
ge_p3_to_cached(&U_cached, &U_p3);
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)

// in debug mode, check that generators are reproducible
(void)reproduce_generator_G; assert(reproduce_generator_G() == G);
(void)reproduce_generator_H; assert(reproduce_generator_H() == H);
<<<<<<< HEAD
=======
(void)reproduce_generator_X; assert(reproduce_generator_X() == X);
(void)reproduce_generator_U; assert(reproduce_generator_U() == U);
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)

});
}
Expand All @@ -253,8 +225,6 @@ public_key get_H()
return H;
}
//-------------------------------------------------------------------------------------------------------------------
<<<<<<< HEAD
=======
public_key get_X()
{
return X;
Expand All @@ -265,7 +235,6 @@ public_key get_U()
return U;
}
//-------------------------------------------------------------------------------------------------------------------
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)
ge_p3 get_G_p3()
{
init_gens();
Expand All @@ -278,8 +247,6 @@ ge_p3 get_H_p3()
return H_p3;
}
//-------------------------------------------------------------------------------------------------------------------
<<<<<<< HEAD
=======
ge_p3 get_X_p3()
{
init_gens();
Expand All @@ -292,7 +259,6 @@ ge_p3 get_U_p3()
return U_p3;
}
//-------------------------------------------------------------------------------------------------------------------
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)
ge_cached get_G_cached()
{
init_gens();
Expand All @@ -305,8 +271,6 @@ ge_cached get_H_cached()
return H_cached;
}
//-------------------------------------------------------------------------------------------------------------------
<<<<<<< HEAD
=======
ge_cached get_X_cached()
{
init_gens();
Expand All @@ -324,5 +288,4 @@ x25519_pubkey get_x25519_G()
return x25519_G;
}
//-------------------------------------------------------------------------------------------------------------------
>>>>>>> 0b10b7211 (seraphis mega squash commit [initial commit - 05/15/2023]; see seraphis_lib_hist_05_15_23 branch for commit history)
} //namespace crypto
2 changes: 1 addition & 1 deletion src/seraphis_crypto/sp_transcript.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class SpTranscriptBuilder final
std::enable_if_t<!std::is_unsigned<T>::value, bool> = true>
void append_impl(const boost::string_ref label, const T signed_integer)
{
using unsigned_type = std::make_unsigned<T>::type;
using unsigned_type = typename std::make_unsigned<T>::type;
static_assert(sizeof(unsigned_type) <= sizeof(std::uint64_t),
"SpTranscriptBuilder: unsupported signed integer type.");
this->append_label(label);
Expand Down

0 comments on commit 5830697

Please sign in to comment.