GNUnet 0.28.1-dev.5-1-gae1c02d74
 
Loading...
Searching...
No Matches
crypto_blind_sign.c
Go to the documentation of this file.
1/*
2 This file is part of GNUNET
3 Copyright (C) 2021, 2022, 2023 GNUnet e.V.
4
5 GNUNET is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3, or (at your option) any later version.
8
9 GNUNET is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 GNUNET; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
15*/
21#include "platform.h"
22#include "gnunet_util_lib.h"
23
24
25void
28{
29 GNUNET_assert (bm->rc > 0);
30 bm->rc--;
31 if (0 != bm->rc)
32 return;
33 switch (bm->cipher)
34 {
36 GNUNET_break (0);
37 break;
40 break;
43 break;
44 }
45 GNUNET_free (bm);
46}
47
48
49void
51 struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv)
52{
53 GNUNET_assert (bsign_priv->rc > 0);
54 bsign_priv->rc--;
55 if (0 != bsign_priv->rc)
56 return;
57 switch (bsign_priv->cipher)
58 {
60 GNUNET_break (0);
61 break;
63 if (NULL != bsign_priv->details.rsa_private_key)
64 {
66 bsign_priv->details.rsa_private_key = NULL;
67 }
69 break;
72 break;
73 }
74 GNUNET_free (bsign_priv);
75}
76
77
78void
80 struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub)
81{
82 GNUNET_assert (bsign_pub->rc > 0);
83 bsign_pub->rc--;
84 if (0 != bsign_pub->rc)
85 return;
86 switch (bsign_pub->cipher)
87 {
89 GNUNET_break (0);
90 break;
92 if (NULL != bsign_pub->details.rsa_public_key)
93 {
95 bsign_pub->details.rsa_public_key = NULL;
96 }
98 break;
100 break;
101 }
102 GNUNET_free (bsign_pub);
103}
104
105
106void
109{
110 GNUNET_assert (ub_sig->rc > 0);
111 ub_sig->rc--;
112 if (0 != ub_sig->rc)
113 return;
114 switch (ub_sig->cipher)
115 {
117 GNUNET_break (0);
118 break;
120 if (NULL != ub_sig->details.rsa_signature)
121 {
123 ub_sig->details.rsa_signature = NULL;
124 }
126 break;
129 break;
130 }
131 GNUNET_free (ub_sig);
132}
133
134
135void
137 struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
138{
139 GNUNET_assert (blind_sig->rc > 0);
140 blind_sig->rc--;
141 if (0 != blind_sig->rc)
142 return;
143 switch (blind_sig->cipher)
144 {
146 GNUNET_break (0);
147 break;
149 if (NULL != blind_sig->details.blinded_rsa_signature)
150 {
152 blind_sig->details.blinded_rsa_signature);
153 blind_sig->details.blinded_rsa_signature = NULL;
154 }
156 break;
159 break;
160 }
161 GNUNET_free (blind_sig);
162}
163
164
165void
168{
169 GNUNET_assert (bm->rc > 0);
170 bm->rc--;
171 if (0 != bm->rc)
172 return;
173 switch (bm->cipher)
174 {
176 GNUNET_break (0);
177 break;
180 break;
182 break;
183 }
184 GNUNET_free (bm);
185}
186
187
191{
192 bm->rc++;
193 return bm;
194}
195
196
200{
201 bm->rc++;
202 return bm;
203}
204
205
208 struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub)
209{
210 bsign_pub->rc++;
211 return bsign_pub;
212}
213
214
217 struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv)
218{
219 bsign_priv->rc++;
220 return bsign_priv;
221}
222
223
226{
227 ub_sig->rc++;
228 return ub_sig;
229}
230
231
234 struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
235{
236 blind_sig->rc++;
237 return blind_sig;
238}
239
240
241int
243 const struct GNUNET_CRYPTO_BlindSignPublicKey *bp1,
244 const struct GNUNET_CRYPTO_BlindSignPublicKey *bp2)
245{
246 if (bp1->cipher != bp2->cipher)
247 return (bp1->cipher > bp2->cipher) ? 1 : -1;
248 switch (bp1->cipher)
249 {
251 GNUNET_break (0);
252 return 0;
254 return GNUNET_memcmp (&bp1->pub_key_hash,
255 &bp2->pub_key_hash);
257 return GNUNET_memcmp (&bp1->pub_key_hash,
258 &bp2->pub_key_hash);
259 }
260 GNUNET_assert (0);
261 return -2;
262}
263
264
265int
267 const struct GNUNET_CRYPTO_UnblindedSignature *sig1,
268 const struct GNUNET_CRYPTO_UnblindedSignature *sig2)
269{
270 if (sig1->cipher != sig2->cipher)
271 return (sig1->cipher > sig2->cipher) ? 1 : -1;
272 switch (sig1->cipher)
273 {
275 GNUNET_break (0);
276 return 0;
279 sig2->details.rsa_signature);
281 return GNUNET_memcmp (&sig1->details.cs_signature,
282 &sig2->details.cs_signature);
283 }
284 GNUNET_assert (0);
285 return -2;
286}
287
288
289int
291 const struct GNUNET_CRYPTO_BlindedSignature *sig1,
292 const struct GNUNET_CRYPTO_BlindedSignature *sig2)
293{
294 if (sig1->cipher != sig2->cipher)
295 return (sig1->cipher > sig2->cipher) ? 1 : -1;
296 switch (sig1->cipher)
297 {
299 GNUNET_break (0);
300 return 0;
308 }
309 GNUNET_assert (0);
310 return -2;
311}
312
313
314int
316 const struct GNUNET_CRYPTO_BlindedMessage *bp1,
317 const struct GNUNET_CRYPTO_BlindedMessage *bp2)
318{
319 if (bp1->cipher != bp2->cipher)
320 return (bp1->cipher > bp2->cipher) ? 1 : -1;
321 switch (bp1->cipher)
322 {
324 GNUNET_break (0);
325 return 0;
331 return memcmp (bp1->details.rsa_blinded_message.blinded_msg,
337 }
338 GNUNET_assert (0);
339 return -2;
340}
341
342
345 struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv,
346 struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub,
348 ...)
349{
351 va_list ap;
352
353 va_start (ap,
354 cipher);
356 bsign_pub,
357 cipher,
358 ap);
359 va_end (ap);
360 return ret;
361}
362
363
366 struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv,
367 struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub,
369 va_list ap)
370{
373
375 priv->rc = 1;
376 priv->cipher = cipher;
377 *bsign_priv = priv;
379 pub->rc = 1;
380 pub->cipher = cipher;
381 *bsign_pub = pub;
382 switch (cipher)
383 {
385 GNUNET_break (0);
386 break;
388 {
389 unsigned int bits;
390
391 bits = va_arg (ap,
392 unsigned int);
393 if (bits < 512)
394 {
395 GNUNET_break (0);
396 break;
397 }
400 }
401 if (NULL == priv->details.rsa_private_key)
402 {
403 GNUNET_break (0);
404 break;
405 }
406 pub->details.rsa_public_key
409 GNUNET_CRYPTO_rsa_public_key_hash (pub->details.rsa_public_key,
410 &pub->pub_key_hash);
411 return GNUNET_OK;
415 &priv->details.cs_private_key,
416 &pub->details.cs_public_key);
417 GNUNET_CRYPTO_hash (&pub->details.cs_public_key,
418 sizeof(pub->details.cs_public_key),
419 &pub->pub_key_hash);
420 return GNUNET_OK;
421 }
422 GNUNET_free (priv);
424 *bsign_priv = NULL;
425 *bsign_pub = NULL;
426 return GNUNET_SYSERR;
427}
428
429
432 const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv,
433 const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
434 const char *salt)
435{
437
439 biv->cipher = bsign_priv->cipher;
440 biv->rc = 1;
441 switch (bsign_priv->cipher)
442 {
444 GNUNET_break (0);
445 GNUNET_free (biv);
446 return NULL;
448 return biv;
450 {
451 struct GNUNET_CRYPTO_CsRSecret cspriv[2];
452
454 salt,
455 &bsign_priv->details.cs_private_key,
456 cspriv);
458 &biv->details.cs_values.r_pub[0]);
460 &biv->details.cs_values.r_pub[1]);
461 return biv;
462 }
463 }
464 GNUNET_break (0);
465 GNUNET_free (biv);
466 return NULL;
467}
468
469
472 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub,
473 const union GNUNET_CRYPTO_BlindingSecretP *bks,
474 const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
475 const void *message,
476 size_t message_size,
477 const struct GNUNET_CRYPTO_BlindingInputValues *alg_values)
478{
480
481 if (alg_values->cipher != bsign_pub->cipher)
482 {
483 GNUNET_break (0);
484 return NULL;
485 }
486
488 bm->cipher = bsign_pub->cipher;
489 bm->rc = 1;
490 switch (bsign_pub->cipher)
491 {
493 GNUNET_break (0);
494 GNUNET_free (bm);
495 return NULL;
497 if (GNUNET_YES !=
499 message,
500 message_size,
501 &bks->rsa_bks,
502 bsign_pub->details.rsa_public_key,
504 {
505 GNUNET_break (0);
506 GNUNET_free (bm);
507 return NULL;
508 }
509 return bm;
511 {
512 struct GNUNET_CRYPTO_CSPublicRPairP blinded_r_pub;
514
515 if (NULL == nonce)
516 {
517 GNUNET_break_op (0);
518 GNUNET_free (bm);
519 return NULL;
520 }
522 bs);
524 bs,
525 alg_values->details.cs_values.r_pub,
526 &bsign_pub->details.cs_public_key,
527 message,
528 message_size,
530 &blinded_r_pub);
532 (void) blinded_r_pub;
533 return bm;
534 }
535 }
536 GNUNET_break (0);
537 return NULL;
538}
539
540
543 const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv,
544 const char *salt,
545 const struct GNUNET_CRYPTO_BlindedMessage *blinded_message)
546{
547 struct GNUNET_CRYPTO_BlindedSignature *blind_sig;
548
549 if (blinded_message->cipher != bsign_priv->cipher)
550 {
551 GNUNET_break (0);
552 return NULL;
553 }
554
555 blind_sig = GNUNET_new (struct GNUNET_CRYPTO_BlindedSignature);
556 blind_sig->cipher = bsign_priv->cipher;
557 blind_sig->rc = 1;
558 switch (bsign_priv->cipher)
559 {
561 GNUNET_break (0);
562 GNUNET_free (blind_sig);
563 return NULL;
567 bsign_priv->details.rsa_private_key,
568 &blinded_message->details.rsa_blinded_message);
569 if (NULL == blind_sig->details.blinded_rsa_signature)
570 {
571 GNUNET_break (0);
572 GNUNET_free (blind_sig);
573 return NULL;
574 }
575 return blind_sig;
577 {
578 struct GNUNET_CRYPTO_CsRSecret r[2];
579
581 &blinded_message->details.cs_blinded_message.nonce,
582 salt,
583 &bsign_priv->details.cs_private_key,
584 r);
586 &bsign_priv->details.cs_private_key,
587 r,
588 &blinded_message->details.cs_blinded_message,
589 &blind_sig->details.blinded_cs_answer);
590 }
591 return blind_sig;
592 }
593 GNUNET_break (0);
594 return NULL;
595}
596
597
600 const struct GNUNET_CRYPTO_BlindedSignature *blinded_sig,
601 const union GNUNET_CRYPTO_BlindingSecretP *bks,
602 const void *message,
603 size_t message_size,
604 const struct GNUNET_CRYPTO_BlindingInputValues *alg_values,
605 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub)
606{
608
609 if (blinded_sig->cipher != bsign_pub->cipher)
610 {
611 GNUNET_break (0);
612 return NULL;
613 }
614 if (blinded_sig->cipher != alg_values->cipher)
615 {
616 GNUNET_break (0);
617 return NULL;
618 }
620 ub_sig->cipher = blinded_sig->cipher;
621 ub_sig->rc = 1;
622 switch (bsign_pub->cipher)
623 {
625 GNUNET_break (0);
626 GNUNET_free (ub_sig);
627 return NULL;
629 ub_sig->details.rsa_signature
631 blinded_sig->details.blinded_rsa_signature,
632 &bks->rsa_bks,
633 bsign_pub->details.rsa_public_key);
634 if (NULL == ub_sig->details.rsa_signature)
635 {
636 GNUNET_break (0);
637 GNUNET_free (ub_sig);
638 return NULL;
639 }
640 return ub_sig;
642 {
644 struct GNUNET_CRYPTO_CsC c[2];
645 struct GNUNET_CRYPTO_CSPublicRPairP r_pub_blind;
646 unsigned int b;
647
649 bs);
651 bs,
652 alg_values->details.cs_values.r_pub,
653 &bsign_pub->details.cs_public_key,
654 message,
655 message_size,
656 c,
657 &r_pub_blind);
658 b = blinded_sig->details.blinded_cs_answer.b;
660 = r_pub_blind.r_pub[b];
662 &blinded_sig->details.blinded_cs_answer.s_scalar,
663 &bs[b],
664 &ub_sig->details.cs_signature.s_scalar);
665 return ub_sig;
666 }
667 }
668 GNUNET_break (0);
669 GNUNET_free (ub_sig);
670 return NULL;
671}
672
673
676 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub,
677 const struct GNUNET_CRYPTO_UnblindedSignature *ub_sig,
678 const void *message,
679 size_t message_size)
680{
681 if (bsign_pub->cipher != ub_sig->cipher)
682 {
683 GNUNET_break (0);
684 return GNUNET_SYSERR;
685 }
686 switch (bsign_pub->cipher)
687 {
689 GNUNET_break (0);
690 return GNUNET_NO;
692 if (GNUNET_OK !=
694 message_size,
695 ub_sig->details.rsa_signature,
696 bsign_pub->details.rsa_public_key))
697 {
698 GNUNET_break_op (0);
699 return GNUNET_NO;
700 }
701 return GNUNET_YES;
703 if (GNUNET_OK !=
705 &bsign_pub->details.cs_public_key,
706 message,
707 message_size))
708 {
709 GNUNET_break_op (0);
710 return GNUNET_NO;
711 }
712 return GNUNET_YES;
713 }
714 GNUNET_break (0);
715 return GNUNET_NO;
716}
717
718
719/* end of crypto_blind_sign.c */
static int ret
Final status code.
Definition gnunet-arm.c:93
static struct GNUNET_CRYPTO_EddsaPublicKey pub
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calculations.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition crypto_hash.c:40
struct GNUNET_CRYPTO_BlindSignPrivateKey * GNUNET_CRYPTO_bsign_priv_incref(struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv)
Increment reference counter of the given bsign_priv.
void GNUNET_CRYPTO_blinded_message_decref(struct GNUNET_CRYPTO_BlindedMessage *bm)
Decrement reference counter of a bm, and free it if it reaches zero.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_blind_sign_keys_create(struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher,...)
Initialize public-private key pair for blind signatures.
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_rsa_blind(const void *message, size_t message_size, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey, struct GNUNET_CRYPTO_RsaBlindedMessage *bm)
Blinds the given message with the given blinding key.
Definition crypto_rsa.c:807
struct GNUNET_CRYPTO_BlindedSignature * GNUNET_CRYPTO_blind_sig_incref(struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
Increment reference counter of the given blind_sig.
void GNUNET_CRYPTO_cs_r_get_public(const struct GNUNET_CRYPTO_CsRSecret *r_priv, struct GNUNET_CRYPTO_CsRPublic *r_pub)
Extract the public R of the given secret r.
Definition crypto_cs.c:97
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_create(unsigned int len)
Create a new private key.
Definition crypto_rsa.c:144
void GNUNET_CRYPTO_rsa_private_key_free(struct GNUNET_CRYPTO_RsaPrivateKey *key)
Free memory occupied by the private key.
Definition crypto_rsa.c:173
int GNUNET_CRYPTO_bsign_pub_cmp(const struct GNUNET_CRYPTO_BlindSignPublicKey *bp1, const struct GNUNET_CRYPTO_BlindSignPublicKey *bp2)
Compare two denomination public keys.
struct GNUNET_CRYPTO_UnblindedSignature * GNUNET_CRYPTO_blind_sig_unblind(const struct GNUNET_CRYPTO_BlindedSignature *blinded_sig, const union GNUNET_CRYPTO_BlindingSecretP *bks, const void *message, size_t message_size, const struct GNUNET_CRYPTO_BlindingInputValues *alg_values, const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub)
Unblind blind signature.
struct GNUNET_CRYPTO_BlindedSignature * GNUNET_CRYPTO_blind_sign(const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv, const char *salt, const struct GNUNET_CRYPTO_BlindedMessage *blinded_message)
Create blind signature.
void GNUNET_CRYPTO_cs_r_derive(const struct GNUNET_CRYPTO_CsSessionNonce *nonce, const char *seed, const struct GNUNET_CRYPTO_CsPrivateKey *lts, struct GNUNET_CRYPTO_CsRSecret r[2])
Derive a new secret r pair r0 and r1.
Definition crypto_cs.c:79
GNUNET_CRYPTO_BlindSignatureAlgorithm
Types of public keys used for blind signatures.
struct GNUNET_CRYPTO_UnblindedSignature * GNUNET_CRYPTO_ub_sig_incref(struct GNUNET_CRYPTO_UnblindedSignature *ub_sig)
Increment reference counter of the given ub_sig.
int GNUNET_CRYPTO_ub_sig_cmp(const struct GNUNET_CRYPTO_UnblindedSignature *sig1, const struct GNUNET_CRYPTO_UnblindedSignature *sig2)
Compare two denomination signatures.
struct GNUNET_CRYPTO_BlindedMessage * GNUNET_CRYPTO_message_blind_to_sign(const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub, const union GNUNET_CRYPTO_BlindingSecretP *bks, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const void *message, size_t message_size, const struct GNUNET_CRYPTO_BlindingInputValues *alg_values)
Blind message for blind signing with dk using blinding secret coin_bks.
int GNUNET_CRYPTO_blinded_message_cmp(const struct GNUNET_CRYPTO_BlindedMessage *bp1, const struct GNUNET_CRYPTO_BlindedMessage *bp2)
Compare two blinded messages.
int GNUNET_CRYPTO_rsa_signature_cmp(const struct GNUNET_CRYPTO_RsaSignature *s1, const struct GNUNET_CRYPTO_RsaSignature *s2)
Compare the values of two signatures.
Definition crypto_rsa.c:602
int GNUNET_CRYPTO_blind_sig_cmp(const struct GNUNET_CRYPTO_BlindedSignature *sig1, const struct GNUNET_CRYPTO_BlindedSignature *sig2)
Compare two blinded denomination signatures.
void GNUNET_CRYPTO_cs_private_key_get_public(const struct GNUNET_CRYPTO_CsPrivateKey *priv, struct GNUNET_CRYPTO_CsPublicKey *pub)
Extract the public key of the given private key.
Definition crypto_cs.c:52
void GNUNET_CRYPTO_cs_unblind(const struct GNUNET_CRYPTO_CsBlindS *blinded_signature_scalar, const struct GNUNET_CRYPTO_CsBlindingSecret *bs, struct GNUNET_CRYPTO_CsS *signature_scalar)
Unblind a blind-signed signature using a c that was blinded.
Definition crypto_cs.c:313
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_blind_sign_keys_create_va(struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, va_list ap)
Initialize public-private key pair for blind signatures.
void GNUNET_CRYPTO_rsa_public_key_hash(const struct GNUNET_CRYPTO_RsaPublicKey *key, struct GNUNET_HashCode *hc)
Compute hash over the public key.
Definition crypto_rsa.c:407
void GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key)
Free memory occupied by the public key.
Definition crypto_rsa.c:268
void GNUNET_CRYPTO_cs_calc_blinded_c(const struct GNUNET_CRYPTO_CsBlindingSecret bs[2], const struct GNUNET_CRYPTO_CsRPublic r_pub[2], const struct GNUNET_CRYPTO_CsPublicKey *pub, const void *msg, size_t msg_len, struct GNUNET_CRYPTO_CsC blinded_c[2], struct GNUNET_CRYPTO_CSPublicRPairP *r_pub_blind)
Calculate two blinded c's.
Definition crypto_cs.c:237
void GNUNET_CRYPTO_blinding_input_values_decref(struct GNUNET_CRYPTO_BlindingInputValues *bm)
Decrement reference counter of the given bi, and free it if it reaches zero.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_blind_sig_verify(const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub, const struct GNUNET_CRYPTO_UnblindedSignature *ub_sig, const void *message, size_t message_size)
Verify signature made blindly.
struct GNUNET_CRYPTO_BlindingInputValues * GNUNET_CRYPTO_blinding_input_values_incref(struct GNUNET_CRYPTO_BlindingInputValues *bm)
Increment reference counter of the given bi.
void GNUNET_CRYPTO_unblinded_sig_decref(struct GNUNET_CRYPTO_UnblindedSignature *ub_sig)
Decrement reference counter of a ub_sig, and free it if it reaches zero.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_sign_blinded(const struct GNUNET_CRYPTO_RsaPrivateKey *key, const struct GNUNET_CRYPTO_RsaBlindedMessage *bm)
Sign a blinded value, which must be a full domain hash of a message.
Definition crypto_rsa.c:970
struct GNUNET_CRYPTO_BlindedMessage * GNUNET_CRYPTO_blinded_message_incref(struct GNUNET_CRYPTO_BlindedMessage *bm)
Increment reference counter of the given bm.
void GNUNET_CRYPTO_blinded_sig_decref(struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
Decrement reference counter of a blind_sig, and free it if it reaches zero.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_cs_verify(const struct GNUNET_CRYPTO_CsSignature *sig, const struct GNUNET_CRYPTO_CsPublicKey *pub, const void *msg, size_t msg_len)
Verify whether the given message corresponds to the given signature and the signature is valid with r...
Definition crypto_cs.c:325
GNUNET_GenericReturnValue
Named constants for return values.
struct GNUNET_CRYPTO_BlindSignPublicKey * GNUNET_CRYPTO_bsign_pub_incref(struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub)
Increment reference counter of the given bsign_pub.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_unblind(const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey)
Unblind a blind-signed signature.
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_private_key_get_public(const struct GNUNET_CRYPTO_RsaPrivateKey *priv)
Extract the public key of the given private key.
Definition crypto_rsa.c:233
void GNUNET_CRYPTO_blind_sign_pub_decref(struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub)
Decrement reference counter of a bsign_pub, and free it if it reaches zero.
void GNUNET_CRYPTO_cs_sign_derive(const struct GNUNET_CRYPTO_CsPrivateKey *priv, const struct GNUNET_CRYPTO_CsRSecret r[2], const struct GNUNET_CRYPTO_CsBlindedMessage *bm, struct GNUNET_CRYPTO_CsBlindSignature *cs_blind_sig)
Sign a blinded c.
Definition crypto_cs.c:281
void GNUNET_CRYPTO_cs_private_key_generate(struct GNUNET_CRYPTO_CsPrivateKey *priv)
Create a new random private key.
Definition crypto_cs.c:45
void GNUNET_CRYPTO_blind_sign_priv_decref(struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv)
Decrement reference counter of a bsign_priv, and free it if it reaches zero.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_rsa_verify(const void *message, size_t message_size, const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaPublicKey *public_key)
Verify whether the given hash corresponds to the given signature and the signature is valid with resp...
struct GNUNET_CRYPTO_BlindingInputValues * GNUNET_CRYPTO_get_blinding_input_values(const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const char *salt)
Compute blinding input values for a given nonce and salt.
void GNUNET_CRYPTO_cs_blinding_secrets_derive(const struct GNUNET_CRYPTO_CsBlindingNonce *blind_seed, struct GNUNET_CRYPTO_CsBlindingSecret bs[2])
Derives new random blinding factors.
Definition crypto_cs.c:107
@ GNUNET_CRYPTO_BSA_INVALID
Invalid type of signature.
@ GNUNET_CRYPTO_BSA_CS
Clause Blind Schnorr signature.
@ GNUNET_CRYPTO_BSA_RSA
RSA blind signature.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
Type of private signing keys for blind signing.
struct GNUNET_CRYPTO_CsPrivateKey cs_private_key
If we use GNUNET_CRYPTO_BSA_CS in cipher.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_RsaPrivateKey * rsa_private_key
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the public key.
union GNUNET_CRYPTO_BlindSignPrivateKey::@21 details
Details, depending on cipher.
Type of public signing keys for blind signatures.
union GNUNET_CRYPTO_BlindSignPublicKey::@20 details
Details, depending on cipher.
unsigned int rc
Reference counter.
struct GNUNET_HashCode pub_key_hash
Hash of the public key.
struct GNUNET_CRYPTO_CsPublicKey cs_public_key
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the public key.
struct GNUNET_CRYPTO_RsaPublicKey * rsa_public_key
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
Blinded message ready for blind signing.
unsigned int rc
Reference counter.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the sign blinded message.
struct GNUNET_CRYPTO_CsBlindedMessage cs_blinded_message
If we use GNUNET_CRYPTO_BSA_CS in cipher.
union GNUNET_CRYPTO_BlindedMessage::@22 details
Details, depending on cipher.
struct GNUNET_CRYPTO_RsaBlindedMessage rsa_blinded_message
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
Type for blinded signatures.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_CsBlindSignature blinded_cs_answer
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
struct GNUNET_CRYPTO_RsaSignature * blinded_rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
union GNUNET_CRYPTO_BlindedSignature::@19 details
Details, depending on cipher.
Input needed for blinding a message.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_CSPublicRPairP cs_values
If we use GNUNET_CRYPTO_BSA_CS in cipher.
union GNUNET_CRYPTO_BlindingInputValues::@23 details
Details, depending on cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
Pair of Public R values for Cs denominations.
struct GNUNET_CRYPTO_CsRPublic r_pub[2]
struct GNUNET_CRYPTO_CsBlindS s_scalar
The blinded s scalar calculated from c_b.
unsigned int b
To make ROS problem harder, the signer chooses an unpredictable b and only calculates signature of c_...
struct GNUNET_CRYPTO_CsC c[2]
The Clause Schnorr c_0 and c_1 containing the blinded message.
struct GNUNET_CRYPTO_CsSessionNonce nonce
Nonce used in initial request.
Secret used for blinding (alpha and beta).
Schnorr c to be signed.
the private r used in the signature
struct GNUNET_CRYPTO_CsS s_scalar
Schnorr signatures are composed of a scalar s and a curve point.
struct GNUNET_CRYPTO_CsRPublic r_point
Curve point of the Schnorr signature.
size_t blinded_msg_size
Size of the blinded_msg to be signed.
void * blinded_msg
Blinded message to be signed Note: is malloc()'ed!
Type of (unblinded) signatures.
union GNUNET_CRYPTO_UnblindedSignature::@18 details
Details, depending on cipher.
struct GNUNET_CRYPTO_RsaSignature * rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_CsSignature cs_signature
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
Nonce used to deterministiacally derive input values used in multi-round blind signature protocols.
struct GNUNET_CRYPTO_CsSessionNonce cs_nonce
Nonce used when signing with CS.
Type of blinding secrets.
struct GNUNET_CRYPTO_CsBlindingNonce nonce
Clause Schnorr nonce.
struct GNUNET_CRYPTO_RsaBlindingKeySecret rsa_bks
Variant for RSA for blind signatures.