gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: -code cleanup


From: gnunet
Subject: [taler-anastasis] branch master updated: -code cleanup
Date: Mon, 28 Mar 2022 13:58:30 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 452aa53  -code cleanup
452aa53 is described below

commit 452aa5391b75ab6637b62398f9b0627593570d5d
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Mar 28 13:58:24 2022 +0200

    -code cleanup
---
 src/util/anastasis_crypto.c | 46 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 89750e4..b4b87da 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -91,28 +91,23 @@ derive_key (const void *key_material,
             const char *salt,
             struct ANASTASIS_CRYPTO_SymKeyP *key)
 {
-  if (GNUNET_YES !=
-      GNUNET_CRYPTO_kdf (key,
-                         sizeof (struct ANASTASIS_CRYPTO_SymKeyP),
-                         /* salt / XTS */
-                         nonce,
-                         sizeof (struct ANASTASIS_CRYPTO_NonceP),
-                         /* ikm */
-                         key_material,
-                         key_m_len,
-                         /* info chunks */
-                         /* The "salt" passed here is actually not something 
random,
-                            but a protocol-specific identifier string.  Thus
-                            we pass it as a context info to the HKDF */
-                         salt,
-                         strlen (salt),
-                         NULL,
-                         0))
-  {
-    // FIXME: Huh?!  Why would we continue here?
-    GNUNET_break (0);
-    return;
-  }
+  GNUNET_assert (GNUNET_YES ==
+                 GNUNET_CRYPTO_kdf (key,
+                                    sizeof (*key),
+                                    /* salt / XTS */
+                                    nonce,
+                                    sizeof (*nonce),
+                                    /* ikm */
+                                    key_material,
+                                    key_m_len,
+                                    /* info chunks */
+                                    /* The "salt" passed here is actually not 
something random,
+                                       but a protocol-specific identifier 
string.  Thus
+                                       we pass it as a context info to the 
HKDF */
+                                    salt,
+                                    strlen (salt),
+                                    NULL,
+                                    0));
 }
 
 
@@ -185,8 +180,11 @@ anastasis_decrypt (const void *key,
   struct ANASTASIS_CRYPTO_SymKeyP skey;
   size_t plaintext_size;
 
-  GNUNET_assert (data_size >= crypto_secretbox_NONCEBYTES
-                 + crypto_secretbox_MACBYTES);
+  if (data_size < crypto_secretbox_NONCEBYTES + crypto_secretbox_MACBYTES)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
   nonce = data;
   derive_key (key,
               key_len,

-- 
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]