-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Pull Request resolved: #488 Adding some quick shortcuts to Batch Types that are commonly used in MPC games. This should let us avoid having to redefine for each separate binary. Reviewed By: haochenuw Differential Revision: D43289317 Privacy Context Container: L1121121 fbshipit-source-id: f38f95f50baf8a590119d77029489896a61f4cda
- Loading branch information
1 parent
6f29481
commit 9fd30b9
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "fbpcf/frontend/Bit.h" | ||
#include "fbpcf/frontend/BitString.h" | ||
#include "fbpcf/frontend/Int.h" | ||
#include "fbpcf/frontend/mpcGame.h" | ||
|
||
namespace fbpcf::frontend { | ||
|
||
template <int schedulerId, bool usingBatch = true> | ||
class MPCTypes { | ||
static const size_t charLength = 8; | ||
static const size_t int32Length = 32; | ||
static const size_t int64Length = 64; | ||
|
||
public: | ||
/** Secure private types **/ | ||
using SecBool = typename MpcGame<schedulerId>::template SecBit<usingBatch>; | ||
|
||
// signed ints | ||
using SecChar = typename MpcGame< | ||
schedulerId>::template SecSignedInt<charLength, usingBatch>; | ||
using Sec32Int = typename MpcGame< | ||
schedulerId>::template SecSignedInt<int32Length, usingBatch>; | ||
using Sec64Int = typename MpcGame< | ||
schedulerId>::template SecSignedInt<int64Length, usingBatch>; | ||
|
||
// unsigned ints | ||
using SecUnsignedChar = typename MpcGame< | ||
schedulerId>::template SecUnsignedInt<charLength, usingBatch>; | ||
using SecUnsigned32Int = typename MpcGame< | ||
schedulerId>::template SecUnsignedInt<int32Length, usingBatch>; | ||
using SecUnsigned64Int = typename MpcGame< | ||
schedulerId>::template SecUnsignedInt<int64Length, usingBatch>; | ||
|
||
/** Public shared types **/ | ||
using PubBool = typename MpcGame<schedulerId>::template PubBit<usingBatch>; | ||
|
||
// signed ints | ||
using PubChar = typename MpcGame< | ||
schedulerId>::template PubSignedInt<charLength, usingBatch>; | ||
using Pub32Int = typename MpcGame< | ||
schedulerId>::template PubSignedInt<int32Length, usingBatch>; | ||
using Pub64Int = typename MpcGame< | ||
schedulerId>::template PubSignedInt<int64Length, usingBatch>; | ||
|
||
// unsigned ints | ||
using PubUnsignedChar = typename MpcGame< | ||
schedulerId>::template PubUnsignedInt<charLength, usingBatch>; | ||
using PubUnsigned32Int = typename MpcGame< | ||
schedulerId>::template PubUnsignedInt<int32Length, usingBatch>; | ||
using PubUnsigned64Int = typename MpcGame< | ||
schedulerId>::template PubUnsignedInt<int64Length, usingBatch>; | ||
}; | ||
|
||
} // namespace fbpcf::frontend |