Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecdsa.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
8
9#include "../../primitives/byte_array/byte_array.hpp"
10#include "../../primitives/circuit_builders/circuit_builders_fwd.hpp"
12namespace bb::stdlib {
13
14template <typename Builder> struct ecdsa_signature {
17
19 {
20 if (r.get_context() != nullptr) {
21 return r.get_context();
22 }
23
24 if (s.get_context() != nullptr) {
25 return s.get_context();
26 }
27
28 return nullptr;
29 }
30};
31
32template <typename Builder, typename Curve, typename Fq, typename Fr, typename G1>
33bool_t<Builder> ecdsa_verify_signature(const stdlib::byte_array<Builder>& hashed_message,
34 const G1& public_key,
35 const ecdsa_signature<Builder>& sig);
36
37template <typename Builder, typename Curve, typename Fq, typename Fr, typename G1>
38void validate_inputs(const stdlib::byte_array<Builder>& hashed_message,
39 const G1& public_key,
40 const ecdsa_signature<Builder>& sig);
41
42template <typename Builder> void generate_ecdsa_verification_test_circuit(Builder& builder, size_t num_iterations);
43
44} // namespace bb::stdlib
45
46#include "./ecdsa_impl.hpp"
Represents a dynamic array of bytes in-circuit.
AluTraceBuilder builder
Definition alu.test.cpp:123
void generate_ecdsa_verification_test_circuit(Builder &builder, size_t num_iterations)
Generate a simple ecdsa verification circuit for testing purposes.
bool_t< Builder > ecdsa_verify_signature(const stdlib::byte_array< Builder > &hashed_message, const G1 &public_key, const ecdsa_signature< Builder > &sig)
Verify ECDSA signature. Returns bool_t(true/false) depending on whether the signature is valid or not...
void validate_inputs(const stdlib::byte_array< Builder > &hashed_message, const G1 &public_key, const ecdsa_signature< Builder > &sig)
Validate the inputs used by the verification function and return messages if they produce an invalid ...
Curve::AffineElement G1
stdlib::byte_array< Builder > s
Definition ecdsa.hpp:16
Builder * get_context() const
Definition ecdsa.hpp:18
stdlib::byte_array< Builder > r
Definition ecdsa.hpp:15