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/revocation | |
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/revocation')
-rw-r--r-- | src/revocation/gnunet-revocation.c | 12 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 8 | ||||
-rw-r--r-- | src/revocation/revocation.h | 6 | ||||
-rw-r--r-- | src/revocation/revocation_api.c | 30 |
4 files changed, 28 insertions, 28 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 5f97a7112..6b2aa6180 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -193,12 +193,12 @@ struct RevocationData | |||
193 | /** | 193 | /** |
194 | * Public key. | 194 | * Public key. |
195 | */ | 195 | */ |
196 | struct GNUNET_CRYPTO_EccPublicSignKey key; | 196 | struct GNUNET_CRYPTO_EcdsaPublicKey key; |
197 | 197 | ||
198 | /** | 198 | /** |
199 | * Revocation signature data. | 199 | * Revocation signature data. |
200 | */ | 200 | */ |
201 | struct GNUNET_CRYPTO_EccSignature sig; | 201 | struct GNUNET_CRYPTO_EcdsaSignature sig; |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * Proof of work (in NBO). | 204 | * Proof of work (in NBO). |
@@ -310,7 +310,7 @@ ego_callback (void *cls, | |||
310 | const struct GNUNET_IDENTITY_Ego *ego) | 310 | const struct GNUNET_IDENTITY_Ego *ego) |
311 | { | 311 | { |
312 | struct RevocationData *rd; | 312 | struct RevocationData *rd; |
313 | struct GNUNET_CRYPTO_EccPublicSignKey key; | 313 | struct GNUNET_CRYPTO_EcdsaPublicKey key; |
314 | 314 | ||
315 | el = NULL; | 315 | el = NULL; |
316 | if (NULL == ego) | 316 | if (NULL == ego) |
@@ -334,7 +334,7 @@ ego_callback (void *cls, | |||
334 | { | 334 | { |
335 | if (0 != memcmp (&rd->key, | 335 | if (0 != memcmp (&rd->key, |
336 | &key, | 336 | &key, |
337 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) | 337 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) |
338 | { | 338 | { |
339 | fprintf (stderr, | 339 | fprintf (stderr, |
340 | _("Error: revocation certificate in `%s' is not for `%s'\n"), | 340 | _("Error: revocation certificate in `%s' is not for `%s'\n"), |
@@ -387,14 +387,14 @@ run (void *cls, | |||
387 | const char *cfgfile, | 387 | const char *cfgfile, |
388 | const struct GNUNET_CONFIGURATION_Handle *c) | 388 | const struct GNUNET_CONFIGURATION_Handle *c) |
389 | { | 389 | { |
390 | struct GNUNET_CRYPTO_EccPublicSignKey pk; | 390 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; |
391 | struct RevocationData rd; | 391 | struct RevocationData rd; |
392 | 392 | ||
393 | cfg = c; | 393 | cfg = c; |
394 | if (NULL != test_ego) | 394 | if (NULL != test_ego) |
395 | { | 395 | { |
396 | if (GNUNET_OK != | 396 | if (GNUNET_OK != |
397 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (test_ego, | 397 | GNUNET_CRYPTO_ecdsa_public_key_from_string (test_ego, |
398 | strlen (test_ego), | 398 | strlen (test_ego), |
399 | &pk)) | 399 | &pk)) |
400 | { | 400 | { |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index c6e3152ba..5a7170de6 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -147,7 +147,7 @@ verify_revoke_message (const struct RevokeMessage *rm) | |||
147 | return GNUNET_NO; | 147 | return GNUNET_NO; |
148 | } | 148 | } |
149 | if (GNUNET_OK != | 149 | if (GNUNET_OK != |
150 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REVOCATION, | 150 | GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_REVOCATION, |
151 | &rm->purpose, | 151 | &rm->purpose, |
152 | &rm->signature, | 152 | &rm->signature, |
153 | &rm->public_key)) | 153 | &rm->public_key)) |
@@ -177,7 +177,7 @@ handle_query_message (void *cls, | |||
177 | int res; | 177 | int res; |
178 | 178 | ||
179 | GNUNET_CRYPTO_hash (&qm->key, | 179 | GNUNET_CRYPTO_hash (&qm->key, |
180 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 180 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
181 | &hc); | 181 | &hc); |
182 | res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); | 182 | res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -240,7 +240,7 @@ publicize_rm (const struct RevokeMessage *rm) | |||
240 | struct GNUNET_SET_Element e; | 240 | struct GNUNET_SET_Element e; |
241 | 241 | ||
242 | GNUNET_CRYPTO_hash (&rm->public_key, | 242 | GNUNET_CRYPTO_hash (&rm->public_key, |
243 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 243 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
244 | &hc); | 244 | &hc); |
245 | if (GNUNET_YES == | 245 | if (GNUNET_YES == |
246 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, | 246 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, |
@@ -622,7 +622,7 @@ run (void *cls, | |||
622 | } | 622 | } |
623 | GNUNET_break (0 == ntohl (rm->reserved)); | 623 | GNUNET_break (0 == ntohl (rm->reserved)); |
624 | GNUNET_CRYPTO_hash (&rm->public_key, | 624 | GNUNET_CRYPTO_hash (&rm->public_key, |
625 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 625 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
626 | &hc); | 626 | &hc); |
627 | GNUNET_break (GNUNET_OK == | 627 | GNUNET_break (GNUNET_OK == |
628 | GNUNET_CONTAINER_multihashmap_put (revocation_map, | 628 | GNUNET_CONTAINER_multihashmap_put (revocation_map, |
diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h index b13d79a37..48c284a4d 100644 --- a/src/revocation/revocation.h +++ b/src/revocation/revocation.h | |||
@@ -48,7 +48,7 @@ struct QueryMessage | |||
48 | /** | 48 | /** |
49 | * Key to check. | 49 | * Key to check. |
50 | */ | 50 | */ |
51 | struct GNUNET_CRYPTO_EccPublicSignKey key; | 51 | struct GNUNET_CRYPTO_EcdsaPublicKey key; |
52 | 52 | ||
53 | }; | 53 | }; |
54 | 54 | ||
@@ -98,7 +98,7 @@ struct RevokeMessage | |||
98 | /** | 98 | /** |
99 | * Signature confirming revocation. | 99 | * Signature confirming revocation. |
100 | */ | 100 | */ |
101 | struct GNUNET_CRYPTO_EccSignature signature; | 101 | struct GNUNET_CRYPTO_EcdsaSignature signature; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION, | 104 | * Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION, |
@@ -109,7 +109,7 @@ struct RevokeMessage | |||
109 | /** | 109 | /** |
110 | * Key to revoke. | 110 | * Key to revoke. |
111 | */ | 111 | */ |
112 | struct GNUNET_CRYPTO_EccPublicSignKey public_key; | 112 | struct GNUNET_CRYPTO_EcdsaPublicKey public_key; |
113 | 113 | ||
114 | }; | 114 | }; |
115 | 115 | ||
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index ebf85a94e..82e905e09 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -49,7 +49,7 @@ struct GNUNET_REVOCATION_Query | |||
49 | /** | 49 | /** |
50 | * Key to check. | 50 | * Key to check. |
51 | */ | 51 | */ |
52 | struct GNUNET_CRYPTO_EccPublicSignKey key; | 52 | struct GNUNET_CRYPTO_EcdsaPublicKey key; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Function to call with the result. | 55 | * Function to call with the result. |
@@ -146,7 +146,7 @@ send_revocation_query (void *cls, | |||
146 | */ | 146 | */ |
147 | struct GNUNET_REVOCATION_Query * | 147 | struct GNUNET_REVOCATION_Query * |
148 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 148 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, |
149 | const struct GNUNET_CRYPTO_EccPublicSignKey *key, | 149 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
150 | GNUNET_REVOCATION_Callback func, void *func_cls) | 150 | GNUNET_REVOCATION_Callback func, void *func_cls) |
151 | { | 151 | { |
152 | struct GNUNET_REVOCATION_Query *q; | 152 | struct GNUNET_REVOCATION_Query *q; |
@@ -210,12 +210,12 @@ struct GNUNET_REVOCATION_Handle | |||
210 | /** | 210 | /** |
211 | * Key to revoke. | 211 | * Key to revoke. |
212 | */ | 212 | */ |
213 | struct GNUNET_CRYPTO_EccPublicSignKey key; | 213 | struct GNUNET_CRYPTO_EcdsaPublicKey key; |
214 | 214 | ||
215 | /** | 215 | /** |
216 | * Signature showing that we have the right to revoke. | 216 | * Signature showing that we have the right to revoke. |
217 | */ | 217 | */ |
218 | struct GNUNET_CRYPTO_EccSignature sig; | 218 | struct GNUNET_CRYPTO_EcdsaSignature sig; |
219 | 219 | ||
220 | /** | 220 | /** |
221 | * Proof of work showing that we spent enough resources to broadcast revocation. | 221 | * Proof of work showing that we spent enough resources to broadcast revocation. |
@@ -300,7 +300,7 @@ send_revoke (void *cls, | |||
300 | rm.proof_of_work = h->pow; | 300 | rm.proof_of_work = h->pow; |
301 | rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 301 | rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
302 | rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 302 | rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
303 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); | 303 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
304 | rm.public_key = h->key; | 304 | rm.public_key = h->key; |
305 | rm.signature = h->sig; | 305 | rm.signature = h->sig; |
306 | memcpy (buf, &rm, sizeof (struct RevokeMessage)); | 306 | memcpy (buf, &rm, sizeof (struct RevokeMessage)); |
@@ -329,8 +329,8 @@ send_revoke (void *cls, | |||
329 | */ | 329 | */ |
330 | struct GNUNET_REVOCATION_Handle * | 330 | struct GNUNET_REVOCATION_Handle * |
331 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | 331 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, |
332 | const struct GNUNET_CRYPTO_EccPublicSignKey *key, | 332 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
333 | const struct GNUNET_CRYPTO_EccSignature *sig, | 333 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, |
334 | uint64_t pow, | 334 | uint64_t pow, |
335 | GNUNET_REVOCATION_Callback func, void *func_cls) | 335 | GNUNET_REVOCATION_Callback func, void *func_cls) |
336 | { | 336 | { |
@@ -437,17 +437,17 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash) | |||
437 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | 437 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not |
438 | */ | 438 | */ |
439 | int | 439 | int |
440 | GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, | 440 | GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
441 | uint64_t pow, | 441 | uint64_t pow, |
442 | unsigned int matching_bits) | 442 | unsigned int matching_bits) |
443 | { | 443 | { |
444 | char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + | 444 | char buf[sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + |
445 | sizeof (pow)] GNUNET_ALIGN; | 445 | sizeof (pow)] GNUNET_ALIGN; |
446 | struct GNUNET_HashCode result; | 446 | struct GNUNET_HashCode result; |
447 | 447 | ||
448 | memcpy (buf, &pow, sizeof (pow)); | 448 | memcpy (buf, &pow, sizeof (pow)); |
449 | memcpy (&buf[sizeof (pow)], key, | 449 | memcpy (&buf[sizeof (pow)], key, |
450 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); | 450 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
451 | pow_hash (buf, sizeof (buf), &result); | 451 | pow_hash (buf, sizeof (buf), &result); |
452 | return (count_leading_zeroes (&result) >= | 452 | return (count_leading_zeroes (&result) >= |
453 | matching_bits) ? GNUNET_YES : GNUNET_NO; | 453 | matching_bits) ? GNUNET_YES : GNUNET_NO; |
@@ -461,17 +461,17 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, | |||
461 | * @param sig where to write the revocation signature | 461 | * @param sig where to write the revocation signature |
462 | */ | 462 | */ |
463 | void | 463 | void |
464 | GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EccPrivateKey *key, | 464 | GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
465 | struct GNUNET_CRYPTO_EccSignature *sig) | 465 | struct GNUNET_CRYPTO_EcdsaSignature *sig) |
466 | { | 466 | { |
467 | struct RevokeMessage rm; | 467 | struct RevokeMessage rm; |
468 | 468 | ||
469 | rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 469 | rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
470 | rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 470 | rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
471 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); | 471 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
472 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &rm.public_key); | 472 | GNUNET_CRYPTO_ecdsa_key_get_public (key, &rm.public_key); |
473 | GNUNET_assert (GNUNET_OK == | 473 | GNUNET_assert (GNUNET_OK == |
474 | GNUNET_CRYPTO_ecc_sign (key, | 474 | GNUNET_CRYPTO_ecdsa_sign (key, |
475 | &rm.purpose, | 475 | &rm.purpose, |
476 | sig)); | 476 | sig)); |
477 | } | 477 | } |