forked from lthn/blockchain
CLSAG prototypes
This commit is contained in:
parent
74f6ce33ac
commit
26f34edc83
3 changed files with 73 additions and 3 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include "crypto/crypto.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "crypto/range_proofs.h"
|
||||
#include "crypto/clsag.h"
|
||||
#include "boost_serialization_maps.h"
|
||||
|
||||
//
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
|
||||
namespace crypto
|
||||
{
|
||||
struct bpp_signature_serialized : public crypto::bpp_signature
|
||||
struct bpp_signature_serialized : public bpp_signature
|
||||
{
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(L)
|
||||
|
|
@ -51,7 +52,7 @@ namespace crypto
|
|||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
struct bppe_signature_serialized : public crypto::bppe_signature
|
||||
struct bppe_signature_serialized : public bppe_signature
|
||||
{
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(L)
|
||||
|
|
@ -77,7 +78,23 @@ namespace crypto
|
|||
BOOST_SERIALIZE(delta_2)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
}
|
||||
|
||||
struct CLSAG_GG_signature_serialized : public CLSAG_GG_signature
|
||||
{
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(c)
|
||||
FIELD((std::vector<scalar_t>&)(r))
|
||||
FIELD(K1)
|
||||
END_SERIALIZE()
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(c)
|
||||
BOOST_SERIALIZE((std::vector<scalar_t>&)(r))
|
||||
BOOST_SERIALIZE(K1)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
} // namespace crypto
|
||||
|
||||
BLOB_SERIALIZER(crypto::chacha8_iv);
|
||||
BLOB_SERIALIZER(crypto::hash);
|
||||
|
|
|
|||
19
src/crypto/clsag.cpp
Normal file
19
src/crypto/clsag.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) 2022 Zano Project
|
||||
// Copyright (c) 2022 sowle (val@zano.org, crypto.sowle@gmail.com)
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
//
|
||||
// This file contains implementation of CLSAG (s.a. https://eprint.iacr.org/2019/654.pdf by Goodel at el)
|
||||
//
|
||||
#include "clsag.h"
|
||||
|
||||
namespace crypto
|
||||
{
|
||||
|
||||
bool generate_CLSAG_GG(const hash& m, const std::vector<CLSAG_GG_input_ref_t>& ring, const point_t& pseudo_out_amount_commitment, const key_image& ki,
|
||||
const scalar_t& secret_x, const scalar_t& secret_f, CLSAG_GG_signature& sig)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace crypto
|
||||
34
src/crypto/clsag.h
Normal file
34
src/crypto/clsag.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2022 Zano Project
|
||||
// Copyright (c) 2022 sowle (val@zano.org, crypto.sowle@gmail.com)
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
//
|
||||
// This file contains implementation of CLSAG (s.a. https://eprint.iacr.org/2019/654.pdf by Goodel at el)
|
||||
//
|
||||
#pragma once
|
||||
#include "crypto-sugar.h"
|
||||
|
||||
namespace crypto
|
||||
{
|
||||
// GG stands for double layers (ring dimentions) both with respect to group element G
|
||||
struct CLSAG_GG_signature
|
||||
{
|
||||
scalar_t c;
|
||||
scalar_vec_t r; // size = size of the ring
|
||||
public_key K1; // auxiliary key image for layer 1
|
||||
};
|
||||
|
||||
|
||||
struct CLSAG_GG_input_ref_t
|
||||
{
|
||||
CLSAG_GG_input_ref_t(const public_key& stealth_address, const public_key& amount_commitment)
|
||||
: stealth_address(stealth_address), amount_commitment(amount_commitment) {}
|
||||
|
||||
const public_key& stealth_address;
|
||||
const public_key& amount_commitment;
|
||||
};
|
||||
|
||||
bool generate_CLSAG_GG(const hash& m, const std::vector<CLSAG_GG_input_ref_t>& ring, const point_t& pseudo_out_amount_commitment, const key_image& ki,
|
||||
const scalar_t& secret_x, const scalar_t& secret_f, CLSAG_GG_signature& sig);
|
||||
|
||||
} // namespace crypto
|
||||
Loading…
Add table
Reference in a new issue