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 
81 
87 
93 };
94 
95 
99 #define GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8)
100 
104 #define GNUNET_CRYPTO_HASH_LENGTH (512 / 8)
105 
110 #define GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52
111 
116  unsigned char encoding[104];
117 };
118 
119 
121 
122 
134  uint32_t size GNUNET_PACKED;
135 
142  uint32_t purpose GNUNET_PACKED;
143 };
144 
145 
154  unsigned char r[256 / 8];
155 
159  unsigned char s[256 / 8];
160 };
161 
162 
170  unsigned char r[256 / 8];
171 
175  unsigned char s[256 / 8];
176 };
177 
178 
189  unsigned char q_y[256 / 8];
190 };
191 
192 
202  unsigned char q_y[256 / 8];
203 };
204 
205 
210  struct GNUNET_CRYPTO_EddsaPublicKey public_key;
211 };
212 
213 
224  unsigned char q_y[256 / 8];
225 };
226 
227 
236  unsigned char d[256 / 8];
237 };
238 
247  unsigned char d[256 / 8];
248 };
249 
258  unsigned char d[256 / 8];
259 };
260 
261 
269  unsigned char aes_key[GNUNET_CRYPTO_AES_KEY_LENGTH];
270 
274  unsigned char twofish_key[GNUNET_CRYPTO_AES_KEY_LENGTH];
275 };
276 
278 
286  unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
287 
288  unsigned char twofish_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2];
289 };
290 
291 
297 };
298 
299 
304 #define GNUNET_CRYPTO_PAILLIER_BITS 2048
305 
306 
314  unsigned char n[GNUNET_CRYPTO_PAILLIER_BITS / 8];
315 };
316 
317 
325  unsigned char lambda[GNUNET_CRYPTO_PAILLIER_BITS / 8];
329  unsigned char mu[GNUNET_CRYPTO_PAILLIER_BITS / 8];
330 };
331 
332 
341  int32_t remaining_ops GNUNET_PACKED;
342 
346  unsigned char bits[GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8];
347 };
348 
349 
350 /* **************** Functions and Macros ************* */
351 
359 void
360 GNUNET_CRYPTO_seed_weak_random(int32_t seed);
361 
362 
371 uint8_t
372 GNUNET_CRYPTO_crc8_n(const void *buf, size_t len);
373 
374 
383 uint32_t
384 GNUNET_CRYPTO_crc16_step(uint32_t sum, const void *buf, size_t len);
385 
386 
393 uint16_t
394 GNUNET_CRYPTO_crc16_finish(uint32_t sum);
395 
396 
405 uint16_t
406 GNUNET_CRYPTO_crc16_n(const void *buf, size_t len);
407 
408 
418 int32_t
419 GNUNET_CRYPTO_crc32_n(const void *buf, size_t len);
420 
429 void
430 GNUNET_CRYPTO_zero_keys(void *buffer, size_t length);
431 
432 
441 void
443  void *buffer,
444  size_t length);
445 
454 uint32_t
456 
457 
466 uint64_t
468 
469 
479 unsigned int *
481 
482 
489 void
492 
493 
505 ssize_t
507  const void *block,
508  size_t size,
509  const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
511  void *result);
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 
543 void
546  const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
547  const void *salt,
548  size_t salt_len,
549  ...);
550 
551 
560 void
563  const struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
564  const void *salt,
565  size_t salt_len,
566  va_list argp);
567 
568 
576 void
577 GNUNET_CRYPTO_hash_to_enc(const struct GNUNET_HashCode *block,
579 
580 
590 int
592  size_t enclen,
593  struct GNUNET_HashCode *result);
594 
595 
604 #define GNUNET_CRYPTO_hash_from_string(enc, result) \
605  GNUNET_CRYPTO_hash_from_string2(enc, strlen(enc), result)
606 
607 
620 uint32_t
622  const struct GNUNET_HashCode *b);
623 
624 
633 void
634 GNUNET_CRYPTO_hash(const void *block,
635  size_t size,
636  struct GNUNET_HashCode *ret);
637 
638 
642 struct GNUNET_HashContext;
643 
644 
650 struct GNUNET_HashContext *
652 
653 
661 void
663  const void *buf,
664  size_t size);
665 
666 
673 void
675  struct GNUNET_HashCode *r_hash);
676 
677 
683 void
685 
686 
698 void
699 GNUNET_CRYPTO_hmac_raw(const void *key,
700  size_t key_len,
701  const void *plaintext,
702  size_t plaintext_len,
703  struct GNUNET_HashCode *hmac);
704 
705 
715 void
717  const void *plaintext,
718  size_t plaintext_len,
719  struct GNUNET_HashCode *hmac);
720 
721 
730  void *cls,
731  const struct GNUNET_HashCode *res);
732 
733 
738 
739 
753  const char *filename,
754  size_t blocksize,
756  void *callback_cls);
757 
758 
764 void
766 
767 
775 void
777  struct GNUNET_HashCode *result);
778 
779 
788 void
790  const struct GNUNET_HashCode *b,
791  struct GNUNET_HashCode *result);
792 
793 
802 void
804  const struct GNUNET_HashCode *delta,
805  struct GNUNET_HashCode *result);
806 
807 
816 void
818  const struct GNUNET_HashCode *b,
819  struct GNUNET_HashCode *result);
820 
821 
830 void
832  const struct GNUNET_HashCode *hc,
835 
836 
845 int
847  unsigned int bit);
848 
849 
862 unsigned int
864  const struct GNUNET_HashCode *second);
865 
866 
876 int
877 GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1,
878  const struct GNUNET_HashCode *h2);
879 
880 
891 int
893  const struct GNUNET_HashCode *h2,
894  const struct GNUNET_HashCode *target);
895 
896 
906 void
908  struct GNUNET_CRYPTO_AuthKey *key,
909  const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
910  const void *salt,
911  size_t salt_len,
912  va_list argp);
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  ...);
931 
932 
947 int
949  size_t out_len,
950  int xtr_algo,
951  int prf_algo,
952  const void *xts,
953  size_t xts_len,
954  const void *skm,
955  size_t skm_len,
956  ...);
957 
958 
973 int
975  size_t out_len,
976  int xtr_algo,
977  int prf_algo,
978  const void *xts,
979  size_t xts_len,
980  const void *skm,
981  size_t skm_len,
982  va_list argp);
983 
984 
996 int
998  size_t out_len,
999  const void *xts,
1000  size_t xts_len,
1001  const void *skm,
1002  size_t skm_len,
1003  va_list argp);
1004 
1005 
1018 void
1019 GNUNET_CRYPTO_kdf_mod_mpi(gcry_mpi_t *r,
1020  gcry_mpi_t n,
1021  const void *xts,
1022  size_t xts_len,
1023  const void *skm,
1024  size_t skm_len,
1025  const char *ctx);
1026 
1027 
1040 int
1042  size_t out_len,
1043  const void *xts,
1044  size_t xts_len,
1045  const void *skm,
1046  size_t skm_len,
1047  ...);
1048 
1049 
1057 void
1059  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1061 
1069 void
1071  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1073 
1074 
1082 void
1084  const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1086 
1087 
1094 char *
1096  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1097 
1104 char *
1106  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv);
1107 
1108 
1115 char *
1117  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
1118 
1119 
1126 char *
1128  const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1129 
1130 
1139 int
1141  const char *enc,
1142  size_t enclen,
1144 
1145 
1154 int
1156  const char *enc,
1157  size_t enclen,
1159 
1160 
1169 int
1171  const char *enc,
1172  size_t enclen,
1174 
1175 
1193 
1194 
1212 
1213 
1218 
1219 
1231  const struct GNUNET_CONFIGURATION_Handle *cfg);
1232 
1233 
1242 
1243 
1252 
1253 
1261 int
1263 
1264 
1273 
1274 
1281 void
1283 
1284 
1291 void
1293 
1294 
1301 void
1303 
1304 
1311 const struct GNUNET_CRYPTO_EcdsaPrivateKey *
1313 
1314 
1324 void
1325 GNUNET_CRYPTO_eddsa_setup_hostkey(const char *cfg_name);
1326 
1327 
1337 int
1339  struct GNUNET_PeerIdentity *dst);
1340 
1341 
1346 
1347 
1357  unsigned char q_y[256 / 8];
1358 };
1359 
1360 
1369 GNUNET_CRYPTO_ecc_dlog_prepare(unsigned int max, unsigned int mem);
1370 
1371 
1380 int
1382  gcry_mpi_point_t input);
1383 
1384 
1398 gcry_mpi_point_t
1400 
1401 
1411 gcry_mpi_point_t
1413  gcry_mpi_t val);
1414 
1415 
1425 gcry_mpi_point_t
1427  gcry_mpi_point_t p,
1428  gcry_mpi_t val);
1429 
1430 
1438 void
1440  gcry_mpi_point_t point,
1441  struct GNUNET_CRYPTO_EccPoint *bin);
1442 
1443 
1451 gcry_mpi_point_t
1453  const struct GNUNET_CRYPTO_EccPoint *bin);
1454 
1455 
1464 gcry_mpi_point_t
1466  gcry_mpi_point_t a,
1467  gcry_mpi_point_t b);
1468 
1469 
1479 void
1481  gcry_mpi_point_t *r,
1482  gcry_mpi_point_t *r_inv);
1483 
1484 
1493 void
1495  gcry_mpi_t *r,
1496  gcry_mpi_t *r_inv);
1497 
1498 
1505 gcry_mpi_t
1507 
1508 
1514 void
1515 GNUNET_CRYPTO_ecc_free(gcry_mpi_point_t p);
1516 
1517 
1523 void
1525 
1526 
1536 int
1538  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1539  struct GNUNET_HashCode *key_material);
1540 
1541 
1552 int
1554  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1555  struct GNUNET_HashCode *key_material);
1556 
1567 int
1569  const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1570  struct GNUNET_HashCode *key_material);
1571 
1572 
1583 int
1585  const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
1586  struct GNUNET_HashCode *key_material);
1587 
1598 int
1600  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1601  struct GNUNET_HashCode *key_material);
1602 
1603 
1613 int
1615  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1616  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1617  struct GNUNET_CRYPTO_EddsaSignature *sig);
1618 
1619 
1629 int
1631  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1632  const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1633  struct GNUNET_CRYPTO_EcdsaSignature *sig);
1634 
1645 int
1647  uint32_t purpose,
1648  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1649  const struct GNUNET_CRYPTO_EddsaSignature *sig,
1650  const struct GNUNET_CRYPTO_EddsaPublicKey *pub);
1651 
1652 
1663 int
1665  uint32_t purpose,
1666  const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
1667  const struct GNUNET_CRYPTO_EcdsaSignature *sig,
1668  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub);
1669 
1670 
1686  const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1687  const char *label,
1688  const char *context);
1689 
1690 
1702 void
1704  const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1705  const char *label,
1706  const char *context,
1708 
1709 
1718 void
1719 GNUNET_CRYPTO_mpi_print_unsigned(void *buf, size_t size, gcry_mpi_t val);
1720 
1721 
1731 void
1733  const void *data,
1734  size_t size);
1735 
1736 
1743 void
1745  struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1746  struct GNUNET_CRYPTO_PaillierPrivateKey *private_key);
1747 
1748 
1760 int
1762  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1763  const gcry_mpi_t m,
1764  int desired_ops,
1766 
1767 
1776 void
1778  const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key,
1779  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1781  gcry_mpi_t m);
1782 
1783 
1797 int
1799  const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
1800  const struct GNUNET_CRYPTO_PaillierCiphertext *c1,
1801  const struct GNUNET_CRYPTO_PaillierCiphertext *c2,
1803 
1804 
1811 int
1813  const struct GNUNET_CRYPTO_PaillierCiphertext *c);
1814 
1815 
1816 /* ********* Chaum-style RSA-based blind signatures ******************* */
1817 
1818 
1823 
1828 
1837  uint32_t pre_secret[8] GNUNET_PACKED;
1838 };
1839 
1844 
1845 
1854 
1855 
1861 void
1863 
1864 
1873 size_t
1875  const struct GNUNET_CRYPTO_RsaPrivateKey *key,
1876  char **buffer);
1877 
1878 
1888 GNUNET_CRYPTO_rsa_private_key_decode(const char *buf, size_t len);
1889 
1890 
1899  const struct GNUNET_CRYPTO_RsaPrivateKey *key);
1900 
1901 
1910  const struct GNUNET_CRYPTO_RsaPrivateKey *priv);
1911 
1912 
1919 void
1921  struct GNUNET_HashCode *hc);
1922 
1923 
1930 unsigned int
1932 
1933 
1939 void
1941 
1942 
1951 size_t
1953  const struct GNUNET_CRYPTO_RsaPublicKey *key,
1954  char **buffer);
1955 
1956 
1966 GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len);
1967 
1968 
1977 
1978 
1986 int
1988  struct GNUNET_CRYPTO_RsaSignature *s2);
1989 
1997 int
1999  struct GNUNET_CRYPTO_RsaPrivateKey *p2);
2000 
2001 
2009 int
2011  struct GNUNET_CRYPTO_RsaPublicKey *p2);
2012 
2013 
2024 int
2025 GNUNET_CRYPTO_rsa_blind(const struct GNUNET_HashCode *hash,
2026  const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2028  char **buf,
2029  size_t *buf_size);
2030 
2031 
2042  const void *msg,
2043  size_t msg_len);
2044 
2045 
2055  const struct GNUNET_HashCode *hash);
2056 
2057 
2063 void
2065 
2066 
2074 size_t
2076  const struct GNUNET_CRYPTO_RsaSignature *sig,
2077  char **buffer);
2078 
2079 
2089 GNUNET_CRYPTO_rsa_signature_decode(const char *buf, size_t len);
2090 
2091 
2100 
2101 
2114  const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks,
2116 
2117 
2127 int
2128 GNUNET_CRYPTO_rsa_verify(const struct GNUNET_HashCode *hash,
2129  const struct GNUNET_CRYPTO_RsaSignature *sig,
2130  const struct GNUNET_CRYPTO_RsaPublicKey *public_key);
2131 
2132 
2133 #if 0 /* keep Emacsens' auto-indent happy */
2134 {
2135 #endif
2136 #ifdef __cplusplus
2137 }
2138 #endif
2139 
2140 
2141 /* ifndef GNUNET_CRYPTO_LIB_H */
2142 #endif
2143 /* 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:1037
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:1562
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:1340
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:160
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
an RSA signature
Definition: crypto_rsa.c:61
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:1667
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:950
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:315
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:965
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:1185
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:445
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:145
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:582
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:925
The public information of an RSA key pair.
Definition: crypto_rsa.c:50
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:143
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:178
#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:1156
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:549
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:1505
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:367
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:614
void GNUNET_CRYPTO_hash_context_abort(struct GNUNET_HashContext *hc)
Abort hashing, do not bother calculating final result.
Definition: crypto_hash.c:511
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:1615
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:1066
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:343
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:66
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:471
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:516
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:734
#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:195
#define GNUNET_PACKED
gcc-ism to get packed structs.
configuration data
Definition: configuration.c:83
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:995
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:894
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:260
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:299
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:225
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:1296
#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:179
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:488
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...