barretenberg
Loading...
Searching...
No Matches
ecdsa_secp256r1.hpp
1#pragma once
2#include "barretenberg/dsl/types.hpp"
3#include <vector>
4
5namespace acir_format {
6
8 // This is the byte representation of the hashed message.
9 std::vector<uint32_t> hashed_message;
10
11 // This is the supposed public key which signed the
12 // message, giving rise to the signature.
13 // Since Fr does not have enough bits to represent
14 // the prime field in secp256r1, a byte array is used.
15 // Can also use low and hi where lo=128 bits
16 std::vector<uint32_t> pub_x_indices;
17 std::vector<uint32_t> pub_y_indices;
18
19 // This is the result of verifying the signature
20 uint32_t result;
21
22 // This is the computed signature
23 //
24 std::vector<uint32_t> signature;
25
26 friend bool operator==(EcdsaSecp256r1Constraint const& lhs, EcdsaSecp256r1Constraint const& rhs) = default;
27};
28
29template <typename Builder>
30void create_ecdsa_r1_verify_constraints(Builder& builder,
31 const EcdsaSecp256r1Constraint& input,
32 bool has_valid_witness_assignments = true);
33
34template <typename Builder> void dummy_ecdsa_constraint(Builder& builder, EcdsaSecp256r1Constraint const& input);
35
36template <typename B> inline void read(B& buf, EcdsaSecp256r1Constraint& constraint)
37{
38 using serialize::read;
39 read(buf, constraint.hashed_message);
40 read(buf, constraint.signature);
41 read(buf, constraint.pub_x_indices);
42 read(buf, constraint.pub_y_indices);
43 read(buf, constraint.result);
44}
45
46template <typename B> inline void write(B& buf, EcdsaSecp256r1Constraint const& constraint)
47{
48 using serialize::write;
49 write(buf, constraint.hashed_message);
50 write(buf, constraint.signature);
51 write(buf, constraint.pub_x_indices);
52 write(buf, constraint.pub_y_indices);
53 write(buf, constraint.result);
54}
55
56} // namespace acir_format
Definition: ultra_circuit_builder.hpp:31
Definition: ecdsa_secp256r1.hpp:7