aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.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/identity/identity_api.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/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index dc4613cdb..931deb509 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -40,7 +40,7 @@ struct GNUNET_IDENTITY_Ego
40 /** 40 /**
41 * Private key associated with this ego. 41 * Private key associated with this ego.
42 */ 42 */
43 struct GNUNET_CRYPTO_EccPrivateKey *pk; 43 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
44 44
45 /** 45 /**
46 * Current name associated with this ego. 46 * Current name associated with this ego.
@@ -179,12 +179,12 @@ const struct GNUNET_IDENTITY_Ego *
179GNUNET_IDENTITY_ego_get_anonymous () 179GNUNET_IDENTITY_ego_get_anonymous ()
180{ 180{
181 static struct GNUNET_IDENTITY_Ego anon; 181 static struct GNUNET_IDENTITY_Ego anon;
182 struct GNUNET_CRYPTO_EccPublicSignKey pub; 182 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
183 183
184 if (NULL != anon.pk) 184 if (NULL != anon.pk)
185 return &anon; 185 return &anon;
186 anon.pk = (struct GNUNET_CRYPTO_EccPrivateKey *) GNUNET_CRYPTO_ecc_key_get_anonymous (); 186 anon.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *) GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
187 GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon.pk, 187 GNUNET_CRYPTO_ecdsa_key_get_public (anon.pk,
188 &pub); 188 &pub);
189 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id); 189 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id);
190 return &anon; 190 return &anon;
@@ -249,7 +249,7 @@ message_handler (void *cls,
249 const struct GNUNET_IDENTITY_ResultCodeMessage *rcm; 249 const struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
250 const struct GNUNET_IDENTITY_UpdateMessage *um; 250 const struct GNUNET_IDENTITY_UpdateMessage *um;
251 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm; 251 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
252 struct GNUNET_CRYPTO_EccPublicSignKey pub; 252 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
253 struct GNUNET_HashCode id; 253 struct GNUNET_HashCode id;
254 const char *str; 254 const char *str;
255 uint16_t size; 255 uint16_t size;
@@ -326,7 +326,7 @@ message_handler (void *cls,
326 h->cb (h->cb_cls, NULL, NULL, NULL); 326 h->cb (h->cb_cls, NULL, NULL, NULL);
327 break; 327 break;
328 } 328 }
329 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&um->private_key, 329 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key,
330 &pub); 330 &pub);
331 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id); 331 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
332 if (0 == name_len) 332 if (0 == name_len)
@@ -346,7 +346,7 @@ message_handler (void *cls,
346 return; 346 return;
347 } 347 }
348 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego); 348 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
349 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); 349 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
350 *ego->pk = um->private_key; 350 *ego->pk = um->private_key;
351 ego->name = GNUNET_strdup (str); 351 ego->name = GNUNET_strdup (str);
352 ego->id = id; 352 ego->id = id;
@@ -406,7 +406,7 @@ message_handler (void *cls,
406 } 406 }
407 /* Note: we know which service this should be for, so we're not 407 /* Note: we know which service this should be for, so we're not
408 really using 'str' henceforth */ 408 really using 'str' henceforth */
409 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&sdm->private_key, 409 GNUNET_CRYPTO_ecdsa_key_get_public (&sdm->private_key,
410 &pub); 410 &pub);
411 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id); 411 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
412 ego = GNUNET_CONTAINER_multihashmap_get (h->egos, 412 ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
@@ -591,7 +591,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
591 * @param ego the ego 591 * @param ego the ego
592 * @return associated ECC key, valid as long as the ego is valid 592 * @return associated ECC key, valid as long as the ego is valid
593 */ 593 */
594const struct GNUNET_CRYPTO_EccPrivateKey * 594const struct GNUNET_CRYPTO_EcdsaPrivateKey *
595GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) 595GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
596{ 596{
597 return ego->pk; 597 return ego->pk;
@@ -606,9 +606,9 @@ GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
606 */ 606 */
607void 607void
608GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, 608GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
609 struct GNUNET_CRYPTO_EccPublicSignKey *pk) 609 struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
610{ 610{
611 GNUNET_CRYPTO_ecc_key_get_public_for_signature (ego->pk, 611 GNUNET_CRYPTO_ecdsa_key_get_public (ego->pk,
612 pk); 612 pk);
613} 613}
614 614
@@ -730,11 +730,11 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
730{ 730{
731 struct GNUNET_IDENTITY_Operation *op; 731 struct GNUNET_IDENTITY_Operation *op;
732 struct GNUNET_IDENTITY_CreateRequestMessage *crm; 732 struct GNUNET_IDENTITY_CreateRequestMessage *crm;
733 struct GNUNET_CRYPTO_EccPrivateKey *pk; 733 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
734 size_t slen; 734 size_t slen;
735 735
736 slen = strlen (name) + 1; 736 slen = strlen (name) + 1;
737 pk = GNUNET_CRYPTO_ecc_key_create (); 737 pk = GNUNET_CRYPTO_ecdsa_key_create ();
738 738
739 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage)) 739 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
740 { 740 {