GNUnet 0.21.0
gnunet_crypto_lib.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001-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
47#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
48#error "Only <gnunet_util_lib.h> can be included directly."
49#endif
50
51#ifndef GNUNET_CRYPTO_LIB_H
52#define GNUNET_CRYPTO_LIB_H
53
54#ifdef __cplusplus
55extern "C" {
56#if 0 /* keep Emacsens' auto-indent happy */
57}
58#endif
59#endif
60
61
62#include <stdbool.h>
63#include <sodium.h>
64
69
70#include <gcrypt.h>
71
72
77#define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126
78
79
85{
92
98
105
106
110#define GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8)
111
115#define GNUNET_CRYPTO_HASH_LENGTH (512 / 8)
116
121#define GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52
122
127{
128 unsigned char encoding[104];
129};
130
131
133
134
141{
148
156};
157
158
164{
168 unsigned char r[256 / 8];
169
173 unsigned char s[256 / 8];
174};
175
176
181{
185 unsigned char r[256 / 8];
186
190 unsigned char s[256 / 8];
191};
192
193
201{
207 unsigned char q_y[256 / 8];
208};
209
210
216{
221 unsigned char q_y[256 / 8];
222};
223
224
229{
231};
232
233
240{
245 unsigned char q_y[256 / 8];
246};
247
248
254{
258 unsigned char d[256 / 8];
259};
260
266{
270 unsigned char d[256 / 8];
271};
272
278{
282 unsigned char d[256 / 8];
283};
284
285
291{
295 unsigned char s[512 / 8];
296};
297
304{
309 unsigned char a[256 / 8];
310
315 unsigned char b[256 / 8];
316};
317
318
326{
332 unsigned char q_y[256 / 8];
333};
334
339{
343 unsigned char r[256 / 8];
344
348 unsigned char s[256 / 8];
349};
350
355{
361
368
375{
381 uint32_t type;
382
383 union
384 {
389
394 };
395};
396
397
402{
408 uint32_t type;
409
410 union
411 {
416
421 };
422};
423
424
429{
435 uint32_t type;
436
437 union
438 {
443
448 };
449};
450
455{
460
465};
466
471{
476};
477
479
487{
489
491};
492
493
498{
500};
501
502
507#define GNUNET_CRYPTO_PAILLIER_BITS 2048
508
509
514{
518 unsigned char n[GNUNET_CRYPTO_PAILLIER_BITS / 8];
519};
520
521
526{
534 unsigned char mu[GNUNET_CRYPTO_PAILLIER_BITS / 8];
535};
536
537
542{
548
552 unsigned char bits[GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8];
553};
554
555
560{
564 unsigned char d[crypto_core_ed25519_SCALARBYTES];
565};
566
567
572{
577 unsigned char y[crypto_core_ed25519_BYTES];
578};
579
580
585{
587};
588
589
594{
596};
597
598
603{
606};
607
608
613{
615};
616
617
622{
624};
625
626
631{
633};
634
635
640{
642};
643
644
649{
651};
652
653
658{
663
668};
669
670
676{
677 /*a nonce*/
678 unsigned char snonce[256 / 8];
679};
680
681
687{
688 /*a nonce*/
689 unsigned char bnonce[256 / 8];
690};
691
692
693/* **************** Functions and Macros ************* */
694
702void
703GNUNET_CRYPTO_seed_weak_random (int32_t seed);
704
705
714uint8_t
715GNUNET_CRYPTO_crc8_n (const void *buf, size_t len);
716
717
726uint32_t
727GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len);
728
729
736uint16_t
738
739
748uint16_t
749GNUNET_CRYPTO_crc16_n (const void *buf, size_t len);
750
751
761int32_t
762GNUNET_CRYPTO_crc32_n (const void *buf, size_t len);
763
772void
773GNUNET_CRYPTO_zero_keys (void *buffer, size_t length);
774
775
784void
786 void *buffer,
787 size_t length);
788
789
800void
802 struct GNUNET_Uuid *uuid);
803
804
813uint32_t
815
816
825uint64_t
827
828
838unsigned int *
840
841
848void
851
852
864ssize_t
866 const void *block,
867 size_t size,
868 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
870 void *result);
871
872
884ssize_t
886 const void *block,
887 size_t size,
888 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
890 void *result);
891
892
902void
905 const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
906 const void *salt,
907 size_t salt_len,
908 ...);
909
910
919void
922 const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
923 const void *salt,
924 size_t salt_len,
925 va_list argp);
926
927
935void
936GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block,
938
939
951 size_t enclen,
952 struct GNUNET_HashCode *result);
953
954
963#define GNUNET_CRYPTO_hash_from_string(enc, result) \
964 GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result)
965
966
979uint32_t
981 const struct GNUNET_HashCode *b);
982
983
992void
993GNUNET_CRYPTO_hash (const void *block,
994 size_t size,
995 struct GNUNET_HashCode *ret);
996
997
1002{
1003 char salt[crypto_pwhash_argon2id_SALTBYTES];
1004};
1005
1006
1015void
1017 const void *buf,
1018 size_t buf_len,
1019 struct GNUNET_HashCode *result);
1020
1021
1025struct GNUNET_HashContext;
1026
1027
1033struct GNUNET_HashContext *
1035
1036
1043struct GNUNET_HashContext *
1045
1046
1054void
1056 const void *buf,
1057 size_t size);
1058
1059
1066void
1068 struct GNUNET_HashCode *r_hash);
1069
1070
1076void
1078
1079
1091void
1092GNUNET_CRYPTO_hmac_raw (const void *key,
1093 size_t key_len,
1094 const void *plaintext,
1095 size_t plaintext_len,
1096 struct GNUNET_HashCode *hmac);
1097
1098
1108void
1110 const void *plaintext,
1111 size_t plaintext_len,
1112 struct GNUNET_HashCode *hmac);
1113
1114
1122typedef void
1124 void *cls,
1125 const struct GNUNET_HashCode *res);
1126
1127
1132
1133
1147 const char *filename,
1148 size_t blocksize,
1150 void *callback_cls);
1151
1152
1158void
1160
1161
1169void
1171 struct GNUNET_HashCode *result);
1172
1173
1182void
1184 const struct GNUNET_HashCode *b,
1185 struct GNUNET_HashCode *result);
1186
1187
1196void
1198 const struct GNUNET_HashCode *delta,
1199 struct GNUNET_HashCode *result);
1200
1201
1210void
1212 const struct GNUNET_HashCode *b,
1213 struct GNUNET_HashCode *result);
1214
1215
1222unsigned int
1224
1225
1232unsigned int
1234
1235
1244void
1246 const struct GNUNET_HashCode *hc,
1249
1250
1260int
1261GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1,
1262 const struct GNUNET_HashCode *h2);
1263
1264
1275int
1277 const struct GNUNET_HashCode *h2,
1278 const struct GNUNET_HashCode *target);
1279
1280
1290void
1292 struct GNUNET_CRYPTO_AuthKey *key,
1293 const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
1294 const void *salt,
1295 size_t salt_len,
1296 va_list argp);
1297
1298
1308void
1310 struct GNUNET_CRYPTO_AuthKey *key,
1311 const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
1312 const void *salt,
1313 size_t salt_len,
1314 ...);
1315
1316
1333 size_t out_len,
1334 int xtr_algo,
1335 int prf_algo,
1336 const void *xts,
1337 size_t xts_len,
1338 const void *skm,
1339 size_t skm_len,
1340 ...);
1341
1342
1359 size_t out_len,
1360 int xtr_algo,
1361 int prf_algo,
1362 const void *xts,
1363 size_t xts_len,
1364 const void *skm,
1365 size_t skm_len,
1366 va_list argp);
1367
1368
1382 size_t out_len,
1383 const void *xts,
1384 size_t xts_len,
1385 const void *skm,
1386 size_t skm_len,
1387 va_list argp);
1388
1389
1402void
1403GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
1404 gcry_mpi_t n,
1405 const void *xts,
1406 size_t xts_len,
1407 const void *skm,
1408 size_t skm_len,
1409 const char *ctx);
1410
1411
1426 size_t out_len,
1427 const void *xts,
1428 size_t xts_len,
1429 const void *skm,
1430 size_t skm_len,
1431 ...);
1432
1433
1441void
1443 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1445
1453void
1455 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1457
1465void
1467 const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv,
1469
1477void
1479 const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1481
1482
1489char *
1491 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1492
1499char *
1501 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv);
1502
1503
1510char *
1512 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1513
1514
1521char *
1523 const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1524
1525
1536 const char *enc,
1537 size_t enclen,
1539
1540
1551 const char *enc,
1552 size_t enclen,
1553 struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1554
1555
1566 const char *enc,
1567 size_t enclen,
1569
1570
1588 int do_create,
1590
1591
1609 int do_create,
1611
1612
1617
1618
1630 const struct GNUNET_CONFIGURATION_Handle *cfg);
1631
1632
1639void
1641
1642
1649void
1651
1652
1659void
1661
1671void
1673 const void *seed,
1674 size_t seedsize,
1676
1683void
1685
1686
1693void
1695
1696
1703void
1705
1712void
1714
1721void
1723
1724
1731const struct GNUNET_CRYPTO_EcdsaPrivateKey *
1733
1734
1744void
1746
1747
1759 struct GNUNET_PeerIdentity *dst);
1760
1761
1775 const struct
1777 struct GNUNET_CRYPTO_EddsaSignature *sig);
1778
1779
1791GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose,
1792 const struct
1794 const struct
1796 const struct GNUNET_PeerIdentity *identity);
1797
1798
1803
1804
1810{
1815 unsigned char v[256 / 8];
1816};
1817
1822{
1823 unsigned char v[256 / 8];
1824};
1825
1835 unsigned int mem);
1836
1837
1846int
1848 const struct GNUNET_CRYPTO_EccPoint *input);
1849
1850
1862void
1863GNUNET_CRYPTO_ecc_dexp (int val,
1864 struct GNUNET_CRYPTO_EccPoint*r);
1865
1866
1877 struct GNUNET_CRYPTO_EccPoint *r);
1878
1879
1890 const struct GNUNET_CRYPTO_EccScalar *val,
1891 struct GNUNET_CRYPTO_EccPoint *r);
1892
1893
1904 const struct GNUNET_CRYPTO_EccPoint *b,
1905 struct GNUNET_CRYPTO_EccPoint *r);
1906
1907
1918 struct GNUNET_CRYPTO_EccPoint *r_inv);
1919
1920
1928void
1930 struct GNUNET_CRYPTO_EccScalar *r_neg);
1931
1932
1938void
1940
1941
1947void
1949
1950
1957void
1959 struct GNUNET_CRYPTO_EccScalar *r);
1960
1961
1973 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1974 struct GNUNET_HashCode *key_material);
1975
1976
1989 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1990 struct GNUNET_HashCode *key_material);
1991
2005 const struct GNUNET_CRYPTO_EcdhePublicKey *c,
2006 struct GNUNET_HashCode *key_material);
2007
2021 struct GNUNET_HashCode *key_material);
2022
2027{
2028 /* The output of the FO-OWTF F(x) */
2030
2031 /* The ephemeral public key from the DH in the KEM */
2033};
2034
2049 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2050 struct GNUNET_CRYPTO_FoKemC *c,
2051 struct GNUNET_HashCode *key_material);
2052
2053
2069 const struct GNUNET_CRYPTO_FoKemC *c,
2070 struct GNUNET_HashCode *key_material);
2071
2087 struct GNUNET_CRYPTO_FoKemC *c,
2088 struct GNUNET_HashCode *key_material);
2089
2090
2106 struct GNUNET_CRYPTO_FoKemC *c,
2107 struct GNUNET_HashCode *key_material);
2108
2121 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2122 struct GNUNET_HashCode *key_material);
2123
2124
2137 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2138 struct GNUNET_HashCode *key_material);
2139
2140
2153 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
2154 struct GNUNET_HashCode *key_material);
2155
2156
2174 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2175 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2176 struct GNUNET_CRYPTO_EddsaSignature *sig);
2177
2178
2191#define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \
2192 /* check size is set correctly */ \
2193 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \
2194 /* check 'ps' begins with the purpose */ \
2195 GNUNET_static_assert (((void*) (ps)) == \
2196 ((void*) &(ps)->purpose)); \
2197 GNUNET_assert (GNUNET_OK == \
2198 GNUNET_CRYPTO_eddsa_sign_ (priv, \
2199 &(ps)->purpose, \
2200 sig)); \
2201} while (0)
2202
2203
2221 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
2222 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2223 struct GNUNET_CRYPTO_EcdsaSignature *sig);
2224
2236 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2237 void *data,
2238 size_t size,
2239 struct GNUNET_CRYPTO_EddsaSignature *sig);
2240
2253#define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \
2254 /* check size is set correctly */ \
2255 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2256 /* check 'ps' begins with the purpose */ \
2257 GNUNET_static_assert (((void*) (ps)) == \
2258 ((void*) &(ps)->purpose)); \
2259 GNUNET_assert (GNUNET_OK == \
2260 GNUNET_CRYPTO_ecdsa_sign_ (priv, \
2261 &(ps)->purpose, \
2262 sig)); \
2263} while (0)
2264
2282 const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv,
2283 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2285
2286
2300#define GNUNET_CRYPTO_edx25519_sign(priv,ps,sig) do { \
2301 /* check size is set correctly */ \
2302 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2303 /* check 'ps' begins with the purpose */ \
2304 GNUNET_static_assert (((void*) (ps)) == \
2305 ((void*) &(ps)->purpose)); \
2306 GNUNET_assert (GNUNET_OK == \
2307 GNUNET_CRYPTO_edx25519_sign_ (priv, \
2308 &(ps)->purpose, \
2309 sig)); \
2310} while (0)
2311
2312
2333 uint32_t purpose,
2334 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
2335 const struct GNUNET_CRYPTO_EddsaSignature *sig,
2336 const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
2337
2338
2353#define GNUNET_CRYPTO_eddsa_verify(purp,ps,sig,pub) ({ \
2354 /* check size is set correctly */ \
2355 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2356 /* check 'ps' begins with the purpose */ \
2357 GNUNET_static_assert (((void*) (ps)) == \
2358 ((void*) &(ps)->purpose)); \
2359 GNUNET_CRYPTO_eddsa_verify_ (purp, \
2360 &(ps)->purpose, \
2361 sig, \
2362 pub); \
2363 })
2364
2385 uint32_t purpose,
2386 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
2387 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
2388 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
2389
2390
2405#define GNUNET_CRYPTO_ecdsa_verify(purp,ps,sig,pub) ({ \
2406 /* check size is set correctly */ \
2407 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2408 /* check 'ps' begins with the purpose */ \
2409 GNUNET_static_assert (((void*) (ps)) == \
2410 ((void*) &(ps)->purpose)); \
2411 GNUNET_CRYPTO_ecdsa_verify_ (purp, \
2412 &(ps)->purpose, \
2413 sig, \
2414 pub); \
2415 })
2416
2437 uint32_t purpose,
2438 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
2439 const struct GNUNET_CRYPTO_Edx25519Signature *sig,
2440 const struct GNUNET_CRYPTO_Edx25519PublicKey *pub);
2441
2442
2457#define GNUNET_CRYPTO_edx25519_verify(purp,ps,sig,pub) ({ \
2458 /* check size is set correctly */ \
2459 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2460 /* check 'ps' begins with the purpose */ \
2461 GNUNET_static_assert (((void*) (ps)) == \
2462 ((void*) &(ps)->purpose)); \
2463 GNUNET_CRYPTO_edx25519_verify_ (purp, \
2464 &(ps)->purpose, \
2465 sig, \
2466 pub); \
2467 })
2468
2484 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
2485 const char *label,
2486 const char *context);
2487
2488
2500void
2502 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
2503 const char *label,
2504 const char *context,
2506
2521 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
2522 const char *label,
2523 const char *context,
2524 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2525 struct GNUNET_CRYPTO_EcdsaSignature *sig);
2526
2527
2544void
2546 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2547 const char *label,
2548 const char *context,
2550
2551
2563void
2565 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2566 const char *label,
2567 const char *context,
2569
2570
2586 const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey,
2587 const char *label,
2588 const char *context,
2589 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2590 struct GNUNET_CRYPTO_EddsaSignature *sig);
2591
2592
2599void
2601 const struct GNUNET_CRYPTO_EddsaPrivateScalar *s,
2603
2616void
2618 const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv,
2619 const void *seed,
2620 size_t seedsize,
2622
2623
2634void
2637 const void *seed,
2638 size_t seedsize,
2640
2641
2650void
2652 size_t size,
2653 gcry_mpi_t val);
2654
2655
2665void
2667 const void *data,
2668 size_t size);
2669
2670
2677void
2679 struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2680 struct GNUNET_CRYPTO_PaillierPrivateKey *private_key);
2681
2682
2694int
2696 const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2697 const gcry_mpi_t m,
2698 int desired_ops,
2699 struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext);
2700
2701
2710void
2712 const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key,
2713 const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2714 const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext,
2715 gcry_mpi_t m);
2716
2717
2732int
2734 const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2735 const struct GNUNET_CRYPTO_PaillierCiphertext *c1,
2736 const struct GNUNET_CRYPTO_PaillierCiphertext *c2,
2738
2739
2746int
2748 const struct GNUNET_CRYPTO_PaillierCiphertext *c);
2749
2750
2751/* ********* Chaum-style RSA-based blind signatures ******************* */
2752
2753
2758
2763
2768{
2774};
2775
2780
2781
2789GNUNET_CRYPTO_rsa_private_key_create (unsigned int len);
2790
2791
2797void
2799
2800
2809size_t
2811 const struct GNUNET_CRYPTO_RsaPrivateKey *key,
2812 void **buffer);
2813
2814
2825 size_t buf_size);
2826
2827
2836 const struct GNUNET_CRYPTO_RsaPrivateKey *key);
2837
2838
2847 const struct GNUNET_CRYPTO_RsaPrivateKey *priv);
2848
2849
2856void
2858 const struct GNUNET_CRYPTO_RsaPublicKey *key,
2859 struct GNUNET_HashCode *hc);
2860
2861
2867bool
2869 const struct GNUNET_CRYPTO_RsaPublicKey *key);
2870
2877unsigned int
2879
2880
2886void
2888
2889
2898size_t
2900 const struct GNUNET_CRYPTO_RsaPublicKey *key,
2901 void **buffer);
2902
2903
2914 size_t len);
2915
2916
2925
2926
2934int
2936 const struct GNUNET_CRYPTO_RsaSignature *s2);
2937
2945int
2947 const struct GNUNET_CRYPTO_RsaPrivateKey *p1,
2948 const struct GNUNET_CRYPTO_RsaPrivateKey *p2);
2949
2950
2958int
2960 const struct GNUNET_CRYPTO_RsaPublicKey *p2);
2961
2962
2967{
2973
2978};
2979
2980
2992GNUNET_CRYPTO_rsa_blind (const void *message,
2993 size_t message_size,
2994 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2997
2998
3008 const struct
3010
3011
3022 const void *message,
3023 size_t message_size);
3024
3025
3032void
3035
3036
3042void
3044
3045
3053size_t
3055 const struct GNUNET_CRYPTO_RsaSignature *sig,
3056 void **buffer);
3057
3058
3069 const void *buf,
3070 size_t buf_size);
3071
3072
3081 const struct GNUNET_CRYPTO_RsaSignature *sig);
3082
3083
3096 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
3098
3099
3111GNUNET_CRYPTO_rsa_verify (const void *message,
3112 size_t message_size,
3113 const struct GNUNET_CRYPTO_RsaSignature *sig,
3114 const struct GNUNET_CRYPTO_RsaPublicKey *public_key);
3115
3116
3122void
3124
3125
3132void
3134 const struct GNUNET_CRYPTO_CsPrivateKey *priv,
3136
3137
3151void
3153 const struct GNUNET_CRYPTO_CsSessionNonce *nonce,
3154 const char *seed,
3155 const struct GNUNET_CRYPTO_CsPrivateKey *lts,
3156 struct GNUNET_CRYPTO_CsRSecret r[2]);
3157
3158
3165void
3167 const struct GNUNET_CRYPTO_CsRSecret *r_priv,
3168 struct GNUNET_CRYPTO_CsRPublic *r_pub);
3169
3170
3181void
3183 const struct GNUNET_CRYPTO_CsBlindingNonce *blind_seed,
3184 struct GNUNET_CRYPTO_CsBlindingSecret bs[2]);
3185
3186
3192{
3197
3202
3203};
3204
3205
3210{
3212};
3213
3214
3227void
3229 const struct GNUNET_CRYPTO_CsBlindingSecret bs[2],
3230 const struct GNUNET_CRYPTO_CsRPublic r_pub[2],
3231 const struct GNUNET_CRYPTO_CsPublicKey *pub,
3232 const void *msg,
3233 size_t msg_len,
3234 struct GNUNET_CRYPTO_CsC blinded_c[2],
3235 struct GNUNET_CRYPTO_CSPublicRPairP *r_pub_blind);
3236
3237
3244{
3249 unsigned int b;
3250
3255};
3256
3257
3272void
3274 const struct GNUNET_CRYPTO_CsPrivateKey *priv,
3275 const struct GNUNET_CRYPTO_CsRSecret r[2],
3276 const struct GNUNET_CRYPTO_CsBlindedMessage *bm,
3277 struct GNUNET_CRYPTO_CsBlindSignature *cs_blind_sig);
3278
3279
3287void
3289 const struct GNUNET_CRYPTO_CsBlindS *blinded_signature_scalar,
3290 const struct GNUNET_CRYPTO_CsBlindingSecret *bs,
3291 struct GNUNET_CRYPTO_CsS *signature_scalar);
3292
3293
3306 const struct GNUNET_CRYPTO_CsSignature *sig,
3307 const struct GNUNET_CRYPTO_CsPublicKey *pub,
3308 const void *msg,
3309 size_t msg_len);
3310
3311
3316{
3317
3322
3327
3333
3334
3339{
3340
3345
3349 unsigned int rc;
3350
3354 union
3355 {
3360
3365
3367
3368};
3369
3370
3376{
3377
3382
3386 unsigned int rc;
3387
3391 union
3392 {
3399
3404
3406
3407};
3408
3409
3414{
3415
3420
3424 unsigned int rc;
3425
3430
3434 union
3435 {
3440
3445
3447};
3448
3449
3454{
3455
3460
3464 unsigned int rc;
3465
3469 union
3470 {
3475
3480
3482};
3483
3484
3489{
3494
3498 unsigned int rc;
3499
3503 union
3504 {
3509
3514
3516};
3517
3518
3523{
3525};
3526
3527
3532{
3533
3538
3542 unsigned int rc;
3543
3547 union
3548 {
3553
3555
3556};
3557
3558
3564{
3569};
3570
3571
3583 const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv,
3584 const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
3585 const char *salt);
3586
3587
3593void
3595 struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub);
3596
3597
3603void
3605 struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv);
3606
3607
3613void
3615 struct GNUNET_CRYPTO_UnblindedSignature *ub_sig);
3616
3617
3623void
3625 struct GNUNET_CRYPTO_BlindedSignature *blind_sig);
3626
3627
3633void
3635 struct GNUNET_CRYPTO_BlindedMessage *bm);
3636
3637
3646 struct GNUNET_CRYPTO_BlindedMessage *bm);
3647
3648
3658
3659
3666void
3669
3670
3679 struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub);
3680
3681
3690 struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv);
3691
3692
3701
3702
3711 struct GNUNET_CRYPTO_BlindedSignature *blind_sig);
3712
3713
3721int
3723 const struct GNUNET_CRYPTO_BlindSignPublicKey *bp1,
3724 const struct GNUNET_CRYPTO_BlindSignPublicKey *bp2);
3725
3726
3734int
3736 const struct GNUNET_CRYPTO_UnblindedSignature *sig2);
3737
3738
3746int
3748 const struct GNUNET_CRYPTO_BlindedSignature *sig1,
3749 const struct GNUNET_CRYPTO_BlindedSignature *sig2);
3750
3751
3759int
3761 const struct GNUNET_CRYPTO_BlindedMessage *bp1,
3762 const struct GNUNET_CRYPTO_BlindedMessage *bp2);
3763
3764
3780 struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv,
3781 struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub,
3783 ...);
3784
3785
3801 struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv,
3802 struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub,
3804 va_list ap);
3805
3806
3811{
3816
3821};
3822
3823
3838 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub,
3839 const union GNUNET_CRYPTO_BlindingSecretP *bks,
3840 const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
3841 const void *message,
3842 size_t message_size,
3843 const struct GNUNET_CRYPTO_BlindingInputValues *alg_values);
3844
3845
3857 const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv,
3858 const char *salt,
3859 const struct GNUNET_CRYPTO_BlindedMessage *blinded_message);
3860
3861
3875 const struct GNUNET_CRYPTO_BlindedSignature *blinded_sig,
3876 const union GNUNET_CRYPTO_BlindingSecretP *bks,
3877 const void *message,
3878 size_t message_size,
3879 const struct GNUNET_CRYPTO_BlindingInputValues *alg_values,
3880 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub);
3881
3882
3894 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub,
3895 const struct GNUNET_CRYPTO_UnblindedSignature *ub_sig,
3896 const void *message,
3897 size_t message_size);
3898
3899
3910ssize_t
3913
3929 const void *buffer,
3930 size_t len,
3932 size_t *read);
3933
3944ssize_t
3946 const struct GNUNET_CRYPTO_PrivateKey *key);
3947
3948
3961ssize_t
3964 void*buffer,
3965 size_t len);
3966
3967
3982 const void*buffer,
3983 size_t len,
3985 size_t *read);
3986
3987
4000ssize_t
4002 const struct GNUNET_CRYPTO_PrivateKey *key,
4003 void*buffer,
4004 size_t len);
4005
4006
4017ssize_t
4019 const struct GNUNET_CRYPTO_Signature *sig);
4020
4021
4032ssize_t
4034
4035
4048ssize_t
4050 struct GNUNET_CRYPTO_Signature *sig,
4051 const void*buffer,
4052 size_t len);
4053
4054
4067ssize_t
4069 const struct GNUNET_CRYPTO_Signature *sig,
4070 void*buffer,
4071 size_t len);
4072
4073
4089 const struct GNUNET_CRYPTO_PrivateKey *priv,
4090 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
4091 struct GNUNET_CRYPTO_Signature *sig);
4092
4108 const struct GNUNET_CRYPTO_PrivateKey *priv,
4109 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
4110 unsigned char *sig);
4111
4112
4124#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \
4125 /* check size is set correctly */ \
4126 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
4127 /* check 'ps' begins with the purpose */ \
4128 GNUNET_static_assert (((void*) (ps)) == \
4129 ((void*) &(ps)->purpose)); \
4130 GNUNET_assert (GNUNET_OK == \
4131 GNUNET_CRYPTO_sign_ (priv, \
4132 &(ps)->purpose, \
4133 sig)); \
4134} while (0)
4135
4136
4156 uint32_t purpose,
4157 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
4158 const struct GNUNET_CRYPTO_Signature *sig,
4159 const struct GNUNET_CRYPTO_PublicKey *pub);
4160
4178 uint32_t purpose,
4179 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
4180 const unsigned char *sig,
4181 const struct GNUNET_CRYPTO_PublicKey *pub);
4182
4183
4197#define GNUNET_CRYPTO_signature_verify(purp,ps,sig,pub) ({ \
4198 /* check size is set correctly */ \
4199 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
4200 /* check 'ps' begins with the purpose */ \
4201 GNUNET_static_assert (((void*) (ps)) == \
4202 ((void*) &(ps)->purpose)); \
4203 GNUNET_CRYPTO_signature_verify_ (purp, \
4204 &(ps)->purpose, \
4205 sig, \
4206 pub); \
4207 })
4208
4209
4225ssize_t
4226GNUNET_CRYPTO_encrypt_old (const void *block,
4227 size_t size,
4228 const struct GNUNET_CRYPTO_PublicKey *pub,
4229 struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
4230 void *result);
4231
4232
4247ssize_t
4249 const void *block,
4250 size_t size,
4251 const struct GNUNET_CRYPTO_PrivateKey *priv,
4252 const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
4253 void *result);
4254
4255#define GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \
4256 + sizeof (struct \
4257 GNUNET_CRYPTO_FoKemC))
4258
4275GNUNET_CRYPTO_encrypt (const void *block,
4276 size_t size,
4277 const struct GNUNET_CRYPTO_PublicKey *pub,
4278 void *result,
4279 size_t result_size);
4280
4281
4294GNUNET_CRYPTO_decrypt (const void *block,
4295 size_t size,
4296 const struct GNUNET_CRYPTO_PrivateKey *priv,
4297 void *result,
4298 size_t result_size);
4299
4300
4309char *
4311 const struct GNUNET_CRYPTO_PublicKey *key);
4312
4313
4322char *
4324 const struct GNUNET_CRYPTO_PrivateKey *key);
4325
4326
4338
4339
4351
4352
4361GNUNET_CRYPTO_key_get_public (const struct
4362 GNUNET_CRYPTO_PrivateKey *privkey,
4364
4365#if 0 /* keep Emacsens' auto-indent happy */
4366{
4367#endif
4368#ifdef __cplusplus
4369}
4370#endif
4371
4372
4373/* ifndef GNUNET_CRYPTO_LIB_H */
4374#endif
4375 /* end of group addition */
4377
4378/* end of gnunet_crypto_lib.h */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static int ret
Final status code.
Definition: gnunet-arm.c:94
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
static char * filename
static pa_context * context
Pulseaudio context.
static OpusEncoder * enc
OPUS encoder.
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static char * pkey
Public key of the zone to look in, in ASCII.
static char * res
Currently read line or NULL on EOF.
static uint32_t type
Type string converted to DNS type value.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
static int result
Global testing status.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:47
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calcualations.
Definition: gnunet-scrypt.c:34
static struct GNUNET_CRYPTO_EccDlogContext * edc
Context for DLOG operations on a curve.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-uri.c:38
static enum @44 mode
Should we do a PUT (mode = 0) or GET (mode = 1);.
void GNUNET_CRYPTO_ecdsa_public_key_derive(const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, const char *context, struct GNUNET_CRYPTO_EcdsaPublicKey *result)
Derive a public key from a given public key and a label.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_fo_kem_decaps(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_FoKemC *c, struct GNUNET_HashCode *key_material)
Decapsulate key material using a CCA-secure KEM.
Definition: crypto_ecc.c:924
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_ecdh(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a public and a private ECC key.
Definition: crypto_ecc.c:714
void GNUNET_CRYPTO_ecdhe_key_create(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:436
void GNUNET_CRYPTO_edx25519_key_get_public(const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, struct GNUNET_CRYPTO_Edx25519PublicKey *pub)
Extract the public key for the given private key.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_sign_by_peer_identity(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig)
Sign a given block with a specific purpose using the host's peer identity.
struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_private_key_derive(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const char *label, const char *context)
Derive a private key from a given private key and a label.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Generate a random unsigned 64-bit value.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_kem_decaps(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *c, struct GNUNET_HashCode *key_material)
Decapsulate a key for a private EdDSA key.
Definition: crypto_ecc.c:749
void GNUNET_CRYPTO_eddsa_private_key_derive(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const char *label, const char *context, struct GNUNET_CRYPTO_EddsaPrivateScalar *result)
Derive a private scalar from a given private key and a label.
void GNUNET_CRYPTO_symmetric_create_session_key(struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Create a new random session key.
void GNUNET_CRYPTO_edx25519_key_clear(struct GNUNET_CRYPTO_Edx25519PrivateKey *pk)
Clear memory that was used to store a private key.
void GNUNET_CRYPTO_edx25519_private_key_derive(const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, const void *seed, size_t seedsize, struct GNUNET_CRYPTO_Edx25519PrivateKey *result)
Derive a private scalar from a given private key and a label.
void GNUNET_CRYPTO_edx25519_key_create_from_seed(const void *seed, size_t seedsize, struct GNUNET_CRYPTO_Edx25519PrivateKey *pk)
Create a new private key for Edx25519 from a given seed.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_key_from_file(const char *filename, int do_create, struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey)
Create a new private key by reading it from a file.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_fo_kem_encaps(const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_CRYPTO_FoKemC *c, struct GNUNET_HashCode *key_material)
Encapsulate key material using a CCA-secure KEM.
Definition: crypto_ecc.c:840
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_key_from_file(const char *filename, int do_create, struct GNUNET_CRYPTO_EddsaPrivateKey *pkey)
Create a new private key by reading it from a file.
void GNUNET_CRYPTO_edx25519_public_key_derive(const struct GNUNET_CRYPTO_Edx25519PublicKey *pub, const void *seed, size_t seedsize, struct GNUNET_CRYPTO_Edx25519PublicKey *result)
Derive a public key from a given public key and a label.
void GNUNET_CRYPTO_random_timeflake(enum GNUNET_CRYPTO_Quality mode, struct GNUNET_Uuid *uuid)
Fill UUID with a timeflake pseudo-random value.
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:198
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_ecdh(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a ECDH public key and a private ECDSA key.
Definition: crypto_ecc.c:759
void GNUNET_CRYPTO_eddsa_key_clear(struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
Clear memory that was used to store a private key.
Definition: crypto_ecc.c:429
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
ECDSA Sign a given block.
Definition: crypto_ecc.c:536
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_fo_kem_encaps(const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, struct GNUNET_CRYPTO_FoKemC *c, struct GNUNET_HashCode *key_material)
Encapsulate key material using a CCA-secure KEM.
Definition: crypto_ecc.c:807
void GNUNET_CRYPTO_eddsa_setup_hostkey(const char *cfg_name)
Setup a hostkey file for a peer given the name of the configuration file (!).
ssize_t GNUNET_CRYPTO_symmetric_encrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Encrypt a block using a symmetric sessionkey.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_kem_encaps(const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_CRYPTO_EcdhePublicKey *c, struct GNUNET_HashCode *key_material)
Encapsulate key material for a EdDSA public key.
Definition: crypto_ecc.c:794
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_ecdh(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a ECDH public key and a private EdDSA key.
Definition: crypto_ecc.c:727
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_ecdsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EcDSA public key and a private ECDH key.
Definition: crypto_ecc.c:940
void GNUNET_CRYPTO_eddsa_key_create(struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:462
void GNUNET_CRYPTO_symmetric_derive_iv(struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const void *salt, size_t salt_len,...)
Derive an IV.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EdDSA public key and a private ECDH key.
Definition: crypto_ecc.c:777
GNUNET_CRYPTO_Quality
Desired quality level for random numbers.
void GNUNET_CRYPTO_seed_weak_random(int32_t seed)
Seed a weak random generator.
Definition: crypto_random.c:91
void GNUNET_CRYPTO_ecdsa_key_create(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:447
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig)
EdDSA sign a given block.
Definition: crypto_ecc.c:607
void GNUNET_CRYPTO_ecdsa_key_clear(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
Clear memory that was used to store a private key.
Definition: crypto_ecc.c:422
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EcdsaSignature *sig, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Verify ECDSA signature.
Definition: crypto_ecc.c:631
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_fo_kem_decaps(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_FoKemC *c, struct GNUNET_HashCode *key_material)
Decapsulate key material using a CCA-secure KEM.
Definition: crypto_ecc.c:908
void GNUNET_CRYPTO_eddsa_public_key_derive(const struct GNUNET_CRYPTO_EddsaPublicKey *pub, const char *label, const char *context, struct GNUNET_CRYPTO_EddsaPublicKey *result)
Derive a public key from a given public key and a label.
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_get_anonymous(void)
Get the shared private key we use for anonymous users.
Definition: crypto_ecc.c:482
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
void GNUNET_CRYPTO_edx25519_key_create(struct GNUNET_CRYPTO_Edx25519PrivateKey *pk)
Create a new private key.
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:187
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Verify EdDSA signature.
Definition: crypto_ecc.c:690
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_Edx25519Signature *sig, const struct GNUNET_CRYPTO_Edx25519PublicKey *pub)
Verify Edx25519 signature.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_sign_(const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_Edx25519Signature *sig)
Edx25519 sign a given block.
unsigned int * GNUNET_CRYPTO_random_permute(enum GNUNET_CRYPTO_Quality mode, unsigned int n)
Get an array with a random permutation of the numbers 0...n-1.
void GNUNET_CRYPTO_zero_keys(void *buffer, size_t length)
Zero out buffer, securely against compiler optimizations.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_get_peer_identity(const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_PeerIdentity *dst)
Retrieve the identity of the host's peer.
void GNUNET_CRYPTO_ecdhe_key_clear(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Clear memory that was used to store a private key.
Definition: crypto_ecc.c:415
void GNUNET_CRYPTO_ecdhe_key_get_public(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, struct GNUNET_CRYPTO_EcdhePublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:214
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_verify_peer_identity(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_PeerIdentity *identity)
Verify a given signature with a peer's identity.
ssize_t GNUNET_CRYPTO_symmetric_decrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Decrypt a given block using a symmetric sessionkey.
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create_from_configuration(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a new private key by reading our peer's key from the file specified in the configuration.
@ GNUNET_CRYPTO_QUALITY_STRONG
High-quality operations are desired.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
@ GNUNET_CRYPTO_QUALITY_NONCE
Randomness for IVs etc.
void GNUNET_CRYPTO_hash_difference(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = b - a
Definition: crypto_hash.c:111
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
struct GNUNET_CRYPTO_FileHashContext * GNUNET_CRYPTO_hash_file(enum GNUNET_SCHEDULER_Priority priority, const char *filename, size_t blocksize, GNUNET_CRYPTO_HashCompletedCallback callback, void *callback_cls)
Compute the hash of an entire file.
void GNUNET_CRYPTO_hash_to_enc(const struct GNUNET_HashCode *block, struct GNUNET_CRYPTO_HashAsciiEncoded *result)
Convert hash to ASCII encoding.
Definition: crypto_hash.c:55
void GNUNET_CRYPTO_hash_create_random(enum GNUNET_CRYPTO_Quality mode, struct GNUNET_HashCode *result)
Create a random hash code.
Definition: crypto_hash.c:100
int32_t GNUNET_CRYPTO_crc32_n(const void *buf, size_t len)
Compute the CRC32 checksum for the first len bytes of the buffer.
Definition: crypto_crc.c:99
void GNUNET_CRYPTO_hmac(const struct GNUNET_CRYPTO_AuthKey *key, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac)
Calculate HMAC of a message (RFC 2104)
Definition: crypto_hash.c:330
void GNUNET_CRYPTO_hash_sum(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *delta, struct GNUNET_HashCode *result)
compute result = a + delta
Definition: crypto_hash.c:123
void GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = a ^ b
Definition: crypto_hash.c:135
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_v(void *result, size_t out_len, int xtr_algo, int prf_algo, const void *xts, size_t xts_len, const void *skm, size_t skm_len, va_list argp)
Derive key.
Definition: crypto_hkdf.c:166
uint8_t GNUNET_CRYPTO_crc8_n(const void *buf, size_t len)
Calculate the checksum of a buffer in one step.
Definition: crypto_crc.c:151
int GNUNET_CRYPTO_hash_xorcmp(const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2, const struct GNUNET_HashCode *target)
Find out which of the two GNUNET_CRYPTO_hash codes is closer to target in the XOR metric (Kademlia).
Definition: crypto_hash.c:243
void GNUNET_CRYPTO_hmac_derive_key_v(struct GNUNET_CRYPTO_AuthKey *key, const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, const void *salt, size_t salt_len, va_list argp)
Derive an authentication key.
Definition: crypto_hash.c:286
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf(void *result, size_t out_len, int xtr_algo, int prf_algo, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
Definition: crypto_hkdf.c:341
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hash_from_string2(const char *enc, size_t enclen, struct GNUNET_HashCode *result)
Convert ASCII encoding back to a 'struct GNUNET_HashCode'.
Definition: crypto_hash.c:72
uint16_t GNUNET_CRYPTO_crc16_n(const void *buf, size_t len)
Calculate the checksum of a buffer in one step.
Definition: crypto_crc.c:133
int GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2)
Compare function for HashCodes, producing a total ordering of all hashcodes.
Definition: crypto_hash.c:221
uint32_t GNUNET_CRYPTO_hash_distance_u32(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b)
Compute the distance between 2 hashcodes.
Definition: crypto_hash.c:89
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
Definition: crypto_kdf.c:70
void GNUNET_CRYPTO_hmac_derive_key(struct GNUNET_CRYPTO_AuthKey *key, const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, const void *salt, size_t salt_len,...)
Derive an authentication key.
Definition: crypto_hash.c:267
void GNUNET_CRYPTO_hash_to_aes_key(const struct GNUNET_HashCode *hc, struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
Convert a hashcode into a key.
Definition: crypto_hash.c:152
char * GNUNET_CRYPTO_eddsa_private_key_to_string(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
Convert a private key to a string.
Definition: crypto_ecc.c:279
unsigned int GNUNET_CRYPTO_hash_count_leading_zeros(const struct GNUNET_HashCode *h)
Count the number of leading 0 bits in h.
Definition: crypto_hash.c:177
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_sign_raw_(const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, unsigned char *sig)
Sign a given block.
Definition: crypto_pkey.c:264
struct GNUNET_CRYPTO_BlindSignPrivateKey * GNUNET_CRYPTO_bsign_priv_incref(struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv)
Increment reference counter of the given bsign_priv.
#define GNUNET_CRYPTO_HASH_LENGTH
Length of a hash value.
void(* GNUNET_CRYPTO_HashCompletedCallback)(void *cls, const struct GNUNET_HashCode *res)
Function called once the hash computation over the specified file has completed.
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_signature_verify_raw_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const unsigned char *sig, const struct GNUNET_CRYPTO_PublicKey *pub)
Verify a given signature.
Definition: crypto_pkey.c:346
void GNUNET_CRYPTO_mpi_scan_unsigned(gcry_mpi_t *result, const void *data, size_t size)
Convert data buffer into MPI value.
Definition: crypto_mpi.c:132
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
int GNUNET_CRYPTO_paillier_hom_get_remaining(const struct GNUNET_CRYPTO_PaillierCiphertext *c)
Get the number of remaining supported homomorphic operations.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_raw(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, void *data, size_t size, struct GNUNET_CRYPTO_EddsaSignature *sig)
Definition: crypto_ecc.c:586
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.
ssize_t GNUNET_CRYPTO_read_signature_from_buffer(struct GNUNET_CRYPTO_Signature *sig, const void *buffer, size_t len)
Reads a GNUNET_CRYPTO_Signature from a compact buffer.
Definition: crypto_pkey.c:226
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
Definition: crypto_pkey.c:68
void GNUNET_CRYPTO_ecc_rnd_mpi(struct GNUNET_CRYPTO_EccScalar *r, struct GNUNET_CRYPTO_EccScalar *r_neg)
Obtain a random scalar for point multiplication on the curve and its additive inverse.
#define GNUNET_CRYPTO_PAILLIER_BITS
Size of paillier plain texts and public keys.
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
Definition: crypto_rsa.c:1015
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
GNUNET_CRYPTO_KeyType
Key type for the generic public key union.
struct GNUNET_CRYPTO_BlindedSignature * GNUNET_CRYPTO_blind_sig_incref(struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
Increment reference counter of the given blind_sig.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_signature_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_Signature *sig, const struct GNUNET_CRYPTO_PublicKey *pub)
Verify a given signature.
Definition: crypto_pkey.c:317
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:98
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_dexp_mpi(const struct GNUNET_CRYPTO_EccScalar *val, struct GNUNET_CRYPTO_EccPoint *r)
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing v...
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.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_pmul_mpi(const struct GNUNET_CRYPTO_EccPoint *p, const struct GNUNET_CRYPTO_EccScalar *val, struct GNUNET_CRYPTO_EccPoint *r)
Multiply the point p on the elliptic curve by val.
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.
ssize_t GNUNET_CRYPTO_decrypt_old(const void *block, size_t size, const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *ecc, void *result)
Decrypt a given block with GNUNET_CRYPTO_PrivateKey and a given GNUNET_CRYPTO_EcdhePublicKey using ec...
Definition: crypto_pkey.c:516
void GNUNET_CRYPTO_kdf_mod_mpi(gcry_mpi_t *r, gcry_mpi_t n, const void *xts, size_t xts_len, const void *skm, size_t skm_len, const char *ctx)
Deterministically generate a pseudo-random number uniformly from the integers modulo a libgcrypt mpi.
Definition: crypto_kdf.c:95
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.
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
Definition: crypto_pkey.c:551
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_dup(const struct GNUNET_CRYPTO_RsaSignature *sig)
Duplicate the given rsa signature.
Definition: crypto_rsa.c:1268
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
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_public_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Convert a string representing a public key to a public key.
Definition: crypto_ecc.c:333
int GNUNET_CRYPTO_ecc_dlog(struct GNUNET_CRYPTO_EccDlogContext *edc, const struct GNUNET_CRYPTO_EccPoint *input)
Calculate ECC discrete logarithm for small factors.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode(const void *buf, size_t buf_size)
Decode the signature from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:1063
GNUNET_CRYPTO_BlindSignatureAlgorithm
Types of public keys used for blind signatures.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_encrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_PublicKey *pub, void *result, size_t result_size)
Encrypt a block with GNUNET_CRYPTO_PublicKey and derives a GNUNET_CRYPTO_EcdhePublicKey which is requ...
Definition: crypto_pkey.c:416
struct GNUNET_CRYPTO_UnblindedSignature * GNUNET_CRYPTO_ub_sig_incref(struct GNUNET_CRYPTO_UnblindedSignature *ub_sig)
Increment reference counter of the given ub_sig.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_private_key_from_string(const char *str, struct GNUNET_CRYPTO_PrivateKey *key)
Parses a (Base32) string representation of the private key.
Definition: crypto_pkey.c:587
void GNUNET_CRYPTO_hash_context_read(struct GNUNET_HashContext *hc, const void *buf, size_t size)
Add data to be hashed.
Definition: crypto_hash.c:366
void GNUNET_CRYPTO_ecc_scalar_from_int(int64_t val, struct GNUNET_CRYPTO_EccScalar *r)
Create a scalar from int value.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_derived(const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey, const char *label, const char *context, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig)
This is a signature function for EdDSA which takes a private key and derives it using the label and c...
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_copy(const struct GNUNET_HashContext *hc)
Make a copy of the hash computation.
Definition: crypto_hash.c:377
uint16_t GNUNET_CRYPTO_crc16_finish(uint32_t sum)
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
Definition: crypto_crc.c:123
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len)
Decode the public key from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:423
int GNUNET_CRYPTO_ub_sig_cmp(const struct GNUNET_CRYPTO_UnblindedSignature *sig1, const struct GNUNET_CRYPTO_UnblindedSignature *sig2)
Compare two denomination signatures.
ssize_t GNUNET_CRYPTO_write_public_key_to_buffer(const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PublicKey to a compact buffer.
Definition: crypto_pkey.c:128
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
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: crypto_pkey.c:602
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_sign_(const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_Signature *sig)
Sign a given block.
Definition: crypto_pkey.c:291
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
uint32_t GNUNET_CRYPTO_crc16_step(uint32_t sum, const void *buf, size_t len)
Perform an incremental step in a CRC16 (for TCP/IP) calculation.
Definition: crypto_crc.c:110
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:321
int GNUNET_CRYPTO_paillier_encrypt(const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const gcry_mpi_t m, int desired_ops, struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext)
Encrypt a plaintext with a paillier public key.
bool GNUNET_CRYPTO_rsa_public_key_check(const struct GNUNET_CRYPTO_RsaPublicKey *key)
Check if key is well-formed.
Definition: crypto_rsa.c:301
#define GNUNET_CRYPTO_AES_KEY_LENGTH
length of the sessionkey in bytes (256 BIT sessionkey)
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf_v(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len, va_list argp)
Derive key.
Definition: crypto_kdf.c:38
char * GNUNET_CRYPTO_eddsa_public_key_to_string(const struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a public key to a string.
Definition: crypto_ecc.c:252
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
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.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_public_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a string representing a public key to a public key.
Definition: crypto_ecc.c:358
unsigned int GNUNET_CRYPTO_rsa_public_key_len(const struct GNUNET_CRYPTO_RsaPublicKey *key)
Obtain the length of the RSA key in bits.
Definition: crypto_rsa.c:680
void GNUNET_CRYPTO_rsa_blinded_message_free(struct GNUNET_CRYPTO_RsaBlindedMessage *bm)
Free memory occupied by blinded message.
Definition: crypto_rsa.c:799
char * GNUNET_CRYPTO_private_key_to_string(const struct GNUNET_CRYPTO_PrivateKey *key)
Creates a (Base32) string representation of the private key.
Definition: crypto_pkey.c:561
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_dup(const struct GNUNET_CRYPTO_RsaPublicKey *key)
Duplicate the given public key.
Definition: crypto_rsa.c:1099
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_sign_fdh(const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *message, size_t message_size)
Create and sign a full domain hash of a message.
Definition: crypto_rsa.c:992
ssize_t GNUNET_CRYPTO_encrypt_old(const void *block, size_t size, const struct GNUNET_CRYPTO_PublicKey *pub, struct GNUNET_CRYPTO_EcdhePublicKey *ecc, void *result)
Encrypt a block with GNUNET_CRYPTO_PublicKey and derives a GNUNET_CRYPTO_EcdhePublicKey which is requ...
Definition: crypto_pkey.c:377
ssize_t GNUNET_CRYPTO_signature_get_raw_length_by_type(uint32_t type)
Get the compacted length of a signature by type.
Definition: crypto_pkey.c:208
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
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_decode(const void *buf, size_t buf_size)
Decode the private key from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:204
void GNUNET_CRYPTO_hash_context_abort(struct GNUNET_HashContext *hc)
Abort hashing, do not bother calculating final result.
Definition: crypto_hash.c:408
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_derived(const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, const char *context, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
This is a signature function for ECDSA which takes a private key, derives/blinds it and signs the mes...
void GNUNET_CRYPTO_pow_hash(const struct GNUNET_CRYPTO_PowSalt *salt, const void *buf, size_t buf_len, struct GNUNET_HashCode *result)
Calculate the 'proof-of-work' hash (an expensive hash).
Definition: crypto_pow.c:42
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_mpi_print_unsigned(void *buf, size_t size, gcry_mpi_t val)
Output the given MPI value to the given buffer in network byte order.
Definition: crypto_mpi.c:79
GNUNET_SCHEDULER_Priority
Valid task priorities.
ssize_t GNUNET_CRYPTO_write_signature_to_buffer(const struct GNUNET_CRYPTO_Signature *sig, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_Signature to a compact buffer.
Definition: crypto_pkey.c:246
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
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:241
size_t GNUNET_CRYPTO_rsa_public_key_encode(const struct GNUNET_CRYPTO_RsaPublicKey *key, void **buffer)
Encode the public key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:325
void GNUNET_CRYPTO_paillier_create(struct GNUNET_CRYPTO_PaillierPublicKey *public_key, struct GNUNET_CRYPTO_PaillierPrivateKey *private_key)
Create a freshly generated paillier public key.
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
Definition: crypto_pkey.c:47
void GNUNET_CRYPTO_eddsa_key_get_public_from_scalar(const struct GNUNET_CRYPTO_EddsaPrivateScalar *s, struct GNUNET_CRYPTO_EddsaPublicKey *pkey)
Extract the public key of the given private scalar.
int GNUNET_CRYPTO_rsa_private_key_cmp(const struct GNUNET_CRYPTO_RsaPrivateKey *p1, const struct GNUNET_CRYPTO_RsaPrivateKey *p2)
Compare the values of two private keys.
Definition: crypto_rsa.c:654
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.
void GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash)
Finish the hash computation.
Definition: crypto_hash.c:390
size_t GNUNET_CRYPTO_rsa_signature_encode(const struct GNUNET_CRYPTO_RsaSignature *sig, void **buffer)
Encode the given signature in a format suitable for storing it into a file.
Definition: crypto_rsa.c:1023
void GNUNET_CRYPTO_ecc_dexp(int val, struct GNUNET_CRYPTO_EccPoint *r)
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing v...
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_symmetric_derive_iv_v(struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const void *salt, size_t salt_len, va_list argp)
Derive an IV.
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer(const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer.
Definition: crypto_pkey.c:171
void GNUNET_CRYPTO_ecc_dlog_release(struct GNUNET_CRYPTO_EccDlogContext *dlc)
Release precalculated values.
struct GNUNET_CRYPTO_EccDlogContext * GNUNET_CRYPTO_ecc_dlog_prepare(unsigned int max, unsigned int mem)
Do pre-calculation for ECC discrete logarithm for small factors.
char * GNUNET_CRYPTO_ecdsa_public_key_to_string(const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Convert a public key to a string.
Definition: crypto_ecc.c:225
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.
int GNUNET_CRYPTO_paillier_hom_add(const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *c1, const struct GNUNET_CRYPTO_PaillierCiphertext *c2, struct GNUNET_CRYPTO_PaillierCiphertext *result)
Compute a ciphertext that represents the sum of the plaintext in c1 and c2.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_decrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_PrivateKey *priv, void *result, size_t result_size)
Decrypt a given block with GNUNET_CRYPTO_PrivateKey and a given GNUNET_CRYPTO_EcdhePublicKey using ec...
Definition: crypto_pkey.c:467
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.
ssize_t GNUNET_CRYPTO_signature_get_length(const struct GNUNET_CRYPTO_Signature *sig)
Get the compacted length of a GNUNET_CRYPTO_Signature.
Definition: crypto_pkey.c:189
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_private_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
Convert a string representing a private key to a private key.
Definition: crypto_ecc.c:383
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.
unsigned int GNUNET_CRYPTO_hash_count_tailing_zeros(const struct GNUNET_HashCode *h)
Count the number of tailing 0 bits in h.
Definition: crypto_hash.c:199
char * GNUNET_CRYPTO_ecdsa_private_key_to_string(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv)
Convert a private key to a string.
Definition: crypto_ecc.c:306
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_rnd(struct GNUNET_CRYPTO_EccPoint *r, struct GNUNET_CRYPTO_EccPoint *r_inv)
Obtain a random point on the curve and its additive inverse.
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:333
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_public_key_from_buffer(const void *buffer, size_t len, struct GNUNET_CRYPTO_PublicKey *key, size_t *read)
Reads a GNUNET_CRYPTO_PublicKey from a compact buffer.
Definition: crypto_pkey.c:103
int GNUNET_CRYPTO_rsa_public_key_cmp(const struct GNUNET_CRYPTO_RsaPublicKey *p1, const struct GNUNET_CRYPTO_RsaPublicKey *p2)
Compare the values of two public keys.
Definition: crypto_rsa.c:628
void GNUNET_CRYPTO_ecc_random_mod_n(struct GNUNET_CRYPTO_EccScalar *r)
Generate a random value mod n.
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_dup(const struct GNUNET_CRYPTO_RsaPrivateKey *key)
Duplicate the given private key.
Definition: crypto_rsa.c:1248
void GNUNET_CRYPTO_paillier_decrypt(const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key, const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext, gcry_mpi_t m)
Decrypt a paillier ciphertext with a private key.
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.
Definition: crypto_rsa.c:1118
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:285
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_read_private_key_from_buffer(const void *buffer, size_t len, struct GNUNET_CRYPTO_PrivateKey *key, size_t *read)
Reads a GNUNET_CRYPTO_PrivateKey from a compact buffer.
Definition: crypto_pkey.c:146
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start(void)
Start incremental hashing operation.
Definition: crypto_hash.c:350
void GNUNET_CRYPTO_hmac_raw(const void *key, size_t key_len, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac)
Calculate HMAC of a message (RFC 2104) TODO: Shouldn't this be the standard hmac function and the abo...
Definition: crypto_hash.c:300
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...
Definition: crypto_rsa.c:1199
size_t GNUNET_CRYPTO_rsa_private_key_encode(const struct GNUNET_CRYPTO_RsaPrivateKey *key, void **buffer)
Encode the private key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:181
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string(const char *str, struct GNUNET_CRYPTO_PublicKey *key)
Parses a (Base32) string representation of the public key.
Definition: crypto_pkey.c:571
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_add(const struct GNUNET_CRYPTO_EccPoint *a, const struct GNUNET_CRYPTO_EccPoint *b, struct GNUNET_CRYPTO_EccPoint *r)
Add two points on the elliptic curve.
#define GNUNET_PACKED
gcc-ism to get packed structs.
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:108
@ GNUNET_PUBLIC_KEY_TYPE_EDDSA
EDDSA identity.
@ GNUNET_PUBLIC_KEY_TYPE_ECDSA
The identity type.
@ GNUNET_CRYPTO_BSA_INVALID
Invalid type of signature.
@ GNUNET_CRYPTO_BSA_CS
Clause Blind Schnorr signature.
@ GNUNET_CRYPTO_BSA_RSA
RSA blind signature.
#define max(x, y)
static unsigned int size
Size of the "table".
Definition: peer.c:68
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:36
type for (message) authentication keys
unsigned char key[(512/8)]
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::@17 details
Details, depending on cipher.
Type of public signing keys for blind signatures.
union GNUNET_CRYPTO_BlindSignPublicKey::@16 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::@18 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.
union GNUNET_CRYPTO_BlindedSignature::@15 details
Details, depending on 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.
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::@19 details
Details, depending on cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
Secret r for Cs denominations.
struct GNUNET_CRYPTO_CsRSecret r[2]
Pair of Public R values for Cs denominations.
struct GNUNET_CRYPTO_CsRPublic r_pub[2]
Type of a nonce used for challenges.
struct GNUNET_ShortHashCode value
The value of the nonce.
unsigned char y[crypto_core_ed25519_BYTES]
This is a point on the Curve25519.
unsigned char d[crypto_core_ed25519_SCALARBYTES]
32 byte scalar
blinded s in the signature
struct GNUNET_CRYPTO_Cs25519Scalar scalar
The Sign Answer for Clause Blind Schnorr signature.
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_...
CS Parameters derived from the message during blinding to create blinded signature.
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.
Nonce for computing blinding factors.
Secret used for blinding (alpha and beta).
struct GNUNET_CRYPTO_Cs25519Scalar alpha
struct GNUNET_CRYPTO_Cs25519Scalar beta
Schnorr c to be signed.
struct GNUNET_CRYPTO_Cs25519Scalar scalar
The private information of an Schnorr key pair.
struct GNUNET_CRYPTO_Cs25519Scalar scalar
The public information of an Schnorr key pair.
struct GNUNET_CRYPTO_Cs25519Point point
the public R (derived from r) used in c
struct GNUNET_CRYPTO_Cs25519Point point
the private r used in the signature
struct GNUNET_CRYPTO_Cs25519Scalar scalar
s in the signature
struct GNUNET_CRYPTO_Cs25519Scalar scalar
Nonce for the session, picked by client, shared with the signer.
CS Signtature containing scalar s and point R.
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.
Internal structure used to cache pre-calculated values for DLOG calculation.
unsigned int mem
How much memory should we use (relates to the number of entries in the map).
Point on a curve (always for Curve25519) encoded in a format suitable for network transmission (ECDH)...
unsigned char v[256/8]
Q consists of an x- and a y-value, each mod p (256 bits), given here in affine coordinates and Ed2551...
A ECC scalar for use in point multiplications.
unsigned char v[256/8]
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!...
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
Private ECC key encoded for transmission.
unsigned char d[256/8]
d is a value mod n, where n has at most 256 bits.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
unsigned char q_y[256/8]
Q consists of an x- and a y-value, each mod p (256 bits), given here in affine coordinates and Ed2551...
Private ECC key encoded for transmission.
unsigned char d[256/8]
d is a value mod n, where n has at most 256 bits.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
unsigned char q_y[256/8]
Q consists of an x- and a y-value, each mod p (256 bits), given here in affine coordinates and Ed2551...
an ECC signature using ECDSA
unsigned char s[256/8]
S value.
unsigned char r[256/8]
R value.
Private ECC key encoded for transmission.
unsigned char d[256/8]
d is a value mod n, where n has at most 256 bits.
Private ECC scalar encoded for transmission.
unsigned char s[512/8]
s is the expandedprivate 512-bit scalar of a private key.
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and E...
unsigned char q_y[256/8]
Point Q consists of a y-value mod p (256 bits); the x-value is always positive.
an ECC signature using EdDSA.
unsigned char s[256/8]
S value.
unsigned char r[256/8]
R value.
Private ECC key material encoded for transmission.
unsigned char b[256/8]
b consists of 32 bytes which where originally the lower 32bytes of the key expansion.
unsigned char a[256/8]
a is a value mod n, where n has at most 256 bits.
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and E...
unsigned char q_y[256/8]
Point Q consists of a y-value mod p (256 bits); the x-value is always positive.
an ECC signature using Edx25519 (same as in EdDSA).
unsigned char s[256/8]
S value.
unsigned char r[256/8]
R value.
Context used when hashing a file.
GNUNET_CRYPTO_HashCompletedCallback callback
Function to call upon completion.
void * callback_cls
Closure for callback.
enum GNUNET_SCHEDULER_Priority priority
Priority we use.
This is the encapsulated key of our FO-KEM.
struct GNUNET_CRYPTO_EcdhePublicKey pub
struct GNUNET_HashCode y
0-terminated ASCII encoding of a struct GNUNET_HashCode.
int32_t remaining_ops
Guaranteed minimum number of homomorphic operations with this ciphertext, in network byte order (NBO)...
unsigned char bits[2048 *2/8]
The bits of the ciphertext.
unsigned char mu[2048/8]
Mu-component of the private key.
unsigned char lambda[2048/8]
Lambda-component of the private key.
unsigned char n[2048/8]
N value.
Value for a salt for GNUNET_CRYPTO_pow_hash().
char salt[crypto_pwhash_argon2id_SALTBYTES]
A private key for an identity as per LSD0001.
uint32_t type
Type of public key.
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key
AN EdDSA identtiy key.
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key
An ECDSA identity key.
An identity key as per LSD0001.
uint32_t type
Type of public key.
struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key
An ECDSA identity key.
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key
AN EdDSA identtiy key.
RSA Parameters to create blinded 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!
Constant-size pre-secret for blinding key generation.
uint32_t pre_secret[8]
Bits used to generate the blinding key.
The private information of an RSA key pair.
Definition: crypto_rsa.c:41
The public information of an RSA key pair.
Definition: crypto_rsa.c:53
an RSA signature
Definition: crypto_rsa.c:65
An identity signature as per LSD0001.
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature
AN EdDSA signature.
struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature
An ECDSA signature.
uint32_t type
Type of signature.
unsigned char twofish_key[(256/8)]
Actual key for TwoFish.
unsigned char aes_key[(256/8)]
Actual key for AES.
Type of (unblinded) signatures.
struct GNUNET_CRYPTO_RsaSignature * rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
unsigned int rc
Reference counter.
union GNUNET_CRYPTO_UnblindedSignature::@14 details
Details, depending on cipher.
struct GNUNET_CRYPTO_CsSignature cs_signature
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
A 256-bit hashcode.
A UUID, a 128 bit "random" value.
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.