diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-10 14:38:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-10 14:38:55 +0000 |
commit | 9351b1e9bdf2b067b6db06562c26ba658cff42b8 (patch) | |
tree | 68dc4ab447e7e8b6a20a706858cd36238c1c7c5f /src/identity | |
parent | 8beabcd96c0cf1e1873c0b5ff96e537f1beb0b34 (diff) | |
download | gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.tar.gz gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.zip |
separating ECC crypto into functions/structs for ECDHE, ECDSA and EDDSA
Diffstat (limited to 'src/identity')
-rw-r--r-- | src/identity/gnunet-identity.c | 4 | ||||
-rw-r--r-- | src/identity/gnunet-service-identity.c | 16 | ||||
-rw-r--r-- | src/identity/identity.h | 6 | ||||
-rw-r--r-- | src/identity/identity_api.c | 26 |
4 files changed, 26 insertions, 26 deletions
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index c2c381604..8304a707d 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c | |||
@@ -226,7 +226,7 @@ print_ego (void *cls, | |||
226 | void **ctx, | 226 | void **ctx, |
227 | const char *identifier) | 227 | const char *identifier) |
228 | { | 228 | { |
229 | struct GNUNET_CRYPTO_EccPublicSignKey pk; | 229 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; |
230 | char *s; | 230 | char *s; |
231 | 231 | ||
232 | if ( (NULL != set_ego) && | 232 | if ( (NULL != set_ego) && |
@@ -267,7 +267,7 @@ print_ego (void *cls, | |||
267 | if (NULL == ego) | 267 | if (NULL == ego) |
268 | return; | 268 | return; |
269 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 269 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
270 | s = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pk); | 270 | s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); |
271 | if ( (monitor) || (NULL != identifier) ) | 271 | if ( (monitor) || (NULL != identifier) ) |
272 | fprintf (stdout, "%s - %s\n", identifier, s); | 272 | fprintf (stdout, "%s - %s\n", identifier, s); |
273 | GNUNET_free (s); | 273 | GNUNET_free (s); |
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index c61286bd5..e0c0bd783 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c | |||
@@ -58,7 +58,7 @@ struct Ego | |||
58 | /** | 58 | /** |
59 | * Private key of the ego. | 59 | * Private key of the ego. |
60 | */ | 60 | */ |
61 | struct GNUNET_CRYPTO_EccPrivateKey *pk; | 61 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * String identifier for the ego. | 64 | * String identifier for the ego. |
@@ -370,10 +370,10 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client, | |||
370 | * @return 0 if the keys are equal | 370 | * @return 0 if the keys are equal |
371 | */ | 371 | */ |
372 | static int | 372 | static int |
373 | key_cmp (const struct GNUNET_CRYPTO_EccPrivateKey *pk1, | 373 | key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, |
374 | const struct GNUNET_CRYPTO_EccPrivateKey *pk2) | 374 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) |
375 | { | 375 | { |
376 | return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)); | 376 | return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
@@ -517,7 +517,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, | |||
517 | } | 517 | } |
518 | } | 518 | } |
519 | ego = GNUNET_new (struct Ego); | 519 | ego = GNUNET_new (struct Ego); |
520 | ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); | 520 | ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); |
521 | *ego->pk = crm->private_key; | 521 | *ego->pk = crm->private_key; |
522 | ego->identifier = GNUNET_strdup (str); | 522 | ego->identifier = GNUNET_strdup (str); |
523 | GNUNET_CONTAINER_DLL_insert (ego_head, | 523 | GNUNET_CONTAINER_DLL_insert (ego_head, |
@@ -526,10 +526,10 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, | |||
526 | send_result_code (client, 0, NULL); | 526 | send_result_code (client, 0, NULL); |
527 | fn = get_ego_filename (ego); | 527 | fn = get_ego_filename (ego); |
528 | (void) GNUNET_DISK_directory_create_for_file (fn); | 528 | (void) GNUNET_DISK_directory_create_for_file (fn); |
529 | if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != | 529 | if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) != |
530 | GNUNET_DISK_fn_write (fn, | 530 | GNUNET_DISK_fn_write (fn, |
531 | &crm->private_key, | 531 | &crm->private_key, |
532 | sizeof (struct GNUNET_CRYPTO_EccPrivateKey), | 532 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), |
533 | GNUNET_DISK_PERM_USER_READ | | 533 | GNUNET_DISK_PERM_USER_READ | |
534 | GNUNET_DISK_PERM_USER_WRITE)) | 534 | GNUNET_DISK_PERM_USER_WRITE)) |
535 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | 535 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
@@ -819,7 +819,7 @@ process_ego_file (void *cls, | |||
819 | return GNUNET_OK; | 819 | return GNUNET_OK; |
820 | } | 820 | } |
821 | ego = GNUNET_new (struct Ego); | 821 | ego = GNUNET_new (struct Ego); |
822 | ego->pk = GNUNET_CRYPTO_ecc_key_create_from_file (filename); | 822 | ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename); |
823 | if (NULL == ego->pk) | 823 | if (NULL == ego->pk) |
824 | { | 824 | { |
825 | GNUNET_free (ego); | 825 | GNUNET_free (ego); |
diff --git a/src/identity/identity.h b/src/identity/identity.h index 5e965b2c7..206f08f2a 100644 --- a/src/identity/identity.h +++ b/src/identity/identity.h | |||
@@ -81,7 +81,7 @@ struct GNUNET_IDENTITY_UpdateMessage | |||
81 | /** | 81 | /** |
82 | * The private key | 82 | * The private key |
83 | */ | 83 | */ |
84 | struct GNUNET_CRYPTO_EccPrivateKey private_key; | 84 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; |
85 | 85 | ||
86 | /* followed by 0-terminated identity name */ | 86 | /* followed by 0-terminated identity name */ |
87 | 87 | ||
@@ -140,7 +140,7 @@ struct GNUNET_IDENTITY_SetDefaultMessage | |||
140 | /** | 140 | /** |
141 | * The private key | 141 | * The private key |
142 | */ | 142 | */ |
143 | struct GNUNET_CRYPTO_EccPrivateKey private_key; | 143 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; |
144 | 144 | ||
145 | /* followed by 0-terminated service name */ | 145 | /* followed by 0-terminated service name */ |
146 | 146 | ||
@@ -171,7 +171,7 @@ struct GNUNET_IDENTITY_CreateRequestMessage | |||
171 | /** | 171 | /** |
172 | * The private key | 172 | * The private key |
173 | */ | 173 | */ |
174 | struct GNUNET_CRYPTO_EccPrivateKey private_key; | 174 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; |
175 | 175 | ||
176 | /* followed by 0-terminated identity name */ | 176 | /* followed by 0-terminated identity name */ |
177 | 177 | ||
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 * | |||
179 | GNUNET_IDENTITY_ego_get_anonymous () | 179 | GNUNET_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 | */ |
594 | const struct GNUNET_CRYPTO_EccPrivateKey * | 594 | const struct GNUNET_CRYPTO_EcdsaPrivateKey * |
595 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) | 595 | GNUNET_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 | */ |
607 | void | 607 | void |
608 | GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, | 608 | GNUNET_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 | { |