aboutsummaryrefslogtreecommitdiff
path: root/src/hello
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-02-05 20:49:21 +0000
committerChristian Grothoff <christian@grothoff.org>2013-02-05 20:49:21 +0000
commitca35f67faee8371fa763bdf49f04a8d5d4cdc021 (patch)
tree5535df5e5a2428ed838c6a0e60b2c6c68a7842c5 /src/hello
parentdd7cca21c5dbaef4d56f92bab3932f0f73d092d1 (diff)
downloadgnunet-ca35f67faee8371fa763bdf49f04a8d5d4cdc021.tar.gz
gnunet-ca35f67faee8371fa763bdf49f04a8d5d4cdc021.zip
switching to ECDHE cryptography f, implementation is incomplete and INSECURE, do not use for anything but testing
Diffstat (limited to 'src/hello')
-rw-r--r--src/hello/gnunet-hello.c2
-rw-r--r--src/hello/hello.c18
-rw-r--r--src/hello/test_hello.c4
3 files changed, 12 insertions, 12 deletions
diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c
index eae16a90b..fa250d7a1 100644
--- a/src/hello/gnunet-hello.c
+++ b/src/hello/gnunet-hello.c
@@ -107,7 +107,7 @@ main (int argc, char *argv[])
107 struct GNUNET_DISK_FileHandle *fh; 107 struct GNUNET_DISK_FileHandle *fh;
108 struct GNUNET_HELLO_Message *orig; 108 struct GNUNET_HELLO_Message *orig;
109 struct GNUNET_HELLO_Message *result; 109 struct GNUNET_HELLO_Message *result;
110 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk; 110 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pk;
111 uint64_t fsize; 111 uint64_t fsize;
112 112
113 GNUNET_log_setup ("gnunet-hello", "INFO", NULL); 113 GNUNET_log_setup ("gnunet-hello", "INFO", NULL);
diff --git a/src/hello/hello.c b/src/hello/hello.c
index becc4da96..a20e8992c 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -59,7 +59,7 @@ struct GNUNET_HELLO_Message
59 /** 59 /**
60 * The public key of the peer. 60 * The public key of the peer.
61 */ 61 */
62 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey; 62 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded publicKey;
63 63
64}; 64};
65GNUNET_NETWORK_STRUCT_END 65GNUNET_NETWORK_STRUCT_END
@@ -201,7 +201,7 @@ get_hello_address_size (const char *buf, size_t max, uint16_t * ralen)
201 * @return the hello message 201 * @return the hello message
202 */ 202 */
203struct GNUNET_HELLO_Message * 203struct GNUNET_HELLO_Message *
204GNUNET_HELLO_create (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded 204GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
205 *publicKey, 205 *publicKey,
206 GNUNET_HELLO_GenerateAddressListCallback addrgen, 206 GNUNET_HELLO_GenerateAddressListCallback addrgen,
207 void *addrgen_cls) 207 void *addrgen_cls)
@@ -227,7 +227,7 @@ GNUNET_HELLO_create (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
227 hello->header.type = htons (GNUNET_MESSAGE_TYPE_HELLO); 227 hello->header.type = htons (GNUNET_MESSAGE_TYPE_HELLO);
228 hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used); 228 hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used);
229 memcpy (&hello->publicKey, publicKey, 229 memcpy (&hello->publicKey, publicKey,
230 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); 230 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded));
231 memcpy (&hello[1], buffer, used); 231 memcpy (&hello[1], buffer, used);
232 return hello; 232 return hello;
233} 233}
@@ -274,7 +274,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
274 wpos = 0; 274 wpos = 0;
275 woff = (ret != NULL) ? (char *) &ret[1] : NULL; 275 woff = (ret != NULL) ? (char *) &ret[1] : NULL;
276 GNUNET_CRYPTO_hash (&msg->publicKey, 276 GNUNET_CRYPTO_hash (&msg->publicKey,
277 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 277 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
278 &address.peer.hashPubKey); 278 &address.peer.hashPubKey);
279 while (insize > 0) 279 while (insize > 0)
280 { 280 {
@@ -503,7 +503,7 @@ GNUNET_HELLO_size (const struct GNUNET_HELLO_Message *hello)
503 */ 503 */
504int 504int
505GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello, 505GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello,
506 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) 506 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *publicKey)
507{ 507{
508 uint16_t ret = ntohs (hello->header.size); 508 uint16_t ret = ntohs (hello->header.size);
509 509
@@ -532,7 +532,7 @@ GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello,
532 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO)) 532 (ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
533 return GNUNET_SYSERR; 533 return GNUNET_SYSERR;
534 GNUNET_CRYPTO_hash (&hello->publicKey, 534 GNUNET_CRYPTO_hash (&hello->publicKey,
535 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 535 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
536 &peer->hashPubKey); 536 &peer->hashPubKey);
537 return GNUNET_OK; 537 return GNUNET_OK;
538} 538}
@@ -641,7 +641,7 @@ GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1,
641 641
642 if (0 != 642 if (0 !=
643 memcmp (&h1->publicKey, &h2->publicKey, 643 memcmp (&h1->publicKey, &h2->publicKey,
644 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) 644 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
645 return GNUNET_TIME_UNIT_ZERO_ABS; 645 return GNUNET_TIME_UNIT_ZERO_ABS;
646 ec.expiration_limit = now; 646 ec.expiration_limit = now;
647 ec.result = GNUNET_TIME_UNIT_FOREVER_ABS; 647 ec.result = GNUNET_TIME_UNIT_FOREVER_ABS;
@@ -833,7 +833,7 @@ GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello,
833 struct GNUNET_HELLO_ComposeUriContext ctx; 833 struct GNUNET_HELLO_ComposeUriContext ctx;
834 ctx.plugins_find = plugins_find; 834 ctx.plugins_find = plugins_find;
835 835
836 char *pkey = GNUNET_CRYPTO_rsa_public_key_to_string (&(hello->publicKey)); 836 char *pkey = GNUNET_CRYPTO_ecc_public_key_to_string (&(hello->publicKey));
837 GNUNET_asprintf (&(ctx.uri), 837 GNUNET_asprintf (&(ctx.uri),
838 "%s%s", 838 "%s%s",
839 GNUNET_HELLO_URI_PREFIX, 839 GNUNET_HELLO_URI_PREFIX,
@@ -1005,7 +1005,7 @@ add_address_to_hello (void *cls, size_t max, void *buffer)
1005 */ 1005 */
1006int 1006int
1007GNUNET_HELLO_parse_uri (const char *uri, 1007GNUNET_HELLO_parse_uri (const char *uri,
1008 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey, 1008 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pubkey,
1009 struct GNUNET_HELLO_Message **hello, 1009 struct GNUNET_HELLO_Message **hello,
1010 GNUNET_HELLO_TransportPluginsFind plugins_find) 1010 GNUNET_HELLO_TransportPluginsFind plugins_find)
1011{ 1011{
diff --git a/src/hello/test_hello.c b/src/hello/test_hello.c
index 28d4aecbe..67335ab95 100644
--- a/src/hello/test_hello.c
+++ b/src/hello/test_hello.c
@@ -93,8 +93,8 @@ main (int argc, char *argv[])
93 struct GNUNET_HELLO_Message *msg1; 93 struct GNUNET_HELLO_Message *msg1;
94 struct GNUNET_HELLO_Message *msg2; 94 struct GNUNET_HELLO_Message *msg2;
95 struct GNUNET_HELLO_Message *msg3; 95 struct GNUNET_HELLO_Message *msg3;
96 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey; 96 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded publicKey;
97 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk; 97 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pk;
98 struct GNUNET_TIME_Absolute startup_time; 98 struct GNUNET_TIME_Absolute startup_time;
99 unsigned int i; 99 unsigned int i;
100 100