summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/documentation/tutorial-examples/005.c5
-rw-r--r--src/abe/abe.c26
-rw-r--r--src/credential/gnunet-service-credential.c48
-rw-r--r--src/credential/plugin_gnsrecord_credential.c10
-rw-r--r--src/credential/plugin_rest_credential.c36
-rw-r--r--src/dns/dnsstub.c12
-rw-r--r--src/fs/gnunet-service-fs_indexing.c6
-rw-r--r--src/gns/gnunet-gns-benchmark.c6
-rw-r--r--src/gns/gnunet-service-gns_resolver.c10
-rw-r--r--src/gns/plugin_gnsrecord_gns.c12
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c10
-rw-r--r--src/identity-provider/identity_provider_api.c12
-rw-r--r--src/multicast/test_multicast_2peers.c5
-rw-r--r--src/multicast/test_multicast_multipeer.c90
-rw-r--r--src/namestore/gnunet-service-namestore.c12
-rw-r--r--src/namestore/gnunet-zoneimport.c18
-rw-r--r--src/nat/gnunet-helper-nat-client.c43
-rw-r--r--src/nat/gnunet-helper-nat-server.c32
-rw-r--r--src/nat/gnunet-service-nat.c8
-rw-r--r--src/regex/regex_test_lib.c10
-rw-r--r--src/rps/test_rps.c8
-rw-r--r--src/util/crypto_abe.c28
22 files changed, 247 insertions, 200 deletions
diff --git a/doc/documentation/tutorial-examples/005.c b/doc/documentation/tutorial-examples/005.c
index 0c459f509..1b59f85a6 100644
--- a/doc/documentation/tutorial-examples/005.c
+++ b/doc/documentation/tutorial-examples/005.c
@@ -2,7 +2,8 @@ struct GNUNET_MQ_Envelope *env;
struct GNUNET_MessageHeader *msg;
env = GNUNET_MQ_msg_extra (msg, payload_size, GNUNET_MY_MESSAGE_TYPE);
-memcpy (&msg[1], &payload, payload_size);
+GNUNET_memcpy (&msg[1],
+ &payload,
+ payload_size);
// Send message via message queue 'mq'
GNUNET_mq_send (mq, env);
-
diff --git a/src/abe/abe.c b/src/abe/abe.c
index 3f1f6dc5b..8b59953fb 100644
--- a/src/abe/abe.c
+++ b/src/abe/abe.c
@@ -54,12 +54,12 @@ init_aes( element_t k, int enc,
int rc;
int key_len;
unsigned char* key_buf;
-
+
key_len = element_length_in_bytes(k) < 33 ? 3 : element_length_in_bytes(k);
key_buf = (unsigned char*) malloc(key_len);
element_to_bytes(key_buf, k);
- memcpy (key->aes_key, key_buf, GNUNET_CRYPTO_AES_KEY_LENGTH);
+ GNUNET_memcpy (key->aes_key, key_buf, GNUNET_CRYPTO_AES_KEY_LENGTH);
GNUNET_assert (0 ==
gcry_cipher_open (handle, GCRY_CIPHER_AES256,
GCRY_CIPHER_MODE_CFB, 0));
@@ -124,16 +124,16 @@ aes_128_cbc_decrypt( char* ct,
unsigned char iv[16];
char* tmp;
uint32_t len;
-
+
init_aes(k, 1, &handle, &skey, iv);
tmp = GNUNET_malloc (size);
//AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT);
- GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size));
+ GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size));
gcry_cipher_close (handle);
/* TODO make less crufty */
-
+
/* get real length */
len = 0;
len = len
@@ -195,7 +195,7 @@ GNUNET_ABE_cpabe_create_key (struct GNUNET_ABE_AbeMasterKey *key,
struct GNUNET_ABE_AbeKey *prv_key;
int size;
char *tmp;
-
+
prv_key = GNUNET_new (struct GNUNET_ABE_AbeKey);
prv_key->prv = gabe_keygen(key->pub, key->msk, attrs);
size = gabe_pub_serialize(key->pub, &tmp);
@@ -234,7 +234,7 @@ write_cpabe (void **result,
{
char *ptr;
uint32_t *len;
-
+
*result = GNUNET_malloc (12 + cph_buf_len + aes_buf_len);
ptr = *result;
len = (uint32_t*) ptr;
@@ -243,12 +243,12 @@ write_cpabe (void **result,
len = (uint32_t*) ptr;
*len = htonl (aes_buf_len);
ptr += 4;
- memcpy (ptr, aes_buf, aes_buf_len);
+ GNUNET_memcpy (ptr, aes_buf, aes_buf_len);
ptr += aes_buf_len;
len = (uint32_t*) ptr;
*len = htonl (cph_buf_len);
ptr += 4;
- memcpy (ptr, cph_buf, cph_buf_len);
+ GNUNET_memcpy (ptr, cph_buf, cph_buf_len);
return 12 + cph_buf_len + aes_buf_len;
}
@@ -271,13 +271,13 @@ read_cpabe (const void *data,
*aes_buf_len = ntohl (*len);
ptr += 4;
*aes_buf = GNUNET_malloc (*aes_buf_len);
- memcpy(*aes_buf, ptr, *aes_buf_len);
+ GNUNET_memcpy(*aes_buf, ptr, *aes_buf_len);
ptr += *aes_buf_len;
len = (uint32_t*)ptr;
*cph_buf_len = ntohl (*len);
ptr += 4;
*cph_buf = GNUNET_malloc (*cph_buf_len);
- memcpy(*cph_buf, ptr, *cph_buf_len);
+ GNUNET_memcpy(*cph_buf, ptr, *cph_buf_len);
return buf_len;
}
@@ -429,7 +429,7 @@ GNUNET_ABE_cpabe_deserialize_key (const void *data,
&prv_len);
key->pub = gabe_pub_unserialize (pub, pub_len);
key->prv = gabe_prv_unserialize (key->pub, prv, prv_len);
-
+
GNUNET_free (pub);
GNUNET_free (prv);
return key;
@@ -491,7 +491,7 @@ GNUNET_ABE_cpabe_deserialize_master_key (const void *data,
&msk_len);
key->pub = gabe_pub_unserialize (pub, pub_len);
key->msk = gabe_msk_unserialize (key->pub, msk, msk_len);
-
+
GNUNET_free (pub);
GNUNET_free (msk);
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c
index 399371a2e..29bdf63d8 100644
--- a/src/credential/gnunet-service-credential.c
+++ b/src/credential/gnunet-service-credential.c
@@ -61,17 +61,17 @@ struct DelegationChainEntry
* The issuer
*/
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
-
+
/**
* The subject
*/
struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
-
+
/**
* The issued attribute
*/
char *issuer_attribute;
-
+
/**
* The delegated attribute
*/
@@ -92,7 +92,7 @@ struct CredentialRecordEntry
* DLL
*/
struct CredentialRecordEntry *prev;
-
+
/**
* Number of references in delegation chains
*/
@@ -409,7 +409,7 @@ cleanup_handle (struct VerifyRequestHandle *vrh)
}
cleanup_delegation_set (vrh->root_set);
GNUNET_free_non_null (vrh->issuer_attribute);
- for (cr_entry = vrh->cred_chain_head;
+ for (cr_entry = vrh->cred_chain_head;
NULL != vrh->cred_chain_head;
cr_entry = vrh->cred_chain_head)
{
@@ -543,7 +543,7 @@ send_lookup_response (struct VerifyRequestHandle *vrh)
else
rmsg->cred_found = htonl (GNUNET_NO);
- GNUNET_assert (-1 !=
+ GNUNET_assert (-1 !=
GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size,
dd,
vrh->cred_chain_size,
@@ -587,7 +587,7 @@ backward_resolution (void* cls,
"Got %d attrs\n", rd_count);
// Each OR
- for (uint32_t i=0; i < rd_count; i++)
+ for (uint32_t i=0; i < rd_count; i++)
{
if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type)
continue;
@@ -665,10 +665,10 @@ backward_resolution (void* cls,
/**
* Check if this delegation already matches one of our credentials
*/
- for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL;
+ for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL;
cred_pointer = cred_pointer->next)
{
- if(0 != memcmp (&set->subject_key,
+ if(0 != memcmp (&set->subject_key,
&cred_pointer->credential->issuer_key,
sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
continue;
@@ -769,7 +769,7 @@ backward_resolution (void* cls,
return;
}
-}
+}
/**
@@ -809,7 +809,7 @@ delegation_chain_resolution_start (void* cls)
}
/**
- * Check for attributes from the issuer and follow the chain
+ * Check for attributes from the issuer and follow the chain
* till you get the required subject's attributes
*/
char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1];
@@ -821,9 +821,9 @@ delegation_chain_resolution_start (void* cls)
"Looking up %s\n", issuer_attribute_name);
ds_entry = GNUNET_new (struct DelegationSetQueueEntry);
ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
- memcpy (ds_entry->issuer_key,
- &vrh->issuer_key,
- sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ GNUNET_memcpy (ds_entry->issuer_key,
+ &vrh->issuer_key,
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute);
ds_entry->handle = vrh;
ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute);
@@ -869,7 +869,7 @@ check_verify (void *cls,
static void
handle_verify (void *cls,
- const struct VerifyMessage *v_msg)
+ const struct VerifyMessage *v_msg)
{
struct VerifyRequestHandle *vrh;
struct GNUNET_SERVICE_Client *client = cls;
@@ -886,7 +886,9 @@ handle_verify (void *cls,
"Received VERIFY message\n");
utf_in = (const char *) &v_msg[1];
GNUNET_STRINGS_utf8_tolower (utf_in, attrptr);
- GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len));
+ GNUNET_memcpy (issuer_attribute,
+ attr,
+ ntohs (v_msg->issuer_attribute_len));
issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0';
vrh = GNUNET_new (struct VerifyRequestHandle);
GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh);
@@ -897,7 +899,7 @@ handle_verify (void *cls,
vrh->issuer_attribute = GNUNET_strdup (issuer_attribute);
if (0 == strlen (issuer_attribute))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No issuer attribute provided!\n");
send_lookup_response (vrh);
return;
@@ -907,7 +909,7 @@ handle_verify (void *cls,
* TODO: cleanup!
*/
credentials_count = ntohl(v_msg->c_count);
- credential_data_size = ntohs (v_msg->header.size)
+ credential_data_size = ntohs (v_msg->header.size)
- sizeof (struct VerifyMessage)
- ntohs (v_msg->issuer_attribute_len)
- 1;
@@ -918,7 +920,7 @@ handle_verify (void *cls,
credentials_count,
credentials))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Cannot deserialize credentials!\n");
send_lookup_response (vrh);
return;
@@ -1015,7 +1017,7 @@ handle_cred_collection_finished_cb (void *cls)
static void
handle_collect (void *cls,
- const struct CollectMessage *c_msg)
+ const struct CollectMessage *c_msg)
{
char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1];
char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1];
@@ -1030,7 +1032,9 @@ handle_collect (void *cls,
utf_in = (const char *) &c_msg[1];
GNUNET_STRINGS_utf8_tolower (utf_in, attrptr);
- GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len));
+ GNUNET_memcpy (issuer_attribute,
+ attr,
+ ntohs (c_msg->issuer_attribute_len));
issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0';
vrh = GNUNET_new (struct VerifyRequestHandle);
GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh);
@@ -1043,7 +1047,7 @@ handle_collect (void *cls,
if (0 == strlen (issuer_attribute))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No issuer attribute provided!\n");
send_lookup_response (vrh);
return;
diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/credential/plugin_gnsrecord_credential.c
index ffb2857dc..cba362a50 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -62,9 +62,9 @@ credential_value_to_string (void *cls,
int i;
if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord))
return NULL; /* malformed */
- memcpy (&sets,
- data,
- sizeof (sets));
+ GNUNET_memcpy (&sets,
+ data,
+ sizeof (sets));
cdata = data;
struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets.set_count)];
if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll (sets.data_size),
@@ -224,7 +224,7 @@ credential_string_to_value (void *cls,
}
tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries,
set);
-
+
if (-1 == tmp_data_size)
{
GNUNET_free (tmp_str);
@@ -248,7 +248,7 @@ credential_string_to_value (void *cls,
return GNUNET_OK;
}
case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
- {
+ {
struct GNUNET_CREDENTIAL_Credential *cred;
cred = GNUNET_CREDENTIAL_credential_from_string (s);
diff --git a/src/credential/plugin_rest_credential.c b/src/credential/plugin_rest_credential.c
index 2e43139de..7f39b34ea 100644
--- a/src/credential/plugin_rest_credential.c
+++ b/src/credential/plugin_rest_credential.c
@@ -309,14 +309,14 @@ json_to_credential (json_t *res)
sig,
sizeof (struct GNUNET_CRYPTO_EcdsaSignature));
GNUNET_free (sig);
-
+
tmp = json_object_get (res, "expiration");
if (0 == json_is_integer (tmp))
{
GNUNET_free (cred);
return NULL;
}
- cred->expiration.abs_value_us = json_integer_value (tmp);
+ cred->expiration.abs_value_us = json_integer_value (tmp);
return cred;
}
@@ -342,7 +342,7 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Issuer in credential malformed\n");
return NULL;
- }
+ }
subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key);
if (NULL == subject)
{
@@ -354,9 +354,9 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred)
GNUNET_STRINGS_base64_encode ((char*)&cred->signature,
sizeof (struct GNUNET_CRYPTO_EcdsaSignature),
&signature);
- memcpy (attribute,
- cred->issuer_attribute,
- cred->issuer_attribute_len);
+ GNUNET_memcpy (attribute,
+ cred->issuer_attribute,
+ cred->issuer_attribute_len);
attribute[cred->issuer_attribute_len] = '\0';
cred_obj = json_object ();
json_object_set_new (cred_obj, "issuer", json_string (issuer));
@@ -570,7 +570,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Missing issuer attribute\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
@@ -585,7 +585,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- if (GNUNET_OK !=
+ if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp,
strlen (tmp),
&handle->issuer_key))
@@ -626,7 +626,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed subject\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg,
@@ -679,7 +679,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Missing issuer attribute\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
@@ -694,7 +694,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- if (GNUNET_OK !=
+ if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp,
strlen (tmp),
&handle->issuer_key))
@@ -735,7 +735,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed subject\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
if (GNUNET_OK !=
@@ -946,7 +946,7 @@ get_cred_issuer_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Missing expiration\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
@@ -955,7 +955,7 @@ get_cred_issuer_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Expiration malformed\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -968,7 +968,7 @@ get_cred_issuer_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed expiration: %s\n", expiration_str);
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR,
@@ -980,10 +980,10 @@ get_cred_issuer_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Missing issuer attribute\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get
+ handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get
(handle->rest_handle->url_param_map,
&key));
GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY,
@@ -1004,7 +1004,7 @@ get_cred_issuer_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed subject\n");
- GNUNET_SCHEDULER_add_now (&do_error, handle);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
if (GNUNET_OK !=
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c
index 647ce70cc..b1068a6de 100644
--- a/src/dns/dnsstub.c
+++ b/src/dns/dnsstub.c
@@ -688,14 +688,14 @@ GNUNET_DNSSTUB_add_dns_sa (struct GNUNET_DNSSTUB_Context *ctx,
switch (sa->sa_family)
{
case AF_INET:
- memcpy (&ds->ss,
- sa,
- sizeof (struct sockaddr_in));
+ GNUNET_memcpy (&ds->ss,
+ sa,
+ sizeof (struct sockaddr_in));
break;
case AF_INET6:
- memcpy (&ds->ss,
- sa,
- sizeof (struct sockaddr_in6));
+ GNUNET_memcpy (&ds->ss,
+ sa,
+ sizeof (struct sockaddr_in6));
break;
default:
GNUNET_break (0);
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index b5e8af95f..f3cc03adc 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -528,9 +528,9 @@ GNUNET_FS_add_to_index (const char *filename,
ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
ii->file_id = *file_id;
ii->filename = (const char *) &ii[1];
- memcpy (&ii[1],
- filename,
- slen);
+ GNUNET_memcpy (&ii[1],
+ filename,
+ slen);
GNUNET_CONTAINER_DLL_insert (indexed_files_head,
indexed_files_tail,
ii);
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c
index af5c27c8c..afa540c85 100644
--- a/src/gns/gnunet-gns-benchmark.c
+++ b/src/gns/gnunet-gns-benchmark.c
@@ -439,9 +439,9 @@ queue (const char *hostname,
req = GNUNET_malloc (sizeof (struct Request) + hlen);
req->cat = cat;
req->hostname = (char *) &req[1];
- memcpy (req->hostname,
- hostname,
- hlen);
+ GNUNET_memcpy (req->hostname,
+ hostname,
+ hlen);
GNUNET_CONTAINER_DLL_insert (todo_head,
todo_tail,
req);
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 71d4e95d8..542085910 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -818,7 +818,9 @@ add_dns_result (struct GNS_ResolverHandle *rh,
res->data_size = data_size;
res->record_type = record_type;
res->data = &res[1];
- GNUNET_memcpy (&res[1], data, data_size);
+ GNUNET_memcpy (&res[1],
+ data,
+ data_size);
GNUNET_CONTAINER_DLL_insert (rh->dns_result_head,
rh->dns_result_tail,
res);
@@ -1516,9 +1518,9 @@ handle_gns2dns_ip (void *cls,
continue_with_gns2dns (ac);
return;
}
- memcpy (&ss,
- addr,
- addrlen);
+ GNUNET_memcpy (&ss,
+ addr,
+ addrlen);
switch (ss.ss_family)
{
case AF_INET:
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index 07d1a9c04..b88e8fcc2 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -102,9 +102,9 @@ gns_value_to_string (void *cls,
('\0' != cdata[data_size - 1]) )
return NULL; /* malformed */
/* need to memcpy for alignment */
- memcpy (&vpn,
- data,
- sizeof (vpn));
+ GNUNET_memcpy (&vpn,
+ data,
+ sizeof (vpn));
GNUNET_asprintf (&vpn_str,
"%u %s %s",
(unsigned int) ntohs (vpn.proto),
@@ -122,9 +122,9 @@ gns_value_to_string (void *cls,
cdata = data;
if (data_size < sizeof (struct GNUNET_GNSRECORD_BoxRecord))
return NULL; /* malformed */
- memcpy (&box,
- data,
- sizeof (box));
+ GNUNET_memcpy (&box,
+ data,
+ sizeof (box));
rt = ntohl (box.record_type);
ival = GNUNET_GNSRECORD_value_to_string (rt,
&cdata[sizeof (box)],
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c
index 3da24d72a..56521945d 100644
--- a/src/gnsrecord/gnsrecord_serialization.c
+++ b/src/gnsrecord/gnsrecord_serialization.c
@@ -84,11 +84,10 @@ size_t
GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd)
{
- unsigned int i;
size_t ret;
ret = sizeof (struct NetworkRecord) * rd_count;
- for (i=0;i<rd_count;i++)
+ for (unsigned int i=0;i<rd_count;i++)
{
GNUNET_assert ((ret + rd[i].data_size) >= ret);
ret += rd[i].data_size;
@@ -113,11 +112,10 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
char *dest)
{
struct NetworkRecord rec;
- unsigned int i;
size_t off;
off = 0;
- for (i=0;i<rd_count;i++)
+ for (unsigned int i=0;i<rd_count;i++)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Serializing record %u with flags %d and expiration time %llu\n",
@@ -168,7 +166,9 @@ GNUNET_GNSRECORD_records_deserialize (size_t len,
{
if (off + sizeof (rec) > len)
return GNUNET_SYSERR;
- GNUNET_memcpy (&rec, &src[off], sizeof (rec));
+ GNUNET_memcpy (&rec,
+ &src[off],
+ sizeof (rec));
dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time);
dest[i].data_size = ntohl ((uint32_t) rec.data_size);
dest[i].record_type = ntohl (rec.record_type);
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c
index 47217442a..6d30f9e2a 100644
--- a/src/identity-provider/identity_provider_api.c
+++ b/src/identity-provider/identity_provider_api.c
@@ -71,7 +71,7 @@ struct GNUNET_IDENTITY_PROVIDER_Operation
* Attribute result callback
*/
GNUNET_IDENTITY_PROVIDER_AttributeResult ar_cb;
-
+
/**
* Revocation result callback
*/
@@ -613,7 +613,7 @@ handle_attribute_result (void *cls,
it->finish_cb (it->finish_cb_cls);
free_it (it);
}
- if (NULL != op)
+ if (NULL != op)
{
if (NULL != op->ar_cb)
op->ar_cb (op->cls,
@@ -953,7 +953,7 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle
/**
- * List all attributes for a local identity.
+ * List all attributes for a local identity.
* This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle`
* for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and
* #GNUNET_IDENTITY_PROVIDER_get_attributes_stop. @a proc will be called once
@@ -1370,9 +1370,9 @@ GNUNET_IDENTITY_PROVIDER_ticket_revoke (struct GNUNET_IDENTITY_PROVIDER_Handle *
GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET);
msg->id = htonl (rid);
msg->identity = *identity;
- memcpy (&msg[1],
- ticket,
- sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket));
+ GNUNET_memcpy (&msg[1],
+ ticket,
+ sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket));
if (NULL == h->mq)
op->env = env;
else
diff --git a/src/multicast/test_multicast_2peers.c b/src/multicast/test_multicast_2peers.c
index 8ce4d585f..ad1a48d6c 100644
--- a/src/multicast/test_multicast_2peers.c
+++ b/src/multicast/test_multicast_2peers.c
@@ -223,8 +223,11 @@ origin_notify (void *cls,
void *data)
{
char text[] = "pong";
+
*data_size = strlen(text)+1;
- memcpy(data, text, *data_size);
+ GNUNET_memcpy (data,
+ text,
+ *data_size);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends (to all): %s\n", text);
diff --git a/src/multicast/test_multicast_multipeer.c b/src/multicast/test_multicast_multipeer.c
index d1ed1cb39..96e86cbb4 100644
--- a/src/multicast/test_multicast_multipeer.c
+++ b/src/multicast/test_multicast_multipeer.c
@@ -54,7 +54,7 @@ enum pingpong
struct pingpong_msg
{
int peer;
- enum pingpong msg;
+ enum pingpong msg;
};
static void service_connect (void *cls,
@@ -143,13 +143,13 @@ member_join_request (void *cls,
{
struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Peer #%u (%s) sent a join request.\n",
- mc_peer->peer,
+ "Peer #%u (%s) sent a join request.\n",
+ mc_peer->peer,
GNUNET_i2s (multicast_peers[mc_peer->peer]->id));
}
-static int
+static int
notify (void *cls,
size_t *data_size,
void *data)
@@ -163,7 +163,7 @@ notify (void *cls,
*data_size = sizeof (struct pingpong_msg);
GNUNET_memcpy(data, pp_msg, *data_size);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Peer #%u sents ping to origin\n", mc_peer->peer);
return GNUNET_YES;
@@ -179,20 +179,20 @@ member_join_decision (void *cls,
const struct GNUNET_MessageHeader *join_msg)
{
struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Peer #%u (%s) received a decision from origin: %s\n",
- mc_peer->peer,
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Peer #%u (%s) received a decision from origin: %s\n",
+ mc_peer->peer,
GNUNET_i2s (multicast_peers[mc_peer->peer]->id),
(GNUNET_YES == is_admitted)?"accepted":"rejected");
-
+
if (GNUNET_YES == is_admitted)
{
GNUNET_MULTICAST_member_to_origin (members[mc_peer->peer],
0,
notify,
cls);
-
+
}
}
@@ -236,7 +236,7 @@ member_disconnected_cb (void *cls)
static void
-member_message (void *cls,
+member_message (void *cls,
const struct GNUNET_MULTICAST_MessageHeader *msg)
{
struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls;
@@ -245,7 +245,7 @@ member_message (void *cls,
if (PONG == pp_msg->msg && mc_peer->peer == pp_msg->peer)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "peer #%i (%s) receives a pong\n",
+ "peer #%i (%s) receives a pong\n",
mc_peer->peer,
GNUNET_i2s (multicast_peers[mc_peer->peer]->id));
mc_peer->test_ok = GNUNET_OK;
@@ -269,9 +269,9 @@ origin_join_request (void *cls,
uint8_t data_size = ntohs (join_msg->size);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"origin got a join request...\n");
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"origin receives: '%s'\n", (char *)&join_msg[1]);
char data[] = "Come in!";
@@ -281,7 +281,7 @@ origin_join_request (void *cls,
join_resp->type = htons (123);
GNUNET_memcpy (&join_resp[1], data, data_size);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"origin sends: '%s'\n", data);
GNUNET_MULTICAST_join_decision (jh,
@@ -311,7 +311,7 @@ origin_replay_msg (void *cls,
uint64_t message_id,
uint64_t fragment_offset,
uint64_t flags,
- struct GNUNET_MULTICAST_ReplayHandle *rh)
+ struct GNUNET_MULTICAST_ReplayHandle *rh)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay msg\n");
@@ -319,8 +319,8 @@ origin_replay_msg (void *cls,
static int
-origin_notify (void *cls,
- size_t *data_size,
+origin_notify (void *cls,
+ size_t *data_size,
void *data)
{
struct pingpong_msg *rcv_pp_msg = (struct pingpong_msg*)cls;
@@ -329,11 +329,11 @@ origin_notify (void *cls,
pp_msg->peer = rcv_pp_msg->peer;
pp_msg->msg = PONG;
*data_size = sizeof (struct pingpong_msg);
- memcpy(data, pp_msg, *data_size);
+ GNUNET_memcpy(data, pp_msg, *data_size);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n");
- return GNUNET_YES;
+ return GNUNET_YES;
}
@@ -345,7 +345,7 @@ origin_request (void *cls,
req++;
struct pingpong_msg *pp_msg = (struct pingpong_msg *) req;
-
+
if (1 != pp_msg->msg) {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "origin didn't reveice a correct request");
}
@@ -360,7 +360,7 @@ origin_request (void *cls,
static void
origin_message (void *cls,
- const struct GNUNET_MULTICAST_MessageHeader *msg)
+ const struct GNUNET_MULTICAST_MessageHeader *msg)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin message msg\n");
}
@@ -386,7 +386,7 @@ multicast_connect (void *cls,
{
group_key = GNUNET_CRYPTO_eddsa_key_create ();
GNUNET_CRYPTO_eddsa_key_get_public (group_key, &group_pub_key);
-
+
GNUNET_CRYPTO_hash (&group_pub_key, sizeof (group_pub_key), &group_pub_key_hash);
origin = GNUNET_MULTICAST_origin_start (cfg,
group_key,
@@ -414,7 +414,7 @@ multicast_connect (void *cls,
{
multicast_peer->key = GNUNET_CRYPTO_ecdsa_key_create ();
- sprintf(data, "Hi, I am peer #%u (%s). Can I enter?",
+ sprintf(data, "Hi, I am peer #%u (%s). Can I enter?",
multicast_peer->peer,
GNUNET_i2s (multicast_peers[multicast_peer->peer]->id));
uint8_t data_size = strlen (data) + 1;
@@ -424,7 +424,7 @@ multicast_connect (void *cls,
GNUNET_memcpy (&join_msg[1], data, data_size);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Peer #%u (%s) tries to join multicast group %s\n",
+ "Peer #%u (%s) tries to join multicast group %s\n",
multicast_peer->peer,
GNUNET_i2s (multicast_peers[multicast_peer->peer]->id),
GNUNET_h2s (&group_pub_key_hash));
@@ -465,12 +465,12 @@ peer_information_cb (void *cls,
multicast_peers[mc_peer->peer]->id = pinfo->result.id;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Got peer information of %s (%s)\n",
- (0 == mc_peer->peer)? "origin" : "member",
+ "Got peer information of %s (%s)\n",
+ (0 == mc_peer->peer)? "origin" : "member",
GNUNET_i2s (pinfo->result.id));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Create peer #%u (%s)\n",
+ "Create peer #%u (%s)\n",
mc_peer->peer,
GNUNET_i2s (multicast_peers[mc_peer->peer]->id));
@@ -479,7 +479,7 @@ peer_information_cb (void *cls,
/* connect to multicast service of members */
op[mc_peer->peer] =
GNUNET_TESTBED_service_connect (/* Closure for operation */
- NULL,
+ NULL,
/* The peer whose service to connect to */
peers[mc_peer->peer],
/* The name of the service */
@@ -508,8 +508,8 @@ service_connect (void *cls,
if (NULL == ca_result)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connection adapter not created for peer #%u (%s)\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Connection adapter not created for peer #%u (%s)\n",
mc_peer->peer,
GNUNET_i2s (multicast_peers[mc_peer->peer]->id));
@@ -519,8 +519,8 @@ service_connect (void *cls,
if (0 == mc_peer->peer)
{
- // Get GNUnet identity of members
- for (int i = 0; i<PEERS_REQUESTED; i++)
+ // Get GNUnet identity of members
+ for (int i = 0; i<PEERS_REQUESTED; i++)
{
pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i],
GNUNET_TESTBED_PIT_IDENTITY,
@@ -547,7 +547,7 @@ service_connect (void *cls,
* @param PEERS_REQUESTED size of the 'peers' array
* @param links_succeeded number of links between peers that were created
* @param links_failed number of links testbed was unable to establish
- */
+ */
static void
testbed_master (void *cls,
struct GNUNET_TESTBED_RunHandle *h,
@@ -562,7 +562,7 @@ testbed_master (void *cls,
multicast_peers = GNUNET_new_array (PEERS_REQUESTED, struct MulticastPeerContext*);
// Create test contexts for members
- for (int i = 0; i<PEERS_REQUESTED; i++)
+ for (int i = 0; i<PEERS_REQUESTED; i++)
{
multicast_peers[i] = GNUNET_new (struct MulticastPeerContext);
multicast_peers[i]->peer = i;
@@ -604,7 +604,7 @@ main (int argc, char *argv[])
int ret;
char const *config_file;
- if (strstr (argv[0], "_line") != NULL)
+ if (strstr (argv[0], "_line") != NULL)
{
config_file = "test_multicast_line.conf";
}
@@ -612,7 +612,7 @@ main (int argc, char *argv[])
{
config_file = "test_multicast_star.conf";
}
- else
+ else
{
config_file = "test_multicast_star.conf";
}
@@ -620,19 +620,19 @@ main (int argc, char *argv[])
result = GNUNET_SYSERR;
ret =
GNUNET_TESTBED_test_run ("test-multicast-multipeer",
- config_file,
+ config_file,
/* number of peers to start */
- PEERS_REQUESTED,
+ PEERS_REQUESTED,
/* Event mask - set to 0 for no event notifications */
- 0LL,
+ 0LL,
/* Controller event callback */
- NULL,
+ NULL,
/* Closure for controller event callback */
- NULL,
+ NULL,
/* called when testbed setup is complete */
- testbed_master,
+ testbed_master,
/* Closure for the test_master callback */
- NULL);
+ NULL);
if ( (GNUNET_OK != ret) || (GNUNET_OK != result) )
return 1;
return 0;
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index b47b89fe8..5e654dbde 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1417,17 +1417,17 @@ handle_record_store (void *cls,
sa);
sa->nc = nc;
sa->rsm = (const struct RecordStoreMessage *) &sa[1];
- memcpy (&sa[1],
- rp_msg,
- ntohs (rp_msg->gns_header.header.size));
+ GNUNET_memcpy (&sa[1],
+ rp_msg,
+ ntohs (rp_msg->gns_header.header.size));
sa->zm_pos = monitor_head;
sa->conv_name = conv_name;
GNUNET_array_grow (sa->rd,
sa->rd_count,
rd_clean_off);
- memcpy (sa->rd,
- rd_clean,
- sizeof (struct GNUNET_GNSRECORD_Data) * rd_clean_off);
+ GNUNET_memcpy (sa->rd,
+ rd_clean,
+ sizeof (struct GNUNET_GNSRECORD_Data) * rd_clean_off);
continue_store_activity (sa);
}
}
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 97133766e..b394178a6 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -434,9 +434,9 @@ get_label (struct Request *req)
GNUNET_break (0);
return NULL;
}
- memcpy (label,
- req->hostname,
- dot - req->hostname);
+ GNUNET_memcpy (label,
+ req->hostname,
+ dot - req->hostname);
label[dot - req->hostname] = '\0';
return label;
}
@@ -491,9 +491,9 @@ build_dns_query (struct Request *req,
GNUNET_free (rawp);
return NULL;
}
- memcpy (raw,
- rawp,
- *raw_size);
+ GNUNET_memcpy (raw,
+ rawp,
+ *raw_size);
GNUNET_free (rawp);
return raw;
}
@@ -1683,9 +1683,9 @@ queue (const char *hostname)
req = GNUNET_malloc (sizeof (struct Request) + hlen);
req->zone = zone;
req->hostname = (char *) &req[1];
- memcpy (req->hostname,
- hostname,
- hlen);
+ GNUNET_memcpy (req->hostname,
+ hostname,
+ hlen);
req->id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
UINT16_MAX);
GNUNET_CRYPTO_hash (req->hostname,
diff --git a/src/nat/gnunet-helper-nat-client.c b/src/nat/gnunet-helper-nat-client.c
index d9129afb0..9768dd856 100644
--- a/src/nat/gnunet-helper-nat-client.c
+++ b/src/nat/gnunet-helper-nat-client.c
@@ -251,14 +251,18 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
ip_pkt.dst_ip = other->s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off],
+ &ip_pkt,
+ sizeof (struct ip_header));
off += sizeof (struct ip_header);
icmp_pkt.type = ICMP_TIME_EXCEEDED;
icmp_pkt.code = 0;
icmp_pkt.checksum = 0;
icmp_pkt.unused = 0;
- memcpy (&packet[off], &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[off],
+ &icmp_pkt,
+ sizeof (struct icmp_ttl_exceeded_header));
off += sizeof (struct icmp_ttl_exceeded_header);
/* ip header of the presumably 'lost' udp packet */
@@ -275,7 +279,9 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
ip_pkt.dst_ip = dummy.s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off],
+ &ip_pkt,
+ sizeof (struct ip_header));
off += sizeof (struct ip_header);
/* build UDP header */
@@ -283,7 +289,9 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
udp_pkt.dst_port = htons (NAT_TRAV_PORT);
udp_pkt.length = htons (port);
udp_pkt.crc = 0;
- memcpy (&packet[off], &udp_pkt, sizeof (struct udp_header));
+ GNUNET_memcpy (&packet[off],
+ &udp_pkt,
+ sizeof (struct udp_header));
off += sizeof (struct udp_header);
/* set ICMP checksum */
@@ -292,8 +300,9 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
((uint16_t *) & packet[sizeof (struct ip_header)],
sizeof (struct icmp_ttl_exceeded_header) +
sizeof (struct ip_header) + sizeof (struct udp_header)));
- memcpy (&packet[sizeof (struct ip_header)], &icmp_pkt,
- sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[sizeof (struct ip_header)],
+ &icmp_pkt,
+ sizeof (struct icmp_ttl_exceeded_header));
memset (&dst, 0, sizeof (dst));
dst.sin_family = AF_INET;
@@ -352,7 +361,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
ip_pkt.dst_ip = other->s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off],
+ &ip_pkt,
+ sizeof (struct ip_header));
off = sizeof (ip_pkt);
/* icmp reply: time exceeded */
@@ -360,7 +371,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
icmp_ttl.code = 0;
icmp_ttl.checksum = 0;
icmp_ttl.unused = 0;
- memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[off],
+ &icmp_ttl,
+ sizeof (struct icmp_ttl_exceeded_header));
off += sizeof (struct icmp_ttl_exceeded_header);
/* ip header of the presumably 'lost' udp packet */
@@ -377,7 +390,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
ip_pkt.checksum = 0;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off],
+ &ip_pkt,
+ sizeof (struct ip_header));
off += sizeof (struct ip_header);
icmp_echo.type = ICMP_ECHO;
@@ -386,8 +401,10 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
icmp_echo.checksum = 0;
icmp_echo.checksum =
htons (calc_checksum
- ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header)));
- memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
+ ((uint16_t *) &icmp_echo, sizeof (struct icmp_echo_header)));
+ GNUNET_memcpy (&packet[off],
+ &icmp_echo,
+ sizeof (struct icmp_echo_header));
/* no go back to calculate ICMP packet checksum */
off = sizeof (struct ip_header);
@@ -396,7 +413,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
((uint16_t *) & packet[off],
sizeof (struct icmp_ttl_exceeded_header) +
sizeof (struct ip_header) + sizeof (struct icmp_echo_header)));
- memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[off],
+ &icmp_ttl,
+ sizeof (struct icmp_ttl_exceeded_header));
/* prepare for transmission */
memset (&dst, 0, sizeof (dst));
diff --git a/src/nat/gnunet-helper-nat-server.c b/src/nat/gnunet-helper-nat-server.c
index ef8e97482..f35649152 100644
--- a/src/nat/gnunet-helper-nat-server.c
+++ b/src/nat/gnunet-helper-nat-server.c
@@ -266,9 +266,9 @@ send_icmp_echo (const struct in_addr *my_ip)
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt,
sizeof (struct ip_header)));
- memcpy (&packet[off],
- &ip_pkt,
- sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off],
+ &ip_pkt,
+ sizeof (struct ip_header));
off += sizeof (struct ip_header);
icmp_echo.type = ICMP_ECHO;
@@ -279,9 +279,9 @@ send_icmp_echo (const struct in_addr *my_ip)
htons (calc_checksum
((uint16_t *) & icmp_echo,
sizeof (struct icmp_echo_header)));
- memcpy (&packet[off],
- &icmp_echo,
- sizeof (struct icmp_echo_header));
+ GNUNET_memcpy (&packet[off],
+ &icmp_echo,
+ sizeof (struct icmp_echo_header));
off += sizeof (struct icmp_echo_header);
memset (&dst, 0, sizeof (dst));
@@ -388,9 +388,13 @@ process_icmp_response ()
return;
}
off = 0;
- memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
+ GNUNET_memcpy (&ip_pkt,
+ &buf[off],
+ sizeof (struct ip_header));
off += sizeof (struct ip_header);
- memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&icmp_ttl,
+ &buf[off],
+ sizeof (struct icmp_ttl_exceeded_header));
off += sizeof (struct icmp_ttl_exceeded_header);
if ((ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code))
{
@@ -401,7 +405,9 @@ process_icmp_response ()
source_ip.s_addr = ip_pkt.src_ip;
/* skip 2nd IP header */
- memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
+ GNUNET_memcpy (&ip_pkt,
+ &buf[off],
+ sizeof (struct ip_header));
off += sizeof (struct ip_header);
switch (ip_pkt.proto)
@@ -416,7 +422,9 @@ process_icmp_response ()
return;
}
/* grab ICMP ECHO content */
- memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header));
+ GNUNET_memcpy (&icmp_echo,
+ &buf[off],
+ sizeof (struct icmp_echo_header));
port = (uint16_t) ntohl (icmp_echo.reserved);
break;
case IPPROTO_UDP:
@@ -428,7 +436,9 @@ process_icmp_response ()
return;
}
/* grab UDP content */
- memcpy (&udp_pkt, &buf[off], sizeof (struct udp_header));
+ GNUNET_memcpy (&udp_pkt,
+ &buf[off],
+ sizeof (struct udp_header));
port = ntohs (udp_pkt.length);
break;
default:
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index 0695c7ac7..21089890d 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -1234,8 +1234,12 @@ process_external_ip (void *cls,
ch->hole_external);
/* build sockaddr storage with port number */
- memset (&ss, 0, sizeof (ss));
- memcpy (&ss, addr, addrlen);
+ memset (&ss,
+ 0,
+ sizeof (ss));
+ GNUNET_memcpy (&ss,
+ addr,
+ addrlen);
switch (addr->sa_family)
{
case AF_INET:
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c
index 814380246..c5f9f6cf0 100644
--- a/src/regex/regex_test_lib.c
+++ b/src/regex/regex_test_lib.c
@@ -172,9 +172,9 @@ move_children (struct RegexCombineCtx *dst,
size_t array_size;
array_size = sizeof(struct RegexCombineCtx *) * src->size;
- memcpy (dst->children,
- src->children,
- array_size);
+ GNUNET_memcpy (dst->children,
+ src->children,
+ array_size);
for (unsigned int i = 0; i < src->size; i++)
{
src->children[i] = NULL;
@@ -364,7 +364,9 @@ regex_add_multiple (struct RegexCombineCtx *ctx,
newctx = new_regex_ctx(ctx->size);
newctx->s = GNUNET_strdup (tmp);
if (children != NULL)
- memcpy (newctx->children, children, sizeof (*children) * ctx->size);
+ GNUNET_memcpy (newctx->children,
+ children,
+ sizeof (*children) * ctx->size);
ctx->children[c2i(tmp[0], ctx->size)] = newctx;
}
}
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 8d31bf50d..b433a51d4 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1836,7 +1836,7 @@ static uint32_t binom (uint32_t n, uint32_t k)
* @param a
* @param b
*
- * @return
+ * @return
*/
static int is_in_view (uint32_t a, uint32_t b)
{
@@ -2172,9 +2172,9 @@ void view_update_cb (void *cls,
rps_peer->cur_view_count,
view_size);
//*rps_peer->cur_view = *peers;
- memcpy (rps_peer->cur_view,
- peers,
- view_size * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (rps_peer->cur_view,
+ peers,
+ view_size * sizeof (struct GNUNET_PeerIdentity));
to_file ("/tmp/rps/count_in_views.txt",
"%" PRIu64 " %" PRIu32 "",
rps_peer->index,
diff --git a/src/util/crypto_abe.c b/src/util/crypto_abe.c
index fcaa826ed..a5cdb2823 100644
--- a/src/util/crypto_abe.c
+++ b/src/util/crypto_abe.c
@@ -53,12 +53,14 @@ init_aes( element_t k, int enc,
int rc;
int key_len;
unsigned char* key_buf;
-
+
key_len = element_length_in_bytes(k) < 33 ? 3 : element_length_in_bytes(k);
key_buf = (unsigned char*) malloc(key_len);
element_to_bytes(key_buf, k);
- memcpy (key->aes_key, key_buf, GNUNET_CRYPTO_AES_KEY_LENGTH);
+ GNUNET_memcpy (key->aes_key,
+ key_buf,
+ GNUNET_CRYPTO_AES_KEY_LENGTH);
GNUNET_assert (0 ==
gcry_cipher_open (handle, GCRY_CIPHER_AES256,
GCRY_CIPHER_MODE_CFB, 0));
@@ -123,16 +125,16 @@ aes_128_cbc_decrypt( char* ct,
unsigned char iv[16];
char* tmp;
uint32_t len;
-
+
init_aes(k, 1, &handle, &skey, iv);
tmp = GNUNET_malloc (size);
//AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT);
- GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size));
+ GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size));
gcry_cipher_close (handle);
/* TODO make less crufty */
-
+
/* get real length */
len = 0;
len = len
@@ -173,7 +175,7 @@ GNUNET_CRYPTO_cpabe_create_key (struct GNUNET_CRYPTO_AbeMasterKey *key,
struct GNUNET_CRYPTO_AbeKey *prv_key;
int size;
char *tmp;
-
+
prv_key = GNUNET_new (struct GNUNET_CRYPTO_AbeKey);
prv_key->prv = gabe_keygen(key->pub, key->msk, attrs);
size = gabe_pub_serialize(key->pub, &tmp);
@@ -204,7 +206,7 @@ write_cpabe (void **result,
{
char *ptr;
uint32_t *len;
-
+
*result = GNUNET_malloc (12 + cph_buf_len + aes_buf_len);
ptr = *result;
len = (uint32_t*) ptr;
@@ -213,12 +215,12 @@ write_cpabe (void **result,
len = (uint32_t*) ptr;
*len = htonl (aes_buf_len);
ptr += 4;
- memcpy (ptr, aes_buf, aes_buf_len);
+ GNUNET_memcpy (ptr, aes_buf, aes_buf_len);
ptr += aes_buf_len;
len = (uint32_t*) ptr;
*len = htonl (cph_buf_len);
ptr += 4;
- memcpy (ptr, cph_buf, cph_buf_len);
+ GNUNET_memcpy (ptr, cph_buf, cph_buf_len);
return 12 + cph_buf_len + aes_buf_len;
}
@@ -241,13 +243,13 @@ read_cpabe (const void *data,
*aes_buf_len = ntohl (*len);
ptr += 4;
*aes_buf = GNUNET_malloc (*aes_buf_len);
- memcpy(*aes_buf, ptr, *aes_buf_len);
+ GNUNET_memcpy (*aes_buf, ptr, *aes_buf_len);
ptr += *aes_buf_len;
len = (uint32_t*)ptr;
*cph_buf_len = ntohl (*len);
ptr += 4;
*cph_buf = GNUNET_malloc (*cph_buf_len);
- memcpy(*cph_buf, ptr, *cph_buf_len);
+ GNUNET_memcpy (*cph_buf, ptr, *cph_buf_len);
return buf_len;
}
@@ -362,7 +364,7 @@ GNUNET_CRYPTO_cpabe_deserialize_key (const void *data,
&prv_len);
key->pub = gabe_pub_unserialize (pub, pub_len);
key->prv = gabe_prv_unserialize (key->pub, prv, prv_len);
-
+
GNUNET_free (pub);
GNUNET_free (prv);
return key;
@@ -408,7 +410,7 @@ GNUNET_CRYPTO_cpabe_deserialize_master_key (const void *data,
&msk_len);
key->pub = gabe_pub_unserialize (pub, pub_len);
key->msk = gabe_msk_unserialize (key->pub, msk, msk_len);
-
+
GNUNET_free (pub);
GNUNET_free (msk);