aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/ed25519/ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcryptobox/ed25519/ref.c')
-rw-r--r--src/libcryptobox/ed25519/ref.c9
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));