const char *attribute)
{
struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
+ struct GNUNET_CRYPTO_EccSignaturePurpose *purp;
crd = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + strlen (attribute) + 1);
- crd->purpose.size = htonl (strlen (attribute) + 1 +
- sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) +
- sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
- sizeof (struct GNUNET_TIME_AbsoluteNBO));
- crd->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
+ purp = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) +
+ strlen (attribute) + 1);
+ purp->size = htonl (strlen (attribute) + 1 +
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
+
+ purp->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
GNUNET_CRYPTO_ecdsa_key_get_public (issuer,
&crd->issuer_key);
crd->subject_key = *subject;
GNUNET_memcpy (&crd[1],
attribute,
strlen (attribute));
+ GNUNET_memcpy (&purp[1],
+ subject,
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ GNUNET_memcpy (&purp[1] + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey),
+ attribute,
+ strlen (attribute));
if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_sign (issuer,
- &crd->purpose,
+ purp,
&crd->sig))
{
GNUNET_break (0);
struct GNUNET_MQ_Envelope *env;
struct VerifyResultMessage *rmsg;
const struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
+ struct GNUNET_CRYPTO_EccSignaturePurpose *purp;
struct CredentialRecordEntry *cr_entry;
cred_record_count = 0;
GNUNET_CONTAINER_DLL_insert_tail (vrh->cred_chain_head,
vrh->cred_chain_tail,
cr_entry);
-
+ purp = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) +
+ strlen ((char*)&crd[1]) +1 );
+ purp->size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) +
+ strlen ((char*)&crd[1]) +1 );
+
+ purp->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
if(GNUNET_OK == GNUNET_CRYPTO_ecdsa_verify(GNUNET_SIGNATURE_PURPOSE_CREDENTIAL,
- &crd->purpose,
- &crd->sig, &crd->issuer_key))
- {
+ purp,
+ &crd->sig,
+ &crd->issuer_key))
+ {
+ GNUNET_free (purp);
break;
}
+ GNUNET_free (purp);
}
-
+
/**
*/
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
- /**
- * Signature purpose (data to sign, kind of signature)
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
/**
* Public key of the subject this credential was issued to
*/