aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_edx25519.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/crypto_edx25519.c')
-rw-r--r--src/util/crypto_edx25519.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/util/crypto_edx25519.c b/src/util/crypto_edx25519.c
index 2f6e12ead..775b64190 100644
--- a/src/util/crypto_edx25519.c
+++ b/src/util/crypto_edx25519.c
@@ -309,11 +309,17 @@ GNUNET_CRYPTO_edx25519_private_key_derive (
309 * generation, the "R" is derived from the same derivation path as "h" and is 309 * generation, the "R" is derived from the same derivation path as "h" and is
310 * not reused. */ 310 * not reused. */
311 { 311 {
312 crypto_hash_sha256_state hs; 312 struct GNUNET_HashCode hcb;
313 crypto_hash_sha256_init (&hs); 313 struct GNUNET_HashContext *hctx;
314 crypto_hash_sha256_update (&hs, priv->b, sizeof(priv->b)); 314
315 crypto_hash_sha256_update (&hs, (unsigned char*) &hc, sizeof (hc)); 315 hctx = GNUNET_CRYPTO_hash_context_start ();
316 crypto_hash_sha256_final (&hs, result->b); 316 GNUNET_CRYPTO_hash_context_read (hctx, priv->b, sizeof(priv->b));
317 GNUNET_CRYPTO_hash_context_read (hctx, (unsigned char*) &hc, sizeof (hc));
318 GNUNET_CRYPTO_hash_context_finish (hctx, &hcb);
319
320 /* Truncate result, effectively doing SHA512/256 */
321 for (size_t i = 0; i < 32; i++)
322 result->b[i] = ((unsigned char *) &hcb)[i];
317 } 323 }
318 324
319 for (size_t i = 0; i < 32; i++) 325 for (size_t i = 0; i < 32; i++)