diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2016-12-05 22:09:11 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2016-12-05 22:09:11 +0100 |
commit | 01fcfd11a5e4c170e0b31c60157fb9748c0d3277 (patch) | |
tree | c6f7735d692f02843ae6f3b2bf5cba126863efd7 /src/credential | |
parent | 6d96eb580bec0831222811f3841174c39e437709 (diff) | |
download | gnunet-01fcfd11a5e4c170e0b31c60157fb9748c0d3277.tar.gz gnunet-01fcfd11a5e4c170e0b31c60157fb9748c0d3277.zip |
- remove purpose from cred
Diffstat (limited to 'src/credential')
-rw-r--r-- | src/credential/credential_api.c | 21 | ||||
-rw-r--r-- | src/credential/gnunet-service-credential.c | 21 |
2 files changed, 31 insertions, 11 deletions
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c index b6c585c72..3be2d8bbb 100644 --- a/src/credential/credential_api.c +++ b/src/credential/credential_api.c | |||
@@ -428,23 +428,32 @@ GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle, | |||
428 | const char *attribute) | 428 | const char *attribute) |
429 | { | 429 | { |
430 | struct GNUNET_CREDENTIAL_CredentialRecordData *crd; | 430 | struct GNUNET_CREDENTIAL_CredentialRecordData *crd; |
431 | struct GNUNET_CRYPTO_EccSignaturePurpose *purp; | ||
431 | 432 | ||
432 | crd = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + strlen (attribute) + 1); | 433 | crd = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + strlen (attribute) + 1); |
433 | 434 | ||
434 | crd->purpose.size = htonl (strlen (attribute) + 1 + | 435 | purp = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + |
435 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + | 436 | strlen (attribute) + 1); |
436 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 437 | purp->size = htonl (strlen (attribute) + 1 + |
437 | sizeof (struct GNUNET_TIME_AbsoluteNBO)); | 438 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + |
438 | crd->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); | 439 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); |
440 | |||
441 | purp->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); | ||
439 | GNUNET_CRYPTO_ecdsa_key_get_public (issuer, | 442 | GNUNET_CRYPTO_ecdsa_key_get_public (issuer, |
440 | &crd->issuer_key); | 443 | &crd->issuer_key); |
441 | crd->subject_key = *subject; | 444 | crd->subject_key = *subject; |
442 | GNUNET_memcpy (&crd[1], | 445 | GNUNET_memcpy (&crd[1], |
443 | attribute, | 446 | attribute, |
444 | strlen (attribute)); | 447 | strlen (attribute)); |
448 | GNUNET_memcpy (&purp[1], | ||
449 | subject, | ||
450 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
451 | GNUNET_memcpy (&purp[1] + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), | ||
452 | attribute, | ||
453 | strlen (attribute)); | ||
445 | if (GNUNET_OK != | 454 | if (GNUNET_OK != |
446 | GNUNET_CRYPTO_ecdsa_sign (issuer, | 455 | GNUNET_CRYPTO_ecdsa_sign (issuer, |
447 | &crd->purpose, | 456 | purp, |
448 | &crd->sig)) | 457 | &crd->sig)) |
449 | { | 458 | { |
450 | GNUNET_break (0); | 459 | GNUNET_break (0); |
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 117156379..20f6fe4e0 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -262,6 +262,7 @@ send_lookup_response (void* cls, | |||
262 | struct GNUNET_MQ_Envelope *env; | 262 | struct GNUNET_MQ_Envelope *env; |
263 | struct VerifyResultMessage *rmsg; | 263 | struct VerifyResultMessage *rmsg; |
264 | const struct GNUNET_CREDENTIAL_CredentialRecordData *crd; | 264 | const struct GNUNET_CREDENTIAL_CredentialRecordData *crd; |
265 | struct GNUNET_CRYPTO_EccSignaturePurpose *purp; | ||
265 | struct CredentialRecordEntry *cr_entry; | 266 | struct CredentialRecordEntry *cr_entry; |
266 | 267 | ||
267 | cred_record_count = 0; | 268 | cred_record_count = 0; |
@@ -284,16 +285,26 @@ send_lookup_response (void* cls, | |||
284 | GNUNET_CONTAINER_DLL_insert_tail (vrh->cred_chain_head, | 285 | GNUNET_CONTAINER_DLL_insert_tail (vrh->cred_chain_head, |
285 | vrh->cred_chain_tail, | 286 | vrh->cred_chain_tail, |
286 | cr_entry); | 287 | cr_entry); |
287 | 288 | purp = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | |
289 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + | ||
290 | strlen ((char*)&crd[1]) +1 ); | ||
291 | purp->size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | ||
292 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + | ||
293 | strlen ((char*)&crd[1]) +1 ); | ||
294 | |||
295 | purp->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); | ||
288 | if(GNUNET_OK == GNUNET_CRYPTO_ecdsa_verify(GNUNET_SIGNATURE_PURPOSE_CREDENTIAL, | 296 | if(GNUNET_OK == GNUNET_CRYPTO_ecdsa_verify(GNUNET_SIGNATURE_PURPOSE_CREDENTIAL, |
289 | &crd->purpose, | 297 | purp, |
290 | &crd->sig, &crd->issuer_key)) | 298 | &crd->sig, |
291 | { | 299 | &crd->issuer_key)) |
300 | { | ||
301 | GNUNET_free (purp); | ||
292 | break; | 302 | break; |
293 | } | 303 | } |
304 | GNUNET_free (purp); | ||
294 | 305 | ||
295 | } | 306 | } |
296 | 307 | ||
297 | 308 | ||
298 | 309 | ||
299 | /** | 310 | /** |