barretenberg
Loading...
Searching...
No Matches
schnorr.hpp
1#pragma once
2#include "../../primitives/bool/bool.hpp"
3#include "../../primitives/byte_array/byte_array.hpp"
4#include "../../primitives/field/field.hpp"
5#include "../../primitives/group/cycle_group.hpp"
6#include "../../primitives/witness/witness.hpp"
7#include "barretenberg/crypto/schnorr/schnorr.hpp"
8
9namespace proof_system::plonk::stdlib::schnorr {
10
11template <typename C> struct signature_bits {
14};
15
16template <typename C> signature_bits<C> convert_signature(C* context, const crypto::schnorr::signature& sig);
17
18template <typename C>
19std::array<field_t<C>, 2> verify_signature_internal(const byte_array<C>& message,
20 const cycle_group<C>& pub_key,
21 const signature_bits<C>& sig);
22
23template <typename C>
24void verify_signature(const byte_array<C>& message, const cycle_group<C>& pub_key, const signature_bits<C>& sig);
25
26template <typename C>
27bool_t<C> signature_verification_result(const byte_array<C>& message,
28 const cycle_group<C>& pub_key,
29 const signature_bits<C>& sig);
30
31#define VERIFY_SIGNATURE_INTERNAL(circuit_type) \
32 std::array<field_t<circuit_type>, 2> verify_signature_internal<circuit_type>( \
33 const byte_array<circuit_type>&, const cycle_group<circuit_type>&, const signature_bits<circuit_type>&)
34
35#define VERIFY_SIGNATURE(circuit_type) \
36 void verify_signature<circuit_type>( \
37 const byte_array<circuit_type>&, const cycle_group<circuit_type>&, const signature_bits<circuit_type>&)
38
39#define SIGNATURE_VERIFICATION_RESULT(circuit_type) \
40 bool_t<circuit_type> signature_verification_result<circuit_type>( \
41 const byte_array<circuit_type>&, const cycle_group<circuit_type>&, const signature_bits<circuit_type>&)
42
43#define CONVERT_SIGNATURE(circuit_type) \
44 signature_bits<circuit_type> convert_signature<circuit_type>(circuit_type*, const crypto::schnorr::signature&)
45
46EXTERN_STDLIB_METHOD(VERIFY_SIGNATURE_INTERNAL)
47EXTERN_STDLIB_METHOD(VERIFY_SIGNATURE)
48EXTERN_STDLIB_METHOD(SIGNATURE_VERIFICATION_RESULT)
49EXTERN_STDLIB_METHOD(CONVERT_SIGNATURE)
50
51} // namespace proof_system::plonk::stdlib::schnorr
Definition: byte_array.hpp:9
cycle_group represents a group Element of the proving system's embedded curve i.e....
Definition: cycle_group.hpp:27
Definition: schnorr.hpp:25
cycle_scalar represents a member of the cycle curve SCALAR FIELD. This is NOT the native circuit fiel...
Definition: cycle_group.hpp:66