myl7/fss 2.0.0
Function secret sharing (FSS) primitives including distributed point/comparison function (DPF/DCF)
Loading...
Searching...
No Matches
compat.cuh
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
19
20#pragma once
21
22#include <cuda_runtime.h>
23#include <limits>
24#include <memory>
25#include <cuda/std/array>
26
27#ifndef FSS_ENABLE_V1_COMPAT
28#define FSS_ENABLE_V1_COMPAT 1
29#endif
30
31#if FSS_ENABLE_V1_COMPAT
32
33namespace fss::compat::detail {
34
35// Record templates backing the deprecated v1.3.0 aggregate-Key nested names.
36// Each scheme header exposes one of these through a deprecated alias, so the
37// deprecation warning fires only where the legacy name is spelled. Member
38// declarations and definitions use the record types directly: a deprecated
39// alias in a member signature would warn on every modern instantiation under
40// NVCC. The SchemeTag template parameter keeps the nested types of different
41// schemes distinct even when their field shapes coincide.
42
44template <typename SchemeTag, typename Cw, int n>
45struct CwsKeyRecord {
46 Cw cws[n];
47 int4 s0;
48};
49
51template <typename SchemeTag, typename Cw, int n>
52struct OcwKeyRecord {
53 [[deprecated("the par_depth template parameter is gone; pass par_depth to EvalAll() instead")]]
54 static constexpr int kParDepth = -1;
55 Cw cws[n];
56 int4 ocw;
57 int4 s0;
58};
59
61template <typename SchemeTag, typename Cw, int n>
62struct FcwKeyRecord {
63 Cw cws[n];
64 int4 fcw;
65 int4 s0;
66};
67
69template <typename SchemeTag, typename Cw, int n>
70struct VdpfKeyRecord {
71 Cw cws[n];
72 cuda::std::array<int4, 4> cs;
73 int4 ocw;
74 int4 s0;
75};
76
78template <typename SchemeTag>
79struct ParityTreeRecord {
80 bool *p;
81 bool b;
82};
83
85template <typename SchemeTag>
86struct PreprocessedTreeRecord {
87 std::unique_ptr<bool[]> p;
88 bool b;
89
90 [[deprecated("use PreprocessOwned() and OwnedParityTree::View()")]]
91 ParityTreeRecord<SchemeTag> view() const { return ParityTreeRecord<SchemeTag>{p.get(), b}; }
92};
93
100template <__uint128_t kLegacySize>
101constexpr int LegacyBucketSize() {
102 static_assert(kLegacySize <= static_cast<__uint128_t>(std::numeric_limits<int>::max()),
103 "legacy b_size: kBucketSize does not fit the legacy int domain");
104 return static_cast<int>(kLegacySize);
105}
106
108template <typename SchemeTag>
109struct EvalResultRecord {
110 int4 y;
111 cuda::std::array<int4, 4> pi_tilde;
112};
113
114} // namespace fss::compat::detail
115
116#endif // FSS_ENABLE_V1_COMPAT