From c09f5f59ba8718c7170bedf13f8d0d9655b3381e Mon Sep 17 00:00:00 2001 From: Peter Rindal Date: Fri, 5 Apr 2024 10:42:51 -0700 Subject: [PATCH] MxCir update and fixes --- cryptoTools/Circuit/MxCircuit.h | 8 +++++++- cryptoTools/Circuit/MxTypes.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cryptoTools/Circuit/MxCircuit.h b/cryptoTools/Circuit/MxCircuit.h index d8915d7..475af10 100644 --- a/cryptoTools/Circuit/MxCircuit.h +++ b/cryptoTools/Circuit/MxCircuit.h @@ -130,7 +130,7 @@ namespace osuCrypto public: Circuit() = default; - Circuit(Circuit&&) = delete; + Circuit(Circuit&&) = default; Circuit(const Circuit&) = delete; enum ValueType @@ -414,6 +414,12 @@ namespace osuCrypto void evaluate(const std::vector& in, std::vector& out) { + + if (mInputs.size() == 0) + throw std::runtime_error("MxCircuit::evaluate(...), zero inputs to cirucit. " LOCATION); + if (mOutputs.size() == 0) + throw std::runtime_error("MxCircuit::evaluate(...), zero output from cirucit. " LOCATION); + if (in.size() != mInputs.size()) throw std::runtime_error("MxCircuit::evaluate(...), number of inputs provided is not correct. " LOCATION); out.resize(mOutputs.size()); diff --git a/cryptoTools/Circuit/MxTypes.h b/cryptoTools/Circuit/MxTypes.h index 5fc5e9a..e52aae9 100644 --- a/cryptoTools/Circuit/MxTypes.h +++ b/cryptoTools/Circuit/MxTypes.h @@ -197,6 +197,10 @@ namespace osuCrypto std::vector& asBits() { return *this; } const std::vector& asBits() const { return *this; } + static BVector makeFromSize(u64 s) + { + return BVector(s); + } }; // a crtp that implement the integer operations for type C.