diff options
author | John McKay <adenosine3p@gmail.com> | 2019-01-16 09:20:37 +0000 |
---|---|---|
committer | John McKay <adenosine3p@gmail.com> | 2019-02-02 05:30:00 +0000 |
commit | 9d59e03376dc4707db1d2baa353b2d145afb2f5d (patch) | |
tree | b8ba9de042c501302c86c0fe731fad4db6114cda /src/libcryptobox | |
parent | e4eab3822fe257ed4a044390a04eaba9a126afcd (diff) | |
download | rspamd-9d59e03376dc4707db1d2baa353b2d145afb2f5d.tar.gz rspamd-9d59e03376dc4707db1d2baa353b2d145afb2f5d.zip |
expose ed25519 private to public key
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/ed25519/ed25519.c | 10 | ||||
-rw-r--r-- | src/libcryptobox/ed25519/ed25519.h | 1 | ||||
-rw-r--r-- | 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) @@ -79,6 +81,12 @@ ed25519_load (void) } 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) { ed25519_opt->keypair (pk, 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) { |