diff options
Diffstat (limited to 'src/lib/util/crypto_blind_sign.c')
-rw-r--r-- | src/lib/util/crypto_blind_sign.c | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/src/lib/util/crypto_blind_sign.c b/src/lib/util/crypto_blind_sign.c index bf6fbc119..469f6f5b8 100644 --- a/src/lib/util/crypto_blind_sign.c +++ b/src/lib/util/crypto_blind_sign.c | |||
@@ -388,10 +388,51 @@ GNUNET_CRYPTO_blind_sign_keys_create_va ( | |||
388 | } | 388 | } |
389 | 389 | ||
390 | 390 | ||
391 | struct GNUNET_CRYPTO_BlindingInputValues * | ||
392 | GNUNET_CRYPTO_get_blinding_input_values ( | ||
393 | const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv, | ||
394 | const union GNUNET_CRYPTO_BlindSessionNonce *nonce, | ||
395 | const char *salt) | ||
396 | { | ||
397 | struct GNUNET_CRYPTO_BlindingInputValues *biv; | ||
398 | |||
399 | biv = GNUNET_new (struct GNUNET_CRYPTO_BlindingInputValues); | ||
400 | biv->cipher = bsign_priv->cipher; | ||
401 | biv->rc = 1; | ||
402 | switch (bsign_priv->cipher) | ||
403 | { | ||
404 | case GNUNET_CRYPTO_BSA_INVALID: | ||
405 | GNUNET_break (0); | ||
406 | GNUNET_free (biv); | ||
407 | return NULL; | ||
408 | case GNUNET_CRYPTO_BSA_RSA: | ||
409 | return biv; | ||
410 | case GNUNET_CRYPTO_BSA_CS: | ||
411 | { | ||
412 | struct GNUNET_CRYPTO_CsRSecret cspriv[2]; | ||
413 | |||
414 | GNUNET_CRYPTO_cs_r_derive (&nonce->cs_nonce, | ||
415 | salt, | ||
416 | &bsign_priv->details.cs_private_key, | ||
417 | cspriv); | ||
418 | GNUNET_CRYPTO_cs_r_get_public (&cspriv[0], | ||
419 | &biv->details.cs_values.r_pub[0]); | ||
420 | GNUNET_CRYPTO_cs_r_get_public (&cspriv[1], | ||
421 | &biv->details.cs_values.r_pub[1]); | ||
422 | return biv; | ||
423 | } | ||
424 | } | ||
425 | GNUNET_break (0); | ||
426 | GNUNET_free (biv); | ||
427 | return NULL; | ||
428 | } | ||
429 | |||
430 | |||
391 | struct GNUNET_CRYPTO_BlindedMessage * | 431 | struct GNUNET_CRYPTO_BlindedMessage * |
392 | GNUNET_CRYPTO_message_blind_to_sign ( | 432 | GNUNET_CRYPTO_message_blind_to_sign ( |
393 | const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub, | 433 | const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub, |
394 | const union GNUNET_CRYPTO_BlindingSecretP *bks, | 434 | const union GNUNET_CRYPTO_BlindingSecretP *bks, |
435 | const union GNUNET_CRYPTO_BlindSessionNonce *nonce, | ||
395 | const void *message, | 436 | const void *message, |
396 | size_t message_size, | 437 | size_t message_size, |
397 | const struct GNUNET_CRYPTO_BlindingInputValues *alg_values) | 438 | const struct GNUNET_CRYPTO_BlindingInputValues *alg_values) |
@@ -426,6 +467,12 @@ GNUNET_CRYPTO_message_blind_to_sign ( | |||
426 | struct GNUNET_CRYPTO_CSPublicRPairP blinded_r_pub; | 467 | struct GNUNET_CRYPTO_CSPublicRPairP blinded_r_pub; |
427 | struct GNUNET_CRYPTO_CsBlindingSecret bs[2]; | 468 | struct GNUNET_CRYPTO_CsBlindingSecret bs[2]; |
428 | 469 | ||
470 | if (NULL == nonce) | ||
471 | { | ||
472 | GNUNET_break_op (0); | ||
473 | GNUNET_free (bm); | ||
474 | return NULL; | ||
475 | } | ||
429 | GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, | 476 | GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, |
430 | bs); | 477 | bs); |
431 | GNUNET_CRYPTO_cs_calc_blinded_c ( | 478 | GNUNET_CRYPTO_cs_calc_blinded_c ( |
@@ -435,10 +482,9 @@ GNUNET_CRYPTO_message_blind_to_sign ( | |||
435 | message, | 482 | message, |
436 | message_size, | 483 | message_size, |
437 | bm->details.cs_blinded_message.c, | 484 | bm->details.cs_blinded_message.c, |
438 | blinded_r_pub.r_pub); | 485 | &blinded_r_pub); |
486 | bm->details.cs_blinded_message.nonce = nonce->cs_nonce; | ||
439 | (void) blinded_r_pub; | 487 | (void) blinded_r_pub; |
440 | // FIXME: bs->details.cs_blinded_message.nonce | ||
441 | // is NOT initialized here. Not elegant! | ||
442 | return bm; | 488 | return bm; |
443 | } | 489 | } |
444 | } | 490 | } |
@@ -562,7 +608,7 @@ GNUNET_CRYPTO_blind_sig_unblind ( | |||
562 | message, | 608 | message, |
563 | message_size, | 609 | message_size, |
564 | c, | 610 | c, |
565 | r_pub_blind.r_pub); | 611 | &r_pub_blind); |
566 | b = blinded_sig->details.blinded_cs_answer.b; | 612 | b = blinded_sig->details.blinded_cs_answer.b; |
567 | ub_sig->details.cs_signature.r_point | 613 | ub_sig->details.cs_signature.r_point |
568 | = r_pub_blind.r_pub[b]; | 614 | = r_pub_blind.r_pub[b]; |