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: Complete, auditors: [Federico], commit: 05a381f8b31ae4648e480f1369e911b148216e8b}
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
11#include <vector>
12
13namespace acir_format {
14
15using namespace bb;
16
41
42 // The byte representation of the hashed message.
43 std::array<uint32_t, 32> hashed_message;
44
45 // The signature
46 std::array<uint32_t, 64> signature;
47
48 // The public key against which the signature must be verified.
49 // Since Fr does not have enough bits to represent the prime field in
50 // secp256k1 or secp256r1, a byte array is used.
51 std::array<uint32_t, 32> pub_x_indices;
52 std::array<uint32_t, 32> pub_y_indices;
53
54 // Predicate indicating whether the constraint should be disabled:
55 // - true: the constraint is valid
56 // - false: the constraint is disabled, i.e it must not fail and can return whatever.
58
59 // Expected result of signature verification
60 uint32_t result;
61
62 friend bool operator==(EcdsaConstraint const& lhs, EcdsaConstraint const& rhs) = default;
63};
64
65template <typename Curve>
66void create_ecdsa_verify_constraints(typename Curve::Builder& builder, const EcdsaConstraint& input);
67
68template <typename Curve>
69void create_dummy_ecdsa_constraint(typename Curve::Builder& builder,
70 const std::vector<stdlib::field_t<typename Curve::Builder>>& hashed_message_fields,
71 const std::vector<stdlib::field_t<typename Curve::Builder>>& r_fields,
72 const std::vector<stdlib::field_t<typename Curve::Builder>>& s_fields,
73 const std::vector<stdlib::field_t<typename Curve::Builder>>& pub_x_fields,
74 const std::vector<stdlib::field_t<typename Curve::Builder>>& pub_y_fields,
76
77} // namespace acir_format
AluTraceBuilder builder
Definition alu.test.cpp:124
void create_ecdsa_verify_constraints(typename Curve::Builder &builder, const EcdsaConstraint &input)
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.
Definition api.hpp:5
CurveType
Definition types.hpp:10
std::array< uint32_t, 32 > pub_x_indices
std::array< uint32_t, 32 > hashed_message
friend bool operator==(EcdsaConstraint const &lhs, EcdsaConstraint const &rhs)=default
WitnessOrConstant< bb::fr > predicate
std::array< uint32_t, 64 > signature
std::array< uint32_t, 32 > pub_y_indices