diff options
author | stoffu <stoffu@protonmail.ch> | 2018-03-05 16:16:30 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-03-14 21:00:15 +0900 |
commit | 27a196b1268718dbc41e308c93b35c58f2da2eb4 (patch) | |
tree | f3e28abc5ef6efc4fd25530fa9b86df6edde664b /src/crypto/crypto.h | |
parent | device: made function prototypes consistent with pre-#3303 codebase (diff) | |
download | monero-27a196b1268718dbc41e308c93b35c58f2da2eb4.tar.xz |
device: untangle cyclic depenency
When #3303 was merged, a cyclic dependency chain was generated:
libdevice <- libcncrypto <- libringct <- libdevice
This was because libdevice needs access to a set of basic crypto operations
implemented in libringct such as scalarmultBase(), while libringct also needs
access to abstracted crypto operations implemented in libdevice such as
ecdhEncode(). To untangle this cyclic dependency chain, this patch splits libringct
into libringct_basic and libringct, where the basic crypto ops previously in
libringct are moved into libringct_basic. The cyclic dependency is now resolved
thanks to this separation:
libcncrypto <- libringct_basic <- libdevice <- libcryptonote_basic <- libringct
This eliminates the need for crypto_device.cpp and rctOps_device.cpp.
Also, many abstracted interfaces of hw::device such as encrypt_payment_id() and
get_subaddress_secret_key() were previously implemented in libcryptonote_basic
(cryptonote_format_utils.cpp) and were then called from hw::core::device_default,
which is odd because libdevice is supposed to be independent of libcryptonote_basic.
Therefore, those functions were moved to device_default.cpp.
Diffstat (limited to 'src/crypto/crypto.h')
-rw-r--r-- | src/crypto/crypto.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h index 75b333473..9d0e5066b 100644 --- a/src/crypto/crypto.h +++ b/src/crypto/crypto.h @@ -46,7 +46,6 @@ #include "hex.h" #include "span.h" #include "hash.h" -#include "device/device_declare.hpp" extern "C" { #include "crypto-ops.h" } @@ -156,17 +155,6 @@ namespace crypto { const public_key *const *, std::size_t, const signature *); }; - secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover, hw::device &hwdev); - secret_key generate_keys(public_key &pub, secret_key &sec, hw::device &hwdev); - bool secret_key_to_public_key(const secret_key &sec, public_key &pub, hw::device &hwdev); - bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation, hw::device &hwdev); - void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res, hw::device &hwdev) ; - bool derive_public_key(const key_derivation &derivation, size_t output_index, const public_key &base, public_key &derived_key, hw::device &hwdev); - void derive_secret_key(const key_derivation &derivation, size_t output_index, const secret_key &base, secret_key &derived_key, hw::device &hwdev); - bool derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &derived_key, hw::device &hwdev); - void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image, hw::device &hwdev); - - /* Generate N random bytes */ inline void rand(size_t N, uint8_t *bytes) { |