fix(crypto): restore vendored boost compat
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
bc3e208691
commit
51d5ce9f14
4 changed files with 72 additions and 4 deletions
|
|
@ -63,7 +63,7 @@ func ringOutputSpendKey(height uint64, target types.TxOutTarget) (types.PublicKe
|
|||
switch t := target.(type) {
|
||||
case types.TxOutMultisig:
|
||||
if len(t.Keys) == 0 {
|
||||
return types.PublicKey{}, fmt.Errorf("unsupported multisig target with no keys")
|
||||
return types.PublicKey{}, coreerr.E("ringOutputSpendKey", "multisig target has no keys", nil)
|
||||
}
|
||||
return t.Keys[0], nil
|
||||
case types.TxOutHTLC:
|
||||
|
|
@ -72,7 +72,7 @@ func ringOutputSpendKey(height uint64, target types.TxOutTarget) (types.PublicKe
|
|||
}
|
||||
return t.PKRedeem, nil
|
||||
default:
|
||||
return types.PublicKey{}, fmt.Errorf("unsupported target type %T", target)
|
||||
return types.PublicKey{}, coreerr.E("ringOutputSpendKey", fmt.Sprintf("unsupported target type %T", target), nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ target_compile_options(randomx PRIVATE
|
|||
|
||||
# --- Find system dependencies ---
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
# --- Static library ---
|
||||
add_library(cryptonote STATIC ${C_SOURCES} ${CXX_SOURCES})
|
||||
|
|
@ -116,7 +115,6 @@ target_include_directories(cryptonote PRIVATE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/compat
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/randomx
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(cryptonote PRIVATE
|
||||
|
|
|
|||
67
crypto/compat/boost/multiprecision/cpp_int.hpp
Normal file
67
crypto/compat/boost/multiprecision/cpp_int.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// Copyright (c) 2017-2026 Lethean (https://lt.hn)
|
||||
//
|
||||
// Licensed under the European Union Public Licence (EUPL) version 1.2.
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost {
|
||||
namespace multiprecision {
|
||||
|
||||
using limb_type = std::uint64_t;
|
||||
|
||||
enum cpp_integer_type {
|
||||
signed_magnitude,
|
||||
unsigned_magnitude,
|
||||
};
|
||||
|
||||
enum cpp_int_check_type {
|
||||
unchecked,
|
||||
checked,
|
||||
};
|
||||
|
||||
enum expression_template_option {
|
||||
et_off,
|
||||
et_on,
|
||||
};
|
||||
|
||||
template <unsigned MinBits = 0, unsigned MaxBits = 0,
|
||||
cpp_integer_type SignType = signed_magnitude,
|
||||
cpp_int_check_type Checked = unchecked,
|
||||
class Allocator = void>
|
||||
class cpp_int_backend {};
|
||||
|
||||
template <class Backend, expression_template_option ExpressionTemplates = et_off>
|
||||
class number {
|
||||
public:
|
||||
number() = default;
|
||||
number(unsigned long long) {}
|
||||
|
||||
class backend_type {
|
||||
public:
|
||||
std::size_t size() const { return 0; }
|
||||
static constexpr std::size_t limb_bits = sizeof(limb_type) * 8;
|
||||
|
||||
limb_type *limbs() { return nullptr; }
|
||||
const limb_type *limbs() const { return nullptr; }
|
||||
|
||||
void resize(unsigned, unsigned) {}
|
||||
void normalize() {}
|
||||
};
|
||||
|
||||
backend_type &backend() { return backend_; }
|
||||
const backend_type &backend() const { return backend_; }
|
||||
|
||||
private:
|
||||
backend_type backend_{};
|
||||
};
|
||||
|
||||
using uint128_t = number<cpp_int_backend<128, 128, unsigned_magnitude, unchecked, void>>;
|
||||
using uint256_t = number<cpp_int_backend<256, 256, unsigned_magnitude, unchecked, void>>;
|
||||
using uint512_t = number<cpp_int_backend<512, 512, unsigned_magnitude, unchecked, void>>;
|
||||
|
||||
} // namespace multiprecision
|
||||
} // namespace boost
|
||||
|
|
@ -16,6 +16,9 @@
|
|||
//
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <stdexcept>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include "crypto.h"
|
||||
#include "eth_signature.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue