[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: build: fix various C90 warnings
From: |
gnunet |
Subject: |
[gnunet] branch master updated: build: fix various C90 warnings |
Date: |
Mon, 23 Sep 2024 11:55:20 +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 e14c10469 build: fix various C90 warnings
e14c10469 is described below
commit e14c104697572ef127b4cc4f1a475e8b0101ee5c
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Mon Sep 23 11:55:11 2024 +0200
build: fix various C90 warnings
---
src/contrib/service/abd/abd_serialization.c | 125 +++++------
src/contrib/service/abd/delegate_misc.c | 147 ++++++------
.../service/scalarproduct/scalarproduct_api.c | 2 +-
src/contrib/service/set/set_api.c | 2 +-
src/include/gnunet_pq_lib.h | 18 ++
src/lib/gnsrecord/gnunet-gnsrecord-tvg.c | 147 ++++++------
src/lib/gnsrecord/json_gnsrecord.c | 20 +-
src/lib/gnsrecord/perf_gnsrecord_crypto.c | 2 +-
src/lib/gnsrecord/test_gnsrecord_crypto.c | 2 +-
src/lib/gnsrecord/test_gnsrecord_serialization.c | 105 ++++-----
src/lib/gnsrecord/test_gnsrecord_testvectors.c | 31 +--
src/lib/json/test_json_mhd.c | 2 +-
src/lib/pq/pq_query_helper.c | 19 +-
src/lib/pq/pq_result_helper.c | 176 ++++++++-------
src/lib/pq/test_pq.c | 70 +++---
src/lib/testing/gnunet-cmds-helper.c | 17 +-
src/lib/testing/testing_api_topology.c | 6 +-
src/lib/util/gnunet-elligator-tvg.c | 8 +-
src/lib/util/perf_mq.c | 6 +-
src/lib/util/test_child_management.c | 6 +-
src/lib/util/test_crypto_ecc_dlog.c | 16 +-
src/lib/util/test_crypto_elligator.c | 22 +-
src/lib/util/test_crypto_rsa.c | 99 +++++----
src/plugin/datastore/plugin_datastore_postgres.c | 9 +-
src/plugin/datastore/plugin_datastore_sqlite.c | 246 +++++++++++----------
src/plugin/datastore/test_plugin_datastore.c | 6 +-
src/plugin/gnsrecord/plugin_gnsrecord_dns.c | 32 +--
src/plugin/namecache/plugin_namecache_postgres.c | 4 +-
src/plugin/namecache/plugin_namecache_sqlite.c | 4 +-
src/plugin/namestore/plugin_namestore_postgres.c | 21 +-
src/plugin/namestore/test_plugin_namestore.c | 9 +-
src/plugin/reclaim/plugin_reclaim_credential_jwt.c | 125 ++++++-----
src/service/arm/arm_api.c | 2 +-
src/service/arm/arm_monitor_api.c | 2 +-
src/service/core/core_api_monitor_peers.c | 2 +-
src/service/dht/dht_api.c | 27 +--
src/service/fs/fs_api.c | 210 +++++++++---------
src/service/fs/fs_namespace.c | 58 ++---
src/service/fs/meta_data.c | 6 +-
src/service/nat-auto/nat_auto_api.c | 6 +-
src/service/nat/nat_api.c | 2 +-
src/service/reclaim/did_core.c | 17 +-
src/service/revocation/revocation_api.c | 14 +-
src/service/seti/seti_api.c | 2 +-
src/service/setu/setu_api.c | 2 +-
.../transport/transport-testing-communicator.c | 33 +--
.../transport/transport_api2_communication.c | 2 +-
47 files changed, 991 insertions(+), 898 deletions(-)
diff --git a/src/contrib/service/abd/abd_serialization.c
b/src/contrib/service/abd/abd_serialization.c
index b41d57d55..99671517c 100644
--- a/src/contrib/service/abd/abd_serialization.c
+++ b/src/contrib/service/abd/abd_serialization.c
@@ -27,7 +27,6 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
#include "gnunet_abd_service.h"
#include "gnunet_signatures.h"
#include "abd.h"
@@ -418,43 +417,44 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate
*dele,
}
size = sizeof (struct DelegateEntry) + attr_len;
- char tmp_str[attr_len];
- GNUNET_memcpy (tmp_str, dele->issuer_attribute, dele->issuer_attribute_len);
- if (0 != dele->subject_attribute_len)
{
- tmp_str[dele->issuer_attribute_len] = '\0';
- GNUNET_memcpy (tmp_str + dele->issuer_attribute_len + 1,
- dele->subject_attribute,
- dele->subject_attribute_len);
+ char tmp_str[attr_len];
+ GNUNET_memcpy (tmp_str, dele->issuer_attribute,
dele->issuer_attribute_len);
+ if (0 != dele->subject_attribute_len)
+ {
+ tmp_str[dele->issuer_attribute_len] = '\0';
+ GNUNET_memcpy (tmp_str + dele->issuer_attribute_len + 1,
+ dele->subject_attribute,
+ dele->subject_attribute_len);
+ }
+ tmp_str[attr_len - 1] = '\0';
+
+ *data = GNUNET_malloc (size);
+ cdata = (struct DelegateEntry *) *data;
+ cdata->subject_key = dele->subject_key;
+ cdata->issuer_key = dele->issuer_key;
+ cdata->expiration = GNUNET_htonll (dele->expiration.abs_value_us);
+ cdata->signature = dele->signature;
+ cdata->issuer_attribute_len = htonl (dele->issuer_attribute_len + 1);
+ if (0 == dele->subject_attribute_len)
+ {
+ cdata->subject_attribute_len = htonl (0);
+ }
+ else
+ {
+ cdata->subject_attribute_len = htonl (dele->subject_attribute_len + 1);
+ }
+ cdata->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
+ cdata->purpose.size =
+ htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
+
+ GNUNET_memcpy (&cdata[1], tmp_str, attr_len);
}
- tmp_str[attr_len - 1] = '\0';
-
- *data = GNUNET_malloc (size);
- cdata = (struct DelegateEntry *) *data;
- cdata->subject_key = dele->subject_key;
- cdata->issuer_key = dele->issuer_key;
- cdata->expiration = GNUNET_htonll (dele->expiration.abs_value_us);
- cdata->signature = dele->signature;
- cdata->issuer_attribute_len = htonl (dele->issuer_attribute_len + 1);
- if (0 == dele->subject_attribute_len)
- {
- cdata->subject_attribute_len = htonl (0);
- }
- else
- {
- cdata->subject_attribute_len = htonl (dele->subject_attribute_len + 1);
- }
- cdata->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
- cdata->purpose.size =
- htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
-
- GNUNET_memcpy (&cdata[1], tmp_str, attr_len);
-
if (GNUNET_OK !=
GNUNET_CRYPTO_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
- &cdata->purpose,
- &cdata->signature,
- &cdata->issuer_key))
+ &cdata->purpose,
+ &cdata->signature,
+ &cdata->issuer_key))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Serialize: Invalid delegate\n");
return 0;
@@ -475,41 +475,42 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t
data_size)
cdata = (struct DelegateEntry *) data;
if (GNUNET_OK !=
GNUNET_CRYPTO_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
- &cdata->purpose,
- &cdata->signature,
- &cdata->issuer_key))
+ &cdata->purpose,
+ &cdata->signature,
+ &cdata->issuer_key))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Deserialize: Invalid delegate\n");
return NULL;
}
attr_combo_str = (char *) &cdata[1];
- int iss_len = ntohl (cdata->issuer_attribute_len);
- int sub_len = ntohl (cdata->subject_attribute_len);
- int attr_combo_len = iss_len + sub_len;
-
- dele =
- GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_combo_len);
-
- dele->issuer_key = cdata->issuer_key;
- dele->subject_key = cdata->subject_key;
- GNUNET_memcpy (&dele[1], attr_combo_str, attr_combo_len);
- dele->signature = cdata->signature;
-
- // Set the pointers for the attributes
- dele->issuer_attribute = (char *) &dele[1];
- dele->issuer_attribute_len = iss_len;
- dele->subject_attribute_len = sub_len;
- if (0 == sub_len)
- {
- dele->subject_attribute = NULL;
- }
- else
{
- dele->subject_attribute = (char *) &dele[1] + iss_len;
+ int iss_len = ntohl (cdata->issuer_attribute_len);
+ int sub_len = ntohl (cdata->subject_attribute_len);
+ int attr_combo_len = iss_len + sub_len;
+
+ dele =
+ GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_combo_len);
+
+ dele->issuer_key = cdata->issuer_key;
+ dele->subject_key = cdata->subject_key;
+ GNUNET_memcpy (&dele[1], attr_combo_str, attr_combo_len);
+ dele->signature = cdata->signature;
+
+ // Set the pointers for the attributes
+ dele->issuer_attribute = (char *) &dele[1];
+ dele->issuer_attribute_len = iss_len;
+ dele->subject_attribute_len = sub_len;
+ if (0 == sub_len)
+ {
+ dele->subject_attribute = NULL;
+ }
+ else
+ {
+ dele->subject_attribute = (char *) &dele[1] + iss_len;
+ }
+
+ dele->expiration.abs_value_us = GNUNET_ntohll (cdata->expiration);
}
-
- dele->expiration.abs_value_us = GNUNET_ntohll (cdata->expiration);
-
return dele;
}
diff --git a/src/contrib/service/abd/delegate_misc.c
b/src/contrib/service/abd/delegate_misc.c
index 799b8646c..2928ddb29 100644
--- a/src/contrib/service/abd/delegate_misc.c
+++ b/src/contrib/service/abd/delegate_misc.c
@@ -27,7 +27,6 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
#include "gnunet_abd_service.h"
#include "gnunet_signatures.h"
#include "abd.h"
@@ -77,20 +76,19 @@ GNUNET_ABD_delegate_to_string (
}
+#define KEY_LEN_ENC (260 / 5)
+
struct GNUNET_ABD_Delegate *
GNUNET_ABD_delegate_from_string (const char *s)
{
struct GNUNET_ABD_Delegate *dele;
- size_t enclen = (sizeof (struct GNUNET_CRYPTO_PublicKey)) * 8;
- if (enclen % 5 > 0)
- enclen += 5 - enclen % 5;
- enclen /= 5; /* 260/5 = 52 */
- char subject_pkey[enclen + 1];
- char issuer_pkey[enclen + 1];
+ char subject_pkey[KEY_LEN_ENC + 7];
+ char issuer_pkey[KEY_LEN_ENC + 7];
char iss_attr[253 + 1];
// Needs to be initialized, in case of Type 1 credential (A.a <- B)
char sub_attr[253 + 1] = "";
char signature[256]; // TODO max payload size
+ int attr_len;
struct GNUNET_CRYPTO_Signature *sig;
struct GNUNET_TIME_Absolute etime_abs;
@@ -122,7 +120,6 @@ GNUNET_ABD_delegate_from_string (const char *s)
}
// +1 for \0
- int attr_len;
if (strcmp (sub_attr, "") == 0)
{
attr_len = strlen (iss_attr) + 1;
@@ -133,40 +130,41 @@ GNUNET_ABD_delegate_from_string (const char *s)
}
dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
- char tmp_str[attr_len];
- GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr));
- if (strcmp (sub_attr, "") != 0)
{
- tmp_str[strlen (iss_attr)] = '\0';
- GNUNET_memcpy (tmp_str + strlen (iss_attr) + 1,
- sub_attr,
- strlen (sub_attr));
- }
- tmp_str[attr_len - 1] = '\0';
-
- if (GNUNET_SYSERR ==
- GNUNET_CRYPTO_public_key_from_string (subject_pkey,
+ char tmp_str[attr_len];
+ GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr));
+ if (strcmp (sub_attr, "") != 0)
+ {
+ tmp_str[strlen (iss_attr)] = '\0';
+ GNUNET_memcpy (tmp_str + strlen (iss_attr) + 1,
+ sub_attr,
+ strlen (sub_attr));
+ }
+ tmp_str[attr_len - 1] = '\0';
+ if (GNUNET_SYSERR ==
+ GNUNET_CRYPTO_public_key_from_string (subject_pkey,
&dele->subject_key))
- {
- GNUNET_free (dele);
- return NULL;
- }
- if (GNUNET_SYSERR ==
- GNUNET_CRYPTO_public_key_from_string (issuer_pkey,
+ {
+ GNUNET_free (dele);
+ return NULL;
+ }
+ if (GNUNET_SYSERR ==
+ GNUNET_CRYPTO_public_key_from_string (issuer_pkey,
&dele->issuer_key))
- {
- GNUNET_free (dele);
- return NULL;
+ {
+ GNUNET_free (dele);
+ return NULL;
+ }
+ GNUNET_assert (sizeof (struct GNUNET_CRYPTO_Signature) ==
+ GNUNET_STRINGS_base64_decode (signature,
+ strlen (signature),
+ (void **) &sig));
+ dele->signature = *sig;
+ dele->expiration = etime_abs;
+ GNUNET_free (sig);
+
+ GNUNET_memcpy (&dele[1], tmp_str, attr_len);
}
- GNUNET_assert (sizeof (struct GNUNET_CRYPTO_Signature) ==
- GNUNET_STRINGS_base64_decode (signature,
- strlen (signature),
- (void **) &sig));
- dele->signature = *sig;
- dele->expiration = etime_abs;
- GNUNET_free (sig);
-
- GNUNET_memcpy (&dele[1], tmp_str, attr_len);
dele->issuer_attribute = (char *) &dele[1];
dele->issuer_attribute_len = strlen (iss_attr);
@@ -220,47 +218,48 @@ GNUNET_ABD_delegate_issue (
}
size = sizeof (struct DelegateEntry) + attr_len;
- char tmp_str[attr_len];
- GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr));
- if (NULL != sub_attr)
{
- tmp_str[strlen (iss_attr)] = '\0';
- GNUNET_memcpy (tmp_str + strlen (iss_attr) + 1,
- sub_attr,
- strlen (sub_attr));
- }
- tmp_str[attr_len - 1] = '\0';
-
- del = GNUNET_malloc (size);
- del->purpose.size =
- htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
- del->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
- GNUNET_CRYPTO_key_get_public (issuer, &del->issuer_key);
- del->subject_key = *subject;
- del->expiration = GNUNET_htonll (expiration->abs_value_us);
- del->issuer_attribute_len = htonl (strlen (iss_attr) + 1);
- if (NULL == sub_attr)
- {
- del->subject_attribute_len = htonl (0);
- }
- else
- {
- del->subject_attribute_len = htonl (strlen (sub_attr) + 1);
- }
-
- GNUNET_memcpy (&del[1], tmp_str, attr_len);
+ char tmp_str[attr_len];
+ GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr));
+ if (NULL != sub_attr)
+ {
+ tmp_str[strlen (iss_attr)] = '\0';
+ GNUNET_memcpy (tmp_str + strlen (iss_attr) + 1,
+ sub_attr,
+ strlen (sub_attr));
+ }
+ tmp_str[attr_len - 1] = '\0';
+
+ del = GNUNET_malloc (size);
+ del->purpose.size =
+ htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
+ del->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
+ GNUNET_CRYPTO_key_get_public (issuer, &del->issuer_key);
+ del->subject_key = *subject;
+ del->expiration = GNUNET_htonll (expiration->abs_value_us);
+ del->issuer_attribute_len = htonl (strlen (iss_attr) + 1);
+ if (NULL == sub_attr)
+ {
+ del->subject_attribute_len = htonl (0);
+ }
+ else
+ {
+ del->subject_attribute_len = htonl (strlen (sub_attr) + 1);
+ }
- GNUNET_CRYPTO_sign_ (issuer, &del->purpose, &del->signature);
+ GNUNET_memcpy (&del[1], tmp_str, attr_len);
+ GNUNET_CRYPTO_sign_ (issuer, &del->purpose, &del->signature);
- dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
- dele->signature = del->signature;
- dele->expiration = *expiration;
- GNUNET_CRYPTO_key_get_public (issuer, &dele->issuer_key);
+ dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
+ dele->signature = del->signature;
+ dele->expiration = *expiration;
+ GNUNET_CRYPTO_key_get_public (issuer, &dele->issuer_key);
- dele->subject_key = *subject;
+ dele->subject_key = *subject;
- // Copy the combined string at the part in the memory where the struct ends
- GNUNET_memcpy (&dele[1], tmp_str, attr_len);
+ // Copy the combined string at the part in the memory where the struct ends
+ GNUNET_memcpy (&dele[1], tmp_str, attr_len);
+ }
dele->issuer_attribute = (char *) &dele[1];
dele->issuer_attribute_len = strlen (iss_attr);
diff --git a/src/contrib/service/scalarproduct/scalarproduct_api.c
b/src/contrib/service/scalarproduct/scalarproduct_api.c
index 8c667a72e..4009afd8f 100644
--- a/src/contrib/service/scalarproduct/scalarproduct_api.c
+++ b/src/contrib/service/scalarproduct/scalarproduct_api.c
@@ -149,7 +149,7 @@ handle_response (void *cls,
struct GNUNET_SCALARPRODUCT_ComputationHandle *h = cls;
enum GNUNET_SCALARPRODUCT_ResponseStatus status;
- status = (enum GNUNET_SCALARPRODUCT_ResponseStatus) ntohl (message->status);
+ status = ntohl (message->status);
h->response_proc (h,
message,
status);
diff --git a/src/contrib/service/set/set_api.c
b/src/contrib/service/set/set_api.c
index 4f73ff06c..03a7d6a6b 100644
--- a/src/contrib/service/set/set_api.c
+++ b/src/contrib/service/set/set_api.c
@@ -401,7 +401,7 @@ handle_result (void *cls,
int destroy_set;
GNUNET_assert (NULL != set->mq);
- result_status = (enum GNUNET_SET_Status) ntohs (msg->result_status);
+ result_status = ntohs (msg->result_status);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got result message with status %d\n",
result_status);
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 97e2837e5..ff05431ac 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -290,6 +290,24 @@ GNUNET_PQ_query_param_array_bytes (
const size_t *sizes,
struct GNUNET_PQ_Context *db);
+/**
+ * Generate query parameter for an array of buffers @a elements,
+ * with sizes @a sizes.
+ *
+ * @param num Number of elements in @a elements
+ * @param elements Continuous array of @a num buffers, each with the same size
+ * @a same_size
+ * @param sizes Sizes in bytes of each element in @a elements
+ * @param db Database context, needed for database-depending encoding of @a
+ * elements
+ * @return query parameter to use
+ */
+struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_bytes(
+ unsigned int num,
+ const void *elements[static num],
+ const size_t *sizes,
+ struct GNUNET_PQ_Context *db);
+
/**
* Generate query parameter for an array of buffers @a elements,
* each of the same size @a size.
diff --git a/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
b/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
index 7ec384249..affbebc78 100644
--- a/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -25,10 +25,7 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_signatures.h"
-#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_testing_lib.h"
#include "gnsrecord_crypto.h"
#include <inttypes.h>
@@ -165,7 +162,7 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count,
const char *label)
sizeof (id_priv.ecdsa_key), 1);
GNUNET_CRYPTO_key_get_public (&id_priv,
- &id_pub);
+ &id_pub);
printf ("Zone private key (d, big-endian):\n");
print_bytes_ (&id_priv.ecdsa_key,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), 8, 1);
@@ -186,7 +183,7 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count,
const char *label)
pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p.ecdsa_key);
GNUNET_CRYPTO_key_get_public (&pkey_data_p,
- &pkey_data);
+ &pkey_data);
conv_lbl = GNUNET_GNSRECORD_string_normalize (label);
printf ("Label:\n");
print_bytes (conv_lbl, strlen (conv_lbl), 8);
@@ -239,35 +236,39 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count,
const char *label)
rd,
rd_count,
&rrblock));
- struct GNUNET_CRYPTO_EcdsaPublicKey derived_key;
- struct GNUNET_CRYPTO_EcdsaPrivateKey *derived_privkey;
-
- GNUNET_CRYPTO_ecdsa_public_key_derive (&id_pub.ecdsa_key,
- label,
- "gns",
- &derived_key);
- derived_privkey = GNUNET_CRYPTO_ecdsa_private_key_derive (&id_priv.ecdsa_key,
- label,
- "gns");
- printf ("ZKDF(zkey):\n");
- print_bytes (&derived_key, sizeof (derived_key), 8);
- printf ("\n");
- printf ("Derived private key (d', big-endian):\n");
- print_bytes_ (derived_privkey, sizeof (*derived_privkey), 8, 1);
- printf ("\n");
- size_t bdata_size = ntohl (rrblock->size) - sizeof (struct
- GNUNET_GNSRECORD_Block);
-
- GNUNET_free (derived_privkey);
-
- bdata = (char*) &(&rrblock->ecdsa_block)[1];
- printf ("BDATA:\n");
- print_bytes (bdata, bdata_size, 8);
- printf ("\n");
- printf ("RRBLOCK:\n");
- print_bytes (rrblock, ntohl (rrblock->size), 8);
- printf ("\n");
- GNUNET_free (rdata);
+ {
+ struct GNUNET_CRYPTO_EcdsaPublicKey derived_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey *derived_privkey;
+ size_t bdata_size;
+
+ GNUNET_CRYPTO_ecdsa_public_key_derive (&id_pub.ecdsa_key,
+ label,
+ "gns",
+ &derived_key);
+ derived_privkey = GNUNET_CRYPTO_ecdsa_private_key_derive
(&id_priv.ecdsa_key
+ ,
+ label,
+ "gns");
+ printf ("ZKDF(zkey):\n");
+ print_bytes (&derived_key, sizeof (derived_key), 8);
+ printf ("\n");
+ printf ("Derived private key (d', big-endian):\n");
+ print_bytes_ (derived_privkey, sizeof (*derived_privkey), 8, 1);
+ printf ("\n");
+ bdata_size = ntohl (rrblock->size) - sizeof (struct
+ GNUNET_GNSRECORD_Block);
+
+ GNUNET_free (derived_privkey);
+
+ bdata = (char*) &(&rrblock->ecdsa_block)[1];
+ printf ("BDATA:\n");
+ print_bytes (bdata, bdata_size, 8);
+ printf ("\n");
+ printf ("RRBLOCK:\n");
+ print_bytes (rrblock, ntohl (rrblock->size), 8);
+ printf ("\n");
+ GNUNET_free (rdata);
+ }
}
@@ -301,7 +302,7 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count,
const char*label)
id_priv.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key);
GNUNET_CRYPTO_key_get_public (&id_priv,
- &id_pub);
+ &id_pub);
id_priv.type = htonl (GNUNET_PUBLIC_KEY_TYPE_EDDSA);
GNUNET_CRYPTO_eddsa_key_create (&id_priv.eddsa_key);
@@ -309,7 +310,7 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count,
const char*label)
(char*) &id_priv.eddsa_key,
sizeof (id_priv.eddsa_key), 0);
GNUNET_CRYPTO_key_get_public (&id_priv,
- &id_pub);
+ &id_pub);
fprintf (stdout,
"Zone private key (d):\n");
print_bytes (&id_priv.eddsa_key, sizeof (struct
@@ -331,7 +332,7 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count,
const char*label)
pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_EDKEY);
GNUNET_CRYPTO_eddsa_key_create (&pkey_data_p.eddsa_key);
GNUNET_CRYPTO_key_get_public (&pkey_data_p,
- &pkey_data);
+ &pkey_data);
conv_lbl = GNUNET_GNSRECORD_string_normalize (label);
printf ("Label:\n");
print_bytes (conv_lbl, strlen (conv_lbl), 8);
@@ -387,41 +388,43 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int
rd_count, const char*label)
rd,
rd_count,
&rrblock));
-
- struct GNUNET_CRYPTO_EddsaPublicKey derived_key;
- struct GNUNET_CRYPTO_EddsaPrivateScalar derived_privkey;
- GNUNET_CRYPTO_eddsa_public_key_derive (&id_pub.eddsa_key,
- label,
- "gns",
- &derived_key);
- GNUNET_CRYPTO_eddsa_private_key_derive (&id_priv.eddsa_key,
- label,
- "gns", &derived_privkey);
- printf ("ZKDF(zkey):\n");
- print_bytes (&derived_key, sizeof (derived_key), 8);
- printf ("\n");
- printf ("nonce := SHA-256 (dh[32..63] || h):\n");
- print_bytes (derived_privkey.s + 32, 32, 8);
- printf ("\n");
- char derived_privkeyNBO[32];
- /* Convert from little endian */
- for (size_t i = 0; i < 32; i++)
- derived_privkeyNBO[i] = derived_privkey.s[31 - i];
- printf ("Derived private key (d', big-endian):\n");
- print_bytes (derived_privkeyNBO, sizeof (derived_privkeyNBO), 8);
- printf ("\n");
- size_t bdata_size = ntohl (rrblock->size) - sizeof (struct
- GNUNET_GNSRECORD_Block);
-
-
- bdata = (char*) &(&rrblock->eddsa_block)[1];
- printf ("BDATA:\n");
- print_bytes (bdata, bdata_size, 8);
- printf ("\n");
- printf ("RRBLOCK:\n");
- print_bytes (rrblock, ntohl (rrblock->size), 8);
- printf ("\n");
- GNUNET_free (rdata);
+ {
+ struct GNUNET_CRYPTO_EddsaPublicKey derived_key;
+ struct GNUNET_CRYPTO_EddsaPrivateScalar derived_privkey;
+ char derived_privkeyNBO[32];
+ size_t bdata_size;
+ GNUNET_CRYPTO_eddsa_public_key_derive (&id_pub.eddsa_key,
+ label,
+ "gns",
+ &derived_key);
+ GNUNET_CRYPTO_eddsa_private_key_derive (&id_priv.eddsa_key,
+ label,
+ "gns", &derived_privkey);
+ printf ("ZKDF(zkey):\n");
+ print_bytes (&derived_key, sizeof (derived_key), 8);
+ printf ("\n");
+ printf ("nonce := SHA-256 (dh[32..63] || h):\n");
+ print_bytes (derived_privkey.s + 32, 32, 8);
+ printf ("\n");
+ /* Convert from little endian */
+ for (size_t i = 0; i < 32; i++)
+ derived_privkeyNBO[i] = derived_privkey.s[31 - i];
+ printf ("Derived private key (d', big-endian):\n");
+ print_bytes (derived_privkeyNBO, sizeof (derived_privkeyNBO), 8);
+ printf ("\n");
+ bdata_size = ntohl (rrblock->size) - sizeof (struct
+ GNUNET_GNSRECORD_Block);
+
+
+ bdata = (char*) &(&rrblock->eddsa_block)[1];
+ printf ("BDATA:\n");
+ print_bytes (bdata, bdata_size, 8);
+ printf ("\n");
+ printf ("RRBLOCK:\n");
+ print_bytes (rrblock, ntohl (rrblock->size), 8);
+ printf ("\n");
+ GNUNET_free (rdata);
+ }
}
diff --git a/src/lib/gnsrecord/json_gnsrecord.c
b/src/lib/gnsrecord/json_gnsrecord.c
index 9ab831117..f8b5726bf 100644
--- a/src/lib/gnsrecord/json_gnsrecord.c
+++ b/src/lib/gnsrecord/json_gnsrecord.c
@@ -205,12 +205,14 @@ parse_record_data (struct GnsRecordInfo *gnsrecord_info,
json_t *data)
*(gnsrecord_info->rd_count) = json_array_size (data);
*(gnsrecord_info->rd) = GNUNET_malloc (sizeof(struct GNUNET_GNSRECORD_Data)
* json_array_size (data));
- size_t index;
- json_t *value;
- json_array_foreach (data, index, value)
{
- if (GNUNET_OK != parse_record (value, &(*(gnsrecord_info->rd))[index]))
- return GNUNET_SYSERR;
+ size_t index;
+ json_t *value;
+ json_array_foreach (data, index, value)
+ {
+ if (GNUNET_OK != parse_record (value, &(*(gnsrecord_info->rd))[index]))
+ return GNUNET_SYSERR;
+ }
}
return GNUNET_OK;
}
@@ -284,10 +286,6 @@ GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct
GNUNET_GNSRECORD_Data **rd,
char **name)
{
struct GnsRecordInfo *gnsrecord_info = GNUNET_new (struct GnsRecordInfo);
-
- gnsrecord_info->rd = rd;
- gnsrecord_info->name = name;
- gnsrecord_info->rd_count = rd_count;
struct GNUNET_JSON_Specification ret = { .parser = &parse_gnsrecordobject,
.cleaner = &clean_gnsrecordobject,
.cls = NULL,
@@ -296,6 +294,10 @@ GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct
GNUNET_GNSRECORD_Data **rd,
gnsrecord_info,
.ptr_size = 0,
.size_ptr = NULL };
+
+ gnsrecord_info->rd = rd;
+ gnsrecord_info->name = name;
+ gnsrecord_info->rd_count = rd_count;
return ret;
}
diff --git a/src/lib/gnsrecord/perf_gnsrecord_crypto.c
b/src/lib/gnsrecord/perf_gnsrecord_crypto.c
index 1f9a3d4d4..82f26a643 100644
--- a/src/lib/gnsrecord/perf_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/perf_gnsrecord_crypto.c
@@ -117,7 +117,7 @@ int
main (int argc, char *argv[])
{
static char *const argvx[] = {
- "perf-gnsrecord-crypto",
+ (char*) "perf-gnsrecord-crypto",
NULL
};
static struct GNUNET_GETOPT_CommandLineOption options[] = {
diff --git a/src/lib/gnsrecord/test_gnsrecord_crypto.c
b/src/lib/gnsrecord/test_gnsrecord_crypto.c
index 9849f6e43..5721350d4 100644
--- a/src/lib/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/test_gnsrecord_crypto.c
@@ -191,7 +191,7 @@ int
main (int argc, char *argv[])
{
static char *const argvx[] = {
- "test-gnsrecord-crypto",
+ (char*) "test-gnsrecord-crypto",
NULL
};
static struct GNUNET_GETOPT_CommandLineOption options[] = {
diff --git a/src/lib/gnsrecord/test_gnsrecord_serialization.c
b/src/lib/gnsrecord/test_gnsrecord_serialization.c
index b06b3a0fe..6e96dbb3a 100644
--- a/src/lib/gnsrecord/test_gnsrecord_serialization.c
+++ b/src/lib/gnsrecord/test_gnsrecord_serialization.c
@@ -59,76 +59,77 @@ run (void *cls,
res = 0;
len = GNUNET_GNSRECORD_records_get_size (rd_count, src);
- char rd_ser[len];
- GNUNET_assert (len ==
- GNUNET_GNSRECORD_records_serialize (rd_count,
- src,
- len,
- rd_ser));
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Serialized data len: %u\n",
- (unsigned int) len);
-
- GNUNET_assert (rd_ser != NULL);
{
- struct GNUNET_GNSRECORD_Data dst[rd_count];
- GNUNET_assert (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (len,
- rd_ser,
- rd_count,
- dst));
-
- GNUNET_assert (dst != NULL);
-
- for (c = 0; c < rd_count; c++)
+ char rd_ser[len];
+ GNUNET_assert (len ==
+ GNUNET_GNSRECORD_records_serialize (rd_count,
+ src,
+ len,
+ rd_ser));
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Serialized data len: %u\n",
+ (unsigned int) len);
+
+ GNUNET_assert (rd_ser != NULL);
{
- if (src[c].data_size != dst[c].data_size)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].expiration_time != dst[c].expiration_time)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].flags != dst[c].flags)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].record_type != dst[c].record_type)
- {
- GNUNET_break (0);
- res = 1;
- }
+ struct GNUNET_GNSRECORD_Data dst[rd_count];
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_GNSRECORD_records_deserialize (len,
+ rd_ser,
+ rd_count,
+ dst));
- {
- size_t data_size = src[c].data_size;
- char data[data_size];
+ GNUNET_assert (dst != NULL);
- memset (data, 'a', data_size);
- if (0 != memcmp (data, dst[c].data, data_size))
+ for (c = 0; c < rd_count; c++)
+ {
+ if (src[c].data_size != dst[c].data_size)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].expiration_time != dst[c].expiration_time)
{
GNUNET_break (0);
res = 1;
}
- if (0 != memcmp (data, src[c].data, data_size))
+ if (src[c].flags != dst[c].flags)
{
GNUNET_break (0);
res = 1;
}
- if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size))
+ if (src[c].record_type != dst[c].record_type)
{
GNUNET_break (0);
res = 1;
}
+
+ {
+ size_t data_size = src[c].data_size;
+ char data[data_size];
+
+ memset (data, 'a', data_size);
+ if (0 != memcmp (data, dst[c].data, data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (0 != memcmp (data, src[c].data, data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ }
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Element [%i]: EQUAL\n", c);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Element [%i]: EQUAL\n", c);
}
-
for (c = 0; c < rd_count; c++)
{
GNUNET_free_nz ((void *) src[c].data);
@@ -139,7 +140,7 @@ run (void *cls,
int
main (int argcx, char *argvx[])
{
- static char *const argv[] = { "test_gnsrecord_serialization",
+ static char *const argv[] = { (char*) "test_gnsrecord_serialization",
NULL };
static struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
diff --git a/src/lib/gnsrecord/test_gnsrecord_testvectors.c
b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
index 8ecaf39ee..177afd7b9 100644
--- a/src/lib/gnsrecord/test_gnsrecord_testvectors.c
+++ b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
@@ -1,6 +1,5 @@
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
#include <inttypes.h>
#include "gnsrecord_crypto.h"
@@ -659,21 +658,23 @@ main ()
res = 1;
break;
}
- int len = parsehex (tvs[i].rdata, (char*) rdata, 0, 0);
- tvs[i].expected_rd_count =
- GNUNET_GNSRECORD_records_deserialize_get_size (len,
- rdata);
- GNUNET_assert (tvs[i].expected_rd_count < 2048);
- if (GNUNET_OK !=
- GNUNET_GNSRECORD_records_deserialize (len,
- rdata,
- tvs[i].expected_rd_count,
- tvs[i].expected_rd))
{
- printf ("FAIL: Deserialization of RDATA failed\n");
- res = 1;
- GNUNET_free (rrblock);
- break;
+ int len = parsehex (tvs[i].rdata, (char*) rdata, 0, 0);
+ tvs[i].expected_rd_count =
+ GNUNET_GNSRECORD_records_deserialize_get_size (len,
+ rdata);
+ GNUNET_assert (tvs[i].expected_rd_count < 2048);
+ if (GNUNET_OK !=
+ GNUNET_GNSRECORD_records_deserialize (len,
+ rdata,
+ tvs[i].expected_rd_count,
+ tvs[i].expected_rd))
+ {
+ printf ("FAIL: Deserialization of RDATA failed\n");
+ res = 1;
+ GNUNET_free (rrblock);
+ break;
+ }
}
expire = GNUNET_GNSRECORD_record_get_expiration_time (
tvs[i].expected_rd_count,
diff --git a/src/lib/json/test_json_mhd.c b/src/lib/json/test_json_mhd.c
index 642715f25..1133b9b65 100644
--- a/src/lib/json/test_json_mhd.c
+++ b/src/lib/json/test_json_mhd.c
@@ -71,7 +71,7 @@ access_handler_cb (void *cls,
global_ret = 6;
}
json_decref (json);
- resp = MHD_create_response_from_buffer (3, "OK\n", MHD_RESPMEM_PERSISTENT);
+ resp = MHD_create_response_from_buffer (3, (void*) "OK\n",
MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, resp);
MHD_destroy_response (resp);
return ret;
diff --git a/src/lib/pq/pq_query_helper.c b/src/lib/pq/pq_query_helper.c
index a16b1b530..f4a1cc16c 100644
--- a/src/lib/pq/pq_query_helper.c
+++ b/src/lib/pq/pq_query_helper.c
@@ -28,7 +28,6 @@
#include "gnunet_time_lib.h"
#include "pq.h"
-
/**
* Function called to convert input argument into SQL parameters.
*
@@ -732,14 +731,14 @@ qconv_array (
same_sized = (0 != meta->same_size);
#define RETURN_UNLESS(cond) \
- do { \
- if (! (cond)) \
- { \
- GNUNET_break ((cond)); \
- noerror = false; \
- goto DONE; \
- } \
- } while (0)
+ do { \
+ if (! (cond)) \
+ { \
+ GNUNET_break ((cond)); \
+ noerror = false; \
+ goto DONE; \
+ } \
+ } while (0)
/* Calculate sizes and check bounds */
{
@@ -1764,6 +1763,7 @@ qconv_blinded_sig (void *cls,
return 1;
}
+
/**
* Generate query parameter for a blinded signature of variable size.
*
@@ -1782,4 +1782,5 @@ GNUNET_PQ_query_param_blinded_sig (
return res;
}
+
/* end of pq_query_helper.c */
diff --git a/src/lib/pq/pq_result_helper.c b/src/lib/pq/pq_result_helper.c
index c7d7f9abd..f81139cc3 100644
--- a/src/lib/pq/pq_result_helper.c
+++ b/src/lib/pq/pq_result_helper.c
@@ -1543,14 +1543,16 @@ GNUNET_PQ_result_spec_array_bool (
"bool",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1571,14 +1573,16 @@ GNUNET_PQ_result_spec_array_uint16 (
"int2",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1599,14 +1603,16 @@ GNUNET_PQ_result_spec_array_uint32 (
"int4",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1627,14 +1633,14 @@ GNUNET_PQ_result_spec_array_uint64 (
"int8",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;}
}
@@ -1655,14 +1661,14 @@ GNUNET_PQ_result_spec_array_abs_time (
"int8",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;}
}
@@ -1683,14 +1689,16 @@ GNUNET_PQ_result_spec_array_rel_time (
"int8",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1711,14 +1719,16 @@ GNUNET_PQ_result_spec_array_timestamp (
"int8",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1741,14 +1751,16 @@ GNUNET_PQ_result_spec_array_variable_size (
"bytea",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1771,14 +1783,16 @@ GNUNET_PQ_result_spec_array_fixed_size (
"bytea",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
@@ -1799,14 +1813,16 @@ GNUNET_PQ_result_spec_array_string (
"text",
&info->oid));
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) dst,
- .fname = name,
- .cls = info
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) dst,
+ .fname = name,
+ .cls = info
+ };
+ return res;
+ }
}
diff --git a/src/lib/pq/test_pq.c b/src/lib/pq/test_pq.c
index 813c4a019..472c248e7 100644
--- a/src/lib/pq/test_pq.c
+++ b/src/lib/pq/test_pq.c
@@ -56,7 +56,7 @@ static struct GNUNET_SCHEDULER_Task *tt;
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
static int
-postgres_prepare (struct GNUNET_PQ_Context *db)
+postgres_prepare (struct GNUNET_PQ_Context *db_)
{
struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("test_insert",
@@ -112,7 +112,7 @@ postgres_prepare (struct GNUNET_PQ_Context *db)
GNUNET_PQ_PREPARED_STATEMENT_END
};
- return GNUNET_PQ_prepare_statements (db,
+ return GNUNET_PQ_prepare_statements (db_,
ps);
}
@@ -124,7 +124,7 @@ postgres_prepare (struct GNUNET_PQ_Context *db)
* @return 0 on success
*/
static int
-run_queries (struct GNUNET_PQ_Context *db)
+run_queries (struct GNUNET_PQ_Context *db_)
{
struct GNUNET_CRYPTO_RsaPublicKey *pub;
struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL;
@@ -137,7 +137,7 @@ run_queries (struct GNUNET_PQ_Context *db)
struct GNUNET_HashCode hc;
struct GNUNET_HashCode hc2;
PGresult *result;
- int ret;
+ int lret;
struct GNUNET_CRYPTO_RsaPrivateKey *priv;
const char msg[] = "hello";
void *msg2;
@@ -191,18 +191,18 @@ run_queries (struct GNUNET_PQ_Context *db)
GNUNET_PQ_query_param_uint32 (&u32),
GNUNET_PQ_query_param_uint64 (&u64),
GNUNET_PQ_query_param_null (),
- GNUNET_PQ_query_param_array_bool (5, ab, db),
- GNUNET_PQ_query_param_array_uint16 (3, ai2, db),
- GNUNET_PQ_query_param_array_uint32 (3, ai4, db),
- GNUNET_PQ_query_param_array_uint64 (3, ai8, db),
+ GNUNET_PQ_query_param_array_bool (5, ab, db_),
+ GNUNET_PQ_query_param_array_uint16 (3, ai2, db_),
+ GNUNET_PQ_query_param_array_uint32 (3, ai4, db_),
+ GNUNET_PQ_query_param_array_uint64 (3, ai8, db_),
GNUNET_PQ_query_param_array_bytes_same_size (3,
ahc,
sizeof(ahc[0]),
- db),
- GNUNET_PQ_query_param_array_ptrs_string (3, as, db),
- GNUNET_PQ_query_param_array_abs_time (2, ata, db),
- GNUNET_PQ_query_param_array_rel_time (2, atr, db),
- GNUNET_PQ_query_param_array_timestamp (2, ats, db),
+ db_),
+ GNUNET_PQ_query_param_array_ptrs_string (3, as, db_),
+ GNUNET_PQ_query_param_array_abs_time (2, ata, db_),
+ GNUNET_PQ_query_param_array_rel_time (2, atr, db_),
+ GNUNET_PQ_query_param_array_timestamp (2, ats, db_),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_QueryParam params_select[] = {
@@ -243,51 +243,51 @@ run_queries (struct GNUNET_PQ_Context *db)
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_uint64 ("unn", &uzzz),
&got_null),
- GNUNET_PQ_result_spec_array_bool (db,
+ GNUNET_PQ_result_spec_array_bool (db_,
"arr_bool",
&num_bool,
&arr_bools),
- GNUNET_PQ_result_spec_array_uint16 (db,
+ GNUNET_PQ_result_spec_array_uint16 (db_,
"arr_int2",
&num_u16,
&arr_u16),
- GNUNET_PQ_result_spec_array_uint32 (db,
+ GNUNET_PQ_result_spec_array_uint32 (db_,
"arr_int4",
&num_u32,
&arr_u32),
- GNUNET_PQ_result_spec_array_uint64 (db,
+ GNUNET_PQ_result_spec_array_uint64 (db_,
"arr_int8",
&num_u64,
&arr_u64),
- GNUNET_PQ_result_spec_array_abs_time (db,
+ GNUNET_PQ_result_spec_array_abs_time (db_,
"arr_abs_time",
&num_abs,
&arr_abs),
- GNUNET_PQ_result_spec_array_rel_time (db,
+ GNUNET_PQ_result_spec_array_rel_time (db_,
"arr_rel_time",
&num_rel,
&arr_rel),
- GNUNET_PQ_result_spec_array_timestamp (db,
+ GNUNET_PQ_result_spec_array_timestamp (db_,
"arr_timestamp",
&num_tstmp,
&arr_tstmp),
- GNUNET_PQ_result_spec_auto_array_from_type (db,
+ GNUNET_PQ_result_spec_auto_array_from_type (db_,
"arr_bytea",
&num_hash,
arr_hash),
- GNUNET_PQ_result_spec_array_variable_size (db,
+ GNUNET_PQ_result_spec_array_variable_size (db_,
"arr_bytea",
&num_buf,
&sz_buf,
&arr_buf),
- GNUNET_PQ_result_spec_array_string (db,
+ GNUNET_PQ_result_spec_array_string (db_,
"arr_text",
&num_str,
&arr_str),
GNUNET_PQ_result_spec_end
};
- result = GNUNET_PQ_exec_prepared (db,
+ result = GNUNET_PQ_exec_prepared (db_,
"test_insert",
params_insert);
if (PGRES_COMMAND_OK != PQresultStatus (result))
@@ -303,7 +303,7 @@ run_queries (struct GNUNET_PQ_Context *db)
}
PQclear (result);
- result = GNUNET_PQ_exec_prepared (db,
+ result = GNUNET_PQ_exec_prepared (db_,
"test_select",
params_select);
if (1 !=
@@ -316,10 +316,10 @@ run_queries (struct GNUNET_PQ_Context *db)
GNUNET_CRYPTO_rsa_public_key_free (pub);
return 1;
}
- ret = GNUNET_PQ_extract_result (result,
+ lret = GNUNET_PQ_extract_result (result,
results_select,
0);
- GNUNET_break (GNUNET_YES == ret);
+ GNUNET_break (GNUNET_YES == lret);
GNUNET_break (abs_time.abs_value_us == abs_time2.abs_value_us);
GNUNET_break (forever.abs_value_us == forever2.abs_value_us);
GNUNET_break (0 ==
@@ -398,7 +398,7 @@ run_queries (struct GNUNET_PQ_Context *db)
GNUNET_CRYPTO_rsa_signature_free (sig);
GNUNET_CRYPTO_rsa_private_key_free (priv);
GNUNET_CRYPTO_rsa_public_key_free (pub);
- if (GNUNET_OK != ret)
+ if (GNUNET_OK != lret)
return 1;
return 0;
@@ -558,12 +558,12 @@ main (int argc,
/* ensure oid lookup works */
{
- enum GNUNET_GenericReturnValue ret;
+ enum GNUNET_GenericReturnValue lret;
Oid oid;
- ret = GNUNET_PQ_get_oid_by_name (db, "int8", &oid);
+ lret = GNUNET_PQ_get_oid_by_name (db, "int8", &oid);
- if (GNUNET_OK != ret)
+ if (GNUNET_OK != lret)
{
fprintf (stderr,
"Cannot lookup oid for int8: %s\n",
@@ -575,8 +575,8 @@ main (int argc,
PQexec (db->conn, "CREATE TYPE foo AS (foo int, bar int);");
- ret = GNUNET_PQ_get_oid_by_name (db, "foo", &oid);
- if (GNUNET_OK != ret)
+ lret = GNUNET_PQ_get_oid_by_name (db, "foo", &oid);
+ if (GNUNET_OK != lret)
{
fprintf (stderr,
"Cannot lookup oid for foo: %s\n",
@@ -607,14 +607,14 @@ main (int argc,
fprintf (stderr, "Result: %d (expect: 0)\n", ret);
#endif
{
- struct GNUNET_PQ_ExecuteStatement es[] = {
+ struct GNUNET_PQ_ExecuteStatement es_tmp[] = {
GNUNET_PQ_make_execute ("DROP TABLE test_pq"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
if (GNUNET_OK !=
GNUNET_PQ_exec_statements (db,
- es))
+ es_tmp))
{
fprintf (stderr,
"Failed to drop table\n");
diff --git a/src/lib/testing/gnunet-cmds-helper.c
b/src/lib/testing/gnunet-cmds-helper.c
index ed724615d..7b5021cf2 100644
--- a/src/lib/testing/gnunet-cmds-helper.c
+++ b/src/lib/testing/gnunet-cmds-helper.c
@@ -99,7 +99,7 @@ static char *plugin_name;
/**
* The loaded topology.
*/
- struct GNUNET_TESTING_NetjailTopology *njt;
+struct GNUNET_TESTING_NetjailTopology *njt;
/**
* Our message stream tokenizer
@@ -199,7 +199,6 @@ do_shutdown (void *cls)
}
-
/**
* Task to write to the standard out
*
@@ -328,7 +327,7 @@ handle_helper_init (
const struct GNUNET_TESTING_CommandHelperInit *msg)
{
uint16_t msize = ntohs (msg->header.size);
- //uint32_t barrier_count = GNUNET_ntohll (msg->barrier_count);
+ // uint32_t barrier_count = GNUNET_ntohll (msg->barrier_count);
uint32_t barrier_count = ntohl (msg->barrier_count);
size_t bs = barrier_count * sizeof (struct GNUNET_ShortHashCode);
size_t left = msize - bs - sizeof (*msg);
@@ -371,12 +370,14 @@ handle_helper_init (
GNUNET_SCHEDULER_shutdown ();
return;
}
- struct GNUNET_TESTING_Command *commands = plugin->cls;
+ {
+ struct GNUNET_TESTING_Command *commands = plugin->cls;
- for (unsigned int i = 0; NULL != commands[i].run; i++)
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "helper %s\n",
- commands[i].label.value);
+ for (unsigned int i = 0; NULL != commands[i].run; i++)
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "helper %s\n",
+ commands[i].label.value);
+ }
is = plugin->start_testcase (plugin->cls,
topo,
barrier_count,
diff --git a/src/lib/testing/testing_api_topology.c
b/src/lib/testing/testing_api_topology.c
index b2fd0f72b..4f7b0b12e 100644
--- a/src/lib/testing/testing_api_topology.c
+++ b/src/lib/testing/testing_api_topology.c
@@ -295,8 +295,8 @@ free_subnets_cb (void *cls,
const struct GNUNET_ShortHashCode *key,
void *value)
{
- (void) cls;
struct GNUNET_TESTING_NetjailSubnet *subnet = value;
+ (void) cls;
GNUNET_CONTAINER_multishortmap_iterate (subnet->peers,
&free_value_cb,
@@ -313,8 +313,8 @@ free_carriers_cb (void *cls,
const struct GNUNET_ShortHashCode *key,
void *value)
{
- (void) cls;
struct GNUNET_TESTING_NetjailCarrier *carrier = value;
+ (void) cls;
GNUNET_CONTAINER_multishortmap_iterate (carrier->peers,
&free_value_cb,
@@ -608,12 +608,12 @@ struct GNUNET_TESTING_NetjailTopology *
GNUNET_TESTING_get_topo_from_string_ (const char *input)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
+ struct GNUNET_HashCode hc;
struct GNUNET_TESTING_NetjailTopology *topology = GNUNET_new (struct
GNUNET_TESTING_NetjailTopology);
topology->backbone_peers = GNUNET_CONTAINER_multishortmap_create
(1,GNUNET_NO)
;
topology->carriers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
- struct GNUNET_HashCode hc;
cfg = GNUNET_CONFIGURATION_create ();
GNUNET_assert (NULL != topology->carriers);
diff --git a/src/lib/util/gnunet-elligator-tvg.c
b/src/lib/util/gnunet-elligator-tvg.c
index c31d371c8..587a75d60 100644
--- a/src/lib/util/gnunet-elligator-tvg.c
+++ b/src/lib/util/gnunet-elligator-tvg.c
@@ -78,21 +78,21 @@ main (int argc,
struct GNUNET_CRYPTO_EddsaPrivateKey skRm;
struct GNUNET_CRYPTO_EddsaPublicKey pkRm;
struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey skEm;
+ struct GNUNET_CRYPTO_EcdhePublicKey pkEm = {0};
+ struct GNUNET_CRYPTO_ElligatorRepresentative enc = {0}; // randomness
through seed
+ struct GNUNET_CRYPTO_EcdhePublicKey pkRmHpke = {0};
+ struct GNUNET_ShortHashCode key = {0};
memcpy (skRm.d, skRmBytes, sizeof(skRm.d));
memcpy (pkRm.q_y, pkRmBytes, sizeof(pkRm.q_y));
memcpy (skEm.d, skEmBytes, sizeof(skEm.d));
// compute special elligator public key "pkEm" and representative "enc"
deterministically
- struct GNUNET_CRYPTO_EcdhePublicKey pkEm = {0};
- struct GNUNET_CRYPTO_ElligatorRepresentative enc = {0}; // randomness
through seed
GNUNET_CRYPTO_ecdhe_elligator_key_get_public_norand (seed,
&skEm,
&pkEm,
&enc);
// compute "key" deterministically
- struct GNUNET_CRYPTO_EcdhePublicKey pkRmHpke = {0};
- struct GNUNET_ShortHashCode key = {0};
eddsa_pub_to_hpke_key (&pkRm, &pkRmHpke);
GNUNET_CRYPTO_hpke_elligator_kem_encaps_norand (seed,
&pkRmHpke,
diff --git a/src/lib/util/perf_mq.c b/src/lib/util/perf_mq.c
index 32ecf8ccc..45422fc2a 100644
--- a/src/lib/util/perf_mq.c
+++ b/src/lib/util/perf_mq.c
@@ -254,9 +254,9 @@ main (int argc, char **argv)
{
struct GNUNET_TIME_Absolute start;
char *test_argv[] = {
- (char *) "test_client",
- "-c",
- "test_client_data.conf",
+ (char*) "test_client",
+ (char*) "-c",
+ (char*) "test_client_data.conf",
NULL
};
struct GNUNET_MQ_MessageHandler mh[] = {
diff --git a/src/lib/util/test_child_management.c
b/src/lib/util/test_child_management.c
index 90cc74c72..01ec4ffa8 100644
--- a/src/lib/util/test_child_management.c
+++ b/src/lib/util/test_child_management.c
@@ -40,13 +40,13 @@ child_completed_callback (void *cls,
enum GNUNET_OS_ProcessStatusType type,
long unsigned int exit_code)
{
+ FILE *file;
+ char code[9];
+
cwh = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Process extided with code: %lu \n",
exit_code);
- FILE *file;
- char code[9];
-
file = fopen ("child_management_test.txt", "r");
if (NULL == file)
{
diff --git a/src/lib/util/test_crypto_ecc_dlog.c
b/src/lib/util/test_crypto_ecc_dlog.c
index c3382a4fa..a3552b1b6 100644
--- a/src/lib/util/test_crypto_ecc_dlog.c
+++ b/src/lib/util/test_crypto_ecc_dlog.c
@@ -173,14 +173,16 @@ test_math (struct GNUNET_CRYPTO_EccDlogContext *edc)
GNUNET_CRYPTO_ecc_add (&ip, &r, &ir);
GNUNET_CRYPTO_ecc_add (&ir, &jp, &irj);
GNUNET_CRYPTO_ecc_add (&irj, &r_inv, &sum);
- int res = GNUNET_CRYPTO_ecc_dlog (edc, &sum);
- if (i + j != res)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Got %d, expected %d\n",
- res,
- i + j);
- // GNUNET_assert (0);
+ int res = GNUNET_CRYPTO_ecc_dlog (edc, &sum);
+ if (i + j != res)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Got %d, expected %d\n",
+ res,
+ i + j);
+ // GNUNET_assert (0);
+ }
}
}
}
diff --git a/src/lib/util/test_crypto_elligator.c
b/src/lib/util/test_crypto_elligator.c
index d19e4b665..445b4d999 100644
--- a/src/lib/util/test_crypto_elligator.c
+++ b/src/lib/util/test_crypto_elligator.c
@@ -32,13 +32,10 @@ testDirectMap (void)
struct GNUNET_CRYPTO_ElligatorRepresentative representative = {0};
memcpy (&representative.r, &repr1, sizeof(repr1));
- bool highYResult;
-
GNUNET_CRYPTO_ecdhe_elligator_decoding (
&pointResult,
- &highYResult,
+ NULL,
&representative);
-
if (memcmp (point1, pointResult.q_y, sizeof(point1)) != 0)
{
ok = GNUNET_SYSERR;
@@ -72,9 +69,8 @@ testInverseMap (void)
struct GNUNET_CRYPTO_EcdhePublicKey pub = {0};
memcpy (&pub.q_y,&point1,sizeof(point1));
- bool success = GNUNET_CRYPTO_ecdhe_elligator_encoding (0,&r,
- &pub);
- if (success == false)
+ if (! GNUNET_CRYPTO_ecdhe_elligator_encoding (0,&r,
+ &pub))
{
ok = GNUNET_SYSERR;
}
@@ -94,11 +90,12 @@ static int
testGeneratePkScalarMult (void)
{
struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey pk;
- GNUNET_CRYPTO_ecdhe_elligator_key_create (&pk);
struct GNUNET_CRYPTO_EcdhePublicKey pubWholeCurve = {0};
struct GNUNET_CRYPTO_ElligatorRepresentative repr;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey clampedPk;
unsigned char pubPrimeCurve[crypto_scalarmult_SCALARBYTES];
+ GNUNET_CRYPTO_ecdhe_elligator_key_create (&pk);
if (GNUNET_CRYPTO_ecdhe_elligator_key_get_public (&pk,
&pubWholeCurve,
&repr) == -1)
@@ -107,7 +104,6 @@ testGeneratePkScalarMult (void)
}
crypto_scalarmult_base (pubPrimeCurve, pk.d);
- struct GNUNET_CRYPTO_EcdsaPrivateKey clampedPk;
GNUNET_CRYPTO_ecdsa_key_create (&clampedPk);
crypto_scalarmult_base (pubWholeCurve.q_y, clampedPk.d);
crypto_scalarmult_base (pubPrimeCurve, clampedPk.d);
@@ -129,9 +125,9 @@ testInverseDirect (void)
struct GNUNET_CRYPTO_ElligatorRepresentative repr;
struct GNUNET_CRYPTO_EcdhePublicKey point;
struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey pk;
+ struct GNUNET_CRYPTO_EcdhePublicKey pub = {0};
GNUNET_CRYPTO_ecdhe_elligator_key_create (&pk);
- struct GNUNET_CRYPTO_EcdhePublicKey pub = {0};
if (GNUNET_CRYPTO_ecdhe_elligator_key_get_public (&pk, &pub,
&repr) == -1)
{
@@ -222,23 +218,23 @@ elligatorKEM ()
struct GNUNET_CRYPTO_EcdhePrivateKey pk_receiver_hpke;
struct GNUNET_CRYPTO_PublicKey pub_receiver;
struct GNUNET_CRYPTO_EcdhePublicKey pub_receiver_hpke;
+ struct GNUNET_CRYPTO_HpkeEncapsulation c_sender;
+ struct GNUNET_ShortHashCode key_material_encaps;
+ struct GNUNET_ShortHashCode key_material_decaps;
pk_receiver.type = htonl (GNUNET_PUBLIC_KEY_TYPE_EDDSA);
pub_receiver.type = htonl (GNUNET_PUBLIC_KEY_TYPE_EDDSA);
GNUNET_CRYPTO_eddsa_key_create (&pk_receiver.eddsa_key);
GNUNET_CRYPTO_eddsa_key_get_public (&pk_receiver.eddsa_key,
&pub_receiver.eddsa_key);
- struct GNUNET_CRYPTO_HpkeEncapsulation c_sender;
GNUNET_CRYPTO_hpke_sk_to_x25519 (&pk_receiver, &pk_receiver_hpke);
GNUNET_CRYPTO_hpke_pk_to_x25519 (&pub_receiver, &pub_receiver_hpke);
// Sender side
- struct GNUNET_ShortHashCode key_material_encaps;
GNUNET_CRYPTO_hpke_elligator_kem_encaps (&pub_receiver_hpke, &c_sender,
&key_material_encaps);
// Receiving side
- struct GNUNET_ShortHashCode key_material_decaps;
GNUNET_CRYPTO_hpke_elligator_kem_decaps (&pk_receiver_hpke, &c_sender,
&key_material_decaps);
diff --git a/src/lib/util/test_crypto_rsa.c b/src/lib/util/test_crypto_rsa.c
index c513a68fe..36920ee7b 100644
--- a/src/lib/util/test_crypto_rsa.c
+++ b/src/lib/util/test_crypto_rsa.c
@@ -64,44 +64,47 @@ main (int argc,
priv_copy));
pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv);
- /* Encoding */
- size_t size;
- void *enc;
- enc = NULL;
- size = GNUNET_CRYPTO_rsa_private_key_encode (priv,
- &enc);
-
- /* Decoding */
- GNUNET_CRYPTO_rsa_private_key_free (priv);
- priv = NULL;
- priv = GNUNET_CRYPTO_rsa_private_key_decode (enc,
- size);
- GNUNET_assert (NULL != priv);
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- enc,
- size);
- GNUNET_assert (NULL ==
- GNUNET_CRYPTO_rsa_private_key_decode (enc,
- size));
- (void) fprintf (stderr,
- "The above warning is expected.\n");
- GNUNET_free (enc);
-
- /* try ordinary sig first */
- sig = GNUNET_CRYPTO_rsa_sign_fdh (priv,
- &hash,
- sizeof (hash));
- sig_copy = GNUNET_CRYPTO_rsa_signature_dup (sig);
- GNUNET_assert (NULL != sig);
- GNUNET_assert (0 == GNUNET_CRYPTO_rsa_signature_cmp (sig,
- sig_copy));
- pub_copy = GNUNET_CRYPTO_rsa_public_key_dup (pub);
- GNUNET_assert (NULL != pub_copy);
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_rsa_verify (&hash,
- sizeof (hash),
- sig,
- pub_copy));
+ {
+ /* Encoding */
+ size_t size;
+ void *enc;
+ enc = NULL;
+ size = GNUNET_CRYPTO_rsa_private_key_encode (priv,
+ &enc);
+
+ /* Decoding */
+ GNUNET_CRYPTO_rsa_private_key_free (priv);
+ priv = NULL;
+ priv = GNUNET_CRYPTO_rsa_private_key_decode (enc,
+ size);
+ GNUNET_assert (NULL != priv);
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ enc,
+ size);
+ GNUNET_assert (NULL ==
+ GNUNET_CRYPTO_rsa_private_key_decode (enc,
+ size));
+ (void) fprintf (stderr,
+ "The above warning is expected.\n");
+ GNUNET_free (enc);
+
+ /* try ordinary sig first */
+ sig = GNUNET_CRYPTO_rsa_sign_fdh (priv,
+ &hash,
+ sizeof (hash));
+ sig_copy = GNUNET_CRYPTO_rsa_signature_dup (sig);
+ GNUNET_assert (NULL != sig);
+ GNUNET_assert (0 == GNUNET_CRYPTO_rsa_signature_cmp (sig,
+ sig_copy));
+ pub_copy = GNUNET_CRYPTO_rsa_public_key_dup (pub);
+ GNUNET_assert (NULL != pub_copy);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CRYPTO_rsa_verify (&hash,
+ sizeof (hash),
+ sig,
+ pub_copy));
+ }
+
{
void *buf;
size_t buf_size;
@@ -143,15 +146,17 @@ main (int argc,
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&bsec,
sizeof(bsec));
- struct GNUNET_CRYPTO_RsaBlindedMessage bm;
- GNUNET_CRYPTO_rsa_blind (&hash,
- sizeof (hash),
- &bsec,
- pub,
- &bm);
- bsig = GNUNET_CRYPTO_rsa_sign_blinded (priv,
- &bm);
- GNUNET_CRYPTO_rsa_blinded_message_free (&bm);
+ {
+ struct GNUNET_CRYPTO_RsaBlindedMessage bm;
+ GNUNET_CRYPTO_rsa_blind (&hash,
+ sizeof (hash),
+ &bsec,
+ pub,
+ &bm);
+ bsig = GNUNET_CRYPTO_rsa_sign_blinded (priv,
+ &bm);
+ GNUNET_CRYPTO_rsa_blinded_message_free (&bm);
+ }
sig = GNUNET_CRYPTO_rsa_unblind (bsig,
&bsec,
pub);
diff --git a/src/plugin/datastore/plugin_datastore_postgres.c
b/src/plugin/datastore/plugin_datastore_postgres.c
index 5fcacc17b..5b4a1f9c9 100644
--- a/src/plugin/datastore/plugin_datastore_postgres.c
+++ b/src/plugin/datastore/plugin_datastore_postgres.c
@@ -238,8 +238,7 @@ postgres_plugin_put (void *cls,
_ ("Postgresql exec failure"));
return;
}
- bool affected = (0 != ret);
- if (affected)
+ if (0 != ret)
{
cont (cont_cls,
key,
@@ -873,6 +872,9 @@ postgres_plugin_remove_key (void *cls,
}
+void *
+libgnunet_plugin_datastore_postgres_init (void *cls);
+
/**
* Entry point for the plugin.
*
@@ -908,6 +910,9 @@ libgnunet_plugin_datastore_postgres_init (void *cls)
}
+void *
+libgnunet_plugin_datastore_postgres_done (void *cls);
+
/**
* Exit point from the plugin.
*
diff --git a/src/plugin/datastore/plugin_datastore_sqlite.c
b/src/plugin/datastore/plugin_datastore_sqlite.c
index cd1b88993..cc2ac53d1 100644
--- a/src/plugin/datastore/plugin_datastore_sqlite.c
+++ b/src/plugin/datastore/plugin_datastore_sqlite.c
@@ -56,16 +56,16 @@
* with the message given by strerror(errno).
*/
#define LOG_SQLITE(db, level, cmd) \
- do \
- { \
- GNUNET_log_from (level, \
- "sqlite", \
- _ ("`%s' failed at %s:%d with error: %s\n"), \
- cmd, \
- __FILE__, \
- __LINE__, \
- sqlite3_errmsg (db->dbh)); \
- } while (0)
+ do \
+ { \
+ GNUNET_log_from (level, \
+ "sqlite", \
+ _ ("`%s' failed at %s:%d with error: %s\n"), \
+ cmd, \
+ __FILE__, \
+ __LINE__, \
+ sqlite3_errmsg (db->dbh)); \
+ } while (0)
/**
@@ -74,22 +74,22 @@
* with the message given by strerror(errno).
*/
#define LOG_SQLITE_MSG(db, msg, level, cmd) \
- do \
- { \
- GNUNET_log_from (level, \
- "sqlite", \
- _ ("`%s' failed at %s:%d with error: %s\n"), \
- cmd, \
- __FILE__, \
- __LINE__, \
- sqlite3_errmsg (db->dbh)); \
- GNUNET_asprintf (msg, \
- _ ("`%s' failed at %s:%u with error: %s"), \
- cmd, \
- __FILE__, \
- __LINE__, \
- sqlite3_errmsg (db->dbh)); \
- } while (0)
+ do \
+ { \
+ GNUNET_log_from (level, \
+ "sqlite", \
+ _ ("`%s' failed at %s:%d with error: %s\n"), \
+ cmd, \
+ __FILE__, \
+ __LINE__, \
+ sqlite3_errmsg (db->dbh)); \
+ GNUNET_asprintf (msg, \
+ _ ("`%s' failed at %s:%u with error: %s"), \
+ cmd, \
+ __FILE__, \
+ __LINE__, \
+ sqlite3_errmsg (db->dbh)); \
+ } while (0)
/**
@@ -249,12 +249,12 @@ create_indices (sqlite3 *dbh)
#define ENULL &e
#define ENULL_DEFINED 1
#define CHECK(a) \
- if (! (a)) \
- { \
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", e); \
- sqlite3_free (e); \
- e = NULL; \
- }
+ if (! (a)) \
+ { \
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", e); \
+ sqlite3_free (e); \
+ e = NULL; \
+ }
#endif
@@ -374,7 +374,7 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle
*cfg,
create_indices (plugin->dbh);
#define RESULT_COLUMNS \
- "repl, type, prio, anonLevel, expire, hash, value, _ROWID_"
+ "repl, type, prio, anonLevel, expire, hash, value, _ROWID_"
if (
(SQLITE_OK != sq_prepare (plugin->dbh,
"UPDATE gn091 "
@@ -644,93 +644,99 @@ sqlite_plugin_put (void *cls,
GNUNET_free (msg);
return;
}
- int changes = sqlite3_changes (plugin->dbh);
- GNUNET_SQ_reset (plugin->dbh, plugin->update);
- if (0 != changes)
{
- cont (cont_cls, key, size, GNUNET_NO, NULL);
- return;
+ int changes = sqlite3_changes (plugin->dbh);
+ GNUNET_SQ_reset (plugin->dbh, plugin->update);
+ if (0 != changes)
+ {
+ cont (cont_cls, key, size, GNUNET_NO, NULL);
+ return;
+ }
}
}
- uint64_t rvalue;
- uint32_t type32 = (uint32_t) type;
- struct GNUNET_SQ_QueryParam params[] =
- { GNUNET_SQ_query_param_uint32 (&replication),
- GNUNET_SQ_query_param_uint32 (&type32),
- GNUNET_SQ_query_param_uint32 (&priority),
- GNUNET_SQ_query_param_uint32 (&anonymity),
- GNUNET_SQ_query_param_absolute_time (&expiration),
- GNUNET_SQ_query_param_uint64 (&rvalue),
- GNUNET_SQ_query_param_auto_from_type (key),
- GNUNET_SQ_query_param_auto_from_type (&vhash),
- GNUNET_SQ_query_param_fixed_size (data, size),
- GNUNET_SQ_query_param_end };
- int n;
- int ret;
- sqlite3_stmt *stmt;
-
- if (size > MAX_ITEM_SIZE)
{
- cont (cont_cls, key, size, GNUNET_SYSERR, _ ("Data too large"));
- return;
- }
- GNUNET_log_from (
- GNUNET_ERROR_TYPE_DEBUG,
- "sqlite",
- "Storing in database block with type %u/key `%s'/priority %u/expiration in
%s (%s).\n",
- type,
- GNUNET_h2s (key),
- priority,
- GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining
(
- expiration),
- GNUNET_YES),
- GNUNET_STRINGS_absolute_time_to_string (expiration));
- stmt = plugin->insertContent;
- rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
- if (GNUNET_OK != GNUNET_SQ_bind (stmt, params))
- {
- cont (cont_cls, key, size, GNUNET_SYSERR, NULL);
- return;
- }
- n = sqlite3_step (stmt);
- switch (n)
- {
- case SQLITE_DONE:
- if (NULL != plugin->env->duc)
- plugin->env->duc (plugin->env->cls,
- size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
- "sqlite",
- "Stored new entry (%u bytes)\n",
- size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
- ret = GNUNET_OK;
- break;
+ // FIXME Refactor?
+ uint64_t rvalue;
+ uint32_t type32 = (uint32_t) type;
+ struct GNUNET_SQ_QueryParam params[] =
+ { GNUNET_SQ_query_param_uint32 (&replication),
+ GNUNET_SQ_query_param_uint32 (&type32),
+ GNUNET_SQ_query_param_uint32 (&priority),
+ GNUNET_SQ_query_param_uint32 (&anonymity),
+ GNUNET_SQ_query_param_absolute_time (&expiration),
+ GNUNET_SQ_query_param_uint64 (&rvalue),
+ GNUNET_SQ_query_param_auto_from_type (key),
+ GNUNET_SQ_query_param_auto_from_type (&vhash),
+ GNUNET_SQ_query_param_fixed_size (data, size),
+ GNUNET_SQ_query_param_end };
+ int n;
+ int ret;
+ sqlite3_stmt *stmt;
- case SQLITE_BUSY:
- GNUNET_break (0);
- LOG_SQLITE_MSG (plugin,
- &msg,
- GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_step");
- ret = GNUNET_SYSERR;
- break;
+ if (size > MAX_ITEM_SIZE)
+ {
+ cont (cont_cls, key, size, GNUNET_SYSERR, _ ("Data too large"));
+ return;
+ }
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_DEBUG,
+ "sqlite",
+ "Storing in database block with type %u/key `%s'/priority %u/expiration
in %s (%s).\n",
+ type,
+ GNUNET_h2s (key),
+ priority,
+ GNUNET_STRINGS_relative_time_to_string
(GNUNET_TIME_absolute_get_remaining
+ (
+ expiration),
+ GNUNET_YES),
+ GNUNET_STRINGS_absolute_time_to_string (expiration));
+ stmt = plugin->insertContent;
+ rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
+ if (GNUNET_OK != GNUNET_SQ_bind (stmt, params))
+ {
+ cont (cont_cls, key, size, GNUNET_SYSERR, NULL);
+ return;
+ }
+ n = sqlite3_step (stmt);
+ switch (n)
+ {
+ case SQLITE_DONE:
+ if (NULL != plugin->env->duc)
+ plugin->env->duc (plugin->env->cls,
+ size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "sqlite",
+ "Stored new entry (%u bytes)\n",
+ size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
+ ret = GNUNET_OK;
+ break;
- default:
- LOG_SQLITE_MSG (plugin,
- &msg,
- GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_step");
+ case SQLITE_BUSY:
+ GNUNET_break (0);
+ LOG_SQLITE_MSG (plugin,
+ &msg,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "sqlite3_step");
+ ret = GNUNET_SYSERR;
+ break;
+
+ default:
+ LOG_SQLITE_MSG (plugin,
+ &msg,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "sqlite3_step");
+ GNUNET_SQ_reset (plugin->dbh, stmt);
+ database_shutdown (plugin);
+ database_setup (plugin->env->cfg, plugin);
+ cont (cont_cls, key, size, GNUNET_SYSERR, msg);
+ GNUNET_free (msg);
+ return;
+ }
GNUNET_SQ_reset (plugin->dbh, stmt);
- database_shutdown (plugin);
- database_setup (plugin->env->cfg, plugin);
- cont (cont_cls, key, size, GNUNET_SYSERR, msg);
+ cont (cont_cls, key, size, ret, msg);
GNUNET_free (msg);
- return;
}
- GNUNET_SQ_reset (plugin->dbh, stmt);
- cont (cont_cls, key, size, ret, msg);
- GNUNET_free (msg);
}
@@ -1209,12 +1215,14 @@ sqlite_plugin_remove_key (void *cls,
cont (cont_cls, key, size, GNUNET_SYSERR, "sqlite3_step failed");
return;
}
- int changes = sqlite3_changes (plugin->dbh);
- GNUNET_SQ_reset (plugin->dbh, plugin->remove);
- if (0 == changes)
{
- cont (cont_cls, key, size, GNUNET_NO, NULL);
- return;
+ int changes = sqlite3_changes (plugin->dbh);
+ GNUNET_SQ_reset (plugin->dbh, plugin->remove);
+ if (0 == changes)
+ {
+ cont (cont_cls, key, size, GNUNET_NO, NULL);
+ return;
+ }
}
if (NULL != plugin->env->duc)
plugin->env->duc (plugin->env->cls,
@@ -1264,7 +1272,7 @@ sqlite_plugin_estimate_size (void *cls, unsigned long
long *estimate)
GNUNET_log_from (
GNUNET_ERROR_TYPE_WARNING,
"datastore-sqlite",
- _("error preparing statement\n"));
+ _ ("error preparing statement\n"));
return;
}
if (SQLITE_ROW == sqlite3_step (stmt))
@@ -1277,7 +1285,7 @@ sqlite_plugin_estimate_size (void *cls, unsigned long
long *estimate)
GNUNET_log_from (
GNUNET_ERROR_TYPE_WARNING,
"datastore-sqlite",
- _("error preparing statement\n"));
+ _ ("error preparing statement\n"));
return;
}
if (SQLITE_ROW != sqlite3_step (stmt))
@@ -1285,7 +1293,7 @@ sqlite_plugin_estimate_size (void *cls, unsigned long
long *estimate)
GNUNET_log_from (
GNUNET_ERROR_TYPE_WARNING,
"datastore-sqlite",
- _("error stepping\n"));
+ _ ("error stepping\n"));
return;
}
page_size = sqlite3_column_int64 (stmt, 0);
@@ -1299,6 +1307,7 @@ sqlite_plugin_estimate_size (void *cls, unsigned long
long *estimate)
*estimate = pages * page_size;
}
+
void *
libgnunet_plugin_datastore_sqlite_init (void *cls);
@@ -1341,6 +1350,7 @@ libgnunet_plugin_datastore_sqlite_init (void *cls)
return api;
}
+
void *
libgnunet_plugin_datastore_sqlite_done (void *cls);
diff --git a/src/plugin/datastore/test_plugin_datastore.c
b/src/plugin/datastore/test_plugin_datastore.c
index e5785bf3d..6185f1089 100644
--- a/src/plugin/datastore/test_plugin_datastore.c
+++ b/src/plugin/datastore/test_plugin_datastore.c
@@ -25,9 +25,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_protocols.h"
#include "gnunet_datastore_plugin.h"
-#include "gnunet_testing_lib.h"
/**
* Number of put operations to perform.
@@ -447,8 +445,8 @@ main (int argc, char *argv[])
char dir_name[PATH_MAX];
char cfg_name[PATH_MAX];
char *const xargv[] = {
- "test-plugin-datastore",
- "-c",
+ (char*) "test-plugin-datastore",
+ (char*) "-c",
cfg_name,
NULL
};
diff --git a/src/plugin/gnsrecord/plugin_gnsrecord_dns.c
b/src/plugin/gnsrecord/plugin_gnsrecord_dns.c
index 2ca4a8f39..bb7f9359d 100644
--- a/src/plugin/gnsrecord/plugin_gnsrecord_dns.c
+++ b/src/plugin/gnsrecord/plugin_gnsrecord_dns.c
@@ -452,7 +452,8 @@ dns_string_to_value (void *cls,
typep = strtok (sdup, " ");
if ((NULL == typep) ||
((0 == (cert_rrtype = rfc4398_mnemonic_to_value (typep))) &&
- ((1 != sscanf (typep, "%u", &cert_rrtype)) || (cert_rrtype >
UINT16_MAX))))
+ ((1 != sscanf (typep, "%u", &cert_rrtype)) || (cert_rrtype >
+ UINT16_MAX))))
{
GNUNET_free (sdup);
return GNUNET_SYSERR;
@@ -681,20 +682,23 @@ dns_string_to_value (void *cls,
target);
return GNUNET_SYSERR;
}
-
- char uribuf[sizeof(struct GNUNET_TUN_DnsUriRecord) + strlen (target) +
1];
-
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_builder_add_uri (uribuf, sizeof(uribuf), &off,
&uri))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to serialize URI record with target `%s'\n"),
- target);
- return GNUNET_SYSERR;
+ char uribuf[sizeof(struct GNUNET_TUN_DnsUriRecord) + strlen (target) +
1
+ ];
+
+ if (GNUNET_OK !=
+ GNUNET_DNSPARSER_builder_add_uri (uribuf, sizeof(uribuf), &off,
&uri
+ ))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to serialize URI record with target `%s'\n"),
+ target);
+ return GNUNET_SYSERR;
+ }
+ *data_size = off;
+ *data = GNUNET_malloc (off);
+ GNUNET_memcpy (*data, uribuf, off);
}
- *data_size = off;
- *data = GNUNET_malloc (off);
- GNUNET_memcpy (*data, uribuf, off);
return GNUNET_OK;
}
@@ -852,6 +856,7 @@ dns_is_critical (void *cls, uint32_t type)
return GNUNET_NO;
}
+
void *
libgnunet_plugin_gnsrecord_dns_init (void *cls);
@@ -875,6 +880,7 @@ libgnunet_plugin_gnsrecord_dns_init (void *cls)
return api;
}
+
void *
libgnunet_plugin_gnsrecord_dns_done (void *cls);
diff --git a/src/plugin/namecache/plugin_namecache_postgres.c
b/src/plugin/namecache/plugin_namecache_postgres.c
index 14c6ecf56..9081e2f72 100644
--- a/src/plugin/namecache/plugin_namecache_postgres.c
+++ b/src/plugin/namecache/plugin_namecache_postgres.c
@@ -25,7 +25,6 @@
*/
#include "platform.h"
#include "gnunet_namecache_plugin.h"
-#include "gnunet_namecache_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_pq_lib.h"
@@ -151,8 +150,7 @@ namecache_postgres_cache_block (void *cls,
struct Plugin *plugin = cls;
struct GNUNET_HashCode query;
size_t block_size = GNUNET_GNSRECORD_block_get_size (block);
- struct GNUNET_TIME_Absolute exp;
- exp = GNUNET_GNSRECORD_block_get_expiration (block);
+ struct GNUNET_TIME_Absolute exp = GNUNET_GNSRECORD_block_get_expiration
(block);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&query),
GNUNET_PQ_query_param_fixed_size (block, block_size),
diff --git a/src/plugin/namecache/plugin_namecache_sqlite.c
b/src/plugin/namecache/plugin_namecache_sqlite.c
index 0392cc630..e159ca8f0 100644
--- a/src/plugin/namecache/plugin_namecache_sqlite.c
+++ b/src/plugin/namecache/plugin_namecache_sqlite.c
@@ -26,7 +26,6 @@
#include "platform.h"
#include "gnunet_sq_lib.h"
#include "gnunet_namecache_plugin.h"
-#include "gnunet_namecache_service.h"
#include "gnunet_gnsrecord_lib.h"
#include <sqlite3.h>
@@ -271,8 +270,7 @@ database_shutdown (struct Plugin *plugin)
static void
namecache_sqlite_expire_blocks (struct Plugin *plugin)
{
- struct GNUNET_TIME_Absolute now;
- now = GNUNET_TIME_absolute_get ();
+ struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
struct GNUNET_SQ_QueryParam params[] = {
GNUNET_SQ_query_param_absolute_time (&now),
GNUNET_SQ_query_param_end
diff --git a/src/plugin/namestore/plugin_namestore_postgres.c
b/src/plugin/namestore/plugin_namestore_postgres.c
index ab09aafcd..f79337ce2 100644
--- a/src/plugin/namestore/plugin_namestore_postgres.c
+++ b/src/plugin/namestore/plugin_namestore_postgres.c
@@ -470,7 +470,6 @@ namestore_postgres_lookup_records (void *cls,
void *iter_cls)
{
struct Plugin *plugin = cls;
- GNUNET_assert (GNUNET_OK == database_prepare (plugin));
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (zone),
GNUNET_PQ_query_param_string (label),
@@ -478,6 +477,7 @@ namestore_postgres_lookup_records (void *cls,
};
struct ParserContext pc;
enum GNUNET_DB_QueryStatus res;
+ GNUNET_assert (GNUNET_OK == database_prepare (plugin));
if (NULL == zone)
{
@@ -566,7 +566,6 @@ namestore_postgres_edit_records (void *cls,
void *iter_cls)
{
struct Plugin *plugin = cls;
- GNUNET_assert (GNUNET_OK == database_prepare (plugin));
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (zone),
GNUNET_PQ_query_param_string (label),
@@ -575,6 +574,7 @@ namestore_postgres_edit_records (void *cls,
};
struct ParserContext pc;
enum GNUNET_DB_QueryStatus res;
+ GNUNET_assert (GNUNET_OK == database_prepare (plugin));
if (NULL == zone)
{
@@ -687,7 +687,6 @@ namestore_postgres_zone_to_name (void *cls,
void *iter_cls)
{
struct Plugin *plugin = cls;
- GNUNET_assert (GNUNET_OK == database_prepare (plugin));
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (zone),
GNUNET_PQ_query_param_auto_from_type (value_zone),
@@ -695,6 +694,7 @@ namestore_postgres_zone_to_name (void *cls,
};
enum GNUNET_DB_QueryStatus res;
struct ParserContext pc;
+ GNUNET_assert (GNUNET_OK == database_prepare (plugin));
pc.iter = iter;
pc.iter_cls = iter_cls;
@@ -709,6 +709,7 @@ namestore_postgres_zone_to_name (void *cls,
return GNUNET_OK;
}
+
/**
*
* @param cls closure (internal context for the plugin)
@@ -725,9 +726,10 @@ namestore_postgres_begin_tx (void *cls)
GNUNET_PQ_EXECUTE_STATEMENT_END
};
GNUNET_assert (GNUNET_OK == database_prepare (plugin));
- return GNUNET_PQ_exec_statements(plugin->dbh, ess);
+ return GNUNET_PQ_exec_statements (plugin->dbh, ess);
}
+
/**
*
* @param cls closure (internal context for the plugin)
@@ -744,9 +746,10 @@ namestore_postgres_commit_tx (void *cls)
GNUNET_PQ_EXECUTE_STATEMENT_END
};
GNUNET_assert (GNUNET_OK == database_prepare (plugin));
- return GNUNET_PQ_exec_statements(plugin->dbh, ess);
+ return GNUNET_PQ_exec_statements (plugin->dbh, ess);
}
+
/**
*
* @param cls closure (internal context for the plugin)
@@ -763,9 +766,10 @@ namestore_postgres_rollback_tx (void *cls)
GNUNET_PQ_EXECUTE_STATEMENT_END
};
GNUNET_assert (GNUNET_OK == database_prepare (plugin));
- return GNUNET_PQ_exec_statements(plugin->dbh, ess);
+ return GNUNET_PQ_exec_statements (plugin->dbh, ess);
}
+
/**
* Shutdown database connection and associate data
* structures.
@@ -780,6 +784,8 @@ database_shutdown (struct Plugin *plugin)
}
+void *libgnunet_plugin_namestore_postgres_init (void *cls);
+
/**
* Entry point for the plugin.
*
@@ -820,6 +826,9 @@ libgnunet_plugin_namestore_postgres_init (void *cls)
}
+void *
+libgnunet_plugin_namestore_postgres_done (void *cls);
+
/**
* Exit point from the plugin.
*
diff --git a/src/plugin/namestore/test_plugin_namestore.c
b/src/plugin/namestore/test_plugin_namestore.c
index db943ab9a..3bd28099b 100644
--- a/src/plugin/namestore/test_plugin_namestore.c
+++ b/src/plugin/namestore/test_plugin_namestore.c
@@ -50,6 +50,8 @@ unload_plugin (struct GNUNET_NAMESTORE_PluginFunctions *api)
GNUNET_break (NULL == GNUNET_PLUGIN_unload (libname, api));
GNUNET_free (libname);
}
+
+
#endif
/**
@@ -189,7 +191,12 @@ int
main (int argc, char *argv[])
{
char cfg_name[PATH_MAX];
- char *const xargv[] = { "test-plugin-namestore", "-c", cfg_name, NULL };
+ char *const xargv[] = {
+ (char*) "test-plugin-namestore",
+ (char*) "-c",
+ cfg_name,
+ NULL
+ };
struct GNUNET_GETOPT_CommandLineOption options[] =
{ GNUNET_GETOPT_OPTION_END };
diff --git a/src/plugin/reclaim/plugin_reclaim_credential_jwt.c
b/src/plugin/reclaim/plugin_reclaim_credential_jwt.c
index 18a9b21b6..55188a7f5 100644
--- a/src/plugin/reclaim/plugin_reclaim_credential_jwt.c
+++ b/src/plugin/reclaim/plugin_reclaim_credential_jwt.c
@@ -154,9 +154,10 @@ jwt_parse_attributes (void *cls,
const char *data,
size_t data_size)
{
- char *jwt_string;
struct GNUNET_RECLAIM_AttributeList *attrs;
+ const char *jwt_body;
char delim[] = ".";
+ char *jwt_string;
char *val_str = NULL;
char *decoded_jwt;
char *tmp;
@@ -166,7 +167,7 @@ jwt_parse_attributes (void *cls,
attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
jwt_string = GNUNET_strndup (data, data_size);
- const char *jwt_body = strtok (jwt_string, delim);
+ jwt_body = strtok (jwt_string, delim);
if (NULL == jwt_body)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -187,66 +188,68 @@ jwt_parse_attributes (void *cls,
GNUNET_assert (NULL != decoded_jwt);
json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, &json_err);
GNUNET_free (decoded_jwt);
- const char *key;
- const char *addr_key;
- json_t *value;
- json_t *addr_value;
-
- json_object_foreach (json_val, key, value) {
- if (0 == strcmp ("iss", key))
- continue;
- if (0 == strcmp ("jti", key))
- continue;
- if (0 == strcmp ("exp", key))
- continue;
- if (0 == strcmp ("iat", key))
- continue;
- if (0 == strcmp ("nbf", key))
- continue;
- if (0 == strcmp ("aud", key))
- continue;
- if (0 == strcmp ("address", key))
- {
- if (! json_is_object (value))
+ {
+ const char *key;
+ const char *addr_key;
+ json_t *value;
+ json_t *addr_value;
+
+ json_object_foreach (json_val, key, value) {
+ if (0 == strcmp ("iss", key))
+ continue;
+ if (0 == strcmp ("jti", key))
+ continue;
+ if (0 == strcmp ("exp", key))
+ continue;
+ if (0 == strcmp ("iat", key))
+ continue;
+ if (0 == strcmp ("nbf", key))
+ continue;
+ if (0 == strcmp ("aud", key))
+ continue;
+ if (0 == strcmp ("address", key))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "address claim in wrong format!");
+ if (! json_is_object (value))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "address claim in wrong format!");
+ continue;
+ }
+ json_object_foreach (value, addr_key, addr_value) {
+ val_str = json_dumps (addr_value, JSON_ENCODE_ANY);
+ tmp = val_str;
+ // Remove leading " from jasson conversion
+ if (tmp[0] == '"')
+ tmp++;
+ // Remove trailing " from jansson conversion
+ if (tmp[strlen (tmp) - 1] == '"')
+ tmp[strlen (tmp) - 1] = '\0';
+ GNUNET_RECLAIM_attribute_list_add (attrs,
+ addr_key,
+ NULL,
+
GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,
+ tmp,
+ strlen (val_str));
+ GNUNET_free (val_str);
+ }
continue;
}
- json_object_foreach (value, addr_key, addr_value) {
- val_str = json_dumps (addr_value, JSON_ENCODE_ANY);
- tmp = val_str;
- // Remove leading " from jasson conversion
- if (tmp[0] == '"')
- tmp++;
- // Remove trailing " from jansson conversion
- if (tmp[strlen (tmp) - 1] == '"')
- tmp[strlen (tmp) - 1] = '\0';
- GNUNET_RECLAIM_attribute_list_add (attrs,
- addr_key,
- NULL,
-
GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,
- tmp,
- strlen (val_str));
- GNUNET_free (val_str);
- }
- continue;
+ val_str = json_dumps (value, JSON_ENCODE_ANY);
+ tmp = val_str;
+ // Remove leading " from jasson conversion
+ if (tmp[0] == '"')
+ tmp++;
+ // Remove trailing " from jansson conversion
+ if (tmp[strlen (tmp) - 1] == '"')
+ tmp[strlen (tmp) - 1] = '\0';
+ GNUNET_RECLAIM_attribute_list_add (attrs,
+ key,
+ NULL,
+
GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,// FIXME
+ tmp,
+ strlen (val_str));
+ GNUNET_free (val_str);
}
- val_str = json_dumps (value, JSON_ENCODE_ANY);
- tmp = val_str;
- // Remove leading " from jasson conversion
- if (tmp[0] == '"')
- tmp++;
- // Remove trailing " from jansson conversion
- if (tmp[strlen (tmp) - 1] == '"')
- tmp[strlen (tmp) - 1] = '\0';
- GNUNET_RECLAIM_attribute_list_add (attrs,
- key,
- NULL,
- GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,//
FIXME
- tmp,
- strlen (val_str));
- GNUNET_free (val_str);
}
json_decref (json_val);
GNUNET_free (jwt_string);
@@ -306,10 +309,10 @@ jwt_get_issuer (void *cls,
char *issuer = NULL;
char *decoded_jwt;
json_t *issuer_json;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
json_t *json_val;
json_error_t json_err;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
jwt_string = GNUNET_strndup (data, data_size);
jwt_body = strtok (jwt_string, delim);
jwt_body = strtok (NULL, delim);
@@ -384,10 +387,10 @@ jwt_get_expiration (void *cls,
char delim[] = ".";
char *decoded_jwt;
json_t *exp_json;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
json_t *json_val;
json_error_t json_err;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
jwt_string = GNUNET_strndup (data, data_size);
jwt_body = strtok (jwt_string, delim);
jwt_body = strtok (NULL, delim);
@@ -461,6 +464,7 @@ jwt_create_presentation (void *cls,
return GNUNET_OK;
}
+
void *
libgnunet_plugin_reclaim_credential_jwt_init (void *cls);
@@ -494,6 +498,7 @@ libgnunet_plugin_reclaim_credential_jwt_init (void *cls)
return api;
}
+
void *
libgnunet_plugin_reclaim_credential_jwt_done (void *cls);
diff --git a/src/service/arm/arm_api.c b/src/service/arm/arm_api.c
index 550a059a7..b6de6334b 100644
--- a/src/service/arm/arm_api.c
+++ b/src/service/arm/arm_api.c
@@ -280,7 +280,7 @@ handle_arm_result (void *cls,
return;
}
- result = (enum GNUNET_ARM_Result) ntohl (res->result);
+ result = ntohl (res->result);
if ( (GNUNET_YES == op->is_arm_stop) &&
(GNUNET_ARM_RESULT_STOPPING == result) )
{
diff --git a/src/service/arm/arm_monitor_api.c
b/src/service/arm/arm_monitor_api.c
index 2c418d0ce..aaee53156 100644
--- a/src/service/arm/arm_monitor_api.c
+++ b/src/service/arm/arm_monitor_api.c
@@ -156,7 +156,7 @@ handle_monitor_notify (void *cls, const struct
GNUNET_ARM_StatusMessage *res)
struct GNUNET_ARM_MonitorHandle *h = cls;
enum GNUNET_ARM_ServiceMonitorStatus status;
- status = (enum GNUNET_ARM_ServiceMonitorStatus) ntohl (res->status);
+ status = ntohl (res->status);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received notification from ARM for service `%s' with status %d\n",
(const char *) &res[1],
diff --git a/src/service/core/core_api_monitor_peers.c
b/src/service/core/core_api_monitor_peers.c
index 3be8e3859..5c1f97676 100644
--- a/src/service/core/core_api_monitor_peers.c
+++ b/src/service/core/core_api_monitor_peers.c
@@ -97,7 +97,7 @@ handle_receive_info (void *cls, const struct
MonitorNotifyMessage *mon_message)
mh->peer_cb (mh->peer_cb_cls,
&mon_message->peer,
- (enum GNUNET_CORE_KxState) ntohl (mon_message->state),
+ ntohl (mon_message->state),
GNUNET_TIME_absolute_ntoh (mon_message->timeout));
}
diff --git a/src/service/dht/dht_api.c b/src/service/dht/dht_api.c
index 6a218e29d..6ed7b22a8 100644
--- a/src/service/dht/dht_api.c
+++ b/src/service/dht/dht_api.c
@@ -534,8 +534,7 @@ handle_monitor_get (void *cls,
const struct GNUNET_DHT_MonitorGetMessage *msg)
{
struct GNUNET_DHT_Handle *handle = cls;
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (msg->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
for (struct GNUNET_DHT_MonitorHandle *mh = handle->monitor_head;
NULL != mh;
@@ -552,7 +551,7 @@ handle_monitor_get (void *cls,
continue;
mh->get_cb (mh->cb_cls,
ro,
- (enum GNUNET_BLOCK_Type) ntohl (msg->type),
+ ntohl (msg->type),
ntohl (msg->hop_count),
ntohl (msg->desired_replication_level),
&msg->key);
@@ -575,8 +574,7 @@ check_monitor_get_resp (void *cls,
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
uint32_t getl = ntohl (msg->get_path_length);
uint32_t putl = ntohl (msg->put_path_length);
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (msg->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
if (truncated)
@@ -610,8 +608,7 @@ handle_monitor_get_resp (void *cls,
{
struct GNUNET_DHT_Handle *handle = cls;
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (msg->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
uint32_t getl = ntohl (msg->get_path_length);
uint32_t putl = ntohl (msg->put_path_length);
bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
@@ -641,7 +638,7 @@ handle_monitor_get_resp (void *cls,
&msg->key)) )
continue;
mh->get_resp_cb (mh->cb_cls,
- (enum GNUNET_BLOCK_Type) ntohl (msg->type),
+ ntohl (msg->type),
trunc_peer,
&path[putl],
getl,
@@ -669,8 +666,7 @@ check_monitor_put (void *cls,
{
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
uint32_t putl = ntohl (msg->put_path_length);
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (msg->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
if (truncated)
@@ -704,8 +700,7 @@ handle_monitor_put (void *cls,
struct GNUNET_DHT_Handle *handle = cls;
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
uint32_t putl = ntohl (msg->put_path_length);
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (msg->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
const struct GNUNET_PeerIdentity *trunc_peer
= truncated
@@ -734,7 +729,7 @@ handle_monitor_put (void *cls,
continue;
mh->put_cb (mh->cb_cls,
ro,
- (enum GNUNET_BLOCK_Type) ntohl (msg->type),
+ ntohl (msg->type),
ntohl (msg->hop_count),
ntohl (msg->desired_replication_level),
trunc_peer,
@@ -763,8 +758,7 @@ check_client_result (void *cls,
size_t msize = ntohs (msg->header.size) - sizeof(*msg);
uint32_t put_path_length = ntohl (msg->put_path_length);
uint32_t get_path_length = ntohl (msg->get_path_length);
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (msg->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (msg->options);
bool truncated = (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
size_t meta_length;
@@ -807,8 +801,7 @@ process_client_result (void *cls,
struct GNUNET_DHT_GetHandle *get_handle = value;
size_t msize = ntohs (crm->header.size) - sizeof(*crm);
uint16_t type = ntohl (crm->type);
- enum GNUNET_DHT_RouteOption ro
- = (enum GNUNET_DHT_RouteOption) ntohl (crm->options);
+ enum GNUNET_DHT_RouteOption ro = ntohl (crm->options);
bool truncated
= (0 != (ro & GNUNET_DHT_RO_TRUNCATED));
uint32_t put_path_length
diff --git a/src/service/fs/fs_api.c b/src/service/fs/fs_api.c
index 1e9da3fd2..ca37386db 100644
--- a/src/service/fs/fs_api.c
+++ b/src/service/fs/fs_api.c
@@ -1369,37 +1369,39 @@ GNUNET_FS_file_information_sync_ (struct
GNUNET_FS_FileInformation *fi)
skss = GNUNET_FS_uri_to_string (fi->sks_uri);
else
skss = NULL;
- struct GNUNET_BIO_WriteSpec ws1[] = {
- GNUNET_BIO_write_spec_object ("b", &b, sizeof (b)),
- GNUNET_FS_write_spec_meta_data ("meta", fi->meta),
- GNUNET_BIO_write_spec_string ("ksks", ksks),
- GNUNET_BIO_write_spec_string ("chks", chks),
- GNUNET_BIO_write_spec_string ("skss", skss),
- GNUNET_BIO_write_spec_end (),
- };
- struct GNUNET_BIO_WriteSpec ws2[] = {
- GNUNET_BIO_write_spec_string ("emsg", fi->emsg),
- GNUNET_BIO_write_spec_string ("filename", fi->filename),
- GNUNET_BIO_write_spec_int64 (
- "expiration time",
- (int64_t *) &fi->bo.expiration_time.abs_value_us),
- GNUNET_BIO_write_spec_int32 (
- "anonymity level",
- (int32_t *) &fi->bo.anonymity_level),
- GNUNET_BIO_write_spec_int32 (
- "content priority",
- (int32_t *) &fi->bo.content_priority),
- GNUNET_BIO_write_spec_int32 (
- "replication level",
- (int32_t *) &fi->bo.replication_level),
- GNUNET_BIO_write_spec_end (),
- };
- if ((GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws1)) ||
- (GNUNET_OK != write_start_time (wh, fi->start_time)) ||
- (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws2)))
{
- GNUNET_break (0);
- goto cleanup;
+ struct GNUNET_BIO_WriteSpec ws1[] = {
+ GNUNET_BIO_write_spec_object ("b", &b, sizeof (b)),
+ GNUNET_FS_write_spec_meta_data ("meta", fi->meta),
+ GNUNET_BIO_write_spec_string ("ksks", ksks),
+ GNUNET_BIO_write_spec_string ("chks", chks),
+ GNUNET_BIO_write_spec_string ("skss", skss),
+ GNUNET_BIO_write_spec_end (),
+ };
+ struct GNUNET_BIO_WriteSpec ws2[] = {
+ GNUNET_BIO_write_spec_string ("emsg", fi->emsg),
+ GNUNET_BIO_write_spec_string ("filename", fi->filename),
+ GNUNET_BIO_write_spec_int64 (
+ "expiration time",
+ (int64_t *) &fi->bo.expiration_time.abs_value_us),
+ GNUNET_BIO_write_spec_int32 (
+ "anonymity level",
+ (int32_t *) &fi->bo.anonymity_level),
+ GNUNET_BIO_write_spec_int32 (
+ "content priority",
+ (int32_t *) &fi->bo.content_priority),
+ GNUNET_BIO_write_spec_int32 (
+ "replication level",
+ (int32_t *) &fi->bo.replication_level),
+ GNUNET_BIO_write_spec_end (),
+ };
+ if ((GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws1)) ||
+ (GNUNET_OK != write_start_time (wh, fi->start_time)) ||
+ (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws2)))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
}
GNUNET_free (chks);
chks = NULL;
@@ -1942,22 +1944,25 @@ read_download_request (struct GNUNET_BIO_ReadHandle *rh)
unsigned int i;
dr = GNUNET_new (struct DownloadRequest);
- struct GNUNET_BIO_ReadSpec rs[] = {
- GNUNET_BIO_read_spec_int32 ("state", (int32_t *) &dr->state),
- GNUNET_BIO_read_spec_int64 ("offset", (int64_t *) &dr->offset),
- GNUNET_BIO_read_spec_int32 ("num children", (int32_t *) &dr->num_children),
- GNUNET_BIO_read_spec_end (),
- };
- if ((GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs)) ||
- (dr->num_children > CHK_PER_INODE) ||
- (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "depth",
- (int32_t *) &dr->depth)) ||
- ((0 == dr->depth) && (dr->num_children > 0)) ||
- ((dr->depth > 0) && (0 == dr->num_children)))
{
- GNUNET_break (0);
- dr->num_children = 0;
- goto cleanup;
+ struct GNUNET_BIO_ReadSpec rs[] = {
+ GNUNET_BIO_read_spec_int32 ("state", (int32_t *) &dr->state),
+ GNUNET_BIO_read_spec_int64 ("offset", (int64_t *) &dr->offset),
+ GNUNET_BIO_read_spec_int32 ("num children", (int32_t *)
&dr->num_children)
+ ,
+ GNUNET_BIO_read_spec_end (),
+ };
+ if ((GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs)) ||
+ (dr->num_children > CHK_PER_INODE) ||
+ (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "depth",
+ (int32_t *) &dr->depth)) ||
+ ((0 == dr->depth) && (dr->num_children > 0)) ||
+ ((dr->depth > 0) && (0 == dr->num_children)))
+ {
+ GNUNET_break (0);
+ dr->num_children = 0;
+ goto cleanup;
+ }
}
if (dr->num_children > 0)
dr->children =
@@ -2088,31 +2093,34 @@ GNUNET_FS_download_sync_ (struct
GNUNET_FS_DownloadContext *dc)
GNUNET_assert ((GNUNET_YES == GNUNET_FS_uri_test_chk (dc->uri)) ||
(GNUNET_YES == GNUNET_FS_uri_test_loc (dc->uri)));
uris = GNUNET_FS_uri_to_string (dc->uri);
- struct GNUNET_BIO_WriteSpec ws1[] = {
- GNUNET_BIO_write_spec_string ("uris", uris),
- GNUNET_FS_write_spec_meta_data ("metadata", dc->meta),
- GNUNET_BIO_write_spec_string ("emsg", dc->emsg),
- GNUNET_BIO_write_spec_string ("filename", dc->filename),
- GNUNET_BIO_write_spec_string ("temp filename", dc->temp_filename),
- GNUNET_BIO_write_spec_int64 ("old file size",
- (int64_t *) &dc->old_file_size),
- GNUNET_BIO_write_spec_int64 ("offset", (int64_t *) &dc->offset),
- GNUNET_BIO_write_spec_int64 ("length", (int64_t *) &dc->length),
- GNUNET_BIO_write_spec_int64 ("completed", (int64_t *) &dc->completed),
- GNUNET_BIO_write_spec_end (),
- };
- struct GNUNET_BIO_WriteSpec ws2[] = {
- GNUNET_BIO_write_spec_int32 ("anonymity", (int32_t *) &dc->anonymity),
- GNUNET_BIO_write_spec_int32 ("options", (int32_t *) &dc->options),
- GNUNET_BIO_write_spec_int32 ("has finished", (int32_t *)
&dc->has_finished),
- GNUNET_BIO_write_spec_end (),
- };
- if ((GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws1)) ||
- (GNUNET_OK != write_start_time (wh, dc->start_time)) ||
- (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws2)))
{
- GNUNET_break (0);
- goto cleanup;
+ struct GNUNET_BIO_WriteSpec ws1[] = {
+ GNUNET_BIO_write_spec_string ("uris", uris),
+ GNUNET_FS_write_spec_meta_data ("metadata", dc->meta),
+ GNUNET_BIO_write_spec_string ("emsg", dc->emsg),
+ GNUNET_BIO_write_spec_string ("filename", dc->filename),
+ GNUNET_BIO_write_spec_string ("temp filename", dc->temp_filename),
+ GNUNET_BIO_write_spec_int64 ("old file size",
+ (int64_t *) &dc->old_file_size),
+ GNUNET_BIO_write_spec_int64 ("offset", (int64_t *) &dc->offset),
+ GNUNET_BIO_write_spec_int64 ("length", (int64_t *) &dc->length),
+ GNUNET_BIO_write_spec_int64 ("completed", (int64_t *) &dc->completed),
+ GNUNET_BIO_write_spec_end (),
+ };
+ struct GNUNET_BIO_WriteSpec ws2[] = {
+ GNUNET_BIO_write_spec_int32 ("anonymity", (int32_t *) &dc->anonymity),
+ GNUNET_BIO_write_spec_int32 ("options", (int32_t *) &dc->options),
+ GNUNET_BIO_write_spec_int32 ("has finished", (int32_t *)
&dc->has_finished
+ ),
+ GNUNET_BIO_write_spec_end (),
+ };
+ if ((GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws1)) ||
+ (GNUNET_OK != write_start_time (wh, dc->start_time)) ||
+ (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws2)))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
}
if (NULL == dc->emsg)
{
@@ -2935,38 +2943,40 @@ deserialize_download (struct GNUNET_FS_Handle *h,
dc->parent = parent;
dc->h = h;
dc->serialization = GNUNET_strdup (serialization);
- struct GNUNET_BIO_ReadSpec rs[] = {
- GNUNET_FS_read_spec_meta_data ("download-meta", &dc->meta),
- GNUNET_BIO_read_spec_string ("download-emsg", &dc->emsg, 10 * 1024),
- GNUNET_BIO_read_spec_string ("download-fn", &dc->filename, 10 * 1024),
- GNUNET_BIO_read_spec_string ("download-tfn",
- &dc->temp_filename, 10 * 1024),
- GNUNET_BIO_read_spec_int64 ("old file size",
- (int64_t *) &dc->old_file_size),
- GNUNET_BIO_read_spec_int64 ("offset",
- (int64_t *) &dc->offset),
- GNUNET_BIO_read_spec_int64 ("length",
- (int64_t *) &dc->length),
- GNUNET_BIO_read_spec_int64 ("completed",
- (int64_t *) &dc->completed),
- GNUNET_BIO_read_spec_end (),
- };
- if ((GNUNET_OK !=
- GNUNET_BIO_read_string (rh, "download-uri", &uris, 10 * 1024)) ||
- (NULL == (dc->uri = GNUNET_FS_uri_parse (uris, &emsg))) ||
- ((GNUNET_YES != GNUNET_FS_uri_test_chk (dc->uri)) &&
- (GNUNET_YES != GNUNET_FS_uri_test_loc (dc->uri))) ||
- (GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs)) ||
- (GNUNET_OK != read_start_time (rh, &dc->start_time)) ||
- (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "anonymity",
- (int32_t *) &dc->anonymity)) ||
- (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "options",
- (int32_t *) &options)) ||
- (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "status",
- (int32_t *) &status)))
{
- GNUNET_break (0);
- goto cleanup;
+ struct GNUNET_BIO_ReadSpec rs[] = {
+ GNUNET_FS_read_spec_meta_data ("download-meta", &dc->meta),
+ GNUNET_BIO_read_spec_string ("download-emsg", &dc->emsg, 10 * 1024),
+ GNUNET_BIO_read_spec_string ("download-fn", &dc->filename, 10 * 1024),
+ GNUNET_BIO_read_spec_string ("download-tfn",
+ &dc->temp_filename, 10 * 1024),
+ GNUNET_BIO_read_spec_int64 ("old file size",
+ (int64_t *) &dc->old_file_size),
+ GNUNET_BIO_read_spec_int64 ("offset",
+ (int64_t *) &dc->offset),
+ GNUNET_BIO_read_spec_int64 ("length",
+ (int64_t *) &dc->length),
+ GNUNET_BIO_read_spec_int64 ("completed",
+ (int64_t *) &dc->completed),
+ GNUNET_BIO_read_spec_end (),
+ };
+ if ((GNUNET_OK !=
+ GNUNET_BIO_read_string (rh, "download-uri", &uris, 10 * 1024)) ||
+ (NULL == (dc->uri = GNUNET_FS_uri_parse (uris, &emsg))) ||
+ ((GNUNET_YES != GNUNET_FS_uri_test_chk (dc->uri)) &&
+ (GNUNET_YES != GNUNET_FS_uri_test_loc (dc->uri))) ||
+ (GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs)) ||
+ (GNUNET_OK != read_start_time (rh, &dc->start_time)) ||
+ (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "anonymity",
+ (int32_t *) &dc->anonymity)) ||
+ (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "options",
+ (int32_t *) &options)) ||
+ (GNUNET_OK != GNUNET_BIO_read_int32 (rh, "status",
+ (int32_t *) &status)))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
}
dc->options = (enum GNUNET_FS_DownloadOptions) options;
dc->active =
diff --git a/src/service/fs/fs_namespace.c b/src/service/fs/fs_namespace.c
index f8b7b91c0..6d66e7dd9 100644
--- a/src/service/fs/fs_namespace.c
+++ b/src/service/fs/fs_namespace.c
@@ -214,21 +214,23 @@ write_update_information_graph (struct
GNUNET_FS_UpdateInformationGraph *uig)
{
n = uig->update_nodes[i];
uris = GNUNET_FS_uri_to_string (n->uri);
- struct GNUNET_BIO_WriteSpec ws[] = {
- GNUNET_BIO_write_spec_string ("fs-namespace-node-id", n->id),
- GNUNET_FS_write_spec_meta_data ("fs-namespace-node-meta", n->md),
- GNUNET_BIO_write_spec_string ("fs-namespace-node-update", n->update),
- GNUNET_BIO_write_spec_string ("fs-namespace-uris", uris),
- GNUNET_BIO_write_spec_end (),
- };
- if (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws))
{
- GNUNET_free (uris);
- break;
+ struct GNUNET_BIO_WriteSpec ws[] = {
+ GNUNET_BIO_write_spec_string ("fs-namespace-node-id", n->id),
+ GNUNET_FS_write_spec_meta_data ("fs-namespace-node-meta", n->md),
+ GNUNET_BIO_write_spec_string ("fs-namespace-node-update", n->update),
+ GNUNET_BIO_write_spec_string ("fs-namespace-uris", uris),
+ GNUNET_BIO_write_spec_end (),
+ };
+ if (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws))
+ {
+ GNUNET_free (uris);
+ break;
+ }
}
GNUNET_free (uris);
}
- END:
+END:
if (GNUNET_OK != GNUNET_BIO_write_close (wh, NULL))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Failed to write `%s': %s\n"),
@@ -292,22 +294,24 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
for (i = 0; i < count; i++)
{
n = GNUNET_new (struct NamespaceUpdateNode);
- struct GNUNET_BIO_ReadSpec rs[] = {
- GNUNET_BIO_read_spec_string ("identifier", &n->id, 1024),
- GNUNET_FS_read_spec_meta_data ("meta", &n->md),
- GNUNET_BIO_read_spec_string ("update-id", &n->update, 1024),
- GNUNET_BIO_read_spec_string ("uri", &uris, 1024 * 2),
- GNUNET_BIO_read_spec_end (),
- };
- if (GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs))
{
- GNUNET_break (0);
- GNUNET_free (n->id);
- GNUNET_free (n->update);
- if (n->md != NULL)
- GNUNET_FS_meta_data_destroy (n->md);
- GNUNET_free (n);
- break;
+ struct GNUNET_BIO_ReadSpec rs[] = {
+ GNUNET_BIO_read_spec_string ("identifier", &n->id, 1024),
+ GNUNET_FS_read_spec_meta_data ("meta", &n->md),
+ GNUNET_BIO_read_spec_string ("update-id", &n->update, 1024),
+ GNUNET_BIO_read_spec_string ("uri", &uris, 1024 * 2),
+ GNUNET_BIO_read_spec_end (),
+ };
+ if (GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs))
+ {
+ GNUNET_break (0);
+ GNUNET_free (n->id);
+ GNUNET_free (n->update);
+ if (n->md != NULL)
+ GNUNET_FS_meta_data_destroy (n->md);
+ GNUNET_free (n);
+ break;
+ }
}
n->uri = GNUNET_FS_uri_parse (uris, &emsg);
GNUNET_free (uris);
@@ -324,7 +328,7 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
uig->update_nodes[i] = n;
}
uig->update_node_count = i;
- END:
+END:
if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/service/fs/meta_data.c b/src/service/fs/meta_data.c
index b3db0e6c7..a00b9984a 100644
--- a/src/service/fs/meta_data.c
+++ b/src/service/fs/meta_data.c
@@ -966,7 +966,7 @@ GNUNET_FS_meta_data_deserialize (const char *input, size_t
size)
{
GNUNET_memcpy (&ent, &cdata[i * sizeof(struct MetaDataEntry)],
sizeof(struct MetaDataEntry));
- format = (enum EXTRACTOR_MetaFormat) ntohl (ent.format);
+ format = ntohl (ent.format);
if ((EXTRACTOR_METAFORMAT_UTF8 != format) &&
(EXTRACTOR_METAFORMAT_C_STRING != format) &&
(EXTRACTOR_METAFORMAT_BINARY != format))
@@ -1030,8 +1030,8 @@ GNUNET_FS_meta_data_deserialize (const char *input,
size_t size)
else
mime_type = &mdata[left];
GNUNET_FS_meta_data_insert (md, plugin_name,
- (enum EXTRACTOR_MetaType)
- ntohl (ent.type), format, mime_type,
+ ntohl (ent.type), format,
+ mime_type,
meta_data, dlen);
}
GNUNET_free (data);
diff --git a/src/service/nat-auto/nat_auto_api.c
b/src/service/nat-auto/nat_auto_api.c
index 3c982f883..cbedc96ef 100644
--- a/src/service/nat-auto/nat_auto_api.c
+++ b/src/service/nat-auto/nat_auto_api.c
@@ -161,10 +161,8 @@ handle_auto_result (void *cls,
struct GNUNET_NAT_AUTO_AutoHandle *ah = cls;
size_t left;
struct GNUNET_CONFIGURATION_Handle *cfg;
- enum GNUNET_NAT_Type type
- = (enum GNUNET_NAT_Type) ntohl (res->type);
- enum GNUNET_NAT_StatusCode status
- = (enum GNUNET_NAT_StatusCode) ntohl (res->status_code);
+ enum GNUNET_NAT_Type type = ntohl (res->type);
+ enum GNUNET_NAT_StatusCode status = ntohl (res->status_code);
left = ntohs (res->header.size) - sizeof(*res);
cfg = GNUNET_CONFIGURATION_create ();
diff --git a/src/service/nat/nat_api.c b/src/service/nat/nat_api.c
index ef7789421..0acae7865 100644
--- a/src/service/nat/nat_api.c
+++ b/src/service/nat/nat_api.c
@@ -266,7 +266,7 @@ handle_address_change_notification (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received address change notification\n");
- ac = (enum GNUNET_NAT_AddressClass) ntohl (acn->addr_class);
+ ac = ntohl (acn->addr_class);
if (GNUNET_YES == ntohl (acn->add_remove))
{
ae = GNUNET_malloc (sizeof(*ae) + alen);
diff --git a/src/service/reclaim/did_core.c b/src/service/reclaim/did_core.c
index 7589657ba..a98f47dc8 100644
--- a/src/service/reclaim/did_core.c
+++ b/src/service/reclaim/did_core.c
@@ -92,6 +92,7 @@ DID_resolve (const char *did,
void *cls)
{
struct GNUNET_CRYPTO_PublicKey pkey;
+ struct DID_resolve_return *cls_gns_lookup_cb;
// did, gns_handle and cont must me set
if ((did == NULL) || (gns_handle == NULL) || (cont == NULL))
@@ -101,8 +102,7 @@ DID_resolve (const char *did,
return GNUNET_NO;
// Create closure for lookup callback
- struct DID_resolve_return *cls_gns_lookup_cb
- = malloc (sizeof(struct DID_resolve_return));
+ cls_gns_lookup_cb = GNUNET_malloc (sizeof(struct DID_resolve_return));
cls_gns_lookup_cb->cb = cont;
cls_gns_lookup_cb->cls = cls;
@@ -231,6 +231,7 @@ DID_create (const struct GNUNET_IDENTITY_Ego *ego,
void *cls)
{
struct GNUNET_CRYPTO_PublicKey pkey;
+ struct DID_create_namestore_lookup_closure *cls_name_store_lookup_cb;
// Ego, namestore_handle and cont must be set
if ((ego == NULL) || (namestore_handle == NULL) || (cont == NULL))
@@ -245,17 +246,13 @@ DID_create (const struct GNUNET_IDENTITY_Ego *ego,
return GNUNET_NO;
}
- struct DID_action_return *ret
- = malloc (sizeof(struct DID_action_return));
- ret->cb = cont;
- ret->cls = cls;
-
- struct DID_create_namestore_lookup_closure *cls_name_store_lookup_cb
- = malloc (sizeof(struct DID_create_namestore_lookup_closure));
+ cls_name_store_lookup_cb = GNUNET_malloc (sizeof(struct
DID_create_namestore_lookup_closure));
+ cls_name_store_lookup_cb->ret = GNUNET_malloc (sizeof(struct
DID_action_return));
+ cls_name_store_lookup_cb->ret->cb = cont;
+ cls_name_store_lookup_cb->ret->cls = cls;
cls_name_store_lookup_cb->did_document = did_document;
cls_name_store_lookup_cb->expire_time = (*expire_time);
cls_name_store_lookup_cb->namestore_handle = namestore_handle;
- cls_name_store_lookup_cb->ret = ret;
// Check if ego already has a DID Document
GNUNET_NAMESTORE_records_lookup (namestore_handle,
diff --git a/src/service/revocation/revocation_api.c
b/src/service/revocation/revocation_api.c
index 0e3641af8..80a38a1d2 100644
--- a/src/service/revocation/revocation_api.c
+++ b/src/service/revocation/revocation_api.c
@@ -307,12 +307,14 @@ GNUNET_REVOCATION_revoke (const struct
GNUNET_CONFIGURATION_Handle *cfg,
}
h->func = func;
h->func_cls = func_cls;
- size_t extra_len = GNUNET_GNSRECORD_proof_get_size (pow);
- env = GNUNET_MQ_msg_extra (rm,
- extra_len,
- GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
- rm->pow_size = htonl (extra_len);
- memcpy (&rm[1], pow, extra_len);
+ {
+ size_t extra_len = GNUNET_GNSRECORD_proof_get_size (pow);
+ env = GNUNET_MQ_msg_extra (rm,
+ extra_len,
+ GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
+ rm->pow_size = htonl (extra_len);
+ memcpy (&rm[1], pow, extra_len);
+ }
GNUNET_MQ_send (h->mq,
env);
return h;
diff --git a/src/service/seti/seti_api.c b/src/service/seti/seti_api.c
index 6522236c6..fba35b629 100644
--- a/src/service/seti/seti_api.c
+++ b/src/service/seti/seti_api.c
@@ -235,7 +235,7 @@ handle_result (void *cls,
int destroy_set;
GNUNET_assert (NULL != set->mq);
- result_status = (enum GNUNET_SETI_Status) ntohs (msg->result_status);
+ result_status = ntohs (msg->result_status);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got result message with status %d\n",
result_status);
diff --git a/src/service/setu/setu_api.c b/src/service/setu/setu_api.c
index 7fa144590..e7f3076f7 100644
--- a/src/service/setu/setu_api.c
+++ b/src/service/setu/setu_api.c
@@ -218,7 +218,7 @@ handle_result (void *cls,
int destroy_set;
GNUNET_assert (NULL != set->mq);
- result_status = (enum GNUNET_SETU_Status) ntohs (msg->result_status);
+ result_status = ntohs (msg->result_status);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got result message with status %d\n",
result_status);
diff --git a/src/service/transport/transport-testing-communicator.c
b/src/service/transport/transport-testing-communicator.c
index 1e5168461..fb7c4eb0c 100644
--- a/src/service/transport/transport-testing-communicator.c
+++ b/src/service/transport/transport-testing-communicator.c
@@ -245,11 +245,14 @@ handle_communicator_backchannel (void *cls,
client->tc;
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *other_tc_h;
struct GNUNET_MessageHeader *msg;
- msg = (struct GNUNET_MessageHeader *) &bc_msg[1];
- uint16_t isize = ntohs (msg->size);
- const char *target_communicator = ((const char *) msg) + isize;
- struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
struct GNUNET_MQ_Envelope *env;
+ uint16_t isize;
+ const char *target_communicator;
+ struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
+
+ msg = (struct GNUNET_MessageHeader *) &bc_msg[1];
+ isize = ntohs (msg->size);
+ target_communicator = ((const char *) msg) + isize;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received backchannel message\n");
@@ -376,9 +379,9 @@ handle_incoming_msg (void *cls,
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h =
client->tc;
struct GNUNET_MessageHeader *msg;
+ size_t payload_len;
msg = (struct GNUNET_MessageHeader *) &inc_msg[1];
- size_t payload_len = ntohs (msg->size) - sizeof (struct
- GNUNET_MessageHeader);
+ payload_len = ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader);
if (NULL != tc_h->incoming_msg_cb)
{
tc_h->incoming_msg_cb (tc_h->cb_cls,
@@ -1213,19 +1216,23 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send
if (last_queue != tc_queue)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Selected sending queue changed to %u with length %lu and MTU
%u\n",
- ntohl (tc_queue->qid), (unsigned long) tc_queue->q_len,
tc_queue->mtu);
+ ntohl (tc_queue->qid), (unsigned long) tc_queue->q_len,
tc_queue
+ ->mtu);
GNUNET_assert (NULL != tc_queue);
last_queue = tc_queue;
// Uncomment this for alternative 1 of backchannel functionality
if (tc_queue->q_len != GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED)
tc_queue->q_len--;
// Until here for alternative 1
- static int msg_count = 0;
- msg_count++;
- if (msg_count % 100 == 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending %u-th (%lu-th for queue) message on queue %u\n",
- msg_count, (unsigned long) tc_queue->mid, ntohl
(tc_queue->qid));
+ {
+ static int msg_count = 0;
+ msg_count++;
+ if (msg_count % 100 == 0)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending %u-th (%lu-th for queue) message on queue %u\n",
+ msg_count, (unsigned long) tc_queue->mid, ntohl
(tc_queue->qid
+ ));
+ }
inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size;
env = GNUNET_MQ_msg_extra (msg,
inbox_size,
diff --git a/src/service/transport/transport_api2_communication.c
b/src/service/transport/transport_api2_communication.c
index 6ea6bce1a..86168c416 100644
--- a/src/service/transport/transport_api2_communication.c
+++ b/src/service/transport/transport_api2_communication.c
@@ -783,8 +783,8 @@ static int
check_start_burst (void *cls,
const struct GNUNET_TRANSPORT_StartBurst *sb)
{
- (void) cls;
const char *addr_str = (const char *) &sb[1];
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"check_start_burst %s %lu\n",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: build: fix various C90 warnings,
gnunet <=