aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/crypto.h
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-01-11 11:45:40 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-01-11 11:45:40 -0500
commit3854cc04be5cbf0ae932727a75003d199f0899c3 (patch)
tree57ca5a963617e3ec55982d86c2c8599e0057a712 /src/crypto/crypto.h
parentMerge pull request #8653 (diff)
parentmiscellaneous crypto updates (diff)
downloadmonero-3854cc04be5cbf0ae932727a75003d199f0899c3.tar.xz
Merge pull request #8663
b1bce85 miscellaneous crypto updates (koe)
Diffstat (limited to 'src/crypto/crypto.h')
-rw-r--r--src/crypto/crypto.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index d8cd6c6a0..43ea59ac6 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -335,8 +335,16 @@ namespace crypto {
inline bool operator<(const public_key &p1, const public_key &p2) { return memcmp(&p1, &p2, sizeof(public_key)) < 0; }
inline bool operator>(const public_key &p1, const public_key &p2) { return p2 < p1; }
+ inline bool operator<(const key_image &p1, const key_image &p2) { return memcmp(&p1, &p2, sizeof(key_image)) < 0; }
+ inline bool operator>(const key_image &p1, const key_image &p2) { return p2 < p1; }
}
+// type conversions for easier calls to sc_add(), sc_sub(), hash functions
+inline unsigned char* to_bytes(crypto::ec_scalar &scalar) { return &reinterpret_cast<unsigned char&>(scalar); }
+inline const unsigned char* to_bytes(const crypto::ec_scalar &scalar) { return &reinterpret_cast<const unsigned char&>(scalar); }
+inline unsigned char* to_bytes(crypto::ec_point &point) { return &reinterpret_cast<unsigned char&>(point); }
+inline const unsigned char* to_bytes(const crypto::ec_point &point) { return &reinterpret_cast<const unsigned char&>(point); }
+
CRYPTO_MAKE_HASHABLE(public_key)
CRYPTO_MAKE_HASHABLE_CONSTANT_TIME(secret_key)
CRYPTO_MAKE_HASHABLE_CONSTANT_TIME(public_key_memsafe)