|
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. More...
#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 |
Macros | |
| #define | SECP256K1_BUILD |
| #define | ENABLE_MODULE_GENERATOR 1 |
| #define | ENABLE_MODULE_BPPP 1 |
| #define | ENABLE_MODULE_EXTRAKEYS 1 |
| #define | ENABLE_MODULE_SCHNORRSIG 1 |
Typedefs | |
| typedef struct purify_bppp_mutable_generators_guard | purify_bppp_mutable_generators_guard |
Functions | |
| static void | purify_bridge_secure_clear (void *data, 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 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_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. | |
| 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 *blind32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char commitment_out33[33], 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 *blind32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char commitment_out33[33], 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 *blind32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char commitment_out33[33], 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 *blind32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char commitment_out33[33], 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 *blind32, const unsigned char value_gen33[33], const unsigned char nonce32[32], const unsigned char *extra_commit, size_t extra_commit_len, unsigned char commitment_out33[33], 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 commitment33[33], 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 commitment33[33], 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 commitment33[33], 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 void | 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 int | purify_bppp_rangeproof_norm_product_prove_const (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 | 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_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]) |
| 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) |
| 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) |
| 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) |
| 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) |
| #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 SECP256K1_BUILD |
Definition at line 10 of file bppp_bridge.c.
| 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 525 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
Referenced by 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 564 of file bppp_bridge.c.
References 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 707 of file bppp_bridge.c.
References purify_bip340_nonce_from_scalar(), purify_bridge_secure_clear(), purify_context_handle(), and purify_fixed_nonce_function().
Referenced by purify::puresign_plusplus::PreparedNonce::sign_message(), purify::puresign::PreparedNonce::sign_message(), purify::puresign_plusplus::PreparedNonce::sign_topic_message(), and purify::puresign::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 662 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
Referenced by purify::puresign_plusplus::Signature::deserialize(), purify::puresign::Signature::deserialize(), purify::puresign_plusplus::api_impl::verify_signature(), and purify::puresign::api_impl::verify_signature().
| int purify_bip340_validate_xonly_pubkey | ( | purify_secp_context * | context, |
| const unsigned char | xonly_pubkey32[32] | ||
| ) |
Definition at line 645 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
Referenced by purify::puresign_plusplus::PublicKey::deserialize(), purify::puresign_plusplus::Nonce::deserialize(), purify::puresign_plusplus::NonceProof::deserialize(), purify::puresign::PublicKey::deserialize(), purify::puresign::Nonce::deserialize(), purify::puresign_plusplus::api_impl::verify_signature(), and purify::puresign::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 758 of file bppp_bridge.c.
References purify_context_handle().
Referenced by purify::puresign_plusplus::PreparedNonce::sign_message(), purify::puresign::PreparedNonce::sign_message(), purify::puresign_plusplus::PreparedNonce::sign_topic_message(), purify::puresign::PreparedNonce::sign_topic_message(), purify::puresign_plusplus::api_impl::verify_signature(), and purify::puresign::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 603 of file bppp_bridge.c.
References purify_bridge_secure_clear(), and purify_context_handle().
|
static |
Definition at line 191 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 336 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_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 292 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_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 374 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::gens, purify_bppp_backend_resources::gens_scratch, 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 205 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 177 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 1514 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 1665 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 1597 of file bppp_bridge.c.
References c_vec, purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, l_vec, n_vec, purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_context_handle(), purify_malloc_array(), purify_parse_scalar(), purify_parse_scalar_array(), purify_serialize_point(), rho, 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 1674 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().
| 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 1756 of file bppp_bridge.c.
References purify_bppp_commit_witness_only_impl().
|
static |
Definition at line 1686 of file bppp_bridge.c.
References purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, l_vec, n_vec, purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), purify_context_handle(), 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 1764 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 1539 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 151 of file bppp_bridge.c.
References generators, purify_bridge_checked_mul_size(), and purify_malloc_array().
Referenced by purify_bppp_backend_resources_clone().
| 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 1773 of file bppp_bridge.c.
References purify_context_handle(), purify_parse_point_as_ge(), purify_parse_scalar(), purify_serialize_point(), and scalar.
| 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 1937 of file bppp_bridge.c.
References purify_bppp_prove_norm_arg_impl().
|
static |
Definition at line 1850 of file bppp_bridge.c.
References c_vec, purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, l_vec, n_vec, purify_bppp_backend_resources_acquire_scratch_gens(), purify_bppp_backend_resources_release_scratch_gens(), purify_bppp_rangeproof_norm_product_prove_const(), purify_bppp_required_proof_size(), 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(), purify_serialize_point(), rho, 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 2052 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 1960 of file bppp_bridge.c.
References c_vec, purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, l_vec, n_vec, purify_bppp_backend_resources_acquire_scratch_gens(), purify_bppp_backend_resources_release_scratch_gens(), purify_bppp_rangeproof_norm_product_prove_const(), purify_bppp_required_proof_size(), 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(), purify_parse_scalar_array(), purify_serialize_point(), rho, and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_prove_norm_arg_to_commitment(), and purify_bppp_prove_norm_arg_to_commitment_with_resources().
| 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 2062 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 1947 of file bppp_bridge.c.
References purify_bppp_backend_resources::generators_count, and purify_bppp_prove_norm_arg_impl().
|
static |
Definition at line 1479 of file bppp_bridge.c.
References c_vec, l_vec, n_vec, purify_copy_vectors_into_scratch(), and rho.
Referenced by purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_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 1499 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_with_cache(), purify_bppp_prove_norm_arg_impl(), and purify_bppp_prove_norm_arg_to_commitment_impl().
| int purify_bppp_value_generator_h | ( | purify_secp_context * | context, |
| unsigned char | out33[33] | ||
| ) |
Definition at line 1528 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 2133 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 2075 of file bppp_bridge.c.
References c_vec, purify_bppp_backend_resources::ctx, purify_bppp_backend_resources::generators_count, purify_bppp_backend_resources::gens, 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(), rho, and purify_bppp_backend_resources::scratch.
Referenced by purify_bppp_verify_norm_arg(), and purify_bppp_verify_norm_arg_with_resources().
| 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 2141 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 116 of file bppp_bridge.c.
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_bppp_required_proof_size(), purify_bppp_verify_norm_arg_impl(), purify_build_bulletproof_circuit(), purify_bulletproof_required_proof_size(), purify_copy_vectors_into_scratch(), and purify_total_row_entries().
|
static |
Definition at line 105 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_generators_clone(), 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_bulletproof_backend_resources_clone(), purify_bulletproof_backend_resources_create(), 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 79 of file bppp_bridge.c.
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_xonly_from_point(), and purify_secp_context_create().
|
static |
Definition at line 1067 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 1002 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 908 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().
| purify_bulletproof_backend_resources * purify_bulletproof_backend_resources_clone | ( | const purify_bulletproof_backend_resources * | resources | ) |
Definition at line 249 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, generator_count, 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, 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 213 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, generator_count, 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_context_handle(), purify_bulletproof_backend_resources::scratch, 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 279 of file bppp_bridge.c.
References purify_bulletproof_backend_resources::ctx, purify_bulletproof_backend_resources::gens, 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().
|
static |
Definition at line 946 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_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 935 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().
| int purify_bulletproof_prove_circuit | ( | purify_secp_context * | context, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const purify_bulletproof_assignment_view * | assignment, | ||
| const unsigned char * | blind32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char | commitment_out33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len | ||
| ) |
Definition at line 1228 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 * | blind32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char | commitment_out33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len | ||
| ) |
Definition at line 1260 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 * | blind32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char | commitment_out33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len | ||
| ) |
Definition at line 1276 of file bppp_bridge.c.
References purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 1111 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, purify_bulletproof_backend_resources::n_gates, secp256k1_bulletproof_circuit::n_gates, purify_bridge_checked_mul_size(), purify_build_bulletproof_assignment(), purify_build_bulletproof_circuit(), purify_bulletproof_backend_resources_create(), purify_bulletproof_backend_resources_destroy(), purify_bulletproof_circuit_evaluate(), purify_free_bulletproof_assignment(), purify_free_bulletproof_circuit(), 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 * | blind32, | ||
| const unsigned char | value_gen33[33], | ||
| const unsigned char | nonce32[32], | ||
| const unsigned char * | extra_commit, | ||
| size_t | extra_commit_len, | ||
| unsigned char | commitment_out33[33], | ||
| unsigned char * | proof_out, | ||
| size_t * | proof_len | ||
| ) |
Definition at line 1244 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 1099 of file bppp_bridge.c.
References purify_bridge_checked_add_size(), and secp256k1_bulletproof_innerproduct_proof_length().
| int purify_bulletproof_verify_circuit | ( | purify_secp_context * | context, |
| const purify_bulletproof_circuit_view * | circuit, | ||
| const unsigned char | commitment33[33], | ||
| 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 1302 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 1314 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_free_bulletproof_circuit(), 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 | commitment33[33], | ||
| 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 1406 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 139 of file bppp_bridge.c.
References purify_bridge_checked_mul_size().
Referenced by purify_build_bulletproof_circuit().
|
static |
Definition at line 42 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_offset_commitment(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_value_generator_h(), purify_bppp_verify_norm_arg_impl(), purify_bulletproof_backend_resources_create(), purify_pedersen_commit_char(), purify_point_add(), and purify_point_scale().
|
static |
Definition at line 1448 of file bppp_bridge.c.
References c_vec, l_vec, n_vec, purify_bridge_checked_add_size(), purify_bridge_checked_mul_size(), and secp256k1_scratch_alloc.
Referenced by purify_bppp_rangeproof_norm_product_prove_const().
|
static |
Definition at line 687 of file bppp_bridge.c.
Referenced by purify_bip340_sign_with_fixed_nonce().
|
static |
Definition at line 867 of file bppp_bridge.c.
References secp256k1_bulletproof_circuit_assignment::al, secp256k1_bulletproof_circuit_assignment::ao, secp256k1_bulletproof_circuit_assignment::ar, and secp256k1_bulletproof_circuit_assignment::v.
Referenced by purify_build_bulletproof_assignment(), and purify_bulletproof_prove_circuit_impl().
|
static |
Definition at line 854 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().
| 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 504 of file bppp_bridge.c.
Referenced by purify::hmac_sha256(), and purify_core_hkdf_sha256().
|
static |
Definition at line 127 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_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_verify_norm_arg_impl(), purify_build_bulletproof_assignment(), and purify_build_bulletproof_circuit().
|
static |
Definition at line 1418 of file bppp_bridge.c.
References c_vec, purify_serialize_point(), and rho.
Referenced by 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 808 of file bppp_bridge.c.
References purify_parse_scalar(), and scalar.
Referenced by purify_build_bulletproof_circuit(), and purify_build_row_family().
|
static |
Definition at line 835 of file bppp_bridge.c.
Referenced by purify_bulletproof_prove_circuit_impl(), and purify_bulletproof_verify_circuit_impl().
|
static |
Definition at line 847 of file bppp_bridge.c.
Referenced by purify_bppp_offset_commitment(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bulletproof_verify_circuit_impl(), purify_point_add(), and purify_point_scale().
|
static |
Definition at line 780 of file bppp_bridge.c.
References scalar.
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_offset_commitment(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), 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 792 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_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 1565 of file bppp_bridge.c.
References purify_context_handle(), 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 1825 of file bppp_bridge.c.
References 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 1800 of file bppp_bridge.c.
References purify_context_handle(), purify_parse_point_as_ge(), purify_parse_scalar(), purify_serialize_point(), and scalar.
| int purify_scalar_add | ( | purify_scalar * | out, |
| const purify_scalar * | lhs, | ||
| const purify_scalar * | rhs | ||
| ) |
Definition at line 442 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify_fe_add().
|
static |
Definition at line 390 of file bppp_bridge.c.
References scalar.
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 394 of file bppp_bridge.c.
References scalar.
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 450 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 426 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify_fe_eq().
| void purify_scalar_get_b32 | ( | unsigned char | output32[32], |
| const purify_scalar * | value | ||
| ) |
Definition at line 410 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify_fe_get_b32(), and purify::FieldElement::to_bytes_be().
| void purify_scalar_inverse | ( | purify_scalar * | out, |
| const purify_scalar * | value | ||
| ) |
Definition at line 434 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 438 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 422 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 418 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 414 of file bppp_bridge.c.
References purify_scalar_cast_const().
Referenced by purify::FieldElement::is_zero(), and purify_fe_is_zero().
| void purify_scalar_mul | ( | purify_scalar * | out, |
| const purify_scalar * | lhs, | ||
| const purify_scalar * | rhs | ||
| ) |
Definition at line 446 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify_fe_mul().
| void purify_scalar_negate | ( | purify_scalar * | out, |
| const purify_scalar * | value | ||
| ) |
Definition at line 430 of file bppp_bridge.c.
References purify_scalar_cast(), and purify_scalar_cast_const().
Referenced by purify::FieldElement::negate(), and purify_fe_negate().
| void purify_scalar_set_b32 | ( | purify_scalar * | out, |
| const unsigned char | input32[32], | ||
| int * | overflow | ||
| ) |
Definition at line 406 of file bppp_bridge.c.
References purify_scalar_cast().
Referenced by purify_fe_set_b32(), and purify::FieldElement::try_from_bytes32().
| void purify_scalar_set_int | ( | purify_scalar * | out, |
| unsigned int | value | ||
| ) |
Definition at line 398 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 402 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 46 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 69 of file bppp_bridge.c.
References purify_secp_context::ctx.
Referenced by purify::SecpContextDeleter::operator()().
|
static |
Definition at line 802 of file bppp_bridge.c.
Referenced by purify_bppp_commit_norm_arg_impl(), 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_bulletproof_prove_circuit_impl(), purify_norm_arg_commit_initial_data(), purify_pedersen_commit_char(), purify_point_add(), and purify_point_scale().
| 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 454 of file bppp_bridge.c.
Referenced by purify::bppp::generator_backend_cache_key(), purify_curve_tag_hash(), 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 471 of file bppp_bridge.c.
Referenced by purify::TaggedHash::digest_many(), and purify_curve_hash_to_int_tagged_u320().
|
static |
Definition at line 878 of file bppp_bridge.c.
References purify_bridge_checked_add_size().
Referenced by purify_build_bulletproof_circuit().