GNUnet  0.10.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 {
155 
159  unsigned char r[256 / 8];
160 
164  unsigned char s[256 / 8];
165 };
166 
167 
172 {
173 
177  unsigned char r[256 / 8];
178 
182  unsigned char s[256 / 8];
183 };
184 
185 
191 {
197  unsigned char q_y[256 / 8];
198 };
199 
200 
206 {
211  unsigned char q_y[256 / 8];
212 };
213 
214 
219 {
220  struct GNUNET_CRYPTO_EddsaPublicKey public_key;
221 };
222 
223 
230 {
235  unsigned char q_y[256 / 8];
236 };
237 
238 
244 {
248  unsigned char d[256 / 8];
249 };
250 
256 {
260  unsigned char d[256 / 8];
261 };
262 
268 {
272  unsigned char d[256 / 8];
273 };
274 
275 
280 {
284  unsigned char aes_key[GNUNET_CRYPTO_AES_KEY_LENGTH];
285 
289  unsigned char twofish_key[GNUNET_CRYPTO_AES_KEY_LENGTH];
290 };
291 
293 
301 {
302  unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
303 
304  unsigned char twofish_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
305 };
306 
307 
312 {
314 };
315 
316 
321 #define GNUNET_CRYPTO_PAILLIER_BITS 2048
322 
323 
328 {
332  unsigned char n[GNUNET_CRYPTO_PAILLIER_BITS / 8];
333 };
334 
335 
340 {
344  unsigned char lambda[GNUNET_CRYPTO_PAILLIER_BITS / 8];
348  unsigned char mu[GNUNET_CRYPTO_PAILLIER_BITS / 8];
349 };
350 
351 
356 {
361  int32_t remaining_ops GNUNET_PACKED;
362 
366  unsigned char bits[GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8];
367 };
368 
369 
370 /* **************** Functions and Macros ************* */
371 
379 void
380 GNUNET_CRYPTO_seed_weak_random (int32_t seed);
381 
382 
391 uint8_t
392 GNUNET_CRYPTO_crc8_n (const void *buf, size_t len);
393 
394 
403 uint32_t
404 GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len);
405 
406 
413 uint16_t
414 GNUNET_CRYPTO_crc16_finish (uint32_t sum);
415 
416 
425 uint16_t
426 GNUNET_CRYPTO_crc16_n (const void *buf, size_t len);
427 
428 
438 int32_t
439 GNUNET_CRYPTO_crc32_n (const void *buf, size_t len);
440 
449 void
450 GNUNET_CRYPTO_zero_keys (void *buffer, size_t length);
451 
452 
461 void
463  void *buffer,
464  size_t length);
465 
474 uint32_t
476 
477 
486 uint64_t
488 
489 
499 unsigned int *
501 
502 
509 void
512 
513 
525 ssize_t
527  const void *block,
528  size_t size,
529  const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
531  void *result);
532 
533 
545 ssize_t
547  const void *block,
548  size_t size,
549  const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
551  void *result);
552 
553 
563 void
566  const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
567  const void *salt,
568  size_t salt_len,
569  ...);
570 
571 
580 void
583  const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
584  const void *salt,
585  size_t salt_len,
586  va_list argp);
587 
588 
596 void
597 GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block,
599 
600 
610 int
612  size_t enclen,
613  struct GNUNET_HashCode *result);
614 
615 
624 #define GNUNET_CRYPTO_hash_from_string(enc, result) \
625  GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result)
626 
627 
640 uint32_t
642  const struct GNUNET_HashCode *b);
643 
644 
653 void
654 GNUNET_CRYPTO_hash (const void *block,
655  size_t size,
656  struct GNUNET_HashCode *ret);
657 
658 
662 struct GNUNET_HashContext;
663 
664 
670 struct GNUNET_HashContext *
672 
673 
681 void
683  const void *buf,
684  size_t size);
685 
686 
693 void
695  struct GNUNET_HashCode *r_hash);
696 
697 
703 void
705 
706 
718 void
719 GNUNET_CRYPTO_hmac_raw (const void *key,
720  size_t key_len,
721  const void *plaintext,
722  size_t plaintext_len,
723  struct GNUNET_HashCode *hmac);
724 
725 
735 void
737  const void *plaintext,
738  size_t plaintext_len,
739  struct GNUNET_HashCode *hmac);
740 
741 
750  void *cls,
751  const struct GNUNET_HashCode *res);
752 
753 
758 
759 
773  const char *filename,
774  size_t blocksize,
776  void *callback_cls);
777 
778 
784 void
786 
787 
795 void
797  struct GNUNET_HashCode *result);
798 
799 
808 void
810  const struct GNUNET_HashCode *b,
811  struct GNUNET_HashCode *result);
812 
813 
822 void
823 GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode *a,
824  const struct GNUNET_HashCode *delta,
825  struct GNUNET_HashCode *result);
826 
827 
836 void
837 GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode *a,
838  const struct GNUNET_HashCode *b,
839  struct GNUNET_HashCode *result);
840 
841 
850 void
852  const struct GNUNET_HashCode *hc,
855 
856 
865 int
866 GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code,
867  unsigned int bit);
868 
869 
882 unsigned int
884  const struct GNUNET_HashCode *second);
885 
886 
896 int
897 GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1,
898  const struct GNUNET_HashCode *h2);
899 
900 
911 int
913  const struct GNUNET_HashCode *h2,
914  const struct GNUNET_HashCode *target);
915 
916 
926 void
928  struct GNUNET_CRYPTO_AuthKey *key,
929  const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
930  const void *salt,
931  size_t salt_len,
932  va_list argp);
933 
934 
944 void
946  struct GNUNET_CRYPTO_AuthKey *key,
947  const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
948  const void *salt,
949  size_t salt_len,
950  ...);
951 
952 
967 int
969  size_t out_len,
970  int xtr_algo,
971  int prf_algo,
972  const void *xts,
973  size_t xts_len,
974  const void *skm,
975  size_t skm_len,
976  ...);
977 
978 
993 int
995  size_t out_len,
996  int xtr_algo,
997  int prf_algo,
998  const void *xts,
999  size_t xts_len,
1000  const void *skm,
1001  size_t skm_len,
1002  va_list argp);
1003 
1004 
1016 int
1018  size_t out_len,
1019  const void *xts,
1020  size_t xts_len,
1021  const void *skm,
1022  size_t skm_len,
1023  va_list argp);
1024 
1025 
1038 void
1039 GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
1040  gcry_mpi_t n,
1041  const void *xts,
1042  size_t xts_len,
1043  const void *skm,
1044  size_t skm_len,
1045  const char *ctx);
1046 
1047 
1060 int
1061 GNUNET_CRYPTO_kdf (void *result,
1062  size_t out_len,
1063  const void *xts,
1064  size_t xts_len,
1065  const void *skm,
1066  size_t skm_len,
1067  ...);
1068 
1069 
1077 void
1079  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1081 
1089 void
1091  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1093 
1094 
1102 void
1104  const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1106 
1107 
1114 char *
1116  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1117 
1124 char *
1126  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv);
1127 
1128 
1135 char *
1137  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1138 
1139 
1146 char *
1148  const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1149 
1150 
1159 int
1161  const char *enc,
1162  size_t enclen,
1164 
1165 
1174 int
1176  const char *enc,
1177  size_t enclen,
1179 
1180 
1189 int
1191  const char *enc,
1192  size_t enclen,
1194 
1195 
1213 
1214 
1232 
1233 
1238 
1239 
1251  const struct GNUNET_CONFIGURATION_Handle *cfg);
1252 
1253 
1262 
1263 
1272 
1273 
1281 int
1283 
1284 
1293 
1294 
1301 void
1303 
1304 
1311 void
1313 
1314 
1321 void
1323 
1324 
1331 const struct GNUNET_CRYPTO_EcdsaPrivateKey *
1333 
1334 
1344 void
1345 GNUNET_CRYPTO_eddsa_setup_hostkey (const char *cfg_name);
1346 
1347 
1357 int
1359  struct GNUNET_PeerIdentity *dst);
1360 
1361 
1366 
1367 
1373 {
1378  unsigned char q_y[256 / 8];
1379 };
1380 
1381 
1390 GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, unsigned int mem);
1391 
1392 
1401 int
1403  gcry_mpi_point_t input);
1404 
1405 
1419 gcry_mpi_point_t
1421 
1422 
1432 gcry_mpi_point_t
1434  gcry_mpi_t val);
1435 
1436 
1446 gcry_mpi_point_t
1448  gcry_mpi_point_t p,
1449  gcry_mpi_t val);
1450 
1451 
1459 void
1461  gcry_mpi_point_t point,
1462  struct GNUNET_CRYPTO_EccPoint *bin);
1463 
1464 
1472 gcry_mpi_point_t
1474  const struct GNUNET_CRYPTO_EccPoint *bin);
1475 
1476 
1485 gcry_mpi_point_t
1487  gcry_mpi_point_t a,
1488  gcry_mpi_point_t b);
1489 
1490 
1500 void
1502  gcry_mpi_point_t *r,
1503  gcry_mpi_point_t *r_inv);
1504 
1505 
1514 void
1516  gcry_mpi_t *r,
1517  gcry_mpi_t *r_inv);
1518 
1519 
1526 gcry_mpi_t
1528 
1529 
1535 void
1536 GNUNET_CRYPTO_ecc_free (gcry_mpi_point_t p);
1537 
1538 
1544 void
1546 
1547 
1557 int
1559  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1560  struct GNUNET_HashCode *key_material);
1561 
1562 
1573 int
1575  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1576  struct GNUNET_HashCode *key_material);
1577 
1588 int
1590  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1591  struct GNUNET_HashCode *key_material);
1592 
1593 
1604 int
1606  const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
1607  struct GNUNET_HashCode *key_material);
1608 
1619 int
1621  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1622  struct GNUNET_HashCode *key_material);
1623 
1624 
1634 int
1636  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1637  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1638  struct GNUNET_CRYPTO_EddsaSignature *sig);
1639 
1640 
1650 int
1652  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1653  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1654  struct GNUNET_CRYPTO_EcdsaSignature *sig);
1655 
1666 int
1668  uint32_t purpose,
1669  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1670  const struct GNUNET_CRYPTO_EddsaSignature *sig,
1671  const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1672 
1673 
1684 int
1686  uint32_t purpose,
1687  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1688  const struct GNUNET_CRYPTO_EcdsaSignature *sig,
1689  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1690 
1691 
1707  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1708  const char *label,
1709  const char *context);
1710 
1711 
1723 void
1725  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1726  const char *label,
1727  const char *context,
1729 
1730 
1739 void
1740 GNUNET_CRYPTO_mpi_print_unsigned (void *buf, size_t size, gcry_mpi_t val);
1741 
1742 
1752 void
1754  const void *data,
1755  size_t size);
1756 
1757 
1764 void
1766  struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1767  struct GNUNET_CRYPTO_PaillierPrivateKey *private_key);
1768 
1769 
1781 int
1783  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1784  const gcry_mpi_t m,
1785  int desired_ops,
1787 
1788 
1797 void
1799  const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key,
1800  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1802  gcry_mpi_t m);
1803 
1804 
1818 int
1820  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1821  const struct GNUNET_CRYPTO_PaillierCiphertext *c1,
1822  const struct GNUNET_CRYPTO_PaillierCiphertext *c2,
1824 
1825 
1832 int
1834  const struct GNUNET_CRYPTO_PaillierCiphertext *c);
1835 
1836 
1837 /* ********* Chaum-style RSA-based blind signatures ******************* */
1838 
1839 
1844 
1849 
1854 {
1859  uint32_t pre_secret[8] GNUNET_PACKED;
1860 };
1861 
1866 
1867 
1876 
1877 
1883 void
1885 
1886 
1895 size_t
1897  const struct GNUNET_CRYPTO_RsaPrivateKey *key,
1898  char **buffer);
1899 
1900 
1910 GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, size_t len);
1911 
1912 
1921  const struct GNUNET_CRYPTO_RsaPrivateKey *key);
1922 
1923 
1932  const struct GNUNET_CRYPTO_RsaPrivateKey *priv);
1933 
1934 
1941 void
1943  struct GNUNET_HashCode *hc);
1944 
1945 
1952 unsigned int
1954 
1955 
1961 void
1963 
1964 
1973 size_t
1975  const struct GNUNET_CRYPTO_RsaPublicKey *key,
1976  char **buffer);
1977 
1978 
1988 GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, size_t len);
1989 
1990 
1999 
2000 
2008 int
2010  struct GNUNET_CRYPTO_RsaSignature *s2);
2011 
2019 int
2021  struct GNUNET_CRYPTO_RsaPrivateKey *p2);
2022 
2023 
2031 int
2033  struct GNUNET_CRYPTO_RsaPublicKey *p2);
2034 
2035 
2046 int
2047 GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash,
2048  const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2050  char **buf,
2051  size_t *buf_size);
2052 
2053 
2064  const void *msg,
2065  size_t msg_len);
2066 
2067 
2077  const struct GNUNET_HashCode *hash);
2078 
2079 
2085 void
2087 
2088 
2096 size_t
2098  const struct GNUNET_CRYPTO_RsaSignature *sig,
2099  char **buffer);
2100 
2101 
2111 GNUNET_CRYPTO_rsa_signature_decode (const char *buf, size_t len);
2112 
2113 
2122 
2123 
2136  const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2138 
2139 
2149 int
2150 GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash,
2151  const struct GNUNET_CRYPTO_RsaSignature *sig,
2152  const struct GNUNET_CRYPTO_RsaPublicKey *public_key);
2153 
2154 
2155 #if 0 /* keep Emacsens' auto-indent happy */
2156 {
2157 #endif
2158 #ifdef __cplusplus
2159 }
2160 #endif
2161 
2162 
2163 /* ifndef GNUNET_CRYPTO_LIB_H */
2164 #endif
2165 /* 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:1038
int GNUNET_CRYPTO_ecdhe_key_create2(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:632
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:1561
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:814
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:1339
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:308
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 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:159
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:142
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:1048
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:128
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
Definition: crypto_rsa.c:951
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:105
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:572
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:585
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:318
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:383
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:966
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:256
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:691
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:989
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:75
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:1184
struct GNUNET_CRYPTO_EcdhePrivateKey * GNUNET_CRYPTO_ecdhe_key_create(void)
Create a new private key.
Definition: crypto_ecc.c:610
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:289
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start(void)
Start incremental hashing operation.
Definition: crypto_hash.c:446
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:431
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:121
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
static int ret
Final status code.
Definition: gnunet-arm.c:89
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:584
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:418
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:926
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:175
uint16_t GNUNET_CRYPTO_crc16_finish(uint32_t sum)
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
Definition: crypto_crc.c:142
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:177
#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:1157
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:99
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:931
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:1233
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create(void)
Create a new private key.
Definition: crypto_ecc.c:746
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:551
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:1116
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:138
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:1504
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:534
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:44
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:367
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:370
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:616
void GNUNET_CRYPTO_hash_context_abort(struct GNUNET_HashContext *hc)
Abort hashing, do not bother calculating final result.
Definition: crypto_hash.c:512
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:1614
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:1067
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:346
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:212
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:433
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:124
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:128
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:334
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
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:69
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:241
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:303
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:359
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:472
int GNUNET_CRYPTO_hash_get_bit(const struct GNUNET_HashCode *code, unsigned int bit)
Obtain a bit from a hashcode.
Definition: crypto_hash.c:236
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:1208
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:272
void GNUNET_CRYPTO_seed_weak_random(int32_t seed)
Seed a weak random generator.
Definition: crypto_random.c:94
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:518
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:736
#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:501
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:598
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:468
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:278
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:996
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:895
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:400
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:263
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:302
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:193
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:156
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:229
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:1295
#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:338
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:92
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:91
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:489
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
static enum @11 mode
Should we do a PUT (mode = 0) or GET (mode = 1);.
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...