diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-10-20 23:13:09 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-10-27 20:08:35 +0200 |
commit | 7278ae87e0d5de5fa31e076581a69d62f3d1fe65 (patch) | |
tree | 6072e2909226acca4dc32d1557c0e66f97e8201c | |
parent | d2e4ba93f679d4845c4bca883e53eae053c99e38 (diff) | |
download | gnunet-7278ae87e0d5de5fa31e076581a69d62f3d1fe65.tar.gz gnunet-7278ae87e0d5de5fa31e076581a69d62f3d1fe65.zip |
more work on new blind signature API and implementation
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 56 | ||||
-rw-r--r-- | src/lib/util/Makefile.am | 8 | ||||
-rw-r--r-- | src/lib/util/crypto_blind_sign.c | 69 | ||||
-rw-r--r-- | src/lib/util/crypto_cs.c | 11 | ||||
-rw-r--r-- | src/lib/util/test_crypto_blind.c | 93 |
5 files changed, 216 insertions, 21 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 11bd680e7..31472f7a1 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -3557,6 +3557,27 @@ GNUNET_CRYPTO_blinded_sig_decref ( | |||
3557 | 3557 | ||
3558 | 3558 | ||
3559 | /** | 3559 | /** |
3560 | * Decrement reference counter of a @a bm, and free it if it reaches zero. | ||
3561 | * | ||
3562 | * @param[in] bm blinded message to free | ||
3563 | */ | ||
3564 | void | ||
3565 | GNUNET_CRYPTO_blinded_message_decref ( | ||
3566 | struct GNUNET_CRYPTO_BlindedMessage *bm); | ||
3567 | |||
3568 | |||
3569 | /** | ||
3570 | * Increment reference counter of the given @a bm. | ||
3571 | * | ||
3572 | * @param[in,out] bm blinded message to increment reference counter for | ||
3573 | * @return alias of @a bm with RC incremented | ||
3574 | */ | ||
3575 | struct GNUNET_CRYPTO_BlindedMessage * | ||
3576 | GNUNET_CRYPTO_blinded_message_incref ( | ||
3577 | struct GNUNET_CRYPTO_BlindedMessage *bm); | ||
3578 | |||
3579 | |||
3580 | /** | ||
3560 | * Increment reference counter of the given @a bsign_pub. | 3581 | * Increment reference counter of the given @a bsign_pub. |
3561 | * | 3582 | * |
3562 | * @param[in,out] bsign_pub public key to increment reference counter for | 3583 | * @param[in,out] bsign_pub public key to increment reference counter for |
@@ -3630,7 +3651,7 @@ GNUNET_CRYPTO_ub_sig_cmp (const struct GNUNET_CRYPTO_UnblindedSignature *sig1, | |||
3630 | * @return 0 if the keys are equal, otherwise -1 or 1 | 3651 | * @return 0 if the keys are equal, otherwise -1 or 1 |
3631 | */ | 3652 | */ |
3632 | int | 3653 | int |
3633 | GNUNET_blind_sig_cmp ( | 3654 | GNUNET_CRYPTO_blind_sig_cmp ( |
3634 | const struct GNUNET_CRYPTO_BlindedSignature *sig1, | 3655 | const struct GNUNET_CRYPTO_BlindedSignature *sig1, |
3635 | const struct GNUNET_CRYPTO_BlindedSignature *sig2); | 3656 | const struct GNUNET_CRYPTO_BlindedSignature *sig2); |
3636 | 3657 | ||
@@ -3655,27 +3676,48 @@ GNUNET_CRYPTO_blinded_message_cmp ( | |||
3655 | * argument with the number of bits for 'n' (e.g. 2048) must | 3676 | * argument with the number of bits for 'n' (e.g. 2048) must |
3656 | * be passed. | 3677 | * be passed. |
3657 | * | 3678 | * |
3658 | * @param[out] denom_priv where to write the private key with RC 1 | 3679 | * @param[out] bsign_priv where to write the private key with RC 1 |
3659 | * @param[out] denom_pub where to write the public key with RC 1 | 3680 | * @param[out] bsign_pub where to write the public key with RC 1 |
3660 | * @param cipher which type of cipher to use | 3681 | * @param cipher which type of cipher to use |
3661 | * @param ... RSA key size (eg. 2048/3072/4096) | 3682 | * @param ... RSA key size (eg. 2048/3072/4096) |
3662 | * @return #GNUNET_OK on success, #GNUNET_NO if parameters were invalid | 3683 | * @return #GNUNET_OK on success, #GNUNET_NO if parameterst were invalid |
3663 | */ | 3684 | */ |
3664 | enum GNUNET_GenericReturnValue | 3685 | enum GNUNET_GenericReturnValue |
3665 | GNUNET_CRYPTO_blind_sign_keys_create ( | 3686 | GNUNET_CRYPTO_blind_sign_keys_create ( |
3666 | struct GNUNET_CRYPTO_BlindSignPrivateKey **denom_priv, | 3687 | struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, |
3667 | struct GNUNET_CRYPTO_BlindSignPublicKey **denom_pub, | 3688 | struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, |
3668 | enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, | 3689 | enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, |
3669 | ...); | 3690 | ...); |
3670 | 3691 | ||
3671 | 3692 | ||
3672 | /** | 3693 | /** |
3694 | * Initialize public-private key pair for blind signatures. | ||
3695 | * | ||
3696 | * For #GNUNET_CRYPTO_BSA_RSA, an additional "unsigned int" | ||
3697 | * argument with the number of bits for 'n' (e.g. 2048) must | ||
3698 | * be passed. | ||
3699 | * | ||
3700 | * @param[out] bsign_priv where to write the private key with RC 1 | ||
3701 | * @param[out] bsign_pub where to write the public key with RC 1 | ||
3702 | * @param cipher which type of cipher to use | ||
3703 | * @param ap RSA key size (eg. 2048/3072/4096) | ||
3704 | * @return #GNUNET_OK on success, #GNUNET_NO if parameterst were invalid | ||
3705 | */ | ||
3706 | enum GNUNET_GenericReturnValue | ||
3707 | GNUNET_CRYPTO_blind_sign_keys_create_va ( | ||
3708 | struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, | ||
3709 | struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, | ||
3710 | enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, | ||
3711 | va_list ap); | ||
3712 | |||
3713 | |||
3714 | /** | ||
3673 | * @brief Type of blinding secrets. Must be exactly 32 bytes (DB). | 3715 | * @brief Type of blinding secrets. Must be exactly 32 bytes (DB). |
3674 | */ | 3716 | */ |
3675 | union GNUNET_CRYPTO_BlindingSecretP | 3717 | union GNUNET_CRYPTO_BlindingSecretP |
3676 | { | 3718 | { |
3677 | /** | 3719 | /** |
3678 | * Clause Schnorr nonce. | 3720 | * Clause Schnorr nonce. |
3679 | */ | 3721 | */ |
3680 | struct GNUNET_CRYPTO_CsBlindingNonce nonce; | 3722 | struct GNUNET_CRYPTO_CsBlindingNonce nonce; |
3681 | 3723 | ||
diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am index 097dec82a..7ab6301f5 100644 --- a/src/lib/util/Makefile.am +++ b/src/lib/util/Makefile.am | |||
@@ -198,7 +198,7 @@ check_PROGRAMS = \ | |||
198 | test_container_multihashmap32 \ | 198 | test_container_multihashmap32 \ |
199 | test_container_multipeermap \ | 199 | test_container_multipeermap \ |
200 | test_container_heap \ | 200 | test_container_heap \ |
201 | test_crypto_symmetric \ | 201 | test_crypto_blind \ |
202 | test_crypto_crc \ | 202 | test_crypto_crc \ |
203 | test_crypto_cs \ | 203 | test_crypto_cs \ |
204 | test_crypto_ecdsa \ | 204 | test_crypto_ecdsa \ |
@@ -215,6 +215,7 @@ check_PROGRAMS = \ | |||
215 | test_crypto_paillier \ | 215 | test_crypto_paillier \ |
216 | test_crypto_random \ | 216 | test_crypto_random \ |
217 | test_crypto_rsa \ | 217 | test_crypto_rsa \ |
218 | test_crypto_symmetric \ | ||
218 | test_disk \ | 219 | test_disk \ |
219 | test_getopt \ | 220 | test_getopt \ |
220 | test_hexcoder \ | 221 | test_hexcoder \ |
@@ -347,6 +348,11 @@ test_container_heap_SOURCES = \ | |||
347 | test_container_heap_LDADD = \ | 348 | test_container_heap_LDADD = \ |
348 | libgnunetutil.la | 349 | libgnunetutil.la |
349 | 350 | ||
351 | test_crypto_blind_SOURCES = \ | ||
352 | test_crypto_blind.c | ||
353 | test_crypto_blind_LDADD = \ | ||
354 | libgnunetutil.la | ||
355 | |||
350 | test_crypto_symmetric_SOURCES = \ | 356 | test_crypto_symmetric_SOURCES = \ |
351 | test_crypto_symmetric.c | 357 | test_crypto_symmetric.c |
352 | test_crypto_symmetric_LDADD = \ | 358 | test_crypto_symmetric_LDADD = \ |
diff --git a/src/lib/util/crypto_blind_sign.c b/src/lib/util/crypto_blind_sign.c index 6121ef9a0..bf6fbc119 100644 --- a/src/lib/util/crypto_blind_sign.c +++ b/src/lib/util/crypto_blind_sign.c | |||
@@ -135,6 +135,38 @@ GNUNET_CRYPTO_blinded_sig_decref ( | |||
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | void | ||
139 | GNUNET_CRYPTO_blinded_message_decref ( | ||
140 | struct GNUNET_CRYPTO_BlindedMessage *bm) | ||
141 | { | ||
142 | GNUNET_assert (bm->rc > 0); | ||
143 | bm->rc--; | ||
144 | if (0 != bm->rc) | ||
145 | return; | ||
146 | switch (bm->cipher) | ||
147 | { | ||
148 | case GNUNET_CRYPTO_BSA_INVALID: | ||
149 | GNUNET_break (0); | ||
150 | break; | ||
151 | case GNUNET_CRYPTO_BSA_RSA: | ||
152 | GNUNET_free (bm->details.rsa_blinded_message.blinded_msg); | ||
153 | break; | ||
154 | case GNUNET_CRYPTO_BSA_CS: | ||
155 | break; | ||
156 | } | ||
157 | GNUNET_free (bm); | ||
158 | } | ||
159 | |||
160 | |||
161 | struct GNUNET_CRYPTO_BlindedMessage * | ||
162 | GNUNET_CRYPTO_blinded_message_incref ( | ||
163 | struct GNUNET_CRYPTO_BlindedMessage *bm) | ||
164 | { | ||
165 | bm->rc++; | ||
166 | return bm; | ||
167 | } | ||
168 | |||
169 | |||
138 | struct GNUNET_CRYPTO_BlindSignPublicKey * | 170 | struct GNUNET_CRYPTO_BlindSignPublicKey * |
139 | GNUNET_CRYPTO_bsign_pub_incref (struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub) | 171 | GNUNET_CRYPTO_bsign_pub_incref (struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub) |
140 | { | 172 | { |
@@ -217,7 +249,7 @@ GNUNET_CRYPTO_ub_sig_cmp ( | |||
217 | 249 | ||
218 | 250 | ||
219 | int | 251 | int |
220 | GNUNET_blind_sig_cmp ( | 252 | GNUNET_CRYPTO_blind_sig_cmp ( |
221 | const struct GNUNET_CRYPTO_BlindedSignature *sig1, | 253 | const struct GNUNET_CRYPTO_BlindedSignature *sig1, |
222 | const struct GNUNET_CRYPTO_BlindedSignature *sig2) | 254 | const struct GNUNET_CRYPTO_BlindedSignature *sig2) |
223 | { | 255 | { |
@@ -271,20 +303,43 @@ GNUNET_CRYPTO_blinded_message_cmp ( | |||
271 | 303 | ||
272 | enum GNUNET_GenericReturnValue | 304 | enum GNUNET_GenericReturnValue |
273 | GNUNET_CRYPTO_blind_sign_keys_create ( | 305 | GNUNET_CRYPTO_blind_sign_keys_create ( |
274 | struct GNUNET_CRYPTO_BlindSignPrivateKey **denom_priv, | 306 | struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, |
275 | struct GNUNET_CRYPTO_BlindSignPublicKey **denom_pub, | 307 | struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, |
276 | enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, | 308 | enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, |
277 | ...) | 309 | ...) |
278 | { | 310 | { |
311 | enum GNUNET_GenericReturnValue ret; | ||
312 | va_list ap; | ||
313 | |||
314 | va_start (ap, | ||
315 | cipher); | ||
316 | ret = GNUNET_CRYPTO_blind_sign_keys_create_va (bsign_priv, | ||
317 | bsign_pub, | ||
318 | cipher, | ||
319 | ap); | ||
320 | va_end (ap); | ||
321 | return ret; | ||
322 | } | ||
323 | |||
324 | |||
325 | enum GNUNET_GenericReturnValue | ||
326 | GNUNET_CRYPTO_blind_sign_keys_create_va ( | ||
327 | struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, | ||
328 | struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, | ||
329 | enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, | ||
330 | va_list ap) | ||
331 | { | ||
279 | struct GNUNET_CRYPTO_BlindSignPrivateKey *priv; | 332 | struct GNUNET_CRYPTO_BlindSignPrivateKey *priv; |
280 | struct GNUNET_CRYPTO_BlindSignPublicKey *pub; | 333 | struct GNUNET_CRYPTO_BlindSignPublicKey *pub; |
281 | 334 | ||
282 | priv = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPrivateKey); | 335 | priv = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPrivateKey); |
283 | priv->rc = 1; | 336 | priv->rc = 1; |
284 | priv->cipher = cipher; | 337 | priv->cipher = cipher; |
338 | *bsign_priv = priv; | ||
285 | pub = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPublicKey); | 339 | pub = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPublicKey); |
286 | pub->rc = 1; | 340 | pub->rc = 1; |
287 | pub->cipher = cipher; | 341 | pub->cipher = cipher; |
342 | *bsign_pub = pub; | ||
288 | switch (cipher) | 343 | switch (cipher) |
289 | { | 344 | { |
290 | case GNUNET_CRYPTO_BSA_INVALID: | 345 | case GNUNET_CRYPTO_BSA_INVALID: |
@@ -292,14 +347,10 @@ GNUNET_CRYPTO_blind_sign_keys_create ( | |||
292 | break; | 347 | break; |
293 | case GNUNET_CRYPTO_BSA_RSA: | 348 | case GNUNET_CRYPTO_BSA_RSA: |
294 | { | 349 | { |
295 | va_list ap; | ||
296 | unsigned int bits; | 350 | unsigned int bits; |
297 | 351 | ||
298 | va_start (ap, | ||
299 | cipher); | ||
300 | bits = va_arg (ap, | 352 | bits = va_arg (ap, |
301 | unsigned int); | 353 | unsigned int); |
302 | va_end (ap); | ||
303 | if (bits < 512) | 354 | if (bits < 512) |
304 | { | 355 | { |
305 | GNUNET_break (0); | 356 | GNUNET_break (0); |
@@ -331,8 +382,8 @@ GNUNET_CRYPTO_blind_sign_keys_create ( | |||
331 | } | 382 | } |
332 | GNUNET_free (priv); | 383 | GNUNET_free (priv); |
333 | GNUNET_free (pub); | 384 | GNUNET_free (pub); |
334 | *denom_priv = NULL; | 385 | *bsign_priv = NULL; |
335 | *denom_pub = NULL; | 386 | *bsign_pub = NULL; |
336 | return GNUNET_SYSERR; | 387 | return GNUNET_SYSERR; |
337 | } | 388 | } |
338 | 389 | ||
diff --git a/src/lib/util/crypto_cs.c b/src/lib/util/crypto_cs.c index cf1c43c25..2ff7c70ce 100644 --- a/src/lib/util/crypto_cs.c +++ b/src/lib/util/crypto_cs.c | |||
@@ -53,8 +53,9 @@ GNUNET_CRYPTO_cs_private_key_get_public ( | |||
53 | const struct GNUNET_CRYPTO_CsPrivateKey *priv, | 53 | const struct GNUNET_CRYPTO_CsPrivateKey *priv, |
54 | struct GNUNET_CRYPTO_CsPublicKey *pub) | 54 | struct GNUNET_CRYPTO_CsPublicKey *pub) |
55 | { | 55 | { |
56 | GNUNET_assert (0 == crypto_scalarmult_ed25519_base_noclamp (pub->point.y, | 56 | GNUNET_assert (0 == |
57 | priv->scalar.d)); | 57 | crypto_scalarmult_ed25519_base_noclamp (pub->point.y, |
58 | priv->scalar.d)); | ||
58 | } | 59 | } |
59 | 60 | ||
60 | 61 | ||
@@ -209,7 +210,8 @@ calc_r_dash (const struct GNUNET_CRYPTO_CsBlindingSecret *bs, | |||
209 | { | 210 | { |
210 | // R'i = Ri + alpha i*G + beta i*pub | 211 | // R'i = Ri + alpha i*G + beta i*pub |
211 | struct GNUNET_CRYPTO_Cs25519Point alpha_mul_base; | 212 | struct GNUNET_CRYPTO_Cs25519Point alpha_mul_base; |
212 | GNUNET_assert (0 == crypto_scalarmult_ed25519_base_noclamp ( | 213 | GNUNET_assert (0 == |
214 | crypto_scalarmult_ed25519_base_noclamp ( | ||
213 | alpha_mul_base.y, | 215 | alpha_mul_base.y, |
214 | bs->alpha.d)); | 216 | bs->alpha.d)); |
215 | struct GNUNET_CRYPTO_Cs25519Point beta_mul_pub; | 217 | struct GNUNET_CRYPTO_Cs25519Point beta_mul_pub; |
@@ -323,7 +325,8 @@ GNUNET_CRYPTO_cs_verify (const struct GNUNET_CRYPTO_CsSignature *sig, | |||
323 | 325 | ||
324 | // s'G ?= R' + c' pub | 326 | // s'G ?= R' + c' pub |
325 | struct GNUNET_CRYPTO_Cs25519Point sig_scal_mul_base; | 327 | struct GNUNET_CRYPTO_Cs25519Point sig_scal_mul_base; |
326 | GNUNET_assert (0 == crypto_scalarmult_ed25519_base_noclamp ( | 328 | GNUNET_assert (0 == |
329 | crypto_scalarmult_ed25519_base_noclamp ( | ||
327 | sig_scal_mul_base.y, | 330 | sig_scal_mul_base.y, |
328 | sig->s_scalar.scalar.d)); | 331 | sig->s_scalar.scalar.d)); |
329 | struct GNUNET_CRYPTO_Cs25519Point c_dash_mul_pub; | 332 | struct GNUNET_CRYPTO_Cs25519Point c_dash_mul_pub; |
diff --git a/src/lib/util/test_crypto_blind.c b/src/lib/util/test_crypto_blind.c new file mode 100644 index 000000000..726516bc2 --- /dev/null +++ b/src/lib/util/test_crypto_blind.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2014, 2015, 2023 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file util/test_crypto_blind.c | ||
23 | * @brief testcase for utility functions for blind signatures | ||
24 | * @author Christian Grothoff <grothoff@gnunet.org> | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include <gcrypt.h> | ||
28 | #include "gnunet_util_lib.h" | ||
29 | |||
30 | |||
31 | int | ||
32 | main (int argc, | ||
33 | char *argv[]) | ||
34 | { | ||
35 | struct GNUNET_CRYPTO_BlindSignPrivateKey *priv; | ||
36 | struct GNUNET_CRYPTO_BlindSignPublicKey *pub; | ||
37 | struct GNUNET_CRYPTO_BlindingInputValues biv; | ||
38 | struct GNUNET_CRYPTO_BlindedMessage *bm; | ||
39 | struct GNUNET_CRYPTO_BlindedSignature *bsig; | ||
40 | struct GNUNET_CRYPTO_UnblindedSignature *sig; | ||
41 | union GNUNET_CRYPTO_BlindingSecretP bsec; | ||
42 | struct GNUNET_CRYPTO_CsSessionNonce nonce; | ||
43 | struct GNUNET_CRYPTO_CsRSecret cspriv[2]; | ||
44 | |||
45 | GNUNET_log_setup ("test-crypto-blind", | ||
46 | "WARNING", | ||
47 | NULL); | ||
48 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, | ||
49 | &bsec, | ||
50 | sizeof (bsec)); | ||
51 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, | ||
52 | &nonce, | ||
53 | sizeof (nonce)); | ||
54 | GNUNET_assert (GNUNET_OK == | ||
55 | GNUNET_CRYPTO_blind_sign_keys_create (&priv, | ||
56 | &pub, | ||
57 | GNUNET_CRYPTO_BSA_CS)); | ||
58 | biv.cipher = GNUNET_CRYPTO_BSA_CS; | ||
59 | GNUNET_CRYPTO_cs_r_derive (&nonce, | ||
60 | "salt", | ||
61 | &priv->details.cs_private_key, | ||
62 | cspriv); | ||
63 | GNUNET_CRYPTO_cs_r_get_public (&cspriv[0], | ||
64 | &biv.details.cs_values.r_pub[0]); | ||
65 | GNUNET_CRYPTO_cs_r_get_public (&cspriv[1], | ||
66 | &biv.details.cs_values.r_pub[1]); | ||
67 | bm = GNUNET_CRYPTO_message_blind_to_sign (pub, | ||
68 | &bsec, | ||
69 | "hello", | ||
70 | 5, | ||
71 | &biv); | ||
72 | bm->details.cs_blinded_message.nonce = nonce; // FIXME: ugly! | ||
73 | bsig = GNUNET_CRYPTO_blind_sign (priv, | ||
74 | "salt", | ||
75 | bm); | ||
76 | sig = GNUNET_CRYPTO_blind_sig_unblind (bsig, | ||
77 | &bsec, | ||
78 | "hello", | ||
79 | 5, | ||
80 | &biv, | ||
81 | pub); | ||
82 | GNUNET_assert (GNUNET_OK == | ||
83 | GNUNET_CRYPTO_blind_sig_verify (pub, | ||
84 | sig, | ||
85 | "hello", | ||
86 | 5)); | ||
87 | GNUNET_CRYPTO_blinded_sig_decref (bsig); | ||
88 | GNUNET_CRYPTO_unblinded_sig_decref (sig); | ||
89 | GNUNET_CRYPTO_blinded_message_decref (bm); | ||
90 | GNUNET_CRYPTO_blind_sign_priv_decref (priv); | ||
91 | GNUNET_CRYPTO_blind_sign_pub_decref (pub); | ||
92 | return 0; | ||
93 | } | ||