Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/crypto/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ namespace crypto {
ge_p1p1_to_p3(&res, &point2);
}

void crypto_ops::derive_key_image_generator(const public_key &pub, ec_point &ki_gen) {
ge_p3 point;
hash_to_ec(pub, point);
ge_p3_tobytes(&ki_gen, &point);
}

void crypto_ops::generate_key_image(const public_key &pub, const secret_key &sec, key_image &image) {
ge_p3 point;
ge_p2 point2;
Expand Down
6 changes: 6 additions & 0 deletions src/crypto/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ namespace crypto {
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 &);
static bool check_tx_proof(const hash &, const public_key &, const public_key &, const boost::optional<public_key> &, const public_key &, const signature &, const int);
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);
static void derive_key_image_generator(const public_key &, ec_point &);
friend void derive_key_image_generator(const public_key &, ec_point &);
static void generate_key_image(const public_key &, const secret_key &, key_image &);
friend void generate_key_image(const public_key &, const secret_key &, key_image &);
static void generate_ring_signature(const hash &, const key_image &,
Expand Down Expand Up @@ -254,6 +256,10 @@ namespace crypto {
return crypto_ops::check_tx_proof(prefix_hash, R, A, B, D, sig, version);
}

inline void derive_key_image_generator(const public_key &pub, ec_point &ki_gen) {
crypto_ops::derive_key_image_generator(pub, ki_gen);
}

/* To send money to a key:
* * The sender generates an ephemeral key and includes it in transaction output.
* * To spend the money, the receiver generates a key image from it.
Expand Down
Loading