35#include <boost/optional.hpp>
75 std::vector<public_key> keys;
80 std::vector<secret_key> keys;
174 typename std::enable_if<std::is_pod<T>::value,
T>::type
rand() {
175 typename std::remove_cv<T>::type
res;
193 typename std::enable_if<std::is_integral<T>::value,
T>::type
rand_range(
T range_min,
T range_max) {
195 std::uniform_int_distribution<T> dis(range_min, range_max);
202 typename std::enable_if<std::is_unsigned<T>::value,
T>::type
rand_idx(
T sz) {
203 return crypto::rand_range<T>(0, sz-1);
281 const public_key *
const *pubs, std::size_t pubs_count,
287 const public_key *
const *pubs, std::size_t pubs_count,
295 const std::vector<const public_key *> &pubs,
301 const std::vector<const public_key *> &pubs,
void operator=(const crypto_ops &)
friend bool secret_key_to_public_key(const secret_key &, public_key &)
Definition: crypto.h:220
static void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &)
friend void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.h:237
friend void generate_key_image(const public_key &, const secret_key &, key_image &)
Definition: crypto.h:277
friend bool derive_subaddress_public_key(const public_key &, const key_derivation &, std::size_t, public_key &)
Definition: crypto.h:244
friend void generate_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const secret_key &, signature &)
Definition: crypto.h:261
friend void derive_view_tag(const key_derivation &, std::size_t, view_tag &)
Definition: crypto.h:310
friend bool check_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const signature *)
Definition: crypto.h:286
static bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &)
friend void generate_signature(const hash &, const public_key &, const secret_key &, signature &)
Definition: crypto.h:250
static void derive_view_tag(const key_derivation &, std::size_t, view_tag &)
crypto_ops(const crypto_ops &)
friend void generate_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *)
Definition: crypto.h:280
friend void generate_tx_proof_v1(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const secret_key &, signature &)
Definition: crypto.h:264
friend bool check_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional< public_key > &, const public_key &, const signature &, const int)
Definition: crypto.h:267
static void generate_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const secret_key &, std::size_t, signature *)
friend bool derive_public_key(const key_derivation &, std::size_t, const public_key &, public_key &)
Definition: crypto.h:233
static bool check_ring_signature(const hash &, const key_image &, const public_key *const *, std::size_t, const signature *)
friend void derive_secret_key(const key_derivation &, std::size_t, const secret_key &, secret_key &)
Definition: crypto.h:240
friend bool generate_key_derivation(const public_key &, const secret_key &, key_derivation &)
Definition: crypto.h:230
friend bool check_key(const public_key &)
Definition: crypto.h:214
friend bool check_signature(const hash &, const public_key &, const signature &)
Definition: crypto.h:253
friend secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key, bool recover)
Definition: crypto.h:208
#define CRYPTO_MAKE_HASHABLE_CONSTANT_TIME(type)
Definition: generic-ops.h:79
#define CRYPTO_MAKE_COMPARABLE(type)
Definition: generic-ops.h:38
#define CRYPTO_MAKE_HASHABLE(type)
Definition: generic-ops.h:75
void * memcpy(void *a, const void *b, size_t c)
Definition: glibc_compat.cpp:16
const char * res
Definition: hmac_keccak.cpp:42
const char * key
Definition: hmac_keccak.cpp:40
static int version
Definition: mdb_load.c:29
crypto namespace.
Definition: crypto.cpp:60
POD_CLASS secret_keyV
Definition: crypto.h:79
void add_extra_entropy_thread_safe(const void *ptr, size_t bytes)
Definition: crypto.cpp:105
const crypto::public_key null_pkey
Definition: crypto.cpp:74
void generate_signature(const hash &prefix_hash, const public_key &pub, const secret_key &sec, signature &sig)
Definition: crypto.h:250
POD_CLASS public_keyM
Definition: crypto.h:84
void derive_view_tag(const key_derivation &derivation, std::size_t output_index, view_tag &vt)
Definition: crypto.h:310
bool check_key(const public_key &key)
Definition: crypto.h:214
void generate_random_bytes_thread_safe(size_t N, uint8_t *bytes)
Definition: crypto.cpp:99
std::enable_if< std::is_pod< T >::value, T >::type rand()
Definition: crypto.h:174
POD_CLASS ec_point
Definition: crypto.h:55
void generate_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional< public_key > &B, const public_key &D, const secret_key &r, signature &sig)
Definition: crypto.h:261
POD_CLASS signature
Definition: crypto.h:98
const crypto::secret_key null_skey
Definition: crypto.cpp:75
bool operator>(const public_key &p1, const public_key &p2)
Definition: crypto.h:337
std::enable_if< std::is_integral< T >::value, T >::type rand_range(T range_min, T range_max)
Definition: crypto.h:193
POD_CLASS public_keyV
Definition: crypto.h:74
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:72
bool derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &result)
Definition: crypto.h:244
POD_CLASS key_derivation
Definition: crypto.h:91
POD_CLASS view_tag
Definition: crypto.h:103
POD_CLASS public_key_memsafe
Definition: crypto.h:68
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.h:208
void derive_secret_key(const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
Definition: crypto.h:240
std::vector< secret_keyV > column_vectors
Definition: crypto.h:87
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
Definition: crypto.h:230
void generate_ring_signature(const hash &prefix_hash, const key_image &image, const public_key *const *pubs, std::size_t pubs_count, const secret_key &sec, std::size_t sec_index, signature *sig)
Definition: crypto.h:280
POD_CLASS public_key
Definition: crypto.h:64
bool check_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional< public_key > &B, const public_key &D, const signature &sig, const int version)
Definition: crypto.h:267
void random32_unbiased(unsigned char *bytes)
Definition: crypto.cpp:123
bool derive_public_key(const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
Definition: crypto.h:233
std::ostream & operator<<(std::ostream &o, const crypto::public_key &v)
Definition: crypto.h:314
POD_CLASS key_image
Definition: crypto.h:95
bool operator<(const public_key &p1, const public_key &p2)
Definition: crypto.h:336
bool check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig)
Definition: crypto.h:253
POD_CLASS ec_scalar
Definition: crypto.h:59
bool secret_key_to_public_key(const secret_key &sec, public_key &pub)
Definition: crypto.h:220
std::enable_if< std::is_unsigned< T >::value, T >::type rand_idx(T sz)
Definition: crypto.h:202
void hash_to_scalar(const void *data, size_t length, ec_scalar &res)
Definition: crypto.cpp:143
int rows
Definition: crypto.h:76
POD_CLASS hash
Definition: hash.h:48
void generate_tx_proof_v1(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional< public_key > &B, const public_key &D, const secret_key &r, signature &sig)
Definition: crypto.h:264
void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.h:237
bool check_ring_signature(const hash &prefix_hash, const key_image &image, const public_key *const *pubs, std::size_t pubs_count, const signature *sig)
Definition: crypto.h:286
span< const std::uint8_t > as_byte_span(const T &src) noexcept
Definition: span.h:152
#define POD_CLASS
Definition: pod-class.h:43
tools::wallet2::message_signature_result_t result
Definition: signature.cpp:62
unsigned char uint8_t
Definition: stdint.h:124
unsigned __int64 uint64_t
Definition: stdint.h:136
static constexpr result_type min()
Definition: crypto.h:185
result_type operator()() const
Definition: crypto.h:187
uint64_t result_type
Definition: crypto.h:184
static constexpr result_type max()
Definition: crypto.h:186
static void formatted(std::ostream &out, const span< const std::uint8_t > src)
Append < + src + > as hex to out.
Definition: hex.cpp:77
Definition: chaingen.h:294
std::string data
Definition: base58.cpp:37
static crypto::key_image generate_key_image()
Definition: ringdb.cpp:55