diff options
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; | |||
2 | struct GNUNET_MessageHeader *msg; | 2 | struct GNUNET_MessageHeader *msg; |
3 | 3 | ||
4 | env = GNUNET_MQ_msg_extra (msg, payload_size, GNUNET_MY_MESSAGE_TYPE); | 4 | env = GNUNET_MQ_msg_extra (msg, payload_size, GNUNET_MY_MESSAGE_TYPE); |
5 | memcpy (&msg[1], &payload, payload_size); | 5 | GNUNET_memcpy (&msg[1], |
6 | &payload, | ||
7 | payload_size); | ||
6 | // Send message via message queue 'mq' | 8 | // Send message via message queue 'mq' |
7 | GNUNET_mq_send (mq, env); | 9 | GNUNET_mq_send (mq, env); |
8 | |||
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, | |||
54 | int rc; | 54 | int rc; |
55 | int key_len; | 55 | int key_len; |
56 | unsigned char* key_buf; | 56 | unsigned char* key_buf; |
57 | 57 | ||
58 | key_len = element_length_in_bytes(k) < 33 ? 3 : element_length_in_bytes(k); | 58 | key_len = element_length_in_bytes(k) < 33 ? 3 : element_length_in_bytes(k); |
59 | key_buf = (unsigned char*) malloc(key_len); | 59 | key_buf = (unsigned char*) malloc(key_len); |
60 | element_to_bytes(key_buf, k); | 60 | element_to_bytes(key_buf, k); |
61 | 61 | ||
62 | memcpy (key->aes_key, key_buf, GNUNET_CRYPTO_AES_KEY_LENGTH); | 62 | GNUNET_memcpy (key->aes_key, key_buf, GNUNET_CRYPTO_AES_KEY_LENGTH); |
63 | GNUNET_assert (0 == | 63 | GNUNET_assert (0 == |
64 | gcry_cipher_open (handle, GCRY_CIPHER_AES256, | 64 | gcry_cipher_open (handle, GCRY_CIPHER_AES256, |
65 | GCRY_CIPHER_MODE_CFB, 0)); | 65 | GCRY_CIPHER_MODE_CFB, 0)); |
@@ -124,16 +124,16 @@ aes_128_cbc_decrypt( char* ct, | |||
124 | unsigned char iv[16]; | 124 | unsigned char iv[16]; |
125 | char* tmp; | 125 | char* tmp; |
126 | uint32_t len; | 126 | uint32_t len; |
127 | 127 | ||
128 | init_aes(k, 1, &handle, &skey, iv); | 128 | init_aes(k, 1, &handle, &skey, iv); |
129 | 129 | ||
130 | tmp = GNUNET_malloc (size); | 130 | tmp = GNUNET_malloc (size); |
131 | 131 | ||
132 | //AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT); | 132 | //AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT); |
133 | GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size)); | 133 | GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size)); |
134 | gcry_cipher_close (handle); | 134 | gcry_cipher_close (handle); |
135 | /* TODO make less crufty */ | 135 | /* TODO make less crufty */ |
136 | 136 | ||
137 | /* get real length */ | 137 | /* get real length */ |
138 | len = 0; | 138 | len = 0; |
139 | len = len | 139 | len = len |
@@ -195,7 +195,7 @@ GNUNET_ABE_cpabe_create_key (struct GNUNET_ABE_AbeMasterKey *key, | |||
195 | struct GNUNET_ABE_AbeKey *prv_key; | 195 | struct GNUNET_ABE_AbeKey *prv_key; |
196 | int size; | 196 | int size; |
197 | char *tmp; | 197 | char *tmp; |
198 | 198 | ||
199 | prv_key = GNUNET_new (struct GNUNET_ABE_AbeKey); | 199 | prv_key = GNUNET_new (struct GNUNET_ABE_AbeKey); |
200 | prv_key->prv = gabe_keygen(key->pub, key->msk, attrs); | 200 | prv_key->prv = gabe_keygen(key->pub, key->msk, attrs); |
201 | size = gabe_pub_serialize(key->pub, &tmp); | 201 | size = gabe_pub_serialize(key->pub, &tmp); |
@@ -234,7 +234,7 @@ write_cpabe (void **result, | |||
234 | { | 234 | { |
235 | char *ptr; | 235 | char *ptr; |
236 | uint32_t *len; | 236 | uint32_t *len; |
237 | 237 | ||
238 | *result = GNUNET_malloc (12 + cph_buf_len + aes_buf_len); | 238 | *result = GNUNET_malloc (12 + cph_buf_len + aes_buf_len); |
239 | ptr = *result; | 239 | ptr = *result; |
240 | len = (uint32_t*) ptr; | 240 | len = (uint32_t*) ptr; |
@@ -243,12 +243,12 @@ write_cpabe (void **result, | |||
243 | len = (uint32_t*) ptr; | 243 | len = (uint32_t*) ptr; |
244 | *len = htonl (aes_buf_len); | 244 | *len = htonl (aes_buf_len); |
245 | ptr += 4; | 245 | ptr += 4; |
246 | memcpy (ptr, aes_buf, aes_buf_len); | 246 | GNUNET_memcpy (ptr, aes_buf, aes_buf_len); |
247 | ptr += aes_buf_len; | 247 | ptr += aes_buf_len; |
248 | len = (uint32_t*) ptr; | 248 | len = (uint32_t*) ptr; |
249 | *len = htonl (cph_buf_len); | 249 | *len = htonl (cph_buf_len); |
250 | ptr += 4; | 250 | ptr += 4; |
251 | memcpy (ptr, cph_buf, cph_buf_len); | 251 | GNUNET_memcpy (ptr, cph_buf, cph_buf_len); |
252 | return 12 + cph_buf_len + aes_buf_len; | 252 | return 12 + cph_buf_len + aes_buf_len; |
253 | } | 253 | } |
254 | 254 | ||
@@ -271,13 +271,13 @@ read_cpabe (const void *data, | |||
271 | *aes_buf_len = ntohl (*len); | 271 | *aes_buf_len = ntohl (*len); |
272 | ptr += 4; | 272 | ptr += 4; |
273 | *aes_buf = GNUNET_malloc (*aes_buf_len); | 273 | *aes_buf = GNUNET_malloc (*aes_buf_len); |
274 | memcpy(*aes_buf, ptr, *aes_buf_len); | 274 | GNUNET_memcpy(*aes_buf, ptr, *aes_buf_len); |
275 | ptr += *aes_buf_len; | 275 | ptr += *aes_buf_len; |
276 | len = (uint32_t*)ptr; | 276 | len = (uint32_t*)ptr; |
277 | *cph_buf_len = ntohl (*len); | 277 | *cph_buf_len = ntohl (*len); |
278 | ptr += 4; | 278 | ptr += 4; |
279 | *cph_buf = GNUNET_malloc (*cph_buf_len); | 279 | *cph_buf = GNUNET_malloc (*cph_buf_len); |
280 | memcpy(*cph_buf, ptr, *cph_buf_len); | 280 | GNUNET_memcpy(*cph_buf, ptr, *cph_buf_len); |
281 | 281 | ||
282 | return buf_len; | 282 | return buf_len; |
283 | } | 283 | } |
@@ -429,7 +429,7 @@ GNUNET_ABE_cpabe_deserialize_key (const void *data, | |||
429 | &prv_len); | 429 | &prv_len); |
430 | key->pub = gabe_pub_unserialize (pub, pub_len); | 430 | key->pub = gabe_pub_unserialize (pub, pub_len); |
431 | key->prv = gabe_prv_unserialize (key->pub, prv, prv_len); | 431 | key->prv = gabe_prv_unserialize (key->pub, prv, prv_len); |
432 | 432 | ||
433 | GNUNET_free (pub); | 433 | GNUNET_free (pub); |
434 | GNUNET_free (prv); | 434 | GNUNET_free (prv); |
435 | return key; | 435 | return key; |
@@ -491,7 +491,7 @@ GNUNET_ABE_cpabe_deserialize_master_key (const void *data, | |||
491 | &msk_len); | 491 | &msk_len); |
492 | key->pub = gabe_pub_unserialize (pub, pub_len); | 492 | key->pub = gabe_pub_unserialize (pub, pub_len); |
493 | key->msk = gabe_msk_unserialize (key->pub, msk, msk_len); | 493 | key->msk = gabe_msk_unserialize (key->pub, msk, msk_len); |
494 | 494 | ||
495 | GNUNET_free (pub); | 495 | GNUNET_free (pub); |
496 | GNUNET_free (msk); | 496 | GNUNET_free (msk); |
497 | 497 | ||
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 | |||
61 | * The issuer | 61 | * The issuer |
62 | */ | 62 | */ |
63 | struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; | 63 | struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * The subject | 66 | * The subject |
67 | */ | 67 | */ |
68 | struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; | 68 | struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * The issued attribute | 71 | * The issued attribute |
72 | */ | 72 | */ |
73 | char *issuer_attribute; | 73 | char *issuer_attribute; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * The delegated attribute | 76 | * The delegated attribute |
77 | */ | 77 | */ |
@@ -92,7 +92,7 @@ struct CredentialRecordEntry | |||
92 | * DLL | 92 | * DLL |
93 | */ | 93 | */ |
94 | struct CredentialRecordEntry *prev; | 94 | struct CredentialRecordEntry *prev; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Number of references in delegation chains | 97 | * Number of references in delegation chains |
98 | */ | 98 | */ |
@@ -409,7 +409,7 @@ cleanup_handle (struct VerifyRequestHandle *vrh) | |||
409 | } | 409 | } |
410 | cleanup_delegation_set (vrh->root_set); | 410 | cleanup_delegation_set (vrh->root_set); |
411 | GNUNET_free_non_null (vrh->issuer_attribute); | 411 | GNUNET_free_non_null (vrh->issuer_attribute); |
412 | for (cr_entry = vrh->cred_chain_head; | 412 | for (cr_entry = vrh->cred_chain_head; |
413 | NULL != vrh->cred_chain_head; | 413 | NULL != vrh->cred_chain_head; |
414 | cr_entry = vrh->cred_chain_head) | 414 | cr_entry = vrh->cred_chain_head) |
415 | { | 415 | { |
@@ -543,7 +543,7 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
543 | else | 543 | else |
544 | rmsg->cred_found = htonl (GNUNET_NO); | 544 | rmsg->cred_found = htonl (GNUNET_NO); |
545 | 545 | ||
546 | GNUNET_assert (-1 != | 546 | GNUNET_assert (-1 != |
547 | GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size, | 547 | GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size, |
548 | dd, | 548 | dd, |
549 | vrh->cred_chain_size, | 549 | vrh->cred_chain_size, |
@@ -587,7 +587,7 @@ backward_resolution (void* cls, | |||
587 | "Got %d attrs\n", rd_count); | 587 | "Got %d attrs\n", rd_count); |
588 | 588 | ||
589 | // Each OR | 589 | // Each OR |
590 | for (uint32_t i=0; i < rd_count; i++) | 590 | for (uint32_t i=0; i < rd_count; i++) |
591 | { | 591 | { |
592 | if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type) | 592 | if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type) |
593 | continue; | 593 | continue; |
@@ -665,10 +665,10 @@ backward_resolution (void* cls, | |||
665 | /** | 665 | /** |
666 | * Check if this delegation already matches one of our credentials | 666 | * Check if this delegation already matches one of our credentials |
667 | */ | 667 | */ |
668 | for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL; | 668 | for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL; |
669 | cred_pointer = cred_pointer->next) | 669 | cred_pointer = cred_pointer->next) |
670 | { | 670 | { |
671 | if(0 != memcmp (&set->subject_key, | 671 | if(0 != memcmp (&set->subject_key, |
672 | &cred_pointer->credential->issuer_key, | 672 | &cred_pointer->credential->issuer_key, |
673 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) | 673 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) |
674 | continue; | 674 | continue; |
@@ -769,7 +769,7 @@ backward_resolution (void* cls, | |||
769 | return; | 769 | return; |
770 | 770 | ||
771 | } | 771 | } |
772 | } | 772 | } |
773 | 773 | ||
774 | 774 | ||
775 | /** | 775 | /** |
@@ -809,7 +809,7 @@ delegation_chain_resolution_start (void* cls) | |||
809 | } | 809 | } |
810 | 810 | ||
811 | /** | 811 | /** |
812 | * Check for attributes from the issuer and follow the chain | 812 | * Check for attributes from the issuer and follow the chain |
813 | * till you get the required subject's attributes | 813 | * till you get the required subject's attributes |
814 | */ | 814 | */ |
815 | char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1]; | 815 | char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1]; |
@@ -821,9 +821,9 @@ delegation_chain_resolution_start (void* cls) | |||
821 | "Looking up %s\n", issuer_attribute_name); | 821 | "Looking up %s\n", issuer_attribute_name); |
822 | ds_entry = GNUNET_new (struct DelegationSetQueueEntry); | 822 | ds_entry = GNUNET_new (struct DelegationSetQueueEntry); |
823 | ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); | 823 | ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); |
824 | memcpy (ds_entry->issuer_key, | 824 | GNUNET_memcpy (ds_entry->issuer_key, |
825 | &vrh->issuer_key, | 825 | &vrh->issuer_key, |
826 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 826 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
827 | ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute); | 827 | ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute); |
828 | ds_entry->handle = vrh; | 828 | ds_entry->handle = vrh; |
829 | ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute); | 829 | ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute); |
@@ -869,7 +869,7 @@ check_verify (void *cls, | |||
869 | 869 | ||
870 | static void | 870 | static void |
871 | handle_verify (void *cls, | 871 | handle_verify (void *cls, |
872 | const struct VerifyMessage *v_msg) | 872 | const struct VerifyMessage *v_msg) |
873 | { | 873 | { |
874 | struct VerifyRequestHandle *vrh; | 874 | struct VerifyRequestHandle *vrh; |
875 | struct GNUNET_SERVICE_Client *client = cls; | 875 | struct GNUNET_SERVICE_Client *client = cls; |
@@ -886,7 +886,9 @@ handle_verify (void *cls, | |||
886 | "Received VERIFY message\n"); | 886 | "Received VERIFY message\n"); |
887 | utf_in = (const char *) &v_msg[1]; | 887 | utf_in = (const char *) &v_msg[1]; |
888 | GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); | 888 | GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); |
889 | GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len)); | 889 | GNUNET_memcpy (issuer_attribute, |
890 | attr, | ||
891 | ntohs (v_msg->issuer_attribute_len)); | ||
890 | issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; | 892 | issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; |
891 | vrh = GNUNET_new (struct VerifyRequestHandle); | 893 | vrh = GNUNET_new (struct VerifyRequestHandle); |
892 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); | 894 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); |
@@ -897,7 +899,7 @@ handle_verify (void *cls, | |||
897 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); | 899 | vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); |
898 | if (0 == strlen (issuer_attribute)) | 900 | if (0 == strlen (issuer_attribute)) |
899 | { | 901 | { |
900 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 902 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
901 | "No issuer attribute provided!\n"); | 903 | "No issuer attribute provided!\n"); |
902 | send_lookup_response (vrh); | 904 | send_lookup_response (vrh); |
903 | return; | 905 | return; |
@@ -907,7 +909,7 @@ handle_verify (void *cls, | |||
907 | * TODO: cleanup! | 909 | * TODO: cleanup! |
908 | */ | 910 | */ |
909 | credentials_count = ntohl(v_msg->c_count); | 911 | credentials_count = ntohl(v_msg->c_count); |
910 | credential_data_size = ntohs (v_msg->header.size) | 912 | credential_data_size = ntohs (v_msg->header.size) |
911 | - sizeof (struct VerifyMessage) | 913 | - sizeof (struct VerifyMessage) |
912 | - ntohs (v_msg->issuer_attribute_len) | 914 | - ntohs (v_msg->issuer_attribute_len) |
913 | - 1; | 915 | - 1; |
@@ -918,7 +920,7 @@ handle_verify (void *cls, | |||
918 | credentials_count, | 920 | credentials_count, |
919 | credentials)) | 921 | credentials)) |
920 | { | 922 | { |
921 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 923 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
922 | "Cannot deserialize credentials!\n"); | 924 | "Cannot deserialize credentials!\n"); |
923 | send_lookup_response (vrh); | 925 | send_lookup_response (vrh); |
924 | return; | 926 | return; |
@@ -1015,7 +1017,7 @@ handle_cred_collection_finished_cb (void *cls) | |||
1015 | 1017 | ||
1016 | static void | 1018 | static void |
1017 | handle_collect (void *cls, | 1019 | handle_collect (void *cls, |
1018 | const struct CollectMessage *c_msg) | 1020 | const struct CollectMessage *c_msg) |
1019 | { | 1021 | { |
1020 | char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; | 1022 | char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; |
1021 | char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; | 1023 | char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; |
@@ -1030,7 +1032,9 @@ handle_collect (void *cls, | |||
1030 | utf_in = (const char *) &c_msg[1]; | 1032 | utf_in = (const char *) &c_msg[1]; |
1031 | GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); | 1033 | GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); |
1032 | 1034 | ||
1033 | GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len)); | 1035 | GNUNET_memcpy (issuer_attribute, |
1036 | attr, | ||
1037 | ntohs (c_msg->issuer_attribute_len)); | ||
1034 | issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; | 1038 | issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; |
1035 | vrh = GNUNET_new (struct VerifyRequestHandle); | 1039 | vrh = GNUNET_new (struct VerifyRequestHandle); |
1036 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); | 1040 | GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); |
@@ -1043,7 +1047,7 @@ handle_collect (void *cls, | |||
1043 | 1047 | ||
1044 | if (0 == strlen (issuer_attribute)) | 1048 | if (0 == strlen (issuer_attribute)) |
1045 | { | 1049 | { |
1046 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1050 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1047 | "No issuer attribute provided!\n"); | 1051 | "No issuer attribute provided!\n"); |
1048 | send_lookup_response (vrh); | 1052 | send_lookup_response (vrh); |
1049 | return; | 1053 | 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, | |||
62 | int i; | 62 | int i; |
63 | if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord)) | 63 | if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord)) |
64 | return NULL; /* malformed */ | 64 | return NULL; /* malformed */ |
65 | memcpy (&sets, | 65 | GNUNET_memcpy (&sets, |
66 | data, | 66 | data, |
67 | sizeof (sets)); | 67 | sizeof (sets)); |
68 | cdata = data; | 68 | cdata = data; |
69 | struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets.set_count)]; | 69 | struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets.set_count)]; |
70 | if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll (sets.data_size), | 70 | if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll (sets.data_size), |
@@ -224,7 +224,7 @@ credential_string_to_value (void *cls, | |||
224 | } | 224 | } |
225 | tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries, | 225 | tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries, |
226 | set); | 226 | set); |
227 | 227 | ||
228 | if (-1 == tmp_data_size) | 228 | if (-1 == tmp_data_size) |
229 | { | 229 | { |
230 | GNUNET_free (tmp_str); | 230 | GNUNET_free (tmp_str); |
@@ -248,7 +248,7 @@ credential_string_to_value (void *cls, | |||
248 | return GNUNET_OK; | 248 | return GNUNET_OK; |
249 | } | 249 | } |
250 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: | 250 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: |
251 | { | 251 | { |
252 | struct GNUNET_CREDENTIAL_Credential *cred; | 252 | struct GNUNET_CREDENTIAL_Credential *cred; |
253 | cred = GNUNET_CREDENTIAL_credential_from_string (s); | 253 | cred = GNUNET_CREDENTIAL_credential_from_string (s); |
254 | 254 | ||
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) | |||
309 | sig, | 309 | sig, |
310 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); | 310 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); |
311 | GNUNET_free (sig); | 311 | GNUNET_free (sig); |
312 | 312 | ||
313 | tmp = json_object_get (res, "expiration"); | 313 | tmp = json_object_get (res, "expiration"); |
314 | if (0 == json_is_integer (tmp)) | 314 | if (0 == json_is_integer (tmp)) |
315 | { | 315 | { |
316 | GNUNET_free (cred); | 316 | GNUNET_free (cred); |
317 | return NULL; | 317 | return NULL; |
318 | } | 318 | } |
319 | cred->expiration.abs_value_us = json_integer_value (tmp); | 319 | cred->expiration.abs_value_us = json_integer_value (tmp); |
320 | return cred; | 320 | return cred; |
321 | } | 321 | } |
322 | 322 | ||
@@ -342,7 +342,7 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred) | |||
342 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 342 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
343 | "Issuer in credential malformed\n"); | 343 | "Issuer in credential malformed\n"); |
344 | return NULL; | 344 | return NULL; |
345 | } | 345 | } |
346 | subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key); | 346 | subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key); |
347 | if (NULL == subject) | 347 | if (NULL == subject) |
348 | { | 348 | { |
@@ -354,9 +354,9 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred) | |||
354 | GNUNET_STRINGS_base64_encode ((char*)&cred->signature, | 354 | GNUNET_STRINGS_base64_encode ((char*)&cred->signature, |
355 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature), | 355 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature), |
356 | &signature); | 356 | &signature); |
357 | memcpy (attribute, | 357 | GNUNET_memcpy (attribute, |
358 | cred->issuer_attribute, | 358 | cred->issuer_attribute, |
359 | cred->issuer_attribute_len); | 359 | cred->issuer_attribute_len); |
360 | attribute[cred->issuer_attribute_len] = '\0'; | 360 | attribute[cred->issuer_attribute_len] = '\0'; |
361 | cred_obj = json_object (); | 361 | cred_obj = json_object (); |
362 | json_object_set_new (cred_obj, "issuer", json_string (issuer)); | 362 | json_object_set_new (cred_obj, "issuer", json_string (issuer)); |
@@ -570,7 +570,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
570 | { | 570 | { |
571 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 571 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
572 | "Missing issuer attribute\n"); | 572 | "Missing issuer attribute\n"); |
573 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 573 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
574 | return; | 574 | return; |
575 | } | 575 | } |
576 | tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, | 576 | tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, |
@@ -585,7 +585,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
585 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 585 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
586 | return; | 586 | return; |
587 | } | 587 | } |
588 | if (GNUNET_OK != | 588 | if (GNUNET_OK != |
589 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, | 589 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, |
590 | strlen (tmp), | 590 | strlen (tmp), |
591 | &handle->issuer_key)) | 591 | &handle->issuer_key)) |
@@ -626,7 +626,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
626 | { | 626 | { |
627 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 627 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
628 | "Malformed subject\n"); | 628 | "Malformed subject\n"); |
629 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 629 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
630 | return; | 630 | return; |
631 | } | 631 | } |
632 | handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg, | 632 | handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg, |
@@ -679,7 +679,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
679 | { | 679 | { |
680 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 680 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
681 | "Missing issuer attribute\n"); | 681 | "Missing issuer attribute\n"); |
682 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 682 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
683 | return; | 683 | return; |
684 | } | 684 | } |
685 | tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, | 685 | tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, |
@@ -694,7 +694,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
694 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 694 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
695 | return; | 695 | return; |
696 | } | 696 | } |
697 | if (GNUNET_OK != | 697 | if (GNUNET_OK != |
698 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, | 698 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, |
699 | strlen (tmp), | 699 | strlen (tmp), |
700 | &handle->issuer_key)) | 700 | &handle->issuer_key)) |
@@ -735,7 +735,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
735 | { | 735 | { |
736 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 736 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
737 | "Malformed subject\n"); | 737 | "Malformed subject\n"); |
738 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 738 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
739 | return; | 739 | return; |
740 | } | 740 | } |
741 | if (GNUNET_OK != | 741 | if (GNUNET_OK != |
@@ -946,7 +946,7 @@ get_cred_issuer_cb (void *cls, | |||
946 | { | 946 | { |
947 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 947 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
948 | "Missing expiration\n"); | 948 | "Missing expiration\n"); |
949 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 949 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
950 | return; | 950 | return; |
951 | } | 951 | } |
952 | expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, | 952 | expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, |
@@ -955,7 +955,7 @@ get_cred_issuer_cb (void *cls, | |||
955 | { | 955 | { |
956 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 956 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
957 | "Expiration malformed\n"); | 957 | "Expiration malformed\n"); |
958 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 958 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
959 | return; | 959 | return; |
960 | } | 960 | } |
961 | 961 | ||
@@ -968,7 +968,7 @@ get_cred_issuer_cb (void *cls, | |||
968 | { | 968 | { |
969 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 969 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
970 | "Malformed expiration: %s\n", expiration_str); | 970 | "Malformed expiration: %s\n", expiration_str); |
971 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 971 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
972 | return; | 972 | return; |
973 | } | 973 | } |
974 | GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR, | 974 | GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR, |
@@ -980,10 +980,10 @@ get_cred_issuer_cb (void *cls, | |||
980 | { | 980 | { |
981 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 981 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
982 | "Missing issuer attribute\n"); | 982 | "Missing issuer attribute\n"); |
983 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 983 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
984 | return; | 984 | return; |
985 | } | 985 | } |
986 | handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get | 986 | handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get |
987 | (handle->rest_handle->url_param_map, | 987 | (handle->rest_handle->url_param_map, |
988 | &key)); | 988 | &key)); |
989 | GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY, | 989 | GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY, |
@@ -1004,7 +1004,7 @@ get_cred_issuer_cb (void *cls, | |||
1004 | { | 1004 | { |
1005 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1005 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1006 | "Malformed subject\n"); | 1006 | "Malformed subject\n"); |
1007 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 1007 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
1008 | return; | 1008 | return; |
1009 | } | 1009 | } |
1010 | if (GNUNET_OK != | 1010 | 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, | |||
688 | switch (sa->sa_family) | 688 | switch (sa->sa_family) |
689 | { | 689 | { |
690 | case AF_INET: | 690 | case AF_INET: |
691 | memcpy (&ds->ss, | 691 | GNUNET_memcpy (&ds->ss, |
692 | sa, | 692 | sa, |
693 | sizeof (struct sockaddr_in)); | 693 | sizeof (struct sockaddr_in)); |
694 | break; | 694 | break; |
695 | case AF_INET6: | 695 | case AF_INET6: |
696 | memcpy (&ds->ss, | 696 | GNUNET_memcpy (&ds->ss, |
697 | sa, | 697 | sa, |
698 | sizeof (struct sockaddr_in6)); | 698 | sizeof (struct sockaddr_in6)); |
699 | break; | 699 | break; |
700 | default: | 700 | default: |
701 | GNUNET_break (0); | 701 | 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, | |||
528 | ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen); | 528 | ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen); |
529 | ii->file_id = *file_id; | 529 | ii->file_id = *file_id; |
530 | ii->filename = (const char *) &ii[1]; | 530 | ii->filename = (const char *) &ii[1]; |
531 | memcpy (&ii[1], | 531 | GNUNET_memcpy (&ii[1], |
532 | filename, | 532 | filename, |
533 | slen); | 533 | slen); |
534 | GNUNET_CONTAINER_DLL_insert (indexed_files_head, | 534 | GNUNET_CONTAINER_DLL_insert (indexed_files_head, |
535 | indexed_files_tail, | 535 | indexed_files_tail, |
536 | ii); | 536 | 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, | |||
439 | req = GNUNET_malloc (sizeof (struct Request) + hlen); | 439 | req = GNUNET_malloc (sizeof (struct Request) + hlen); |
440 | req->cat = cat; | 440 | req->cat = cat; |
441 | req->hostname = (char *) &req[1]; | 441 | req->hostname = (char *) &req[1]; |
442 | memcpy (req->hostname, | 442 | GNUNET_memcpy (req->hostname, |
443 | hostname, | 443 | hostname, |
444 | hlen); | 444 | hlen); |
445 | GNUNET_CONTAINER_DLL_insert (todo_head, | 445 | GNUNET_CONTAINER_DLL_insert (todo_head, |
446 | todo_tail, | 446 | todo_tail, |
447 | req); | 447 | 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, | |||
818 | res->data_size = data_size; | 818 | res->data_size = data_size; |
819 | res->record_type = record_type; | 819 | res->record_type = record_type; |
820 | res->data = &res[1]; | 820 | res->data = &res[1]; |
821 | GNUNET_memcpy (&res[1], data, data_size); | 821 | GNUNET_memcpy (&res[1], |
822 | data, | ||
823 | data_size); | ||
822 | GNUNET_CONTAINER_DLL_insert (rh->dns_result_head, | 824 | GNUNET_CONTAINER_DLL_insert (rh->dns_result_head, |
823 | rh->dns_result_tail, | 825 | rh->dns_result_tail, |
824 | res); | 826 | res); |
@@ -1516,9 +1518,9 @@ handle_gns2dns_ip (void *cls, | |||
1516 | continue_with_gns2dns (ac); | 1518 | continue_with_gns2dns (ac); |
1517 | return; | 1519 | return; |
1518 | } | 1520 | } |
1519 | memcpy (&ss, | 1521 | GNUNET_memcpy (&ss, |
1520 | addr, | 1522 | addr, |
1521 | addrlen); | 1523 | addrlen); |
1522 | switch (ss.ss_family) | 1524 | switch (ss.ss_family) |
1523 | { | 1525 | { |
1524 | case AF_INET: | 1526 | 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, | |||
102 | ('\0' != cdata[data_size - 1]) ) | 102 | ('\0' != cdata[data_size - 1]) ) |
103 | return NULL; /* malformed */ | 103 | return NULL; /* malformed */ |
104 | /* need to memcpy for alignment */ | 104 | /* need to memcpy for alignment */ |
105 | memcpy (&vpn, | 105 | GNUNET_memcpy (&vpn, |
106 | data, | 106 | data, |
107 | sizeof (vpn)); | 107 | sizeof (vpn)); |
108 | GNUNET_asprintf (&vpn_str, | 108 | GNUNET_asprintf (&vpn_str, |
109 | "%u %s %s", | 109 | "%u %s %s", |
110 | (unsigned int) ntohs (vpn.proto), | 110 | (unsigned int) ntohs (vpn.proto), |
@@ -122,9 +122,9 @@ gns_value_to_string (void *cls, | |||
122 | cdata = data; | 122 | cdata = data; |
123 | if (data_size < sizeof (struct GNUNET_GNSRECORD_BoxRecord)) | 123 | if (data_size < sizeof (struct GNUNET_GNSRECORD_BoxRecord)) |
124 | return NULL; /* malformed */ | 124 | return NULL; /* malformed */ |
125 | memcpy (&box, | 125 | GNUNET_memcpy (&box, |
126 | data, | 126 | data, |
127 | sizeof (box)); | 127 | sizeof (box)); |
128 | rt = ntohl (box.record_type); | 128 | rt = ntohl (box.record_type); |
129 | ival = GNUNET_GNSRECORD_value_to_string (rt, | 129 | ival = GNUNET_GNSRECORD_value_to_string (rt, |
130 | &cdata[sizeof (box)], | 130 | &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 | |||
84 | GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, | 84 | GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, |
85 | const struct GNUNET_GNSRECORD_Data *rd) | 85 | const struct GNUNET_GNSRECORD_Data *rd) |
86 | { | 86 | { |
87 | unsigned int i; | ||
88 | size_t ret; | 87 | size_t ret; |
89 | 88 | ||
90 | ret = sizeof (struct NetworkRecord) * rd_count; | 89 | ret = sizeof (struct NetworkRecord) * rd_count; |
91 | for (i=0;i<rd_count;i++) | 90 | for (unsigned int i=0;i<rd_count;i++) |
92 | { | 91 | { |
93 | GNUNET_assert ((ret + rd[i].data_size) >= ret); | 92 | GNUNET_assert ((ret + rd[i].data_size) >= ret); |
94 | ret += rd[i].data_size; | 93 | ret += rd[i].data_size; |
@@ -113,11 +112,10 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count, | |||
113 | char *dest) | 112 | char *dest) |
114 | { | 113 | { |
115 | struct NetworkRecord rec; | 114 | struct NetworkRecord rec; |
116 | unsigned int i; | ||
117 | size_t off; | 115 | size_t off; |
118 | 116 | ||
119 | off = 0; | 117 | off = 0; |
120 | for (i=0;i<rd_count;i++) | 118 | for (unsigned int i=0;i<rd_count;i++) |
121 | { | 119 | { |
122 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 120 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
123 | "Serializing record %u with flags %d and expiration time %llu\n", | 121 | "Serializing record %u with flags %d and expiration time %llu\n", |
@@ -168,7 +166,9 @@ GNUNET_GNSRECORD_records_deserialize (size_t len, | |||
168 | { | 166 | { |
169 | if (off + sizeof (rec) > len) | 167 | if (off + sizeof (rec) > len) |
170 | return GNUNET_SYSERR; | 168 | return GNUNET_SYSERR; |
171 | GNUNET_memcpy (&rec, &src[off], sizeof (rec)); | 169 | GNUNET_memcpy (&rec, |
170 | &src[off], | ||
171 | sizeof (rec)); | ||
172 | dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time); | 172 | dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time); |
173 | dest[i].data_size = ntohl ((uint32_t) rec.data_size); | 173 | dest[i].data_size = ntohl ((uint32_t) rec.data_size); |
174 | dest[i].record_type = ntohl (rec.record_type); | 174 | 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 | |||
71 | * Attribute result callback | 71 | * Attribute result callback |
72 | */ | 72 | */ |
73 | GNUNET_IDENTITY_PROVIDER_AttributeResult ar_cb; | 73 | GNUNET_IDENTITY_PROVIDER_AttributeResult ar_cb; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Revocation result callback | 76 | * Revocation result callback |
77 | */ | 77 | */ |
@@ -613,7 +613,7 @@ handle_attribute_result (void *cls, | |||
613 | it->finish_cb (it->finish_cb_cls); | 613 | it->finish_cb (it->finish_cb_cls); |
614 | free_it (it); | 614 | free_it (it); |
615 | } | 615 | } |
616 | if (NULL != op) | 616 | if (NULL != op) |
617 | { | 617 | { |
618 | if (NULL != op->ar_cb) | 618 | if (NULL != op->ar_cb) |
619 | op->ar_cb (op->cls, | 619 | op->ar_cb (op->cls, |
@@ -953,7 +953,7 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle | |||
953 | 953 | ||
954 | 954 | ||
955 | /** | 955 | /** |
956 | * List all attributes for a local identity. | 956 | * List all attributes for a local identity. |
957 | * This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle` | 957 | * This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle` |
958 | * for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and | 958 | * for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and |
959 | * #GNUNET_IDENTITY_PROVIDER_get_attributes_stop. @a proc will be called once | 959 | * #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 * | |||
1370 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET); | 1370 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET); |
1371 | msg->id = htonl (rid); | 1371 | msg->id = htonl (rid); |
1372 | msg->identity = *identity; | 1372 | msg->identity = *identity; |
1373 | memcpy (&msg[1], | 1373 | GNUNET_memcpy (&msg[1], |
1374 | ticket, | 1374 | ticket, |
1375 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); | 1375 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); |
1376 | if (NULL == h->mq) | 1376 | if (NULL == h->mq) |
1377 | op->env = env; | 1377 | op->env = env; |
1378 | else | 1378 | 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, | |||
223 | void *data) | 223 | void *data) |
224 | { | 224 | { |
225 | char text[] = "pong"; | 225 | char text[] = "pong"; |
226 | |||
226 | *data_size = strlen(text)+1; | 227 | *data_size = strlen(text)+1; |
227 | memcpy(data, text, *data_size); | 228 | GNUNET_memcpy (data, |
229 | text, | ||
230 | *data_size); | ||
228 | 231 | ||
229 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends (to all): %s\n", text); | 232 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends (to all): %s\n", text); |
230 | 233 | ||
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 | |||
54 | struct pingpong_msg | 54 | struct pingpong_msg |
55 | { | 55 | { |
56 | int peer; | 56 | int peer; |
57 | enum pingpong msg; | 57 | enum pingpong msg; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static void service_connect (void *cls, | 60 | static void service_connect (void *cls, |
@@ -143,13 +143,13 @@ member_join_request (void *cls, | |||
143 | { | 143 | { |
144 | struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls; | 144 | struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls; |
145 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 145 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
146 | "Peer #%u (%s) sent a join request.\n", | 146 | "Peer #%u (%s) sent a join request.\n", |
147 | mc_peer->peer, | 147 | mc_peer->peer, |
148 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); | 148 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | static int | 152 | static int |
153 | notify (void *cls, | 153 | notify (void *cls, |
154 | size_t *data_size, | 154 | size_t *data_size, |
155 | void *data) | 155 | void *data) |
@@ -163,7 +163,7 @@ notify (void *cls, | |||
163 | *data_size = sizeof (struct pingpong_msg); | 163 | *data_size = sizeof (struct pingpong_msg); |
164 | GNUNET_memcpy(data, pp_msg, *data_size); | 164 | GNUNET_memcpy(data, pp_msg, *data_size); |
165 | 165 | ||
166 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 166 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
167 | "Peer #%u sents ping to origin\n", mc_peer->peer); | 167 | "Peer #%u sents ping to origin\n", mc_peer->peer); |
168 | 168 | ||
169 | return GNUNET_YES; | 169 | return GNUNET_YES; |
@@ -179,20 +179,20 @@ member_join_decision (void *cls, | |||
179 | const struct GNUNET_MessageHeader *join_msg) | 179 | const struct GNUNET_MessageHeader *join_msg) |
180 | { | 180 | { |
181 | struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls; | 181 | struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls; |
182 | 182 | ||
183 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 183 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
184 | "Peer #%u (%s) received a decision from origin: %s\n", | 184 | "Peer #%u (%s) received a decision from origin: %s\n", |
185 | mc_peer->peer, | 185 | mc_peer->peer, |
186 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id), | 186 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id), |
187 | (GNUNET_YES == is_admitted)?"accepted":"rejected"); | 187 | (GNUNET_YES == is_admitted)?"accepted":"rejected"); |
188 | 188 | ||
189 | if (GNUNET_YES == is_admitted) | 189 | if (GNUNET_YES == is_admitted) |
190 | { | 190 | { |
191 | GNUNET_MULTICAST_member_to_origin (members[mc_peer->peer], | 191 | GNUNET_MULTICAST_member_to_origin (members[mc_peer->peer], |
192 | 0, | 192 | 0, |
193 | notify, | 193 | notify, |
194 | cls); | 194 | cls); |
195 | 195 | ||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
@@ -236,7 +236,7 @@ member_disconnected_cb (void *cls) | |||
236 | 236 | ||
237 | 237 | ||
238 | static void | 238 | static void |
239 | member_message (void *cls, | 239 | member_message (void *cls, |
240 | const struct GNUNET_MULTICAST_MessageHeader *msg) | 240 | const struct GNUNET_MULTICAST_MessageHeader *msg) |
241 | { | 241 | { |
242 | struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls; | 242 | struct MulticastPeerContext *mc_peer = (struct MulticastPeerContext*)cls; |
@@ -245,7 +245,7 @@ member_message (void *cls, | |||
245 | if (PONG == pp_msg->msg && mc_peer->peer == pp_msg->peer) | 245 | if (PONG == pp_msg->msg && mc_peer->peer == pp_msg->peer) |
246 | { | 246 | { |
247 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 247 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
248 | "peer #%i (%s) receives a pong\n", | 248 | "peer #%i (%s) receives a pong\n", |
249 | mc_peer->peer, | 249 | mc_peer->peer, |
250 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); | 250 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); |
251 | mc_peer->test_ok = GNUNET_OK; | 251 | mc_peer->test_ok = GNUNET_OK; |
@@ -269,9 +269,9 @@ origin_join_request (void *cls, | |||
269 | 269 | ||
270 | uint8_t data_size = ntohs (join_msg->size); | 270 | uint8_t data_size = ntohs (join_msg->size); |
271 | 271 | ||
272 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 272 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
273 | "origin got a join request...\n"); | 273 | "origin got a join request...\n"); |
274 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 274 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
275 | "origin receives: '%s'\n", (char *)&join_msg[1]); | 275 | "origin receives: '%s'\n", (char *)&join_msg[1]); |
276 | 276 | ||
277 | char data[] = "Come in!"; | 277 | char data[] = "Come in!"; |
@@ -281,7 +281,7 @@ origin_join_request (void *cls, | |||
281 | join_resp->type = htons (123); | 281 | join_resp->type = htons (123); |
282 | GNUNET_memcpy (&join_resp[1], data, data_size); | 282 | GNUNET_memcpy (&join_resp[1], data, data_size); |
283 | 283 | ||
284 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 284 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
285 | "origin sends: '%s'\n", data); | 285 | "origin sends: '%s'\n", data); |
286 | 286 | ||
287 | GNUNET_MULTICAST_join_decision (jh, | 287 | GNUNET_MULTICAST_join_decision (jh, |
@@ -311,7 +311,7 @@ origin_replay_msg (void *cls, | |||
311 | uint64_t message_id, | 311 | uint64_t message_id, |
312 | uint64_t fragment_offset, | 312 | uint64_t fragment_offset, |
313 | uint64_t flags, | 313 | uint64_t flags, |
314 | struct GNUNET_MULTICAST_ReplayHandle *rh) | 314 | struct GNUNET_MULTICAST_ReplayHandle *rh) |
315 | { | 315 | { |
316 | 316 | ||
317 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay msg\n"); | 317 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin replay msg\n"); |
@@ -319,8 +319,8 @@ origin_replay_msg (void *cls, | |||
319 | 319 | ||
320 | 320 | ||
321 | static int | 321 | static int |
322 | origin_notify (void *cls, | 322 | origin_notify (void *cls, |
323 | size_t *data_size, | 323 | size_t *data_size, |
324 | void *data) | 324 | void *data) |
325 | { | 325 | { |
326 | struct pingpong_msg *rcv_pp_msg = (struct pingpong_msg*)cls; | 326 | struct pingpong_msg *rcv_pp_msg = (struct pingpong_msg*)cls; |
@@ -329,11 +329,11 @@ origin_notify (void *cls, | |||
329 | pp_msg->peer = rcv_pp_msg->peer; | 329 | pp_msg->peer = rcv_pp_msg->peer; |
330 | pp_msg->msg = PONG; | 330 | pp_msg->msg = PONG; |
331 | *data_size = sizeof (struct pingpong_msg); | 331 | *data_size = sizeof (struct pingpong_msg); |
332 | memcpy(data, pp_msg, *data_size); | 332 | GNUNET_memcpy(data, pp_msg, *data_size); |
333 | 333 | ||
334 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n"); | 334 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n"); |
335 | 335 | ||
336 | return GNUNET_YES; | 336 | return GNUNET_YES; |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
@@ -345,7 +345,7 @@ origin_request (void *cls, | |||
345 | 345 | ||
346 | req++; | 346 | req++; |
347 | struct pingpong_msg *pp_msg = (struct pingpong_msg *) req; | 347 | struct pingpong_msg *pp_msg = (struct pingpong_msg *) req; |
348 | 348 | ||
349 | if (1 != pp_msg->msg) { | 349 | if (1 != pp_msg->msg) { |
350 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "origin didn't reveice a correct request"); | 350 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "origin didn't reveice a correct request"); |
351 | } | 351 | } |
@@ -360,7 +360,7 @@ origin_request (void *cls, | |||
360 | 360 | ||
361 | static void | 361 | static void |
362 | origin_message (void *cls, | 362 | origin_message (void *cls, |
363 | const struct GNUNET_MULTICAST_MessageHeader *msg) | 363 | const struct GNUNET_MULTICAST_MessageHeader *msg) |
364 | { | 364 | { |
365 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin message msg\n"); | 365 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin message msg\n"); |
366 | } | 366 | } |
@@ -386,7 +386,7 @@ multicast_connect (void *cls, | |||
386 | { | 386 | { |
387 | group_key = GNUNET_CRYPTO_eddsa_key_create (); | 387 | group_key = GNUNET_CRYPTO_eddsa_key_create (); |
388 | GNUNET_CRYPTO_eddsa_key_get_public (group_key, &group_pub_key); | 388 | GNUNET_CRYPTO_eddsa_key_get_public (group_key, &group_pub_key); |
389 | 389 | ||
390 | GNUNET_CRYPTO_hash (&group_pub_key, sizeof (group_pub_key), &group_pub_key_hash); | 390 | GNUNET_CRYPTO_hash (&group_pub_key, sizeof (group_pub_key), &group_pub_key_hash); |
391 | origin = GNUNET_MULTICAST_origin_start (cfg, | 391 | origin = GNUNET_MULTICAST_origin_start (cfg, |
392 | group_key, | 392 | group_key, |
@@ -414,7 +414,7 @@ multicast_connect (void *cls, | |||
414 | { | 414 | { |
415 | multicast_peer->key = GNUNET_CRYPTO_ecdsa_key_create (); | 415 | multicast_peer->key = GNUNET_CRYPTO_ecdsa_key_create (); |
416 | 416 | ||
417 | sprintf(data, "Hi, I am peer #%u (%s). Can I enter?", | 417 | sprintf(data, "Hi, I am peer #%u (%s). Can I enter?", |
418 | multicast_peer->peer, | 418 | multicast_peer->peer, |
419 | GNUNET_i2s (multicast_peers[multicast_peer->peer]->id)); | 419 | GNUNET_i2s (multicast_peers[multicast_peer->peer]->id)); |
420 | uint8_t data_size = strlen (data) + 1; | 420 | uint8_t data_size = strlen (data) + 1; |
@@ -424,7 +424,7 @@ multicast_connect (void *cls, | |||
424 | GNUNET_memcpy (&join_msg[1], data, data_size); | 424 | GNUNET_memcpy (&join_msg[1], data, data_size); |
425 | 425 | ||
426 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 426 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
427 | "Peer #%u (%s) tries to join multicast group %s\n", | 427 | "Peer #%u (%s) tries to join multicast group %s\n", |
428 | multicast_peer->peer, | 428 | multicast_peer->peer, |
429 | GNUNET_i2s (multicast_peers[multicast_peer->peer]->id), | 429 | GNUNET_i2s (multicast_peers[multicast_peer->peer]->id), |
430 | GNUNET_h2s (&group_pub_key_hash)); | 430 | GNUNET_h2s (&group_pub_key_hash)); |
@@ -465,12 +465,12 @@ peer_information_cb (void *cls, | |||
465 | multicast_peers[mc_peer->peer]->id = pinfo->result.id; | 465 | multicast_peers[mc_peer->peer]->id = pinfo->result.id; |
466 | 466 | ||
467 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 467 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
468 | "Got peer information of %s (%s)\n", | 468 | "Got peer information of %s (%s)\n", |
469 | (0 == mc_peer->peer)? "origin" : "member", | 469 | (0 == mc_peer->peer)? "origin" : "member", |
470 | GNUNET_i2s (pinfo->result.id)); | 470 | GNUNET_i2s (pinfo->result.id)); |
471 | 471 | ||
472 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 472 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
473 | "Create peer #%u (%s)\n", | 473 | "Create peer #%u (%s)\n", |
474 | mc_peer->peer, | 474 | mc_peer->peer, |
475 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); | 475 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); |
476 | 476 | ||
@@ -479,7 +479,7 @@ peer_information_cb (void *cls, | |||
479 | /* connect to multicast service of members */ | 479 | /* connect to multicast service of members */ |
480 | op[mc_peer->peer] = | 480 | op[mc_peer->peer] = |
481 | GNUNET_TESTBED_service_connect (/* Closure for operation */ | 481 | GNUNET_TESTBED_service_connect (/* Closure for operation */ |
482 | NULL, | 482 | NULL, |
483 | /* The peer whose service to connect to */ | 483 | /* The peer whose service to connect to */ |
484 | peers[mc_peer->peer], | 484 | peers[mc_peer->peer], |
485 | /* The name of the service */ | 485 | /* The name of the service */ |
@@ -508,8 +508,8 @@ service_connect (void *cls, | |||
508 | 508 | ||
509 | if (NULL == ca_result) | 509 | if (NULL == ca_result) |
510 | { | 510 | { |
511 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 511 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
512 | "Connection adapter not created for peer #%u (%s)\n", | 512 | "Connection adapter not created for peer #%u (%s)\n", |
513 | mc_peer->peer, | 513 | mc_peer->peer, |
514 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); | 514 | GNUNET_i2s (multicast_peers[mc_peer->peer]->id)); |
515 | 515 | ||
@@ -519,8 +519,8 @@ service_connect (void *cls, | |||
519 | 519 | ||
520 | if (0 == mc_peer->peer) | 520 | if (0 == mc_peer->peer) |
521 | { | 521 | { |
522 | // Get GNUnet identity of members | 522 | // Get GNUnet identity of members |
523 | for (int i = 0; i<PEERS_REQUESTED; i++) | 523 | for (int i = 0; i<PEERS_REQUESTED; i++) |
524 | { | 524 | { |
525 | pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i], | 525 | pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i], |
526 | GNUNET_TESTBED_PIT_IDENTITY, | 526 | GNUNET_TESTBED_PIT_IDENTITY, |
@@ -547,7 +547,7 @@ service_connect (void *cls, | |||
547 | * @param PEERS_REQUESTED size of the 'peers' array | 547 | * @param PEERS_REQUESTED size of the 'peers' array |
548 | * @param links_succeeded number of links between peers that were created | 548 | * @param links_succeeded number of links between peers that were created |
549 | * @param links_failed number of links testbed was unable to establish | 549 | * @param links_failed number of links testbed was unable to establish |
550 | */ | 550 | */ |
551 | static void | 551 | static void |
552 | testbed_master (void *cls, | 552 | testbed_master (void *cls, |
553 | struct GNUNET_TESTBED_RunHandle *h, | 553 | struct GNUNET_TESTBED_RunHandle *h, |
@@ -562,7 +562,7 @@ testbed_master (void *cls, | |||
562 | multicast_peers = GNUNET_new_array (PEERS_REQUESTED, struct MulticastPeerContext*); | 562 | multicast_peers = GNUNET_new_array (PEERS_REQUESTED, struct MulticastPeerContext*); |
563 | 563 | ||
564 | // Create test contexts for members | 564 | // Create test contexts for members |
565 | for (int i = 0; i<PEERS_REQUESTED; i++) | 565 | for (int i = 0; i<PEERS_REQUESTED; i++) |
566 | { | 566 | { |
567 | multicast_peers[i] = GNUNET_new (struct MulticastPeerContext); | 567 | multicast_peers[i] = GNUNET_new (struct MulticastPeerContext); |
568 | multicast_peers[i]->peer = i; | 568 | multicast_peers[i]->peer = i; |
@@ -604,7 +604,7 @@ main (int argc, char *argv[]) | |||
604 | int ret; | 604 | int ret; |
605 | char const *config_file; | 605 | char const *config_file; |
606 | 606 | ||
607 | if (strstr (argv[0], "_line") != NULL) | 607 | if (strstr (argv[0], "_line") != NULL) |
608 | { | 608 | { |
609 | config_file = "test_multicast_line.conf"; | 609 | config_file = "test_multicast_line.conf"; |
610 | } | 610 | } |
@@ -612,7 +612,7 @@ main (int argc, char *argv[]) | |||
612 | { | 612 | { |
613 | config_file = "test_multicast_star.conf"; | 613 | config_file = "test_multicast_star.conf"; |
614 | } | 614 | } |
615 | else | 615 | else |
616 | { | 616 | { |
617 | config_file = "test_multicast_star.conf"; | 617 | config_file = "test_multicast_star.conf"; |
618 | } | 618 | } |
@@ -620,19 +620,19 @@ main (int argc, char *argv[]) | |||
620 | result = GNUNET_SYSERR; | 620 | result = GNUNET_SYSERR; |
621 | ret = | 621 | ret = |
622 | GNUNET_TESTBED_test_run ("test-multicast-multipeer", | 622 | GNUNET_TESTBED_test_run ("test-multicast-multipeer", |
623 | config_file, | 623 | config_file, |
624 | /* number of peers to start */ | 624 | /* number of peers to start */ |
625 | PEERS_REQUESTED, | 625 | PEERS_REQUESTED, |
626 | /* Event mask - set to 0 for no event notifications */ | 626 | /* Event mask - set to 0 for no event notifications */ |
627 | 0LL, | 627 | 0LL, |
628 | /* Controller event callback */ | 628 | /* Controller event callback */ |
629 | NULL, | 629 | NULL, |
630 | /* Closure for controller event callback */ | 630 | /* Closure for controller event callback */ |
631 | NULL, | 631 | NULL, |
632 | /* called when testbed setup is complete */ | 632 | /* called when testbed setup is complete */ |
633 | testbed_master, | 633 | testbed_master, |
634 | /* Closure for the test_master callback */ | 634 | /* Closure for the test_master callback */ |
635 | NULL); | 635 | NULL); |
636 | if ( (GNUNET_OK != ret) || (GNUNET_OK != result) ) | 636 | if ( (GNUNET_OK != ret) || (GNUNET_OK != result) ) |
637 | return 1; | 637 | return 1; |
638 | return 0; | 638 | 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, | |||
1417 | sa); | 1417 | sa); |
1418 | sa->nc = nc; | 1418 | sa->nc = nc; |
1419 | sa->rsm = (const struct RecordStoreMessage *) &sa[1]; | 1419 | sa->rsm = (const struct RecordStoreMessage *) &sa[1]; |
1420 | memcpy (&sa[1], | 1420 | GNUNET_memcpy (&sa[1], |
1421 | rp_msg, | 1421 | rp_msg, |
1422 | ntohs (rp_msg->gns_header.header.size)); | 1422 | ntohs (rp_msg->gns_header.header.size)); |
1423 | sa->zm_pos = monitor_head; | 1423 | sa->zm_pos = monitor_head; |
1424 | sa->conv_name = conv_name; | 1424 | sa->conv_name = conv_name; |
1425 | GNUNET_array_grow (sa->rd, | 1425 | GNUNET_array_grow (sa->rd, |
1426 | sa->rd_count, | 1426 | sa->rd_count, |
1427 | rd_clean_off); | 1427 | rd_clean_off); |
1428 | memcpy (sa->rd, | 1428 | GNUNET_memcpy (sa->rd, |
1429 | rd_clean, | 1429 | rd_clean, |
1430 | sizeof (struct GNUNET_GNSRECORD_Data) * rd_clean_off); | 1430 | sizeof (struct GNUNET_GNSRECORD_Data) * rd_clean_off); |
1431 | continue_store_activity (sa); | 1431 | continue_store_activity (sa); |
1432 | } | 1432 | } |
1433 | } | 1433 | } |
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) | |||
434 | GNUNET_break (0); | 434 | GNUNET_break (0); |
435 | return NULL; | 435 | return NULL; |
436 | } | 436 | } |
437 | memcpy (label, | 437 | GNUNET_memcpy (label, |
438 | req->hostname, | 438 | req->hostname, |
439 | dot - req->hostname); | 439 | dot - req->hostname); |
440 | label[dot - req->hostname] = '\0'; | 440 | label[dot - req->hostname] = '\0'; |
441 | return label; | 441 | return label; |
442 | } | 442 | } |
@@ -491,9 +491,9 @@ build_dns_query (struct Request *req, | |||
491 | GNUNET_free (rawp); | 491 | GNUNET_free (rawp); |
492 | return NULL; | 492 | return NULL; |
493 | } | 493 | } |
494 | memcpy (raw, | 494 | GNUNET_memcpy (raw, |
495 | rawp, | 495 | rawp, |
496 | *raw_size); | 496 | *raw_size); |
497 | GNUNET_free (rawp); | 497 | GNUNET_free (rawp); |
498 | return raw; | 498 | return raw; |
499 | } | 499 | } |
@@ -1683,9 +1683,9 @@ queue (const char *hostname) | |||
1683 | req = GNUNET_malloc (sizeof (struct Request) + hlen); | 1683 | req = GNUNET_malloc (sizeof (struct Request) + hlen); |
1684 | req->zone = zone; | 1684 | req->zone = zone; |
1685 | req->hostname = (char *) &req[1]; | 1685 | req->hostname = (char *) &req[1]; |
1686 | memcpy (req->hostname, | 1686 | GNUNET_memcpy (req->hostname, |
1687 | hostname, | 1687 | hostname, |
1688 | hlen); | 1688 | hlen); |
1689 | req->id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | 1689 | req->id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, |
1690 | UINT16_MAX); | 1690 | UINT16_MAX); |
1691 | GNUNET_CRYPTO_hash (req->hostname, | 1691 | 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) | |||
251 | ip_pkt.dst_ip = other->s_addr; | 251 | ip_pkt.dst_ip = other->s_addr; |
252 | ip_pkt.checksum = | 252 | ip_pkt.checksum = |
253 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); | 253 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); |
254 | memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); | 254 | GNUNET_memcpy (&packet[off], |
255 | &ip_pkt, | ||
256 | sizeof (struct ip_header)); | ||
255 | off += sizeof (struct ip_header); | 257 | off += sizeof (struct ip_header); |
256 | 258 | ||
257 | icmp_pkt.type = ICMP_TIME_EXCEEDED; | 259 | icmp_pkt.type = ICMP_TIME_EXCEEDED; |
258 | icmp_pkt.code = 0; | 260 | icmp_pkt.code = 0; |
259 | icmp_pkt.checksum = 0; | 261 | icmp_pkt.checksum = 0; |
260 | icmp_pkt.unused = 0; | 262 | icmp_pkt.unused = 0; |
261 | memcpy (&packet[off], &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header)); | 263 | GNUNET_memcpy (&packet[off], |
264 | &icmp_pkt, | ||
265 | sizeof (struct icmp_ttl_exceeded_header)); | ||
262 | off += sizeof (struct icmp_ttl_exceeded_header); | 266 | off += sizeof (struct icmp_ttl_exceeded_header); |
263 | 267 | ||
264 | /* ip header of the presumably 'lost' udp packet */ | 268 | /* 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) | |||
275 | ip_pkt.dst_ip = dummy.s_addr; | 279 | ip_pkt.dst_ip = dummy.s_addr; |
276 | ip_pkt.checksum = | 280 | ip_pkt.checksum = |
277 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); | 281 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); |
278 | memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); | 282 | GNUNET_memcpy (&packet[off], |
283 | &ip_pkt, | ||
284 | sizeof (struct ip_header)); | ||
279 | off += sizeof (struct ip_header); | 285 | off += sizeof (struct ip_header); |
280 | 286 | ||
281 | /* build UDP header */ | 287 | /* build UDP header */ |
@@ -283,7 +289,9 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) | |||
283 | udp_pkt.dst_port = htons (NAT_TRAV_PORT); | 289 | udp_pkt.dst_port = htons (NAT_TRAV_PORT); |
284 | udp_pkt.length = htons (port); | 290 | udp_pkt.length = htons (port); |
285 | udp_pkt.crc = 0; | 291 | udp_pkt.crc = 0; |
286 | memcpy (&packet[off], &udp_pkt, sizeof (struct udp_header)); | 292 | GNUNET_memcpy (&packet[off], |
293 | &udp_pkt, | ||
294 | sizeof (struct udp_header)); | ||
287 | off += sizeof (struct udp_header); | 295 | off += sizeof (struct udp_header); |
288 | 296 | ||
289 | /* set ICMP checksum */ | 297 | /* set ICMP checksum */ |
@@ -292,8 +300,9 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) | |||
292 | ((uint16_t *) & packet[sizeof (struct ip_header)], | 300 | ((uint16_t *) & packet[sizeof (struct ip_header)], |
293 | sizeof (struct icmp_ttl_exceeded_header) + | 301 | sizeof (struct icmp_ttl_exceeded_header) + |
294 | sizeof (struct ip_header) + sizeof (struct udp_header))); | 302 | sizeof (struct ip_header) + sizeof (struct udp_header))); |
295 | memcpy (&packet[sizeof (struct ip_header)], &icmp_pkt, | 303 | GNUNET_memcpy (&packet[sizeof (struct ip_header)], |
296 | sizeof (struct icmp_ttl_exceeded_header)); | 304 | &icmp_pkt, |
305 | sizeof (struct icmp_ttl_exceeded_header)); | ||
297 | 306 | ||
298 | memset (&dst, 0, sizeof (dst)); | 307 | memset (&dst, 0, sizeof (dst)); |
299 | dst.sin_family = AF_INET; | 308 | dst.sin_family = AF_INET; |
@@ -352,7 +361,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) | |||
352 | ip_pkt.dst_ip = other->s_addr; | 361 | ip_pkt.dst_ip = other->s_addr; |
353 | ip_pkt.checksum = | 362 | ip_pkt.checksum = |
354 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); | 363 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); |
355 | memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); | 364 | GNUNET_memcpy (&packet[off], |
365 | &ip_pkt, | ||
366 | sizeof (struct ip_header)); | ||
356 | off = sizeof (ip_pkt); | 367 | off = sizeof (ip_pkt); |
357 | 368 | ||
358 | /* icmp reply: time exceeded */ | 369 | /* icmp reply: time exceeded */ |
@@ -360,7 +371,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) | |||
360 | icmp_ttl.code = 0; | 371 | icmp_ttl.code = 0; |
361 | icmp_ttl.checksum = 0; | 372 | icmp_ttl.checksum = 0; |
362 | icmp_ttl.unused = 0; | 373 | icmp_ttl.unused = 0; |
363 | memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); | 374 | GNUNET_memcpy (&packet[off], |
375 | &icmp_ttl, | ||
376 | sizeof (struct icmp_ttl_exceeded_header)); | ||
364 | off += sizeof (struct icmp_ttl_exceeded_header); | 377 | off += sizeof (struct icmp_ttl_exceeded_header); |
365 | 378 | ||
366 | /* ip header of the presumably 'lost' udp packet */ | 379 | /* 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) | |||
377 | ip_pkt.checksum = 0; | 390 | ip_pkt.checksum = 0; |
378 | ip_pkt.checksum = | 391 | ip_pkt.checksum = |
379 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); | 392 | htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); |
380 | memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); | 393 | GNUNET_memcpy (&packet[off], |
394 | &ip_pkt, | ||
395 | sizeof (struct ip_header)); | ||
381 | off += sizeof (struct ip_header); | 396 | off += sizeof (struct ip_header); |
382 | 397 | ||
383 | icmp_echo.type = ICMP_ECHO; | 398 | icmp_echo.type = ICMP_ECHO; |
@@ -386,8 +401,10 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) | |||
386 | icmp_echo.checksum = 0; | 401 | icmp_echo.checksum = 0; |
387 | icmp_echo.checksum = | 402 | icmp_echo.checksum = |
388 | htons (calc_checksum | 403 | htons (calc_checksum |
389 | ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header))); | 404 | ((uint16_t *) &icmp_echo, sizeof (struct icmp_echo_header))); |
390 | memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header)); | 405 | GNUNET_memcpy (&packet[off], |
406 | &icmp_echo, | ||
407 | sizeof (struct icmp_echo_header)); | ||
391 | 408 | ||
392 | /* no go back to calculate ICMP packet checksum */ | 409 | /* no go back to calculate ICMP packet checksum */ |
393 | off = sizeof (struct ip_header); | 410 | off = sizeof (struct ip_header); |
@@ -396,7 +413,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) | |||
396 | ((uint16_t *) & packet[off], | 413 | ((uint16_t *) & packet[off], |
397 | sizeof (struct icmp_ttl_exceeded_header) + | 414 | sizeof (struct icmp_ttl_exceeded_header) + |
398 | sizeof (struct ip_header) + sizeof (struct icmp_echo_header))); | 415 | sizeof (struct ip_header) + sizeof (struct icmp_echo_header))); |
399 | memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); | 416 | GNUNET_memcpy (&packet[off], |
417 | &icmp_ttl, | ||
418 | sizeof (struct icmp_ttl_exceeded_header)); | ||
400 | 419 | ||
401 | /* prepare for transmission */ | 420 | /* prepare for transmission */ |
402 | memset (&dst, 0, sizeof (dst)); | 421 | 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) | |||
266 | ip_pkt.checksum = | 266 | ip_pkt.checksum = |
267 | htons (calc_checksum ((uint16_t *) & ip_pkt, | 267 | htons (calc_checksum ((uint16_t *) & ip_pkt, |
268 | sizeof (struct ip_header))); | 268 | sizeof (struct ip_header))); |
269 | memcpy (&packet[off], | 269 | GNUNET_memcpy (&packet[off], |
270 | &ip_pkt, | 270 | &ip_pkt, |
271 | sizeof (struct ip_header)); | 271 | sizeof (struct ip_header)); |
272 | off += sizeof (struct ip_header); | 272 | off += sizeof (struct ip_header); |
273 | 273 | ||
274 | icmp_echo.type = ICMP_ECHO; | 274 | icmp_echo.type = ICMP_ECHO; |
@@ -279,9 +279,9 @@ send_icmp_echo (const struct in_addr *my_ip) | |||
279 | htons (calc_checksum | 279 | htons (calc_checksum |
280 | ((uint16_t *) & icmp_echo, | 280 | ((uint16_t *) & icmp_echo, |
281 | sizeof (struct icmp_echo_header))); | 281 | sizeof (struct icmp_echo_header))); |
282 | memcpy (&packet[off], | 282 | GNUNET_memcpy (&packet[off], |
283 | &icmp_echo, | 283 | &icmp_echo, |
284 | sizeof (struct icmp_echo_header)); | 284 | sizeof (struct icmp_echo_header)); |
285 | off += sizeof (struct icmp_echo_header); | 285 | off += sizeof (struct icmp_echo_header); |
286 | 286 | ||
287 | memset (&dst, 0, sizeof (dst)); | 287 | memset (&dst, 0, sizeof (dst)); |
@@ -388,9 +388,13 @@ process_icmp_response () | |||
388 | return; | 388 | return; |
389 | } | 389 | } |
390 | off = 0; | 390 | off = 0; |
391 | memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header)); | 391 | GNUNET_memcpy (&ip_pkt, |
392 | &buf[off], | ||
393 | sizeof (struct ip_header)); | ||
392 | off += sizeof (struct ip_header); | 394 | off += sizeof (struct ip_header); |
393 | memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header)); | 395 | GNUNET_memcpy (&icmp_ttl, |
396 | &buf[off], | ||
397 | sizeof (struct icmp_ttl_exceeded_header)); | ||
394 | off += sizeof (struct icmp_ttl_exceeded_header); | 398 | off += sizeof (struct icmp_ttl_exceeded_header); |
395 | if ((ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code)) | 399 | if ((ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code)) |
396 | { | 400 | { |
@@ -401,7 +405,9 @@ process_icmp_response () | |||
401 | source_ip.s_addr = ip_pkt.src_ip; | 405 | source_ip.s_addr = ip_pkt.src_ip; |
402 | 406 | ||
403 | /* skip 2nd IP header */ | 407 | /* skip 2nd IP header */ |
404 | memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header)); | 408 | GNUNET_memcpy (&ip_pkt, |
409 | &buf[off], | ||
410 | sizeof (struct ip_header)); | ||
405 | off += sizeof (struct ip_header); | 411 | off += sizeof (struct ip_header); |
406 | 412 | ||
407 | switch (ip_pkt.proto) | 413 | switch (ip_pkt.proto) |
@@ -416,7 +422,9 @@ process_icmp_response () | |||
416 | return; | 422 | return; |
417 | } | 423 | } |
418 | /* grab ICMP ECHO content */ | 424 | /* grab ICMP ECHO content */ |
419 | memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header)); | 425 | GNUNET_memcpy (&icmp_echo, |
426 | &buf[off], | ||
427 | sizeof (struct icmp_echo_header)); | ||
420 | port = (uint16_t) ntohl (icmp_echo.reserved); | 428 | port = (uint16_t) ntohl (icmp_echo.reserved); |
421 | break; | 429 | break; |
422 | case IPPROTO_UDP: | 430 | case IPPROTO_UDP: |
@@ -428,7 +436,9 @@ process_icmp_response () | |||
428 | return; | 436 | return; |
429 | } | 437 | } |
430 | /* grab UDP content */ | 438 | /* grab UDP content */ |
431 | memcpy (&udp_pkt, &buf[off], sizeof (struct udp_header)); | 439 | GNUNET_memcpy (&udp_pkt, |
440 | &buf[off], | ||
441 | sizeof (struct udp_header)); | ||
432 | port = ntohs (udp_pkt.length); | 442 | port = ntohs (udp_pkt.length); |
433 | break; | 443 | break; |
434 | default: | 444 | 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, | |||
1234 | ch->hole_external); | 1234 | ch->hole_external); |
1235 | 1235 | ||
1236 | /* build sockaddr storage with port number */ | 1236 | /* build sockaddr storage with port number */ |
1237 | memset (&ss, 0, sizeof (ss)); | 1237 | memset (&ss, |
1238 | memcpy (&ss, addr, addrlen); | 1238 | 0, |
1239 | sizeof (ss)); | ||
1240 | GNUNET_memcpy (&ss, | ||
1241 | addr, | ||
1242 | addrlen); | ||
1239 | switch (addr->sa_family) | 1243 | switch (addr->sa_family) |
1240 | { | 1244 | { |
1241 | case AF_INET: | 1245 | 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, | |||
172 | size_t array_size; | 172 | size_t array_size; |
173 | 173 | ||
174 | array_size = sizeof(struct RegexCombineCtx *) * src->size; | 174 | array_size = sizeof(struct RegexCombineCtx *) * src->size; |
175 | memcpy (dst->children, | 175 | GNUNET_memcpy (dst->children, |
176 | src->children, | 176 | src->children, |
177 | array_size); | 177 | array_size); |
178 | for (unsigned int i = 0; i < src->size; i++) | 178 | for (unsigned int i = 0; i < src->size; i++) |
179 | { | 179 | { |
180 | src->children[i] = NULL; | 180 | src->children[i] = NULL; |
@@ -364,7 +364,9 @@ regex_add_multiple (struct RegexCombineCtx *ctx, | |||
364 | newctx = new_regex_ctx(ctx->size); | 364 | newctx = new_regex_ctx(ctx->size); |
365 | newctx->s = GNUNET_strdup (tmp); | 365 | newctx->s = GNUNET_strdup (tmp); |
366 | if (children != NULL) | 366 | if (children != NULL) |
367 | memcpy (newctx->children, children, sizeof (*children) * ctx->size); | 367 | GNUNET_memcpy (newctx->children, |
368 | children, | ||
369 | sizeof (*children) * ctx->size); | ||
368 | ctx->children[c2i(tmp[0], ctx->size)] = newctx; | 370 | ctx->children[c2i(tmp[0], ctx->size)] = newctx; |
369 | } | 371 | } |
370 | } | 372 | } |
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) | |||
1836 | * @param a | 1836 | * @param a |
1837 | * @param b | 1837 | * @param b |
1838 | * | 1838 | * |
1839 | * @return | 1839 | * @return |
1840 | */ | 1840 | */ |
1841 | static int is_in_view (uint32_t a, uint32_t b) | 1841 | static int is_in_view (uint32_t a, uint32_t b) |
1842 | { | 1842 | { |
@@ -2172,9 +2172,9 @@ void view_update_cb (void *cls, | |||
2172 | rps_peer->cur_view_count, | 2172 | rps_peer->cur_view_count, |
2173 | view_size); | 2173 | view_size); |
2174 | //*rps_peer->cur_view = *peers; | 2174 | //*rps_peer->cur_view = *peers; |
2175 | memcpy (rps_peer->cur_view, | 2175 | GNUNET_memcpy (rps_peer->cur_view, |
2176 | peers, | 2176 | peers, |
2177 | view_size * sizeof (struct GNUNET_PeerIdentity)); | 2177 | view_size * sizeof (struct GNUNET_PeerIdentity)); |
2178 | to_file ("/tmp/rps/count_in_views.txt", | 2178 | to_file ("/tmp/rps/count_in_views.txt", |
2179 | "%" PRIu64 " %" PRIu32 "", | 2179 | "%" PRIu64 " %" PRIu32 "", |
2180 | rps_peer->index, | 2180 | 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, | |||
53 | int rc; | 53 | int rc; |
54 | int key_len; | 54 | int key_len; |
55 | unsigned char* key_buf; | 55 | unsigned char* key_buf; |
56 | 56 | ||
57 | key_len = element_length_in_bytes(k) < 33 ? 3 : element_length_in_bytes(k); | 57 | key_len = element_length_in_bytes(k) < 33 ? 3 : element_length_in_bytes(k); |
58 | key_buf = (unsigned char*) malloc(key_len); | 58 | key_buf = (unsigned char*) malloc(key_len); |
59 | element_to_bytes(key_buf, k); | 59 | element_to_bytes(key_buf, k); |
60 | 60 | ||
61 | memcpy (key->aes_key, key_buf, GNUNET_CRYPTO_AES_KEY_LENGTH); | 61 | GNUNET_memcpy (key->aes_key, |
62 | key_buf, | ||
63 | GNUNET_CRYPTO_AES_KEY_LENGTH); | ||
62 | GNUNET_assert (0 == | 64 | GNUNET_assert (0 == |
63 | gcry_cipher_open (handle, GCRY_CIPHER_AES256, | 65 | gcry_cipher_open (handle, GCRY_CIPHER_AES256, |
64 | GCRY_CIPHER_MODE_CFB, 0)); | 66 | GCRY_CIPHER_MODE_CFB, 0)); |
@@ -123,16 +125,16 @@ aes_128_cbc_decrypt( char* ct, | |||
123 | unsigned char iv[16]; | 125 | unsigned char iv[16]; |
124 | char* tmp; | 126 | char* tmp; |
125 | uint32_t len; | 127 | uint32_t len; |
126 | 128 | ||
127 | init_aes(k, 1, &handle, &skey, iv); | 129 | init_aes(k, 1, &handle, &skey, iv); |
128 | 130 | ||
129 | tmp = GNUNET_malloc (size); | 131 | tmp = GNUNET_malloc (size); |
130 | 132 | ||
131 | //AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT); | 133 | //AES_cbc_encrypt(ct->data, pt->data, ct->len, &key, iv, AES_DECRYPT); |
132 | GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size)); | 134 | GNUNET_assert (0 == gcry_cipher_decrypt (handle, tmp, size, ct, size)); |
133 | gcry_cipher_close (handle); | 135 | gcry_cipher_close (handle); |
134 | /* TODO make less crufty */ | 136 | /* TODO make less crufty */ |
135 | 137 | ||
136 | /* get real length */ | 138 | /* get real length */ |
137 | len = 0; | 139 | len = 0; |
138 | len = len | 140 | len = len |
@@ -173,7 +175,7 @@ GNUNET_CRYPTO_cpabe_create_key (struct GNUNET_CRYPTO_AbeMasterKey *key, | |||
173 | struct GNUNET_CRYPTO_AbeKey *prv_key; | 175 | struct GNUNET_CRYPTO_AbeKey *prv_key; |
174 | int size; | 176 | int size; |
175 | char *tmp; | 177 | char *tmp; |
176 | 178 | ||
177 | prv_key = GNUNET_new (struct GNUNET_CRYPTO_AbeKey); | 179 | prv_key = GNUNET_new (struct GNUNET_CRYPTO_AbeKey); |
178 | prv_key->prv = gabe_keygen(key->pub, key->msk, attrs); | 180 | prv_key->prv = gabe_keygen(key->pub, key->msk, attrs); |
179 | size = gabe_pub_serialize(key->pub, &tmp); | 181 | size = gabe_pub_serialize(key->pub, &tmp); |
@@ -204,7 +206,7 @@ write_cpabe (void **result, | |||
204 | { | 206 | { |
205 | char *ptr; | 207 | char *ptr; |
206 | uint32_t *len; | 208 | uint32_t *len; |
207 | 209 | ||
208 | *result = GNUNET_malloc (12 + cph_buf_len + aes_buf_len); | 210 | *result = GNUNET_malloc (12 + cph_buf_len + aes_buf_len); |
209 | ptr = *result; | 211 | ptr = *result; |
210 | len = (uint32_t*) ptr; | 212 | len = (uint32_t*) ptr; |
@@ -213,12 +215,12 @@ write_cpabe (void **result, | |||
213 | len = (uint32_t*) ptr; | 215 | len = (uint32_t*) ptr; |
214 | *len = htonl (aes_buf_len); | 216 | *len = htonl (aes_buf_len); |
215 | ptr += 4; | 217 | ptr += 4; |
216 | memcpy (ptr, aes_buf, aes_buf_len); | 218 | GNUNET_memcpy (ptr, aes_buf, aes_buf_len); |
217 | ptr += aes_buf_len; | 219 | ptr += aes_buf_len; |
218 | len = (uint32_t*) ptr; | 220 | len = (uint32_t*) ptr; |
219 | *len = htonl (cph_buf_len); | 221 | *len = htonl (cph_buf_len); |
220 | ptr += 4; | 222 | ptr += 4; |
221 | memcpy (ptr, cph_buf, cph_buf_len); | 223 | GNUNET_memcpy (ptr, cph_buf, cph_buf_len); |
222 | return 12 + cph_buf_len + aes_buf_len; | 224 | return 12 + cph_buf_len + aes_buf_len; |
223 | } | 225 | } |
224 | 226 | ||
@@ -241,13 +243,13 @@ read_cpabe (const void *data, | |||
241 | *aes_buf_len = ntohl (*len); | 243 | *aes_buf_len = ntohl (*len); |
242 | ptr += 4; | 244 | ptr += 4; |
243 | *aes_buf = GNUNET_malloc (*aes_buf_len); | 245 | *aes_buf = GNUNET_malloc (*aes_buf_len); |
244 | memcpy(*aes_buf, ptr, *aes_buf_len); | 246 | GNUNET_memcpy (*aes_buf, ptr, *aes_buf_len); |
245 | ptr += *aes_buf_len; | 247 | ptr += *aes_buf_len; |
246 | len = (uint32_t*)ptr; | 248 | len = (uint32_t*)ptr; |
247 | *cph_buf_len = ntohl (*len); | 249 | *cph_buf_len = ntohl (*len); |
248 | ptr += 4; | 250 | ptr += 4; |
249 | *cph_buf = GNUNET_malloc (*cph_buf_len); | 251 | *cph_buf = GNUNET_malloc (*cph_buf_len); |
250 | memcpy(*cph_buf, ptr, *cph_buf_len); | 252 | GNUNET_memcpy (*cph_buf, ptr, *cph_buf_len); |
251 | 253 | ||
252 | return buf_len; | 254 | return buf_len; |
253 | } | 255 | } |
@@ -362,7 +364,7 @@ GNUNET_CRYPTO_cpabe_deserialize_key (const void *data, | |||
362 | &prv_len); | 364 | &prv_len); |
363 | key->pub = gabe_pub_unserialize (pub, pub_len); | 365 | key->pub = gabe_pub_unserialize (pub, pub_len); |
364 | key->prv = gabe_prv_unserialize (key->pub, prv, prv_len); | 366 | key->prv = gabe_prv_unserialize (key->pub, prv, prv_len); |
365 | 367 | ||
366 | GNUNET_free (pub); | 368 | GNUNET_free (pub); |
367 | GNUNET_free (prv); | 369 | GNUNET_free (prv); |
368 | return key; | 370 | return key; |
@@ -408,7 +410,7 @@ GNUNET_CRYPTO_cpabe_deserialize_master_key (const void *data, | |||
408 | &msk_len); | 410 | &msk_len); |
409 | key->pub = gabe_pub_unserialize (pub, pub_len); | 411 | key->pub = gabe_pub_unserialize (pub, pub_len); |
410 | key->msk = gabe_msk_unserialize (key->pub, msk, msk_len); | 412 | key->msk = gabe_msk_unserialize (key->pub, msk, msk_len); |
411 | 413 | ||
412 | GNUNET_free (pub); | 414 | GNUNET_free (pub); |
413 | GNUNET_free (msk); | 415 | GNUNET_free (msk); |
414 | 416 | ||