aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_search.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-10 14:38:55 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-10 14:38:55 +0000
commit9351b1e9bdf2b067b6db06562c26ba658cff42b8 (patch)
tree68dc4ab447e7e8b6a20a706858cd36238c1c7c5f /src/fs/fs_search.c
parent8beabcd96c0cf1e1873c0b5ff96e537f1beb0b34 (diff)
downloadgnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.tar.gz
gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.zip
separating ECC crypto into functions/structs for ECDHE, ECDSA and EDDSA
Diffstat (limited to 'src/fs/fs_search.c')
-rw-r--r--src/fs/fs_search.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 11af03646..bc3561856 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -679,20 +679,20 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc, const char *id_update,
679 */ 679 */
680static int 680static int
681decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, 681decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
682 const struct GNUNET_CRYPTO_EccPublicSignKey *dpub, 682 const struct GNUNET_CRYPTO_EcdsaPublicKey *dpub,
683 const void *edata, 683 const void *edata,
684 size_t edata_size, 684 size_t edata_size,
685 char *data) 685 char *data)
686{ 686{
687 const struct GNUNET_CRYPTO_EccPrivateKey *anon; 687 const struct GNUNET_CRYPTO_EcdsaPrivateKey *anon;
688 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; 688 struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub;
689 unsigned int i; 689 unsigned int i;
690 690
691 /* find key */ 691 /* find key */
692 for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) 692 for (i = 0; i < sc->uri->data.ksk.keywordCount; i++)
693 if (0 == memcmp (dpub, 693 if (0 == memcmp (dpub,
694 &sc->requests[i].dpub, 694 &sc->requests[i].dpub,
695 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) 695 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
696 break; 696 break;
697 if (i == sc->uri->data.ksk.keywordCount) 697 if (i == sc->uri->data.ksk.keywordCount)
698 { 698 {
@@ -701,8 +701,8 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
701 return GNUNET_SYSERR; 701 return GNUNET_SYSERR;
702 } 702 }
703 /* decrypt */ 703 /* decrypt */
704 anon = GNUNET_CRYPTO_ecc_key_get_anonymous (); 704 anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
705 GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub); 705 GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub);
706 GNUNET_FS_ublock_decrypt_ (edata, edata_size, 706 GNUNET_FS_ublock_decrypt_ (edata, edata_size,
707 &anon_pub, 707 &anon_pub,
708 sc->requests[i].keyword, 708 sc->requests[i].keyword,
@@ -1035,7 +1035,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
1035 struct MessageBuilderContext mbc; 1035 struct MessageBuilderContext mbc;
1036 size_t msize; 1036 size_t msize;
1037 struct SearchMessage *sm; 1037 struct SearchMessage *sm;
1038 struct GNUNET_CRYPTO_EccPublicSignKey dpub; 1038 struct GNUNET_CRYPTO_EcdsaPublicKey dpub;
1039 unsigned int sqms; 1039 unsigned int sqms;
1040 uint32_t options; 1040 uint32_t options;
1041 1041
@@ -1102,7 +1102,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
1102 sm->type = htonl (GNUNET_BLOCK_TYPE_FS_UBLOCK); 1102 sm->type = htonl (GNUNET_BLOCK_TYPE_FS_UBLOCK);
1103 sm->anonymity_level = htonl (sc->anonymity); 1103 sm->anonymity_level = htonl (sc->anonymity);
1104 memset (&sm->target, 0, sizeof (struct GNUNET_HashCode)); 1104 memset (&sm->target, 0, sizeof (struct GNUNET_HashCode));
1105 GNUNET_CRYPTO_ecc_public_key_derive (&sc->uri->data.sks.ns, 1105 GNUNET_CRYPTO_ecdsa_public_key_derive (&sc->uri->data.sks.ns,
1106 sc->uri->data.sks.identifier, 1106 sc->uri->data.sks.identifier,
1107 "fs-ublock", 1107 "fs-ublock",
1108 &dpub); 1108 &dpub);
@@ -1271,16 +1271,16 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1271{ 1271{
1272 unsigned int i; 1272 unsigned int i;
1273 const char *keyword; 1273 const char *keyword;
1274 const struct GNUNET_CRYPTO_EccPrivateKey *anon; 1274 const struct GNUNET_CRYPTO_EcdsaPrivateKey *anon;
1275 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; 1275 struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub;
1276 struct SearchRequestEntry *sre; 1276 struct SearchRequestEntry *sre;
1277 1277
1278 GNUNET_assert (NULL == sc->client); 1278 GNUNET_assert (NULL == sc->client);
1279 if (GNUNET_FS_uri_test_ksk (sc->uri)) 1279 if (GNUNET_FS_uri_test_ksk (sc->uri))
1280 { 1280 {
1281 GNUNET_assert (0 != sc->uri->data.ksk.keywordCount); 1281 GNUNET_assert (0 != sc->uri->data.ksk.keywordCount);
1282 anon = GNUNET_CRYPTO_ecc_key_get_anonymous (); 1282 anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
1283 GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub); 1283 GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub);
1284 sc->requests = 1284 sc->requests =
1285 GNUNET_malloc (sizeof (struct SearchRequestEntry) * 1285 GNUNET_malloc (sizeof (struct SearchRequestEntry) *
1286 sc->uri->data.ksk.keywordCount); 1286 sc->uri->data.ksk.keywordCount);
@@ -1289,12 +1289,12 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1289 keyword = &sc->uri->data.ksk.keywords[i][1]; 1289 keyword = &sc->uri->data.ksk.keywords[i][1];
1290 sre = &sc->requests[i]; 1290 sre = &sc->requests[i];
1291 sre->keyword = GNUNET_strdup (keyword); 1291 sre->keyword = GNUNET_strdup (keyword);
1292 GNUNET_CRYPTO_ecc_public_key_derive (&anon_pub, 1292 GNUNET_CRYPTO_ecdsa_public_key_derive (&anon_pub,
1293 keyword, 1293 keyword,
1294 "fs-ublock", 1294 "fs-ublock",
1295 &sre->dpub); 1295 &sre->dpub);
1296 GNUNET_CRYPTO_hash (&sre->dpub, 1296 GNUNET_CRYPTO_hash (&sre->dpub,
1297 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 1297 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey),
1298 &sre->uquery); 1298 &sre->uquery);
1299 sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+'); 1299 sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+');
1300 if (sre->mandatory) 1300 if (sre->mandatory)