aboutsummaryrefslogtreecommitdiff
path: root/src/revocation/revocation_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/revocation/revocation_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/revocation/revocation_api.c')
-rw-r--r--src/revocation/revocation_api.c30
1 files changed, 15 insertions, 15 deletions
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 */
147struct GNUNET_REVOCATION_Query * 147struct GNUNET_REVOCATION_Query *
148GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, 148GNUNET_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 */
330struct GNUNET_REVOCATION_Handle * 330struct GNUNET_REVOCATION_Handle *
331GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, 331GNUNET_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 */
439int 439int
440GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, 440GNUNET_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 */
463void 463void
464GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EccPrivateKey *key, 464GNUNET_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}