diff --git a/.bazelignore b/.bazelignore index 1e107f5..74ecab7 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1 +1,4 @@ examples +cmake +docs +build diff --git a/README.md b/README.md index 4358234..9026c40 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ Yacl-r is a fork and extension of the C++ crypto library [secretflow/yacl](https - **bazel**: [.bazelversion](.bazelversion) file describes the recommended version of bazel. We recommend to use the official [bazelisk](https://github.com/bazelbuild/bazelisk?tab=readme-ov-file#installation) to manage bazel version. - **gcc >= 10.3** -- **[cmake](https://cmake.org/getting-started/)** - **[ninja/ninja-build](https://ninja-build.org/)** - **Perl 5 with core modules** (Required by [OpenSSL](https://github.com/openssl/openssl/blob/master/INSTALL.md#prerequisites)) diff --git a/examples/hesm2/BUILD.bazel b/examples/hesm2/BUILD.bazel new file mode 100644 index 0000000..e97e7de --- /dev/null +++ b/examples/hesm2/BUILD.bazel @@ -0,0 +1,40 @@ +# Copyright 2024 Guowei Ling. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@yacl//bazel:yacl.bzl", "yacl_cc_binary") + +package(default_visibility = ["//visibility:public"]) + +yacl_cc_binary( + name = "sm2_example", + srcs = [ + "ahesm2.cc", + "ahesm2.h", + "ciphertext.h", + "config.cc", + "config.h", + "main.cc", + "private_key.h", + "public_key.h", + "t1.h", + "t2.h", + ], + deps = [ + "@yacl//yacl/crypto/ecc:spi", + "@yacl//yacl/crypto/ecc/openssl", + "@yacl//yacl/crypto/tools:cuckoo_index", # 添加 cuckoo_index 依赖 + "@yacl//yacl/math/mpint", + "@yacl//yacl/utils/spi", + ], +) diff --git a/yacl/crypto/tools/BUILD.bazel b/yacl/crypto/tools/BUILD.bazel index 2ef47cd..ff7bfa5 100644 --- a/yacl/crypto/tools/BUILD.bazel +++ b/yacl/crypto/tools/BUILD.bazel @@ -119,3 +119,24 @@ yacl_cc_binary( "@com_github_google_benchmark//:benchmark_main", ], ) + +yacl_cc_library( + name = "cuckoo_index", + srcs = ["cuckoo_index.cc"], + hdrs = ["cuckoo_index.h"], + linkopts = ["-lm"], + deps = [ + "//yacl/base:exception", + "//yacl/base:int128", + "@com_google_absl//absl/types:span", + ], +) + +yacl_cc_test( + name = "cuckoo_index_test", + srcs = ["cuckoo_index_test.cc"], + deps = [ + ":cuckoo_index", + "//yacl/crypto/rand", + ], +) diff --git a/yacl/utils/cuckoo_index.cc b/yacl/crypto/tools/cuckoo_index.cc similarity index 98% rename from yacl/utils/cuckoo_index.cc rename to yacl/crypto/tools/cuckoo_index.cc index 29850e3..7eff417 100644 --- a/yacl/utils/cuckoo_index.cc +++ b/yacl/crypto/tools/cuckoo_index.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "yacl/utils/cuckoo_index.h" +#include "yacl/crypto/tools/cuckoo_index.h" #include #include @@ -147,4 +147,4 @@ uint8_t CuckooIndex::MinCollidingHashIdx(uint64_t bin_index) const { return -1; } -} // namespace yacl \ No newline at end of file +} // namespace yacl diff --git a/yacl/utils/cuckoo_index.h b/yacl/crypto/tools/cuckoo_index.h similarity index 100% rename from yacl/utils/cuckoo_index.h rename to yacl/crypto/tools/cuckoo_index.h diff --git a/yacl/utils/cuckoo_index_test.cc b/yacl/crypto/tools/cuckoo_index_test.cc similarity index 98% rename from yacl/utils/cuckoo_index_test.cc rename to yacl/crypto/tools/cuckoo_index_test.cc index 1912bfb..b3d1cb6 100644 --- a/yacl/utils/cuckoo_index_test.cc +++ b/yacl/crypto/tools/cuckoo_index_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "yacl/utils/cuckoo_index.h" +#include "yacl/crypto/tools/cuckoo_index.h" #include diff --git a/yacl/engine/plaintext/BUILD.bazel b/yacl/engine/plaintext/BUILD.bazel new file mode 100644 index 0000000..30d371b --- /dev/null +++ b/yacl/engine/plaintext/BUILD.bazel @@ -0,0 +1,39 @@ +# Copyright 2022 Ant Group Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test") + +package(default_visibility = ["//visibility:public"]) + +yacl_cc_library( + name = "executor", + srcs = ["executor.cc"], + hdrs = ["executor.h"], + deps = [ + "//yacl/base:dynamic_bitset", + "//yacl/base:int128", + "//yacl/io/circuit:bristol_fashion", + ], +) + +yacl_cc_test( + name = "executor_test", + srcs = ["executor_test.cc"], + data = ["//yacl/io/circuit:circuit_data"], + deps = [ + "executor", + "//yacl/crypto/block_cipher:symmetric_crypto", + "//yacl/crypto/rand", + ], +) diff --git a/yacl/utils/circuit_executor.cc b/yacl/engine/plaintext/executor.cc similarity index 69% rename from yacl/utils/circuit_executor.cc rename to yacl/engine/plaintext/executor.cc index 856b8cb..1abf29e 100644 --- a/yacl/utils/circuit_executor.cc +++ b/yacl/engine/plaintext/executor.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "yacl/utils/circuit_executor.h" +#include "yacl/engine/plaintext/executor.h" -namespace yacl { +namespace yacl::engine { namespace { class PlaintextCore { @@ -25,24 +25,13 @@ class PlaintextCore { }; } // namespace -template -void PlainExecutor::LoadCircuitFile(const std::string& path) { +void PlainExecutor::LoadCircuitFile(const std::string& path) { io::CircuitReader reader(path); reader.ReadAll(); circ_ = reader.StealCirc(); } -template -void PlainExecutor::SetupInputs(absl::Span inputs) { - YACL_ENFORCE(inputs.size() == circ_->niv); - for (auto input : inputs) { - wires_.append(input); - } - wires_.resize(circ_->nw); -} - -template -void PlainExecutor::Exec() { +void PlainExecutor::Exec() { // Evaluate all gates, sequentially for (const auto& gate : circ_->gates) { switch (gate.op) { @@ -82,22 +71,5 @@ void PlainExecutor::Exec() { } } -template -void PlainExecutor::Finalize(absl::Span outputs) { - YACL_ENFORCE(outputs.size() >= circ_->nov); - - size_t index = wires_.size(); - for (size_t i = 0; i < circ_->nov; ++i) { - dynamic_bitset result(circ_->now[i]); - for (size_t j = 0; j < circ_->now[i]; ++j) { - result[j] = wires_[index - circ_->now[i] + j]; - } - outputs[circ_->nov - i - 1] = *(T*)result.data(); - index -= circ_->now[i]; - } -} - -template class PlainExecutor; -template class PlainExecutor; -} // namespace yacl +} // namespace yacl::engine diff --git a/yacl/engine/plaintext/executor.h b/yacl/engine/plaintext/executor.h new file mode 100644 index 0000000..3028151 --- /dev/null +++ b/yacl/engine/plaintext/executor.h @@ -0,0 +1,99 @@ +// Copyright 2024 Ant Group Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include + +#include "yacl/base/byte_container_view.h" +#include "yacl/base/dynamic_bitset.h" +#include "yacl/base/int128.h" +#include "yacl/io/circuit/bristol_fashion.h" + +namespace yacl::engine { + +// plaintext protocol that executes everything without link + +class PlainExecutor { + public: + // Constructor + explicit PlainExecutor() = default; + + // Load circuit from file (local operation) + void LoadCircuitFile(const std::string &path); + + // Setup the input wire (local operation) + template + void SetupInputs(absl::Span inputs) { + YACL_ENFORCE(inputs.size() == circ_->niv); + + dynamic_bitset input_wires; + input_wires.resize(sizeof(T) * 8 * inputs.size()); + std::memcpy(input_wires.data(), inputs.data(), inputs.size() * sizeof(T)); + wires_.append(input_wires); + wires_.resize(circ_->nw); + } + + // Setup the input wire + void SetupInputBytes(ByteContainerView bytes) { + wires_.resize(circ_->nw); + std::memcpy(wires_.data(), bytes.data(), bytes.size()); + } + + // Execute the circuit + void Exec(); + + // Finalize and get the result + template + void Finalize(absl::Span outputs) { + YACL_ENFORCE(outputs.size() >= circ_->nov); + size_t index = wires_.size(); + for (size_t i = 0; i < circ_->nov; ++i) { + dynamic_bitset result(circ_->now[i]); + for (size_t j = 0; j < circ_->now[i]; ++j) { + result[j] = wires_[index - circ_->now[i] + j]; + } + outputs[circ_->nov - i - 1] = *(T *)result.data(); + index -= circ_->now[i]; + } + } + + std::vector FinalizeBytes() { + // Count the totoal number of output wires (a.k.a. output bits) + size_t total_out_bitnum = 0; + for (size_t i = 0; i < circ_->nov; ++i) { + total_out_bitnum += circ_->now[i]; + } + + // Make sure that the circuit output wire is full bytes + YACL_ENFORCE(total_out_bitnum % 8 == 0); + + const size_t wire_size = wires_.size(); + dynamic_bitset result(total_out_bitnum); + for (size_t i = 0; i < total_out_bitnum; ++i) { + result[total_out_bitnum - i - 1] = wires_[wire_size - i - 1]; + } + YACL_ENFORCE(result.size() == total_out_bitnum); + std::vector out(total_out_bitnum / 8); + std::memcpy(out.data(), result.data(), out.size()); + return out; + } + + private: + // NOTE: please make sure you use the correct order of wires + dynamic_bitset wires_; // shares + std::shared_ptr circ_; // bristol fashion circuit +}; + +} // namespace yacl::engine diff --git a/yacl/utils/circuit_executor_test.cc b/yacl/engine/plaintext/executor_test.cc similarity index 84% rename from yacl/utils/circuit_executor_test.cc rename to yacl/engine/plaintext/executor_test.cc index 9df0ad4..f51b6d9 100644 --- a/yacl/utils/circuit_executor_test.cc +++ b/yacl/engine/plaintext/executor_test.cc @@ -13,9 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "yacl/utils/circuit_executor.h" - -#include +#include "yacl/engine/plaintext/executor.h" #include "absl/strings/escaping.h" #include "gtest/gtest.h" @@ -23,10 +21,11 @@ #include "yacl/base/byte_container_view.h" #include "yacl/base/dynamic_bitset.h" #include "yacl/crypto/block_cipher/symmetric_crypto.h" +#include "yacl/crypto/hash/ssl_hash.h" #include "yacl/crypto/rand/rand.h" #include "yacl/io/circuit/bristol_fashion.h" -namespace yacl { +namespace yacl::engine { namespace { inline uint64_t Add64(uint64_t in1, uint64_t in2) { return in1 + in2; } @@ -64,11 +63,11 @@ uint128_t ReverseBytes(uint128_t x) { TEST(ArithmaticTest, Add64Test) { /* GIVEN */ - std::vector inputs = {crypto::FastRandU64(), crypto::FastRandU64()}; + std::vector inputs = {1, 3}; std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::Add64Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -84,7 +83,7 @@ TEST(ArithmaticTest, Sub64Test) { std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::Sub64Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -100,7 +99,7 @@ TEST(ArithmaticTest, Neg64Test) { std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::Neg64Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -116,7 +115,7 @@ TEST(ArithmaticTest, Mul64Test) { std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::Mul64Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -132,7 +131,7 @@ TEST(ArithmaticTest, Div64Test) { std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::Div64Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -149,7 +148,7 @@ TEST(ArithmaticTest, UDiv64Test) { /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::UDiv64Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -165,7 +164,7 @@ TEST(ArithmaticTest, EqzTest) { std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::EqzPath()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -188,7 +187,7 @@ TEST(CryptoTest, Aes128Test) { std::vector result(1); /* WHEN */ - PlainExecutor exec; + PlainExecutor exec; exec.LoadCircuitFile(io::BuiltinBFCircuit::Aes128Path()); exec.SetupInputs(absl::MakeSpan(inputs)); exec.Exec(); @@ -208,4 +207,25 @@ TEST(CryptoTest, Aes128Test) { EXPECT_EQ(ReverseBytes(result[0]), compare); } -} // namespace yacl +TEST(CryptoTest, Sha256Test) { + /* GIVEN */ + auto input = crypto::FastRandBytes(crypto::RandLtN(10)); + + std::string temp = "1"; + SPDLOG_INFO(absl::BytesToHexString( + ByteContainerView(io::BuiltinBFCircuit::PrepareSha256Input(temp)))); + + /* WHEN */ + // PlainExecutor exec; + // exec.LoadCircuitFile(io::BuiltinBFCircuit::Sha256Path()); + // exec.SetupInputBytes(io::BuiltinBFCircuit::PrepareSha256Input(input)); + // exec.Exec(); + // auto result = exec.FinalizeBytes(); + + /* THEN */ + // auto compare = crypto::Sha256Hash().Update(input).CumulativeHash(); + // SPDLOG_INFO(absl::BytesToHexString(ByteContainerView(result))); + // SPDLOG_INFO(absl::BytesToHexString(ByteContainerView(compare))); +} + +} // namespace yacl::engine diff --git a/yacl/io/circuit/bristol_fashion.h b/yacl/io/circuit/bristol_fashion.h index 3b669ab..2748fed 100644 --- a/yacl/io/circuit/bristol_fashion.h +++ b/yacl/io/circuit/bristol_fashion.h @@ -23,6 +23,7 @@ #include "spdlog/spdlog.h" +#include "yacl/base/byte_container_view.h" #include "yacl/base/exception.h" #include "yacl/io/stream/file_io.h" #include "yacl/io/stream/interface.h" @@ -136,6 +137,52 @@ class BuiltinBFCircuit { std::filesystem::current_path().string()); } + constexpr static std::array GetSha256InitialHashValues() { + return {0x6a, 0x09, 0xe6, 0x67, 0xbb, 0x67, 0xae, 0x85, 0x3c, 0x6e, 0xf3, + 0x72, 0xa5, 0x4f, 0xf5, 0x3a, 0x51, 0x0e, 0x52, 0x7f, 0x9b, 0x05, + 0x68, 0x8c, 0x1f, 0x83, 0xd9, 0xab, 0x5b, 0xe0, 0xcd, 0x19}; + } + + static std::vector PrepareSha256Input(ByteContainerView input) { + constexpr size_t kSha256FixPadSize = 1; // in bytes + constexpr size_t kSha256MessageBlockSize = 64; // in bytes + + uint64_t input_size = input.size(); + constexpr auto kInitSha256Bytes = GetSha256InitialHashValues(); + uint64_t zero_padding_size = + (input_size + kSha256FixPadSize) % kSha256MessageBlockSize == 0 + ? 0 + : kSha256MessageBlockSize - + (input_size + kSha256FixPadSize) % kSha256MessageBlockSize; + uint64_t message_size = input_size + kSha256FixPadSize + zero_padding_size; + uint64_t result_size = message_size + kInitSha256Bytes.size(); + + YACL_ENFORCE(message_size % kSha256MessageBlockSize == 0); + + // Declare the resut byte-vector + std::vector result(result_size); + + // original input message + size_t offset = kInitSha256Bytes.size(); + std::memcpy(result.data() + offset, input.data(), input_size); + + // additional padding (as a mark) + offset = kInitSha256Bytes.size() + input_size; + result[offset] = 0x80; + + // zero padding (result vector has zero initialization) + // ... should doing nothing ... + + // the last 64 bits should be the byte length of input message + offset = kInitSha256Bytes.size() + input_size + kSha256FixPadSize; + std::memcpy(result.data() + offset, &input_size, sizeof(uint64_t)); + + // initial hash values + std::memcpy(result.data(), kInitSha256Bytes.data(), kInitSha256Bytes.size()); + + return result; + } + // NOTE: For AES-128 the wire orders are in the reverse order as used in // the examples given in our earlier `Bristol Format', thus bit 0 becomes bit // 127 etc, for key, plaintext and message. @@ -149,10 +196,10 @@ class BuiltinBFCircuit { // NOTE: sha256 needs two inputs, a 512 bit buffer, and a 256 bit previous // digest value // - // static std::string Sha256Path() { - // return fmt::format("{}/yacl/io/circuit/data/sha256.txt", - // std::filesystem::current_path().string()); - // } + static std::string Sha256Path() { + return fmt::format("{}/yacl/io/circuit/data/sha256.txt", + std::filesystem::current_path().string()); + } }; } // namespace yacl::io diff --git a/yacl/kernel/algorithms/BUILD.bazel b/yacl/kernel/algorithms/BUILD.bazel index 175a995..e649582 100644 --- a/yacl/kernel/algorithms/BUILD.bazel +++ b/yacl/kernel/algorithms/BUILD.bazel @@ -219,6 +219,7 @@ yacl_cc_library( "//yacl/crypto/hash:hash_utils", "//yacl/crypto/rand", "//yacl/crypto/tools:common", + "//yacl/crypto/tools:cuckoo_index", "//yacl/crypto/tools:prg", "//yacl/crypto/tools:rp", "//yacl/kernel/algorithms:gywz_ote", @@ -228,7 +229,6 @@ yacl_cc_library( "//yacl/link", "//yacl/math:gadget", "//yacl/math/galois_field:gf_intrinsic", - "//yacl/utils:cuckoo_index", ], ) diff --git a/yacl/kernel/algorithms/ferret_ote.cc b/yacl/kernel/algorithms/ferret_ote.cc index 7f6535f..af46fd7 100644 --- a/yacl/kernel/algorithms/ferret_ote.cc +++ b/yacl/kernel/algorithms/ferret_ote.cc @@ -20,7 +20,7 @@ #include #include "yacl/base/aligned_vector.h" -#include "yacl/utils/cuckoo_index.h" +#include "yacl/crypto/tools/cuckoo_index.h" #include "yacl/utils/serialize.h" namespace yacl::crypto { diff --git a/yacl/utils/BUILD.bazel b/yacl/utils/BUILD.bazel index e0b3ab4..c203487 100644 --- a/yacl/utils/BUILD.bazel +++ b/yacl/utils/BUILD.bazel @@ -16,28 +16,6 @@ load("//bazel:yacl.bzl", "OMP_CFLAGS", "OMP_DEPS", "OMP_LINKFLAGS", "yacl_cc_bin package(default_visibility = ["//visibility:public"]) -yacl_cc_library( - name = "circuit_executor", - srcs = ["circuit_executor.cc"], - hdrs = ["circuit_executor.h"], - deps = [ - "//yacl/base:dynamic_bitset", - "//yacl/base:int128", - "//yacl/io/circuit:bristol_fashion", - ], -) - -yacl_cc_test( - name = "circuit_executor_test", - srcs = ["circuit_executor_test.cc"], - data = ["//yacl/io/circuit:circuit_data"], - deps = [ - "circuit_executor", - "//yacl/crypto/block_cipher:symmetric_crypto", - "//yacl/crypto/rand", - ], -) - yacl_cc_library( name = "hamming", hdrs = ["hamming.h"], @@ -210,27 +188,6 @@ yacl_cc_binary( ], ) -yacl_cc_library( - name = "cuckoo_index", - srcs = ["cuckoo_index.cc"], - hdrs = ["cuckoo_index.h"], - linkopts = ["-lm"], - deps = [ - "//yacl/base:exception", - "//yacl/base:int128", - "@com_google_absl//absl/types:span", - ], -) - -yacl_cc_test( - name = "cuckoo_index_test", - srcs = ["cuckoo_index_test.cc"], - deps = [ - ":cuckoo_index", - "//yacl/crypto/rand", - ], -) - yacl_cc_library( name = "platform_utils", srcs = ["platform_utils.cc"], diff --git a/yacl/utils/circuit_executor.h b/yacl/utils/circuit_executor.h deleted file mode 100644 index fe824cf..0000000 --- a/yacl/utils/circuit_executor.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2024 Ant Group Co., Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include - -#include "yacl/base/dynamic_bitset.h" -#include "yacl/io/circuit/bristol_fashion.h" - -namespace yacl { - -// plaintext protocol that executes everything without link - -template -class PlainExecutor { - public: - // Constructor - explicit PlainExecutor() = default; - - // Load circuit from file (local operation) - void LoadCircuitFile(const std::string &path); - - // Setup the input wire (local operation) - void SetupInputs(absl::Span inputs); - - // Execute the circuit - void Exec(); - - // Finalize and get the result - void Finalize(absl::Span outputs); - - private: - // NOTE: please make sure you use the correct order of wires - dynamic_bitset wires_; // shares - std::shared_ptr circ_; // bristol fashion circuit -}; - -} // namespace yacl