curly wars / auto-indentation
[oweals/gnunet.git] / src / util / crypto_ksk.c
index 7c23fc1e0d6cf514afb1a7ca03fecfb4952dae4a..60639a709e7b5344297b48c918932aede6733bf1 100644 (file)
 #include <gcrypt.h>
 #include <limits.h>
 
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
 /**
  * Log an error message at log-level 'level' that indicates
  * a failure of the command 'cmd' with the message given
  * by gcry_strerror(rc).
  */
-#define LOG_GCRY(level, cmd, rc) do { GNUNET_log(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0);
+#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0);
 
 
 typedef struct
@@ -397,8 +399,8 @@ gen_prime (gcry_mpi_t * ptest, unsigned int nbits, GNUNET_HashCode * hc)
  * @param hc the HC to use for PRNG (modified!)
  */
 static void
-generate_kblock_key (KBlock_secret_key *sk,
-                     unsigned int nbits, GNUNET_HashCode * hc)
+generate_kblock_key (KBlock_secret_key *sk, unsigned int nbits,
+                     GNUNET_HashCode * hc)
 {
   gcry_mpi_t t1, t2;
   gcry_mpi_t phi;               /* helper: (p-1)(q-1) */
@@ -569,10 +571,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
 
   pos = 0;
   size = ntohs (encoding->sizen);
-  rc = gcry_mpi_scan (&n,
-                      GCRYMPI_FMT_USG,
-                      &((const unsigned char *) (&encoding[1]))[pos],
-                      size, &size);
+  rc = gcry_mpi_scan (&n, GCRYMPI_FMT_USG,
+                      &((const unsigned char *) (&encoding[1]))[pos], size,
+                      &size);
   pos += ntohs (encoding->sizen);
   if (rc)
   {
@@ -580,10 +581,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
     return NULL;
   }
   size = ntohs (encoding->sizee);
-  rc = gcry_mpi_scan (&e,
-                      GCRYMPI_FMT_USG,
-                      &((const unsigned char *) (&encoding[1]))[pos],
-                      size, &size);
+  rc = gcry_mpi_scan (&e, GCRYMPI_FMT_USG,
+                      &((const unsigned char *) (&encoding[1]))[pos], size,
+                      &size);
   pos += ntohs (encoding->sizee);
   if (rc)
   {
@@ -592,10 +592,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
     return NULL;
   }
   size = ntohs (encoding->sized);
-  rc = gcry_mpi_scan (&d,
-                      GCRYMPI_FMT_USG,
-                      &((const unsigned char *) (&encoding[1]))[pos],
-                      size, &size);
+  rc = gcry_mpi_scan (&d, GCRYMPI_FMT_USG,
+                      &((const unsigned char *) (&encoding[1]))[pos], size,
+                      &size);
   pos += ntohs (encoding->sized);
   if (rc)
   {
@@ -608,10 +607,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
   size = ntohs (encoding->sizep);
   if (size > 0)
   {
-    rc = gcry_mpi_scan (&q,
-                        GCRYMPI_FMT_USG,
-                        &((const unsigned char *) (&encoding[1]))[pos],
-                        size, &size);
+    rc = gcry_mpi_scan (&q, GCRYMPI_FMT_USG,
+                        &((const unsigned char *) (&encoding[1]))[pos], size,
+                        &size);
     pos += ntohs (encoding->sizep);
     if (rc)
     {
@@ -627,10 +625,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
   size = ntohs (encoding->sizeq);
   if (size > 0)
   {
-    rc = gcry_mpi_scan (&p,
-                        GCRYMPI_FMT_USG,
-                        &((const unsigned char *) (&encoding[1]))[pos],
-                        size, &size);
+    rc = gcry_mpi_scan (&p, GCRYMPI_FMT_USG,
+                        &((const unsigned char *) (&encoding[1]))[pos], size,
+                        &size);
     pos += ntohs (encoding->sizeq);
     if (rc)
     {
@@ -652,10 +649,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
       pos;
   if (size > 0)
   {
-    rc = gcry_mpi_scan (&u,
-                        GCRYMPI_FMT_USG,
-                        &((const unsigned char *) (&encoding[1]))[pos],
-                        size, &size);
+    rc = gcry_mpi_scan (&u, GCRYMPI_FMT_USG,
+                        &((const unsigned char *) (&encoding[1]))[pos], size,
+                        &size);
     if (rc)
     {
       LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc);