GNUnet  0.11.x
gnunet_crypto_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2001-2013 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 
43 #ifndef GNUNET_CRYPTO_LIB_H
44 #define GNUNET_CRYPTO_LIB_H
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #if 0 /* keep Emacsens' auto-indent happy */
49 }
50 #endif
51 #endif
52 
53 
57 struct GNUNET_PeerIdentity;
58 
59 #include "gnunet_common.h"
60 #include <gcrypt.h>
61 
62 
67 #define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126
68 
69 
75 {
82 
88 
94 };
95 
96 
100 #define GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8)
101 
105 #define GNUNET_CRYPTO_HASH_LENGTH (512 / 8)
106 
111 #define GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52
112 
117 {
118  unsigned char encoding[104];
119 };
120 
121 
123 
124 
131 {
137  uint32_t size GNUNET_PACKED;
138 
145  uint32_t purpose GNUNET_PACKED;
146 };
147 
148 
154 {
158  unsigned char r[256 / 8];
159 
163  unsigned char s[256 / 8];
164 };
165 
166 
171 {
175  unsigned char r[256 / 8];
176 
180  unsigned char s[256 / 8];
181 };
182 
183 
189 {
195  unsigned char q_y[256 / 8];
196 };
197 
198 
204 {
209  unsigned char q_y[256 / 8];
210 };
211 
212 
217 {
218  struct GNUNET_CRYPTO_EddsaPublicKey public_key;
219 };
220 
221 
228 {
233  unsigned char q_y[256 / 8];
234 };
235 
236 
242 {
246  unsigned char d[256 / 8];
247 };
248 
254 {
258  unsigned char d[256 / 8];
259 };
260 
266 {
270  unsigned char d[256 / 8];
271 };
272 
273 
278 {
282  unsigned char aes_key[GNUNET_CRYPTO_AES_KEY_LENGTH];
283 
287  unsigned char twofish_key[GNUNET_CRYPTO_AES_KEY_LENGTH];
288 };
289 
291 
299 {
300  unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
301 
302  unsigned char twofish_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
303 };
304 
305 
310 {
312 };
313 
314 
319 #define GNUNET_CRYPTO_PAILLIER_BITS 2048
320 
321 
326 {
330  unsigned char n[GNUNET_CRYPTO_PAILLIER_BITS / 8];
331 };
332 
333 
338 {
342  unsigned char lambda[GNUNET_CRYPTO_PAILLIER_BITS / 8];
346  unsigned char mu[GNUNET_CRYPTO_PAILLIER_BITS / 8];
347 };
348 
349 
354 {
359  int32_t remaining_ops GNUNET_PACKED;
360 
364  unsigned char bits[GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8];
365 };
366 
367 
368 /* **************** Functions and Macros ************* */
369 
377 void
378 GNUNET_CRYPTO_seed_weak_random (int32_t seed);
379 
380 
389 uint8_t
390 GNUNET_CRYPTO_crc8_n (const void *buf, size_t len);
391 
392 
401 uint32_t
402 GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len);
403 
404 
411 uint16_t
412 GNUNET_CRYPTO_crc16_finish (uint32_t sum);
413 
414 
423 uint16_t
424 GNUNET_CRYPTO_crc16_n (const void *buf, size_t len);
425 
426 
436 int32_t
437 GNUNET_CRYPTO_crc32_n (const void *buf, size_t len);
438 
447 void
448 GNUNET_CRYPTO_zero_keys (void *buffer, size_t length);
449 
450 
459 void
461  void *buffer,
462  size_t length);
463 
472 uint32_t
474 
475 
484 uint64_t
486 
487 
497 unsigned int *
499 
500 
507 void
510 
511 
523 ssize_t
525  const void *block,
526  size_t size,
527  const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
529  void *result);
530 
531 
543 ssize_t
545  const void *block,
546  size_t size,
547  const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
549  void *result);
550 
551 
561 void
564  const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
565  const void *salt,
566  size_t salt_len,
567  ...);
568 
569 
578 void
581  const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
582  const void *salt,
583  size_t salt_len,
584  va_list argp);
585 
586 
594 void
595 GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block,
597 
598 
608 int
610  size_t enclen,
611  struct GNUNET_HashCode *result);
612 
613 
622 #define GNUNET_CRYPTO_hash_from_string(enc, result) \
623  GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result)
624 
625 
638 uint32_t
640  const struct GNUNET_HashCode *b);
641 
642 
651 void
652 GNUNET_CRYPTO_hash (const void *block,
653  size_t size,
654  struct GNUNET_HashCode *ret);
655 
656 
660 struct GNUNET_HashContext;
661 
662 
668 struct GNUNET_HashContext *
670 
671 
679 void
681  const void *buf,
682  size_t size);
683 
684 
691 void
693  struct GNUNET_HashCode *r_hash);
694 
695 
701 void
703 
704 
716 void
717 GNUNET_CRYPTO_hmac_raw (const void *key,
718  size_t key_len,
719  const void *plaintext,
720  size_t plaintext_len,
721  struct GNUNET_HashCode *hmac);
722 
723 
733 void
735  const void *plaintext,
736  size_t plaintext_len,
737  struct GNUNET_HashCode *hmac);
738 
739 
748  void *cls,
749  const struct GNUNET_HashCode *res);
750 
751 
756 
757 
771  const char *filename,
772  size_t blocksize,
774  void *callback_cls);
775 
776 
782 void
784 
785 
793 void
795  struct GNUNET_HashCode *result);
796 
797 
806 void
808  const struct GNUNET_HashCode *b,
809  struct GNUNET_HashCode *result);
810 
811 
820 void
821 GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode *a,
822  const struct GNUNET_HashCode *delta,
823  struct GNUNET_HashCode *result);
824 
825 
834 void
835 GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode *a,
836  const struct GNUNET_HashCode *b,
837  struct GNUNET_HashCode *result);
838 
839 
848 void
850  const struct GNUNET_HashCode *hc,
853 
854 
863 int
864 GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code,
865  unsigned int bit);
866 
867 
880 unsigned int
882  const struct GNUNET_HashCode *second);
883 
884 
894 int
895 GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1,
896  const struct GNUNET_HashCode *h2);
897 
898 
909 int
911  const struct GNUNET_HashCode *h2,
912  const struct GNUNET_HashCode *target);
913 
914 
924 void
926  struct GNUNET_CRYPTO_AuthKey *key,
927  const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
928  const void *salt,
929  size_t salt_len,
930  va_list argp);
931 
932 
942 void
944  struct GNUNET_CRYPTO_AuthKey *key,
945  const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
946  const void *salt,
947  size_t salt_len,
948  ...);
949 
950 
965 int
967  size_t out_len,
968  int xtr_algo,
969  int prf_algo,
970  const void *xts,
971  size_t xts_len,
972  const void *skm,
973  size_t skm_len,
974  ...);
975 
976 
991 int
993  size_t out_len,
994  int xtr_algo,
995  int prf_algo,
996  const void *xts,
997  size_t xts_len,
998  const void *skm,
999  size_t skm_len,
1000  va_list argp);
1001 
1002 
1014 int
1016  size_t out_len,
1017  const void *xts,
1018  size_t xts_len,
1019  const void *skm,
1020  size_t skm_len,
1021  va_list argp);
1022 
1023 
1036 void
1037 GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
1038  gcry_mpi_t n,
1039  const void *xts,
1040  size_t xts_len,
1041  const void *skm,
1042  size_t skm_len,
1043  const char *ctx);
1044 
1045 
1058 int
1059 GNUNET_CRYPTO_kdf (void *result,
1060  size_t out_len,
1061  const void *xts,
1062  size_t xts_len,
1063  const void *skm,
1064  size_t skm_len,
1065  ...);
1066 
1067 
1075 void
1077  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1079 
1087 void
1089  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1091 
1092 
1100 void
1102  const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1104 
1105 
1112 char *
1114  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1115 
1122 char *
1124  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv);
1125 
1126 
1133 char *
1135  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1136 
1137 
1144 char *
1146  const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1147 
1148 
1157 int
1159  const char *enc,
1160  size_t enclen,
1162 
1163 
1172 int
1174  const char *enc,
1175  size_t enclen,
1177 
1178 
1187 int
1189  const char *enc,
1190  size_t enclen,
1192 
1193 
1211 
1212 
1230 
1231 
1236 
1237 
1249  const struct GNUNET_CONFIGURATION_Handle *cfg);
1250 
1251 
1260 
1261 
1270 
1271 
1279 int
1281 
1282 
1291 
1292 
1299 void
1301 
1302 
1309 void
1311 
1312 
1319 void
1321 
1322 
1329 const struct GNUNET_CRYPTO_EcdsaPrivateKey *
1331 
1332 
1342 void
1343 GNUNET_CRYPTO_eddsa_setup_hostkey (const char *cfg_name);
1344 
1345 
1355 int
1357  struct GNUNET_PeerIdentity *dst);
1358 
1359 
1364 
1365 
1371 {
1376  unsigned char q_y[256 / 8];
1377 };
1378 
1379 
1388 GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, unsigned int mem);
1389 
1390 
1399 int
1401  gcry_mpi_point_t input);
1402 
1403 
1417 gcry_mpi_point_t
1419 
1420 
1430 gcry_mpi_point_t
1432  gcry_mpi_t val);
1433 
1434 
1444 gcry_mpi_point_t
1446  gcry_mpi_point_t p,
1447  gcry_mpi_t val);
1448 
1449 
1457 void
1459  gcry_mpi_point_t point,
1460  struct GNUNET_CRYPTO_EccPoint *bin);
1461 
1462 
1470 gcry_mpi_point_t
1472  const struct GNUNET_CRYPTO_EccPoint *bin);
1473 
1474 
1483 gcry_mpi_point_t
1485  gcry_mpi_point_t a,
1486  gcry_mpi_point_t b);
1487 
1488 
1498 void
1500  gcry_mpi_point_t *r,
1501  gcry_mpi_point_t *r_inv);
1502 
1503 
1512 void
1514  gcry_mpi_t *r,
1515  gcry_mpi_t *r_inv);
1516 
1517 
1524 gcry_mpi_t
1526 
1527 
1533 void
1534 GNUNET_CRYPTO_ecc_free (gcry_mpi_point_t p);
1535 
1536 
1542 void
1544 
1545 
1555 int
1557  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1558  struct GNUNET_HashCode *key_material);
1559 
1560 
1571 int
1573  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1574  struct GNUNET_HashCode *key_material);
1575 
1586 int
1588  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1589  struct GNUNET_HashCode *key_material);
1590 
1591 
1602 int
1604  const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
1605  struct GNUNET_HashCode *key_material);
1606 
1617 int
1619  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1620  struct GNUNET_HashCode *key_material);
1621 
1622 
1632 int
1634  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1635  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1636  struct GNUNET_CRYPTO_EddsaSignature *sig);
1637 
1638 
1648 int
1650  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1651  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1652  struct GNUNET_CRYPTO_EcdsaSignature *sig);
1653 
1664 int
1666  uint32_t purpose,
1667  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1668  const struct GNUNET_CRYPTO_EddsaSignature *sig,
1669  const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1670 
1671 
1682 int
1684  uint32_t purpose,
1685  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1686  const struct GNUNET_CRYPTO_EcdsaSignature *sig,
1687  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1688 
1689 
1705  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1706  const char *label,
1707  const char *context);
1708 
1709 
1721 void
1723  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1724  const char *label,
1725  const char *context,
1727 
1728 
1737 void
1738 GNUNET_CRYPTO_mpi_print_unsigned (void *buf, size_t size, gcry_mpi_t val);
1739 
1740 
1750 void
1752  const void *data,
1753  size_t size);
1754 
1755 
1762 void
1764  struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1765  struct GNUNET_CRYPTO_PaillierPrivateKey *private_key);
1766 
1767 
1779 int
1781  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1782  const gcry_mpi_t m,
1783  int desired_ops,
1785 
1786 
1795 void
1797  const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key,
1798  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1800  gcry_mpi_t m);
1801 
1802 
1816 int
1818  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1819  const struct GNUNET_CRYPTO_PaillierCiphertext *c1,
1820  const struct GNUNET_CRYPTO_PaillierCiphertext *c2,
1822 
1823 
1830 int
1832  const struct GNUNET_CRYPTO_PaillierCiphertext *c);
1833 
1834 
1835 /* ********* Chaum-style RSA-based blind signatures ******************* */
1836 
1837 
1842 
1847 
1852 {
1857  uint32_t pre_secret[8] GNUNET_PACKED;
1858 };
1859 
1864 
1865 
1874 
1875 
1881 void
1883 
1884 
1893 size_t
1895  const struct GNUNET_CRYPTO_RsaPrivateKey *key,
1896  char **buffer);
1897 
1898 
1908 GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, size_t len);
1909 
1910 
1919  const struct GNUNET_CRYPTO_RsaPrivateKey *key);
1920 
1921 
1930  const struct GNUNET_CRYPTO_RsaPrivateKey *priv);
1931 
1932 
1939 void
1941  struct GNUNET_HashCode *hc);
1942 
1943 
1950 unsigned int
1952 
1953 
1959 void
1961 
1962 
1971 size_t
1973  const struct GNUNET_CRYPTO_RsaPublicKey *key,
1974  char **buffer);
1975 
1976 
1986 GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, size_t len);
1987 
1988 
1997 
1998 
2006 int
2008  struct GNUNET_CRYPTO_RsaSignature *s2);
2009 
2017 int
2019  struct GNUNET_CRYPTO_RsaPrivateKey *p2);
2020 
2021 
2029 int
2031  struct GNUNET_CRYPTO_RsaPublicKey *p2);
2032 
2033 
2044 int
2045 GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash,
2046  const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2048  char **buf,
2049  size_t *buf_size);
2050 
2051 
2062  const void *msg,
2063  size_t msg_len);
2064 
2065 
2075  const struct GNUNET_HashCode *hash);
2076 
2077 
2083 void
2085 
2086 
2094 size_t
2096  const struct GNUNET_CRYPTO_RsaSignature *sig,
2097  char **buffer);
2098 
2099 
2109 GNUNET_CRYPTO_rsa_signature_decode (const char *buf, size_t len);
2110 
2111 
2120 
2121 
2134  const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2136 
2137 
2147 int
2148 GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash,
2149  const struct GNUNET_CRYPTO_RsaSignature *sig,
2150  const struct GNUNET_CRYPTO_RsaPublicKey *public_key);
2151 
2152 
2153 #if 0 /* keep Emacsens' auto-indent happy */
2154 {
2155 #endif
2156 #ifdef __cplusplus
2157 }
2158 #endif
2159 
2160 
2161 /* ifndef GNUNET_CRYPTO_LIB_H */
2162 #endif
2163 /* end of gnunet_crypto_lib.h */
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:1046
int GNUNET_CRYPTO_ecdhe_key_create2(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:630
int 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:1560
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:812
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.
Definition: crypto_ecc.c:1338
Point on a curve (always for Curve25519) encoded in a format suitable for network transmission (ECDH)...
static struct GNUNET_CRYPTO_EddsaPrivateKey * pk
Private key of this peer.
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:325
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
gcry_mpi_point_t GNUNET_CRYPTO_ecc_bin_to_point(struct GNUNET_CRYPTO_EccDlogContext *edc, const struct GNUNET_CRYPTO_EccPoint *bin)
Convert binary representation of a point to computational representation.
void GNUNET_CRYPTO_ecc_rnd_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_t *r, gcry_mpi_t *r_inv)
Obtain a random scalar for point multiplication on the curve and its multiplicative inverse...
#define GNUNET_CRYPTO_HASH_LENGTH
Length of a hash value.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static char * pkey
Public key of the zone to look in, in ASCII.
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:161
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
an RSA signature
Definition: crypto_rsa.c:63
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.
int 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:144
int 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:1666
int 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:1046
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:126
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
Definition: crypto_rsa.c:958
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:106
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:570
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:583
size_t GNUNET_CRYPTO_rsa_public_key_encode(const struct GNUNET_CRYPTO_RsaPublicKey *key, char **buffer)
Encode the public key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:321
gcry_mpi_t GNUNET_CRYPTO_ecc_random_mod_n(struct GNUNET_CRYPTO_EccDlogContext *edc)
Generate a random value mod n.
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_symmetric_create_session_key(struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Create a new random session key.
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&#39; this be the standard hmac function and the abov...
Definition: crypto_hash.c:403
size_t GNUNET_CRYPTO_rsa_signature_encode(const struct GNUNET_CRYPTO_RsaSignature *sig, char **buffer)
Encode the given signature in a format suitable for storing it into a file.
Definition: crypto_rsa.c:973
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Random on unsigned 64-bit values.
unsigned int GNUNET_CRYPTO_hash_matching_bits(const struct GNUNET_HashCode *first, const struct GNUNET_HashCode *second)
Determine how many low order bits match in two struct GNUNET_HashCodes.
Definition: crypto_hash.c:272
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_create(void)
Create a new private key.
Definition: crypto_ecc.c:688
int 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:987
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:78
int 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:1183
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
struct GNUNET_CRYPTO_EcdhePrivateKey * GNUNET_CRYPTO_ecdhe_key_create(void)
Create a new private key.
Definition: crypto_ecc.c:608
int 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:291
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start(void)
Start incremental hashing operation.
Definition: crypto_hash.c:466
GNUNET_CRYPTO_Quality
Desired quality level for random numbers.
Private ECC key encoded for transmission.
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.
Context for cummulative hashing.
Definition: crypto_hash.c:451
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:127
static enum @8 mode
Should we do a PUT (mode = 0) or GET (mode = 1);.
GNUNET_SCHEDULER_Priority
Valid task priorities.
void GNUNET_CRYPTO_ecc_point_to_bin(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t point, struct GNUNET_CRYPTO_EccPoint *bin)
Convert point value to binary representation.
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.
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_create(unsigned int len)
Create a new private key.
Definition: crypto_rsa.c:149
int GNUNET_CRYPTO_rsa_private_key_cmp(struct GNUNET_CRYPTO_RsaPrivateKey *p1, struct GNUNET_CRYPTO_RsaPrivateKey *p2)
Compare the values of two private keys.
Definition: crypto_rsa.c:589
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:438
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_sign_fdh(const struct GNUNET_CRYPTO_RsaPrivateKey *key, const struct GNUNET_HashCode *hash)
Create and sign a full domain hash of a message.
Definition: crypto_rsa.c:933
The public information of an RSA key pair.
Definition: crypto_rsa.c:51
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:182
uint16_t GNUNET_CRYPTO_crc16_finish(uint32_t sum)
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
Definition: crypto_crc.c:144
void GNUNET_CRYPTO_zero_keys(void *buffer, size_t length)
Zero out buffer, securely against compiler optimizations.
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:179
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
static pa_context * context
Pulseaudio context.
void GNUNET_CRYPTO_paillier_create(struct GNUNET_CRYPTO_PaillierPublicKey *public_key, struct GNUNET_CRYPTO_PaillierPrivateKey *private_key)
Create a freshly generated paillier public key.
int GNUNET_CRYPTO_rsa_verify(const struct GNUNET_HashCode *hash, 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:1165
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
int 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:929
static struct GNUNET_CRYPTO_EccDlogContext * edc
Context for DLOG operations on a curve.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_dup(const struct GNUNET_CRYPTO_RsaSignature *sig)
Duplicate the given rsa signature.
Definition: crypto_rsa.c:1242
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create(void)
Create a new private key.
Definition: crypto_ecc.c:744
int GNUNET_CRYPTO_rsa_public_key_cmp(struct GNUNET_CRYPTO_RsaPublicKey *p1, struct GNUNET_CRYPTO_RsaPublicKey *p2)
Compare the values of two public keys.
Definition: crypto_rsa.c:556
int 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:1114
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
void GNUNET_CRYPTO_hash_create_random(enum GNUNET_CRYPTO_Quality mode, struct GNUNET_HashCode *result)
Create a random hash code.
Definition: crypto_hash.c:144
int 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:1503
int GNUNET_CRYPTO_eddsa_private_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPrivateKey *pub)
Convert a string representing a private key to a private key.
Definition: crypto_ecc.c:532
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:48
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.
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:365
int GNUNET_CRYPTO_paillier_hom_get_remaining(const struct GNUNET_CRYPTO_PaillierCiphertext *c)
Get the number of remaining supported homomorphic operations.
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:374
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.
Randomness for IVs etc.
gcry_mpi_point_t GNUNET_CRYPTO_ecc_add(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t a, gcry_mpi_point_t b)
Add two points on the elliptic curve.
an ECC signature using ECDSA
static char buf[2048]
static char * filename
static int result
Global testing status.
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:621
void GNUNET_CRYPTO_hash_context_abort(struct GNUNET_HashContext *hc)
Abort hashing, do not bother calculating final result.
Definition: crypto_hash.c:532
void GNUNET_CRYPTO_ecc_rnd(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t *r, gcry_mpi_point_t *r_inv)
Obtain a random point on the curve and its additive inverse.
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.
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
static struct GNUNET_SECRETSHARING_Ciphertext ciphertext
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 x1 and x2.
A 512-bit hashcode.
int 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:1613
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:1075
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:350
static int res
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:222
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:431
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:125
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:131
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:332
Private ECC key encoded for transmission.
#define GNUNET_CRYPTO_AES_KEY_LENGTH
length of the sessionkey in bytes (256 BIT sessionkey)
struct GNUNET_HashCode key
The key used in the DHT.
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:73
static unsigned int size
Size of the "table".
Definition: peer.c:67
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:239
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:301
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:378
struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_create_from_file(const char *filename)
Create a new private key by reading it from a file.
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:492
int GNUNET_CRYPTO_hash_get_bit(const struct GNUNET_HashCode *code, unsigned int bit)
Obtain a bit from a hashcode.
Definition: crypto_hash.c:251
void GNUNET_CRYPTO_ecc_dlog_release(struct GNUNET_CRYPTO_EccDlogContext *dlc)
Release precalculated values.
gcry_mpi_point_t GNUNET_CRYPTO_ecc_dexp(struct GNUNET_CRYPTO_EccDlogContext *edc, int val)
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing v...
Context used when hashing a file.
gcry_mpi_point_t GNUNET_CRYPTO_ecc_dexp_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_t val)
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_dup(const struct GNUNET_CRYPTO_RsaPrivateKey *key)
Duplicate the given private key.
Definition: crypto_rsa.c:1216
an ECC signature using EdDSA.
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:270
void GNUNET_CRYPTO_seed_weak_random(int32_t seed)
Seed a weak random generator.
Definition: crypto_random.c:96
0-terminated ASCII encoding of a struct GNUNET_HashCode.
int GNUNET_CRYPTO_rsa_signature_cmp(struct GNUNET_CRYPTO_RsaSignature *s1, struct GNUNET_CRYPTO_RsaSignature *s2)
Compare the values of two signatures.
Definition: crypto_rsa.c:523
int GNUNET_CRYPTO_rsa_blind(const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey, char **buf, size_t *buf_size)
Blinds the given message with the given blinding key.
Definition: crypto_rsa.c:741
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32;.
Private ECC key encoded for transmission.
int 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:499
The identity of the host (wraps the signing key of the peer).
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:596
int 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:466
size_t GNUNET_CRYPTO_rsa_private_key_encode(const struct GNUNET_CRYPTO_RsaPrivateKey *key, char **buffer)
Encode the private key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:199
#define GNUNET_PACKED
gcc-ism to get packed structs.
configuration data
Definition: configuration.c:85
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:39
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:294
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode(const char *buf, size_t len)
Decode the signature from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:1004
enum GNUNET_SCHEDULER_Priority priority
Priority we use.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
static OpusEncoder * enc
OPUS encoder.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_sign_blinded(const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *msg, size_t msg_len)
Sign a blinded value, which must be a full domain hash of a message.
Definition: crypto_rsa.c:902
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
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:398
GNUNET_CRYPTO_HashCompletedCallback callback
Function to call upon completion.
The private information of an RSA key pair.
Definition: crypto_rsa.c:39
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create_from_file(const char *filename)
Create a new private key by reading it from a file.
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
int GNUNET_CRYPTO_get_peer_identity(const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_PeerIdentity *dst)
Retrieve the identity of the host&#39;s peer.
void GNUNET_CRYPTO_ecc_free(gcry_mpi_point_t p)
Free a point value returned by the API.
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&#39;s key from the file specified in the configuration...
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:265
Constant-size pre-secret for blinding key generation.
void GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key)
Free memory occupied by the public key.
Definition: crypto_rsa.c:305
int 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:47
Internal structure used to cache pre-calculated values for DLOG calculation.
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.
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:202
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
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:162
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_decode(const char *buf, size_t len)
Decode the private key from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:230
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.
Definition: crypto_ecc.c:1294
#define GNUNET_CRYPTO_PAILLIER_BITS
Size of paillier plain texts and public keys.
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.
int GNUNET_CRYPTO_ecc_dlog(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t input)
Calculate ECC discrete logarithm for small factors.
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:356
uint32_t data
The data value.
int GNUNET_CRYPTO_hash_from_string2(const char *enc, size_t enclen, struct GNUNET_HashCode *result)
Convert ASCII encoding back to a &#39;struct GNUNET_HashCode&#39;.
Definition: crypto_hash.c:98
gcry_mpi_point_t GNUNET_CRYPTO_ecc_pmul_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t p, gcry_mpi_t val)
Multiply the point p on the elliptic curve by val.
int 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:89
unsigned int max
Maximum absolute value the calculation supports.
void GNUNET_CRYPTO_rsa_private_key_free(struct GNUNET_CRYPTO_RsaPrivateKey *key)
Free memory occupied by the private key.
Definition: crypto_rsa.c:183
type for (message) authentication keys
void GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash)
Finish the hash computation.
Definition: crypto_hash.c:509
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
void * callback_cls
Closure for callback.
void GNUNET_CRYPTO_eddsa_setup_hostkey(const char *cfg_name)
Setup a hostkey file for a peer given the name of the configuration file (!).
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
High-quality operations are desired.
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.
unsigned int mem
How much memory should we use (relates to the number of entries in the map).
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and E...