From 9e6afc71429144b5efa09f31fca64f1c83b73919 Mon Sep 17 00:00:00 2001 From: Fabian Albert <fabian.albert@rohde-schwarz.com> Date: Fri, 8 Mar 2024 10:01:07 +0100 Subject: [PATCH] CI fix: Compatibility with 32-bit systems --- .../curve448/curve448_utils/curve448_gf.cpp | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/lib/pubkey/curve448/curve448_utils/curve448_gf.cpp b/src/lib/pubkey/curve448/curve448_utils/curve448_gf.cpp index 99e7d366d88..b875e57d53a 100644 --- a/src/lib/pubkey/curve448/curve448_utils/curve448_gf.cpp +++ b/src/lib/pubkey/curve448/curve448_utils/curve448_gf.cpp @@ -149,23 +149,6 @@ void reduce_after_mul(std::span<uint64_t, 7> out, std::span<const uint64_t, 14> } constexpr size_t words_per_uint64 = 8 / sizeof(word); -constexpr size_t bytes_per_uint64 = 8; - -template <size_t S> -std::array<word, S * words_per_uint64> span64_to_word_arr(std::span<const uint64_t, S> a) { - std::array<uint8_t, S * bytes_per_uint64> bytes; - copy_out_le(bytes.data(), bytes.size(), a.data()); - std::array<word, S * words_per_uint64> out; - load_le<word>(out.data(), bytes.data(), out.size()); - return out; -} - -template <size_t S> -void word_arr_to_span64(std::span<uint64_t, S> out, std::span<const word, S * words_per_uint64> in) { - std::array<uint8_t, S * bytes_per_uint64> bytes; - copy_out_le(bytes.data(), bytes.size(), in.data()); - load_le<uint64_t>(out.data(), bytes.data(), out.size()); -} void gf_mul(std::span<uint64_t, 7> out, std::span<const uint64_t, 7> a, std::span<const uint64_t, 7> b) { std::array<uint64_t, 14> ws; @@ -175,8 +158,8 @@ void gf_mul(std::span<uint64_t, 7> out, std::span<const uint64_t, 7> a, std::spa reinterpret_cast<const word*>(a.data()), reinterpret_cast<const word*>(b.data())); } else { - const auto a_arr = load_le<std::array<uint64_t, 7>>(store_le(a)); - const auto b_arr = load_le<std::array<uint64_t, 7>>(store_le(b)); + const auto a_arr = load_le<std::array<word, words_per_uint64 * 7>>(store_le(a)); + const auto b_arr = load_le<std::array<word, words_per_uint64 * 7>>(store_le(b)); auto ws_arr = std::array<word, words_per_uint64 * 14>{}; bigint_mul(ws_arr.data(), @@ -202,7 +185,7 @@ void gf_square(std::span<uint64_t, 7> out, std::span<const uint64_t, 7> a) { // Reinterpret cast to itself to prevent compiler errors on non 64-bit systems bigint_comba_sqr7(reinterpret_cast<word*>(ws.data()), reinterpret_cast<const word*>(a.data())); } else { - const auto a_arr = load_le<std::array<uint64_t, 7>>(store_le(a)); + const auto a_arr = load_le<std::array<word, words_per_uint64 * 7>>(store_le(a)); auto ws_arr = std::array<word, words_per_uint64 * 14>{}; bigint_sqr(ws_arr.data(), ws_arr.size(), a_arr.data(), a_arr.size(), a_arr.size(), nullptr, 0); load_le(ws, store_le(ws_arr));