|
purify
C++ Purify implementation with native circuit and BPP support
|
C bridge that binds Purify's lightweight ABI to secp256k1-zkp internals and BPPP helpers.
#include "purify.h"#include "bppp_bridge.h"#include "purify/secp_bridge.h"#include <limits.h>#include <stdlib.h>#include <string.h>#include "third_party/secp256k1-zkp/include/secp256k1_extrakeys.h"#include "third_party/secp256k1-zkp/include/secp256k1_schnorrsig.h"#include "third_party/secp256k1-zkp/src/secp256k1.c"#include "third_party/secp256k1-zkp/src/precomputed_ecmult.c"#include "third_party/secp256k1-zkp/src/precomputed_ecmult_gen.c"#include "src/legacy_bulletproof/circuit_impl.h"Go to the source code of this file.
Data Structures | |
| struct | purify_secp_context |
| struct | purify_bulletproof_backend_resources |
| struct | purify_bppp_backend_resources |
| struct | purify_bppp_mutable_generators_guard |
| struct | purify_bppp_public_msm_data |
Macros | |
| #define | SECP256K1_BUILD |
| #define | ENABLE_MODULE_GENERATOR 1 |
| #define | ENABLE_MODULE_BPPP 1 |
| #define | ENABLE_MODULE_EXTRAKEYS 1 |
| #define | ENABLE_MODULE_SCHNORRSIG 1 |
| #define | PURIFY_BRIDGE_DECLASSIFY(data, size) |
Typedefs | |
| typedef struct purify_bppp_mutable_generators_guard | purify_bppp_mutable_generators_guard |
| typedef struct purify_bppp_public_msm_data | purify_bppp_public_msm_data |
Functions | |
| static void | purify_bridge_secure_clear (void *data, size_t size) |
| static int | purify_bridge_memeq_const (const unsigned char *lhs, const unsigned char *rhs, size_t size) |
| static secp256k1_context * | purify_context_handle (const purify_secp_context *context) |
| purify_secp_context * | purify_secp_context_create (void) |
| Creates one reusable secp256k1 context for the Purify bridge and public APIs. | |
| void | purify_secp_context_destroy (purify_secp_context *context) |
| Destroys a context returned by purify_secp_context_create. | |
| static void | purify_bridge_secure_clear_scratch_tail (secp256k1_scratch_space *scratch, size_t checkpoint) |
| size_t | purify_bulletproof_backend_resources_scratch_capacity (const purify_bulletproof_backend_resources *resources) |
| static int | purify_bridge_checked_mul_size (size_t lhs, size_t rhs, size_t *out) |
| static int | purify_bridge_checked_add_size (size_t lhs, size_t rhs, size_t *out) |
| static void | purify_bridge_secure_free_array (void *data, size_t count, size_t elem_size) |
| static int | purify_bulletproof_add_scratch_frame (size_t *total, size_t bytes, size_t objects) |
| static secp256k1_scratch_space * | purify_bppp_create_scratch (const secp256k1_context *ctx, size_t generators_count) |
| static int | purify_bulletproof_circuit_scratch_size (const secp256k1_bulletproof_circuit *circuit, size_t *out) |
| static int | purify_bulletproof_reserve_circuit_scratch (purify_bulletproof_backend_resources *resources, const secp256k1_bulletproof_circuit *circuit) |
| static void * | purify_malloc_array (size_t count, size_t elem_size) |
| static void * | purify_calloc_array (size_t count, size_t elem_size) |
| static secp256k1_bppp_generators * | purify_bppp_generators_clone (const secp256k1_bppp_generators *generators) |
| static int | purify_bppp_backend_resources_reset_scratch_gens (purify_bppp_backend_resources *resources) |
| static secp256k1_bppp_generators * | purify_bppp_backend_resources_acquire_scratch_gens (purify_bppp_backend_resources *resources, purify_bppp_mutable_generators_guard *guard) |
| static void | purify_bppp_backend_resources_release_scratch_gens (purify_bppp_mutable_generators_guard *guard) |
| purify_bulletproof_backend_resources * | purify_bulletproof_backend_resources_create (purify_secp_context *context, size_t n_gates) |
| purify_bulletproof_backend_resources * | purify_bulletproof_backend_resources_clone (const purify_bulletproof_backend_resources *resources) |
| void | purify_bulletproof_backend_resources_destroy (purify_bulletproof_backend_resources *resources) |
| purify_bppp_backend_resources * | purify_bppp_backend_resources_create (purify_secp_context *context, const unsigned char *generators33, size_t generators_count) |
| purify_bppp_backend_resources * | purify_bppp_backend_resources_clone (const purify_bppp_backend_resources *resources) |
| void | purify_bppp_backend_resources_destroy (purify_bppp_backend_resources *resources) |
| static secp256k1_scalar * | purify_scalar_cast (purify_scalar *scalar) |
| static const secp256k1_scalar * | purify_scalar_cast_const (const purify_scalar *scalar) |
| void | purify_scalar_set_int (purify_scalar *out, unsigned int value) |
| Initializes a scalar from an unsigned integer. | |
| void | purify_scalar_set_u64 (purify_scalar *out, uint64_t value) |
| Initializes a scalar from a 64-bit unsigned integer. | |
| void | purify_scalar_set_b32 (purify_scalar *out, const unsigned char input32[32], int *overflow) |
| Parses a big-endian 32-byte scalar. | |
| void | purify_scalar_get_b32 (unsigned char output32[32], const purify_scalar *value) |
| Serializes a scalar as 32 big-endian bytes. | |
| int | purify_scalar_is_zero (const purify_scalar *value) |
| Returns nonzero when the scalar is zero. | |
| int | purify_scalar_is_one (const purify_scalar *value) |
| Returns nonzero when the scalar is one. | |
| int | purify_scalar_is_even (const purify_scalar *value) |
| Returns nonzero when the scalar is even. | |
| int | purify_scalar_eq (const purify_scalar *lhs, const purify_scalar *rhs) |
| Returns nonzero when two scalars are equal. | |
| void | purify_scalar_negate (purify_scalar *out, const purify_scalar *value) |
| Computes the additive inverse of a scalar. | |
| void | purify_scalar_inverse (purify_scalar *out, const purify_scalar *value) |
| Computes the multiplicative inverse of a scalar in constant time. | |
| void | purify_scalar_inverse_var (purify_scalar *out, const purify_scalar *value) |
| Computes the multiplicative inverse of a scalar. | |
| int | purify_scalar_add (purify_scalar *out, const purify_scalar *lhs, const purify_scalar *rhs) |
| Adds two scalars modulo the backend field. | |
| void | purify_scalar_mul (purify_scalar *out, const purify_scalar *lhs, const purify_scalar *rhs) |
| Multiplies two scalars modulo the backend field. | |
| void | purify_scalar_cmov (purify_scalar *dst, const purify_scalar *src, int flag) |
| Conditionally assigns src into dst when flag is nonzero. | |
| void | purify_sha256 (unsigned char output32[32], const unsigned char *data, size_t data_len) |
| Computes SHA-256 over a byte string. | |
| int | purify_sha256_many (unsigned char output32[32], const unsigned char *const *items, const size_t *item_lens, size_t items_count) |
| Computes SHA-256 over a set of byte strings. | |
| void | purify_hmac_sha256 (unsigned char output32[32], const unsigned char *key, size_t key_len, const unsigned char *data, size_t data_len) |
| Computes HMAC-SHA256 over a byte string. | |
| static int | purify_bip340_canonicalize_scalar (const secp256k1_context *ctx, unsigned char scalar32[32], unsigned char xonly_pubkey32[32]) |
| int | purify_bip340_key_from_seckey (purify_secp_context *context, unsigned char seckey32[32], unsigned char xonly_pubkey32[32]) |
| Canonicalizes a valid secp256k1 secret key for BIP340 and derives its x-only public key. | |
| int | purify_bip340_nonce_from_scalar (purify_secp_context *context, unsigned char scalar32[32], unsigned char xonly_nonce32[32]) |
| Canonicalizes a valid secp256k1 nonce scalar for BIP340 and derives its x-only public nonce. | |
| int | purify_bip340_xonly_from_point (purify_secp_context *context, const unsigned char point33[33], unsigned char xonly32[32], int *parity_out) |
| Converts a compressed secp256k1 point into its x-only public key encoding. | |
| int | purify_bip340_validate_xonly_pubkey (purify_secp_context *context, const unsigned char xonly_pubkey32[32]) |
| Returns nonzero when the x-only public key encoding parses successfully. | |
| int | purify_bip340_validate_signature (purify_secp_context *context, const unsigned char sig64[64]) |
| Returns nonzero when the 64-byte BIP340 signature has a syntactically valid encoding. | |
| static int | purify_fixed_nonce_function (unsigned char *nonce32, const unsigned char *msg, size_t msglen, const unsigned char *key32, const unsigned char *xonly_pk32, const unsigned char *algo, size_t algolen, void *data) |
| int | purify_bip340_sign_with_fixed_nonce (purify_secp_context *context, unsigned char sig64[64], const unsigned char *msg, size_t msglen, const unsigned char seckey32[32], const unsigned char nonce32[32]) |
| Signs a message with a caller-supplied BIP340 nonce scalar. | |
| int | purify_bip340_verify (purify_secp_context *context, const unsigned char sig64[64], const unsigned char *msg, size_t msglen, const unsigned char xonly_pubkey32[32]) |
| Verifies a BIP340 signature against a serialized x-only public key. | |
| static int | purify_parse_scalar (const unsigned char input32[32], secp256k1_scalar *scalar, int reject_zero) |
| static int | purify_parse_scalar_array (const unsigned char *input32, size_t count, secp256k1_scalar *out) |
| static int | purify_serialize_point (unsigned char out33[33], secp256k1_ge *point) |
| static int | purify_parse_fast_scalar (const unsigned char input32[32], secp256k1_fast_scalar *scalar) |
| static int | purify_parse_generator_as_ge (const secp256k1_context *ctx, const unsigned char generator33[33], secp256k1_ge *out) |
| static int | purify_parse_point_as_ge (const unsigned char point33[33], secp256k1_ge *out) |
| static void | purify_free_bulletproof_circuit (secp256k1_bulletproof_circuit *circuit) |
| static void | purify_free_bulletproof_assignment (secp256k1_bulletproof_circuit_assignment *assignment) |
| static size_t | purify_total_row_entries (const purify_bulletproof_row_view *rows, size_t count, int *ok) |
| static int | purify_build_row_family (secp256k1_bulletproof_wmatrix_row *out_rows, size_t row_count, const purify_bulletproof_row_view *in_rows, size_t n_constraints, secp256k1_bulletproof_wmatrix_entry *entries, size_t *offset) |
| static void | purify_bulletproof_circuit_evaluate_sum_row (secp256k1_scalar *acc, const secp256k1_bulletproof_wmatrix_row *row, const secp256k1_scalar *assn) |
| static int | purify_bulletproof_circuit_evaluate (const secp256k1_bulletproof_circuit *circuit, const secp256k1_bulletproof_circuit_assignment *assignment) |
| static int | purify_build_bulletproof_circuit (const purify_bulletproof_circuit_view *view, secp256k1_bulletproof_circuit *out) |
| static int | purify_build_bulletproof_assignment (const purify_bulletproof_assignment_view *view, secp256k1_bulletproof_circuit_assignment *out) |
| size_t | purify_bulletproof_required_proof_size (size_t n_gates) |
| static int | purify_bulletproof_prove_circuit_impl (const purify_bulletproof_circuit_view *circuit, const purify_bulletproof_assignment_view *assignment, const unsigned char *blinds32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char *commitments_out33, unsigned char *proof_out, size_t *proof_len, int require_valid_assignment, purify_secp_context *context, purify_bulletproof_backend_resources *resources) |
| int | purify_bulletproof_prove_circuit (purify_secp_context *context, const purify_bulletproof_circuit_view *circuit, const purify_bulletproof_assignment_view *assignment, const unsigned char *blinds32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char *commitments_out33, unsigned char *proof_out, size_t *proof_len) |
| int | purify_bulletproof_prove_circuit_with_resources (purify_bulletproof_backend_resources *resources, const purify_bulletproof_circuit_view *circuit, const purify_bulletproof_assignment_view *assignment, const unsigned char *blinds32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char *commitments_out33, unsigned char *proof_out, size_t *proof_len) |
| int | purify_bulletproof_prove_circuit_assume_valid (purify_secp_context *context, const purify_bulletproof_circuit_view *circuit, const purify_bulletproof_assignment_view *assignment, const unsigned char *blinds32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char *commitments_out33, unsigned char *proof_out, size_t *proof_len) |
| int | purify_bulletproof_prove_circuit_assume_valid_with_resources (purify_bulletproof_backend_resources *resources, const purify_bulletproof_circuit_view *circuit, const purify_bulletproof_assignment_view *assignment, const unsigned char *blinds32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char *commitments_out33, unsigned char *proof_out, size_t *proof_len) |
| static int | purify_bulletproof_verify_circuit_impl (purify_secp_context *context, purify_bulletproof_backend_resources *resources, const purify_bulletproof_circuit_view *circuit, const unsigned char *commitments33, const unsigned char value_gen33[33], const unsigned char *extra_commit, size_t extra_commit_len, const unsigned char *proof, size_t proof_len) |
| int | purify_bulletproof_verify_circuit (purify_secp_context *context, const purify_bulletproof_circuit_view *circuit, const unsigned char *commitments33, const unsigned char value_gen33[33], const unsigned char *extra_commit, size_t extra_commit_len, const unsigned char *proof, size_t proof_len) |
| int | purify_bulletproof_verify_circuit_with_resources (purify_bulletproof_backend_resources *resources, const purify_bulletproof_circuit_view *circuit, const unsigned char *commitments33, const unsigned char value_gen33[33], const unsigned char *extra_commit, size_t extra_commit_len, const unsigned char *proof, size_t proof_len) |
| static int | purify_norm_arg_public_digest (unsigned char digest[32], const secp256k1_scalar *rho, const secp256k1_bppp_generators *gens_vec, size_t g_len, const secp256k1_scalar *c_vec, size_t c_vec_len) |
| static int | purify_norm_arg_commit_initial_data (secp256k1_sha256 *transcript, const secp256k1_scalar *rho, const secp256k1_bppp_generators *gens_vec, size_t g_len, const secp256k1_scalar *c_vec, size_t c_vec_len, const secp256k1_ge *commit) |
| static int | purify_copy_vectors_into_scratch (const secp256k1_context *ctx, secp256k1_scratch_space *scratch, secp256k1_scalar **ns, secp256k1_scalar **ls, secp256k1_scalar **cs, secp256k1_ge **gs, const secp256k1_scalar *n_vec, const secp256k1_scalar *l_vec, const secp256k1_scalar *c_vec, const secp256k1_ge *gens_vec, size_t g_len, size_t h_len) |
| static void | purify_ge_cmov (secp256k1_ge *r, const secp256k1_ge *a, int flag) |
| static void | purify_gej_add_secret_scalar_term (secp256k1_gej *accumulator, const secp256k1_ge *point, const secp256k1_scalar *scalar) |
| static int | purify_ecmult_multi_secret (const secp256k1_context *ctx, secp256k1_gej *result, const secp256k1_scalar *base_scalar, secp256k1_ecmult_multi_callback callback, void *callback_data, size_t point_count) |
| static void | purify_scalar_inner_product_secret (secp256k1_scalar *result, const secp256k1_scalar *lhs, size_t lhs_offset, const secp256k1_scalar *rhs, size_t rhs_offset, size_t step, size_t length) |
| static void | purify_weighted_scalar_inner_product_secret (secp256k1_scalar *result, const secp256k1_scalar *lhs, size_t lhs_offset, const secp256k1_scalar *rhs, size_t rhs_offset, size_t step, size_t length, const secp256k1_scalar *weight) |
| static int | purify_bppp_commit_secret (const secp256k1_context *ctx, secp256k1_ge *commit, const secp256k1_bppp_generators *generators, const secp256k1_scalar *n_vec, size_t n_vec_len, const secp256k1_scalar *l_vec, size_t l_vec_len, const secp256k1_scalar *c_vec, size_t c_vec_len, const secp256k1_scalar *mu) |
| static int | purify_bppp_rangeproof_norm_product_prove_secret (const secp256k1_context *ctx, unsigned char *proof, size_t *proof_len, secp256k1_sha256 *transcript, const secp256k1_scalar *rho, secp256k1_ge *g_vec, size_t g_vec_len, secp256k1_scalar *n_vec, size_t n_vec_len, secp256k1_scalar *l_vec, size_t l_vec_len, secp256k1_scalar *c_vec, size_t c_vec_len, purify_bppp_round_challenge_callback challenge_callback, void *callback_data) |
| static int | purify_bppp_rangeproof_norm_product_prove_with_copied_inputs (const secp256k1_context *ctx, secp256k1_scratch_space *scratch, unsigned char *proof, size_t *proof_len, secp256k1_sha256 *transcript, const secp256k1_scalar *rho, const secp256k1_ge *g_vec, size_t g_vec_len, const secp256k1_scalar *n_vec, size_t n_vec_len, const secp256k1_scalar *l_vec, size_t l_vec_len, const secp256k1_scalar *c_vec, size_t c_vec_len, size_t secure_clear_checkpoint, purify_bppp_round_challenge_callback challenge_callback, void *callback_data) |
| size_t | purify_bppp_required_proof_size (size_t n_vec_len, size_t c_vec_len) |
| Computes the maximum serialized size of a BPPP norm proof. | |
| int | purify_bppp_base_generator (purify_secp_context *context, unsigned char out33[33]) |
| Serializes the secp256k1 base generator into compressed form. | |
| int | purify_bppp_value_generator_h (purify_secp_context *context, unsigned char out33[33]) |
| Serializes the alternate value generator used by Pedersen commitments. | |
| int | purify_bppp_create_generators (purify_secp_context *context, size_t count, unsigned char *out, size_t *out_len) |
| Expands the generator list required by the BPPP prover and verifier. | |
| int | purify_bppp_scale_generator (purify_secp_context *context, const unsigned char generator33[33], const unsigned char scalar32[32], unsigned char out33[33]) |
| int | purify_bppp_generator_to_point (purify_secp_context *context, const unsigned char generator33[33], unsigned char out33[33]) |
| int | purify_pedersen_commit_char (purify_secp_context *context, const unsigned char blind32[32], const unsigned char value32[32], const unsigned char value_gen33[33], const unsigned char blind_gen33[33], unsigned char commitment_out33[33]) |
| Computes a Pedersen commitment to an arbitrary 32-byte scalar value. | |
| static int | purify_bppp_commit_norm_arg_impl (purify_secp_context *context, purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, unsigned char commitment_out33[33]) |
| int | purify_bppp_commit_norm_arg (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, unsigned char commitment_out33[33]) |
| int | purify_bppp_commit_norm_arg_with_resources (purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, unsigned char commitment_out33[33]) |
| static int | purify_bppp_commit_witness_only_impl (purify_secp_context *context, purify_bppp_backend_resources *resources, const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, unsigned char commitment_out33[33]) |
| int | purify_bppp_commit_witness_only (purify_secp_context *context, const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, unsigned char commitment_out33[33]) |
| int | purify_bppp_commit_witness_only_with_resources (purify_bppp_backend_resources *resources, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, unsigned char commitment_out33[33]) |
| int | purify_bppp_offset_commitment (purify_secp_context *context, const unsigned char commitment33[33], const unsigned char scalar32[32], unsigned char commitment_out33[33]) |
| int | purify_point_scale (purify_secp_context *context, const unsigned char point33[33], const unsigned char scalar32[32], unsigned char out33[33]) |
| int | purify_point_add (purify_secp_context *context, const unsigned char lhs33[33], const unsigned char rhs33[33], unsigned char out33[33]) |
| int | purify_point_add_allow_infinity (purify_secp_context *context, const unsigned char lhs33[33], const unsigned char rhs33[33], unsigned char out33[33]) |
| int | purify_point_subtract_allow_infinity (purify_secp_context *context, const unsigned char lhs33[33], const unsigned char rhs33[33], unsigned char out33[33]) |
| static int | purify_bppp_prove_norm_arg_impl (purify_secp_context *context, purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, unsigned char commitment_out33[33], unsigned char *proof_out, size_t *proof_len) |
| int | purify_bppp_prove_norm_arg (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, unsigned char commitment_out33[33], unsigned char *proof_out, size_t *proof_len) |
| Produces a standalone BPPP norm argument. | |
| int | purify_bppp_prove_norm_arg_with_resources (purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, unsigned char commitment_out33[33], unsigned char *proof_out, size_t *proof_len) |
| static int | purify_bppp_prove_norm_arg_to_commitment_impl (purify_secp_context *context, purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, const unsigned char commitment33[33], unsigned char *proof_out, size_t *proof_len, purify_bppp_round_challenge_callback challenge_callback, void *callback_data) |
| int | purify_bppp_prove_norm_arg_to_commitment (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, const unsigned char commitment33[33], unsigned char *proof_out, size_t *proof_len) |
| int | purify_bppp_prove_norm_arg_to_commitment_with_resources (purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, const unsigned char commitment33[33], unsigned char *proof_out, size_t *proof_len) |
| int | purify_bppp_prove_norm_arg_to_commitment_with_callback (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *n_vec32, size_t n_vec_len, const unsigned char *l_vec32, size_t l_vec_len, const unsigned char *c_vec32, size_t c_vec_len, const unsigned char commitment33[33], purify_bppp_round_challenge_callback challenge_callback, void *callback_data, unsigned char *proof_out, size_t *proof_len) |
| static int | purify_bppp_rangeproof_norm_product_verify_challenges (const secp256k1_context *ctx, secp256k1_scratch_space *scratch, const unsigned char *proof, size_t proof_len, const secp256k1_scalar *rho, const secp256k1_bppp_generators *g_vec, size_t g_len, const secp256k1_scalar *c_vec, size_t c_vec_len, const secp256k1_ge *commit, const secp256k1_scalar *gammas, size_t gamma_count) |
| static int | purify_bppp_verify_norm_arg_impl (purify_secp_context *context, purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len, const unsigned char *gammas32, size_t gamma_count) |
| int | purify_bppp_verify_norm_arg (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len) |
| Verifies a standalone BPPP norm argument. | |
| int | purify_bppp_verify_norm_arg_with_resources (purify_bppp_backend_resources *resources, const unsigned char rho32[32], const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len) |
| int | purify_bppp_verify_norm_arg_with_challenges (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len, const unsigned char *gammas32, size_t gamma_count) |
| static int | purify_bppp_prepare_norm_arg_claim_impl (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len, const unsigned char *supplied_gammas32, unsigned char *derived_gammas32, size_t gamma_count, unsigned char terminal_n32[32], unsigned char terminal_l32[32], unsigned char residual33[33]) |
| int | purify_bppp_prepare_norm_arg_claim (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len, unsigned char terminal_n32[32], unsigned char terminal_l32[32], unsigned char *gammas32, size_t gamma_count, unsigned char residual33[33]) |
| int | purify_bppp_prepare_norm_arg_claim_with_challenges (purify_secp_context *context, const unsigned char rho32[32], const unsigned char *generators33, size_t generators_count, const unsigned char *c_vec32, size_t c_vec_len, size_t n_vec_len, const unsigned char commitment33[33], const unsigned char *proof, size_t proof_len, const unsigned char *gammas32, size_t gamma_count, unsigned char terminal_n32[32], unsigned char terminal_l32[32], unsigned char residual33[33]) |
| int | purify_bppp_generators_to_points (purify_secp_context *context, const unsigned char *generators33, size_t generators_count, unsigned char *points_out33) |
| static int | purify_bppp_public_msm_cb (secp256k1_scalar *scalar, secp256k1_ge *point, size_t index, void *data_ptr) |
| int | purify_bppp_public_msm (purify_secp_context *context, const unsigned char *points33, const unsigned char *scalars32, size_t count, unsigned char out33[33]) |
| int | purify_bppp_public_point_validate (const unsigned char point33[33]) |
| int | purify_bppp_public_hash_to_point (purify_secp_context *context, const unsigned char *input, size_t input_len, unsigned char out33[33]) |
Variables | |
| static const size_t | purify_bulletproof_msm_scratch_size = (size_t)1u << 24 |
| #define ENABLE_MODULE_BPPP 1 |
Definition at line 12 of file bppp_bridge.c.
| #define ENABLE_MODULE_EXTRAKEYS 1 |
Definition at line 13 of file bppp_bridge.c.
| #define ENABLE_MODULE_GENERATOR 1 |
Definition at line 11 of file bppp_bridge.c.
| #define ENABLE_MODULE_SCHNORRSIG 1 |
Definition at line 14 of file bppp_bridge.c.
| #define PURIFY_BRIDGE_DECLASSIFY | ( | data, | |
| size ) |
Definition at line 30 of file bppp_bridge.c.
Referenced by purify_bppp_commit_secret(), purify_bppp_commit_witness_only_impl(), purify_bppp_offset_commitment(), purify_bppp_rangeproof_norm_product_prove_secret(), purify_pedersen_commit_char(), and purify_point_scale().
| #define SECP256K1_BUILD |
Definition at line 10 of file bppp_bridge.c.
| typedef struct purify_bppp_mutable_generators_guard purify_bppp_mutable_generators_guard |
| typedef struct purify_bppp_public_msm_data purify_bppp_public_msm_data |
|
static |
Definition at line 675 of file bppp_bridge.c.
References purify_bridge_secure_clear().
Referenced by purify_bip340_key_from_seckey(), and purify_bip340_nonce_from_scalar().
| int purify_bip340_key_from_seckey | ( | purify_secp_context * | context, |
| unsigned char | seckey32[32], | ||
| unsigned char | xonly_pubkey32[32] ) |
The input/output seckey32 buffer is rewritten in place to the even-Y canonical secret scalar corresponding to the returned x-only public key. Returns zero when the input scalar is invalid.
Definition at line 705 of file bppp_bridge.c.
References purify_bip340_canonicalize_scalar(), purify_bridge_secure_clear(), and purify_context_handle().
Referenced by purify::accountable::AnchorPunishmentKey::from_secret(), and purify_derive_bip340_key().
| int purify_bip340_nonce_from_scalar | ( | purify_secp_context * | context, |
| unsigned char | scalar32[32], | ||
| unsigned char | xonly_nonce32[32] ) |
The input/output scalar32 buffer is rewritten in place to the even-Y representative corresponding to the returned x-only public nonce. Returns zero when the input scalar is invalid or zero.
Definition at line 728 of file bppp_bridge.c.
References purify_bip340_canonicalize_scalar(), purify_bridge_secure_clear(), and purify_context_handle().
Referenced by purify_bip340_sign_with_fixed_nonce().
| int purify_bip340_sign_with_fixed_nonce | ( | purify_secp_context * | context, |
| unsigned char | sig64[64], | ||
| const unsigned char * | msg, | ||
| size_t | msglen, | ||
| const unsigned char | seckey32[32], | ||
| const unsigned char | nonce32[32] ) |
seckey32 must be a valid secp256k1 secret key. nonce32 must be a non-zero canonical nonce scalar whose public point has even Y, for example the output of purify_bip340_nonce_from_scalar. Returns zero when any input is invalid.
Definition at line 855 of file bppp_bridge.c.
References purify_bip340_nonce_from_scalar(), purify_bridge_memeq_const(), purify_bridge_secure_clear(), purify_context_handle(), and purify_fixed_nonce_function().
Referenced by purify::puresign::PreparedNonce::sign_message(), purify::puresign_plusplus::PreparedNonce::sign_message(), purify::puresign::PreparedNonce::sign_topic_message(), and purify::puresign_plusplus::PreparedNonce::sign_topic_message().
| int purify_bip340_validate_signature | ( | purify_secp_context * | context, |
| const unsigned char | sig64[64] ) |
This only checks the standalone encoding shape (r as a valid x-only point and s as a scalar below the curve order). It does not verify the signature against a message or public key.
Definition at line 810 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
Referenced by purify::puresign::Signature::deserialize(), purify::puresign_plusplus::Signature::deserialize(), purify::puresign::api_impl::verify_signature(), and purify::puresign_plusplus::api_impl::verify_signature().
| int purify_bip340_validate_xonly_pubkey | ( | purify_secp_context * | context, |
| const unsigned char | xonly_pubkey32[32] ) |
Definition at line 793 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
Referenced by purify::accountable::SigningRoster::aggregate(), purify::bppp::candidate::CircuitProofTranscriptV4::append_public_opening(), purify::accountable::AnchorPunishmentPublicKey::create(), purify::puresign::Nonce::deserialize(), purify::puresign::PublicKey::deserialize(), purify::puresign_plusplus::Nonce::deserialize(), purify::puresign_plusplus::NonceProof::deserialize(), purify::puresign_plusplus::PublicKey::deserialize(), purify::puresign::api_impl::verify_signature(), and purify::puresign_plusplus::api_impl::verify_signature().
| int purify_bip340_verify | ( | purify_secp_context * | context, |
| const unsigned char | sig64[64], | ||
| const unsigned char * | msg, | ||
| size_t | msglen, | ||
| const unsigned char | xonly_pubkey32[32] ) |
Definition at line 907 of file bppp_bridge.c.
References purify_context_handle().
Referenced by purify::puresign::PreparedNonce::sign_message(), purify::puresign_plusplus::PreparedNonce::sign_message(), purify::puresign::PreparedNonce::sign_topic_message(), purify::puresign_plusplus::PreparedNonce::sign_topic_message(), purify::puresign::api_impl::verify_signature(), and purify::puresign_plusplus::api_impl::verify_signature().
| int purify_bip340_xonly_from_point | ( | purify_secp_context * | context, |
| const unsigned char | point33[33], | ||
| unsigned char | xonly32[32], | ||
| int * | parity_out ) |
Returns zero when the point encoding is invalid. When parity_out is not null it receives the original point parity as returned by secp256k1_xonly_pubkey_from_pubkey (0 for even Y, 1 for odd Y).
Definition at line 751 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
|
static |
Definition at line 337 of file bppp_bridge.c.
References purify_bppp_backend_resources::gens_scratch, purify_bppp_backend_resources::gens_scratch_in_use, purify_bppp_backend_resources_reset_scratch_gens(), and purify_bppp_mutable_generators_guard::resources.
Referenced by purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_impl().
| purify_bppp_backend_resources * purify_bppp_backend_resources_clone | ( | const purify_bppp_backend_resources * | resources | ) |
Definition at line 485 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, purify_bppp_backend_resources::gens_scratch, purify_bppp_backend_resources_destroy(), purify_bppp_create_scratch(), purify_bppp_generators_clone(), purify_bridge_checked_mul_size(), purify_malloc_array(), and purify_bppp_backend_resources::scratch.
Referenced by purify::bppp::ExperimentalCircuitCache::clone_line_for_thread().
| purify_bppp_backend_resources * purify_bppp_backend_resources_create | ( | purify_secp_context * | context, |
| const unsigned char * | generators33, | ||
| size_t | generators_count ) |
Definition at line 441 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, purify_bppp_backend_resources::gens_scratch, purify_bppp_backend_resources_destroy(), purify_bppp_create_scratch(), purify_bridge_checked_mul_size(), purify_context_handle(), purify_malloc_array(), and purify_bppp_backend_resources::scratch.
| void purify_bppp_backend_resources_destroy | ( | purify_bppp_backend_resources * | resources | ) |
Definition at line 523 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::gens, purify_bppp_backend_resources::gens_scratch, purify_bridge_secure_clear_scratch_tail(), and purify_bppp_backend_resources::scratch.
Referenced by purify::bppp::BpppBackendResourcesDeleter::operator()(), purify_bppp_backend_resources_clone(), and purify_bppp_backend_resources_create().
|
static |
Definition at line 351 of file bppp_bridge.c.
References purify_bppp_backend_resources::gens_scratch_in_use, and purify_bppp_mutable_generators_guard::resources.
Referenced by purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_impl().
|
static |
Definition at line 323 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, purify_bppp_backend_resources::gens_scratch, and purify_bridge_checked_mul_size().
Referenced by purify_bppp_backend_resources_acquire_scratch_gens().
| int purify_bppp_base_generator | ( | purify_secp_context * | context, |
| unsigned char | out33[33] ) |
Definition at line 2159 of file bppp_bridge.c.
References purify_context_handle().
Referenced by purify::bppp::base_generator().
| int purify_bppp_commit_norm_arg | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| unsigned char | commitment_out33[33] ) |
Definition at line 2390 of file bppp_bridge.c.
References purify_bppp_commit_norm_arg_impl().
Referenced by purify::bppp::commit_norm_arg_with_cache().
|
static |
Definition at line 2311 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, purify_bppp_commit_secret(), purify_bppp_create_scratch(), purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_bridge_secure_clear(), purify_bridge_secure_clear_scratch_tail(), purify_bridge_secure_free_array(), purify_context_handle(), purify_malloc_array(), purify_parse_scalar(), purify_parse_scalar_array(), purify_serialize_point(), and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_commit_norm_arg(), and purify_bppp_commit_norm_arg_with_resources().
| int purify_bppp_commit_norm_arg_with_resources | ( | purify_bppp_backend_resources * | resources, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| unsigned char | commitment_out33[33] ) |
Definition at line 2399 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, and purify_bppp_commit_norm_arg_impl().
Referenced by purify::bppp::commit_norm_arg_with_cache().
|
static |
Definition at line 1833 of file bppp_bridge.c.
References PURIFY_BRIDGE_DECLASSIFY, purify_bridge_secure_clear(), purify_ecmult_multi_secret(), purify_scalar_inner_product_secret(), and purify_weighted_scalar_inner_product_secret().
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_impl().
| int purify_bppp_commit_witness_only | ( | purify_secp_context * | context, |
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| unsigned char | commitment_out33[33] ) |
Definition at line 2496 of file bppp_bridge.c.
References purify_bppp_commit_witness_only_impl().
|
static |
Definition at line 2411 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, purify_bppp_create_scratch(), purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), PURIFY_BRIDGE_DECLASSIFY, purify_bridge_secure_clear(), purify_bridge_secure_clear_scratch_tail(), purify_bridge_secure_free_array(), purify_context_handle(), purify_ecmult_multi_secret(), purify_malloc_array(), purify_parse_scalar_array(), purify_serialize_point(), and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_commit_witness_only(), and purify_bppp_commit_witness_only_with_resources().
| int purify_bppp_commit_witness_only_with_resources | ( | purify_bppp_backend_resources * | resources, |
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| unsigned char | commitment_out33[33] ) |
Definition at line 2504 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, and purify_bppp_commit_witness_only_impl().
| int purify_bppp_create_generators | ( | purify_secp_context * | context, |
| size_t | count, | ||
| unsigned char * | out, | ||
| size_t * | out_len ) |
| count | Number of generators requested. |
| out | Output buffer for count compressed points. |
| out_len | In/out serialized byte length. |
Definition at line 2184 of file bppp_bridge.c.
References purify_bridge_checked_mul_size(), and purify_context_handle().
Referenced by purify::bppp::create_generators().
|
static |
Definition at line 173 of file bppp_bridge.c.
References purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_bulletproof_add_scratch_frame(), and purify_bulletproof_msm_scratch_size.
Referenced by purify_bppp_backend_resources_clone(), purify_bppp_backend_resources_create(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), and purify_bppp_verify_norm_arg_impl().
| int purify_bppp_generator_to_point | ( | purify_secp_context * | context, |
| const unsigned char | generator33[33], | ||
| unsigned char | out33[33] ) |
Definition at line 2252 of file bppp_bridge.c.
References purify_context_handle(), and purify_serialize_point().
|
static |
Definition at line 297 of file bppp_bridge.c.
References purify_bridge_checked_mul_size(), and purify_malloc_array().
Referenced by purify_bppp_backend_resources_clone().
| int purify_bppp_generators_to_points | ( | purify_secp_context * | context, |
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| unsigned char * | points_out33 ) |
Converts a nonempty generator stream to finite canonical SEC1 points. The caller authenticates the stream's derivation and protocol role.
Definition at line 3405 of file bppp_bridge.c.
References purify_bridge_checked_mul_size(), purify_context_handle(), purify_parse_generator_as_ge(), and purify_serialize_point().
Referenced by purify::bppp::accumulation::Basis::create(), purify::bppp::accumulation::PendingClaim::verify_algebraic_norm_reduction, and purify::bppp::accumulation::PendingClaim::verify_norm_reduction.
| int purify_bppp_offset_commitment | ( | purify_secp_context * | context, |
| const unsigned char | commitment33[33], | ||
| const unsigned char | scalar32[32], | ||
| unsigned char | commitment_out33[33] ) |
Definition at line 2513 of file bppp_bridge.c.
References PURIFY_BRIDGE_DECLASSIFY, purify_bridge_secure_clear(), purify_context_handle(), purify_gej_add_secret_scalar_term(), purify_parse_point_as_ge(), purify_parse_scalar(), and purify_serialize_point().
Referenced by purify::accountable::reconstruct_nonce().
| int purify_bppp_prepare_norm_arg_claim | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| size_t | n_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| const unsigned char * | proof, | ||
| size_t | proof_len, | ||
| unsigned char | terminal_n32[32], | ||
| unsigned char | terminal_l32[32], | ||
| unsigned char * | gammas32, | ||
| size_t | gamma_count, | ||
| unsigned char | residual33[33] ) |
Prepares a pending polynomial-commitment claim from a public norm proof.
Success checks encodings and computes the exact transcript and short group equation. It does NOT verify the proof: the returned residual must still be reduced using an authenticated coefficient opening and discharged by an accumulator's final decider. gamma_count must equal log2(n_vec_len); gammas32 may be NULL only when zero. The residual uses canonical compressed SEC1, or 33 zero bytes for infinity.
Definition at line 3364 of file bppp_bridge.c.
References purify_bppp_prepare_norm_arg_claim_impl().
Referenced by purify::bppp::accumulation::PreparedNorm::prepare_norm.
|
static |
Definition at line 3241 of file bppp_bridge.c.
References purify_bppp_create_scratch(), purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_context_handle(), purify_malloc_array(), purify_norm_arg_commit_initial_data(), purify_parse_point_as_ge(), purify_parse_scalar(), and purify_parse_scalar_array().
Referenced by purify_bppp_prepare_norm_arg_claim(), and purify_bppp_prepare_norm_arg_claim_with_challenges().
| int purify_bppp_prepare_norm_arg_claim_with_challenges | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| size_t | n_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| const unsigned char * | proof, | ||
| size_t | proof_len, | ||
| const unsigned char * | gammas32, | ||
| size_t | gamma_count, | ||
| unsigned char | terminal_n32[32], | ||
| unsigned char | terminal_l32[32], | ||
| unsigned char | residual33[33] ) |
Prepares the same pending claim using protocol-authenticated challenges. This does not verify the coefficient opening or discharge the claim.
Definition at line 3379 of file bppp_bridge.c.
References purify_bppp_prepare_norm_arg_claim_impl().
Referenced by purify::bppp::prepare_norm_arg_v4(), and purify::bppp::accumulation::AlgebraicPreparedNorm::prepare_v4_circuit_norm_for_algebraic_reduction.
| int purify_bppp_prove_norm_arg | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| unsigned char | commitment_out33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
| rho32 | Fiat-Shamir seed. |
| generators33 | Serialized generator list. |
| generators_count | Number of generators in generators33. |
| n_vec32 | Serialized n vector. |
| n_vec_len | Length of the n vector. |
| l_vec32 | Serialized l vector. |
| l_vec_len | Length of the l vector. |
| c_vec32 | Serialized c vector. |
| c_vec_len | Length of the c vector. |
| commitment_out33 | Commitment output used by the proof. |
| proof_out | Output buffer for the serialized proof. |
| proof_len | In/out proof buffer length. |
Definition at line 2797 of file bppp_bridge.c.
References purify_bppp_prove_norm_arg_impl().
|
static |
Definition at line 2691 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources_acquire_scratch_gens(), purify_bppp_backend_resources_release_scratch_gens(), purify_bppp_commit_secret(), purify_bppp_create_scratch(), purify_bppp_rangeproof_norm_product_prove_with_copied_inputs(), purify_bppp_required_proof_size(), purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_bridge_secure_clear(), purify_bridge_secure_clear_scratch_tail(), purify_bridge_secure_free_array(), purify_context_handle(), purify_malloc_array(), purify_norm_arg_commit_initial_data(), purify_parse_scalar(), purify_parse_scalar_array(), purify_serialize_point(), and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_prove_norm_arg(), and purify_bppp_prove_norm_arg_with_resources().
| int purify_bppp_prove_norm_arg_to_commitment | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 2938 of file bppp_bridge.c.
References purify_bppp_prove_norm_arg_to_commitment_impl().
Referenced by purify::bppp::prove_norm_arg_to_commitment_with_cache().
|
static |
Definition at line 2820 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources_acquire_scratch_gens(), purify_bppp_backend_resources_release_scratch_gens(), purify_bppp_commit_secret(), purify_bppp_create_scratch(), purify_bppp_rangeproof_norm_product_prove_with_copied_inputs(), purify_bppp_required_proof_size(), purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_bridge_memeq_const(), purify_bridge_secure_clear(), purify_bridge_secure_clear_scratch_tail(), purify_bridge_secure_free_array(), purify_context_handle(), purify_malloc_array(), purify_norm_arg_commit_initial_data(), purify_parse_point_as_ge(), purify_parse_scalar(), purify_parse_scalar_array(), purify_serialize_point(), and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_prove_norm_arg_to_commitment(), purify_bppp_prove_norm_arg_to_commitment_with_callback(), and purify_bppp_prove_norm_arg_to_commitment_with_resources().
| int purify_bppp_prove_norm_arg_to_commitment_with_callback | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| purify_bppp_round_challenge_callback | challenge_callback, | ||
| void * | callback_data, | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Produces a norm proof using challenges owned by the surrounding protocol.
The callback is invoked exactly once for every serialized proof point pair, in round order. The bridge validates every returned challenge before it can influence the secret witness fold.
Definition at line 2961 of file bppp_bridge.c.
References purify_bppp_prove_norm_arg_to_commitment_impl().
Referenced by purify::bppp::prove_norm_arg_to_commitment_v4().
| int purify_bppp_prove_norm_arg_to_commitment_with_resources | ( | purify_bppp_backend_resources * | resources, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 2948 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, and purify_bppp_prove_norm_arg_to_commitment_impl().
Referenced by purify::bppp::prove_norm_arg_to_commitment_with_cache().
| int purify_bppp_prove_norm_arg_with_resources | ( | purify_bppp_backend_resources * | resources, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | n_vec32, | ||
| size_t | n_vec_len, | ||
| const unsigned char * | l_vec32, | ||
| size_t | l_vec_len, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| unsigned char | commitment_out33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 2807 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, and purify_bppp_prove_norm_arg_impl().
| int purify_bppp_public_hash_to_point | ( | purify_secp_context * | context, |
| const unsigned char * | input, | ||
| size_t | input_len, | ||
| unsigned char | out33[33] ) |
Hashes framed public input to a finite point using the vendored generator map. Callers must bind their protocol domain and complete challenge transcript.
Definition at line 3496 of file bppp_bridge.c.
References purify_context_handle(), and purify_serialize_point().
| int purify_bppp_public_msm | ( | purify_secp_context * | context, |
| const unsigned char * | points33, | ||
| const unsigned char * | scalars32, | ||
| size_t | count, | ||
| unsigned char | out33[33] ) |
Variable-time arithmetic for public accumulator data only. Points use canonical SEC1 or all-zero33 for infinity; scalars are canonical. An empty MSM returns infinity and permits NULL points/scalars.
Definition at line 3437 of file bppp_bridge.c.
References purify_bppp_public_msm_data::points33, purify_bppp_public_msm_cb(), purify_bridge_checked_mul_size(), purify_bulletproof_msm_scratch_size, purify_context_handle(), and purify_bppp_public_msm_data::scalars32.
|
static |
Definition at line 3430 of file bppp_bridge.c.
References purify_bppp_public_msm_data::points33, purify_parse_scalar(), and purify_bppp_public_msm_data::scalars32.
Referenced by purify_bppp_public_msm().
| int purify_bppp_public_point_validate | ( | const unsigned char | point33[33] | ) |
Parses one canonical public accumulator point.
Points use compressed SEC1 or the unique all-zero33 identity encoding. This variable-time helper must never process secret data.
Definition at line 3483 of file bppp_bridge.c.
|
static |
Definition at line 1885 of file bppp_bridge.c.
References PURIFY_BRIDGE_DECLASSIFY, purify_bridge_secure_clear(), purify_ecmult_multi_secret(), purify_parse_scalar(), purify_scalar_inner_product_secret(), and purify_weighted_scalar_inner_product_secret().
Referenced by purify_bppp_rangeproof_norm_product_prove_with_copied_inputs().
|
static |
Definition at line 2113 of file bppp_bridge.c.
References purify_bppp_rangeproof_norm_product_prove_secret(), purify_bridge_secure_clear_scratch_tail(), and purify_copy_vectors_into_scratch().
Referenced by purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_impl().
|
static |
Definition at line 2987 of file bppp_bridge.c.
References secp256k1_scratch_alloc.
Referenced by purify_bppp_verify_norm_arg_impl().
| size_t purify_bppp_required_proof_size | ( | size_t | n_vec_len, |
| size_t | c_vec_len ) |
| n_vec_len | Length of the n vector. |
| c_vec_len | Length of the c vector. |
Definition at line 2144 of file bppp_bridge.c.
References purify_bridge_checked_add_size(), and purify_bridge_checked_mul_size().
Referenced by purify::bppp::prove_norm_arg_to_commitment_v4(), purify::bppp::prove_norm_arg_to_commitment_with_cache(), purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_impl().
| int purify_bppp_scale_generator | ( | purify_secp_context * | context, |
| const unsigned char | generator33[33], | ||
| const unsigned char | scalar32[32], | ||
| unsigned char | out33[33] ) |
Definition at line 2211 of file bppp_bridge.c.
References purify_context_handle(), and purify_parse_scalar().
Referenced by purify::bppp::accumulation::AlgebraicPreparedNorm::prepare_v4_circuit_norm_for_algebraic_reduction.
| int purify_bppp_value_generator_h | ( | purify_secp_context * | context, |
| unsigned char | out33[33] ) |
Definition at line 2173 of file bppp_bridge.c.
References purify_context_handle().
Referenced by purify::bppp::value_generator_h().
| int purify_bppp_verify_norm_arg | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| size_t | n_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| const unsigned char * | proof, | ||
| size_t | proof_len ) |
| rho32 | Fiat-Shamir seed. |
| generators33 | Serialized generator list. |
| generators_count | Number of generators in generators33. |
| c_vec32 | Serialized c vector. |
| c_vec_len | Length of the c vector. |
| n_vec_len | Length of the hidden n vector. |
| commitment33 | Serialized compressed commitment point. |
| proof | Serialized proof bytes. |
| proof_len | Proof length in bytes. |
Definition at line 3199 of file bppp_bridge.c.
References purify_bppp_verify_norm_arg_impl().
Referenced by purify::bppp::verify_norm_arg_with_cache().
|
static |
Definition at line 3109 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, purify_bppp_create_scratch(), purify_bppp_rangeproof_norm_product_verify_challenges(), purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_context_handle(), purify_malloc_array(), purify_norm_arg_commit_initial_data(), purify_parse_scalar(), purify_parse_scalar_array(), and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_verify_norm_arg(), purify_bppp_verify_norm_arg_with_challenges(), and purify_bppp_verify_norm_arg_with_resources().
| int purify_bppp_verify_norm_arg_with_challenges | ( | purify_secp_context * | context, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | generators33, | ||
| size_t | generators_count, | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| size_t | n_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| const unsigned char * | proof, | ||
| size_t | proof_len, | ||
| const unsigned char * | gammas32, | ||
| size_t | gamma_count ) |
Verifies a norm proof with already authenticated folding challenges. gamma_count must equal the proof round count and every scalar must be canonical and nonzero.
Definition at line 3219 of file bppp_bridge.c.
References purify_bppp_verify_norm_arg_impl().
Referenced by purify::bppp::verify_norm_arg_v4().
| int purify_bppp_verify_norm_arg_with_resources | ( | purify_bppp_backend_resources * | resources, |
| const unsigned char | rho32[32], | ||
| const unsigned char * | c_vec32, | ||
| size_t | c_vec_len, | ||
| size_t | n_vec_len, | ||
| const unsigned char | commitment33[33], | ||
| const unsigned char * | proof, | ||
| size_t | proof_len ) |
Definition at line 3208 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, and purify_bppp_verify_norm_arg_impl().
Referenced by purify::bppp::verify_norm_arg_with_cache().
|
static |
Definition at line 141 of file bppp_bridge.c.
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_create_scratch(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_required_proof_size(), purify_bppp_verify_norm_arg_impl(), purify_build_bulletproof_circuit(), purify_bulletproof_add_scratch_frame(), purify_bulletproof_circuit_scratch_size(), purify_bulletproof_required_proof_size(), purify_copy_vectors_into_scratch(), and purify_total_row_entries().
|
static |
Definition at line 130 of file bppp_bridge.c.
Referenced by purify_bppp_backend_resources_clone(), purify_bppp_backend_resources_create(), purify_bppp_backend_resources_reset_scratch_gens(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_create_generators(), purify_bppp_create_scratch(), purify_bppp_generators_clone(), purify_bppp_generators_to_points(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_public_msm(), purify_bppp_required_proof_size(), purify_bppp_verify_norm_arg_impl(), purify_bridge_secure_free_array(), purify_bulletproof_add_scratch_frame(), purify_bulletproof_backend_resources_clone(), purify_bulletproof_backend_resources_create(), purify_bulletproof_circuit_scratch_size(), purify_bulletproof_prove_circuit_impl(), purify_bulletproof_verify_circuit_impl(), purify_calloc_array(), purify_copy_vectors_into_scratch(), and purify_malloc_array().
|
static |
Definition at line 960 of file bppp_bridge.c.
Referenced by purify_bip340_sign_with_fixed_nonce(), purify_bppp_prove_norm_arg_to_commitment_impl(), and purify_point_add_allow_infinity().
|
static |
Definition at line 91 of file bppp_bridge.c.
Referenced by purify_bip340_canonicalize_scalar(), purify_bip340_key_from_seckey(), purify_bip340_nonce_from_scalar(), purify_bip340_sign_with_fixed_nonce(), purify_bip340_validate_signature(), purify_bip340_validate_xonly_pubkey(), purify_bip340_xonly_from_point(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_secret(), purify_bppp_commit_witness_only_impl(), purify_bppp_offset_commitment(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_rangeproof_norm_product_prove_secret(), purify_bridge_secure_clear_scratch_tail(), purify_bridge_secure_free_array(), purify_ecmult_multi_secret(), purify_gej_add_secret_scalar_term(), purify_pedersen_commit_char(), purify_point_add_allow_infinity(), purify_point_scale(), purify_point_subtract_allow_infinity(), and purify_secp_context_create().
|
static |
Definition at line 97 of file bppp_bridge.c.
References purify_bridge_secure_clear().
Referenced by purify_bppp_backend_resources_destroy(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_rangeproof_norm_product_prove_with_copied_inputs(), purify_bulletproof_backend_resources_destroy(), purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_reserve_circuit_scratch().
|
static |
Definition at line 152 of file bppp_bridge.c.
References purify_bridge_checked_mul_size(), and purify_bridge_secure_clear().
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bulletproof_circuit_evaluate(), and purify_free_bulletproof_assignment().
|
static |
Definition at line 1240 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit_assignment::al, purify_bulletproof_assignment_view::al32, secp256k1_bulletproof_circuit_assignment::ao, purify_bulletproof_assignment_view::ao32, secp256k1_bulletproof_circuit_assignment::ar, purify_bulletproof_assignment_view::ar32, purify_bulletproof_assignment_view::n_commits, secp256k1_bulletproof_circuit_assignment::n_commits, purify_bulletproof_assignment_view::n_gates, secp256k1_bulletproof_circuit_assignment::n_gates, purify_free_bulletproof_assignment(), purify_malloc_array(), purify_parse_scalar_array(), secp256k1_bulletproof_circuit_assignment::v, and purify_bulletproof_assignment_view::v32.
Referenced by purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 1175 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit::c, purify_bulletproof_circuit_view::c32, secp256k1_bulletproof_circuit::entries, purify_bulletproof_circuit_view::n_bits, secp256k1_bulletproof_circuit::n_bits, purify_bulletproof_circuit_view::n_commits, secp256k1_bulletproof_circuit::n_commits, purify_bulletproof_circuit_view::n_constraints, secp256k1_bulletproof_circuit::n_constraints, purify_bulletproof_circuit_view::n_gates, secp256k1_bulletproof_circuit::n_gates, purify_bridge_checked_add_size(), purify_build_row_family(), purify_calloc_array(), purify_free_bulletproof_circuit(), purify_malloc_array(), purify_parse_fast_scalar(), purify_total_row_entries(), purify_bulletproof_circuit_view::wl, secp256k1_bulletproof_circuit::wl, purify_bulletproof_circuit_view::wo, secp256k1_bulletproof_circuit::wo, purify_bulletproof_circuit_view::wr, secp256k1_bulletproof_circuit::wr, purify_bulletproof_circuit_view::wv, and secp256k1_bulletproof_circuit::wv.
Referenced by purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
|
static |
Definition at line 1072 of file bppp_bridge.c.
References secp256k1_bulletproof_wmatrix_row::entry, secp256k1_bulletproof_wmatrix_entry::idx, purify_bulletproof_row_view::indices, purify_parse_fast_scalar(), purify_bulletproof_row_view::size, and secp256k1_bulletproof_wmatrix_row::size.
Referenced by purify_build_bulletproof_circuit().
|
static |
Definition at line 166 of file bppp_bridge.c.
References purify_bridge_checked_add_size(), and purify_bridge_checked_mul_size().
Referenced by purify_bppp_create_scratch(), and purify_bulletproof_circuit_scratch_size().
| purify_bulletproof_backend_resources * purify_bulletproof_backend_resources_clone | ( | const purify_bulletproof_backend_resources * | resources | ) |
Definition at line 396 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, purify_bulletproof_backend_resources::gens, secp256k1_bulletproof_generators::n, purify_bulletproof_backend_resources::n_gates, purify_bridge_checked_mul_size(), purify_bulletproof_backend_resources_destroy(), purify_bulletproof_backend_resources::scratch, purify_bulletproof_backend_resources::scratch_capacity, and secp256k1_bulletproof_generators_create().
Referenced by purify::ExperimentalBulletproofBackendCache::clone_for_thread().
| purify_bulletproof_backend_resources * purify_bulletproof_backend_resources_create | ( | purify_secp_context * | context, |
| size_t | n_gates ) |
Definition at line 359 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, purify_bulletproof_backend_resources::gens, secp256k1_bulletproof_generators::n, purify_bulletproof_backend_resources::n_gates, purify_bridge_checked_mul_size(), purify_bulletproof_backend_resources_destroy(), purify_bulletproof_msm_scratch_size, purify_context_handle(), purify_bulletproof_backend_resources::scratch, purify_bulletproof_backend_resources::scratch_capacity, and secp256k1_bulletproof_generators_create().
Referenced by purify::ExperimentalBulletproofBackendCache::get_or_create(), main(), purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
| void purify_bulletproof_backend_resources_destroy | ( | purify_bulletproof_backend_resources * | resources | ) |
Definition at line 427 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, purify_bulletproof_backend_resources::gens, purify_bridge_secure_clear_scratch_tail(), purify_bulletproof_backend_resources::scratch, and secp256k1_bulletproof_generators_destroy().
Referenced by main(), purify::BulletproofBackendResourceDeleter::operator()(), purify_bulletproof_backend_resources_clone(), purify_bulletproof_backend_resources_create(), purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
| size_t purify_bulletproof_backend_resources_scratch_capacity | ( | const purify_bulletproof_backend_resources * | resources | ) |
Definition at line 113 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::scratch.
|
static |
Definition at line 1111 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit_assignment::al, secp256k1_bulletproof_circuit_assignment::ao, secp256k1_bulletproof_circuit_assignment::ar, secp256k1_bulletproof_circuit::c, secp256k1_bulletproof_circuit::n_commits, secp256k1_bulletproof_circuit_assignment::n_commits, secp256k1_bulletproof_circuit::n_constraints, secp256k1_bulletproof_circuit::n_gates, secp256k1_bulletproof_circuit_assignment::n_gates, purify_bridge_secure_free_array(), purify_bulletproof_circuit_evaluate_sum_row(), secp256k1_fast_scalar_mul(), secp256k1_bulletproof_circuit_assignment::v, secp256k1_bulletproof_circuit::wl, secp256k1_bulletproof_circuit::wo, secp256k1_bulletproof_circuit::wr, and secp256k1_bulletproof_circuit::wv.
Referenced by purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 1099 of file bppp_bridge.c.
References secp256k1_bulletproof_wmatrix_row::entry, secp256k1_bulletproof_wmatrix_entry::idx, secp256k1_bulletproof_wmatrix_entry::scal, secp256k1_fast_scalar_mul(), and secp256k1_bulletproof_wmatrix_row::size.
Referenced by purify_bulletproof_circuit_evaluate().
|
static |
Definition at line 196 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit::n_commits, secp256k1_bulletproof_circuit::n_constraints, secp256k1_bulletproof_circuit::n_gates, purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_bulletproof_add_scratch_frame(), purify_bulletproof_msm_scratch_size, and secp256k1_floor_lg().
Referenced by purify_bulletproof_reserve_circuit_scratch().
| int purify_bulletproof_prove_circuit | ( | purify_secp_context * | context, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const purify_bulletproof_assignment_view * | assignment, | ||
| const unsigned char * | blinds32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char * | commitments_out33, | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 1422 of file bppp_bridge.c.
References purify_bulletproof_prove_circuit_impl().
| int purify_bulletproof_prove_circuit_assume_valid | ( | purify_secp_context * | context, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const purify_bulletproof_assignment_view * | assignment, | ||
| const unsigned char * | blinds32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char * | commitments_out33, | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 1454 of file bppp_bridge.c.
References purify_bulletproof_prove_circuit_impl().
| int purify_bulletproof_prove_circuit_assume_valid_with_resources | ( | purify_bulletproof_backend_resources * | resources, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const purify_bulletproof_assignment_view * | assignment, | ||
| const unsigned char * | blinds32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char * | commitments_out33, | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 1470 of file bppp_bridge.c.
References purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 1283 of file bppp_bridge.c.
References secp256k1_bulletproof_generators::blinding_gen, purify_bulletproof_backend_resources::ctx, purify_bulletproof_backend_resources::gens, secp256k1_bulletproof_generators::n, secp256k1_bulletproof_circuit::n_commits, secp256k1_bulletproof_circuit_assignment::n_commits, purify_bulletproof_backend_resources::n_gates, secp256k1_bulletproof_circuit::n_gates, secp256k1_bulletproof_circuit_assignment::n_gates, purify_bridge_checked_mul_size(), purify_bridge_secure_clear_scratch_tail(), purify_build_bulletproof_assignment(), purify_build_bulletproof_circuit(), purify_bulletproof_backend_resources_create(), purify_bulletproof_backend_resources_destroy(), purify_bulletproof_circuit_evaluate(), purify_bulletproof_reserve_circuit_scratch(), purify_calloc_array(), purify_free_bulletproof_assignment(), purify_free_bulletproof_circuit(), purify_malloc_array(), purify_parse_generator_as_ge(), purify_parse_scalar(), purify_serialize_point(), purify_bulletproof_backend_resources::scratch, secp256k1_bulletproof_relation66_prove_impl(), secp256k1_pedersen_ecmult_scalar(), and secp256k1_bulletproof_circuit_assignment::v.
Referenced by purify_bulletproof_prove_circuit(), purify_bulletproof_prove_circuit_assume_valid(), purify_bulletproof_prove_circuit_assume_valid_with_resources(), and purify_bulletproof_prove_circuit_with_resources().
| int purify_bulletproof_prove_circuit_with_resources | ( | purify_bulletproof_backend_resources * | resources, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const purify_bulletproof_assignment_view * | assignment, | ||
| const unsigned char * | blinds32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char * | commitments_out33, | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len ) |
Definition at line 1438 of file bppp_bridge.c.
References purify_bulletproof_prove_circuit_impl().
| size_t purify_bulletproof_required_proof_size | ( | size_t | n_gates | ) |
Definition at line 1271 of file bppp_bridge.c.
References purify_bridge_checked_add_size(), and secp256k1_bulletproof_innerproduct_proof_length().
|
static |
Definition at line 250 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, purify_bridge_secure_clear_scratch_tail(), purify_bulletproof_circuit_scratch_size(), purify_bulletproof_backend_resources::scratch, and purify_bulletproof_backend_resources::scratch_capacity.
Referenced by purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
| int purify_bulletproof_verify_circuit | ( | purify_secp_context * | context, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const unsigned char * | commitments33, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| const unsigned char * | proof, | ||
| size_t | proof_len ) |
Definition at line 1496 of file bppp_bridge.c.
References purify_bulletproof_verify_circuit_impl().
Referenced by purify::verify_experimental_circuit(), and purify::verify_experimental_circuit().
|
static |
Definition at line 1508 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, purify_bulletproof_backend_resources::gens, secp256k1_bulletproof_generators::n, secp256k1_bulletproof_circuit::n_commits, purify_bulletproof_backend_resources::n_gates, secp256k1_bulletproof_circuit::n_gates, purify_bridge_checked_mul_size(), purify_build_bulletproof_circuit(), purify_bulletproof_backend_resources_create(), purify_bulletproof_backend_resources_destroy(), purify_bulletproof_reserve_circuit_scratch(), purify_free_bulletproof_circuit(), purify_malloc_array(), purify_parse_generator_as_ge(), purify_parse_point_as_ge(), purify_bulletproof_backend_resources::scratch, and secp256k1_bulletproof_relation66_verify_impl().
Referenced by purify_bulletproof_verify_circuit(), and purify_bulletproof_verify_circuit_with_resources().
| int purify_bulletproof_verify_circuit_with_resources | ( | purify_bulletproof_backend_resources * | resources, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const unsigned char * | commitments33, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| const unsigned char * | proof, | ||
| size_t | proof_len ) |
Definition at line 1615 of file bppp_bridge.c.
References purify_bulletproof_verify_circuit_impl().
Referenced by purify::verify_experimental_circuit(), and purify::verify_experimental_circuit().
|
static |
Definition at line 285 of file bppp_bridge.c.
References purify_bridge_checked_mul_size().
Referenced by purify_build_bulletproof_circuit(), and purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 54 of file bppp_bridge.c.
References purify_secp_context::ctx.
Referenced by purify_bip340_key_from_seckey(), purify_bip340_nonce_from_scalar(), purify_bip340_sign_with_fixed_nonce(), purify_bip340_validate_signature(), purify_bip340_validate_xonly_pubkey(), purify_bip340_verify(), purify_bip340_xonly_from_point(), purify_bppp_backend_resources_create(), purify_bppp_base_generator(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_create_generators(), purify_bppp_generator_to_point(), purify_bppp_generators_to_points(), purify_bppp_offset_commitment(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_public_hash_to_point(), purify_bppp_public_msm(), purify_bppp_scale_generator(), purify_bppp_value_generator_h(), purify_bppp_verify_norm_arg_impl(), purify_bulletproof_backend_resources_create(), purify_pedersen_commit_char(), purify_point_add(), purify_point_add_allow_infinity(), purify_point_scale(), and purify_point_subtract_allow_infinity().
|
static |
Definition at line 1684 of file bppp_bridge.c.
References purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), and secp256k1_scratch_alloc.
Referenced by purify_bppp_rangeproof_norm_product_prove_with_copied_inputs().
|
static |
Definition at line 1756 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_gej_add_secret_scalar_term().
Referenced by purify_bppp_commit_secret(), purify_bppp_commit_witness_only_impl(), and purify_bppp_rangeproof_norm_product_prove_secret().
|
static |
Definition at line 835 of file bppp_bridge.c.
Referenced by purify_bip340_sign_with_fixed_nonce().
|
static |
Definition at line 1031 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit_assignment::al, secp256k1_bulletproof_circuit_assignment::ao, secp256k1_bulletproof_circuit_assignment::ar, secp256k1_bulletproof_circuit_assignment::n_commits, secp256k1_bulletproof_circuit_assignment::n_gates, purify_bridge_secure_free_array(), and secp256k1_bulletproof_circuit_assignment::v.
Referenced by purify_build_bulletproof_assignment(), and purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 1018 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit::c, secp256k1_bulletproof_circuit::entries, secp256k1_bulletproof_circuit::wl, secp256k1_bulletproof_circuit::wo, secp256k1_bulletproof_circuit::wr, and secp256k1_bulletproof_circuit::wv.
Referenced by purify_build_bulletproof_circuit(), purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
|
static |
Definition at line 1729 of file bppp_bridge.c.
Referenced by purify_gej_add_secret_scalar_term().
|
static |
Definition at line 1735 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_ge_cmov().
Referenced by purify_bppp_offset_commitment(), purify_ecmult_multi_secret(), and purify_pedersen_commit_char().
| void purify_hmac_sha256 | ( | unsigned char | output32[32], |
| const unsigned char * | key, | ||
| size_t | key_len, | ||
| const unsigned char * | data, | ||
| size_t | data_len ) |
| output32 | Output MAC buffer. |
| key | Pointer to key bytes, or NULL when key_len is zero. |
| key_len | Key length in bytes. |
| data | Pointer to message bytes, or NULL when data_len is zero. |
| data_len | Message length in bytes. |
Definition at line 654 of file bppp_bridge.c.
Referenced by purify::hmac_sha256(), and purify_core_hkdf_sha256().
|
static |
Definition at line 273 of file bppp_bridge.c.
References purify_bridge_checked_mul_size().
Referenced by purify_bppp_backend_resources_clone(), purify_bppp_backend_resources_create(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_generators_clone(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_verify_norm_arg_impl(), purify_build_bulletproof_assignment(), purify_build_bulletproof_circuit(), purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
|
static |
Definition at line 1661 of file bppp_bridge.c.
References purify_norm_arg_public_digest(), and purify_serialize_point().
Referenced by purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), and purify_bppp_verify_norm_arg_impl().
|
static |
Definition at line 1627 of file bppp_bridge.c.
References purify_serialize_point().
Referenced by purify_norm_arg_commit_initial_data().
|
static |
Definition at line 972 of file bppp_bridge.c.
References purify_parse_scalar(), secp256k1_fast_scalar::scal, and secp256k1_fast_scalar::special.
Referenced by purify_build_bulletproof_circuit(), and purify_build_row_family().
|
static |
Definition at line 999 of file bppp_bridge.c.
Referenced by purify_bppp_generators_to_points(), purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
|
static |
Definition at line 1011 of file bppp_bridge.c.
Referenced by purify_bppp_offset_commitment(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bulletproof_verify_circuit_impl(), purify_point_add(), purify_point_add_allow_infinity(), purify_point_scale(), and purify_point_subtract_allow_infinity().
|
static |
Definition at line 929 of file bppp_bridge.c.
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_offset_commitment(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_public_msm_cb(), purify_bppp_rangeproof_norm_product_prove_secret(), purify_bppp_scale_generator(), purify_bppp_verify_norm_arg_impl(), purify_bulletproof_prove_circuit_impl(), purify_parse_fast_scalar(), purify_parse_scalar_array(), purify_pedersen_commit_char(), and purify_point_scale().
|
static |
Definition at line 941 of file bppp_bridge.c.
References purify_parse_scalar().
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_prepare_norm_arg_claim_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_verify_norm_arg_impl(), and purify_build_bulletproof_assignment().
| int purify_pedersen_commit_char | ( | purify_secp_context * | context, |
| const unsigned char | blind32[32], | ||
| const unsigned char | value32[32], | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | blind_gen33[33], | ||
| unsigned char | commitment_out33[33] ) |
| blind32 | Blinding factor in big-endian scalar form. |
| value32 | Committed value in big-endian scalar form. |
| value_gen33 | Compressed generator for the value term. |
| blind_gen33 | Compressed generator for the blind term. |
| commitment_out33 | Serialized compressed commitment output. |
Definition at line 2269 of file bppp_bridge.c.
References PURIFY_BRIDGE_DECLASSIFY, purify_bridge_secure_clear(), purify_context_handle(), purify_gej_add_secret_scalar_term(), purify_parse_scalar(), and purify_serialize_point().
Referenced by purify::bppp::pedersen_commit_char().
| int purify_point_add | ( | purify_secp_context * | context, |
| const unsigned char | lhs33[33], | ||
| const unsigned char | rhs33[33], | ||
| unsigned char | out33[33] ) |
Definition at line 2581 of file bppp_bridge.c.
References purify_context_handle(), purify_parse_point_as_ge(), and purify_serialize_point().
Referenced by purify::accountable::SigningRoster::aggregate(), and purify::accountable::VerifiedCoalitionNonceSet::verify_coalition_nonce_set.
| int purify_point_add_allow_infinity | ( | purify_secp_context * | context, |
| const unsigned char | lhs33[33], | ||
| const unsigned char | rhs33[33], | ||
| unsigned char | out33[33] ) |
Definition at line 2606 of file bppp_bridge.c.
References purify_bridge_memeq_const(), purify_bridge_secure_clear(), purify_context_handle(), purify_parse_point_as_ge(), and purify_serialize_point().
| int purify_point_scale | ( | purify_secp_context * | context, |
| const unsigned char | point33[33], | ||
| const unsigned char | scalar32[32], | ||
| unsigned char | out33[33] ) |
Definition at line 2548 of file bppp_bridge.c.
References PURIFY_BRIDGE_DECLASSIFY, purify_bridge_secure_clear(), purify_context_handle(), purify_parse_point_as_ge(), purify_parse_scalar(), and purify_serialize_point().
Referenced by purify::accountable::SigningRoster::aggregate(), purify::accountable::reconstruct_nonce(), and purify::accountable::recover_same_slot_key().
| int purify_point_subtract_allow_infinity | ( | purify_secp_context * | context, |
| const unsigned char | lhs33[33], | ||
| const unsigned char | rhs33[33], | ||
| unsigned char | out33[33] ) |
Definition at line 2655 of file bppp_bridge.c.
References purify_bridge_secure_clear(), purify_context_handle(), purify_parse_point_as_ge(), and purify_serialize_point().
| int purify_scalar_add | ( | purify_scalar * | out, |
| const purify_scalar * | lhs, | ||
| const purify_scalar * | rhs ) |
Definition at line 592 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::operator+, and purify_fe_add().
|
static |
Definition at line 540 of file bppp_bridge.c.
Referenced by purify_scalar_add(), purify_scalar_cmov(), purify_scalar_inverse(), purify_scalar_inverse_var(), purify_scalar_mul(), purify_scalar_negate(), purify_scalar_set_b32(), purify_scalar_set_int(), and purify_scalar_set_u64().
|
static |
Definition at line 544 of file bppp_bridge.c.
Referenced by purify_scalar_add(), purify_scalar_cmov(), purify_scalar_eq(), purify_scalar_get_b32(), purify_scalar_inverse(), purify_scalar_inverse_var(), purify_scalar_is_even(), purify_scalar_is_one(), purify_scalar_is_zero(), purify_scalar_mul(), and purify_scalar_negate().
| void purify_scalar_cmov | ( | purify_scalar * | dst, |
| const purify_scalar * | src, | ||
| int | flag ) |
Definition at line 600 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::conditional_assign(), and purify_fe_cmov().
| int purify_scalar_eq | ( | const purify_scalar * | lhs, |
| const purify_scalar * | rhs ) |
Definition at line 576 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify::FieldElement::operator==, and purify_fe_eq().
| void purify_scalar_get_b32 | ( | unsigned char | output32[32], |
| const purify_scalar * | value ) |
Definition at line 560 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify::bppp::commit_output_witness(), purify::accountable::RecoveryRootShare::prove_recovery_root_contribution, purify::accountable::RecoveryRootSetupProof::prove_recovery_root_setup, purify_fe_get_b32(), purify::puresign_plusplus::PreparedNonceWithProof::raw_scalar(), purify::bppp::scalar_bytes(), purify::bppp::scalar_bytes(), and purify::FieldElement::to_bytes_be().
|
static |
Definition at line 1786 of file bppp_bridge.c.
Referenced by purify_bppp_commit_secret(), and purify_bppp_rangeproof_norm_product_prove_secret().
| void purify_scalar_inverse | ( | purify_scalar * | out, |
| const purify_scalar * | value ) |
Definition at line 584 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::inverse_consttime(), and purify_fe_inverse().
| void purify_scalar_inverse_var | ( | purify_scalar * | out, |
| const purify_scalar * | value ) |
Definition at line 588 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::inverse(), and purify_fe_inverse_var().
| int purify_scalar_is_even | ( | const purify_scalar * | value | ) |
Definition at line 572 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify::FieldElement::is_odd(), and purify_fe_is_odd().
| int purify_scalar_is_one | ( | const purify_scalar * | value | ) |
Definition at line 568 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify::FieldElement::is_one(), and purify_fe_is_one().
| int purify_scalar_is_zero | ( | const purify_scalar * | value | ) |
Definition at line 564 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify::FieldElement::is_zero(), purify_fe_is_zero(), and purify::puresign_plusplus::PreparedNonceWithProof::raw_scalar().
| void purify_scalar_mul | ( | purify_scalar * | out, |
| const purify_scalar * | lhs, | ||
| const purify_scalar * | rhs ) |
Definition at line 596 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::operator*, and purify_fe_mul().
| void purify_scalar_negate | ( | purify_scalar * | out, |
| const purify_scalar * | value ) |
Definition at line 580 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::negate(), purify_fe_negate(), and purify::puresign_plusplus::PreparedNonceWithProof::raw_scalar().
| void purify_scalar_set_b32 | ( | purify_scalar * | out, |
| const unsigned char | input32[32], | ||
| int * | overflow ) |
Definition at line 556 of file bppp_bridge.c.
References purify_scalar_cast().
Referenced by purify::accountable::SigningRoster::aggregate(), purify_fe_set_b32(), purify::puresign_plusplus::PreparedNonceWithProof::raw_scalar(), purify::accountable::signature_challenge(), and purify::FieldElement::try_from_bytes32().
| void purify_scalar_set_int | ( | purify_scalar * | out, |
| unsigned int | value ) |
Definition at line 548 of file bppp_bridge.c.
References purify_scalar_cast().
Referenced by purify::FieldElement::FieldElement(), and purify_fe_set_zero().
| void purify_scalar_set_u64 | ( | purify_scalar * | out, |
| uint64_t | value ) |
Definition at line 552 of file bppp_bridge.c.
References purify_scalar_cast().
Referenced by purify::FieldElement::from_u64(), and purify_fe_set_u64().
| purify_secp_context * purify_secp_context_create | ( | void | ) |
Definition at line 58 of file bppp_bridge.c.
References purify_secp_context::ctx, purify_bridge_secure_clear(), PURIFY_ERROR_OK, and purify_fill_secure_random().
Referenced by purify::make_secp_context().
| void purify_secp_context_destroy | ( | purify_secp_context * | context | ) |
Definition at line 81 of file bppp_bridge.c.
References purify_secp_context::ctx.
Referenced by purify::SecpContextDeleter::operator()().
|
static |
Definition at line 951 of file bppp_bridge.c.
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_generator_to_point(), purify_bppp_generators_to_points(), purify_bppp_offset_commitment(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_public_hash_to_point(), purify_bulletproof_prove_circuit_impl(), purify_norm_arg_commit_initial_data(), purify_norm_arg_public_digest(), purify_pedersen_commit_char(), purify_point_add(), purify_point_add_allow_infinity(), purify_point_scale(), and purify_point_subtract_allow_infinity().
| void purify_sha256 | ( | unsigned char | output32[32], |
| const unsigned char * | data, | ||
| size_t | data_len ) |
| output32 | Output digest buffer. |
| data | Pointer to message bytes, or NULL when data_len is zero. |
| data_len | Message length in bytes. |
Definition at line 604 of file bppp_bridge.c.
Referenced by purify::bppp::generator_backend_cache_key(), purify_curve_tag_hash(), purify::bppp::candidate::Sha256Transcript::Sha256Transcript(), and purify::TaggedHash::TaggedHash().
| int purify_sha256_many | ( | unsigned char | output32[32], |
| const unsigned char *const * | items, | ||
| const size_t * | item_lens, | ||
| size_t | items_count ) |
| output32 | Output digest buffer. |
| items | Array of item pointers. Each item may be NULL only when the corresponding length is zero. |
| item_lens | Array of item lengths in bytes. |
| items_count | Number of items in both arrays. |
Definition at line 621 of file bppp_bridge.c.
Referenced by purify::TaggedHash::digest_many(), and purify_curve_hash_to_int_tagged_u320().
|
static |
Definition at line 1042 of file bppp_bridge.c.
References purify_bridge_checked_add_size().
Referenced by purify_build_bulletproof_circuit().
|
static |
Definition at line 1807 of file bppp_bridge.c.
Referenced by purify_bppp_commit_secret(), and purify_bppp_rangeproof_norm_product_prove_secret().
|
static |
Definition at line 164 of file bppp_bridge.c.
Referenced by purify_bppp_create_scratch(), purify_bppp_public_msm(), purify_bulletproof_backend_resources_create(), and purify_bulletproof_circuit_scratch_size().