aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_identity_service.h
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-07-15 15:52:55 +0200
committerMartin Schanzenbach <schanzen@gnunet.org>2023-07-15 15:52:55 +0200
commit55d5ed20422cda828ee04065207d07f666b9a5ff (patch)
treeeef4be45adcfaf2a88422d6b6835d894bc00987c /src/include/gnunet_identity_service.h
parent365a1f1bd2a3674b0892ab48630a53ce59f4ddac (diff)
parentcbbd64c51fbfa05856111c512f45d19b7d6fd390 (diff)
downloadgnunet-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.h152
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 */
408ssize_t 408ssize_t
409GNUNET_IDENTITY_public_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); 409GNUNET_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 */
424enum GNUNET_GenericReturnValue 425enum GNUNET_GenericReturnValue
425GNUNET_IDENTITY_read_public_key_from_buffer (const void *buffer, 426GNUNET_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 */
441ssize_t 442ssize_t
442GNUNET_IDENTITY_private_key_get_length (const struct 443GNUNET_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 */
477enum GNUNET_GenericReturnValue 478enum GNUNET_GenericReturnValue
478GNUNET_IDENTITY_read_private_key_from_buffer (const void*buffer, 479GNUNET_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 */
497ssize_t 498ssize_t
498GNUNET_IDENTITY_write_private_key_to_buffer (const struct 499GNUNET_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 */
514ssize_t 515ssize_t
515GNUNET_IDENTITY_signature_get_length (const struct 516GNUNET_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 */
529ssize_t 530ssize_t
530GNUNET_IDENTITY_signature_get_raw_length_by_type (const uint32_t type); 531GNUNET_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 */
546ssize_t 546ssize_t
547GNUNET_IDENTITY_read_signature_from_buffer (struct 547GNUNET_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 */
565ssize_t 565ssize_t
566GNUNET_IDENTITY_write_signature_to_buffer (const struct 566GNUNET_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 */
585enum GNUNET_GenericReturnValue 585enum GNUNET_GenericReturnValue
586GNUNET_IDENTITY_sign_ (const struct 586GNUNET_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 */
605enum GNUNET_GenericReturnValue 604enum GNUNET_GenericReturnValue
606GNUNET_IDENTITY_sign_raw_ (const struct 605GNUNET_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 */
654enum GNUNET_GenericReturnValue 652enum GNUNET_GenericReturnValue
655GNUNET_IDENTITY_signature_verify_ (uint32_t purpose, 653GNUNET_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 */
677enum GNUNET_GenericReturnValue 674enum GNUNET_GenericReturnValue
678GNUNET_IDENTITY_signature_verify_raw_ (uint32_t purpose, 675GNUNET_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 */
750ssize_t 745ssize_t
751GNUNET_IDENTITY_decrypt (const void *block, 746GNUNET_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 */
768char * 762char *
769GNUNET_IDENTITY_public_key_to_string (const struct 763GNUNET_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 */
781char * 775char *
782GNUNET_IDENTITY_private_key_to_string (const struct 776GNUNET_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 */
899struct GNUNET_IDENTITY_EgoSuffixLookup * 893struct GNUNET_IDENTITY_EgoSuffixLookup *
900GNUNET_IDENTITY_ego_lookup_by_suffix (const struct 894GNUNET_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/**