diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-07-15 15:52:55 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-07-15 15:52:55 +0200 |
commit | 55d5ed20422cda828ee04065207d07f666b9a5ff (patch) | |
tree | eef4be45adcfaf2a88422d6b6835d894bc00987c /src/include/gnunet_identity_service.h | |
parent | 365a1f1bd2a3674b0892ab48630a53ce59f4ddac (diff) | |
parent | cbbd64c51fbfa05856111c512f45d19b7d6fd390 (diff) | |
download | gnunet-55d5ed20422cda828ee04065207d07f666b9a5ff.tar.gz gnunet-55d5ed20422cda828ee04065207d07f666b9a5ff.zip |
Merge branch 'master' of git+ssh://git.gnunet.org/gnunet
NEWS: -
Diffstat (limited to 'src/include/gnunet_identity_service.h')
-rw-r--r-- | src/include/gnunet_identity_service.h | 152 |
1 files changed, 73 insertions, 79 deletions
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 67327af5d..f38e373b1 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -406,7 +406,8 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); | |||
406 | * @return -1 on error, else the compacted length of the key. | 406 | * @return -1 on error, else the compacted length of the key. |
407 | */ | 407 | */ |
408 | ssize_t | 408 | ssize_t |
409 | GNUNET_IDENTITY_public_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); | 409 | GNUNET_IDENTITY_public_key_get_length (const struct |
410 | GNUNET_IDENTITY_PublicKey *key); | ||
410 | 411 | ||
411 | /** | 412 | /** |
412 | * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer. | 413 | * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer. |
@@ -419,14 +420,14 @@ GNUNET_IDENTITY_public_key_get_length (const struct GNUNET_IDENTITY_PublicKey *k | |||
419 | * @param len the length of buffer | 420 | * @param len the length of buffer |
420 | * @param key the key | 421 | * @param key the key |
421 | * @param the amount of bytes read from the buffer | 422 | * @param the amount of bytes read from the buffer |
422 | * @return GNUNET_SYSERR on error | 423 | * @return #GNUNET_SYSERR on error |
423 | */ | 424 | */ |
424 | enum GNUNET_GenericReturnValue | 425 | enum GNUNET_GenericReturnValue |
425 | GNUNET_IDENTITY_read_public_key_from_buffer (const void *buffer, | 426 | GNUNET_IDENTITY_read_public_key_from_buffer ( |
426 | size_t len, | 427 | const void *buffer, |
427 | struct | 428 | size_t len, |
428 | GNUNET_IDENTITY_PublicKey *key, | 429 | struct GNUNET_IDENTITY_PublicKey *key, |
429 | size_t *read); | 430 | size_t *read); |
430 | 431 | ||
431 | /** | 432 | /** |
432 | * Get the compacted length of a #GNUNET_IDENTITY_PrivateKey. | 433 | * Get the compacted length of a #GNUNET_IDENTITY_PrivateKey. |
@@ -439,8 +440,8 @@ GNUNET_IDENTITY_read_public_key_from_buffer (const void *buffer, | |||
439 | * @return -1 on error, else the compacted length of the key. | 440 | * @return -1 on error, else the compacted length of the key. |
440 | */ | 441 | */ |
441 | ssize_t | 442 | ssize_t |
442 | GNUNET_IDENTITY_private_key_get_length (const struct | 443 | GNUNET_IDENTITY_private_key_get_length ( |
443 | GNUNET_IDENTITY_PrivateKey *key); | 444 | const struct GNUNET_IDENTITY_PrivateKey *key); |
444 | 445 | ||
445 | 446 | ||
446 | /** | 447 | /** |
@@ -472,14 +473,14 @@ GNUNET_IDENTITY_write_public_key_to_buffer (const struct | |||
472 | * @param len the length of buffer | 473 | * @param len the length of buffer |
473 | * @param key the key | 474 | * @param key the key |
474 | * @param the amount of bytes read from the buffer | 475 | * @param the amount of bytes read from the buffer |
475 | * @return GNUNET_SYSERR on error | 476 | * @return #GNUNET_SYSERR on error |
476 | */ | 477 | */ |
477 | enum GNUNET_GenericReturnValue | 478 | enum GNUNET_GenericReturnValue |
478 | GNUNET_IDENTITY_read_private_key_from_buffer (const void*buffer, | 479 | GNUNET_IDENTITY_read_private_key_from_buffer ( |
479 | size_t len, | 480 | const void*buffer, |
480 | struct | 481 | size_t len, |
481 | GNUNET_IDENTITY_PrivateKey *key, | 482 | struct GNUNET_IDENTITY_PrivateKey *key, |
482 | size_t *read); | 483 | size_t *read); |
483 | 484 | ||
484 | 485 | ||
485 | /** | 486 | /** |
@@ -495,10 +496,10 @@ GNUNET_IDENTITY_read_private_key_from_buffer (const void*buffer, | |||
495 | * @return -1 or -2 on error, else the amount of bytes written to the buffer | 496 | * @return -1 or -2 on error, else the amount of bytes written to the buffer |
496 | */ | 497 | */ |
497 | ssize_t | 498 | ssize_t |
498 | GNUNET_IDENTITY_write_private_key_to_buffer (const struct | 499 | GNUNET_IDENTITY_write_private_key_to_buffer ( |
499 | GNUNET_IDENTITY_PrivateKey *key, | 500 | const struct GNUNET_IDENTITY_PrivateKey *key, |
500 | void*buffer, | 501 | void*buffer, |
501 | size_t len); | 502 | size_t len); |
502 | 503 | ||
503 | 504 | ||
504 | /** | 505 | /** |
@@ -512,8 +513,8 @@ GNUNET_IDENTITY_write_private_key_to_buffer (const struct | |||
512 | * @return -1 on error, else the compacted length of the signature. | 513 | * @return -1 on error, else the compacted length of the signature. |
513 | */ | 514 | */ |
514 | ssize_t | 515 | ssize_t |
515 | GNUNET_IDENTITY_signature_get_length (const struct | 516 | GNUNET_IDENTITY_signature_get_length ( |
516 | GNUNET_IDENTITY_Signature *sig); | 517 | const struct GNUNET_IDENTITY_Signature *sig); |
517 | 518 | ||
518 | 519 | ||
519 | /** | 520 | /** |
@@ -527,8 +528,7 @@ GNUNET_IDENTITY_signature_get_length (const struct | |||
527 | * @return -1 on error, else the compacted length of the signature. | 528 | * @return -1 on error, else the compacted length of the signature. |
528 | */ | 529 | */ |
529 | ssize_t | 530 | ssize_t |
530 | GNUNET_IDENTITY_signature_get_raw_length_by_type (const uint32_t type); | 531 | GNUNET_IDENTITY_signature_get_raw_length_by_type (uint32_t type); |
531 | |||
532 | 532 | ||
533 | 533 | ||
534 | /** | 534 | /** |
@@ -544,10 +544,10 @@ GNUNET_IDENTITY_signature_get_raw_length_by_type (const uint32_t type); | |||
544 | * @return -1 or -2 on error, else the amount of bytes read from the buffer | 544 | * @return -1 or -2 on error, else the amount of bytes read from the buffer |
545 | */ | 545 | */ |
546 | ssize_t | 546 | ssize_t |
547 | GNUNET_IDENTITY_read_signature_from_buffer (struct | 547 | GNUNET_IDENTITY_read_signature_from_buffer ( |
548 | GNUNET_IDENTITY_Signature *sig, | 548 | struct GNUNET_IDENTITY_Signature *sig, |
549 | const void*buffer, | 549 | const void*buffer, |
550 | size_t len); | 550 | size_t len); |
551 | 551 | ||
552 | 552 | ||
553 | /** | 553 | /** |
@@ -563,10 +563,10 @@ GNUNET_IDENTITY_read_signature_from_buffer (struct | |||
563 | * @return -1 or -2 on error, else the amount of bytes written to the buffer | 563 | * @return -1 or -2 on error, else the amount of bytes written to the buffer |
564 | */ | 564 | */ |
565 | ssize_t | 565 | ssize_t |
566 | GNUNET_IDENTITY_write_signature_to_buffer (const struct | 566 | GNUNET_IDENTITY_write_signature_to_buffer ( |
567 | GNUNET_IDENTITY_Signature *sig, | 567 | const struct GNUNET_IDENTITY_Signature *sig, |
568 | void*buffer, | 568 | void*buffer, |
569 | size_t len); | 569 | size_t len); |
570 | 570 | ||
571 | 571 | ||
572 | /** | 572 | /** |
@@ -583,11 +583,10 @@ GNUNET_IDENTITY_write_signature_to_buffer (const struct | |||
583 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 583 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
584 | */ | 584 | */ |
585 | enum GNUNET_GenericReturnValue | 585 | enum GNUNET_GenericReturnValue |
586 | GNUNET_IDENTITY_sign_ (const struct | 586 | GNUNET_IDENTITY_sign_ ( |
587 | GNUNET_IDENTITY_PrivateKey *priv, | 587 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
588 | const struct | 588 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
589 | GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 589 | struct GNUNET_IDENTITY_Signature *sig); |
590 | struct GNUNET_IDENTITY_Signature *sig); | ||
591 | 590 | ||
592 | /** | 591 | /** |
593 | * @brief Sign a given block. | 592 | * @brief Sign a given block. |
@@ -603,11 +602,10 @@ GNUNET_IDENTITY_sign_ (const struct | |||
603 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 602 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
604 | */ | 603 | */ |
605 | enum GNUNET_GenericReturnValue | 604 | enum GNUNET_GenericReturnValue |
606 | GNUNET_IDENTITY_sign_raw_ (const struct | 605 | GNUNET_IDENTITY_sign_raw_ ( |
607 | GNUNET_IDENTITY_PrivateKey *priv, | 606 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
608 | const struct | 607 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
609 | GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 608 | unsigned char *sig); |
610 | unsigned char *sig); | ||
611 | 609 | ||
612 | 610 | ||
613 | /** | 611 | /** |
@@ -622,15 +620,15 @@ GNUNET_IDENTITY_sign_raw_ (const struct | |||
622 | * @param[out] sig where to write the signature | 620 | * @param[out] sig where to write the signature |
623 | */ | 621 | */ |
624 | #define GNUNET_IDENTITY_sign(priv,ps,sig) do { \ | 622 | #define GNUNET_IDENTITY_sign(priv,ps,sig) do { \ |
625 | /* check size is set correctly */ \ | 623 | /* check size is set correctly */ \ |
626 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ | 624 | GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ |
627 | /* check 'ps' begins with the purpose */ \ | 625 | /* check 'ps' begins with the purpose */ \ |
628 | GNUNET_static_assert (((void*) (ps)) == \ | 626 | GNUNET_static_assert (((void*) (ps)) == \ |
629 | ((void*) &(ps)->purpose)); \ | 627 | ((void*) &(ps)->purpose)); \ |
630 | GNUNET_assert (GNUNET_OK == \ | 628 | GNUNET_assert (GNUNET_OK == \ |
631 | GNUNET_IDENTITY_sign_ (priv, \ | 629 | GNUNET_IDENTITY_sign_ (priv, \ |
632 | &(ps)->purpose, \ | 630 | &(ps)->purpose, \ |
633 | sig)); \ | 631 | sig)); \ |
634 | } while (0) | 632 | } while (0) |
635 | 633 | ||
636 | 634 | ||
@@ -652,12 +650,11 @@ GNUNET_IDENTITY_sign_raw_ (const struct | |||
652 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid | 650 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid |
653 | */ | 651 | */ |
654 | enum GNUNET_GenericReturnValue | 652 | enum GNUNET_GenericReturnValue |
655 | GNUNET_IDENTITY_signature_verify_ (uint32_t purpose, | 653 | GNUNET_IDENTITY_signature_verify_ ( |
656 | const struct | 654 | uint32_t purpose, |
657 | GNUNET_CRYPTO_EccSignaturePurpose *validate, | 655 | const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, |
658 | const struct GNUNET_IDENTITY_Signature *sig, | 656 | const struct GNUNET_IDENTITY_Signature *sig, |
659 | const struct | 657 | const struct GNUNET_IDENTITY_PublicKey *pub); |
660 | GNUNET_IDENTITY_PublicKey *pub); | ||
661 | 658 | ||
662 | /** | 659 | /** |
663 | * @brief Verify a given signature. | 660 | * @brief Verify a given signature. |
@@ -675,13 +672,11 @@ GNUNET_IDENTITY_signature_verify_ (uint32_t purpose, | |||
675 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid | 672 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid |
676 | */ | 673 | */ |
677 | enum GNUNET_GenericReturnValue | 674 | enum GNUNET_GenericReturnValue |
678 | GNUNET_IDENTITY_signature_verify_raw_ (uint32_t purpose, | 675 | GNUNET_IDENTITY_signature_verify_raw_ ( |
679 | const struct | 676 | uint32_t purpose, |
680 | GNUNET_CRYPTO_EccSignaturePurpose * | 677 | const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, |
681 | validate, | 678 | const unsigned char *sig, |
682 | const unsigned char *sig, | 679 | const struct GNUNET_IDENTITY_PublicKey *pub); |
683 | const struct | ||
684 | GNUNET_IDENTITY_PublicKey *pub); | ||
685 | 680 | ||
686 | 681 | ||
687 | /** | 682 | /** |
@@ -748,13 +743,12 @@ GNUNET_IDENTITY_encrypt (const void *block, | |||
748 | * this size should be the same as @c size. | 743 | * this size should be the same as @c size. |
749 | */ | 744 | */ |
750 | ssize_t | 745 | ssize_t |
751 | GNUNET_IDENTITY_decrypt (const void *block, | 746 | GNUNET_IDENTITY_decrypt ( |
752 | size_t size, | 747 | const void *block, |
753 | const struct | 748 | size_t size, |
754 | GNUNET_IDENTITY_PrivateKey *priv, | 749 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
755 | const struct | 750 | const struct GNUNET_CRYPTO_EcdhePublicKey *ecc, |
756 | GNUNET_CRYPTO_EcdhePublicKey *ecc, | 751 | void *result); |
757 | void *result); | ||
758 | 752 | ||
759 | 753 | ||
760 | /** | 754 | /** |
@@ -766,8 +760,8 @@ GNUNET_IDENTITY_decrypt (const void *block, | |||
766 | * @return the string representation of the key, or NULL on error. | 760 | * @return the string representation of the key, or NULL on error. |
767 | */ | 761 | */ |
768 | char * | 762 | char * |
769 | GNUNET_IDENTITY_public_key_to_string (const struct | 763 | GNUNET_IDENTITY_public_key_to_string ( |
770 | GNUNET_IDENTITY_PublicKey *key); | 764 | const struct GNUNET_IDENTITY_PublicKey *key); |
771 | 765 | ||
772 | 766 | ||
773 | /** | 767 | /** |
@@ -779,8 +773,8 @@ GNUNET_IDENTITY_public_key_to_string (const struct | |||
779 | * @return the string representation of the key, or NULL on error. | 773 | * @return the string representation of the key, or NULL on error. |
780 | */ | 774 | */ |
781 | char * | 775 | char * |
782 | GNUNET_IDENTITY_private_key_to_string (const struct | 776 | GNUNET_IDENTITY_private_key_to_string ( |
783 | GNUNET_IDENTITY_PrivateKey *key); | 777 | const struct GNUNET_IDENTITY_PrivateKey *key); |
784 | 778 | ||
785 | 779 | ||
786 | /** | 780 | /** |
@@ -897,11 +891,11 @@ struct GNUNET_IDENTITY_EgoSuffixLookup; | |||
897 | * @return handle to abort the operation | 891 | * @return handle to abort the operation |
898 | */ | 892 | */ |
899 | struct GNUNET_IDENTITY_EgoSuffixLookup * | 893 | struct GNUNET_IDENTITY_EgoSuffixLookup * |
900 | GNUNET_IDENTITY_ego_lookup_by_suffix (const struct | 894 | GNUNET_IDENTITY_ego_lookup_by_suffix ( |
901 | GNUNET_CONFIGURATION_Handle *cfg, | 895 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
902 | const char *suffix, | 896 | const char *suffix, |
903 | GNUNET_IDENTITY_EgoSuffixCallback cb, | 897 | GNUNET_IDENTITY_EgoSuffixCallback cb, |
904 | void *cb_cls); | 898 | void *cb_cls); |
905 | 899 | ||
906 | 900 | ||
907 | /** | 901 | /** |