const struct GNUNET_GNSRECORD_Data *rd)
{
struct AttributeIterator *ai = cls;
- struct AttributeResultMessage *arm;
struct GNUNET_MQ_Envelope *env;
char *data_tmp;
if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type )
{
+ struct AttributeResultMessage *arm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
label);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
{
if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type )
{
+ struct AttributeResultMessage *arm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
label);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
}
else
{
+ struct ReferenceResultMessage *rrm;
+ char *data_tmp2;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found reference under: %s\n",
label);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending REFERENCE_RESULT message\n");
- env = GNUNET_MQ_msg_extra (arm,
- rd[i].data_size,
+ env = GNUNET_MQ_msg_extra (rrm,
+ rd[i].data_size + rd[0].data_size,
GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT);
- arm->id = htonl (ai->request_id);
- arm->attr_len = htons (rd[i].data_size);
- GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
- data_tmp = (char *) &arm[1];
- GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
+ rrm->id = htonl (ai->request_id);
+ rrm->attest_len = htons (rd[0].data_size);
+ rrm->ref_len = htons (rd[i].data_size);
+ GNUNET_CRYPTO_ecdsa_key_get_public (zone, &rrm->identity);
+ data_tmp = (char *) &rrm[1];
+ GNUNET_memcpy (data_tmp, rd[0].data, rd[0].data_size);
+ data_tmp2 = (char *) &rrm[2];
+ GNUNET_memcpy (data_tmp2, rd[i].data, rd[i].data_size);
+
GNUNET_MQ_send (ai->client->mq, env);
}
}
}
}
-
/**
* Iterate over zone to get attributes
*
if ((NULL == reference->name) || (NULL == reference->reference_value))
{
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str));
json_array_append (handle->resp_object, attr_obj);
json_decref (attr_obj);
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
}
/**
char *tmp_value;
char *id_str;
+
+ if (NULL != reference)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Attestation Collection with Reference\n");
+ return;
+ }
if (NULL == attest)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Attestation Collection with empty Attestation\n");
GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
if ((NULL == attest->name) || (NULL == attest->data))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Attestation Collection with empty Name/Value\n");
GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
const char *type;
char *id_str;
- if ((NULL == attr)&& (NULL == reference))
+ if ((NULL == attr) && (NULL == reference))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute Collection with empty Attribute/Reference\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Attribute Collection with empty Attribute/Reference\n");
GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
if ((NULL == reference->name) || (NULL == reference->reference_value))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute Collection with empty Reference Name/Value\n");
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Attribute Collection with empty Reference Name/Value\n");
return;
}
json_object_set_new (attr_obj, "type", json_string (type));
json_array_append (handle->resp_object, attr_obj);
json_decref (attr_obj);
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
}
else
{
if ((NULL == attr->name) || (NULL == attr->data))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute Collection with empty Attribute Name/Value\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Attribute Collection with empty Attribute Name/Value\n");
GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
*/
};
+/**
+ * Reference plus Attestation is returned from the idp.
+ */
+struct ReferenceResultMessage
+{
+ /**
+ * Message header
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Unique identifier for this request (for key collisions).
+ */
+ uint32_t id GNUNET_PACKED;
+
+ /**
+ * Length of serialized attestation data
+ */
+ uint16_t attest_len GNUNET_PACKED;
+
+ /**
+ * Length of serialized reference data
+ */
+ uint16_t ref_len GNUNET_PACKED;
+
+ /**
+ * always zero (for alignment)
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+ /**
+ * The public key of the identity.
+ */
+ struct GNUNET_CRYPTO_EcdsaPublicKey identity;
+
+ /* followed by:
+ * serialized reference data + attestation data
+ */
+};
/**
* Start a attribute iteration for the given identity
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
static int
-check_reference_result (void *cls, const struct AttributeResultMessage *msg)
+check_reference_result (void *cls, const struct ReferenceResultMessage *msg)
{
size_t msg_len;
size_t attr_len;
+ size_t ref_len;
msg_len = ntohs (msg->header.size);
- attr_len = ntohs (msg->attr_len);
- if (msg_len != sizeof(struct AttributeResultMessage) + attr_len)
+ attr_len = ntohs (msg->attest_len);
+ ref_len = ntohs (msg->ref_len);
+ if (msg_len != sizeof(struct ReferenceResultMessage) + attr_len + ref_len)
{
GNUNET_break (0);
return GNUNET_SYSERR;
* @param msg the message we received
*/
static void
-handle_reference_result (void *cls, const struct AttributeResultMessage *msg)
+handle_reference_result (void *cls, const struct ReferenceResultMessage *msg)
{
static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
struct GNUNET_RECLAIM_Handle *h = cls;
struct GNUNET_RECLAIM_AttributeIterator *it;
struct GNUNET_RECLAIM_Operation *op;
- size_t attr_len;
+ size_t attest_len;
+ size_t ref_len;
uint32_t r_id = ntohl (msg->id);
-
- attr_len = ntohs (msg->attr_len);
+ attest_len = ntohs (msg->attest_len);
+ ref_len = ntohs (msg->ref_len);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n");
-
-
for (it = h->it_head; NULL != it; it = it->next)
if (it->r_id == r_id)
break;
}
{
- struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
- attr = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1],
- attr_len);
+ struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref;
+ struct GNUNET_RECLAIM_ATTESTATION_Claim *attest;
+ attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1],
+ attest_len);
+ ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[2],
+ ref_len);
if (NULL != it)
{
if (NULL != it->proc)
- it->proc (it->proc_cls, &msg->identity, NULL, NULL, attr);
+ it->proc (it->proc_cls, &msg->identity, NULL, attest, ref);
}
else if (NULL != op)
{
if (NULL != op->ar_cb)
- op->ar_cb (op->cls, &msg->identity, NULL, NULL, attr);
+ op->ar_cb (op->cls, &msg->identity, NULL, attest, ref);
}
- GNUNET_free (attr);
+ GNUNET_free (ref);
+ GNUNET_free (attest);
return;
}
GNUNET_assert (0);
h),
GNUNET_MQ_hd_var_size (reference_result,
GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT,
- struct AttributeResultMessage,
+ struct ReferenceResultMessage,
h),
GNUNET_MQ_hd_fixed_size (ticket_result,
GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,