Skip to content

Commit

Permalink
fix: revert cbind breakage (#5348)
Browse files Browse the repository at this point in the history
These require careful naming for the binding script to understand.
  • Loading branch information
ludamad authored Mar 20, 2024
1 parent 13cef1f commit c237193
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
6 changes: 6 additions & 0 deletions barretenberg/cpp/src/barretenberg/crypto/blake2s/c_bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
#include <cstddef>
#include <cstdint>

extern "C" {

using namespace bb;

WASM_EXPORT void blake2s(uint8_t const* data, out_buf32 r);

WASM_EXPORT void blake2s_to_field_(uint8_t const* data, fr::out_buf r);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"

WASM_EXPORT void pedersen_commit(bb::fr::vec_in_buf inputs_buffer, bb::grumpkin::g1::affine_element::out_buf output);
extern "C" {

using namespace bb;
using affine_element = grumpkin::g1::affine_element;

WASM_EXPORT void pedersen_commit(fr::vec_in_buf inputs_buffer, affine_element::out_buf output);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include "barretenberg/common/wasm_export.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"

WASM_EXPORT void pedersen_hash(bb::fr::vec_in_buf inputs_buffer, uint32_t const* hash_index, bb::fr::out_buf output);
WASM_EXPORT void pedersen_hashes(bb::fr::vec_in_buf inputs_buffer, uint32_t const* hash_index, bb::fr::out_buf output);
WASM_EXPORT void pedersen_hash_buffer(uint8_t const* input_buffer, uint32_t const* hash_index, bb::fr::out_buf output);
extern "C" {

using namespace bb;

WASM_EXPORT void pedersen_hash(fr::vec_in_buf inputs_buffer, uint32_t const* hash_index, fr::out_buf output);
WASM_EXPORT void pedersen_hashes(fr::vec_in_buf inputs_buffer, uint32_t const* hash_index, fr::out_buf output);
WASM_EXPORT void pedersen_hash_buffer(uint8_t const* input_buffer, uint32_t const* hash_index, fr::out_buf output);
}
9 changes: 7 additions & 2 deletions barretenberg/cpp/src/barretenberg/crypto/poseidon2/c_bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
#include "barretenberg/common/wasm_export.hpp"
#include "barretenberg/ecc/curves/bn254/fr.hpp"

WASM_EXPORT void poseidon_hash(bb::fr::vec_in_buf inputs_buffer, bb::fr::out_buf output);
WASM_EXPORT void poseidon_hashes(bb::fr::vec_in_buf inputs_buffer, bb::fr::out_buf output);
extern "C" {

using namespace bb;

WASM_EXPORT void poseidon_hash(fr::vec_in_buf inputs_buffer, fr::out_buf output);
WASM_EXPORT void poseidon_hashes(fr::vec_in_buf inputs_buffer, fr::out_buf output);
}
2 changes: 2 additions & 0 deletions barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "schnorr.hpp"

using namespace bb;
using namespace bb::crypto;

using affine_element = grumpkin::g1::affine_element;
using multisig = crypto::schnorr_multisig<grumpkin::g1, KeccakHasher, Blake2sHasher>;
using multisig_public_key = typename multisig::MultiSigPublicKey;
Expand Down
9 changes: 5 additions & 4 deletions barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "multisig.hpp"

using namespace bb;
using namespace bb::crypto;
extern "C" {

using namespace bb;
using affine_element = grumpkin::g1::affine_element;
using multisig = schnorr_multisig<grumpkin::g1, KeccakHasher, Blake2sHasher>;
using multisig = crypto::schnorr_multisig<grumpkin::g1, bb::crypto::KeccakHasher, bb::crypto::Blake2sHasher>;

WASM_EXPORT void schnorr_compute_public_key(fr::in_buf private_key, affine_element::out_buf public_key_buf);
WASM_EXPORT void schnorr_negate_public_key(affine_element::in_buf public_key_buffer, affine_element::out_buf output);
Expand Down Expand Up @@ -42,4 +42,5 @@ WASM_EXPORT void schnorr_multisig_combine_signatures(uint8_t const* message,
fq::vec_in_buf round_two_buf,
out_buf32 s,
out_buf32 e,
bool* success);
bool* success);
}

0 comments on commit c237193

Please sign in to comment.