diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-03 00:40:43 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-03 00:40:43 +0000 |
commit | cd757ac4e75c57b2f79da6eea9f9ccea8589310a (patch) | |
tree | 7eff9eb79205a3496aba751368460ba3d2b18da7 | |
parent | 11d091cf61a6eb9e4b396f5e387441240957a320 (diff) | |
download | rspamd-cd757ac4e75c57b2f79da6eea9f9ccea8589310a.tar.gz rspamd-cd757ac4e75c57b2f79da6eea9f9ccea8589310a.zip |
Fix eddsa keys generation
-rw-r--r-- | src/libcryptobox/ed25519/ref.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libcryptobox/ed25519/ref.c b/src/libcryptobox/ed25519/ref.c index 5ae5eb898..589556e9c 100644 --- a/src/libcryptobox/ed25519/ref.c +++ b/src/libcryptobox/ed25519/ref.c @@ -28,8 +28,12 @@ ed_seed_keypair_ref (unsigned char *pk, unsigned char *sk, const unsigned char *seed) { ge_p3 A; + EVP_MD_CTX sha_ctx; + + g_assert (EVP_DigestInit (&sha_ctx, EVP_sha512()) == 1); + EVP_DigestUpdate (&sha_ctx, seed, 32); + EVP_DigestFinal (&sha_ctx, sk, NULL); - memmove (sk, seed, 32); sk[0] &= 248; sk[31] &= 63; sk[31] |= 64; @@ -46,11 +50,10 @@ ed_seed_keypair_ref (unsigned char *pk, unsigned char *sk, int ed_keypair_ref (unsigned char *pk, unsigned char *sk) { - unsigned char seed[rspamd_cryptobox_HASHBYTES]; + unsigned char seed[32]; int ret; ottery_rand_bytes (seed, sizeof (seed)); - rspamd_cryptobox_hash (seed, seed, sizeof (seed), NULL, 0); ret = ed_seed_keypair_ref (pk, sk, seed); rspamd_explicit_memzero (seed, sizeof (seed)); |