gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated (1ca30687b -> 132e09b6e)


From: gnunet
Subject: [gnunet] branch master updated (1ca30687b -> 132e09b6e)
Date: Tue, 26 Apr 2022 17:14:08 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a change to branch master
in repository gnunet.

    from 1ca30687b - added missing GNUNET_SERVICE_client_continue
     new 8d8e7d3da edx25519: use SHA512/256 instead of SHA256
     new 132e09b6e gnunet-crypto-tvg: edx25519 test vectors

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/util/crypto_edx25519.c   | 16 +++++++++++-----
 src/util/gnunet-crypto-tvg.c | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 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 (
    * generation, the "R" is derived from the same derivation path as "h" and is
    * not reused. */
   {
-    crypto_hash_sha256_state hs;
-    crypto_hash_sha256_init (&hs);
-    crypto_hash_sha256_update (&hs, priv->b, sizeof(priv->b));
-    crypto_hash_sha256_update (&hs, (unsigned char*) &hc, sizeof (hc));
-    crypto_hash_sha256_final (&hs, result->b);
+    struct GNUNET_HashCode hcb;
+    struct GNUNET_HashContext *hctx;
+
+    hctx = GNUNET_CRYPTO_hash_context_start ();
+    GNUNET_CRYPTO_hash_context_read (hctx, priv->b, sizeof(priv->b));
+    GNUNET_CRYPTO_hash_context_read (hctx, (unsigned char*) &hc, sizeof (hc));
+    GNUNET_CRYPTO_hash_context_finish (hctx, &hcb);
+
+    /* Truncate result, effectively doing SHA512/256 */
+    for (size_t i = 0; i < 32; i++)
+      result->b[i] = ((unsigned char *) &hcb)[i];
   }
 
   for (size_t i = 0; i < 32; i++)
diff --git a/src/util/gnunet-crypto-tvg.c b/src/util/gnunet-crypto-tvg.c
index 0071f3e90..76c379784 100644
--- a/src/util/gnunet-crypto-tvg.c
+++ b/src/util/gnunet-crypto-tvg.c
@@ -1200,6 +1200,45 @@ output_vectors ()
          sizeof (struct GNUNET_HashCode));
   }
 
+  {
+    json_t *vec = vec_for (vecs, "edx25519_derive");
+    struct GNUNET_CRYPTO_Edx25519PrivateKey priv1_edx;
+    struct GNUNET_CRYPTO_Edx25519PublicKey pub1_edx;
+    struct GNUNET_CRYPTO_Edx25519PrivateKey priv2_edx;
+    struct GNUNET_CRYPTO_Edx25519PublicKey pub2_edx;
+    struct GNUNET_HashCode seed;
+
+    GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+                                &seed,
+                                sizeof (struct GNUNET_HashCode));
+    GNUNET_CRYPTO_edx25519_key_create (&priv1_edx);
+    GNUNET_CRYPTO_edx25519_key_get_public (&priv1_edx, &pub1_edx);
+    GNUNET_CRYPTO_edx25519_private_key_derive (&priv1_edx,
+                                               &seed,
+                                               sizeof (seed),
+                                               &priv2_edx);
+    GNUNET_CRYPTO_edx25519_public_key_derive (&pub1_edx,
+                                              &seed,
+                                              sizeof (seed),
+                                              &pub2_edx);
+
+    d2j (vec, "priv1_edx",
+         &priv1_edx,
+         sizeof (struct GNUNET_CRYPTO_Edx25519PrivateKey));
+    d2j (vec, "pub1_edx",
+         &pub1_edx,
+         sizeof (struct GNUNET_CRYPTO_Edx25519PublicKey));
+    d2j (vec, "seed",
+         &seed,
+         sizeof (struct GNUNET_HashCode));
+    d2j (vec, "priv2_edx",
+         &priv2_edx,
+         sizeof (struct GNUNET_CRYPTO_Edx25519PrivateKey));
+    d2j (vec, "pub2_edx",
+         &pub2_edx,
+         sizeof (struct GNUNET_CRYPTO_Edx25519PublicKey));
+  }
+
   {
     json_t *vec = vec_for (vecs, "rsa_blind_signing");
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]