diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-14 10:46:14 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-16 19:36:02 +0000 |
commit | 80be2dca2b8abdc0dae515187038475062987bd8 (patch) | |
tree | 6c0ea4c48e4d6c75ecf9c62181cd62138af4d466 /tests/unit_tests/crypto.cpp | |
parent | Merge pull request #4814 (diff) | |
download | monero-80be2dca2b8abdc0dae515187038475062987bd8.tar.xz |
unit_tests: don't take the address of an unwrapped secret key
Diffstat (limited to 'tests/unit_tests/crypto.cpp')
-rw-r--r-- | tests/unit_tests/crypto.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/unit_tests/crypto.cpp b/tests/unit_tests/crypto.cpp index 29fa88f9d..e09ec7f7a 100644 --- a/tests/unit_tests/crypto.cpp +++ b/tests/unit_tests/crypto.cpp @@ -47,6 +47,9 @@ namespace "8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94" "6c7251d54154cfa92c173a0dd39c1f948b655970153799af2aeadc9ff1add0ea"; + template<typename T> void *addressof(T &t) { return &t; } + template<> void *addressof(crypto::secret_key &k) { return addressof(unwrap(unwrap(k))); } + template<typename T> bool is_formatted() { @@ -55,7 +58,7 @@ namespace static_assert(alignof(T) == 1, "T must have 1 byte alignment"); static_assert(sizeof(T) <= sizeof(source), "T is too large for source"); static_assert(sizeof(T) * 2 <= sizeof(expected), "T is too large for destination"); - std::memcpy(std::addressof(value), source, sizeof(T)); + std::memcpy(addressof(value), source, sizeof(T)); std::stringstream out; out << "BEGIN" << value << "END"; |