Public paste
Undefined
By: Guest | Date: Apr 27 2020 23:21 | Format: None | Expires: never | Size: 5.52 KB | Hits: 503

  1. diff --git a/src/abd/abd.h b/src/abd/abd.h
  2. index 1e9d6bcea..0af0d43ca 100644
  3. --- a/src/abd/abd.h
  4. +++ b/src/abd/abd.h
  5. @@ -245,14 +245,14 @@ struct DelegateEntry
  6.  {
  7.  
  8.    /**
  9. -   * The signature for this credential by the issuer
  10. +   * Signature meta
  11.     */
  12. -  struct GNUNET_CRYPTO_EcdsaSignature signature;
  13. +  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
  14.  
  15.    /**
  16. -   * Signature meta
  17. +   * The signature for this credential by the issuer
  18.     */
  19. -  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
  20. +  struct GNUNET_CRYPTO_EcdsaSignature signature;
  21.  
  22.    /**
  23.     * Public key of the issuer
  24. diff --git a/src/abd/abd_serialization.c b/src/abd/abd_serialization.c
  25. index 90a89886b..c03fab7dc 100644
  26. --- a/src/abd/abd_serialization.c
  27. +++ b/src/abd/abd_serialization.c
  28. @@ -451,7 +451,7 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele,
  29.  
  30.    if (GNUNET_OK !=
  31.        GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
  32. -                                  &cdata->purpose,
  33. +                                  cdata,
  34.                                    &cdata->signature,
  35.                                    &cdata->issuer_key))
  36.    {
  37. @@ -474,7 +474,7 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size)
  38.    cdata = (struct DelegateEntry *) data;
  39.    if (GNUNET_OK !=
  40.        GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_DELEGATE,
  41. -                                  &cdata->purpose,
  42. +                                  cdata,
  43.                                    &cdata->signature,
  44.                                    &cdata->issuer_key))
  45.    {
  46. diff --git a/src/abd/delegate_misc.c b/src/abd/delegate_misc.c
  47. index df34cff8b..4740a3e30 100644
  48. --- a/src/abd/delegate_misc.c
  49. +++ b/src/abd/delegate_misc.c
  50. @@ -240,13 +240,7 @@ GNUNET_ABD_delegate_issue (
  51.  
  52.    GNUNET_memcpy (&del[1], tmp_str, attr_len);
  53.  
  54. -  if (GNUNET_OK !=
  55. -      GNUNET_CRYPTO_ecdsa_sign (issuer, &del->purpose, &del->signature))
  56. -  {
  57. -    GNUNET_break (0);
  58. -    GNUNET_free (del);
  59. -    return NULL;
  60. -  }
  61. +  GNUNET_CRYPTO_ecdsa_sign (issuer, del, &del->signature);
  62.  
  63.    dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
  64.    dele->signature = del->signature;
  65. diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c
  66. index eb3e29e23..6cf4aab0d 100644
  67. --- a/src/abd/gnunet-abd.c
  68. +++ b/src/abd/gnunet-abd.c
  69. @@ -512,11 +512,13 @@ get_existing_record (void *cls,
  70.                       unsigned int rd_count,
  71.                       const struct GNUNET_GNSRECORD_Data *rd)
  72.  {
  73. -  struct GNUNET_GNSRECORD_Data rdn[rd_count + 1];
  74.    struct GNUNET_GNSRECORD_Data *rde;
  75. +  struct GNUNET_GNSRECORD_Data* rdn =
  76. +    GNUNET_malloc(sizeof(*rdn)*(rd_count + 1));
  77.  
  78.    memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
  79. -  GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
  80. +  GNUNET_memcpy (&rdn[1], rd,
  81. +                 rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
  82.    rde = &rdn[0];
  83.    rde->data = data;
  84.    rde->data_size = data_size;
  85. @@ -539,7 +541,7 @@ get_existing_record (void *cls,
  86.                                             rde,
  87.                                             &add_continuation,
  88.                                             &add_qe);
  89. -
  90. +  GNUNET_free(rdn);
  91.    return;
  92.  }
  93.  
  94. @@ -602,10 +604,18 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego)
  95.      if (GNUNET_OK !=
  96.          GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size))
  97.      {
  98. -      fprintf (stderr,
  99. -               "Value `%s' invalid for record type `%s'\n",
  100. -               subject,
  101. -               typestring);
  102. +      if(typestring == NULL) {
  103. +        fputs("No value for unknown record type\n", stderr);
  104. +      } else if(subject == NULL) {
  105. +        fprintf(stderr,
  106. +                "No value for record type`%s'\n",
  107. +                typestring);
  108. +      } else {
  109. +        fprintf (stderr,
  110. +                 "Value `%s' invalid for record type `%s'\n",
  111. +                 subject,
  112. +                 typestring);
  113. +      }
  114.        GNUNET_SCHEDULER_shutdown ();
  115.        return;
  116.      }
  117. @@ -917,7 +927,8 @@ run (void *cls,
  118.      int i;
  119.      while (NULL != (tok = strtok (NULL, ",")))
  120.        count++;
  121. -    struct GNUNET_ABD_Delegate delegates[count];
  122. +    struct GNUNET_ABD_Delegate* delegates =
  123. +      GNUNET_malloc(sizeof(*delegates)*count);
  124.      struct GNUNET_ABD_Delegate *dele;
  125.      GNUNET_free (tmp);
  126.      tmp = GNUNET_strdup (subject_delegate);
  127. @@ -946,9 +957,11 @@ run (void *cls,
  128.                                          NULL);
  129.      for (i = 0; i < count; i++)
  130.      {
  131. -      GNUNET_free ((char *) delegates[i].issuer_attribute);
  132. +      GNUNET_free_nz ((char *) delegates[i].issuer_attribute);
  133. +      delegates[i].issuer_attribute = NULL;
  134.      }
  135.      GNUNET_free (tmp);
  136. +    GNUNET_free(delegates);
  137.    }
  138.    else
  139.    {
  140. diff --git a/src/abd/plugin_gnsrecord_abd.c b/src/abd/plugin_gnsrecord_abd.c
  141. index c7635b997..850fa9a45 100644
  142. --- a/src/abd/plugin_gnsrecord_abd.c
  143. +++ b/src/abd/plugin_gnsrecord_abd.c
  144. @@ -235,8 +235,10 @@ abd_string_to_value (void *cls,
  145.                                             (char *) &sets[1]);
  146.        for (i = 0; i < entries; i++)
  147.        {
  148. -        if (0 != set[i].subject_attribute_len)
  149. -          GNUNET_free ((char *) set[i].subject_attribute);
  150. +        if (0 != set[i].subject_attribute_len) {
  151. +          GNUNET_free_nz ((char *) set[i].subject_attribute);
  152. +          set[i].subject_attribute = NULL;
  153. +        }
  154.        }
  155.        sets->set_count = htonl (entries);
  156.        sets->data_size = GNUNET_htonll (tmp_data_size);
  157.