aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/crypto.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/crypto/crypto.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
index f5f525700..31fc31d5b 100644
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -50,6 +50,7 @@ namespace crypto {
return &reinterpret_cast<const unsigned char &>(scalar);
}
+ /* generate a random 32-byte (256-bit) integer and copy it to res */
static inline void random_scalar(ec_scalar &res) {
unsigned char tmp[64];
generate_random_bytes(64, tmp);
@@ -62,6 +63,11 @@ namespace crypto {
sc_reduce32(&res);
}
+ /*
+ * generate public and secret keys from a random 256-bit integer
+ * TODO: allow specifiying random value (for wallet recovery)
+ *
+ */
void crypto_ops::generate_keys(public_key &pub, secret_key &sec) {
lock_guard<mutex> lock(random_lock);
ge_p3 point;