gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34976 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r34976 - gnunet/src/util
Date: Sat, 24 Jan 2015 19:53:29 +0100

Author: harsha
Date: 2015-01-24 19:53:29 +0100 (Sat, 24 Jan 2015)
New Revision: 34976

Modified:
   gnunet/src/util/crypto_rsa.c
   gnunet/src/util/test_crypto_rsa.c
Log:
-fix assertion checking the encoded s-expressions

Modified: gnunet/src/util/crypto_rsa.c
===================================================================
--- gnunet/src/util/crypto_rsa.c        2015-01-23 11:53:41 UTC (rev 34975)
+++ gnunet/src/util/crypto_rsa.c        2015-01-24 18:53:29 UTC (rev 34976)
@@ -199,7 +199,7 @@
                         NULL,
                         0);
   b = GNUNET_malloc (n);
-  GNUNET_assert (n ==
+  GNUNET_assert ((n - 1) ==     /* since the last byte is \0 */
                  gcry_sexp_sprint (key->sexp,
                                    GCRYSEXP_FMT_DEFAULT,
                                    b,
@@ -309,7 +309,7 @@
                         NULL,
                         0);
   b = GNUNET_malloc (n);
-  GNUNET_assert (n ==
+  GNUNET_assert ((n -1) ==      /* since the last byte is \0 */
                  gcry_sexp_sprint (key->sexp,
                                    GCRYSEXP_FMT_ADVANCED,
                                    b,
@@ -636,7 +636,7 @@
                         NULL,
                         0);
   b = GNUNET_malloc (n);
-  GNUNET_assert (n ==
+  GNUNET_assert ((n - 1) ==     /* since the last byte is \0 */
                  gcry_sexp_sprint (sig->sexp,
                                    GCRYSEXP_FMT_ADVANCED,
                                    b,

Modified: gnunet/src/util/test_crypto_rsa.c
===================================================================
--- gnunet/src/util/test_crypto_rsa.c   2015-01-23 11:53:41 UTC (rev 34975)
+++ gnunet/src/util/test_crypto_rsa.c   2015-01-24 18:53:29 UTC (rev 34976)
@@ -49,6 +49,13 @@
                       &hash);
   priv = GNUNET_CRYPTO_rsa_private_key_create (KEY_SIZE);
   pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv);
+  /* Encoding */
+  size_t size;
+  char *enc;
+  enc = NULL;
+  size = GNUNET_CRYPTO_rsa_private_key_encode (priv, &enc);
+  GNUNET_free (enc);
+  
   /* try ordinary sig first */
   sig = GNUNET_CRYPTO_rsa_sign (priv,
                         &hash,




reply via email to

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