GNUnet 0.21.2
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{
360 unsigned char r[256 / 8];
361};
362
367{
373
380
387{
393 uint32_t type;
394
395 union
396 {
401
406 };
407};
408
409
414{
420 uint32_t type;
421
422 union
423 {
428
433 };
434};
435
436
441{
447 uint32_t type;
448
449 union
450 {
455
460 };
461};
462
467{
472
477};
478
483{
488};
489
491
499{
501
503};
504
505
510{
512};
513
514
519#define GNUNET_CRYPTO_PAILLIER_BITS 2048
520
521
526{
530 unsigned char n[GNUNET_CRYPTO_PAILLIER_BITS / 8];
531};
532
533
538{
546 unsigned char mu[GNUNET_CRYPTO_PAILLIER_BITS / 8];
547};
548
549
554{
560
564 unsigned char bits[GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8];
565};
566
567
572{
576 unsigned char d[crypto_core_ed25519_SCALARBYTES];
577};
578
579
584{
589 unsigned char y[crypto_core_ed25519_BYTES];
590};
591
592
597{
599};
600
601
606{
608};
609
610
615{
618};
619
620
625{
627};
628
629
634{
636};
637
638
643{
645};
646
647
652{
654};
655
656
661{
663};
664
665
670{
675
680};
681
682
688{
689 /*a nonce*/
690 unsigned char snonce[256 / 8];
691};
692
693
699{
700 /*a nonce*/
701 unsigned char bnonce[256 / 8];
702};
703
704
705/* **************** Functions and Macros ************* */
706
714void
715GNUNET_CRYPTO_seed_weak_random (int32_t seed);
716
717
726uint8_t
727GNUNET_CRYPTO_crc8_n (const void *buf, size_t len);
728
729
738uint32_t
739GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len);
740
741
748uint16_t
750
751
760uint16_t
761GNUNET_CRYPTO_crc16_n (const void *buf, size_t len);
762
763
773int32_t
774GNUNET_CRYPTO_crc32_n (const void *buf, size_t len);
775
784void
785GNUNET_CRYPTO_zero_keys (void *buffer, size_t length);
786
787
796void
798 void *buffer,
799 size_t length);
800
801
812void
814 struct GNUNET_Uuid *uuid);
815
816
825uint32_t
827
828
837uint64_t
839
840
850unsigned int *
852
853
860void
863
864
876ssize_t
878 const void *block,
879 size_t size,
880 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
882 void *result);
883
884
896ssize_t
898 const void *block,
899 size_t size,
900 const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
902 void *result);
903
904
914void
917 const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
918 const void *salt,
919 size_t salt_len,
920 ...);
921
922
931void
934 const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
935 const void *salt,
936 size_t salt_len,
937 va_list argp);
938
939
947void
948GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block,
950
951
963 size_t enclen,
964 struct GNUNET_HashCode *result);
965
966
975#define GNUNET_CRYPTO_hash_from_string(enc, result) \
976 GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result)
977
978
991uint32_t
993 const struct GNUNET_HashCode *b);
994
995
1004void
1005GNUNET_CRYPTO_hash (const void *block,
1006 size_t size,
1007 struct GNUNET_HashCode *ret);
1008
1009
1014{
1015 char salt[crypto_pwhash_argon2id_SALTBYTES];
1016};
1017
1018
1027void
1029 const void *buf,
1030 size_t buf_len,
1031 struct GNUNET_HashCode *result);
1032
1033
1037struct GNUNET_HashContext;
1038
1039
1045struct GNUNET_HashContext *
1047
1048
1055struct GNUNET_HashContext *
1057
1058
1066void
1068 const void *buf,
1069 size_t size);
1070
1071
1078void
1080 struct GNUNET_HashCode *r_hash);
1081
1082
1088void
1090
1091
1103void
1104GNUNET_CRYPTO_hmac_raw (const void *key,
1105 size_t key_len,
1106 const void *plaintext,
1107 size_t plaintext_len,
1108 struct GNUNET_HashCode *hmac);
1109
1110
1120void
1122 const void *plaintext,
1123 size_t plaintext_len,
1124 struct GNUNET_HashCode *hmac);
1125
1126
1134typedef void
1136 void *cls,
1137 const struct GNUNET_HashCode *res);
1138
1139
1144
1145
1159 const char *filename,
1160 size_t blocksize,
1162 void *callback_cls);
1163
1164
1170void
1172
1173
1181void
1183 struct GNUNET_HashCode *result);
1184
1185
1194void
1196 const struct GNUNET_HashCode *b,
1197 struct GNUNET_HashCode *result);
1198
1199
1208void
1210 const struct GNUNET_HashCode *delta,
1211 struct GNUNET_HashCode *result);
1212
1213
1222void
1224 const struct GNUNET_HashCode *b,
1225 struct GNUNET_HashCode *result);
1226
1227
1234unsigned int
1236
1237
1244unsigned int
1246
1247
1256void
1258 const struct GNUNET_HashCode *hc,
1261
1262
1272int
1273GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1,
1274 const struct GNUNET_HashCode *h2);
1275
1276
1287int
1289 const struct GNUNET_HashCode *h2,
1290 const struct GNUNET_HashCode *target);
1291
1292
1302void
1304 struct GNUNET_CRYPTO_AuthKey *key,
1305 const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
1306 const void *salt,
1307 size_t salt_len,
1308 va_list argp);
1309
1310
1320void
1322 struct GNUNET_CRYPTO_AuthKey *key,
1323 const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
1324 const void *salt,
1325 size_t salt_len,
1326 ...);
1327
1328
1341 const void *salt,
1342 size_t salt_len,
1343 const void *ikm,
1344 size_t ikm_len);
1345
1356 size_t out_len,
1357 const struct GNUNET_ShortHashCode *prk,
1358 ...);
1359
1370 size_t out_len,
1371 const struct GNUNET_ShortHashCode *prk,
1372 va_list argp);
1373
1374
1397 size_t out_len,
1398 const void *xts,
1399 size_t xts_len,
1400 const void *skm,
1401 size_t skm_len,
1402 ...);
1403
1404
1419 size_t out_len,
1420 const void *xts,
1421 size_t xts_len,
1422 const void *skm,
1423 size_t skm_len,
1424 va_list argp);
1425
1426
1440 size_t out_len,
1441 const void *xts,
1442 size_t xts_len,
1443 const void *skm,
1444 size_t skm_len,
1445 va_list argp);
1446
1447
1460void
1461GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
1462 gcry_mpi_t n,
1463 const void *xts,
1464 size_t xts_len,
1465 const void *skm,
1466 size_t skm_len,
1467 const char *ctx);
1468
1469
1484 size_t out_len,
1485 const void *xts,
1486 size_t xts_len,
1487 const void *skm,
1488 size_t skm_len,
1489 ...);
1490
1491
1499void
1501 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1503
1511void
1513 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1515
1523void
1525 const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv,
1527
1535void
1537 const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1539
1540
1547char *
1549 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1550
1557char *
1559 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv);
1560
1561
1568char *
1570 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1571
1572
1579char *
1581 const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1582
1583
1594 const char *enc,
1595 size_t enclen,
1597
1598
1609 const char *enc,
1610 size_t enclen,
1611 struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1612
1613
1624 const char *enc,
1625 size_t enclen,
1627
1628
1646 int do_create,
1648
1649
1667 int do_create,
1669
1670
1675
1676
1688 const struct GNUNET_CONFIGURATION_Handle *cfg);
1689
1690
1697void
1699
1700
1707void
1709
1710
1717void
1719
1729void
1731 const void *seed,
1732 size_t seedsize,
1734
1744void
1746
1747
1754void
1756
1757
1764void
1766
1773void
1775
1782void
1784
1791void
1793
1794
1801const struct GNUNET_CRYPTO_EcdsaPrivateKey *
1803
1804
1814void
1816
1817
1829 struct GNUNET_PeerIdentity *dst);
1830
1831
1845 const struct
1847 struct GNUNET_CRYPTO_EddsaSignature *sig);
1848
1849
1861GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose,
1862 const struct
1864 const struct
1866 const struct GNUNET_PeerIdentity *identity);
1867
1868
1873
1874
1880{
1885 unsigned char v[256 / 8];
1886};
1887
1892{
1893 unsigned char v[256 / 8];
1894};
1895
1905 unsigned int mem);
1906
1907
1916int
1918 const struct GNUNET_CRYPTO_EccPoint *input);
1919
1920
1932void
1933GNUNET_CRYPTO_ecc_dexp (int val,
1934 struct GNUNET_CRYPTO_EccPoint*r);
1935
1936
1947 struct GNUNET_CRYPTO_EccPoint *r);
1948
1949
1960 const struct GNUNET_CRYPTO_EccScalar *val,
1961 struct GNUNET_CRYPTO_EccPoint *r);
1962
1963
1974 const struct GNUNET_CRYPTO_EccPoint *b,
1975 struct GNUNET_CRYPTO_EccPoint *r);
1976
1977
1988 struct GNUNET_CRYPTO_EccPoint *r_inv);
1989
1990
1998void
2000 struct GNUNET_CRYPTO_EccScalar *r_neg);
2001
2002
2008void
2010
2011
2017void
2019
2020
2027void
2029 struct GNUNET_CRYPTO_EccScalar *r);
2030
2031
2046 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2047 struct GNUNET_HashCode *key_material);
2048
2049
2066 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2067 struct GNUNET_HashCode *key_material);
2068
2069
2088 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2089 struct GNUNET_HashCode *key_material);
2090
2091
2105 const struct GNUNET_CRYPTO_EcdhePublicKey *c,
2106 struct GNUNET_HashCode *key_material);
2107
2121 struct GNUNET_HashCode *key_material);
2122
2127{
2128 /* The output of the FO-OWTF F(x) */
2130
2131 /* The ephemeral public key from the DH in the KEM */
2133};
2134
2149 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2150 struct GNUNET_CRYPTO_FoKemC *c,
2151 struct GNUNET_HashCode *key_material);
2152
2153
2169 const struct GNUNET_CRYPTO_FoKemC *c,
2170 struct GNUNET_HashCode *key_material);
2171
2187 struct GNUNET_CRYPTO_FoKemC *c,
2188 struct GNUNET_HashCode *key_material);
2189
2190
2206 struct GNUNET_CRYPTO_FoKemC *c,
2207 struct GNUNET_HashCode *key_material);
2208
2221 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2222 struct GNUNET_HashCode *key_material);
2223
2224
2244 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2245 struct GNUNET_HashCode *key_material);
2246
2247
2266 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2267 struct GNUNET_HashCode *key_material);
2268
2281 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
2282 struct GNUNET_HashCode *key_material);
2283
2284
2302 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2303 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2304 struct GNUNET_CRYPTO_EddsaSignature *sig);
2305
2306
2319#define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \
2320 /* check size is set correctly */ \
2321 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \
2322 /* check 'ps' begins with the purpose */ \
2323 GNUNET_static_assert (((void*) (ps)) == \
2324 ((void*) &(ps)->purpose)); \
2325 GNUNET_assert (GNUNET_OK == \
2326 GNUNET_CRYPTO_eddsa_sign_ (priv, \
2327 &(ps)->purpose, \
2328 sig)); \
2329} while (0)
2330
2331
2349 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
2350 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2351 struct GNUNET_CRYPTO_EcdsaSignature *sig);
2352
2364 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2365 void *data,
2366 size_t size,
2367 struct GNUNET_CRYPTO_EddsaSignature *sig);
2368
2381#define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \
2382 /* check size is set correctly */ \
2383 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2384 /* check 'ps' begins with the purpose */ \
2385 GNUNET_static_assert (((void*) (ps)) == \
2386 ((void*) &(ps)->purpose)); \
2387 GNUNET_assert (GNUNET_OK == \
2388 GNUNET_CRYPTO_ecdsa_sign_ (priv, \
2389 &(ps)->purpose, \
2390 sig)); \
2391} while (0)
2392
2410 const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv,
2411 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2413
2414
2428#define GNUNET_CRYPTO_edx25519_sign(priv,ps,sig) do { \
2429 /* check size is set correctly */ \
2430 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2431 /* check 'ps' begins with the purpose */ \
2432 GNUNET_static_assert (((void*) (ps)) == \
2433 ((void*) &(ps)->purpose)); \
2434 GNUNET_assert (GNUNET_OK == \
2435 GNUNET_CRYPTO_edx25519_sign_ (priv, \
2436 &(ps)->purpose, \
2437 sig)); \
2438} while (0)
2439
2440
2461 uint32_t purpose,
2462 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
2463 const struct GNUNET_CRYPTO_EddsaSignature *sig,
2464 const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
2465
2466
2481#define GNUNET_CRYPTO_eddsa_verify(purp,ps,sig,pub) ({ \
2482 /* check size is set correctly */ \
2483 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2484 /* check 'ps' begins with the purpose */ \
2485 GNUNET_static_assert (((void*) (ps)) == \
2486 ((void*) &(ps)->purpose)); \
2487 GNUNET_CRYPTO_eddsa_verify_ (purp, \
2488 &(ps)->purpose, \
2489 sig, \
2490 pub); \
2491 })
2492
2513 uint32_t purpose,
2514 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
2515 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
2516 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
2517
2518
2533#define GNUNET_CRYPTO_ecdsa_verify(purp,ps,sig,pub) ({ \
2534 /* check size is set correctly */ \
2535 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2536 /* check 'ps' begins with the purpose */ \
2537 GNUNET_static_assert (((void*) (ps)) == \
2538 ((void*) &(ps)->purpose)); \
2539 GNUNET_CRYPTO_ecdsa_verify_ (purp, \
2540 &(ps)->purpose, \
2541 sig, \
2542 pub); \
2543 })
2544
2565 uint32_t purpose,
2566 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
2567 const struct GNUNET_CRYPTO_Edx25519Signature *sig,
2568 const struct GNUNET_CRYPTO_Edx25519PublicKey *pub);
2569
2570
2585#define GNUNET_CRYPTO_edx25519_verify(purp,ps,sig,pub) ({ \
2586 /* check size is set correctly */ \
2587 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2588 /* check 'ps' begins with the purpose */ \
2589 GNUNET_static_assert (((void*) (ps)) == \
2590 ((void*) &(ps)->purpose)); \
2591 GNUNET_CRYPTO_edx25519_verify_ (purp, \
2592 &(ps)->purpose, \
2593 sig, \
2594 pub); \
2595 })
2596
2612 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
2613 const char *label,
2614 const char *context);
2615
2616
2628void
2630 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
2631 const char *label,
2632 const char *context,
2634
2649 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
2650 const char *label,
2651 const char *context,
2652 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2653 struct GNUNET_CRYPTO_EcdsaSignature *sig);
2654
2655
2672void
2674 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2675 const char *label,
2676 const char *context,
2678
2679
2691void
2693 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2694 const char *label,
2695 const char *context,
2697
2698
2714 const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey,
2715 const char *label,
2716 const char *context,
2717 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
2718 struct GNUNET_CRYPTO_EddsaSignature *sig);
2719
2720
2727void
2729 const struct GNUNET_CRYPTO_EddsaPrivateScalar *s,
2731
2744void
2746 const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv,
2747 const void *seed,
2748 size_t seedsize,
2750
2751
2762void
2765 const void *seed,
2766 size_t seedsize,
2768
2769
2778void
2780 struct GNUNET_CRYPTO_EcdhePublicKey *point,
2781 bool *high_y,
2782 const struct GNUNET_CRYPTO_ElligatorRepresentative *representative);
2783
2794bool
2797 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2798 bool high_y);
2799
2800
2814
2815
2823void
2827
2840 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2842 struct GNUNET_HashCode *key_material);
2843
2856 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2858 struct GNUNET_HashCode *key_material);
2859
2860
2869void
2871 size_t size,
2872 gcry_mpi_t val);
2873
2874
2884void
2886 const void *data,
2887 size_t size);
2888
2889
2896void
2898 struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2899 struct GNUNET_CRYPTO_PaillierPrivateKey *private_key);
2900
2901
2913int
2915 const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2916 const gcry_mpi_t m,
2917 int desired_ops,
2918 struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext);
2919
2920
2929void
2931 const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key,
2932 const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2933 const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext,
2934 gcry_mpi_t m);
2935
2936
2951int
2953 const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
2954 const struct GNUNET_CRYPTO_PaillierCiphertext *c1,
2955 const struct GNUNET_CRYPTO_PaillierCiphertext *c2,
2957
2958
2965int
2967 const struct GNUNET_CRYPTO_PaillierCiphertext *c);
2968
2969
2970/* ********* Chaum-style RSA-based blind signatures ******************* */
2971
2972
2977
2982
2987{
2993};
2994
2999
3000
3008GNUNET_CRYPTO_rsa_private_key_create (unsigned int len);
3009
3010
3016void
3018
3019
3028size_t
3030 const struct GNUNET_CRYPTO_RsaPrivateKey *key,
3031 void **buffer);
3032
3033
3044 size_t buf_size);
3045
3046
3055 const struct GNUNET_CRYPTO_RsaPrivateKey *key);
3056
3057
3066 const struct GNUNET_CRYPTO_RsaPrivateKey *priv);
3067
3068
3075void
3077 const struct GNUNET_CRYPTO_RsaPublicKey *key,
3078 struct GNUNET_HashCode *hc);
3079
3080
3086bool
3088 const struct GNUNET_CRYPTO_RsaPublicKey *key);
3089
3096unsigned int
3098
3099
3105void
3107
3108
3117size_t
3119 const struct GNUNET_CRYPTO_RsaPublicKey *key,
3120 void **buffer);
3121
3122
3133 size_t len);
3134
3135
3144
3145
3153int
3155 const struct GNUNET_CRYPTO_RsaSignature *s2);
3156
3164int
3166 const struct GNUNET_CRYPTO_RsaPrivateKey *p1,
3167 const struct GNUNET_CRYPTO_RsaPrivateKey *p2);
3168
3169
3177int
3179 const struct GNUNET_CRYPTO_RsaPublicKey *p2);
3180
3181
3186{
3192
3197};
3198
3199
3211GNUNET_CRYPTO_rsa_blind (const void *message,
3212 size_t message_size,
3213 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
3216
3217
3227 const struct
3229
3230
3241 const void *message,
3242 size_t message_size);
3243
3244
3251void
3254
3255
3261void
3263
3264
3272size_t
3274 const struct GNUNET_CRYPTO_RsaSignature *sig,
3275 void **buffer);
3276
3277
3288 const void *buf,
3289 size_t buf_size);
3290
3291
3300 const struct GNUNET_CRYPTO_RsaSignature *sig);
3301
3302
3315 const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
3317
3318
3330GNUNET_CRYPTO_rsa_verify (const void *message,
3331 size_t message_size,
3332 const struct GNUNET_CRYPTO_RsaSignature *sig,
3333 const struct GNUNET_CRYPTO_RsaPublicKey *public_key);
3334
3335
3341void
3343
3344
3351void
3353 const struct GNUNET_CRYPTO_CsPrivateKey *priv,
3355
3356
3370void
3372 const struct GNUNET_CRYPTO_CsSessionNonce *nonce,
3373 const char *seed,
3374 const struct GNUNET_CRYPTO_CsPrivateKey *lts,
3375 struct GNUNET_CRYPTO_CsRSecret r[2]);
3376
3377
3384void
3386 const struct GNUNET_CRYPTO_CsRSecret *r_priv,
3387 struct GNUNET_CRYPTO_CsRPublic *r_pub);
3388
3389
3400void
3402 const struct GNUNET_CRYPTO_CsBlindingNonce *blind_seed,
3403 struct GNUNET_CRYPTO_CsBlindingSecret bs[2]);
3404
3405
3411{
3416
3421
3422};
3423
3424
3429{
3431};
3432
3433
3446void
3448 const struct GNUNET_CRYPTO_CsBlindingSecret bs[2],
3449 const struct GNUNET_CRYPTO_CsRPublic r_pub[2],
3450 const struct GNUNET_CRYPTO_CsPublicKey *pub,
3451 const void *msg,
3452 size_t msg_len,
3453 struct GNUNET_CRYPTO_CsC blinded_c[2],
3454 struct GNUNET_CRYPTO_CSPublicRPairP *r_pub_blind);
3455
3456
3463{
3468 unsigned int b;
3469
3474};
3475
3476
3491void
3493 const struct GNUNET_CRYPTO_CsPrivateKey *priv,
3494 const struct GNUNET_CRYPTO_CsRSecret r[2],
3495 const struct GNUNET_CRYPTO_CsBlindedMessage *bm,
3496 struct GNUNET_CRYPTO_CsBlindSignature *cs_blind_sig);
3497
3498
3506void
3508 const struct GNUNET_CRYPTO_CsBlindS *blinded_signature_scalar,
3509 const struct GNUNET_CRYPTO_CsBlindingSecret *bs,
3510 struct GNUNET_CRYPTO_CsS *signature_scalar);
3511
3512
3525 const struct GNUNET_CRYPTO_CsSignature *sig,
3526 const struct GNUNET_CRYPTO_CsPublicKey *pub,
3527 const void *msg,
3528 size_t msg_len);
3529
3530
3535{
3536
3541
3546
3552
3553
3558{
3559
3564
3568 unsigned int rc;
3569
3573 union
3574 {
3579
3584
3586
3587};
3588
3589
3595{
3596
3601
3605 unsigned int rc;
3606
3610 union
3611 {
3618
3623
3625
3626};
3627
3628
3633{
3634
3639
3643 unsigned int rc;
3644
3649
3653 union
3654 {
3659
3664
3666};
3667
3668
3673{
3674
3679
3683 unsigned int rc;
3684
3688 union
3689 {
3694
3699
3701};
3702
3703
3708{
3713
3717 unsigned int rc;
3718
3722 union
3723 {
3728
3733
3735};
3736
3737
3742{
3744};
3745
3746
3751{
3752
3757
3761 unsigned int rc;
3762
3766 union
3767 {
3772
3774
3775};
3776
3777
3783{
3788};
3789
3790
3802 const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv,
3803 const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
3804 const char *salt);
3805
3806
3812void
3814 struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub);
3815
3816
3822void
3824 struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv);
3825
3826
3832void
3834 struct GNUNET_CRYPTO_UnblindedSignature *ub_sig);
3835
3836
3842void
3844 struct GNUNET_CRYPTO_BlindedSignature *blind_sig);
3845
3846
3852void
3854 struct GNUNET_CRYPTO_BlindedMessage *bm);
3855
3856
3865 struct GNUNET_CRYPTO_BlindedMessage *bm);
3866
3867
3877
3878
3885void
3888
3889
3898 struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub);
3899
3900
3909 struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv);
3910
3911
3920
3921
3930 struct GNUNET_CRYPTO_BlindedSignature *blind_sig);
3931
3932
3940int
3942 const struct GNUNET_CRYPTO_BlindSignPublicKey *bp1,
3943 const struct GNUNET_CRYPTO_BlindSignPublicKey *bp2);
3944
3945
3953int
3955 const struct GNUNET_CRYPTO_UnblindedSignature *sig2);
3956
3957
3965int
3967 const struct GNUNET_CRYPTO_BlindedSignature *sig1,
3968 const struct GNUNET_CRYPTO_BlindedSignature *sig2);
3969
3970
3978int
3980 const struct GNUNET_CRYPTO_BlindedMessage *bp1,
3981 const struct GNUNET_CRYPTO_BlindedMessage *bp2);
3982
3983
3999 struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv,
4000 struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub,
4002 ...);
4003
4004
4020 struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv,
4021 struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub,
4023 va_list ap);
4024
4025
4030{
4035
4040};
4041
4042
4057 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub,
4058 const union GNUNET_CRYPTO_BlindingSecretP *bks,
4059 const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
4060 const void *message,
4061 size_t message_size,
4062 const struct GNUNET_CRYPTO_BlindingInputValues *alg_values);
4063
4064
4076 const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv,
4077 const char *salt,
4078 const struct GNUNET_CRYPTO_BlindedMessage *blinded_message);
4079
4080
4094 const struct GNUNET_CRYPTO_BlindedSignature *blinded_sig,
4095 const union GNUNET_CRYPTO_BlindingSecretP *bks,
4096 const void *message,
4097 size_t message_size,
4098 const struct GNUNET_CRYPTO_BlindingInputValues *alg_values,
4099 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub);
4100
4101
4113 const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub,
4114 const struct GNUNET_CRYPTO_UnblindedSignature *ub_sig,
4115 const void *message,
4116 size_t message_size);
4117
4118
4129ssize_t
4132
4148 const void *buffer,
4149 size_t len,
4151 size_t *read);
4152
4163ssize_t
4165 const struct GNUNET_CRYPTO_PrivateKey *key);
4166
4167
4180ssize_t
4183 void*buffer,
4184 size_t len);
4185
4186
4201 const void*buffer,
4202 size_t len,
4204 size_t *read);
4205
4206
4219ssize_t
4221 const struct GNUNET_CRYPTO_PrivateKey *key,
4222 void*buffer,
4223 size_t len);
4224
4225
4236ssize_t
4238 const struct GNUNET_CRYPTO_Signature *sig);
4239
4240
4251ssize_t
4253
4254
4267ssize_t
4269 struct GNUNET_CRYPTO_Signature *sig,
4270 const void*buffer,
4271 size_t len);
4272
4273
4286ssize_t
4288 const struct GNUNET_CRYPTO_Signature *sig,
4289 void*buffer,
4290 size_t len);
4291
4292
4308 const struct GNUNET_CRYPTO_PrivateKey *priv,
4309 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
4310 struct GNUNET_CRYPTO_Signature *sig);
4311
4327 const struct GNUNET_CRYPTO_PrivateKey *priv,
4328 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
4329 unsigned char *sig);
4330
4331
4343#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \
4344 /* check size is set correctly */ \
4345 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
4346 /* check 'ps' begins with the purpose */ \
4347 GNUNET_static_assert (((void*) (ps)) == \
4348 ((void*) &(ps)->purpose)); \
4349 GNUNET_assert (GNUNET_OK == \
4350 GNUNET_CRYPTO_sign_ (priv, \
4351 &(ps)->purpose, \
4352 sig)); \
4353} while (0)
4354
4355
4375 uint32_t purpose,
4376 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
4377 const struct GNUNET_CRYPTO_Signature *sig,
4378 const struct GNUNET_CRYPTO_PublicKey *pub);
4379
4397 uint32_t purpose,
4398 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
4399 const unsigned char *sig,
4400 const struct GNUNET_CRYPTO_PublicKey *pub);
4401
4402
4416#define GNUNET_CRYPTO_signature_verify(purp,ps,sig,pub) ({ \
4417 /* check size is set correctly */ \
4418 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
4419 /* check 'ps' begins with the purpose */ \
4420 GNUNET_static_assert (((void*) (ps)) == \
4421 ((void*) &(ps)->purpose)); \
4422 GNUNET_CRYPTO_signature_verify_ (purp, \
4423 &(ps)->purpose, \
4424 sig, \
4425 pub); \
4426 })
4427
4428
4444ssize_t
4445GNUNET_CRYPTO_encrypt_old (const void *block,
4446 size_t size,
4447 const struct GNUNET_CRYPTO_PublicKey *pub,
4448 struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
4449 void *result);
4450
4451
4466ssize_t
4468 const void *block,
4469 size_t size,
4470 const struct GNUNET_CRYPTO_PrivateKey *priv,
4471 const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
4472 void *result);
4473
4474#define GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \
4475 + sizeof (struct \
4476 GNUNET_CRYPTO_FoKemC))
4477
4494GNUNET_CRYPTO_encrypt (const void *block,
4495 size_t size,
4496 const struct GNUNET_CRYPTO_PublicKey *pub,
4497 void *result,
4498 size_t result_size);
4499
4500
4513GNUNET_CRYPTO_decrypt (const void *block,
4514 size_t size,
4515 const struct GNUNET_CRYPTO_PrivateKey *priv,
4516 void *result,
4517 size_t result_size);
4518
4519
4528char *
4530 const struct GNUNET_CRYPTO_PublicKey *key);
4531
4532
4541char *
4543 const struct GNUNET_CRYPTO_PrivateKey *key);
4544
4545
4557
4558
4570
4571
4580GNUNET_CRYPTO_key_get_public (const struct
4581 GNUNET_CRYPTO_PrivateKey *privkey,
4583
4584#if 0 /* keep Emacsens' auto-indent happy */
4585{
4586#endif
4587#ifdef __cplusplus
4588}
4589#endif
4590
4591
4592/* ifndef GNUNET_CRYPTO_LIB_H */
4593#endif
4594 /* end of group addition */
4596
4597/* 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 calculations.
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:1009
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:731
void GNUNET_CRYPTO_ecdhe_key_create(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:453
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:834
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_ecdh_kdf(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:766
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.
bool GNUNET_CRYPTO_ecdhe_elligator_encoding(struct GNUNET_CRYPTO_ElligatorRepresentative *r, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, bool high_y)
Encodes a point on Curve25519 to a an element of the underlying finite field.
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.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_elligator_kem_encaps(const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_CRYPTO_ElligatorRepresentative *r, struct GNUNET_HashCode *key_material)
Carries out ecdh encapsulation with given public key and the private key from a freshly created ephem...
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:925
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:200
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:844
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:446
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:553
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:892
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:879
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:744
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:1025
void GNUNET_CRYPTO_eddsa_key_create(struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:479
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.
void GNUNET_CRYPTO_ecdhe_elligator_decoding(struct GNUNET_CRYPTO_EcdhePublicKey *point, bool *high_y, const struct GNUNET_CRYPTO_ElligatorRepresentative *representative)
Clears the most significant bit and second most significant bit of the serialized representaive befor...
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:862
GNUNET_CRYPTO_Quality
Desired quality level for random numbers.
void GNUNET_CRYPTO_ecdhe_elligator_key_create(struct GNUNET_CRYPTO_ElligatorRepresentative *repr, struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Generates a private key for Curve25519 and the elligator representative of the corresponding public k...
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:464
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:624
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:439
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:648
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:993
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:499
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_eddsa_kdf(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:798
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:189
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:707
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_private_key_clear(struct GNUNET_CRYPTO_PrivateKey *pk)
Clear memory that was used to store a private key.
Definition: crypto_pkey.c:47
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_elligator_kem_decaps(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_ElligatorRepresentative *r, struct GNUNET_HashCode *key_material)
Carries out ecdh decapsulation with own private key and the representative of the received public key...
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:432
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:216
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdhe_elligator_generate_public_key(struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Generates a valid public key for elligator's inverse map by adding a lower order point to a prime ord...
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.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_extract(struct GNUNET_ShortHashCode *prk, const void *salt, size_t salt_len, const void *ikm, size_t ikm_len)
HKDF-Extract using SHA256.
Definition: crypto_hkdf.c:224
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
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_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
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_gnunet(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
A peculiar HKDF instantiation that tried to mimic Truncated NMAC.
Definition: crypto_hkdf.c:199
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
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_gnunet_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_hkdf.c:172
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
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_expand(void *result, size_t out_len, const struct GNUNET_ShortHashCode *prk,...)
HKDF-Expand using SHA256.
Definition: crypto_hkdf.c:156
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:62
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
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_expand_v(void *result, size_t out_len, const struct GNUNET_ShortHashCode *prk, va_list argp)
HKDF-Expand using SHA256.
Definition: crypto_hkdf.c:144
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:281
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:281
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:363
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:603
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:243
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:85
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:334
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:533
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:87
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:568
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:335
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:433
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:604
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:145
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:619
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:308
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:318
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:254
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:360
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:578
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:394
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:225
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:263
#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:240
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:64
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:188
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:227
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:484
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:206
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:385
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:308
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:330
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:120
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:284
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:163
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:588
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.
Elligator representative (always for Curve25519)
unsigned char r[256/8]
Represents an element of Curve25519 finite field.
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.