aboutsummaryrefslogtreecommitdiff
path: root/src/revocation/revocation_api.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-04-19 20:30:07 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-04-19 20:30:07 +0200
commitc2127bac669d91eb66bea91f5a9e0b27106a9152 (patch)
tree7698986db3d4108db1d4fddb4c83436460dae389 /src/revocation/revocation_api.c
parent37bb51d9fc99c8d5dd99343adf0feb7e351e6394 (diff)
downloadgnunet-c2127bac669d91eb66bea91f5a9e0b27106a9152.tar.gz
gnunet-c2127bac669d91eb66bea91f5a9e0b27106a9152.zip
uncrustify
Diffstat (limited to 'src/revocation/revocation_api.c')
-rw-r--r--src/revocation/revocation_api.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index bd0202b67..0361f239b 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -430,7 +430,8 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
430 */ 430 */
431 for (unsigned int i = 0; i < POW_COUNT; i++) 431 for (unsigned int i = 0; i < POW_COUNT; i++)
432 { 432 {
433 for (unsigned int j = i+1; j < POW_COUNT; j++) { 433 for (unsigned int j = i + 1; j < POW_COUNT; j++)
434 {
434 if (pow->pow[i] == pow->pow[j]) 435 if (pow->pow[i] == pow->pow[j])
435 return GNUNET_NO; 436 return GNUNET_NO;
436 } 437 }
@@ -451,7 +452,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
451 &result); 452 &result);
452 tmp_score = count_leading_zeroes (&result); 453 tmp_score = count_leading_zeroes (&result);
453 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 454 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
454 "Score %u with %"PRIu64" (#%u)\n", 455 "Score %u with %" PRIu64 " (#%u)\n",
455 tmp_score, pow_val, i); 456 tmp_score, pow_val, i);
456 score += tmp_score; 457 score += tmp_score;
457 458
@@ -472,11 +473,11 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
472 unsigned int difficulty) 473 unsigned int difficulty)
473{ 474{
474 struct GNUNET_REVOCATION_PowCalculationHandle*pc; 475 struct GNUNET_REVOCATION_PowCalculationHandle*pc;
475 struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get(); 476 struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
476 477
477 pc = GNUNET_new (struct GNUNET_REVOCATION_PowCalculationHandle); 478 pc = GNUNET_new (struct GNUNET_REVOCATION_PowCalculationHandle);
478 pc->pow.key = *key; 479 pc->pow.key = *key;
479 pc->pow.timestamp = GNUNET_TIME_absolute_hton(ts); 480 pc->pow.timestamp = GNUNET_TIME_absolute_hton (ts);
480 pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 481 pc->current_pow = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
481 UINT64_MAX); 482 UINT64_MAX);
482 pc->difficulty = difficulty; 483 pc->difficulty = difficulty;
@@ -533,7 +534,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
533 pc->best[i].pow = pc->current_pow; 534 pc->best[i].pow = pc->current_pow;
534 pc->pow.pow[i] = GNUNET_htonll (pc->current_pow); 535 pc->pow.pow[i] = GNUNET_htonll (pc->current_pow);
535 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 536 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
536 "New best score %u with %"PRIu64" (#%u)\n", 537 "New best score %u with %" PRIu64 " (#%u)\n",
537 zeros, pc->current_pow, i); 538 zeros, pc->current_pow, i);
538 break; 539 break;
539 } 540 }
@@ -568,11 +569,12 @@ GNUNET_REVOCATION_pow_cleanup (struct
568 */ 569 */
569void 570void
570GNUNET_REVOCATION_sign_revocation (struct GNUNET_REVOCATION_Pow *pow, 571GNUNET_REVOCATION_sign_revocation (struct GNUNET_REVOCATION_Pow *pow,
571 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key) 572 const struct
573 GNUNET_CRYPTO_EcdsaPrivateKey *key)
572{ 574{
573 pow->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); 575 pow->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
574 pow->purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) 576 pow->purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
575 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 577 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
576 GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key); 578 GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key);
577 GNUNET_assert (GNUNET_OK == 579 GNUNET_assert (GNUNET_OK ==
578 GNUNET_CRYPTO_ecdsa_sign_ (key, 580 GNUNET_CRYPTO_ecdsa_sign_ (key,