MOTION  0.01
Framework for mixed-protocol multi-party computation
simdify_gate.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2021 Oleksandr Tkachenko
4 // Cryptography and Privacy Engineering Group (ENCRYPTO)
5 // TU Darmstadt, Germany
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 
25 #pragma once
26 
27 #include <span>
28 #include <vector>
29 
30 #include "protocols/gate.h"
31 
32 // namespace encrypto::motion::proto::boolean_gmw
33 
34 namespace encrypto::motion {
35 
36 class Share;
37 using SharePointer = std::shared_ptr<Share>;
38 
39 class ShareWrapper;
40 
48 class SimdifyGate final : public OneGate {
49  public:
50  SimdifyGate(std::span<SharePointer> parents);
51 
52  ~SimdifyGate() = default;
53 
54  void EvaluateSetup() override;
55 
56  void EvaluateOnline() override;
57 
59 
60  SimdifyGate() = delete;
61 
62  SimdifyGate(const Gate&) = delete;
63 
64  private:
65  const std::size_t number_of_input_shares_;
66  std::size_t output_number_of_simd_values_{0};
67 };
68 
69 } // namespace encrypto::motion
encrypto::motion::Gate::gate_type_
GateType gate_type_
Definition: gate.h:105
encrypto::motion::SimdifyGate::~SimdifyGate
~SimdifyGate()=default
encrypto::motion::MpcProtocol::kArithmeticConstant
@ kArithmeticConstant
encrypto::motion::Gate::output_wires_
std::vector< WirePointer > output_wires_
Definition: gate.h:100
encrypto::motion::Gate::GetLogger
Logger & GetLogger()
Definition: gate.cpp:100
encrypto::motion::MpcProtocol::kBmr
@ kBmr
encrypto::motion::SimdifyGate::EvaluateOnline
void EvaluateOnline() override
Definition: simdify_gate.cpp:272
encrypto::motion::WirePointer
std::shared_ptr< Wire > WirePointer
Definition: register.h:40
configuration.h
bmr_wire.h
encrypto::motion::OneGate::parent_
std::vector< WirePointer > parent_
Definition: gate.h:155
encrypto::motion::SimdifyGate::EvaluateSetup
void EvaluateSetup() override
Definition: simdify_gate.cpp:208
encrypto::motion::MpcProtocol::kBooleanConstant
@ kBooleanConstant
encrypto::motion::GateType::kNonInteractive
@ kNonInteractive
encrypto::motion::SimdifyGate
yields a share that constitutes a concatenation of the parent in terms of their SIMD values,...
Definition: simdify_gate.h:48
encrypto::motion::Logger::LogDebug
void LogDebug(const std::string &message)
Definition: logger.cpp:142
encrypto::motion::SimdifyGate::GetOutputAsShare
SharePointer GetOutputAsShare()
Definition: simdify_gate.cpp:389
encrypto::motion::Gate::requires_online_interaction_
std::atomic< bool > requires_online_interaction_
Definition: gate.h:108
encrypto::motion::SimdifyGate::SimdifyGate
SimdifyGate()=delete
encrypto::motion::Gate::GetRegister
Register & GetRegister()
Definition: gate.cpp:96
constant_wire.h
encrypto::motion::MpcProtocol::kBooleanGmw
@ kBooleanGmw
bmr_share.h
encrypto::motion::Gate::GetId
std::int64_t GetId() const
Definition: gate.h:95
encrypto::motion::Register::IncrementEvaluatedGatesOnlineCounter
void IncrementEvaluatedGatesOnlineCounter()
Definition: register.cpp:125
constant_share.h
encrypto::motion::Gate::RegisterWaitingFor
void RegisterWaitingFor(std::size_t wire_id)
Definition: gate.cpp:36
boolean_gmw_wire.h
encrypto::motion::Gate::SetOnlineIsReady
void SetOnlineIsReady()
Definition: gate.cpp:54
encrypto::motion::ArithmeticGmwSimdifyOnline
void ArithmeticGmwSimdifyOnline(std::span< WirePointer > parent_wires, WirePointer output_wire)
Definition: simdify_gate.cpp:262
encrypto::motion::ArithmeticSimdifyOnlineImplementation
void ArithmeticSimdifyOnlineImplementation(std::span< WirePointer > parent_wires, WirePointer output_wire)
Definition: simdify_gate.cpp:244
encrypto::motion::Gate::backend_
Backend & backend_
Definition: gate.h:101
encrypto::motion::Gate::SetSetupIsReady
void SetSetupIsReady()
Definition: gate.cpp:46
encrypto::motion::Register::IncrementEvaluatedGatesSetupCounter
void IncrementEvaluatedGatesSetupCounter()
Definition: register.cpp:114
encrypto::motion::OneGate
Definition: gate.h:148
simdify_gate.h
register.h
logger.h
encrypto::motion
Definition: algorithm_description.cpp:35
arithmetic_gmw_share.h
encrypto::motion::SharePointer
std::shared_ptr< Share > SharePointer
Definition: conversion_gate.h:49
encrypto::motion::Gate::gate_id_
std::int64_t gate_id_
Definition: gate.h:102
encrypto::motion::Configuration::GetNumOfParties
std::size_t GetNumOfParties() const
Definition: configuration.h:56
encrypto::motion::Gate
Definition: gate.h:67
encrypto::motion::MpcProtocol
MpcProtocol
Definition: typedefs.h:140
encrypto::motion::ArithmeticConstantSimdifyOnline
void ArithmeticConstantSimdifyOnline(std::span< WirePointer > parent_wires, WirePointer output_wire)
Definition: simdify_gate.cpp:267
share.h
gate.h
encrypto::motion::MpcProtocol::kArithmeticGmw
@ kArithmeticGmw
encrypto::motion::Gate::WaitSetup
void WaitSetup() const
Definition: gate.cpp:68
encrypto::motion::Register::RegisterNextWire
void RegisterNextWire(WirePointer wire)
Definition: register.h:78
constants.h
encrypto::motion::kDebug
constexpr bool kDebug
Definition: config.h:36
encrypto::motion::proto::ConstantArithmeticWire
Definition: constant_wire.h:33
encrypto::motion::proto::arithmetic_gmw::Wire
Definition: arithmetic_gmw_wire.h:33
boolean_gmw_share.h
encrypto::motion::Gate::GetConfiguration
Configuration & GetConfiguration()
Definition: gate.cpp:98
encrypto::motion::Register::NextGateId
std::size_t NextGateId() noexcept
Definition: register.cpp:53
arithmetic_gmw_wire.h