diff options
Diffstat (limited to 'src/util/test_crypto_cs.c')
-rw-r--r-- | src/util/test_crypto_cs.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/src/util/test_crypto_cs.c b/src/util/test_crypto_cs.c index f7ac10982..347d2e214 100644 --- a/src/util/test_crypto_cs.c +++ b/src/util/test_crypto_cs.c | |||
@@ -486,10 +486,19 @@ main (int argc, | |||
486 | size_t message_len = strlen ("test message"); | 486 | size_t message_len = strlen ("test message"); |
487 | 487 | ||
488 | struct GNUNET_CRYPTO_CsPrivateKey priv; | 488 | struct GNUNET_CRYPTO_CsPrivateKey priv; |
489 | |||
490 | memset (&priv, | ||
491 | 42, | ||
492 | sizeof (priv)); | ||
489 | test_create_priv (&priv); | 493 | test_create_priv (&priv); |
490 | 494 | ||
491 | struct GNUNET_CRYPTO_CsPublicKey pub; | 495 | struct GNUNET_CRYPTO_CsPublicKey pub; |
492 | test_generate_pub (&priv, &pub); | 496 | |
497 | memset (&pub, | ||
498 | 42, | ||
499 | sizeof (pub)); | ||
500 | test_generate_pub (&priv, | ||
501 | &pub); | ||
493 | 502 | ||
494 | // derive nonce | 503 | // derive nonce |
495 | struct GNUNET_CRYPTO_CsNonce nonce; | 504 | struct GNUNET_CRYPTO_CsNonce nonce; |
@@ -505,22 +514,45 @@ main (int argc, | |||
505 | 514 | ||
506 | // generate r, R | 515 | // generate r, R |
507 | struct GNUNET_CRYPTO_CsRSecret r_secrets[2]; | 516 | struct GNUNET_CRYPTO_CsRSecret r_secrets[2]; |
508 | test_derive_rsecret (&nonce, &priv, r_secrets); | 517 | |
518 | memset (r_secrets, | ||
519 | 42, | ||
520 | sizeof (r_secrets)); | ||
521 | test_derive_rsecret (&nonce, | ||
522 | &priv, | ||
523 | r_secrets); | ||
509 | 524 | ||
510 | struct GNUNET_CRYPTO_CsRPublic r_publics[2]; | 525 | struct GNUNET_CRYPTO_CsRPublic r_publics[2]; |
511 | test_generate_rpublic (&r_secrets[0], &r_publics[0]); | 526 | |
512 | test_generate_rpublic (&r_secrets[1], &r_publics[1]); | 527 | memset (r_publics, |
528 | 42, | ||
529 | sizeof (r_publics)); | ||
530 | test_generate_rpublic (&r_secrets[0], | ||
531 | &r_publics[0]); | ||
532 | test_generate_rpublic (&r_secrets[1], | ||
533 | &r_publics[1]); | ||
513 | 534 | ||
514 | // ---------- actions performed by user | 535 | // ---------- actions performed by user |
515 | 536 | ||
516 | // generate blinding secrets | 537 | // generate blinding secrets |
517 | struct GNUNET_CRYPTO_CsBlindingSecret blindingsecrets[2]; | 538 | struct GNUNET_CRYPTO_CsBlindingSecret blindingsecrets[2]; |
539 | |||
540 | memset (blindingsecrets, | ||
541 | 42, | ||
542 | sizeof (blindingsecrets)); | ||
518 | test_derive_blindingsecrets (&nonce, | 543 | test_derive_blindingsecrets (&nonce, |
519 | blindingsecrets); | 544 | blindingsecrets); |
520 | 545 | ||
521 | // calculate blinded c's | 546 | // calculate blinded c's |
522 | struct GNUNET_CRYPTO_CsC blinded_cs[2]; | 547 | struct GNUNET_CRYPTO_CsC blinded_cs[2]; |
523 | struct GNUNET_CRYPTO_CsRPublic blinded_r_pubs[2]; | 548 | struct GNUNET_CRYPTO_CsRPublic blinded_r_pubs[2]; |
549 | |||
550 | memset (blinded_cs, | ||
551 | 42, | ||
552 | sizeof (blinded_cs)); | ||
553 | memset (blinded_r_pubs, | ||
554 | 42, | ||
555 | sizeof (blinded_r_pubs)); | ||
524 | test_calc_blindedc (blindingsecrets, | 556 | test_calc_blindedc (blindingsecrets, |
525 | r_publics, | 557 | r_publics, |
526 | &pub, | 558 | &pub, |
@@ -533,6 +565,10 @@ main (int argc, | |||
533 | // sign blinded c's and get b and s in return | 565 | // sign blinded c's and get b and s in return |
534 | unsigned int b; | 566 | unsigned int b; |
535 | struct GNUNET_CRYPTO_CsBlindS blinded_s; | 567 | struct GNUNET_CRYPTO_CsBlindS blinded_s; |
568 | |||
569 | memset (&blinded_s, | ||
570 | 42, | ||
571 | sizeof (blinded_s)); | ||
536 | test_blind_sign (&b, | 572 | test_blind_sign (&b, |
537 | &priv, | 573 | &priv, |
538 | r_secrets, | 574 | r_secrets, |
@@ -542,6 +578,7 @@ main (int argc, | |||
542 | 578 | ||
543 | // verify blinded signature | 579 | // verify blinded signature |
544 | struct GNUNET_CRYPTO_CsSignature blinded_signature; | 580 | struct GNUNET_CRYPTO_CsSignature blinded_signature; |
581 | |||
545 | blinded_signature.r_point = r_publics[b]; | 582 | blinded_signature.r_point = r_publics[b]; |
546 | blinded_signature.s_scalar.scalar = blinded_s.scalar; | 583 | blinded_signature.s_scalar.scalar = blinded_s.scalar; |
547 | test_blind_verify (&blinded_signature, | 584 | test_blind_verify (&blinded_signature, |
@@ -550,6 +587,10 @@ main (int argc, | |||
550 | 587 | ||
551 | // ---------- actions performed by user | 588 | // ---------- actions performed by user |
552 | struct GNUNET_CRYPTO_CsS sig_scalar; | 589 | struct GNUNET_CRYPTO_CsS sig_scalar; |
590 | |||
591 | memset (&sig_scalar, | ||
592 | 42, | ||
593 | sizeof (sig_scalar)); | ||
553 | test_unblinds (&blinded_s, | 594 | test_unblinds (&blinded_s, |
554 | &blindingsecrets[b], | 595 | &blindingsecrets[b], |
555 | &sig_scalar); | 596 | &sig_scalar); |