MOTION  0.01
Framework for mixed-protocol multi-party computation
shared_bits_data.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Lennart Braun
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 <cstdint>
28 #include <vector>
30 
31 namespace encrypto::motion {
32 
33 enum SharedBitsMessageType : std::uint8_t { kMaskMessage = 2, kReconstructMessage = 1 };
34 
36  void MessageReceived(const SharedBitsMessageType type, const std::uint8_t* message,
37  const std::size_t size);
38  void Clear();
39 
40  // register to receive the masked value during squaring
42 
43  // register to receive the reconstruction messages for a^2
45 
47  std::size_t mask_message_expected_size = 0;
50 };
51 
52 } // namespace encrypto::motion
shared_bits_data.h
encrypto::motion::SharedBitsData
Definition: shared_bits_data.h:35
encrypto::motion::kReconstructMessage
@ kReconstructMessage
Definition: shared_bits_data.h:33
encrypto::motion::SharedBitsData::RegisterForMaskMessage
ReusableFuture< std::vector< std::uint8_t > > RegisterForMaskMessage(size_t expected_size)
Definition: shared_bits_data.cpp:30
encrypto::motion::ReusableFuture
Definition: reusable_future.h:129
reusable_future.h
geninput.type
type
Definition: geninput.py:149
encrypto::motion::ReusablePromise::get_future
ReusableFuture< R, MutexType, ConditionVariableType > get_future()
Definition: reusable_future.h:242
encrypto::motion::SharedBitsMessageType
SharedBitsMessageType
Definition: shared_bits_data.h:33
encrypto::motion::SharedBitsData::mask_message_expected_size
std::size_t mask_message_expected_size
Definition: shared_bits_data.h:47
encrypto::motion::SharedBitsData::reconstruct_message_expected_size
std::size_t reconstruct_message_expected_size
Definition: shared_bits_data.h:49
encrypto::motion::SharedBitsData::Clear
void Clear()
encrypto::motion::SharedBitsData::mask_message_promise
ReusablePromise< std::vector< std::uint8_t > > mask_message_promise
Definition: shared_bits_data.h:46
encrypto::motion
Definition: algorithm_description.cpp:35
encrypto::motion::SharedBitsData::RegisterForReconstructMessage
ReusableFuture< std::vector< std::uint8_t > > RegisterForReconstructMessage(size_t expected_size)
Definition: shared_bits_data.cpp:37
encrypto::motion::SharedBitsData::MessageReceived
void MessageReceived(const SharedBitsMessageType type, const std::uint8_t *message, const std::size_t size)
Definition: shared_bits_data.cpp:44
encrypto::motion::SharedBitsData::reconstruct_message_promise
ReusablePromise< std::vector< std::uint8_t > > reconstruct_message_promise
Definition: shared_bits_data.h:48
encrypto::motion::ReusablePromise
Definition: reusable_future.h:123
encrypto::motion::ReusablePromise::set_value
void set_value(const R &value)
Definition: reusable_future.h:226
encrypto::motion::kMaskMessage
@ kMaskMessage
Definition: shared_bits_data.h:33