Checkpoint the party/runtime stack before share-program and malicious-mode work.
Ship the TLS mesh, composer, Beaver/Yao/leaf MPC, prep/online paths, apps, and docs so the tree is pushable before elevating share_expr, security_mode, and prep resume. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
695f8e84f7
commit
0d22946a0e
1835 changed files with 170291 additions and 2849 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#define LIBDPF_INCLUDE_DPF_UTILS_HPP__
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
#include <string_view>
|
||||
#include <iterator>
|
||||
|
|
@ -183,6 +184,16 @@ using digest_type = std::array<psnip_uint8_t, 32>;
|
|||
namespace utils
|
||||
{
|
||||
|
||||
/// @brief Byte copy whose destination is `void *`, so `-Wclass-memaccess` does
|
||||
/// not fire on a class leaf or buffer element.
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
HEDLEY_NO_THROW
|
||||
void raw_memcpy(void * dst, const void * src, std::size_t n) noexcept
|
||||
{
|
||||
if (n != 0)
|
||||
std::memcpy(dst, src, n);
|
||||
}
|
||||
|
||||
/// @brief Ugly hack to implement `constexpr`-frien`dly conditional `throw`
|
||||
/// @tparam Exception exception
|
||||
/// @param b the `b`
|
||||
|
|
@ -526,16 +537,6 @@ struct make_default
|
|||
template <typename T>
|
||||
static constexpr T make_default_v = make_default<T>::value;
|
||||
|
||||
template <typename DpfKey,
|
||||
typename InputT = typename DpfKey::input_type,
|
||||
typename IntegralT = typename DpfKey::integral_type>
|
||||
static constexpr IntegralT get_node_mask(InputT mask, std::size_t level_index)
|
||||
{
|
||||
using dpf_type = DpfKey;
|
||||
constexpr auto to_int = to_integral_type<InputT>{};
|
||||
return static_cast<IntegralT>(to_int(mask) >> (level_index-1 + dpf_type::lg_outputs_per_leaf));
|
||||
}
|
||||
|
||||
/// @brief Logical right shift. Offsets at or past the width yield 0 (a `>>` of that
|
||||
/// width is undefined for the native unsigned types).
|
||||
/// @tparam IntegralT integral type
|
||||
|
|
@ -552,6 +553,19 @@ constexpr IntegralT shift_right(IntegralT value, std::size_t offset) noexcept
|
|||
return static_cast<IntegralT>(value >> offset);
|
||||
}
|
||||
|
||||
template <typename DpfKey,
|
||||
typename InputT = typename DpfKey::input_type,
|
||||
typename IntegralT = typename DpfKey::integral_type>
|
||||
static constexpr IntegralT get_node_mask(InputT mask, std::size_t level_index)
|
||||
{
|
||||
using dpf_type = DpfKey;
|
||||
constexpr auto to_int = to_integral_type<InputT>{};
|
||||
// `shift_right` (not a bare `>>`) so a resume at the leaf of a 128-bit
|
||||
// domain never shifts by the type width.
|
||||
return shift_right(static_cast<IntegralT>(to_int(mask)),
|
||||
level_index - 1 + dpf_type::lg_outputs_per_leaf);
|
||||
}
|
||||
|
||||
/// @brief Floor of `from_inclusive / 2^lg_opl`. `lg_opl` is `log2(outputs_per_leaf)`.
|
||||
/// @tparam IntegralT integral type
|
||||
/// @param from_inclusive the `from_inclusive`
|
||||
|
|
@ -1304,6 +1318,14 @@ struct flip_msb_for_input
|
|||
}
|
||||
};
|
||||
|
||||
/// @brief Flip the high bit of a signed domain point before the walk.
|
||||
/// @tparam T input type
|
||||
/// @param x the point, updated in place
|
||||
/// @warning Signed integers and `simde_int128` (`uses_signed_msb`) XOR the
|
||||
/// MSB so negative values sort below non-negative ones. Unsigned
|
||||
/// types, `modint`, and `xint` are unchanged. The flip is not part
|
||||
/// of the value the caller passed.
|
||||
/// @see dpf::utils::uses_signed_msb
|
||||
template <typename T>
|
||||
inline void flip_msb_if_signed_integral(T & x)
|
||||
{
|
||||
|
|
@ -1322,7 +1344,7 @@ auto get_common_part_hash(const std::array<InteriorNodeT, Depth> & correction_wo
|
|||
using zero_type = unsigned char;
|
||||
static constexpr zero_type zero{};
|
||||
|
||||
SHA256 h;
|
||||
class SHA256 h;
|
||||
digest_type digest;
|
||||
|
||||
h.add(&correction_words, sizeof(correction_words));
|
||||
|
|
@ -1353,7 +1375,7 @@ auto get_common_part_hash(const std::array<InteriorNodeT, Depth> & correction_wo
|
|||
using zero_type = unsigned char;
|
||||
static constexpr zero_type zero{};
|
||||
|
||||
SHA256 h;
|
||||
class SHA256 h;
|
||||
digest_type digest;
|
||||
|
||||
h.add(&correction_words, sizeof(correction_words));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue