Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecdsa_constraints.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
11#include <vector>
12
13namespace acir_format {
14
15using namespace bb;
16
33 // The byte representation of the hashed message.
34 std::array<uint32_t, 32> hashed_message;
35
36 // The signature
37 std::array<uint32_t, 64> signature;
38
39 // The public key against which the signature must be verified.
40 // Since Fr does not have enough bits to represent the prime field in
41 // secp256k1 or secp256r1, a byte array is used.
42 std::array<uint32_t, 32> pub_x_indices;
43 std::array<uint32_t, 32> pub_y_indices;
44
45 // Expected result of signature verification
46 uint32_t result;
47
48 // For serialization, update with any new fields
50 friend bool operator==(EcdsaConstraint const& lhs, EcdsaConstraint const& rhs) = default;
51};
52
53template <typename Curve>
54void create_ecdsa_verify_constraints(typename Curve::Builder& builder,
55 const EcdsaConstraint& input,
56 bool has_valid_witness_assignments = true);
57
58template <typename Curve>
59void create_dummy_ecdsa_constraint(typename Curve::Builder& builder,
60 const std::vector<stdlib::field_t<typename Curve::Builder>>& hashed_message_fields,
61 const std::vector<stdlib::field_t<typename Curve::Builder>>& r_fields,
62 const std::vector<stdlib::field_t<typename Curve::Builder>>& s_fields,
63 const std::vector<stdlib::field_t<typename Curve::Builder>>& pub_x_fields,
64 const std::vector<stdlib::field_t<typename Curve::Builder>>& pub_y_fields,
66
67} // namespace acir_format
AluTraceBuilder builder
Definition alu.test.cpp:123
void create_ecdsa_verify_constraints(typename Curve::Builder &builder, const EcdsaConstraint &input, bool has_valid_witness_assignments)
Create constraints to verify an ECDSA signature.
void create_dummy_ecdsa_constraint(typename Curve::Builder &builder, const std::vector< stdlib::field_t< typename Curve::Builder > > &hashed_message_fields, const std::vector< stdlib::field_t< typename Curve::Builder > > &r_fields, const std::vector< stdlib::field_t< typename Curve::Builder > > &s_fields, const std::vector< stdlib::field_t< typename Curve::Builder > > &pub_x_fields, const std::vector< stdlib::field_t< typename Curve::Builder > > &pub_y_fields, const stdlib::field_t< typename Curve::Builder > &result_field)
Generate dummy ECDSA constraints when the builder doesn't have witnesses.
Entry point for Barretenberg command-line interface.
std::array< uint32_t, 32 > pub_x_indices
MSGPACK_FIELDS(hashed_message, signature, pub_x_indices, pub_y_indices, result)
std::array< uint32_t, 32 > hashed_message
friend bool operator==(EcdsaConstraint const &lhs, EcdsaConstraint const &rhs)=default
std::array< uint32_t, 64 > signature
std::array< uint32_t, 32 > pub_y_indices