PRCYCoin  2.0.0.7rc1
P2P Digital Currency
secp256k1_surjectionproof.h
Go to the documentation of this file.
1 #ifndef _SECP256K1_SURJECTIONPROOF_
2 #define _SECP256K1_SURJECTIONPROOF_
3 
4 #include "secp256k1_2.h"
5 #include "secp256k1_rangeproof.h"
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
12 #define SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS 256
13 
17 #define SECP256K1_SURJECTIONPROOF_SERIALIZATION_BYTES(n_inputs, n_used_inputs) \
18  (2 + (n_inputs + 7)/8 + 32 * (1 + (n_used_inputs)))
19 
21 #define SECP256K1_SURJECTIONPROOF_SERIALIZATION_BYTES_MAX \
22  SECP256K1_SURJECTIONPROOF_SERIALIZATION_BYTES(SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS, SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS)
23 
39 typedef struct {
40 #ifdef VERIFY
41 
42  int initialized;
43 #endif
44 
45  size_t n_inputs;
47  unsigned char used_inputs[SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS / 8];
49  unsigned char data[32 * (1 + SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS)];
51 
68  const secp256k1_context2* ctx,
70  const unsigned char *input,
71  size_t inputlen
73 
87  const secp256k1_context2* ctx,
88  unsigned char *output,
89  size_t *outputlen,
90  const secp256k1_surjectionproof *proof
92 
99 typedef struct {
100  unsigned char data[32];
102 
110  const secp256k1_context2* ctx,
111  const secp256k1_surjectionproof* proof
113 
121  const secp256k1_context2* ctx,
122  const secp256k1_surjectionproof* proof
124 
132  const secp256k1_context2* ctx,
133  const secp256k1_surjectionproof* proof
135 
158  const secp256k1_context2* ctx,
160  size_t *input_index,
161  const secp256k1_fixed_asset_tag* fixed_input_tags,
162  const size_t n_input_tags,
163  const size_t n_input_tags_to_use,
164  const secp256k1_fixed_asset_tag* fixed_output_tag,
165  const size_t n_max_iterations,
166  const unsigned char *random_seed32
168 
183  const secp256k1_context2* ctx,
185  const secp256k1_generator* ephemeral_input_tags,
186  size_t n_ephemeral_input_tags,
187  const secp256k1_generator* ephemeral_output_tag,
188  size_t input_index,
189  const unsigned char *input_blinding_key,
190  const unsigned char *output_blinding_key
192 
193 
205  const secp256k1_context2* ctx,
206  const secp256k1_surjectionproof* proof,
207  const secp256k1_generator* ephemeral_input_tags,
208  size_t n_ephemeral_input_tags,
209  const secp256k1_generator* ephemeral_output_tag
211 
212 #ifdef __cplusplus
213 }
214 #endif
215 
216 #endif
SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS
#define SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS
Maximum number of inputs that may be given in a surjection proof.
Definition: secp256k1_surjectionproof.h:12
SECP256K1_API
#define SECP256K1_API
Definition: secp256k1_2.h:139
secp256k1_surjectionproof_generate
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_surjectionproof_generate(const secp256k1_context2 *ctx, secp256k1_surjectionproof *proof, const secp256k1_generator *ephemeral_input_tags, size_t n_ephemeral_input_tags, const secp256k1_generator *ephemeral_output_tag, size_t input_index, const unsigned char *input_blinding_key, const unsigned char *output_blinding_key) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(7) SECP256K1_ARG_NONNULL(8)
Surjection proof generation function Returns 0: proof could not be created 1: proof was successfully ...
Definition: main_impl.h:211
secp256k1_generator
Opaque data structure that stores a base point.
Definition: secp256k1_generator.h:20
secp256k1_surjectionproof_verify
SECP256K1_API int secp256k1_surjectionproof_verify(const secp256k1_context2 *ctx, const secp256k1_surjectionproof *proof, const secp256k1_generator *ephemeral_input_tags, size_t n_ephemeral_input_tags, const secp256k1_generator *ephemeral_output_tag) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5)
Surjection proof verification function Returns 0: proof was invalid 1: proof was valid.
Definition: main_impl.h:292
secp256k1_rangeproof.h
SECP256K1_WARN_UNUSED_RESULT
#define SECP256K1_WARN_UNUSED_RESULT
Warning attributes NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out...
Definition: secp256k1.h:35
secp256k1_surjectionproof
Opaque data structure that holds a parsed surjection proof.
Definition: secp256k1_surjectionproof.h:39
secp256k1_surjectionproof_parse
SECP256K1_API int secp256k1_surjectionproof_parse(const secp256k1_context2 *ctx, secp256k1_surjectionproof *proof, const unsigned char *input, size_t inputlen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a surjection proof.
Definition: main_impl.h:38
secp256k1_surjectionproof_n_used_inputs
SECP256K1_API size_t secp256k1_surjectionproof_n_used_inputs(const secp256k1_context2 *ctx, const secp256k1_surjectionproof *proof) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Returns the actual number of inputs that a proof uses.
Definition: main_impl.h:101
secp256k1_surjectionproof_serialize
SECP256K1_API int secp256k1_surjectionproof_serialize(const secp256k1_context2 *ctx, unsigned char *output, size_t *outputlen, const secp256k1_surjectionproof *proof) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Serialize a surjection proof.
Definition: main_impl.h:69
secp256k1_context_struct2
Definition: secp256k1_types.h:15
secp256k1_2.h
SECP256K1_ARG_NONNULL
#define SECP256K1_ARG_NONNULL(_x)
Definition: secp256k1.h:40
secp256k1_surjectionproof_initialize
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_surjectionproof_initialize(const secp256k1_context2 *ctx, secp256k1_surjectionproof *proof, size_t *input_index, const secp256k1_fixed_asset_tag *fixed_input_tags, const size_t n_input_tags, const size_t n_input_tags_to_use, const secp256k1_fixed_asset_tag *fixed_output_tag, const size_t n_max_iterations, const unsigned char *random_seed32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(7)
Surjection proof initialization function; decides on inputs to use Returns 0: inputs could not be sel...
Definition: main_impl.h:154
secp256k1_surjectionproof_serialized_size
SECP256K1_API size_t secp256k1_surjectionproof_serialized_size(const secp256k1_context2 *ctx, const secp256k1_surjectionproof *proof) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Returns the total size this proof would take, in bytes, when serialized.
Definition: main_impl.h:108
secp256k1_fixed_asset_tag
Data structure that holds a fixed asset tag.
Definition: secp256k1_surjectionproof.h:99
secp256k1_surjectionproof_n_total_inputs
SECP256K1_API size_t secp256k1_surjectionproof_n_total_inputs(const secp256k1_context2 *ctx, const secp256k1_surjectionproof *proof) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Returns the total number of inputs a proof expects to be over.
Definition: main_impl.h:94
secp256k1_surjectionproof::n_inputs
size_t n_inputs
Total number of input asset tags.
Definition: secp256k1_surjectionproof.h:45