gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -fix actually follow spec for Salsa encr


From: gnunet
Subject: [gnunet] branch master updated: -fix actually follow spec for Salsa encryption
Date: Mon, 03 May 2021 20:48:59 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 35fb28b9b -fix actually follow spec for Salsa encryption
35fb28b9b is described below

commit 35fb28b9bc616b638d9a8de31633e2d68dca26d0
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Mon May 3 20:46:46 2021 +0200

    -fix actually follow spec for Salsa encryption
---
 src/gnsrecord/gnsrecord_crypto.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index 7fe0c6953..feb60ade9 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -99,7 +99,14 @@ eddsa_symmetric_decrypt (
   const unsigned char *nonce,
   void *result)
 {
-  if (0 != crypto_secretbox_open_easy (result, block, size, nonce, key))
+  ssize_t ctlen = size - crypto_secretbox_MACBYTES;
+  if (ctlen < 0)
+    return GNUNET_SYSERR;
+  if (0 != crypto_secretbox_open_detached (result,
+                                           block, // Ciphertext
+                                           ((unsigned char*)block) + ctlen, // 
TAG
+                                           ctlen,
+                                           nonce, key))
   {
     return GNUNET_SYSERR;
   }
@@ -115,7 +122,11 @@ eddsa_symmetric_encrypt (
   const unsigned char *nonce,
   void *result)
 {
-  crypto_secretbox_easy (result, block, size, nonce, key);
+  if (size > crypto_secretbox_MESSAGEBYTES_MAX)
+    return GNUNET_SYSERR;
+  crypto_secretbox_detached (result, // Ciphertext
+                             result + size, // TAG
+                             block, size, nonce, key);
   return GNUNET_OK;
 }
 

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