diff --git a/barretenberg/cpp/src/barretenberg/crypto/blake2s/c_bind.hpp b/barretenberg/cpp/src/barretenberg/crypto/blake2s/c_bind.hpp index c1e14c07a00e..cf124a5a6c9e 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/blake2s/c_bind.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/blake2s/c_bind.hpp @@ -3,5 +3,11 @@ #include #include +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); +} diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/c_bind.hpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/c_bind.hpp index d90b4234cab4..a4a37b9eac54 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/c_bind.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/c_bind.hpp @@ -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); \ No newline at end of file +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); +} \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.hpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.hpp index cb39f6a6a425..e25cc79d1f32 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.hpp @@ -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); \ No newline at end of file +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); +} \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/c_bind.hpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/c_bind.hpp index 9915e0825766..e113b523dd18 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/c_bind.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/c_bind.hpp @@ -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); \ No newline at end of file +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); +} \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.cpp b/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.cpp index 79cc4b44767e..b5fc5570e86a 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.cpp @@ -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; using multisig_public_key = typename multisig::MultiSigPublicKey; diff --git a/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.hpp b/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.hpp index 9e4991ff7c35..51fd3f33a8db 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.hpp +++ b/barretenberg/cpp/src/barretenberg/crypto/schnorr/c_bind.hpp @@ -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; +using multisig = crypto::schnorr_multisig; 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); @@ -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); \ No newline at end of file + bool* success); +}