gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: added assertions


From: gnunet
Subject: [taler-anastasis] branch master updated: added assertions
Date: Wed, 25 Mar 2020 10:28:41 +0100

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 26a665a  added assertions
26a665a is described below

commit 26a665a27c855dc11f13f3cbdb05c3f623160f49
Author: Dennis Neufeld <address@hidden>
AuthorDate: Wed Mar 25 09:28:38 2020 +0000

    added assertions
---
 src/util/anastasis_crypto.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index a5a65f1..cc53e9b 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -234,6 +234,7 @@ ANASTASIS_CRYPTO_recovery_document_decrypt (
   char sym_key[AES_KEY_SIZE];
   char iv[AES_IV_SIZE];
   char gcm_tag[GCM_TAG_SIZE];
+  int rc;
 
   memcpy (&nonce, data, sizeof (struct ANASTASIS_CRYPTO_Nonce));
   memcpy (&gcm_tag,
@@ -247,20 +248,27 @@ ANASTASIS_CRYPTO_recovery_document_decrypt (
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "\n NONCE_2:  %s \n",
               &nonce);
-  gcry_cipher_open (&cipher,
-                    GCRY_CIPHER_AES256,
-                    GCRY_CIPHER_MODE_GCM,
-                    0);
-  gcry_cipher_setkey (cipher,
-                      sym_key,
-                      sizeof (sym_key));
+  GNUNET_assert (0 == gcry_cipher_open (&cipher,
+                                        GCRY_CIPHER_AES256,
+                                        GCRY_CIPHER_MODE_GCM,
+                                        0));
+  rc = gcry_cipher_setkey (cipher,
+                           sym_key,
+                           sizeof (sym_key));
+  GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "\n SYMKEY_2:  %s \n",
               sym_key);
-  gcry_cipher_setiv (cipher,
-                     &iv,
-                     sizeof (iv));
-  gcry_cipher_decrypt (cipher, res, *res_size, ciphertext, sizeof 
(ciphertext));
+  rc = gcry_cipher_setiv (cipher,
+                          &iv,
+                          sizeof (iv));
+  GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
+
+  GNUNET_assert (0 == gcry_cipher_decrypt (cipher,
+                                           res, *res_size,
+                                           ciphertext,
+                                           sizeof (ciphertext)));
   gcry_cipher_close (cipher);
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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