aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-10 12:48:20 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:30:19 +0100
commitd4b62a1e295a7fb19de6081733b1d8e0610cbf08 (patch)
treea40178b339e35090117d3b3d2680a79a0bc28ac6 /src/crypto
parentrct: rework v2 txes into prunable and non prunable data (diff)
downloadmonero-d4b62a1e295a7fb19de6081733b1d8e0610cbf08.tar.xz
rct amount key modified as per luigi1111's recommendations
This allows the key to be not the same for two outputs sent to the same address (eg, if you pay yourself, and also get change back). Also remove the key amounts lists and return parameters since we don't actually generate random ones, so we don't need to save them as we can recalculate them when needed if we have the correct keys.
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/crypto.cpp2
-rw-r--r--src/crypto/crypto.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
index f0ee3bdc3..250779ac3 100644
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -151,7 +151,7 @@ namespace crypto {
return true;
}
- static void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res) {
+ void crypto_ops::derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res) {
struct {
key_derivation derivation;
char output_index[(sizeof(size_t) * 8 + 6) / 7];
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index aa437d57d..b396fc7db 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -113,6 +113,8 @@ namespace crypto {
friend bool secret_key_to_public_key(const secret_key &, public_key &);
static bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &);
friend bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &);
+ static void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res);
+ friend void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res);
static bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &);
friend bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &);
static void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &);
@@ -181,6 +183,9 @@ namespace crypto {
const public_key &base, public_key &derived_key) {
return crypto_ops::derive_public_key(derivation, output_index, base, derived_key);
}
+ inline void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res) {
+ return crypto_ops::derivation_to_scalar(derivation, output_index, res);
+ }
inline void derive_secret_key(const key_derivation &derivation, std::size_t output_index,
const secret_key &base, secret_key &derived_key) {
crypto_ops::derive_secret_key(derivation, output_index, base, derived_key);