From 4ae6616a2b5f4b3886d92cb574b10c3109fedd89 Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 21 Feb 2023 01:37:42 +0100 Subject: [PATCH] crypto: linear composition proof stub --- src/common/crypto_serialization.h | 17 ++++++++++++++++- src/crypto/zarcanum.h | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/common/crypto_serialization.h b/src/common/crypto_serialization.h index 588deb69..2aef3cae 100644 --- a/src/common/crypto_serialization.h +++ b/src/common/crypto_serialization.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2022 Zano Project +// Copyright (c) 2014-2023 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Copyright (c) 2012-2013 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying @@ -152,6 +152,21 @@ namespace crypto END_BOOST_SERIALIZATION() }; + struct linear_composition_proof_s : public linear_composition_proof + { + BEGIN_SERIALIZE_OBJECT() + FIELD(c) + FIELD(y0) + FIELD(y1) + END_SERIALIZE() + + BEGIN_BOOST_SERIALIZATION() + BOOST_SERIALIZE(c) + BOOST_SERIALIZE(y0) + BOOST_SERIALIZE(y1) + END_BOOST_SERIALIZATION() + }; + } // namespace crypto diff --git a/src/crypto/zarcanum.h b/src/crypto/zarcanum.h index bfb20a53..ac517395 100644 --- a/src/crypto/zarcanum.h +++ b/src/crypto/zarcanum.h @@ -56,6 +56,30 @@ namespace crypto const zarcanum_proof& sig, uint8_t* p_err = nullptr); + // TODO @#@#: make sure it is used, implement, then move it to an appropriate place + struct linear_composition_proof + { + scalar_t c; + scalar_t y0; + scalar_t y1; + }; + + enum generator_tag { generator_tag_void = 0, generator_tag_G = 1, generator_tag_H = 2, generator_tag_H2 = 3, generator_tag_X = 4, generator_tag_U = 5 }; + + template + bool generate_linear_composition_proof(const hash& m, const public_key& A, const scalar_t& secret_a, const scalar_t& secret_b, linear_composition_proof& result, uint8_t* p_err = nullptr) + { + // consider embedding generators' tags into random entropy to distinguish proofs made with different generators during verification + return false; + } + + template + bool verify_linear_composition_proof(const hash& m, const public_key& A, const linear_composition_proof& sig, uint8_t* p_err = nullptr) + { + return false; + } + + // TODO: improve this proof using random weightning factor struct vector_UG_aggregation_proof