gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: util: Silence some style warnings


From: gnunet
Subject: [gnunet] branch master updated: util: Silence some style warnings
Date: Thu, 05 Sep 2024 14:45:29 +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 4df03b9d5 util: Silence some style warnings
4df03b9d5 is described below

commit 4df03b9d513f2cb3c1b8e6b92c876f7db1cc3af0
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Thu Sep 5 14:45:24 2024 +0200

    util: Silence some style warnings
---
 contrib/gana                         |  2 +-
 contrib/handbook                     |  2 +-
 src/lib/gnsrecord/gnsrecord_crypto.c | 37 +++++++--------
 src/lib/util/bio.c                   |  6 +--
 src/lib/util/buffer.c                |  3 +-
 src/lib/util/common_logging.c        | 12 ++---
 src/lib/util/configuration.c         | 38 ++++++++-------
 src/lib/util/crypto_cs.c             | 22 ++++-----
 src/lib/util/crypto_ecc_gnsrecord.c  | 31 +++++++------
 src/lib/util/crypto_ecc_setup.c      |  2 +-
 src/lib/util/crypto_edx25519.c       |  2 +-
 src/lib/util/crypto_elligator.c      | 90 ++++++++++++++++++++----------------
 src/lib/util/crypto_hkdf.c           |  2 +-
 src/lib/util/crypto_hpke.c           |  6 +--
 src/lib/util/crypto_mpi.c            |  2 +-
 src/lib/util/crypto_paillier.c       |  2 +-
 src/lib/util/crypto_pkey.c           | 27 +++--------
 src/lib/util/crypto_random.c         |  4 +-
 src/lib/util/disk.c                  |  1 +
 src/lib/util/disk.h                  |  3 +-
 src/lib/util/dnsparser.c             |  6 ++-
 src/lib/util/load.c                  |  3 +-
 src/lib/util/mq.c                    |  4 +-
 src/lib/util/network.c               |  3 +-
 src/lib/util/nt.c                    | 30 ++++++------
 src/lib/util/time.c                  |  8 ++--
 26 files changed, 177 insertions(+), 171 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 7d199a4a0..a2057ac0e 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 7d199a4a0e85592cf0fa4032d9e6a6764e53a593
+Subproject commit a2057ac0e3c43950dcfc5024cc0abe6f362e45ba
diff --git a/contrib/handbook b/contrib/handbook
index 3f20b1641..57e146d7f 160000
--- a/contrib/handbook
+++ b/contrib/handbook
@@ -1 +1 @@
-Subproject commit 3f20b1641b5617394f97d6137978f03bcbd57561
+Subproject commit 57e146d7f375860cc3e12ae127c90c215e343a2f
diff --git a/src/lib/gnsrecord/gnsrecord_crypto.c 
b/src/lib/gnsrecord/gnsrecord_crypto.c
index de0fa3ffd..2ee82c098 100644
--- a/src/lib/gnsrecord/gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/gnsrecord_crypto.c
@@ -30,7 +30,7 @@
 
 #define LOG(kind, ...) GNUNET_log_from (kind, "gnsrecord", __VA_ARGS__)
 
-ssize_t
+static ssize_t
 ecdsa_symmetric_decrypt (
   const void *block,
   size_t size,
@@ -57,7 +57,7 @@ ecdsa_symmetric_decrypt (
 }
 
 
-ssize_t
+static ssize_t
 ecdsa_symmetric_encrypt (
   const void *block,
   size_t size,
@@ -84,7 +84,7 @@ ecdsa_symmetric_encrypt (
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 eddsa_symmetric_decrypt (
   const void *block,
   size_t size,
@@ -108,7 +108,7 @@ eddsa_symmetric_decrypt (
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 eddsa_symmetric_encrypt (
   const void *block,
   size_t size,
@@ -196,7 +196,7 @@ block_get_size_ecdsa (const struct GNUNET_GNSRECORD_Data 
*rd,
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 block_sign_ecdsa (const struct
                   GNUNET_CRYPTO_EcdsaPrivateKey *key,
                   const struct
@@ -237,7 +237,7 @@ block_sign_ecdsa (const struct
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 block_sign_eddsa (const struct
                   GNUNET_CRYPTO_EddsaPrivateKey *key,
                   const struct
@@ -282,7 +282,7 @@ GNUNET_GNSRECORD_block_sign (const struct
   char *norm_label;
 
   GNUNET_CRYPTO_key_get_public (key,
-                                  &pkey);
+                                &pkey);
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
   switch (ntohl (key->type))
@@ -430,7 +430,7 @@ block_get_size_eddsa (const struct GNUNET_GNSRECORD_Data 
*rd,
  * @param sign GNUNET_YES if block shall be signed as well
  * @return GNUNET_SYSERR on error (otherwise GNUNET_OK)
  */
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 block_create_eddsa (const struct GNUNET_CRYPTO_EddsaPrivateKey *key,
                     const struct GNUNET_CRYPTO_EddsaPublicKey *pkey,
                     struct GNUNET_TIME_Absolute expire,
@@ -518,7 +518,7 @@ GNUNET_GNSRECORD_block_calculate_size (const struct
   ssize_t res = -1;
 
   GNUNET_CRYPTO_key_get_public (key,
-                                  &pkey);
+                                &pkey);
   switch (ntohl (key->type))
   {
   case GNUNET_GNSRECORD_TYPE_PKEY:
@@ -548,7 +548,7 @@ GNUNET_GNSRECORD_block_create (const struct 
GNUNET_CRYPTO_PrivateKey *key,
   char *norm_label;
 
   GNUNET_CRYPTO_key_get_public (key,
-                                  &pkey);
+                                &pkey);
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
   switch (ntohl (key->type))
@@ -611,15 +611,15 @@ block_create2 (const struct GNUNET_CRYPTO_PrivateKey 
*pkey,
   struct GNUNET_CRYPTO_EddsaPublicKey edpubkey;
   enum GNUNET_GenericReturnValue res = GNUNET_SYSERR;
   char *norm_label;
+#define CSIZE 64
+  static struct KeyCacheLine cache[CSIZE];
+  struct KeyCacheLine *line;
 
   norm_label = GNUNET_GNSRECORD_string_normalize (label);
 
   if (GNUNET_PUBLIC_KEY_TYPE_ECDSA == ntohl (pkey->type))
   {
     key = &pkey->ecdsa_key;
-#define CSIZE 64
-    static struct KeyCacheLine cache[CSIZE];
-    struct KeyCacheLine *line;
 
     line = &cache[(*(unsigned int *) key) % CSIZE];
     if (0 != memcmp (&line->key,
@@ -631,7 +631,6 @@ block_create2 (const struct GNUNET_CRYPTO_PrivateKey *pkey,
       GNUNET_CRYPTO_ecdsa_key_get_public (key,
                                           &line->pkey);
     }
-#undef CSIZE
     res = block_create_ecdsa (key,
                               &line->pkey,
                               expire,
@@ -654,6 +653,7 @@ block_create2 (const struct GNUNET_CRYPTO_PrivateKey *pkey,
                               result,
                               sign);
   }
+#undef CSIZE
   GNUNET_free (norm_label);
   return res;
 }
@@ -730,7 +730,7 @@ GNUNET_GNSRECORD_block_verify (const struct 
GNUNET_GNSRECORD_Block *block)
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block *block,
                      const struct
                      GNUNET_CRYPTO_EcdsaPublicKey *zone_key,
@@ -855,7 +855,7 @@ block_decrypt_ecdsa (const struct GNUNET_GNSRECORD_Block 
*block,
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block *block,
                      const struct
                      GNUNET_CRYPTO_EddsaPublicKey *zone_key,
@@ -878,7 +878,8 @@ block_decrypt_eddsa (const struct GNUNET_GNSRECORD_Block 
*block,
   GNR_derive_block_xsalsa_key (nonce,
                                key,
                                label,
-                               
block->eddsa_block.expiration_time.abs_value_us__,
+                               
block->eddsa_block.expiration_time.abs_value_us__
+                               ,
                                zone_key);
   {
     char payload[payload_len];
@@ -1036,7 +1037,7 @@ GNUNET_GNSRECORD_query_from_private_key (const struct
   case GNUNET_GNSRECORD_TYPE_EDKEY:
 
     GNUNET_CRYPTO_key_get_public (zone,
-                                    &pub);
+                                  &pub);
     GNUNET_GNSRECORD_query_from_public_key (&pub,
                                             norm_label,
                                             query);
diff --git a/src/lib/util/bio.c b/src/lib/util/bio.c
index caf533108..38ea5d93e 100644
--- a/src/lib/util/bio.c
+++ b/src/lib/util/bio.c
@@ -645,14 +645,12 @@ GNUNET_BIO_get_buffer_contents (struct 
GNUNET_BIO_WriteHandle *h,
                                 void **contents,
                                 size_t *size)
 {
+  enum GNUNET_GenericReturnValue ret;
   if (IO_BUFFER != h->type)
     return GNUNET_SYSERR;
   if ((NULL == contents) || (NULL == size))
     return GNUNET_SYSERR;
-  enum GNUNET_GenericReturnValue ret
-    = (NULL != h->emsg)
-    ? GNUNET_SYSERR
-    : GNUNET_OK;
+  ret = (NULL != h->emsg) ? GNUNET_SYSERR : GNUNET_OK;
   if (NULL != emsg)
     *emsg = h->emsg;
   else
diff --git a/src/lib/util/buffer.c b/src/lib/util/buffer.c
index f88c56849..1adf2a387 100644
--- a/src/lib/util/buffer.c
+++ b/src/lib/util/buffer.c
@@ -148,8 +148,9 @@ GNUNET_buffer_reap_str (struct GNUNET_Buffer *buf)
 void *
 GNUNET_buffer_reap (struct GNUNET_Buffer *buf, size_t *size)
 {
+  void *res;
   *size = buf->position;
-  void *res = buf->mem;
+  res = buf->mem;
   memset (buf, 0, sizeof (struct GNUNET_Buffer));
   return res;
 }
diff --git a/src/lib/util/common_logging.c b/src/lib/util/common_logging.c
index 5ccf5abcc..b85bd8994 100644
--- a/src/lib/util/common_logging.c
+++ b/src/lib/util/common_logging.c
@@ -436,7 +436,7 @@ setup_log_file (const struct tm *tm)
  * @return 0 on success, regex-specific error otherwise
  */
 static int
-add_definition (const char *component,
+add_definition (const char *lcomponent,
                 const char *file,
                 const char *function,
                 int from_line,
@@ -450,9 +450,9 @@ add_definition (const char *component,
   if (logdefs_size == logdefs_len)
     resize_logdefs ();
   memset (&n, 0, sizeof(n));
-  if (0 == strlen (component))
-    component = (char *) ".*";
-  r = regcomp (&n.component_regex, (const char *) component, REG_NOSUB);
+  if (0 == strlen (lcomponent))
+    lcomponent = (char *) ".*";
+  r = regcomp (&n.component_regex, (const char *) lcomponent, REG_NOSUB);
   if (0 != r)
   {
     return r;
@@ -1568,7 +1568,7 @@ GNUNET_print_bytes (const void *buf, size_t buf_len, int 
fold, int in_be)
 /**
  * Initializer
  */
-void __attribute__ ((constructor))
+static void __attribute__ ((constructor))
 GNUNET_util_cl_init ()
 {
   GNUNET_stderr = stderr;
@@ -1578,7 +1578,7 @@ GNUNET_util_cl_init ()
 /**
  * Destructor
  */
-void __attribute__ ((destructor))
+static void __attribute__ ((destructor))
 GNUNET_util_cl_fini ()
 {
 
diff --git a/src/lib/util/configuration.c b/src/lib/util/configuration.c
index c5e93e62d..bc3169075 100644
--- a/src/lib/util/configuration.c
+++ b/src/lib/util/configuration.c
@@ -424,7 +424,7 @@ pstrcmp (const void *a,
  *
  * @returns #GNUNET_SYSERR on error, #GNUNET_OK otherwise
  */
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg,
                const char *path_or_glob,
                bool path_is_glob,
@@ -531,6 +531,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg,
     }
     if (cfg->diagnostics)
     {
+      const char *pwname;
+      const char *grname;
       char *sfn = GNUNET_STRINGS_filename_expand (inline_path);
       struct stat istat;
 
@@ -539,8 +541,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg,
       {
         struct passwd *pw = getpwuid (istat.st_uid);
         struct group *gr = getgrgid (istat.st_gid);
-        char *pwname = (NULL == pw) ? "<unknown>" : pw->pw_name;
-        char *grname = (NULL == gr) ? "<unknown>" : gr->gr_name;
+        pwname = (NULL == pw) ? "<unknown>" : pw->pw_name;
+        grname = (NULL == gr) ? "<unknown>" : gr->gr_name;
 
         GNUNET_asprintf (&cs->hint_secret_stat,
                          "%s:%s %o",
@@ -2604,23 +2606,25 @@ GNUNET_CONFIGURATION_load (
     GNUNET_free (ipath);
   }
 
-  char *dname = GNUNET_STRINGS_filename_expand (baseconfig);
-  GNUNET_free (baseconfig);
-
-  if ((GNUNET_YES ==
-       GNUNET_DISK_directory_test (dname,
-                                   GNUNET_YES)) &&
-      (GNUNET_SYSERR ==
-       GNUNET_CONFIGURATION_load_from (cfg,
-                                       dname)))
   {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Failed to load base configuration from '%s'\n",
-         filename);
+    char *dname = GNUNET_STRINGS_filename_expand (baseconfig);
+    GNUNET_free (baseconfig);
+
+    if ((GNUNET_YES ==
+         GNUNET_DISK_directory_test (dname,
+                                     GNUNET_YES)) &&
+        (GNUNET_SYSERR ==
+         GNUNET_CONFIGURATION_load_from (cfg,
+                                         dname)))
+    {
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+           "Failed to load base configuration from '%s'\n",
+           filename);
+      GNUNET_free (dname);
+      return GNUNET_SYSERR;     /* no configuration at all found */
+    }
     GNUNET_free (dname);
-    return GNUNET_SYSERR;       /* no configuration at all found */
   }
-  GNUNET_free (dname);
   if ((NULL != filename) &&
       (GNUNET_OK !=
        GNUNET_CONFIGURATION_parse (cfg,
diff --git a/src/lib/util/crypto_cs.c b/src/lib/util/crypto_cs.c
index 51675e4ac..06e7dd861 100644
--- a/src/lib/util/crypto_cs.c
+++ b/src/lib/util/crypto_cs.c
@@ -155,6 +155,10 @@ cs_full_domain_hash (const struct GNUNET_CRYPTO_CsRPublic 
*r_dash,
                      struct GNUNET_CRYPTO_CsC *c)
 {
   // SHA-512 hash of R' and message
+  struct GNUNET_HashCode prehash;
+  gcry_mpi_t l_mpi;
+  gcry_mpi_t c_mpi;
+  unsigned char c_big_endian[256 / 8];
   size_t r_m_concat_len = sizeof(struct GNUNET_CRYPTO_CsRPublic) + msg_len;
   char r_m_concat[r_m_concat_len];
   memcpy (r_m_concat,
@@ -163,20 +167,17 @@ cs_full_domain_hash (const struct GNUNET_CRYPTO_CsRPublic 
*r_dash,
   memcpy (r_m_concat + sizeof(struct GNUNET_CRYPTO_CsRPublic),
           msg,
           msg_len);
-  struct GNUNET_HashCode prehash;
 
   GNUNET_CRYPTO_hash (r_m_concat,
                       r_m_concat_len,
                       &prehash);
 
   // modulus converted to MPI representation
-  gcry_mpi_t l_mpi;
   GNUNET_CRYPTO_mpi_scan_unsigned (&l_mpi,
                                    L_BIG_ENDIAN,
                                    sizeof(L_BIG_ENDIAN));
 
   // calculate full domain hash
-  gcry_mpi_t c_mpi;
   GNUNET_CRYPTO_kdf_mod_mpi (&c_mpi,
                              l_mpi,
                              pub,
@@ -187,7 +188,6 @@ cs_full_domain_hash (const struct GNUNET_CRYPTO_CsRPublic 
*r_dash,
   gcry_mpi_release (l_mpi);
 
   // convert c from mpi
-  unsigned char c_big_endian[256 / 8];
   GNUNET_CRYPTO_mpi_print_unsigned (c_big_endian,
                                     sizeof(c_big_endian),
                                     c_mpi);
@@ -213,17 +213,17 @@ calc_r_dash (const struct GNUNET_CRYPTO_CsBlindingSecret 
*bs,
 {
   // R'i = Ri + alpha i*G + beta i*pub
   struct GNUNET_CRYPTO_Cs25519Point alpha_mul_base;
+  struct GNUNET_CRYPTO_Cs25519Point beta_mul_pub;
+  struct GNUNET_CRYPTO_Cs25519Point alpha_mul_base_plus_beta_mul_pub;
   GNUNET_assert (0 ==
                  crypto_scalarmult_ed25519_base_noclamp (
                    alpha_mul_base.y,
                    bs->alpha.d));
-  struct GNUNET_CRYPTO_Cs25519Point beta_mul_pub;
   GNUNET_assert (0 ==
                  crypto_scalarmult_ed25519_noclamp (
                    beta_mul_pub.y,
                    bs->beta.d,
                    pub->point.y));
-  struct GNUNET_CRYPTO_Cs25519Point alpha_mul_base_plus_beta_mul_pub;
   GNUNET_assert (0 == crypto_core_ed25519_add (
                    alpha_mul_base_plus_beta_mul_pub.y,
                    alpha_mul_base.y,
@@ -246,6 +246,8 @@ GNUNET_CRYPTO_cs_calc_blinded_c (
   struct GNUNET_CRYPTO_CsC blinded_c[2],
   struct GNUNET_CRYPTO_CSPublicRPairP *r_pub_blind)
 {
+  struct GNUNET_CRYPTO_CsC c_dash_0;
+  struct GNUNET_CRYPTO_CsC c_dash_1;
   /* for i 0/1: R'i = Ri + alpha i*G + beta i*pub */
   calc_r_dash (&bs[0],
                &r_pub[0],
@@ -257,8 +259,6 @@ GNUNET_CRYPTO_cs_calc_blinded_c (
                &r_pub_blind->r_pub[1]);
 
   /* for i 0/1: c'i = H(R'i, msg) */
-  struct GNUNET_CRYPTO_CsC c_dash_0;
-  struct GNUNET_CRYPTO_CsC c_dash_1;
   cs_full_domain_hash (&r_pub_blind->r_pub[0],
                        msg,
                        msg_len,
@@ -334,6 +334,9 @@ GNUNET_CRYPTO_cs_verify (const struct 
GNUNET_CRYPTO_CsSignature *sig,
 {
   // calculate c' = H(R, m)
   struct GNUNET_CRYPTO_CsC c_dash;
+  struct GNUNET_CRYPTO_Cs25519Point sig_scal_mul_base;
+  struct GNUNET_CRYPTO_Cs25519Point c_dash_mul_pub;
+  struct GNUNET_CRYPTO_Cs25519Point R_add_c_dash_mul_pub;
 
   cs_full_domain_hash (&sig->r_point,
                        msg,
@@ -342,16 +345,13 @@ GNUNET_CRYPTO_cs_verify (const struct 
GNUNET_CRYPTO_CsSignature *sig,
                        &c_dash);
 
   // s'G ?= R' + c' pub
-  struct GNUNET_CRYPTO_Cs25519Point sig_scal_mul_base;
   GNUNET_assert (0 ==
                  crypto_scalarmult_ed25519_base_noclamp (
                    sig_scal_mul_base.y,
                    sig->s_scalar.scalar.d));
-  struct GNUNET_CRYPTO_Cs25519Point c_dash_mul_pub;
   GNUNET_assert (0 == crypto_scalarmult_ed25519_noclamp (c_dash_mul_pub.y,
                                                          c_dash.scalar.d,
                                                          pub->point.y));
-  struct GNUNET_CRYPTO_Cs25519Point R_add_c_dash_mul_pub;
   GNUNET_assert (0 == crypto_core_ed25519_add (R_add_c_dash_mul_pub.y,
                                                sig->r_point.point.y,
                                                c_dash_mul_pub.y));
diff --git a/src/lib/util/crypto_ecc_gnsrecord.c 
b/src/lib/util/crypto_ecc_gnsrecord.c
index fb8ba3ac9..a5991370a 100644
--- a/src/lib/util/crypto_ecc_gnsrecord.c
+++ b/src/lib/util/crypto_ecc_gnsrecord.c
@@ -44,7 +44,7 @@
  *        typically the name of the subsystem/application
  * @param hc where to write the result
  */
-void
+static void
 derive_h (const void *pub,
           size_t pubsize,
           const char *label,
@@ -84,6 +84,8 @@ GNUNET_CRYPTO_eddsa_sign_derived (
   unsigned char R[32];
   unsigned char zk[32];
   unsigned char tmp[32];
+  unsigned char r_mod[64];
+  unsigned char hram_mod[64];
 
   /**
    * Derive the private key
@@ -132,7 +134,6 @@ GNUNET_CRYPTO_eddsa_sign_derived (
   /**
    * Reduce the scalar value r
    */
-  unsigned char r_mod[64];
   crypto_core_ed25519_scalar_reduce (r_mod, r);
 
   /**
@@ -154,7 +155,6 @@ GNUNET_CRYPTO_eddsa_sign_derived (
   /**
    * Reduce the resulting scalar value
    */
-  unsigned char hram_mod[64];
   crypto_core_ed25519_scalar_reduce (hram_mod, hram);
 
   /**
@@ -356,18 +356,19 @@ GNUNET_CRYPTO_eddsa_private_key_derive (
   gcry_mpi_release (h_mod_L);
   gcry_ctx_release (ctx);
   GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d);
-  /**
-   * We hash the derived "h" parameter with the
-   * other half of the expanded private key. This ensures
-   * that for signature generation, the "R" is derived from
-   * the same derivation path as "h" and is not reused.
-   */
-  crypto_hash_sha256_state hs;
-  crypto_hash_sha256_init (&hs);
-  crypto_hash_sha256_update (&hs, sk + 32, 32);
-  crypto_hash_sha256_update (&hs, (unsigned char*) &hc, sizeof (hc));
-  crypto_hash_sha256_final (&hs, result->s + 32);
-  // memcpy (result->s, sk, sizeof (sk));
+  {
+    /**
+     * We hash the derived "h" parameter with the
+     * other half of the expanded private key. This ensures
+     * that for signature generation, the "R" is derived from
+     * the same derivation path as "h" and is not reused.
+     */
+    crypto_hash_sha256_state hs;
+    crypto_hash_sha256_init (&hs);
+    crypto_hash_sha256_update (&hs, sk + 32, 32);
+    crypto_hash_sha256_update (&hs, (unsigned char*) &hc, sizeof (hc));
+    crypto_hash_sha256_final (&hs, result->s + 32);
+  }
   /* Convert to little endian for libsodium */
   for (size_t i = 0; i < 32; i++)
     result->s[i] = dc[31 - i];
diff --git a/src/lib/util/crypto_ecc_setup.c b/src/lib/util/crypto_ecc_setup.c
index 07e28f89d..f0e60ff47 100644
--- a/src/lib/util/crypto_ecc_setup.c
+++ b/src/lib/util/crypto_ecc_setup.c
@@ -332,7 +332,6 @@ GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose,
  * key is fast (for example in time-dependent testcases).
  *
  * @param cfg_name name of the configuration file to use
- */
 void
 GNUNET_CRYPTO_eddsa_setup_key (const char *cfg_name)
 {
@@ -346,6 +345,7 @@ GNUNET_CRYPTO_eddsa_setup_key (const char *cfg_name)
     GNUNET_free (priv);
   GNUNET_CONFIGURATION_destroy (cfg);
 }
+ */
 
 
 /* end of crypto_ecc_setup.c */
diff --git a/src/lib/util/crypto_edx25519.c b/src/lib/util/crypto_edx25519.c
index 2d9a76aa3..0b68dc4a6 100644
--- a/src/lib/util/crypto_edx25519.c
+++ b/src/lib/util/crypto_edx25519.c
@@ -113,6 +113,7 @@ GNUNET_CRYPTO_edx25519_sign_ (
   unsigned char r_mod[64];
   unsigned char R[32];
   unsigned char tmp[32];
+  unsigned char hram_mod[64];
 
   crypto_hash_sha512_init (&hs);
 
@@ -165,7 +166,6 @@ GNUNET_CRYPTO_edx25519_sign_ (
   /**
    * Reduce the resulting scalar value
    */
-  unsigned char hram_mod[64];
   crypto_core_ed25519_scalar_reduce (hram_mod, hram);
 
   /**
diff --git a/src/lib/util/crypto_elligator.c b/src/lib/util/crypto_elligator.c
index f17a65b2e..87a41260a 100644
--- a/src/lib/util/crypto_elligator.c
+++ b/src/lib/util/crypto_elligator.c
@@ -222,29 +222,11 @@ encode_bytes (uint8_t *bytes, mp_limb_t *number)
 /**
  * Initialize elligator scratch space.
 */
-void __attribute__ ((constructor))
+static void __attribute__ ((constructor))
 GNUNET_CRYPTO_ecdhe_elligator_initialize ()
 {
   static bool initialized = false;
 
-  if (initialized)
-  {
-    return;
-  }
-
-  decode_bytes (p, p_bytes);
-  decode_bytes (negative_1, negative_1_bytes);
-  decode_bytes (negative_2, negative_2_bytes);
-  decode_bytes (divide_negative_1_2, divide_negative_1_2_bytes);
-  decode_bytes (divide_plus_p_3_8, divide_plus_p_3_8_bytes);
-  decode_bytes (divide_minus_p_1_2, divide_minus_p_1_2_bytes);
-  decode_bytes (square_root_negative_1, square_root_negative_1_bytes);
-  decode_bytes (A, A_bytes);
-  decode_bytes (negative_A, negative_A_bytes);
-  decode_bytes (u, u_bytes);
-  decode_bytes (inverted_u, inverted_u_bytes);
-  decode_bytes (d, d_bytes);
-
   mp_size_t scratch_space_lengths[] = {
     // For least_square_root
 
@@ -280,6 +262,25 @@ GNUNET_CRYPTO_ecdhe_elligator_initialize ()
     mpn_sec_sub_1_itch (P_LIMBS)
   };
 
+  if (initialized)
+  {
+    return;
+  }
+
+  decode_bytes (p, p_bytes);
+  decode_bytes (negative_1, negative_1_bytes);
+  decode_bytes (negative_2, negative_2_bytes);
+  decode_bytes (divide_negative_1_2, divide_negative_1_2_bytes);
+  decode_bytes (divide_plus_p_3_8, divide_plus_p_3_8_bytes);
+  decode_bytes (divide_minus_p_1_2, divide_minus_p_1_2_bytes);
+  decode_bytes (square_root_negative_1, square_root_negative_1_bytes);
+  decode_bytes (A, A_bytes);
+  decode_bytes (negative_A, negative_A_bytes);
+  decode_bytes (u, u_bytes);
+  decode_bytes (inverted_u, inverted_u_bytes);
+  decode_bytes (d, d_bytes);
+
+
   for (size_t i = 0; i < sizeof scratch_space_lengths
        / sizeof *scratch_space_lengths; ++i)
   {
@@ -308,6 +309,7 @@ least_square_root (mp_limb_t *root,
 {
   mp_limb_t a[P_LIMBS + P_LIMBS];
   mp_limb_t b[P_LIMBS];
+  mp_limb_t condition;
 
   // root := number ^ ((p + 3) / 8)
 
@@ -321,7 +323,7 @@ least_square_root (mp_limb_t *root,
   mpn_sec_div_r (a, P_LIMBS + P_LIMBS, p, P_LIMBS, scratch_space);
   mpn_sub_n (b, a, number, P_LIMBS);
 
-  mp_limb_t condition = mpn_sec_sub_1 (b, b, P_LIMBS, 1, scratch_space) ^ 1;
+  condition = mpn_sec_sub_1 (b, b, P_LIMBS, 1, scratch_space) ^ 1;
 
   mpn_sec_mul (a, root, P_LIMBS, square_root_negative_1, P_LIMBS,
                scratch_space);
@@ -349,7 +351,6 @@ GNUNET_CRYPTO_ecdhe_elligator_encoding (
   bool msb_set;
   bool smsb_set;
 
-  high_y = random_tweak & 1;
 
   uint8_t *representative = r->r;
   uint8_t *point = (uint8_t *) pub->q_y;
@@ -360,6 +361,8 @@ GNUNET_CRYPTO_ecdhe_elligator_encoding (
   mp_limb_t b[P_LIMBS + P_LIMBS];
   mp_limb_t c[P_LIMBS + P_LIMBS];
 
+  high_y = random_tweak & 1;
+
   // a := point
 
   decode_bytes (a, point);
@@ -394,22 +397,24 @@ GNUNET_CRYPTO_ecdhe_elligator_encoding (
   mpn_sec_div_r (a, P_LIMBS + P_LIMBS, p, P_LIMBS, scratch_space);
   mpn_sub_n (a, a, c, P_LIMBS);
 
-  bool result = mpn_sec_sub_1 (a, a, P_LIMBS, 1, scratch_space);
+  {
+    bool result = mpn_sec_sub_1 (a, a, P_LIMBS, 1, scratch_space);
 
-  encode_bytes (representative, b);
+    encode_bytes (representative, b);
 
-  // Setting most significant bit and second most significant bit randomly
-  msb_set = (random_tweak >> 1) & 1;
-  smsb_set = (random_tweak >> 2) & 1;
-  if (msb_set)
-  {
-    r->r[31] |= 128;
-  }
-  if (smsb_set)
-  {
-    r->r[31] |= 64;
+    // Setting most significant bit and second most significant bit randomly
+    msb_set = (random_tweak >> 1) & 1;
+    smsb_set = (random_tweak >> 2) & 1;
+    if (msb_set)
+    {
+      r->r[31] |= 128;
+    }
+    if (smsb_set)
+    {
+      r->r[31] |= 64;
+    }
+    return result;
   }
-  return result;
 }
 
 
@@ -435,6 +440,7 @@ elligator_direct_map (uint8_t *point,
   mp_limb_t b[P_LIMBS + P_LIMBS];
   mp_limb_t c[P_LIMBS];
   mp_limb_t e[P_LIMBS + P_LIMBS];
+  bool result;
 
   // a := representative
 
@@ -442,7 +448,7 @@ elligator_direct_map (uint8_t *point,
 
   // Determine whether a < (p - 1) / 2
 
-  bool result = mpn_sub_n (b, divide_minus_p_1_2, a, P_LIMBS) ^ 1;
+  result = mpn_sub_n (b, divide_minus_p_1_2, a, P_LIMBS) ^ 1;
 
   // b := -A / (1 + u * a ^ 2)
 
@@ -491,6 +497,7 @@ GNUNET_CRYPTO_ecdhe_elligator_decoding (
   const struct GNUNET_CRYPTO_ElligatorRepresentative *representative)
 {
   // if sign of direct map transformation not needed throw it away
+  struct GNUNET_CRYPTO_ElligatorRepresentative r_tmp;
   bool high_y_local;
   bool *high_y_ptr;
   if (NULL == high_y)
@@ -498,7 +505,6 @@ GNUNET_CRYPTO_ecdhe_elligator_decoding (
   else
     high_y_ptr = high_y;
 
-  struct GNUNET_CRYPTO_ElligatorRepresentative r_tmp;
   memcpy (&r_tmp.r, &representative->r, sizeof(r_tmp.r));
   r_tmp.r[31] &= 63;
   // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Print high_y\n");
@@ -530,6 +536,7 @@ convert_from_ed_to_curve (uint8_t *point,
   mp_limb_t c[P_LIMBS + P_LIMBS];
 
   uint8_t y_bytes[P_BYTES];
+  bool result;
 
   memcpy (y_bytes, source, 31);
 
@@ -539,7 +546,7 @@ convert_from_ed_to_curve (uint8_t *point,
 
   // Check if y < p
 
-  bool result = mpn_sub_n (a, y, p, P_LIMBS);
+  result = mpn_sub_n (a, y, p, P_LIMBS);
 
   // a := (y ^ 2 - 1) / (1 + d * y ^ 2)
 
@@ -592,15 +599,15 @@ elligator_generate_public_key (
   // eHigh
   // crypto_scalarmult_ed25519_base clamps the scalar pk->d and return only 0 
if pk->d is zero
   unsigned char eHigh[crypto_scalarmult_SCALARBYTES] = {0};
+  int sLow = (pk->d)[0] % 8;
+  unsigned char eLow[crypto_scalarmult_SCALARBYTES] = {0};
+  unsigned char edPub[crypto_scalarmult_SCALARBYTES] = {0};
   GNUNET_assert (0 == crypto_scalarmult_ed25519_base (eHigh, pk->d));
 
   // eLow: choose a random point of low order
-  int sLow = (pk->d)[0] % 8;
-  unsigned char eLow[crypto_scalarmult_SCALARBYTES] = {0};
   memcpy (eLow, lookupTable[sLow], crypto_scalarmult_SCALARBYTES);
 
   // eHigh + eLow
-  unsigned char edPub[crypto_scalarmult_SCALARBYTES] = {0};
   if (crypto_core_ed25519_add (edPub, eLow, eHigh) == -1)
   {
     return GNUNET_SYSERR;
@@ -668,7 +675,8 @@ GNUNET_CRYPTO_ecdhe_elligator_key_create (
     GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
                                 sk,
                                 sizeof (struct
-                                        
GNUNET_CRYPTO_ElligatorEcdhePrivateKey));
+                                        
GNUNET_CRYPTO_ElligatorEcdhePrivateKey))
+    ;
     if (GNUNET_OK == GNUNET_CRYPTO_ecdhe_elligator_key_get_public (sk, &pk,
                                                                    &repr))
       break;
diff --git a/src/lib/util/crypto_hkdf.c b/src/lib/util/crypto_hkdf.c
index 31399d9aa..2cee12f92 100644
--- a/src/lib/util/crypto_hkdf.c
+++ b/src/lib/util/crypto_hkdf.c
@@ -178,9 +178,9 @@ GNUNET_CRYPTO_hkdf_gnunet_v (void *result,
                              va_list argp)
 {
   unsigned char prk[crypto_auth_hmacsha512_BYTES];
+  crypto_auth_hmacsha512_state st;
 
   memset (result, 0, out_len);
-  crypto_auth_hmacsha512_state st;
   if (crypto_auth_hmacsha512_init (&st, xts, xts_len))
     return GNUNET_SYSERR;
   if (crypto_auth_hmacsha512_update (&st, skm, skm_len))
diff --git a/src/lib/util/crypto_hpke.c b/src/lib/util/crypto_hpke.c
index d36a47b24..b89ce7b9b 100644
--- a/src/lib/util/crypto_hpke.c
+++ b/src/lib/util/crypto_hpke.c
@@ -452,12 +452,12 @@ GNUNET_CRYPTO_hpke_elligator_kem_encaps (
   struct GNUNET_ShortHashCode *shared_secret)
 {
   uint8_t random_tweak;
+  struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey skE;
+
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
                               &random_tweak,
                               sizeof(uint8_t));
 
-  struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey skE;
-
   // skE, pkE = GenerateElligatorKeyPair()
   GNUNET_CRYPTO_ecdhe_elligator_key_create (&skE);
 
@@ -581,7 +581,7 @@ verify_psk_inputs (enum GNUNET_CRYPTO_HpkeMode mode,
 }
 
 
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
 key_schedule (enum GNUNET_CRYPTO_HpkeRole role,
               enum GNUNET_CRYPTO_HpkeMode mode,
               const struct GNUNET_ShortHashCode *shared_secret,
diff --git a/src/lib/util/crypto_mpi.c b/src/lib/util/crypto_mpi.c
index 06f2fd786..62941dace 100644
--- a/src/lib/util/crypto_mpi.c
+++ b/src/lib/util/crypto_mpi.c
@@ -155,7 +155,6 @@ GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result,
  * @param result where to store MPI value (allocated)
  * @param data raw data (GCRYMPI_FMT_USG)
  * @param size number of bytes in @a data
- */
 void
 GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result,
                                     const void *data,
@@ -173,6 +172,7 @@ GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result,
     GNUNET_assert (0);
   }
 }
+ */
 
 
 /* end of crypto_mpi.c */
diff --git a/src/lib/util/crypto_paillier.c b/src/lib/util/crypto_paillier.c
index 169d1e49e..669b94a90 100644
--- a/src/lib/util/crypto_paillier.c
+++ b/src/lib/util/crypto_paillier.c
@@ -117,7 +117,7 @@ GNUNET_CRYPTO_paillier_create (struct
  *         or desired_ops, in case that is lower,
  *         or -1 if less than one homomorphic operation is possible
  */
-int
+static int
 GNUNET_CRYPTO_paillier_encrypt1 (const struct
                                  GNUNET_CRYPTO_PaillierPublicKey *public_key,
                                  const gcry_mpi_t m,
diff --git a/src/lib/util/crypto_pkey.c b/src/lib/util/crypto_pkey.c
index ea005232d..f383e2883 100644
--- a/src/lib/util/crypto_pkey.c
+++ b/src/lib/util/crypto_pkey.c
@@ -98,24 +98,6 @@ GNUNET_CRYPTO_public_key_get_length (const struct
 }
 
 
-ssize_t
-GNUNET_CRYPTO_private_key_length_by_type (enum GNUNET_CRYPTO_KeyType kt)
-{
-  switch (kt)
-  {
-  case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
-    return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
-    break;
-  case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
-    return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
-    break;
-  default:
-    GNUNET_break (0);
-  }
-  return -1;
-}
-
-
 enum GNUNET_GenericReturnValue
 GNUNET_CRYPTO_read_public_key_from_buffer (const void *buffer,
                                            size_t len,
@@ -123,12 +105,13 @@ GNUNET_CRYPTO_read_public_key_from_buffer (const void 
*buffer,
                                            key,
                                            size_t *kb_read)
 {
+  ssize_t length;
   if (len < sizeof (key->type))
     return GNUNET_SYSERR;
   GNUNET_memcpy (&key->type,
                  buffer,
                  sizeof (key->type));
-  ssize_t length = GNUNET_CRYPTO_public_key_get_length (key);
+  length = GNUNET_CRYPTO_public_key_get_length (key);
   if (len < length)
     return GNUNET_SYSERR;
   if (length < 0)
@@ -166,12 +149,13 @@ GNUNET_CRYPTO_read_private_key_from_buffer (const void 
*buffer,
                                             GNUNET_CRYPTO_PrivateKey *key,
                                             size_t *kb_read)
 {
+  ssize_t length;
   if (len < sizeof (key->type))
     return GNUNET_SYSERR;
   GNUNET_memcpy (&key->type,
                  buffer,
                  sizeof (key->type));
-  ssize_t length = GNUNET_CRYPTO_private_key_get_length (key);
+  length = GNUNET_CRYPTO_private_key_get_length (key);
   if (len < length)
     return GNUNET_SYSERR;
   if (length < 0)
@@ -245,10 +229,11 @@ GNUNET_CRYPTO_read_signature_from_buffer (struct
                                           const void*buffer,
                                           size_t len)
 {
+  ssize_t length;
   if (len < sizeof (sig->type))
     return -1;
   GNUNET_memcpy (&(sig->type), buffer, sizeof (sig->type));
-  const ssize_t length = GNUNET_CRYPTO_signature_get_length (sig);
+  length = GNUNET_CRYPTO_signature_get_length (sig);
   if (len < length)
     return -1;
   if (length < 0)
diff --git a/src/lib/util/crypto_random.c b/src/lib/util/crypto_random.c
index 72474d04b..064722906 100644
--- a/src/lib/util/crypto_random.c
+++ b/src/lib/util/crypto_random.c
@@ -360,7 +360,7 @@ w_check (const void *p)
 /**
  * Initialize libgcrypt.
  */
-void __attribute__ ((constructor))
+static void __attribute__ ((constructor))
 GNUNET_CRYPTO_random_init ()
 {
   gcry_error_t rc;
@@ -399,7 +399,7 @@ GNUNET_CRYPTO_random_init ()
 /**
  * Nicely shut down libgcrypt.
  */
-void __attribute__ ((destructor))
+static void __attribute__ ((destructor))
 GNUNET_CRYPTO_random_fini ()
 {
   gcry_set_progress_handler (NULL, NULL);
diff --git a/src/lib/util/disk.c b/src/lib/util/disk.c
index 9639489fd..fd0621e3e 100644
--- a/src/lib/util/disk.c
+++ b/src/lib/util/disk.c
@@ -26,6 +26,7 @@
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "disk.h"
 
 #define LOG(kind, ...) GNUNET_log_from (kind, "util-disk", __VA_ARGS__)
 
diff --git a/src/lib/util/disk.h b/src/lib/util/disk.h
index bca398e26..7af3ac828 100644
--- a/src/lib/util/disk.h
+++ b/src/lib/util/disk.h
@@ -26,6 +26,7 @@
 #ifndef GNUNET_DISK_H_
 #define GNUNET_DISK_H_
 
+#include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 
 /**
@@ -37,7 +38,7 @@
  * @param dst_len length of @a dst
  * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
  */
-int
+enum GNUNET_GenericReturnValue
 GNUNET_DISK_internal_file_handle_ (const struct GNUNET_DISK_FileHandle *fh,
                                    void *dst, size_t dst_len);
 
diff --git a/src/lib/util/dnsparser.c b/src/lib/util/dnsparser.c
index 93b2b590b..7b61be125 100644
--- a/src/lib/util/dnsparser.c
+++ b/src/lib/util/dnsparser.c
@@ -541,6 +541,8 @@ GNUNET_DNSPARSER_parse_uri (const char *udp_payload,
   struct GNUNET_DNSPARSER_UriRecord *uri;
   struct GNUNET_TUN_DnsUriRecord uri_bin;
   size_t old_off;
+  int max_len;
+  int len;
 
   old_off = *off;
   if (*off + sizeof(struct GNUNET_TUN_DnsUriRecord) > udp_payload_length)
@@ -552,8 +554,8 @@ GNUNET_DNSPARSER_parse_uri (const char *udp_payload,
   uri = GNUNET_new (struct GNUNET_DNSPARSER_UriRecord);
   uri->priority = ntohs (uri_bin.prio);
   uri->weight = ntohs (uri_bin.weight);
-  int max_len = udp_payload_length - sizeof(struct GNUNET_TUN_DnsUriRecord);
-  int len =  GNUNET_asprintf (&(uri->target), "%.*s", max_len,
+  max_len = udp_payload_length - sizeof(struct GNUNET_TUN_DnsUriRecord);
+  len =  GNUNET_asprintf (&(uri->target), "%.*s", max_len,
                               &udp_payload[*off]);
   (*off) += len;
   if (NULL == uri->target)
diff --git a/src/lib/util/load.c b/src/lib/util/load.c
index a64171bd4..a182d6701 100644
--- a/src/lib/util/load.c
+++ b/src/lib/util/load.c
@@ -24,8 +24,7 @@
  * @author Christian Grothoff
  */
 
-#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_load_lib.h"
 
 
 #define LOG(kind, ...) GNUNET_log_from (kind, "util-load", __VA_ARGS__)
diff --git a/src/lib/util/mq.c b/src/lib/util/mq.c
index c2ca5a1b8..f77856b96 100644
--- a/src/lib/util/mq.c
+++ b/src/lib/util/mq.c
@@ -354,10 +354,10 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq,
 struct GNUNET_MQ_Envelope *
 GNUNET_MQ_unsent_head (struct GNUNET_MQ_Handle *mq)
 {
+  struct GNUNET_MQ_Envelope *env;
   GNUNET_assert (0 < mq->queue_length);
   GNUNET_assert (NULL != mq->envelope_head);
   GNUNET_assert (NULL != mq->envelope_tail);
-  struct GNUNET_MQ_Envelope *env;
 
   env = mq->envelope_head;
   GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
@@ -384,9 +384,9 @@ void
 GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq,
                      const struct GNUNET_MQ_Envelope *ev)
 {
-  GNUNET_assert (NULL != ev);
   struct GNUNET_MQ_Envelope *env;
   uint16_t msize;
+  GNUNET_assert (NULL != ev);
 
   msize = ntohs (ev->mh->size);
   env = GNUNET_malloc (sizeof(struct GNUNET_MQ_Envelope) + msize);
diff --git a/src/lib/util/network.c b/src/lib/util/network.c
index d2b6d320d..2883bf6d1 100644
--- a/src/lib/util/network.c
+++ b/src/lib/util/network.c
@@ -508,10 +508,11 @@ enum GNUNET_GenericReturnValue
 GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc)
 {
   int ret;
+  const struct sockaddr_un *un;
 
   ret = close (desc->fd);
 
-  const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr;
+  un = (const struct sockaddr_un *) desc->addr;
 
   /* Cleanup the UNIX domain socket and its parent directories in case of non
      abstract sockets */
diff --git a/src/lib/util/nt.c b/src/lib/util/nt.c
index 24471d9ad..37867a1c2 100644
--- a/src/lib/util/nt.c
+++ b/src/lib/util/nt.c
@@ -30,7 +30,7 @@
  * How frequently do we scan the interfaces for changes to the addresses?
  */
 #define INTERFACE_PROCESSING_INTERVAL GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MINUTES, 2)
+          GNUNET_TIME_UNIT_MINUTES, 2)
 
 
 const char *
@@ -237,19 +237,21 @@ interface_proc (void *cls,
 #if HAVE_SOCKADDR_IN_SIN_LEN
     network6.sin6_len = sizeof(network6);
 #endif
-    unsigned int c = 0;
-    uint32_t *addr_elem = (uint32_t *) &addr6->sin6_addr;
-    uint32_t *mask_elem = (uint32_t *) &netmask6->sin6_addr;
-    uint32_t *net_elem = (uint32_t *) &network6.sin6_addr;
-    for (c = 0; c < 4; c++)
-      net_elem[c] = addr_elem[c] & mask_elem[c];
-
-    GNUNET_memcpy (net->netmask,
-                   netmask6,
-                   sizeof(struct sockaddr_in6));
-    GNUNET_memcpy (net->network,
-                   &network6,
-                   sizeof(struct sockaddr_in6));
+    {
+      unsigned int c;
+      uint32_t *addr_elem = (uint32_t *) &addr6->sin6_addr;
+      uint32_t *mask_elem = (uint32_t *) &netmask6->sin6_addr;
+      uint32_t *net_elem = (uint32_t *) &network6.sin6_addr;
+      for (c = 0; c < 4; c++)
+        net_elem[c] = addr_elem[c] & mask_elem[c];
+
+      GNUNET_memcpy (net->netmask,
+                     netmask6,
+                     sizeof(struct sockaddr_in6));
+      GNUNET_memcpy (net->network,
+                     &network6,
+                     sizeof(struct sockaddr_in6));
+    }
   }
   if (NULL == net)
     return GNUNET_OK; /* odd / unsupported address family */
diff --git a/src/lib/util/time.c b/src/lib/util/time.c
index 1bc7baeaa..63e0ac0c0 100644
--- a/src/lib/util/time.c
+++ b/src/lib/util/time.c
@@ -316,10 +316,11 @@ struct GNUNET_TIME_Absolute
 GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel)
 {
   struct GNUNET_TIME_Absolute ret;
+  struct GNUNET_TIME_Absolute now;
 
   if (GNUNET_TIME_relative_is_forever (rel))
     return GNUNET_TIME_UNIT_FOREVER_ABS;
-  struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+  now = GNUNET_TIME_absolute_get ();
 
   if (rel.rel_value_us + now.abs_value_us < rel.rel_value_us)
   {
@@ -405,10 +406,11 @@ struct GNUNET_TIME_Relative
 GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future)
 {
   struct GNUNET_TIME_Relative ret;
+  struct GNUNET_TIME_Absolute now;
 
   if (GNUNET_TIME_absolute_is_never (future))
     return GNUNET_TIME_UNIT_FOREVER_REL;
-  struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+  now = GNUNET_TIME_absolute_get ();
 
   if (now.abs_value_us > future.abs_value_us)
     return GNUNET_TIME_UNIT_ZERO;
@@ -981,7 +983,7 @@ GNUNET_TIME_absolute_get_monotonic (
 /**
  * Destructor
  */
-void __attribute__ ((destructor))
+static void __attribute__ ((destructor))
 GNUNET_util_time_fini ()
 {
   (void) GNUNET_TIME_absolute_get_monotonic (NULL);

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