diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-02-24 07:55:21 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-02-24 07:55:21 +0100 |
commit | d31e933a35007204ca4c7f98c209b4f7e14f9ecc (patch) | |
tree | 95a6397bedf8731fc0bd5ef484fa26a96b6cb41e /src/util/crypto_ecc.c | |
parent | c802d0a81e6c415e4c99b562b03d47a1beb5a617 (diff) | |
download | gnunet-d31e933a35007204ca4c7f98c209b4f7e14f9ecc.tar.gz gnunet-d31e933a35007204ca4c7f98c209b4f7e14f9ecc.zip |
geq redefinition breaks texi2pdf, instead just avoid @geq
Diffstat (limited to 'src/util/crypto_ecc.c')
-rw-r--r-- | src/util/crypto_ecc.c | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index ac7662a10..a720d6c2b 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c | |||
@@ -789,19 +789,40 @@ GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first, | |||
789 | static gcry_sexp_t | 789 | static gcry_sexp_t |
790 | data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) | 790 | data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) |
791 | { | 791 | { |
792 | struct GNUNET_HashCode hc; | ||
793 | gcry_sexp_t data; | 792 | gcry_sexp_t data; |
794 | int rc; | 793 | int rc; |
795 | 794 | ||
795 | #if 1 | ||
796 | struct GNUNET_HashCode hc; | ||
797 | |||
798 | GNUNET_CRYPTO_hash (purpose, | ||
799 | ntohl (purpose->size), | ||
800 | &hc); | ||
801 | if (0 != (rc = gcry_sexp_build (&data, NULL, | ||
802 | "(data(flags eddsa)(hash-algo %s)(value %b))", | ||
803 | "sha512", | ||
804 | (int)sizeof (hc), | ||
805 | &hc))) | ||
806 | { | ||
807 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, | ||
808 | "gcry_sexp_build", | ||
809 | rc); | ||
810 | return NULL; | ||
811 | } | ||
812 | #else | ||
796 | GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc); | 813 | GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc); |
797 | if (0 != (rc = gcry_sexp_build (&data, NULL, | 814 | if (0 != (rc = gcry_sexp_build (&data, NULL, |
798 | "(data(flags eddsa)(hash-algo %s)(value %b))", | 815 | "(data(flags eddsa)(hash-algo %s)(value %b))", |
799 | "sha512", | 816 | "sha512", |
800 | (int)sizeof (hc), &hc))) | 817 | ntohl (purpose->size), |
818 | purpose))) | ||
801 | { | 819 | { |
802 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); | 820 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, |
821 | "gcry_sexp_build", | ||
822 | rc); | ||
803 | return NULL; | 823 | return NULL; |
804 | } | 824 | } |
825 | #endif | ||
805 | return data; | 826 | return data; |
806 | } | 827 | } |
807 | 828 | ||
@@ -816,19 +837,38 @@ data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) | |||
816 | static gcry_sexp_t | 837 | static gcry_sexp_t |
817 | data_to_ecdsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) | 838 | data_to_ecdsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) |
818 | { | 839 | { |
819 | struct GNUNET_HashCode hc; | ||
820 | gcry_sexp_t data; | 840 | gcry_sexp_t data; |
821 | int rc; | 841 | int rc; |
822 | 842 | ||
823 | GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc); | 843 | #if 1 |
844 | struct GNUNET_HashCode hc; | ||
845 | |||
846 | GNUNET_CRYPTO_hash (purpose, | ||
847 | ntohl (purpose->size), | ||
848 | &hc); | ||
824 | if (0 != (rc = gcry_sexp_build (&data, NULL, | 849 | if (0 != (rc = gcry_sexp_build (&data, NULL, |
825 | "(data(flags rfc6979)(hash %s %b))", | 850 | "(data(flags rfc6979)(hash %s %b))", |
826 | "sha512", | 851 | "sha512", |
827 | (int)sizeof (hc), &hc))) | 852 | (int)sizeof (hc), &hc))) |
828 | { | 853 | { |
829 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); | 854 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, |
855 | "gcry_sexp_build", | ||
856 | rc); | ||
857 | return NULL; | ||
858 | } | ||
859 | #else | ||
860 | if (0 != (rc = gcry_sexp_build (&data, NULL, | ||
861 | "(data(flags rfc6979)(hash %s %b))", | ||
862 | "sha512", | ||
863 | ntohl (purpose->size), | ||
864 | purpose))) | ||
865 | { | ||
866 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, | ||
867 | "gcry_sexp_build", | ||
868 | rc); | ||
830 | return NULL; | 869 | return NULL; |
831 | } | 870 | } |
871 | #endif | ||
832 | return data; | 872 | return data; |
833 | } | 873 | } |
834 | 874 | ||
@@ -877,8 +917,12 @@ GNUNET_CRYPTO_ecdsa_sign (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | |||
877 | return GNUNET_SYSERR; | 917 | return GNUNET_SYSERR; |
878 | } | 918 | } |
879 | gcry_sexp_release (sig_sexp); | 919 | gcry_sexp_release (sig_sexp); |
880 | GNUNET_CRYPTO_mpi_print_unsigned (sig->r, sizeof (sig->r), rs[0]); | 920 | GNUNET_CRYPTO_mpi_print_unsigned (sig->r, |
881 | GNUNET_CRYPTO_mpi_print_unsigned (sig->s, sizeof (sig->s), rs[1]); | 921 | sizeof (sig->r), |
922 | rs[0]); | ||
923 | GNUNET_CRYPTO_mpi_print_unsigned (sig->s, | ||
924 | sizeof (sig->s), | ||
925 | rs[1]); | ||
882 | gcry_mpi_release (rs[0]); | 926 | gcry_mpi_release (rs[0]); |
883 | gcry_mpi_release (rs[1]); | 927 | gcry_mpi_release (rs[1]); |
884 | 928 | ||