Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bbapi_schnorr.cpp
Go to the documentation of this file.
1
5
#include "
barretenberg/bbapi/bbapi_schnorr.hpp
"
6
7
namespace
bb::bbapi
{
8
9
SchnorrComputePublicKey::Response
SchnorrComputePublicKey::execute
(
BB_UNUSED
BBApiRequest
& request) &&
10
{
11
return
{
grumpkin::g1::one
* private_key };
12
}
13
14
SchnorrConstructSignature::Response
SchnorrConstructSignature::execute
(
BB_UNUSED
BBApiRequest
& request) &&
15
{
16
grumpkin::g1::affine_element
pub_key =
grumpkin::g1::one
* private_key;
17
crypto::schnorr_key_pair<grumpkin::fr, grumpkin::g1>
key_pair = { private_key, pub_key };
18
19
auto
sig = crypto::schnorr_construct_signature<grumpkin::fr, grumpkin::g1>(message_field, key_pair);
20
crypto::secure_erase_bytes
(&key_pair.
private_key
,
sizeof
(key_pair.
private_key
));
21
22
return
{ sig.s, sig.e };
23
}
24
25
SchnorrVerifySignature::Response
SchnorrVerifySignature::execute
(
BB_UNUSED
BBApiRequest
& request) &&
26
{
27
crypto::schnorr_signature
sig = { s, e };
28
29
bool
result = crypto::schnorr_verify_signature<grumpkin::fr, grumpkin::g1>(message_field, public_key, sig);
30
31
return
{ result };
32
}
33
34
}
// namespace bb::bbapi
bbapi_schnorr.hpp
Schnorr signature command definitions for the Barretenberg RPC API.
bb::group_elements::affine_element
Definition
affine_element.hpp:27
bb::group::one
static constexpr element one
Definition
group.hpp:48
BB_UNUSED
#define BB_UNUSED
Definition
compiler_hints.hpp:30
bb::bbapi
Definition
bbapi_avm.cpp:5
bb::crypto::secure_erase_bytes
void secure_erase_bytes(void *ptr, size_t size)
Definition
hmac.hpp:18
bb::bbapi::BBApiRequest
Definition
bbapi_shared.hpp:178
bb::bbapi::SchnorrComputePublicKey::Response
Definition
bbapi_schnorr.hpp:24
bb::bbapi::SchnorrComputePublicKey::execute
Response execute(BBApiRequest &request) &&
Definition
bbapi_schnorr.cpp:9
bb::bbapi::SchnorrConstructSignature::Response
Definition
bbapi_schnorr.hpp:44
bb::bbapi::SchnorrConstructSignature::execute
Response execute(BBApiRequest &request) &&
Definition
bbapi_schnorr.cpp:14
bb::bbapi::SchnorrVerifySignature::Response
Definition
bbapi_schnorr.hpp:66
bb::bbapi::SchnorrVerifySignature::execute
Response execute(BBApiRequest &request) &&
Definition
bbapi_schnorr.cpp:25
bb::crypto::schnorr_key_pair
Definition
schnorr.hpp:12
bb::crypto::schnorr_key_pair::private_key
Fr private_key
Definition
schnorr.hpp:13
bb::crypto::schnorr_signature
Definition
schnorr.hpp:23
src
barretenberg
bbapi
bbapi_schnorr.cpp
Generated by
1.9.8