diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-19 19:09:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-19 19:09:28 +0000 |
commit | 7b8acf8915fcedc4d905487ce0f7f3ff4ab201f4 (patch) | |
tree | 60bd85d90797a26b8ad34caf1b32c8c45fc93f8b /src/util | |
parent | bdeb92f66e328fc964423310300a18981d9eb1af (diff) | |
download | gnunet-7b8acf8915fcedc4d905487ce0f7f3ff4ab201f4.tar.gz gnunet-7b8acf8915fcedc4d905487ce0f7f3ff4ab201f4.zip |
-eliminate more uses of ShortHashCode, breaks signatures
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/crypto_ecc.c | 6 | ||||
-rw-r--r-- | src/util/gnunet-ecc.c | 18 | ||||
-rw-r--r-- | src/util/network.c | 12 |
3 files changed, 9 insertions, 27 deletions
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index a397724f4..89cbde922 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c | |||
@@ -711,14 +711,14 @@ GNUNET_CRYPTO_get_host_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
711 | static gcry_sexp_t | 711 | static gcry_sexp_t |
712 | data_to_pkcs1 (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) | 712 | data_to_pkcs1 (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) |
713 | { | 713 | { |
714 | struct GNUNET_CRYPTO_ShortHashCode hc; | 714 | struct GNUNET_HashCode hc; |
715 | gcry_sexp_t data; | 715 | gcry_sexp_t data; |
716 | int rc; | 716 | int rc; |
717 | 717 | ||
718 | GNUNET_CRYPTO_short_hash (purpose, ntohl (purpose->size), &hc); | 718 | GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc); |
719 | if (0 != (rc = gcry_sexp_build (&data, NULL, | 719 | if (0 != (rc = gcry_sexp_build (&data, NULL, |
720 | "(data(flags rfc6979)(hash %s %b))", | 720 | "(data(flags rfc6979)(hash %s %b))", |
721 | "sha256", | 721 | "sha512", |
722 | sizeof (hc), | 722 | sizeof (hc), |
723 | &hc))) | 723 | &hc))) |
724 | { | 724 | { |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 0805e3f94..103f8eff2 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -40,11 +40,6 @@ static int print_public_key; | |||
40 | static int print_peer_identity; | 40 | static int print_peer_identity; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Flag for printing short hash of public key. | ||
44 | */ | ||
45 | static int print_short_identity; | ||
46 | |||
47 | /** | ||
48 | * Option set to create a bunch of keys at once. | 43 | * Option set to create a bunch of keys at once. |
49 | */ | 44 | */ |
50 | static unsigned int make_keys; | 45 | static unsigned int make_keys; |
@@ -149,16 +144,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
149 | GNUNET_CRYPTO_hash_to_enc (&pid.hashPubKey, &enc); | 144 | GNUNET_CRYPTO_hash_to_enc (&pid.hashPubKey, &enc); |
150 | fprintf (stdout, "%s\n", enc.encoding); | 145 | fprintf (stdout, "%s\n", enc.encoding); |
151 | } | 146 | } |
152 | if (print_short_identity) | ||
153 | { | ||
154 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded enc; | ||
155 | struct GNUNET_CRYPTO_ShortHashCode sh; | ||
156 | |||
157 | GNUNET_CRYPTO_ecc_key_get_public (pk, &pub); | ||
158 | GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &sh); | ||
159 | GNUNET_CRYPTO_short_hash_to_enc (&sh, &enc); | ||
160 | fprintf (stdout, "%s\n", enc.short_encoding); | ||
161 | } | ||
162 | GNUNET_CRYPTO_ecc_key_free (pk); | 147 | GNUNET_CRYPTO_ecc_key_free (pk); |
163 | } | 148 | } |
164 | 149 | ||
@@ -183,9 +168,6 @@ main (int argc, char *const *argv) | |||
183 | { 'P', "print-peer-identity", NULL, | 168 | { 'P', "print-peer-identity", NULL, |
184 | gettext_noop ("print the hash of the public key in ASCII format"), | 169 | gettext_noop ("print the hash of the public key in ASCII format"), |
185 | 0, &GNUNET_GETOPT_set_one, &print_peer_identity }, | 170 | 0, &GNUNET_GETOPT_set_one, &print_peer_identity }, |
186 | { 's', "print-short-identity", NULL, | ||
187 | gettext_noop ("print the short hash of the public key in ASCII format"), | ||
188 | 0, &GNUNET_GETOPT_set_one, &print_short_identity }, | ||
189 | GNUNET_GETOPT_OPTION_END | 171 | GNUNET_GETOPT_OPTION_END |
190 | }; | 172 | }; |
191 | int ret; | 173 | int ret; |
diff --git a/src/util/network.c b/src/util/network.c index 454de1e50..00b0413e2 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -114,16 +114,16 @@ GNUNET_NETWORK_shorten_unixpath (char *unixpath) | |||
114 | struct sockaddr_un dummy; | 114 | struct sockaddr_un dummy; |
115 | size_t slen; | 115 | size_t slen; |
116 | char *end; | 116 | char *end; |
117 | struct GNUNET_CRYPTO_ShortHashCode sh; | 117 | struct GNUNET_HashCode sh; |
118 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded ae; | 118 | struct GNUNET_CRYPTO_HashAsciiEncoded ae; |
119 | size_t upm; | 119 | size_t upm; |
120 | 120 | ||
121 | upm = sizeof (dummy.sun_path); | 121 | upm = sizeof (dummy.sun_path); |
122 | slen = strlen (unixpath); | 122 | slen = strlen (unixpath); |
123 | if (slen < upm) | 123 | if (slen < upm) |
124 | return unixpath; /* no shortening required */ | 124 | return unixpath; /* no shortening required */ |
125 | GNUNET_CRYPTO_short_hash (unixpath, slen, &sh); | 125 | GNUNET_CRYPTO_hash (unixpath, slen, &sh); |
126 | while (sizeof (struct GNUNET_CRYPTO_ShortHashAsciiEncoded) + | 126 | while (sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) + |
127 | strlen (unixpath) >= upm) | 127 | strlen (unixpath) >= upm) |
128 | { | 128 | { |
129 | if (NULL == (end = strrchr (unixpath, '/'))) | 129 | if (NULL == (end = strrchr (unixpath, '/'))) |
@@ -136,8 +136,8 @@ GNUNET_NETWORK_shorten_unixpath (char *unixpath) | |||
136 | } | 136 | } |
137 | *end = '\0'; | 137 | *end = '\0'; |
138 | } | 138 | } |
139 | GNUNET_CRYPTO_short_hash_to_enc (&sh, &ae); | 139 | GNUNET_CRYPTO_hash_to_enc (&sh, &ae); |
140 | strcat (unixpath, (char*) ae.short_encoding); | 140 | strcat (unixpath, (char*) ae.encoding); |
141 | return unixpath; | 141 | return unixpath; |
142 | } | 142 | } |
143 | 143 | ||