diff options
Diffstat (limited to 'src/abd')
-rw-r--r-- | src/abd/abd.h | 8 | ||||
-rw-r--r-- | src/abd/abd_serialization.c | 4 | ||||
-rw-r--r-- | src/abd/delegate_misc.c | 8 | ||||
-rw-r--r-- | src/abd/gnunet-abd.c | 31 | ||||
-rw-r--r-- | src/abd/plugin_gnsrecord_abd.c | 6 |
5 files changed, 33 insertions, 24 deletions
diff --git a/src/abd/abd.h b/src/abd/abd.h index 1e9d6bcea..0af0d43ca 100644 --- a/src/abd/abd.h +++ b/src/abd/abd.h | |||
@@ -245,14 +245,14 @@ struct DelegateEntry | |||
245 | { | 245 | { |
246 | 246 | ||
247 | /** | 247 | /** |
248 | * The signature for this credential by the issuer | 248 | * Signature meta |
249 | */ | 249 | */ |
250 | struct GNUNET_CRYPTO_EcdsaSignature signature; | 250 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; |
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Signature meta | 253 | * The signature for this credential by the issuer |
254 | */ | 254 | */ |
255 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | 255 | struct GNUNET_CRYPTO_EcdsaSignature signature; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * Public key of the issuer | 258 | * Public key of the issuer |
diff --git a/src/abd/abd_serialization.c b/src/abd/abd_serialization.c index 90a89886b..c03fab7dc 100644 --- a/src/abd/abd_serialization.c +++ b/src/abd/abd_serialization.c | |||
@@ -451,7 +451,7 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele, | |||
451 | 451 | ||
452 | if (GNUNET_OK != | 452 | if (GNUNET_OK != |
453 | GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE, | 453 | GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE, |
454 | &cdata->purpose, | 454 | cdata, |
455 | &cdata->signature, | 455 | &cdata->signature, |
456 | &cdata->issuer_key)) | 456 | &cdata->issuer_key)) |
457 | { | 457 | { |
@@ -474,7 +474,7 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size) | |||
474 | cdata = (struct DelegateEntry *) data; | 474 | cdata = (struct DelegateEntry *) data; |
475 | if (GNUNET_OK != | 475 | if (GNUNET_OK != |
476 | GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE, | 476 | GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE, |
477 | &cdata->purpose, | 477 | cdata, |
478 | &cdata->signature, | 478 | &cdata->signature, |
479 | &cdata->issuer_key)) | 479 | &cdata->issuer_key)) |
480 | { | 480 | { |
diff --git a/src/abd/delegate_misc.c b/src/abd/delegate_misc.c index df34cff8b..4740a3e30 100644 --- a/src/abd/delegate_misc.c +++ b/src/abd/delegate_misc.c | |||
@@ -240,13 +240,7 @@ GNUNET_ABD_delegate_issue ( | |||
240 | 240 | ||
241 | GNUNET_memcpy (&del[1], tmp_str, attr_len); | 241 | GNUNET_memcpy (&del[1], tmp_str, attr_len); |
242 | 242 | ||
243 | if (GNUNET_OK != | 243 | GNUNET_CRYPTO_ecdsa_sign (issuer, del, &del->signature); |
244 | GNUNET_CRYPTO_ecdsa_sign (issuer, &del->purpose, &del->signature)) | ||
245 | { | ||
246 | GNUNET_break (0); | ||
247 | GNUNET_free (del); | ||
248 | return NULL; | ||
249 | } | ||
250 | 244 | ||
251 | dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len); | 245 | dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len); |
252 | dele->signature = del->signature; | 246 | dele->signature = del->signature; |
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c index eb3e29e23..6cf4aab0d 100644 --- a/src/abd/gnunet-abd.c +++ b/src/abd/gnunet-abd.c | |||
@@ -512,11 +512,13 @@ get_existing_record (void *cls, | |||
512 | unsigned int rd_count, | 512 | unsigned int rd_count, |
513 | const struct GNUNET_GNSRECORD_Data *rd) | 513 | const struct GNUNET_GNSRECORD_Data *rd) |
514 | { | 514 | { |
515 | struct GNUNET_GNSRECORD_Data rdn[rd_count + 1]; | ||
516 | struct GNUNET_GNSRECORD_Data *rde; | 515 | struct GNUNET_GNSRECORD_Data *rde; |
516 | struct GNUNET_GNSRECORD_Data* rdn = | ||
517 | GNUNET_malloc(sizeof(*rdn)*(rd_count + 1)); | ||
517 | 518 | ||
518 | memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); | 519 | memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); |
519 | GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); | 520 | GNUNET_memcpy (&rdn[1], rd, |
521 | rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); | ||
520 | rde = &rdn[0]; | 522 | rde = &rdn[0]; |
521 | rde->data = data; | 523 | rde->data = data; |
522 | rde->data_size = data_size; | 524 | rde->data_size = data_size; |
@@ -539,7 +541,7 @@ get_existing_record (void *cls, | |||
539 | rde, | 541 | rde, |
540 | &add_continuation, | 542 | &add_continuation, |
541 | &add_qe); | 543 | &add_qe); |
542 | 544 | GNUNET_free(rdn); | |
543 | return; | 545 | return; |
544 | } | 546 | } |
545 | 547 | ||
@@ -602,10 +604,18 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
602 | if (GNUNET_OK != | 604 | if (GNUNET_OK != |
603 | GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size)) | 605 | GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size)) |
604 | { | 606 | { |
605 | fprintf (stderr, | 607 | if(typestring == NULL) { |
606 | "Value `%s' invalid for record type `%s'\n", | 608 | fputs("No value for unknown record type\n", stderr); |
607 | subject, | 609 | } else if(subject == NULL) { |
608 | typestring); | 610 | fprintf(stderr, |
611 | "No value for record type`%s'\n", | ||
612 | typestring); | ||
613 | } else { | ||
614 | fprintf (stderr, | ||
615 | "Value `%s' invalid for record type `%s'\n", | ||
616 | subject, | ||
617 | typestring); | ||
618 | } | ||
609 | GNUNET_SCHEDULER_shutdown (); | 619 | GNUNET_SCHEDULER_shutdown (); |
610 | return; | 620 | return; |
611 | } | 621 | } |
@@ -917,7 +927,8 @@ run (void *cls, | |||
917 | int i; | 927 | int i; |
918 | while (NULL != (tok = strtok (NULL, ","))) | 928 | while (NULL != (tok = strtok (NULL, ","))) |
919 | count++; | 929 | count++; |
920 | struct GNUNET_ABD_Delegate delegates[count]; | 930 | struct GNUNET_ABD_Delegate* delegates = |
931 | GNUNET_malloc(sizeof(*delegates)*count); | ||
921 | struct GNUNET_ABD_Delegate *dele; | 932 | struct GNUNET_ABD_Delegate *dele; |
922 | GNUNET_free (tmp); | 933 | GNUNET_free (tmp); |
923 | tmp = GNUNET_strdup (subject_delegate); | 934 | tmp = GNUNET_strdup (subject_delegate); |
@@ -946,9 +957,11 @@ run (void *cls, | |||
946 | NULL); | 957 | NULL); |
947 | for (i = 0; i < count; i++) | 958 | for (i = 0; i < count; i++) |
948 | { | 959 | { |
949 | GNUNET_free ((char *) delegates[i].issuer_attribute); | 960 | GNUNET_free_nz ((char *) delegates[i].issuer_attribute); |
961 | delegates[i].issuer_attribute = NULL; | ||
950 | } | 962 | } |
951 | GNUNET_free (tmp); | 963 | GNUNET_free (tmp); |
964 | GNUNET_free(delegates); | ||
952 | } | 965 | } |
953 | else | 966 | else |
954 | { | 967 | { |
diff --git a/src/abd/plugin_gnsrecord_abd.c b/src/abd/plugin_gnsrecord_abd.c index c7635b997..850fa9a45 100644 --- a/src/abd/plugin_gnsrecord_abd.c +++ b/src/abd/plugin_gnsrecord_abd.c | |||
@@ -235,8 +235,10 @@ abd_string_to_value (void *cls, | |||
235 | (char *) &sets[1]); | 235 | (char *) &sets[1]); |
236 | for (i = 0; i < entries; i++) | 236 | for (i = 0; i < entries; i++) |
237 | { | 237 | { |
238 | if (0 != set[i].subject_attribute_len) | 238 | if (0 != set[i].subject_attribute_len) { |
239 | GNUNET_free ((char *) set[i].subject_attribute); | 239 | GNUNET_free_nz ((char *) set[i].subject_attribute); |
240 | set[i].subject_attribute = NULL; | ||
241 | } | ||
240 | } | 242 | } |
241 | sets->set_count = htonl (entries); | 243 | sets->set_count = htonl (entries); |
242 | sets->data_size = GNUNET_htonll (tmp_data_size); | 244 | sets->data_size = GNUNET_htonll (tmp_data_size); |