diff options
Diffstat (limited to 'src/revocation/revocation_api.c')
-rw-r--r-- | src/revocation/revocation_api.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 819c34b71..3b7d83710 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -160,7 +160,7 @@ handle_revocation_query_response (void *cls, | |||
160 | */ | 160 | */ |
161 | struct GNUNET_REVOCATION_Query * | 161 | struct GNUNET_REVOCATION_Query * |
162 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 162 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, |
163 | const struct GNUNET_IDENTITY_PublicKey *key, | 163 | const struct GNUNET_CRYPTO_PublicKey *key, |
164 | GNUNET_REVOCATION_Callback func, | 164 | GNUNET_REVOCATION_Callback func, |
165 | void *func_cls) | 165 | void *func_cls) |
166 | { | 166 | { |
@@ -189,10 +189,10 @@ GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
189 | } | 189 | } |
190 | q->func = func; | 190 | q->func = func; |
191 | q->func_cls = func_cls; | 191 | q->func_cls = func_cls; |
192 | key_len = GNUNET_IDENTITY_public_key_get_length (key); | 192 | key_len = GNUNET_CRYPTO_public_key_get_length (key); |
193 | env = GNUNET_MQ_msg_extra (qm, key_len, | 193 | env = GNUNET_MQ_msg_extra (qm, key_len, |
194 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY); | 194 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY); |
195 | GNUNET_IDENTITY_write_public_key_to_buffer (key, &qm[1], key_len); | 195 | GNUNET_CRYPTO_write_public_key_to_buffer (key, &qm[1], key_len); |
196 | qm->key_len = htonl (key_len); | 196 | qm->key_len = htonl (key_len); |
197 | GNUNET_MQ_send (q->mq, | 197 | GNUNET_MQ_send (q->mq, |
198 | env); | 198 | env); |
@@ -406,16 +406,16 @@ struct GNUNET_REVOCATION_SignaturePurposePS * | |||
406 | REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow) | 406 | REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow) |
407 | { | 407 | { |
408 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; | 408 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; |
409 | const struct GNUNET_IDENTITY_PublicKey *pk; | 409 | const struct GNUNET_CRYPTO_PublicKey *pk; |
410 | size_t ksize; | 410 | size_t ksize; |
411 | 411 | ||
412 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 412 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
413 | ksize = GNUNET_IDENTITY_public_key_get_length (pk); | 413 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); |
414 | spurp = GNUNET_malloc (sizeof (*spurp) + ksize); | 414 | spurp = GNUNET_malloc (sizeof (*spurp) + ksize); |
415 | spurp->timestamp = pow->timestamp; | 415 | spurp->timestamp = pow->timestamp; |
416 | spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION); | 416 | spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION); |
417 | spurp->purpose.size = htonl (sizeof(*spurp) + ksize); | 417 | spurp->purpose.size = htonl (sizeof(*spurp) + ksize); |
418 | GNUNET_IDENTITY_write_public_key_to_buffer (pk, | 418 | GNUNET_CRYPTO_write_public_key_to_buffer (pk, |
419 | (char*) &spurp[1], | 419 | (char*) &spurp[1], |
420 | ksize); | 420 | ksize); |
421 | return spurp; | 421 | return spurp; |
@@ -424,18 +424,18 @@ REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow) | |||
424 | 424 | ||
425 | enum GNUNET_GenericReturnValue | 425 | enum GNUNET_GenericReturnValue |
426 | check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, | 426 | check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, |
427 | const struct GNUNET_IDENTITY_PublicKey *key) | 427 | const struct GNUNET_CRYPTO_PublicKey *key) |
428 | { | 428 | { |
429 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; | 429 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; |
430 | unsigned char *sig; | 430 | unsigned char *sig; |
431 | size_t ksize; | 431 | size_t ksize; |
432 | int ret; | 432 | int ret; |
433 | 433 | ||
434 | ksize = GNUNET_IDENTITY_public_key_get_length (key); | 434 | ksize = GNUNET_CRYPTO_public_key_get_length (key); |
435 | spurp = REV_create_signature_message (pow); | 435 | spurp = REV_create_signature_message (pow); |
436 | sig = ((unsigned char*) &pow[1] + ksize); | 436 | sig = ((unsigned char*) &pow[1] + ksize); |
437 | ret = | 437 | ret = |
438 | GNUNET_IDENTITY_signature_verify_raw_ ( | 438 | GNUNET_CRYPTO_signature_verify_raw_ ( |
439 | GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION, | 439 | GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION, |
440 | &spurp->purpose, | 440 | &spurp->purpose, |
441 | sig, | 441 | sig, |
@@ -448,9 +448,9 @@ check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, | |||
448 | enum GNUNET_GenericReturnValue | 448 | enum GNUNET_GenericReturnValue |
449 | check_signature (const struct GNUNET_REVOCATION_PowP *pow) | 449 | check_signature (const struct GNUNET_REVOCATION_PowP *pow) |
450 | { | 450 | { |
451 | const struct GNUNET_IDENTITY_PublicKey *pk; | 451 | const struct GNUNET_CRYPTO_PublicKey *pk; |
452 | 452 | ||
453 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 453 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
454 | return check_signature_identity (pow, pk); | 454 | return check_signature_identity (pow, pk); |
455 | } | 455 | } |
456 | 456 | ||
@@ -468,7 +468,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
468 | unsigned int difficulty, | 468 | unsigned int difficulty, |
469 | struct GNUNET_TIME_Relative epoch_duration) | 469 | struct GNUNET_TIME_Relative epoch_duration) |
470 | { | 470 | { |
471 | char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) | 471 | char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) |
472 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) | 472 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) |
473 | + sizeof (uint64_t)] GNUNET_ALIGN; | 473 | + sizeof (uint64_t)] GNUNET_ALIGN; |
474 | struct GNUNET_HashCode result; | 474 | struct GNUNET_HashCode result; |
@@ -482,9 +482,9 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
482 | unsigned int epochs; | 482 | unsigned int epochs; |
483 | uint64_t pow_val; | 483 | uint64_t pow_val; |
484 | ssize_t pklen; | 484 | ssize_t pklen; |
485 | const struct GNUNET_IDENTITY_PublicKey *pk; | 485 | const struct GNUNET_CRYPTO_PublicKey *pk; |
486 | 486 | ||
487 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 487 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
488 | 488 | ||
489 | /** | 489 | /** |
490 | * Check if signature valid | 490 | * Check if signature valid |
@@ -507,7 +507,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
507 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | 507 | GNUNET_memcpy (&buf[sizeof(uint64_t)], |
508 | &pow->timestamp, | 508 | &pow->timestamp, |
509 | sizeof (uint64_t)); | 509 | sizeof (uint64_t)); |
510 | pklen = GNUNET_IDENTITY_public_key_get_length (pk); | 510 | pklen = GNUNET_CRYPTO_public_key_get_length (pk); |
511 | if (0 > pklen) | 511 | if (0 > pklen) |
512 | { | 512 | { |
513 | GNUNET_break (0); | 513 | GNUNET_break (0); |
@@ -566,12 +566,12 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
566 | 566 | ||
567 | 567 | ||
568 | enum GNUNET_GenericReturnValue | 568 | enum GNUNET_GenericReturnValue |
569 | sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key, | 569 | sign_pow_identity (const struct GNUNET_CRYPTO_PrivateKey *key, |
570 | struct GNUNET_REVOCATION_PowP *pow) | 570 | struct GNUNET_REVOCATION_PowP *pow) |
571 | { | 571 | { |
572 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); | 572 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); |
573 | struct GNUNET_REVOCATION_SignaturePurposePS *rp; | 573 | struct GNUNET_REVOCATION_SignaturePurposePS *rp; |
574 | const struct GNUNET_IDENTITY_PublicKey *pk; | 574 | const struct GNUNET_CRYPTO_PublicKey *pk; |
575 | size_t ksize; | 575 | size_t ksize; |
576 | char *sig; | 576 | char *sig; |
577 | 577 | ||
@@ -581,12 +581,12 @@ sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key, | |||
581 | */ | 581 | */ |
582 | ts = GNUNET_TIME_absolute_subtract (ts, | 582 | ts = GNUNET_TIME_absolute_subtract (ts, |
583 | GNUNET_TIME_UNIT_WEEKS); | 583 | GNUNET_TIME_UNIT_WEEKS); |
584 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 584 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
585 | ksize = GNUNET_IDENTITY_public_key_get_length (pk); | 585 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); |
586 | pow->timestamp = GNUNET_TIME_absolute_hton (ts); | 586 | pow->timestamp = GNUNET_TIME_absolute_hton (ts); |
587 | rp = REV_create_signature_message (pow); | 587 | rp = REV_create_signature_message (pow); |
588 | sig = ((char*) &pow[1]) + ksize; | 588 | sig = ((char*) &pow[1]) + ksize; |
589 | int result = GNUNET_IDENTITY_sign_raw_ (key, | 589 | int result = GNUNET_CRYPTO_sign_raw_ (key, |
590 | &rp->purpose, | 590 | &rp->purpose, |
591 | (void*) sig); | 591 | (void*) sig); |
592 | GNUNET_free (rp); | 592 | GNUNET_free (rp); |
@@ -598,13 +598,13 @@ sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key, | |||
598 | 598 | ||
599 | 599 | ||
600 | enum GNUNET_GenericReturnValue | 600 | enum GNUNET_GenericReturnValue |
601 | sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key, | 601 | sign_pow (const struct GNUNET_CRYPTO_PrivateKey *key, |
602 | struct GNUNET_REVOCATION_PowP *pow) | 602 | struct GNUNET_REVOCATION_PowP *pow) |
603 | { | 603 | { |
604 | struct GNUNET_IDENTITY_PublicKey *pk; | 604 | struct GNUNET_CRYPTO_PublicKey *pk; |
605 | 605 | ||
606 | pk = (struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 606 | pk = (struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
607 | GNUNET_IDENTITY_key_get_public (key, pk); | 607 | GNUNET_CRYPTO_key_get_public (key, pk); |
608 | return sign_pow_identity (key, pow); | 608 | return sign_pow_identity (key, pow); |
609 | } | 609 | } |
610 | 610 | ||
@@ -616,7 +616,7 @@ sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key, | |||
616 | * @param[out] pow starting point for PoW calculation (not yet valid) | 616 | * @param[out] pow starting point for PoW calculation (not yet valid) |
617 | */ | 617 | */ |
618 | void | 618 | void |
619 | GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key, | 619 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, |
620 | struct GNUNET_REVOCATION_PowP *pow) | 620 | struct GNUNET_REVOCATION_PowP *pow) |
621 | { | 621 | { |
622 | GNUNET_assert (GNUNET_OK == sign_pow (key, pow)); | 622 | GNUNET_assert (GNUNET_OK == sign_pow (key, pow)); |
@@ -672,18 +672,18 @@ cmp_pow_value (const void *a, const void *b) | |||
672 | enum GNUNET_GenericReturnValue | 672 | enum GNUNET_GenericReturnValue |
673 | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | 673 | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) |
674 | { | 674 | { |
675 | char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) | 675 | char buf[sizeof(struct GNUNET_CRYPTO_PublicKey) |
676 | + sizeof (uint64_t) | 676 | + sizeof (uint64_t) |
677 | + sizeof (uint64_t)] GNUNET_ALIGN; | 677 | + sizeof (uint64_t)] GNUNET_ALIGN; |
678 | struct GNUNET_HashCode result; | 678 | struct GNUNET_HashCode result; |
679 | const struct GNUNET_IDENTITY_PublicKey *pk; | 679 | const struct GNUNET_CRYPTO_PublicKey *pk; |
680 | unsigned int zeros; | 680 | unsigned int zeros; |
681 | int ret; | 681 | int ret; |
682 | uint64_t pow_nbo; | 682 | uint64_t pow_nbo; |
683 | ssize_t ksize; | 683 | ssize_t ksize; |
684 | 684 | ||
685 | pc->current_pow++; | 685 | pc->current_pow++; |
686 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &(pc->pow[1]); | 686 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &(pc->pow[1]); |
687 | 687 | ||
688 | /** | 688 | /** |
689 | * Do not try duplicates | 689 | * Do not try duplicates |
@@ -696,7 +696,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | |||
696 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | 696 | GNUNET_memcpy (&buf[sizeof(uint64_t)], |
697 | &pc->pow->timestamp, | 697 | &pc->pow->timestamp, |
698 | sizeof (uint64_t)); | 698 | sizeof (uint64_t)); |
699 | ksize = GNUNET_IDENTITY_public_key_get_length (pk); | 699 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); |
700 | GNUNET_assert (0 < ksize); | 700 | GNUNET_assert (0 < ksize); |
701 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | 701 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], |
702 | pk, | 702 | pk, |
@@ -750,13 +750,13 @@ GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow) | |||
750 | { | 750 | { |
751 | size_t size; | 751 | size_t size; |
752 | size_t ksize; | 752 | size_t ksize; |
753 | const struct GNUNET_IDENTITY_PublicKey *pk; | 753 | const struct GNUNET_CRYPTO_PublicKey *pk; |
754 | 754 | ||
755 | size = sizeof (struct GNUNET_REVOCATION_PowP); | 755 | size = sizeof (struct GNUNET_REVOCATION_PowP); |
756 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 756 | pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1]; |
757 | ksize = GNUNET_IDENTITY_public_key_get_length (pk); | 757 | ksize = GNUNET_CRYPTO_public_key_get_length (pk); |
758 | size += ksize; | 758 | size += ksize; |
759 | size += GNUNET_IDENTITY_signature_get_raw_length_by_type (pk->type); | 759 | size += GNUNET_CRYPTO_signature_get_raw_length_by_type (pk->type); |
760 | return size; | 760 | return size; |
761 | } | 761 | } |
762 | 762 | ||