commit 9d59e03: expose ed25519 private to public key

John McKay adenosine3p at gmail.com
Mon Feb 4 14:35:06 UTC 2019


Author: John McKay
Date: 2019-01-16 09:20:37 +0000
URL: https://github.com/rspamd/rspamd/commit/9d59e03376dc4707db1d2baa353b2d145afb2f5d

expose ed25519 private to public key

---
 src/libcryptobox/ed25519/ed25519.c | 10 +++++++++-
 src/libcryptobox/ed25519/ed25519.h |  1 +
 src/libcryptobox/ed25519/ref.c     |  2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/libcryptobox/ed25519/ed25519.c b/src/libcryptobox/ed25519/ed25519.c
index 736cd96bf..1591b2590 100644
--- a/src/libcryptobox/ed25519/ed25519.c
+++ b/src/libcryptobox/ed25519/ed25519.c
@@ -26,6 +26,7 @@ typedef struct ed25519_impl_s {
 	const char *desc;
 
 	void (*keypair) (unsigned char *pk, unsigned char *sk);
+	void (*seed_keypair) (unsigned char *pk, unsigned char *sk, unsigned char *seed);
 	void (*sign) (unsigned char *sig, size_t *siglen_p,
 			const unsigned char *m, size_t mlen,
 			const unsigned char *sk);
@@ -37,6 +38,7 @@ typedef struct ed25519_impl_s {
 
 #define ED25519_DECLARE(ext) \
     void ed_keypair_##ext(unsigned char *pk, unsigned char *sk); \
+    void ed_seed_keypair_##ext(unsigned char *pk, unsigned char *sk, unsigned char *seed); \
     void ed_sign_##ext(unsigned char *sig, size_t *siglen_p, \
         const unsigned char *m, size_t mlen, \
         const unsigned char *sk); \
@@ -46,7 +48,7 @@ typedef struct ed25519_impl_s {
         const unsigned char *pk)
 
 #define ED25519_IMPL(cpuflags, desc, ext) \
-    {(cpuflags), desc, ed_keypair_##ext, ed_sign_##ext, ed_verify_##ext}
+    {(cpuflags), desc, ed_keypair_##ext, ed_seed_keypair_##ext, ed_sign_##ext, ed_verify_##ext}
 
 ED25519_DECLARE(ref);
 #define ED25519_REF ED25519_IMPL(0, "ref", ref)
@@ -78,6 +80,12 @@ ed25519_load (void)
 	return ed25519_opt->desc;
 }
 
+void
+ed25519_seed_keypair (unsigned char *pk, unsigned char *sk, unsigned char *seed)
+{
+	ed25519_opt->seed_keypair (pk, sk, seed);
+}
+
 void
 ed25519_keypair (unsigned char *pk, unsigned char *sk)
 {
diff --git a/src/libcryptobox/ed25519/ed25519.h b/src/libcryptobox/ed25519/ed25519.h
index ff8d320ae..0fbf7d6fe 100644
--- a/src/libcryptobox/ed25519/ed25519.h
+++ b/src/libcryptobox/ed25519/ed25519.h
@@ -22,6 +22,7 @@
 
 const char* ed25519_load (void);
 void ed25519_keypair (unsigned char *pk, unsigned char *sk);
+void ed25519_seed_keypair (unsigned char *pk, unsigned char *sk, unsigned char *seed);
 void ed25519_sign (unsigned char *sig, size_t *siglen_p,
 		const unsigned char *m, size_t mlen,
 		const unsigned char *sk);
diff --git a/src/libcryptobox/ed25519/ref.c b/src/libcryptobox/ed25519/ref.c
index 2f2596242..cbcf87857 100644
--- a/src/libcryptobox/ed25519/ref.c
+++ b/src/libcryptobox/ed25519/ref.c
@@ -23,7 +23,7 @@
 #include "ottery.h"
 #include <openssl/evp.h> /* SHA512 */
 
-static int
+int
 ed_seed_keypair_ref (unsigned char *pk, unsigned char *sk,
 		const unsigned char *seed)
 {


More information about the Commits mailing list