Multi-function utilities library for GNUnet programs. More...
Modules | |
BIO library | |
Buffered binary disk IO (with endianness conversion) | |
Bandwidth library | |
Functions related to bandwidth (unit) | |
Configuration library | |
Configuration management. | |
Container | |
Common data structures in GNUnet programs. | |
Crypto library: cryptographic operations | |
Provides cryptographic primitives. | |
Crypto library: hash operations | |
Provides hashing and operations on hashes. | |
DNS Stub library | |
Helper library to send DNS requests to DNS resolver. | |
DNS parser library | |
Helper library to parse DNS packets. | |
Disk library | |
Disk IO APIs. | |
Getopt library | |
Command line parsing and –help formatting. | |
Helper library | |
Dealing with SUID helper processes. | |
Load library | |
Load calculations. | |
Logging | |
MQ library | |
General-purpose message queue. | |
Memory management | |
Network protocol definitions | |
Types of messages used in GNUnet. | |
Networking | |
OS library | |
Low level process routines. | |
Peer library | |
Helper library for interning of peer identifiers. | |
Plugin library | |
Plugin loading and unloading. | |
Program library | |
Start command-line programs. | |
SOCKS proxy | |
SOCKS proxy for connections. | |
Scheduler library | |
Event loop (scheduler) | |
Signal library | |
Manage signal handlers. | |
Strings library | |
Strings and string handling functions, including malloc and string tokenizing. | |
Time library | |
Time and time calculations. | |
Files | |
file | gnunet_bandwidth_lib.h |
Functions related to bandwidth (unit) | |
file | gnunet_bio_lib.h |
Buffered IO library. | |
file | gnunet_child_management_lib.h |
GNUnet child management api. | |
file | gnunet_common.h |
commonly used definitions; globals in this file are exempt from the rule that the module name ("common") must be part of the symbol name. | |
file | gnunet_configuration_lib.h |
Configuration API. | |
file | gnunet_container_lib.h |
Container classes for GNUnet. | |
file | gnunet_crypto_lib.h |
cryptographic primitives for GNUnet | |
file | gnunet_disk_lib.h |
Disk IO APIs. | |
file | gnunet_dnsparser_lib.h |
API for helper library to parse DNS packets. | |
file | gnunet_dnsstub_lib.h |
API for helper library to send DNS requests to DNS resolver. | |
file | gnunet_getopt_lib.h |
Command line parsing and –help formatting. | |
file | gnunet_helper_lib.h |
API for dealing with SUID helper processes. | |
file | gnunet_load_lib.h |
Functions related to load calculations. | |
file | gnunet_mq_lib.h |
General-purpose message queue. | |
file | gnunet_nc_lib.h |
General-purpose broadcast mechanism for message queues. | |
file | gnunet_op_lib.h |
Asynchronous operations; register callbacks for operations and call them when a response arrives. | |
file | gnunet_os_lib.h |
Low level process routines. | |
file | gnunet_peer_lib.h |
Helper library for interning of peer identifiers. | |
file | gnunet_plugin_lib.h |
Plugin loading and unloading. | |
file | gnunet_program_lib.h |
Functions related to starting programs. | |
file | gnunet_protocols.h |
Constants for network protocols. | |
file | gnunet_scheduler_lib.h |
API to schedule computations using continuation passing style. | |
file | gnunet_signal_lib.h |
Functions related to signals. | |
file | gnunet_socks.h |
SOCKS proxy for connections. | |
file | gnunet_strings_lib.h |
Strings and string handling functions. | |
file | gnunet_time_lib.h |
Functions related to time. | |
Data Structures | |
struct | GNUNET_Buffer |
Dynamically growing buffer. More... | |
struct | GNUNET_HashCode |
A 512-bit hashcode. More... | |
struct | GNUNET_ShortHashCode |
A 256-bit hashcode. More... | |
struct | GNUNET_Uuid |
A UUID, a 128 bit "random" value. More... | |
struct | GNUNET_MessageHeader |
Header for all communications. More... | |
struct | GNUNET_OperationResultMessage |
Answer from service to client about last operation. More... | |
struct | GNUNET_AsyncScopeId |
Identifier for an asynchronous execution context. More... | |
struct | GNUNET_AsyncScopeSave |
Saved async scope identifier or root scope. More... | |
struct | GNUNET_CRYPTO_HashAsciiEncoded |
0-terminated ASCII encoding of a struct GNUNET_HashCode. More... | |
struct | GNUNET_CRYPTO_EccSignaturePurpose |
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed data More... | |
struct | GNUNET_CRYPTO_EddsaSignature |
an ECC signature using EdDSA. More... | |
struct | GNUNET_CRYPTO_EcdsaSignature |
an ECC signature using ECDSA More... | |
struct | GNUNET_CRYPTO_EddsaPublicKey |
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and EdDSA signatures. More... | |
struct | GNUNET_CRYPTO_EcdsaPublicKey |
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDSA signatures. More... | |
struct | GNUNET_PeerIdentity |
The identity of the host (wraps the signing key of the peer). More... | |
struct | GNUNET_CRYPTO_EcdhePublicKey |
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encryption (ECDH), See http://cr.yp.to/ecdh.html. More... | |
struct | GNUNET_CRYPTO_EcdhePrivateKey |
Private ECC key encoded for transmission. More... | |
struct | GNUNET_CRYPTO_EcdsaPrivateKey |
Private ECC key encoded for transmission. More... | |
struct | GNUNET_CRYPTO_EddsaPrivateKey |
Private ECC key encoded for transmission. More... | |
struct | GNUNET_CRYPTO_EddsaPrivateScalar |
Private ECC scalar encoded for transmission. More... | |
struct | GNUNET_CRYPTO_Edx25519PrivateKey |
Private ECC key material encoded for transmission. More... | |
struct | GNUNET_CRYPTO_Edx25519PublicKey |
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and Edx25519 (same as EdDSA) signatures. More... | |
struct | GNUNET_CRYPTO_Edx25519Signature |
an ECC signature using Edx25519 (same as in EdDSA). More... | |
struct | GNUNET_CRYPTO_ElligatorEcdhePrivateKey |
Special private ECC key generated by GNUNET_CRYPTO_ecdhe_elligator_key_create. More... | |
struct | GNUNET_CRYPTO_ElligatorRepresentative |
Elligator representative (always for Curve25519) More... | |
struct | GNUNET_CRYPTO_PrivateKey |
A private key for an identity as per LSD0001. More... | |
struct | GNUNET_CRYPTO_PublicKey |
An identity key as per LSD0001. More... | |
struct | GNUNET_CRYPTO_Signature |
An identity signature as per LSD0001. More... | |
struct | GNUNET_CRYPTO_SymmetricSessionKey |
type for session keys More... | |
struct | GNUNET_CRYPTO_ChallengeNonceP |
Type of a nonce used for challenges. More... | |
struct | GNUNET_CRYPTO_SymmetricInitializationVector |
IV for sym cipher. More... | |
struct | GNUNET_CRYPTO_AuthKey |
type for (message) authentication keys More... | |
struct | GNUNET_CRYPTO_PaillierPublicKey |
Paillier public key. More... | |
struct | GNUNET_CRYPTO_PaillierPrivateKey |
Paillier private key. More... | |
struct | GNUNET_CRYPTO_PaillierCiphertext |
Paillier ciphertext. More... | |
struct | GNUNET_CRYPTO_Cs25519Scalar |
Curve25519 Scalar. More... | |
struct | GNUNET_CRYPTO_Cs25519Point |
Curve25519 point. More... | |
struct | GNUNET_CRYPTO_CsPrivateKey |
The private information of an Schnorr key pair. More... | |
struct | GNUNET_CRYPTO_CsPublicKey |
The public information of an Schnorr key pair. More... | |
struct | GNUNET_CRYPTO_CsBlindingSecret |
Secret used for blinding (alpha and beta). More... | |
struct | GNUNET_CRYPTO_CsRSecret |
the private r used in the signature More... | |
struct | GNUNET_CRYPTO_CsRPublic |
the public R (derived from r) used in c More... | |
struct | GNUNET_CRYPTO_CsC |
Schnorr c to be signed. More... | |
struct | GNUNET_CRYPTO_CsS |
s in the signature More... | |
struct | GNUNET_CRYPTO_CsBlindS |
blinded s in the signature More... | |
struct | GNUNET_CRYPTO_CsSignature |
CS Signtature containing scalar s and point R. More... | |
struct | GNUNET_CRYPTO_CsSessionNonce |
Nonce for the session, picked by client, shared with the signer. More... | |
struct | GNUNET_CRYPTO_CsBlindingNonce |
Nonce for computing blinding factors. More... | |
struct | GNUNET_CRYPTO_PowSalt |
Value for a salt for GNUNET_CRYPTO_pow_hash(). More... | |
struct | GNUNET_CRYPTO_EccPoint |
Point on a curve (always for Curve25519) encoded in a format suitable for network transmission (ECDH), see http://cr.yp.to/ecdh.html. More... | |
struct | GNUNET_CRYPTO_EccScalar |
A ECC scalar for use in point multiplications. More... | |
struct | GNUNET_CRYPTO_HpkeContext |
struct | GNUNET_CRYPTO_HpkeEncapsulation |
HPKE DHKEM encapsulation (X25519) See RFC 9180. More... | |
struct | GNUNET_CRYPTO_RsaBlindingKeySecret |
Constant-size pre-secret for blinding key generation. More... | |
struct | GNUNET_CRYPTO_RsaBlindedMessage |
RSA Parameters to create blinded signature. More... | |
struct | GNUNET_CRYPTO_CsBlindedMessage |
CS Parameters derived from the message during blinding to create blinded signature. More... | |
struct | GNUNET_CRYPTO_CSPublicRPairP |
Pair of Public R values for Cs denominations. More... | |
struct | GNUNET_CRYPTO_CsBlindSignature |
The Sign Answer for Clause Blind Schnorr signature. More... | |
struct | GNUNET_CRYPTO_UnblindedSignature |
Type of (unblinded) signatures. More... | |
struct | GNUNET_CRYPTO_BlindedSignature |
Type for blinded signatures. More... | |
struct | GNUNET_CRYPTO_BlindSignPublicKey |
Type of public signing keys for blind signatures. More... | |
struct | GNUNET_CRYPTO_BlindSignPrivateKey |
Type of private signing keys for blind signing. More... | |
struct | GNUNET_CRYPTO_BlindedMessage |
Blinded message ready for blind signing. More... | |
struct | GNUNET_CRYPTO_CSPrivateRPairP |
Secret r for Cs denominations. More... | |
struct | GNUNET_CRYPTO_BlindingInputValues |
Input needed for blinding a message. More... | |
union | GNUNET_CRYPTO_BlindSessionNonce |
Nonce used to deterministiacally derive input values used in multi-round blind signature protocols. More... | |
union | GNUNET_CRYPTO_BlindingSecretP |
Type of blinding secrets. More... | |
Macros | |
#define | GNUNET_UTIL_VERSION 0x000A0104 |
Version of the API (for entire gnunetutil.so library). More... | |
#define | GNUNET_MIN(a, b) (((a) < (b)) ? (a) : (b)) |
#define | GNUNET_MAX(a, b) (((a) > (b)) ? (a) : (b)) |
#define | BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) |
Endian operations. More... | |
#define | BYTE_SWAP_32(x) |
#define | BYTE_SWAP_64(x) |
#define | GNUNET_htobe16(x) BYTE_SWAP_16 (x) |
#define | GNUNET_htobe16(x) (x) |
#define | GNUNET_htole16(x) (x) |
#define | GNUNET_htole16(x) BYTE_SWAP_16 (x) |
#define | GNUNET_be16toh(x) BYTE_SWAP_16 (x) |
#define | GNUNET_be16toh(x) (x) |
#define | GNUNET_le16toh(x) (x) |
#define | GNUNET_le16toh(x) BYTE_SWAP_16 (x) |
#define | GNUNET_htobe32(x) BYTE_SWAP_32 (x) |
#define | GNUNET_htobe32(x) (x) |
#define | GNUNET_htole32(x) (x) |
#define | GNUNET_htole32(x) BYTE_SWAP_32 (x) |
#define | GNUNET_be32toh(x) BYTE_SWAP_32 (x) |
#define | GNUNET_be32toh(x) (x) |
#define | GNUNET_le32toh(x) (x) |
#define | GNUNET_le32toh(x) BYTE_SWAP_32 (x) |
#define | GNUNET_htobe64(x) BYTE_SWAP_64 (x) |
#define | GNUNET_htobe64(x) (x) |
#define | GNUNET_htole64(x) (x) |
#define | GNUNET_htole64(x) BYTE_SWAP_64 (x) |
#define | GNUNET_be64toh(x) BYTE_SWAP_64 (x) |
#define | GNUNET_be64toh(x) (x) |
#define | GNUNET_le64toh(x) (x) |
#define | GNUNET_le64toh(x) BYTE_SWAP_64 (x) |
#define | GNUNET_NZL(l) GNUNET_MAX (1, l) |
Macro used to avoid using 0 for the length of a variable-size array (Non-Zero-Length). More... | |
#define | GNUNET_PACKED __attribute__ ((packed)) |
gcc-ism to get packed structs. More... | |
#define | GNUNET_ALIGN __attribute__ ((aligned (8))) |
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's. More... | |
#define | GNUNET_UNUSED __attribute__ ((unused)) |
gcc-ism to document unused arguments More... | |
#define | GNUNET_NORETURN __attribute__ ((noreturn)) |
gcc-ism to document functions that don't return More... | |
#define | GNUNET_NETWORK_STRUCT_BEGIN |
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32. More... | |
#define | GNUNET_NETWORK_STRUCT_END |
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;. More... | |
#define | GN_LIKELY(expr) (expr) |
#define | GN_UNLIKELY(expr) (expr) |
#define | GNUNET_LOG_CALL_STATUS -1 |
#define | GNUNET_log_from(kind, comp, ...) |
#define | GNUNET_log(kind, ...) |
#define | GNUNET_B2S(obj) GNUNET_b2s ((obj), sizeof (*(obj))) |
Convert a fixed-sized object to a string using GNUNET_b2s(). More... | |
#define | GNUNET_static_assert(cond) GNUNET_assert (cond) |
Assertion to be checked (if supported by C compiler) at compile time, otherwise checked at runtime and resulting in an abort() on failure. More... | |
#define | GNUNET_memcmp(a, b) |
Compare memory in a and b, where both must be of the same pointer type. More... | |
#define | GNUNET_memcmp_priv(a, b) |
Compare memory in a and b in constant time, suitable for private data. More... | |
#define | GNUNET_is_zero(a) GNUNET_is_zero_ ((a), sizeof (*(a))) |
Check that memory in a is all zeros. More... | |
#define | GNUNET_memcpy(dst, src, n) |
Call memcpy() but check for n being 0 first. More... | |
#define | __func__ "<unknown>" |
#define | GNUNET_CONTAINER_LIB_H |
#define | GNUNET_CONTAINER_DLL_insert_sorted(TYPE, comparator, comparator_cls, head, tail, element) |
Insertion sort of element into DLL from head to tail sorted by comparator. More... | |
#define | GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126 |
Maximum length of an ECC signature. More... | |
#define | GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8) |
length of the sessionkey in bytes (256 BIT sessionkey) More... | |
#define | GNUNET_CRYPTO_HASH_LENGTH (512 / 8) |
Length of a hash value. More... | |
#define | GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52 |
How many characters (without 0-terminator) are our ASCII-encoded public keys (ECDSA/EDDSA/ECDHE). More... | |
#define | GNUNET_CRYPTO_PAILLIER_BITS 2048 |
Size of paillier plain texts and public keys. More... | |
#define | GNUNET_CRYPTO_HPKE_AEAD_ID 0x0003 |
#define | GNUNET_CRYPTO_HPKE_NONCE_LEN 12 |
#define | GNUNET_CRYPTO_HPKE_KEY_LEN 32 |
#define | GNUNET_CRYPTO_HPKE_TAG_LEN 16 |
#define | GNUNET_CRYPTO_HPKE_SEAL_OVERHEAD_BYTES GNUNET_CRYPTO_HPKE_TAG_LEN |
#define | GNUNET_CRYPTO_HPKE_SEAL_ONESHOT_OVERHEAD_BYTES |
#define | GNUNET_CRYPTO_sign(priv, ps, sig) |
Sign a given block with GNUNET_CRYPTO_PrivateKey. More... | |
#define | GNUNET_CRYPTO_signature_verify(purp, ps, sig, pub) |
Verify a given signature with GNUNET_CRYPTO_PublicKey. More... | |
Typedefs | |
typedef void(* | GNUNET_ChildCompletedCallback) (void *cls, enum GNUNET_OS_ProcessStatusType type, long unsigned int exit_code) |
Defines a GNUNET_ChildCompletedCallback which is sent back upon death or completion of a child process. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_FileNameCallback) (void *cls, const char *filename) |
Function called with a filename. More... | |
typedef void(* | GNUNET_ContinuationCallback) (void *cls) |
Generic continuation callback. More... | |
typedef void(* | GNUNET_ResultCallback) (void *cls, int64_t result_code, const void *data, uint16_t data_size) |
Function called with the result of an asynchronous operation. More... | |
typedef void(* | GNUNET_CRYPTO_HashCompletedCallback) (void *cls, const struct GNUNET_HashCode *res) |
Function called once the hash computation over the specified file has completed. More... | |
Functions | |
void | GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity) |
Initialize a buffer with the given capacity. More... | |
void | GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n) |
Make sure that at least n bytes remaining in the buffer. More... | |
void | GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len) |
Write bytes to the buffer. More... | |
void | GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str) |
Write a 0-terminated string to a buffer, excluding the 0-terminator. More... | |
void | GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf, const void *data, size_t data_len) |
Write data encoded via GNUNET_STRINGS_data_to_string to the buffer. More... | |
void | GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str) |
Write a path component to a buffer, ensuring that there is exactly one slash between the previous contents of the buffer and the new string. More... | |
void | GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt,...) __attribute__((format(printf |
Write a 0-terminated formatted string to a buffer, excluding the 0-terminator. More... | |
void void | GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, const char *fmt, va_list args) |
Write a 0-terminated formatted string to a buffer, excluding the 0-terminator. More... | |
char * | GNUNET_buffer_reap_str (struct GNUNET_Buffer *buf) |
Clear the buffer and return the string it contained. More... | |
void * | GNUNET_buffer_reap (struct GNUNET_Buffer *buf, size_t *size) |
Clear the buffer and return its contents. More... | |
void | GNUNET_buffer_clear (struct GNUNET_Buffer *buf) |
Free the backing memory of the given buffer. More... | |
struct GNUNET_ChildWaitHandle * | GNUNET_wait_child (struct GNUNET_OS_Process *proc, GNUNET_ChildCompletedCallback cb, void *cb_cls) |
Starts the handling of the child processes. More... | |
void | GNUNET_wait_child_cancel (struct GNUNET_ChildWaitHandle *cwh) |
Stop waiting on this child. More... | |
int | GNUNET_get_log_call_status (int caller_level, const char *comp, const char *file, const char *function, int line) |
Decides whether a particular logging call should or should not be allowed to be made. More... | |
const char * | GNUNET_b2s (const void *buf, size_t buf_size) |
Convert a buffer to an 8-character string representative of the contents. More... | |
uint64_t | GNUNET_htonll (uint64_t n) |
Convert unsigned 64-bit integer to network byte order. More... | |
uint64_t | GNUNET_ntohll (uint64_t n) |
Convert unsigned 64-bit integer to host byte order. More... | |
double | GNUNET_hton_double (double d) |
Convert double to network byte order. More... | |
double | GNUNET_ntoh_double (double d) |
Convert double to host byte order. More... | |
int | GNUNET_memcmp_ct_ (const void *b1, const void *b2, size_t len) |
Compare memory in b1 and b2 in constant time, suitable for private data. More... | |
bool | GNUNET_is_zero_ (const void *a, size_t n) |
Check that memory in a is all zeros. More... | |
int int void * | GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber) |
Allocate memory. More... | |
void ** | GNUNET_xnew_array_2d_ (size_t n, size_t m, size_t elementSize, const char *filename, int linenumber) |
Allocate memory for a two dimensional array in one block and set up pointers. More... | |
void *** | GNUNET_xnew_array_3d_ (size_t n, size_t m, size_t o, size_t elementSize, const char *filename, int linenumber) |
Allocate memory for a three dimensional array in one block and set up pointers. More... | |
void * | GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename, int linenumber) |
Allocate and initialize memory. More... | |
void * | GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber) |
Allocate memory. More... | |
void * | GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber) |
Reallocate memory. More... | |
void | GNUNET_xfree_ (void *ptr, const char *filename, int linenumber) |
Free memory. More... | |
char * | GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber) |
Dup a string. More... | |
char * | GNUNET_xstrndup_ (const char *str, size_t len, const char *filename, int linenumber) |
Dup partially a string. More... | |
void | GNUNET_xgrow_ (void **old, size_t elementSize, unsigned int *oldCount, unsigned int newCount, const char *filename, int linenumber) |
Grow an array, the new elements are zeroed out. More... | |
void | GNUNET_async_scope_enter (const struct GNUNET_AsyncScopeId *aid, struct GNUNET_AsyncScopeSave *old_scope) |
Set the async scope for the current thread. More... | |
void | GNUNET_async_scope_restore (struct GNUNET_AsyncScopeSave *old_scope) |
Clear the current thread's async scope. More... | |
void | GNUNET_async_scope_get (struct GNUNET_AsyncScopeSave *scope_ret) |
Get the current async scope. More... | |
void | GNUNET_async_scope_fresh (struct GNUNET_AsyncScopeId *aid_ret) |
Generate a fresh async scope identifier. More... | |
int | GNUNET_try_compression (const char *data, size_t old_size, char **result, size_t *new_size) |
Try to compress the given block of data using libz. More... | |
char * | GNUNET_decompress (const char *input, size_t input_size, size_t output_size) |
Decompress input, return the decompressed data as output. More... | |
size_t | GNUNET_CONTAINER_bloomfilter_get_element_addresses (const struct GNUNET_CONTAINER_BloomFilter *bf) |
Get the number of the addresses set per element in the bloom filter. More... | |
struct GNUNET_CONTAINER_MultiHashMap32Iterator * | GNUNET_CONTAINER_multihashmap32_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap32 *map) |
Create an iterator for a 32-bit multihashmap. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONTAINER_multihashmap32_iterator_next (struct GNUNET_CONTAINER_MultiHashMap32Iterator *iter, uint32_t *key, const void **value) |
Retrieve the next element from the hash map at the iterator's position. More... | |
void | GNUNET_CONTAINER_multihashmap32_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter) |
Destroy a 32-bit multihashmap iterator. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONTAINER_heap_peek2 (const struct GNUNET_CONTAINER_Heap *heap, void **element, GNUNET_CONTAINER_HeapCostType *cost) |
Get element and cost stored at the root of heap. More... | |
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. More... | |
uint16_t | GNUNET_CRYPTO_crc16_finish (uint32_t sum) |
Convert results from GNUNET_CRYPTO_crc16_step to final crc16. More... | |
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. More... | |
void | GNUNET_CRYPTO_pow_hash (const struct GNUNET_CRYPTO_PowSalt *salt, const void *buf, size_t buf_len, struct GNUNET_HashCode *result) |
Calculate the 'proof-of-work' hash (an expensive hash). More... | |
struct GNUNET_HashContext * | GNUNET_CRYPTO_hash_context_start (void) |
Start incremental hashing operation. More... | |
struct GNUNET_HashContext * | GNUNET_CRYPTO_hash_context_copy (const struct GNUNET_HashContext *hc) |
Make a copy of the hash computation. More... | |
void | GNUNET_CRYPTO_hash_context_read (struct GNUNET_HashContext *hc, const void *buf, size_t size) |
Add data to be hashed. More... | |
void | GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash) |
Finish the hash computation. More... | |
void | GNUNET_CRYPTO_hash_context_abort (struct GNUNET_HashContext *hc) |
Abort hashing, do not bother calculating final result. More... | |
void | GNUNET_CRYPTO_hmac_raw (const void *key, size_t key_len, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac) |
Calculate HMAC of a message (RFC 2104) TODO: Shouldn't this be the standard hmac function and the above be renamed? More... | |
void | GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc) |
Cancel a file hashing operation. More... | |
unsigned int | GNUNET_CRYPTO_hash_count_leading_zeros (const struct GNUNET_HashCode *h) |
Count the number of leading 0 bits in h. More... | |
unsigned int | GNUNET_CRYPTO_hash_count_tailing_zeros (const struct GNUNET_HashCode *h) |
Count the number of tailing 0 bits in h. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_kdf_v (void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len, va_list argp) |
Derive key. More... | |
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. More... | |
char * | GNUNET_CRYPTO_ecdsa_public_key_to_string (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
Convert a public key to a string. More... | |
char * | GNUNET_CRYPTO_ecdsa_private_key_to_string (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv) |
Convert a private key to a string. More... | |
char * | GNUNET_CRYPTO_eddsa_private_key_to_string (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) |
Convert a private key to a string. More... | |
char * | GNUNET_CRYPTO_eddsa_public_key_to_string (const struct GNUNET_CRYPTO_EddsaPublicKey *pub) |
Convert a public key to a string. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdsa_public_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
Convert a string representing a public key to a public key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_private_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPrivateKey *priv) |
Convert a string representing a private key to a private key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_public_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPublicKey *pub) |
Convert a string representing a public key to a public key. More... | |
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. More... | |
int | GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc, const struct GNUNET_CRYPTO_EccPoint *input) |
Calculate ECC discrete logarithm for small factors. More... | |
void | GNUNET_CRYPTO_ecc_dexp (int val, struct GNUNET_CRYPTO_EccPoint *r) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecc_dexp_mpi (const struct GNUNET_CRYPTO_EccScalar *val, struct GNUNET_CRYPTO_EccPoint *r) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecc_pmul_mpi (const struct GNUNET_CRYPTO_EccPoint *p, const struct GNUNET_CRYPTO_EccScalar *val, struct GNUNET_CRYPTO_EccPoint *r) |
Multiply the point p on the elliptic curve by val. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecc_add (const struct GNUNET_CRYPTO_EccPoint *a, const struct GNUNET_CRYPTO_EccPoint *b, struct GNUNET_CRYPTO_EccPoint *r) |
Add two points on the elliptic curve. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccPoint *r, struct GNUNET_CRYPTO_EccPoint *r_inv) |
Obtain a random point on the curve and its additive inverse. More... | |
void | GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccScalar *r, struct GNUNET_CRYPTO_EccScalar *r_neg) |
Obtain a random scalar for point multiplication on the curve and its additive inverse. More... | |
void | GNUNET_CRYPTO_ecc_random_mod_n (struct GNUNET_CRYPTO_EccScalar *r) |
Generate a random value mod n. More... | |
void | GNUNET_CRYPTO_ecc_dlog_release (struct GNUNET_CRYPTO_EccDlogContext *dlc) |
Release precalculated values. More... | |
void | GNUNET_CRYPTO_ecc_scalar_from_int (int64_t val, struct GNUNET_CRYPTO_EccScalar *r) |
Create a scalar from int value. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_sk_to_x25519 (const struct GNUNET_CRYPTO_PrivateKey *sk, struct GNUNET_CRYPTO_EcdhePrivateKey *x25519) |
Convert a GNUnet identity key to a key sutiable for HPKE (X25519) More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_pk_to_x25519 (const struct GNUNET_CRYPTO_PublicKey *pk, struct GNUNET_CRYPTO_EcdhePublicKey *x25519) |
Convert a GNUnet identity key to a key sutiable for HPKE (X25519) More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_sender_setup (const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, const uint8_t *info, size_t info_len, struct GNUNET_CRYPTO_HpkeEncapsulation *enc, struct GNUNET_CRYPTO_HpkeContext *ctx) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_sender_setup2 (enum GNUNET_CRYPTO_HpkeKem kem, enum GNUNET_CRYPTO_HpkeMode mode, struct GNUNET_CRYPTO_EcdhePrivateKey *skE, struct GNUNET_CRYPTO_EcdhePrivateKey *skS, const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, const uint8_t *info, size_t info_len, const uint8_t *psk, size_t psk_len, const uint8_t *psk_id, size_t psk_id_len, struct GNUNET_CRYPTO_HpkeEncapsulation *enc, struct GNUNET_CRYPTO_HpkeContext *ctx) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_receiver_setup2 (enum GNUNET_CRYPTO_HpkeKem kem, enum GNUNET_CRYPTO_HpkeMode mode, const struct GNUNET_CRYPTO_HpkeEncapsulation *enc, const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, const struct GNUNET_CRYPTO_EcdhePublicKey *pkS, const uint8_t *info, size_t info_len, const uint8_t *psk, size_t psk_len, const uint8_t *psk_id, size_t psk_id_len, struct GNUNET_CRYPTO_HpkeContext *ctx) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_receiver_setup (const struct GNUNET_CRYPTO_HpkeEncapsulation *enc, const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, const uint8_t *info, size_t info_len, struct GNUNET_CRYPTO_HpkeContext *ctx) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_seal (struct GNUNET_CRYPTO_HpkeContext *ctx, const uint8_t *aad, size_t aad_len, const uint8_t *pt, size_t pt_len, uint8_t *ct, unsigned long long *ct_len) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_seal_oneshot (const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, const uint8_t *info, size_t info_len, const uint8_t *aad, size_t aad_len, const uint8_t *pt, size_t pt_len, uint8_t *ct, unsigned long long *ct_len) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_open (struct GNUNET_CRYPTO_HpkeContext *ctx, const uint8_t *aad, size_t aad_len, const uint8_t *ct, size_t ct_len, uint8_t *pt, unsigned long long *pt_len_p) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hpke_open_oneshot (const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, const uint8_t *info, size_t info_len, const uint8_t *aad, size_t aad_len, const uint8_t *ct, size_t ct_len, uint8_t *pt, unsigned long long *pt_len) |
RFC9180 HPKE encryption. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_sign_raw (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, void *data, size_t size, struct GNUNET_CRYPTO_EddsaSignature *sig) |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdsa_sign_derived (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, const char *context, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig) |
This is a signature function for ECDSA which takes a private key, derives/blinds it and signs the message. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_sign_derived (const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey, const char *label, const char *context, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig) |
This is a signature function for EdDSA which takes a private key and derives it using the label and context before signing. More... | |
void | GNUNET_CRYPTO_eddsa_key_get_public_from_scalar (const struct GNUNET_CRYPTO_EddsaPrivateScalar *s, struct GNUNET_CRYPTO_EddsaPublicKey *pkey) |
Extract the public key of the given private scalar. More... | |
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. More... | |
void | GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result, const void *data, size_t size) |
Convert data buffer into MPI value. More... | |
void | GNUNET_CRYPTO_paillier_create (struct GNUNET_CRYPTO_PaillierPublicKey *public_key, struct GNUNET_CRYPTO_PaillierPrivateKey *private_key) |
Create a freshly generated paillier public key. More... | |
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. More... | |
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. More... | |
int | GNUNET_CRYPTO_paillier_hom_add (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *c1, const struct GNUNET_CRYPTO_PaillierCiphertext *c2, struct GNUNET_CRYPTO_PaillierCiphertext *result) |
Compute a ciphertext that represents the sum of the plaintext in c1 and c2. More... | |
int | GNUNET_CRYPTO_paillier_hom_get_remaining (const struct GNUNET_CRYPTO_PaillierCiphertext *c) |
Get the number of remaining supported homomorphic operations. More... | |
struct GNUNET_CRYPTO_RsaPrivateKey * | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) |
Create a new private key. More... | |
void | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key) |
Free memory occupied by the private key. More... | |
size_t | GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_RsaPrivateKey *key, void **buffer) |
Encode the private key in a format suitable for storing it into a file. More... | |
struct GNUNET_CRYPTO_RsaPrivateKey * | GNUNET_CRYPTO_rsa_private_key_decode (const void *buf, size_t buf_size) |
Decode the private key from the data-format back to the "normal", internal format. More... | |
struct GNUNET_CRYPTO_RsaPrivateKey * | GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_RsaPrivateKey *key) |
Duplicate the given private key. More... | |
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. More... | |
void | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, struct GNUNET_HashCode *hc) |
Compute hash over the public key. More... | |
bool | GNUNET_CRYPTO_rsa_public_key_check (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
Check if key is well-formed. More... | |
unsigned int | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
Obtain the length of the RSA key in bits. More... | |
void | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key) |
Free memory occupied by the public key. More... | |
size_t | GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_RsaPublicKey *key, void **buffer) |
Encode the public key in a format suitable for storing it into a file. More... | |
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. More... | |
struct GNUNET_CRYPTO_RsaPublicKey * | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
Duplicate the given public key. More... | |
int | GNUNET_CRYPTO_rsa_signature_cmp (const struct GNUNET_CRYPTO_RsaSignature *s1, const struct GNUNET_CRYPTO_RsaSignature *s2) |
Compare the values of two signatures. More... | |
int | GNUNET_CRYPTO_rsa_private_key_cmp (const struct GNUNET_CRYPTO_RsaPrivateKey *p1, const struct GNUNET_CRYPTO_RsaPrivateKey *p2) |
Compare the values of two private keys. More... | |
int | GNUNET_CRYPTO_rsa_public_key_cmp (const struct GNUNET_CRYPTO_RsaPublicKey *p1, const struct GNUNET_CRYPTO_RsaPublicKey *p2) |
Compare the values of two public keys. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_rsa_blind (const void *message, size_t message_size, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey, struct GNUNET_CRYPTO_RsaBlindedMessage *bm) |
Blinds the given message with the given blinding key. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const struct GNUNET_CRYPTO_RsaBlindedMessage *bm) |
Sign a blinded value, which must be a full domain hash of a message. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *message, size_t message_size) |
Create and sign a full domain hash of a message. More... | |
void | GNUNET_CRYPTO_rsa_blinded_message_free (struct GNUNET_CRYPTO_RsaBlindedMessage *bm) |
Free memory occupied by blinded message. More... | |
void | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig) |
Free memory occupied by signature. More... | |
size_t | GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_RsaSignature *sig, void **buffer) |
Encode the given signature in a format suitable for storing it into a file. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_signature_decode (const void *buf, size_t buf_size) |
Decode the signature from the data-format back to the "normal", internal format. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig) |
Duplicate the given rsa signature. More... | |
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. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_rsa_verify (const void *message, size_t message_size, const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaPublicKey *public_key) |
Verify whether the given hash corresponds to the given signature and the signature is valid with respect to the given public key. More... | |
void | GNUNET_CRYPTO_cs_private_key_generate (struct GNUNET_CRYPTO_CsPrivateKey *priv) |
Create a new random private key. More... | |
void | GNUNET_CRYPTO_cs_private_key_get_public (const struct GNUNET_CRYPTO_CsPrivateKey *priv, struct GNUNET_CRYPTO_CsPublicKey *pub) |
Extract the public key of the given private key. More... | |
void | GNUNET_CRYPTO_cs_r_derive (const struct GNUNET_CRYPTO_CsSessionNonce *nonce, const char *seed, const struct GNUNET_CRYPTO_CsPrivateKey *lts, struct GNUNET_CRYPTO_CsRSecret r[2]) |
Derive a new secret r pair r0 and r1. More... | |
void | GNUNET_CRYPTO_cs_r_get_public (const struct GNUNET_CRYPTO_CsRSecret *r_priv, struct GNUNET_CRYPTO_CsRPublic *r_pub) |
Extract the public R of the given secret r. More... | |
void | GNUNET_CRYPTO_cs_blinding_secrets_derive (const struct GNUNET_CRYPTO_CsBlindingNonce *blind_seed, struct GNUNET_CRYPTO_CsBlindingSecret bs[2]) |
Derives new random blinding factors. More... | |
void | GNUNET_CRYPTO_cs_calc_blinded_c (const struct GNUNET_CRYPTO_CsBlindingSecret bs[2], const struct GNUNET_CRYPTO_CsRPublic r_pub[2], const struct GNUNET_CRYPTO_CsPublicKey *pub, const void *msg, size_t msg_len, struct GNUNET_CRYPTO_CsC blinded_c[2], struct GNUNET_CRYPTO_CSPublicRPairP *r_pub_blind) |
Calculate two blinded c's. More... | |
void | GNUNET_CRYPTO_cs_sign_derive (const struct GNUNET_CRYPTO_CsPrivateKey *priv, const struct GNUNET_CRYPTO_CsRSecret r[2], const struct GNUNET_CRYPTO_CsBlindedMessage *bm, struct GNUNET_CRYPTO_CsBlindSignature *cs_blind_sig) |
Sign a blinded c. More... | |
void | GNUNET_CRYPTO_cs_unblind (const struct GNUNET_CRYPTO_CsBlindS *blinded_signature_scalar, const struct GNUNET_CRYPTO_CsBlindingSecret *bs, struct GNUNET_CRYPTO_CsS *signature_scalar) |
Unblind a blind-signed signature using a c that was blinded. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_cs_verify (const struct GNUNET_CRYPTO_CsSignature *sig, const struct GNUNET_CRYPTO_CsPublicKey *pub, const void *msg, size_t msg_len) |
Verify whether the given message corresponds to the given signature and the signature is valid with respect to the given public key. More... | |
struct GNUNET_CRYPTO_BlindingInputValues * | GNUNET_CRYPTO_get_blinding_input_values (const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const char *salt) |
Compute blinding input values for a given nonce and salt. More... | |
void | GNUNET_CRYPTO_blind_sign_pub_decref (struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub) |
Decrement reference counter of a bsign_pub, and free it if it reaches zero. More... | |
void | GNUNET_CRYPTO_blind_sign_priv_decref (struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv) |
Decrement reference counter of a bsign_priv, and free it if it reaches zero. More... | |
void | GNUNET_CRYPTO_unblinded_sig_decref (struct GNUNET_CRYPTO_UnblindedSignature *ub_sig) |
Decrement reference counter of a ub_sig, and free it if it reaches zero. More... | |
void | GNUNET_CRYPTO_blinded_sig_decref (struct GNUNET_CRYPTO_BlindedSignature *blind_sig) |
Decrement reference counter of a blind_sig, and free it if it reaches zero. More... | |
void | GNUNET_CRYPTO_blinded_message_decref (struct GNUNET_CRYPTO_BlindedMessage *bm) |
Decrement reference counter of a bm, and free it if it reaches zero. More... | |
struct GNUNET_CRYPTO_BlindedMessage * | GNUNET_CRYPTO_blinded_message_incref (struct GNUNET_CRYPTO_BlindedMessage *bm) |
Increment reference counter of the given bm. More... | |
struct GNUNET_CRYPTO_BlindingInputValues * | GNUNET_CRYPTO_blinding_input_values_incref (struct GNUNET_CRYPTO_BlindingInputValues *bm) |
Increment reference counter of the given bi. More... | |
void | GNUNET_CRYPTO_blinding_input_values_decref (struct GNUNET_CRYPTO_BlindingInputValues *bm) |
Decrement reference counter of the given bi, and free it if it reaches zero. More... | |
struct GNUNET_CRYPTO_BlindSignPublicKey * | GNUNET_CRYPTO_bsign_pub_incref (struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub) |
Increment reference counter of the given bsign_pub. More... | |
struct GNUNET_CRYPTO_BlindSignPrivateKey * | GNUNET_CRYPTO_bsign_priv_incref (struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv) |
Increment reference counter of the given bsign_priv. More... | |
struct GNUNET_CRYPTO_UnblindedSignature * | GNUNET_CRYPTO_ub_sig_incref (struct GNUNET_CRYPTO_UnblindedSignature *ub_sig) |
Increment reference counter of the given ub_sig. More... | |
struct GNUNET_CRYPTO_BlindedSignature * | GNUNET_CRYPTO_blind_sig_incref (struct GNUNET_CRYPTO_BlindedSignature *blind_sig) |
Increment reference counter of the given blind_sig. More... | |
int | GNUNET_CRYPTO_bsign_pub_cmp (const struct GNUNET_CRYPTO_BlindSignPublicKey *bp1, const struct GNUNET_CRYPTO_BlindSignPublicKey *bp2) |
Compare two denomination public keys. More... | |
int | GNUNET_CRYPTO_ub_sig_cmp (const struct GNUNET_CRYPTO_UnblindedSignature *sig1, const struct GNUNET_CRYPTO_UnblindedSignature *sig2) |
Compare two denomination signatures. More... | |
int | GNUNET_CRYPTO_blind_sig_cmp (const struct GNUNET_CRYPTO_BlindedSignature *sig1, const struct GNUNET_CRYPTO_BlindedSignature *sig2) |
Compare two blinded denomination signatures. More... | |
int | GNUNET_CRYPTO_blinded_message_cmp (const struct GNUNET_CRYPTO_BlindedMessage *bp1, const struct GNUNET_CRYPTO_BlindedMessage *bp2) |
Compare two blinded messages. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_blind_sign_keys_create (struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher,...) |
Initialize public-private key pair for blind signatures. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_blind_sign_keys_create_va (struct GNUNET_CRYPTO_BlindSignPrivateKey **bsign_priv, struct GNUNET_CRYPTO_BlindSignPublicKey **bsign_pub, enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher, va_list ap) |
Initialize public-private key pair for blind signatures. More... | |
struct GNUNET_CRYPTO_BlindedMessage * | GNUNET_CRYPTO_message_blind_to_sign (const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub, const union GNUNET_CRYPTO_BlindingSecretP *bks, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const void *message, size_t message_size, const struct GNUNET_CRYPTO_BlindingInputValues *alg_values) |
Blind message for blind signing with dk using blinding secret coin_bks. More... | |
struct GNUNET_CRYPTO_BlindedSignature * | GNUNET_CRYPTO_blind_sign (const struct GNUNET_CRYPTO_BlindSignPrivateKey *bsign_priv, const char *salt, const struct GNUNET_CRYPTO_BlindedMessage *blinded_message) |
Create blind signature. More... | |
struct GNUNET_CRYPTO_UnblindedSignature * | GNUNET_CRYPTO_blind_sig_unblind (const struct GNUNET_CRYPTO_BlindedSignature *blinded_sig, const union GNUNET_CRYPTO_BlindingSecretP *bks, const void *message, size_t message_size, const struct GNUNET_CRYPTO_BlindingInputValues *alg_values, const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub) |
Unblind blind signature. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_blind_sig_verify (const struct GNUNET_CRYPTO_BlindSignPublicKey *bsign_pub, const struct GNUNET_CRYPTO_UnblindedSignature *ub_sig, const void *message, size_t message_size) |
Verify signature made blindly. More... | |
ssize_t | GNUNET_CRYPTO_public_key_get_length (const struct GNUNET_CRYPTO_PublicKey *key) |
Get the compacted length of a GNUNET_CRYPTO_PublicKey. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_read_public_key_from_buffer (const void *buffer, size_t len, struct GNUNET_CRYPTO_PublicKey *key, size_t *read) |
Reads a GNUNET_CRYPTO_PublicKey from a compact buffer. More... | |
ssize_t | GNUNET_CRYPTO_private_key_get_length (const struct GNUNET_CRYPTO_PrivateKey *key) |
Get the compacted length of a GNUNET_CRYPTO_PrivateKey. More... | |
ssize_t | GNUNET_CRYPTO_write_public_key_to_buffer (const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len) |
Writes a GNUNET_CRYPTO_PublicKey to a compact buffer. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_read_private_key_from_buffer (const void *buffer, size_t len, struct GNUNET_CRYPTO_PrivateKey *key, size_t *read) |
Reads a GNUNET_CRYPTO_PrivateKey from a compact buffer. More... | |
ssize_t | GNUNET_CRYPTO_write_private_key_to_buffer (const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len) |
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer. More... | |
ssize_t | GNUNET_CRYPTO_signature_get_length (const struct GNUNET_CRYPTO_Signature *sig) |
Get the compacted length of a GNUNET_CRYPTO_Signature. More... | |
ssize_t | GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type) |
Get the compacted length of a signature by type. More... | |
ssize_t | GNUNET_CRYPTO_read_signature_from_buffer (struct GNUNET_CRYPTO_Signature *sig, const void *buffer, size_t len) |
Reads a GNUNET_CRYPTO_Signature from a compact buffer. More... | |
ssize_t | GNUNET_CRYPTO_write_signature_to_buffer (const struct GNUNET_CRYPTO_Signature *sig, void *buffer, size_t len) |
Writes a GNUNET_CRYPTO_Signature to a compact buffer. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_sign_ (const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_Signature *sig) |
Sign a given block. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_sign_raw_ (const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, unsigned char *sig) |
Sign a given block. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_signature_verify_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_Signature *sig, const struct GNUNET_CRYPTO_PublicKey *pub) |
Verify a given signature. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_signature_verify_raw_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const unsigned char *sig, const struct GNUNET_CRYPTO_PublicKey *pub) |
Verify a given signature. More... | |
char * | GNUNET_CRYPTO_public_key_to_string (const struct GNUNET_CRYPTO_PublicKey *key) |
Creates a (Base32) string representation of the public key. More... | |
char * | GNUNET_CRYPTO_private_key_to_string (const struct GNUNET_CRYPTO_PrivateKey *key) |
Creates a (Base32) string representation of the private key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_public_key_from_string (const char *str, struct GNUNET_CRYPTO_PublicKey *key) |
Parses a (Base32) string representation of the public key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_private_key_from_string (const char *str, struct GNUNET_CRYPTO_PrivateKey *key) |
Parses a (Base32) string representation of the private key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_key_get_public (const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key) |
Retrieves the public key representation of a private key. More... | |
struct GNUNET_OP_Handle * | GNUNET_OP_create () |
Create new operations handle. More... | |
void | GNUNET_OP_destroy (struct GNUNET_OP_Handle *h) |
Destroy operations handle. More... | |
uint64_t | GNUNET_OP_get_next_id (struct GNUNET_OP_Handle *h) |
Get a unique operation ID to distinguish between asynchronous requests. More... | |
int | GNUNET_OP_get (struct GNUNET_OP_Handle *h, uint64_t op_id, GNUNET_ResultCallback *result_cb, void **cls, void **ctx) |
Find operation by ID. More... | |
uint64_t | GNUNET_OP_add (struct GNUNET_OP_Handle *h, GNUNET_ResultCallback result_cb, void *cls, void *ctx) |
Add a new operation. More... | |
int | GNUNET_OP_result (struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx) |
Call the result callback of an operation and remove it. More... | |
int | GNUNET_OP_remove (struct GNUNET_OP_Handle *h, uint64_t op_id) |
Remove / cancel an operation. More... | |
Variables | |
uint32_t | GNUNET_HashCode::bits [512/8/sizeof(uint32_t)] |
uint32_t | GNUNET_ShortHashCode::bits [256/8/sizeof(uint32_t)] |
uint32_t | GNUNET_Uuid::value [4] |
128 random bits. More... | |
uint16_t | GNUNET_MessageHeader::size |
The length of the struct (in bytes, including the length field itself), in big-endian format. More... | |
uint16_t | GNUNET_MessageHeader::type |
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format. More... | |
struct GNUNET_MessageHeader | GNUNET_OperationResultMessage::header |
uint32_t | GNUNET_OperationResultMessage::reserved |
uint64_t | GNUNET_OperationResultMessage::op_id |
Operation ID. More... | |
uint64_t | GNUNET_OperationResultMessage::result_code |
Status code for the operation. More... | |
uint32_t | GNUNET_AsyncScopeId::bits [16/sizeof(uint32_t)] |
struct GNUNET_AsyncScopeId | GNUNET_AsyncScopeSave::scope_id |
Saved scope. More... | |
int | GNUNET_AsyncScopeSave::have_scope |
GNUNET_YES unless this saved scope is the unnamed root scope. More... | |
GNUNET_MQ_MessageValidationCallback | GNUNET_MQ_MessageHandler::mv |
Callback to validate a message of the specified type. More... | |
GNUNET_MQ_MessageCallback | GNUNET_MQ_MessageHandler::cb |
Callback, called every time a new message of the specified type has been received. More... | |
void * | GNUNET_MQ_MessageHandler::cls |
Closure for mv and cb. More... | |
uint16_t | GNUNET_MQ_MessageHandler::type |
Type of the message this handler covers, in host byte order. More... | |
uint16_t | GNUNET_MQ_MessageHandler::expected_size |
Expected size of messages of this type. More... | |
Multi-function utilities library for GNUnet programs.
Common buffer management functions.
#define GNUNET_UTIL_VERSION 0x000A0104 |
Version of the API (for entire gnunetutil.so library).
Definition at line 98 of file gnunet_common.h.
#define GNUNET_MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Definition at line 117 of file gnunet_common.h.
#define GNUNET_MAX | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Definition at line 119 of file gnunet_common.h.
#define BYTE_SWAP_16 | ( | x | ) | ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) |
Endian operations.
Definition at line 168 of file gnunet_common.h.
#define BYTE_SWAP_32 | ( | x | ) |
Definition at line 170 of file gnunet_common.h.
#define BYTE_SWAP_64 | ( | x | ) |
Definition at line 174 of file gnunet_common.h.
#define GNUNET_htobe16 | ( | x | ) | BYTE_SWAP_16 (x) |
Definition at line 203 of file gnunet_common.h.
#define GNUNET_htobe16 | ( | x | ) | (x) |
Definition at line 203 of file gnunet_common.h.
#define GNUNET_htole16 | ( | x | ) | (x) |
Definition at line 204 of file gnunet_common.h.
#define GNUNET_htole16 | ( | x | ) | BYTE_SWAP_16 (x) |
Definition at line 204 of file gnunet_common.h.
#define GNUNET_be16toh | ( | x | ) | BYTE_SWAP_16 (x) |
Definition at line 205 of file gnunet_common.h.
#define GNUNET_be16toh | ( | x | ) | (x) |
Definition at line 205 of file gnunet_common.h.
#define GNUNET_le16toh | ( | x | ) | (x) |
Definition at line 206 of file gnunet_common.h.
#define GNUNET_le16toh | ( | x | ) | BYTE_SWAP_16 (x) |
Definition at line 206 of file gnunet_common.h.
#define GNUNET_htobe32 | ( | x | ) | BYTE_SWAP_32 (x) |
Definition at line 208 of file gnunet_common.h.
#define GNUNET_htobe32 | ( | x | ) | (x) |
Definition at line 208 of file gnunet_common.h.
#define GNUNET_htole32 | ( | x | ) | (x) |
Definition at line 209 of file gnunet_common.h.
#define GNUNET_htole32 | ( | x | ) | BYTE_SWAP_32 (x) |
Definition at line 209 of file gnunet_common.h.
#define GNUNET_be32toh | ( | x | ) | BYTE_SWAP_32 (x) |
Definition at line 210 of file gnunet_common.h.
#define GNUNET_be32toh | ( | x | ) | (x) |
Definition at line 210 of file gnunet_common.h.
#define GNUNET_le32toh | ( | x | ) | (x) |
Definition at line 211 of file gnunet_common.h.
#define GNUNET_le32toh | ( | x | ) | BYTE_SWAP_32 (x) |
Definition at line 211 of file gnunet_common.h.
#define GNUNET_htobe64 | ( | x | ) | BYTE_SWAP_64 (x) |
Definition at line 213 of file gnunet_common.h.
#define GNUNET_htobe64 | ( | x | ) | (x) |
Definition at line 213 of file gnunet_common.h.
#define GNUNET_htole64 | ( | x | ) | (x) |
Definition at line 214 of file gnunet_common.h.
#define GNUNET_htole64 | ( | x | ) | BYTE_SWAP_64 (x) |
Definition at line 214 of file gnunet_common.h.
#define GNUNET_be64toh | ( | x | ) | BYTE_SWAP_64 (x) |
Definition at line 215 of file gnunet_common.h.
#define GNUNET_be64toh | ( | x | ) | (x) |
Definition at line 215 of file gnunet_common.h.
#define GNUNET_le64toh | ( | x | ) | (x) |
Definition at line 216 of file gnunet_common.h.
#define GNUNET_le64toh | ( | x | ) | BYTE_SWAP_64 (x) |
Definition at line 216 of file gnunet_common.h.
#define GNUNET_NZL | ( | l | ) | GNUNET_MAX (1, l) |
Macro used to avoid using 0 for the length of a variable-size array (Non-Zero-Length).
Basically, C standard says that "int[n] x;" is undefined if n=0. This was supposed to prevent issues with pointer aliasing. However, C compilers may conclude that n!=0 as n=0 would be undefined, and then optimize under the assumption n!=0, which could cause actual issues. Hence, when initializing an array on the stack with a variable-length that might be zero, write "int[GNUNET_NZL(n)] x;" instead of "int[n] x".
Definition at line 232 of file gnunet_common.h.
#define GNUNET_PACKED __attribute__ ((packed)) |
gcc-ism to get packed structs.
Definition at line 238 of file gnunet_common.h.
#define GNUNET_ALIGN __attribute__ ((aligned (8))) |
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's.
See also gcc bug #33594.
Definition at line 253 of file gnunet_common.h.
#define GNUNET_UNUSED __attribute__ ((unused)) |
gcc-ism to document unused arguments
Definition at line 259 of file gnunet_common.h.
#define GNUNET_NORETURN __attribute__ ((noreturn)) |
gcc-ism to document functions that don't return
Definition at line 264 of file gnunet_common.h.
#define GNUNET_NETWORK_STRUCT_BEGIN |
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
Definition at line 269 of file gnunet_common.h.
#define GNUNET_NETWORK_STRUCT_END |
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
Definition at line 274 of file gnunet_common.h.
#define GN_LIKELY | ( | expr | ) | (expr) |
Definition at line 517 of file gnunet_common.h.
#define GN_UNLIKELY | ( | expr | ) | (expr) |
Definition at line 518 of file gnunet_common.h.
#define GNUNET_LOG_CALL_STATUS -1 |
Definition at line 522 of file gnunet_common.h.
#define GNUNET_log_from | ( | kind, | |
comp, | |||
... | |||
) |
Definition at line 545 of file gnunet_common.h.
#define GNUNET_log | ( | kind, | |
... | |||
) |
Definition at line 571 of file gnunet_common.h.
#define GNUNET_B2S | ( | obj | ) | GNUNET_b2s ((obj), sizeof (*(obj))) |
Convert a fixed-sized object to a string using GNUNET_b2s().
obj | address of object to convert |
Definition at line 664 of file gnunet_common.h.
#define GNUNET_static_assert | ( | cond | ) | GNUNET_assert (cond) |
Assertion to be checked (if supported by C compiler) at compile time, otherwise checked at runtime and resulting in an abort() on failure.
This is the case where the compiler does not support static assertions.
cond | condition to test, 0 implies failure |
Definition at line 1055 of file gnunet_common.h.
#define GNUNET_memcmp | ( | a, | |
b | |||
) |
Compare memory in a and b, where both must be of the same pointer type.
Do NOT use this function on arrays, it would only compare the first element!
Definition at line 1269 of file gnunet_common.h.
#define GNUNET_memcmp_priv | ( | a, | |
b | |||
) |
Compare memory in a and b in constant time, suitable for private data.
Both a and b must be of the same pointer type.
Do NOT use this function on arrays, it would only compare the first element!
Definition at line 1298 of file gnunet_common.h.
#define GNUNET_is_zero | ( | a | ) | GNUNET_is_zero_ ((a), sizeof (*(a))) |
Check that memory in a is all zeros.
a must be a pointer.
a | pointer to a struct which should be tested for the entire memory being zero'ed out. |
Definition at line 1326 of file gnunet_common.h.
#define GNUNET_memcpy | ( | dst, | |
src, | |||
n | |||
) |
Call memcpy() but check for n being 0 first.
In the latter case, it is now safe to pass NULL for src or dst. Unlike traditional memcpy(), returns nothing.
dst | destination of the copy, may be NULL if n is zero |
src | source of the copy, may be NULL if n is zero |
n | number of bytes to copy |
Definition at line 1339 of file gnunet_common.h.
#define __func__ "<unknown>" |
Definition at line 1854 of file gnunet_common.h.
#define GNUNET_CONTAINER_LIB_H |
Definition at line 61 of file gnunet_container_lib.h.
#define GNUNET_CONTAINER_DLL_insert_sorted | ( | TYPE, | |
comparator, | |||
comparator_cls, | |||
head, | |||
tail, | |||
element | |||
) |
Insertion sort of element into DLL from head to tail sorted by comparator.
TYPE | element type of the elements, e.g. struct ListElement | |
comparator | function like memcmp() to compare elements; takes three arguments, the comparator_cls and two elements, returns an int (-1, 0 or 1) | |
comparator_cls | closure for comparator | |
[in,out] | head | head of DLL |
[in,out] | tail | tail of DLL |
element | element to insert |
Definition at line 2097 of file gnunet_container_lib.h.
#define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126 |
Maximum length of an ECC signature.
Note: round up to multiple of 8 minus 2 for alignment.
Definition at line 77 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8) |
length of the sessionkey in bytes (256 BIT sessionkey)
Definition at line 110 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HASH_LENGTH (512 / 8) |
Length of a hash value.
Definition at line 115 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52 |
How many characters (without 0-terminator) are our ASCII-encoded public keys (ECDSA/EDDSA/ECDHE).
Definition at line 121 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_PAILLIER_BITS 2048 |
Size of paillier plain texts and public keys.
Private keys and ciphertexts are twice this size.
Definition at line 532 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HPKE_AEAD_ID 0x0003 |
Definition at line 2121 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HPKE_NONCE_LEN 12 |
Definition at line 2124 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HPKE_KEY_LEN 32 |
Definition at line 2127 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HPKE_TAG_LEN 16 |
Definition at line 2130 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HPKE_SEAL_OVERHEAD_BYTES GNUNET_CRYPTO_HPKE_TAG_LEN |
Definition at line 2133 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_HPKE_SEAL_ONESHOT_OVERHEAD_BYTES |
Definition at line 2136 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_sign | ( | priv, | |
ps, | |||
sig | |||
) |
Sign a given block with GNUNET_CRYPTO_PrivateKey.
The ps data must be a fixed-size struct for which the signature is to be created. The size
field in ps->purpose must correctly indicate the number of bytes of the data structure, including its header.
priv | private key to use for the signing | |
ps | packed struct with what to sign, MUST begin with a purpose | |
[out] | sig | where to write the signature |
Definition at line 4821 of file gnunet_crypto_lib.h.
Verify a given signature with GNUNET_CRYPTO_PublicKey.
The ps data must be a fixed-size struct for which the signature is to be created. The size
field in ps->purpose must correctly indicate the number of bytes of the data structure, including its header.
purp | purpose of the signature, must match 'ps->purpose.purpose' (except in host byte order) |
ps | packed struct with what to sign, MUST begin with a purpose |
sig | where to read the signature from |
pub | public key to use for the verifying |
Definition at line 4894 of file gnunet_crypto_lib.h.
typedef void(* GNUNET_ChildCompletedCallback) (void *cls, enum GNUNET_OS_ProcessStatusType type, long unsigned int exit_code) |
Defines a GNUNET_ChildCompletedCallback which is sent back upon death or completion of a child process.
cls | handle for the callback |
type | type of the process |
exit_code | status code of the process |
Definition at line 53 of file gnunet_child_management_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_FileNameCallback) (void *cls, const char *filename) |
Function called with a filename.
cls | closure |
filename | complete filename (absolute path) |
Definition at line 1 of file gnunet_common.h.
typedef void(* GNUNET_ContinuationCallback) (void *cls) |
Generic continuation callback.
cls | Closure. |
Definition at line 404 of file gnunet_common.h.
typedef void(* GNUNET_ResultCallback) (void *cls, int64_t result_code, const void *data, uint16_t data_size) |
Function called with the result of an asynchronous operation.
cls | Closure. |
result_code | Result code for the operation. |
data | Data result for the operation. |
data_size | Size of data. |
Definition at line 420 of file gnunet_common.h.
typedef void(* GNUNET_CRYPTO_HashCompletedCallback) (void *cls, const struct GNUNET_HashCode *res) |
Function called once the hash computation over the specified file has completed.
cls | closure |
res | resulting hash, NULL on error |
Definition at line 1147 of file gnunet_crypto_lib.h.
Named constants for return values.
The following invariants hold: GNUNET_NO == 0
(to allow if (GNUNET_NO)
) GNUNET_OK != GNUNET_SYSERR
, GNUNET_OK != GNUNET_NO
, GNUNET_NO != GNUNET_SYSERR
and finally GNUNET_YES != GNUNET_NO
.
Enumerator | |
---|---|
GNUNET_SYSERR | |
GNUNET_NO | |
GNUNET_OK | |
GNUNET_YES |
Definition at line 107 of file gnunet_common.h.
Valid task priorities.
Use these, do not pass random integers! For various reasons (#3862 – building with QT Creator, and our restricted cross-compilation with emscripten) this cannot be in gnunet_scheduler_lib.h, but it works if we declare it here. Naturally, logically this is part of the scheduler.
Definition at line 1866 of file gnunet_common.h.
Key type for the generic public key union.
Enumerator | |
---|---|
GNUNET_PUBLIC_KEY_TYPE_ECDSA | The identity type. The value is the same as the PKEY record type. |
GNUNET_PUBLIC_KEY_TYPE_EDDSA | EDDSA identity. The value is the same as the EDKEY record type. |
Definition at line 379 of file gnunet_crypto_lib.h.
HPKE RFC 9180.
The HPKE Mode "PSK" stands for "Pre-Shared Key". The "AUTH" variants use an authenticating KEM construction.
Enumerator | |
---|---|
GNUNET_CRYPTO_HPKE_MODE_BASE | |
GNUNET_CRYPTO_HPKE_MODE_PSK | |
GNUNET_CRYPTO_HPKE_MODE_AUTH | |
GNUNET_CRYPTO_HPKE_MODE_AUTH_PSK |
Definition at line 2112 of file gnunet_crypto_lib.h.
Enumerator | |
---|---|
GNUNET_CRYPTO_HPKE_ROLE_R | |
GNUNET_CRYPTO_HPKE_ROLE_S |
Definition at line 2140 of file gnunet_crypto_lib.h.
Enumerator | |
---|---|
GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256 | |
GNUNET_CRYPTO_HPKE_KEM_DH_X25519ELLIGATOR_HKDF256 |
Definition at line 2155 of file gnunet_crypto_lib.h.
Types of public keys used for blind signatures.
Enumerator | |
---|---|
GNUNET_CRYPTO_BSA_INVALID | Invalid type of signature. |
GNUNET_CRYPTO_BSA_RSA | RSA blind signature. |
GNUNET_CRYPTO_BSA_CS | Clause Blind Schnorr signature. |
Definition at line 4012 of file gnunet_crypto_lib.h.
void GNUNET_buffer_prealloc | ( | struct GNUNET_Buffer * | buf, |
size_t | capacity | ||
) |
Initialize a buffer with the given capacity.
When a buffer is allocated with this function, a warning is logged when the buffer exceeds the initial capacity.
buf | the buffer to initialize |
capacity | the capacity (in bytes) to allocate for buf |
Definition at line 35 of file buffer.c.
References GNUNET_Buffer::capacity, GNUNET_assert, GNUNET_malloc, GNUNET_YES, GNUNET_Buffer::mem, GNUNET_Buffer::position, and GNUNET_Buffer::warn_grow.
void GNUNET_buffer_ensure_remaining | ( | struct GNUNET_Buffer * | buf, |
size_t | n | ||
) |
Make sure that at least n bytes remaining in the buffer.
buf | buffer to potentially grow |
n | number of bytes that should be available to write |
Definition at line 55 of file buffer.c.
References GNUNET_Buffer::capacity, GNUNET_assert, GNUNET_break, GNUNET_malloc, GNUNET_realloc, GNUNET_YES, GNUNET_Buffer::mem, GNUNET_Buffer::position, and GNUNET_Buffer::warn_grow.
Referenced by GNUNET_buffer_reap_str(), GNUNET_buffer_write(), GNUNET_buffer_write_data_encoded(), GNUNET_buffer_write_path(), and GNUNET_buffer_write_vfstr().
void GNUNET_buffer_write | ( | struct GNUNET_Buffer * | buf, |
const char * | data, | ||
size_t | len | ||
) |
Write bytes to the buffer.
Grows the buffer if necessary.
buf | buffer to write to |
data | data to read from |
len | number of bytes to copy from data to buf |
Definition at line 86 of file buffer.c.
References data, GNUNET_buffer_ensure_remaining(), GNUNET_Buffer::mem, and GNUNET_Buffer::position.
Referenced by GNUNET_buffer_write_path(), GNUNET_buffer_write_str(), GNUNET_STRINGS_urlencode(), and write_to_buffer().
void GNUNET_buffer_write_str | ( | struct GNUNET_Buffer * | buf, |
const char * | str | ||
) |
Write a 0-terminated string to a buffer, excluding the 0-terminator.
Grows the buffer if necessary.
buf | the buffer to write to |
str | the string to write to buf |
buf | the buffer to write to |
str | the string to write to buf |
Definition at line 103 of file buffer.c.
References GNUNET_buffer_write().
Referenced by GNUNET_CONFIGURATION_serialize_diagnostics(), and login_redirect().
void GNUNET_buffer_write_data_encoded | ( | struct GNUNET_Buffer * | buf, |
const void * | data, | ||
size_t | data_len | ||
) |
Write data encoded via GNUNET_STRINGS_data_to_string to the buffer.
Grows the buffer if necessary.
buf | buffer to write to |
data | data to read from |
data_len | number of bytes to copy from data to buf |
Definition at line 265 of file buffer.c.
References GNUNET_Buffer::capacity, data, GNUNET_assert, GNUNET_buffer_ensure_remaining(), GNUNET_STRINGS_data_to_string(), GNUNET_Buffer::mem, and GNUNET_Buffer::position.
void GNUNET_buffer_write_path | ( | struct GNUNET_Buffer * | buf, |
const char * | str | ||
) |
Write a path component to a buffer, ensuring that there is exactly one slash between the previous contents of the buffer and the new string.
buf | buffer to write to |
str | string containing the new path component |
Definition at line 181 of file buffer.c.
References GNUNET_buffer_ensure_remaining(), GNUNET_buffer_write(), GNUNET_Buffer::mem, and GNUNET_Buffer::position.
void GNUNET_buffer_write_fstr | ( | struct GNUNET_Buffer * | buf, |
const char * | fmt, | ||
... | |||
) |
Write a 0-terminated formatted string to a buffer, excluding the 0-terminator.
Grows the buffer if necessary.
buf | the buffer to write to |
fmt | format string |
... | format arguments |
Referenced by GNUNET_CONFIGURATION_serialize_diagnostics(), GNUNET_STRINGS_urlencode(), and login_redirect().
void void GNUNET_buffer_write_vfstr | ( | struct GNUNET_Buffer * | buf, |
const char * | fmt, | ||
va_list | args | ||
) |
Write a 0-terminated formatted string to a buffer, excluding the 0-terminator.
Grows the buffer if necessary.
buf | the buffer to write to |
fmt | format string |
args | format argument list |
Definition at line 231 of file buffer.c.
References consensus-simulation::args, GNUNET_Buffer::capacity, GNUNET_assert, GNUNET_buffer_ensure_remaining(), GNUNET_Buffer::mem, GNUNET_Buffer::position, and res.
Referenced by GNUNET_buffer_write_fstr().
char * GNUNET_buffer_reap_str | ( | struct GNUNET_Buffer * | buf | ) |
Clear the buffer and return the string it contained.
The caller is responsible to eventually GNUNET_free the returned string.
The returned string is always 0-terminated.
buf | the buffer to reap the string from |
Definition at line 123 of file buffer.c.
References GNUNET_buffer_ensure_remaining(), GNUNET_Buffer::mem, GNUNET_Buffer::position, and res.
Referenced by GNUNET_CONFIGURATION_serialize_diagnostics(), GNUNET_STRINGS_urlencode(), and login_redirect().
void * GNUNET_buffer_reap | ( | struct GNUNET_Buffer * | buf, |
size_t * | size | ||
) |
Clear the buffer and return its contents.
The caller is responsible to eventually GNUNET_free the returned data.
buf | the buffer to reap the contents from |
size | where to store the size of the returned data |
Definition at line 149 of file buffer.c.
References GNUNET_Buffer::mem, GNUNET_Buffer::position, res, and size.
Referenced by GNUNET_BIO_get_buffer_contents().
void GNUNET_buffer_clear | ( | struct GNUNET_Buffer * | buf | ) |
Free the backing memory of the given buffer.
Does not free the memory of the buffer control structure, which is typically stack-allocated.
Definition at line 165 of file buffer.c.
References GNUNET_free, and GNUNET_Buffer::mem.
Referenced by GNUNET_BIO_write_close(), and GNUNET_STRINGS_urlencode().
struct GNUNET_ChildWaitHandle * GNUNET_wait_child | ( | struct GNUNET_OS_Process * | proc, |
GNUNET_ChildCompletedCallback | cb, | ||
void * | cb_cls | ||
) |
Starts the handling of the child processes.
Function checks the status of the child process and sends back a GNUNET_ChildCompletedCallback upon completion/death of the child.
proc | child process which is monitored |
cb | reference to the callback which is called after completion |
cb_cls | closure for the callback |
Definition at line 198 of file child_management.c.
References GNUNET_ChildWaitHandle::cb, GNUNET_ChildWaitHandle::cb_cls, child_management_start(), cwh_head, cwh_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_pipe_handle(), GNUNET_new, GNUNET_SCHEDULER_add_read_file(), GNUNET_TIME_UNIT_FOREVER_REL, maint_child_death(), GNUNET_ChildWaitHandle::proc, sig_task, sighandler_child_death(), and sigpipe.
Referenced by exec_bash_script_run(), handle_uri(), and netjail_start_run().
void GNUNET_wait_child_cancel | ( | struct GNUNET_ChildWaitHandle * | cwh | ) |
Stop waiting on this child.
Definition at line 231 of file child_management.c.
References child_management_done(), cwh_head, cwh_tail, GNUNET_CONTAINER_DLL_remove, and GNUNET_free.
Referenced by exec_bash_script_cleanup(), netjail_start_cleanup(), and shutdown_program().
int GNUNET_get_log_call_status | ( | int | caller_level, |
const char * | comp, | ||
const char * | file, | ||
const char * | function, | ||
int | line | ||
) |
Decides whether a particular logging call should or should not be allowed to be made.
Used internally by GNUNET_log*()
caller_level | loglevel the caller wants to use |
comp | component name the caller uses (NULL means that global component name is used) |
file | file name containing the logging call, usually FILE |
function | function which tries to make a logging call, usually FUNCTION |
line | line at which the call is made, usually LINE |
Definition at line 500 of file common_logging.c.
References component_nopid, LogDef::component_regex, LogDef::file_regex, LogDef::force, LogDef::from_line, LogDef::function_regex, GNUNET_ERROR_TYPE_MESSAGE, gnunet_force_log_present, GNUNET_NO, LogDef::level, line, logdefs, logdefs_len, min_level, and LogDef::to_line.
Referenced by GCC_debug(), GCCH_debug(), GCT_debug(), and get_nick_record().
const char * GNUNET_b2s | ( | const void * | buf, |
size_t | buf_size | ||
) |
Convert a buffer to an 8-character string representative of the contents.
This is used for logging binary data when debugging.
buf | buffer to log |
buf_size | number of bytes in buf |
Definition at line 324 of file common_logging.c.
References GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_THREAD_LOCAL, and ret.
uint64_t GNUNET_htonll | ( | uint64_t | n | ) |
Convert unsigned 64-bit integer to network byte order.
n | The value in host byte order. |
Definition at line 37 of file common_endian.c.
Referenced by abd_string_to_value(), block_proc(), change_service(), commit_set(), consider_sending_fc(), create_loc_uri(), determine_id(), GCCH_handle_channel_plaintext_data_ack(), GNUNET_ABD_delegate_issue(), GNUNET_ABD_delegate_serialize(), GNUNET_ABD_delegates_serialize(), GNUNET_ARM_request_service_list(), GNUNET_BIO_write_int64(), GNUNET_CRYPTO_ecc_scalar_from_int(), GNUNET_CRYPTO_random_timeflake(), GNUNET_DATASTORE_get_key(), GNUNET_DATASTORE_get_zero_anonymity(), GNUNET_DATASTORE_reserve(), GNUNET_FS_tree_encoder_next(), GNUNET_GNSRECORD_pow_round(), GNUNET_GNSRECORD_records_serialize(), GNUNET_hton_double(), GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_PEERSTORE_iteration_next(), GNUNET_PEERSTORE_monitor_next(), GNUNET_RECLAIM_attribute_store(), GNUNET_RECLAIM_credential_store(), GNUNET_TIME_absolute_hton(), GNUNET_TIME_relative_hton(), handle_client_accept(), hash_for_index_cb(), increment_seq(), notify_change(), print_record(), qconv_abs_time(), qconv_array(), qconv_int64(), qconv_rel_time(), qconv_uint64(), queue_send_msg(), run(), save(), send_add_queue(), send_channel_data_ack(), send_client_done(), send_client_element(), send_update_queue(), signal_result(), transmit(), transmit_item(), transmit_set(), unindex_process(), union_accept(), uri_chk_parse(), and uri_loc_parse().
uint64_t GNUNET_ntohll | ( | uint64_t | n | ) |
Convert unsigned 64-bit integer to host byte order.
n | The value in network byte order. |
Definition at line 54 of file common_endian.c.
Referenced by abd_value_to_string(), backward_resolution(), cb_intersection_element_removed(), cmp_pow_value(), copy_element_cb(), extract_abs_time(), extract_array_generic(), extract_int64(), extract_rel_time(), extract_timestamp(), extract_uint64(), find_proof(), GNUNET_ABD_delegate_deserialize(), GNUNET_ABD_delegates_deserialize(), GNUNET_BIO_read_int64(), GNUNET_CRYPTO_hash_count_leading_zeros(), GNUNET_CRYPTO_hash_count_tailing_zeros(), GNUNET_FS_handle_on_demand_block(), GNUNET_FS_publish_stop(), GNUNET_FS_uri_chk_get_file_size(), GNUNET_GNSRECORD_check_pow(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_ntoh_double(), GNUNET_TIME_absolute_ntoh(), GNUNET_TIME_relative_ntoh(), GNUNET_xfree_(), GNUNET_xrealloc_(), handle_add_queue_message(), handle_alice_client_message(), handle_arm_list_result(), handle_arm_result(), handle_attribute_store_message(), handle_bob_client_message(), handle_client_index_start(), handle_client_loc_sign(), handle_credential_store_message(), handle_data(), handle_flow_control(), handle_get(), handle_get_key(), handle_get_zero_anonymity(), handle_iterate_next(), handle_iteration_next(), handle_monitor_next(), handle_reserve(), handle_result(), handle_send_message_ack(), handle_set(), handle_start(), handle_statistics_value(), handle_statistics_watch_value(), handle_stop(), handle_union_p2p_strata_estimator(), handle_update_queue_message(), increment_seq(), print_record(), process_result_with_request(), queue_send_msg(), reconstruct_cb(), set_result_cb(), try_match_block(), uri_chk_to_string(), uri_loc_to_string(), and verify_message_crypto().
double GNUNET_hton_double | ( | double | d | ) |
Convert double to network byte order.
d | The value in host byte order. |
Definition at line 70 of file common_endian.c.
References d, GNUNET_htonll(), and res.
Referenced by setup_estimate_message().
double GNUNET_ntoh_double | ( | double | d | ) |
Convert double to host byte order.
d | The value in network byte order. |
Definition at line 83 of file common_endian.c.
References d, GNUNET_ntohll(), and res.
Referenced by handle_estimate().
int GNUNET_memcmp_ct_ | ( | const void * | b1, |
const void * | b2, | ||
size_t | len | ||
) |
Compare memory in b1 and b2 in constant time, suitable for private data.
b1 | some buffer of size len |
b2 | another buffer of size len |
len | number of bytes in b1 and b2 |
Definition at line 134 of file consttime_memcmp.c.
References d, consensus-simulation::int, and m.
bool GNUNET_is_zero_ | ( | const void * | a, |
size_t | n | ||
) |
Check that memory in a is all zeros.
a must be a pointer.
a | pointer to n bytes which should be tested for the entire memory being zero'ed out. |
n | number of bytes in to be tested |
Definition at line 425 of file common_allocation.c.
int int void * GNUNET_xmalloc_ | ( | size_t | size, |
const char * | filename, | ||
int | linenumber | ||
) |
Allocate memory.
Checks the return value, aborts if no more memory is available. Don't use GNUNET_xmalloc_ directly. Use the GNUNET_malloc macro. The memory will be zero'ed out.
size | number of bytes to allocate |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 48 of file common_allocation.c.
References filename, GNUNET_assert, GNUNET_assert_at, GNUNET_ERROR_TYPE_ERROR, GNUNET_MAX_MALLOC_CHECKED, GNUNET_xmalloc_unchecked_(), LOG_STRERROR, ret, and size.
Referenced by GNUNET_xgrow_(), GNUNET_xnew_array_2d_(), GNUNET_xnew_array_3d_(), GNUNET_xstrdup_(), and GNUNET_xstrndup_().
void ** GNUNET_xnew_array_2d_ | ( | size_t | n, |
size_t | m, | ||
size_t | elementSize, | ||
const char * | filename, | ||
int | linenumber | ||
) |
Allocate memory for a two dimensional array in one block and set up pointers.
Aborts if no more memory is available. Don't use GNUNET_xnew_array_2d_ directly. Use the GNUNET_new_array_2d macro. The memory of the elements will be zero'ed out.
n | size of the first dimension |
m | size of the second dimension |
elementSize | size of a single element in bytes |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 73 of file common_allocation.c.
References filename, GNUNET_xmalloc_(), m, and ret.
void *** GNUNET_xnew_array_3d_ | ( | size_t | n, |
size_t | m, | ||
size_t | o, | ||
size_t | elementSize, | ||
const char * | filename, | ||
int | linenumber | ||
) |
Allocate memory for a three dimensional array in one block and set up pointers.
Aborts if no more memory is available. Don't use GNUNET_xnew_array_3d_ directly. Use the GNUNET_new_array_3d macro. The memory of the elements will be zero'ed out.
n | size of the first dimension |
m | size of the second dimension |
o | size of the third dimension |
elementSize | size of a single element in bytes |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 94 of file common_allocation.c.
References filename, GNUNET_xmalloc_(), m, and ret.
void * GNUNET_xmemdup_ | ( | const void * | buf, |
size_t | size, | ||
const char * | filename, | ||
int | linenumber | ||
) |
Allocate and initialize memory.
Checks the return value, aborts if no more memory is available. Don't use GNUNET_xmemdup_ directly. Use the GNUNET_memdup macro.
buf | buffer to initialize from (must contain size bytes) |
size | number of bytes to allocate |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 126 of file common_allocation.c.
References filename, GNUNET_assert, GNUNET_assert_at, GNUNET_ERROR_TYPE_ERROR, GNUNET_MAX_MALLOC_CHECKED, GNUNET_memcpy, INT_MAX, LOG_STRERROR, ret, and size.
void * GNUNET_xmalloc_unchecked_ | ( | size_t | size, |
const char * | filename, | ||
int | linenumber | ||
) |
Allocate memory.
This function does not check if the allocation request is within reasonable bounds, allowing allocations larger than 40 MB. If you don't expect the possibility of very large allocations, use GNUNET_malloc instead. The memory will be zero'ed out.
size | number of bytes to allocate |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 156 of file common_allocation.c.
References filename, result, and size.
Referenced by GNUNET_xmalloc_().
void * GNUNET_xrealloc_ | ( | void * | ptr, |
size_t | n, | ||
const char * | filename, | ||
int | linenumber | ||
) |
Reallocate memory.
Checks the return value, aborts if no more memory is available.
Definition at line 175 of file common_allocation.c.
References filename, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_memcpy, GNUNET_MIN, GNUNET_ntohll(), and LOG_STRERROR.
void GNUNET_xfree_ | ( | void * | ptr, |
const char * | filename, | ||
int | linenumber | ||
) |
Free memory.
Merely a wrapper for the case that we want to keep track of allocations. Don't use GNUNET_xfree_ directly. Use the GNUNET_free macro.
ptr | pointer to memory to free |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 235 of file common_allocation.c.
References GNUNET_memcpy, and GNUNET_ntohll().
Referenced by GNUNET_xgrow_().
char * GNUNET_xstrdup_ | ( | const char * | str, |
const char * | filename, | ||
int | linenumber | ||
) |
Dup a string.
Don't call GNUNET_xstrdup_ directly. Use the GNUNET_strdup macro.
str | string to duplicate |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 259 of file common_allocation.c.
References filename, GNUNET_assert_at, GNUNET_memcpy, GNUNET_xmalloc_(), and res.
char * GNUNET_xstrndup_ | ( | const char * | str, |
size_t | len, | ||
const char * | filename, | ||
int | linenumber | ||
) |
Dup partially a string.
Don't call GNUNET_xstrndup_ directly. Use the GNUNET_strndup macro.
str | string to duplicate |
len | length of the string to duplicate |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 299 of file common_allocation.c.
References filename, GNUNET_assert_at, GNUNET_memcpy, GNUNET_strdup, GNUNET_xmalloc_(), res, and strnlen().
void GNUNET_xgrow_ | ( | void ** | old, |
size_t | elementSize, | ||
unsigned int * | oldCount, | ||
unsigned int | newCount, | ||
const char * | filename, | ||
int | linenumber | ||
) |
Grow an array, the new elements are zeroed out.
Grows old by (*oldCount-newCount)*elementSize bytes and sets *oldCount to newCount.
Don't call GNUNET_xgrow_ directly. Use the GNUNET_array_grow macro.
old | address of the pointer to the array *old may be NULL |
elementSize | the size of the elements of the array |
oldCount | address of the number of elements in the *old array |
newCount | number of elements in the new array, may be 0 (then *old will be NULL afterwards) |
filename | where is this call being made (for debugging) |
linenumber | line where this call is being made (for debugging) |
Definition at line 322 of file common_allocation.c.
References filename, GNUNET_assert_at, GNUNET_memcpy, GNUNET_MIN, GNUNET_xfree_(), GNUNET_xmalloc_(), INT_MAX, and size.
void GNUNET_async_scope_enter | ( | const struct GNUNET_AsyncScopeId * | aid, |
struct GNUNET_AsyncScopeSave * | old_scope | ||
) |
Set the async scope for the current thread.
aid | the async scope identifier | |
[out] | old_scope | location to save the old scope |
Definition at line 1478 of file common_logging.c.
References current_async_scope, GNUNET_YES, GNUNET_AsyncScopeSave::have_scope, and GNUNET_AsyncScopeSave::scope_id.
Referenced by GNUNET_SCHEDULER_begin_async_scope(), and GNUNET_SCHEDULER_do_work().
void GNUNET_async_scope_restore | ( | struct GNUNET_AsyncScopeSave * | old_scope | ) |
Clear the current thread's async scope.
old_scope | scope to restore |
Definition at line 1493 of file common_logging.c.
References current_async_scope.
Referenced by GNUNET_SCHEDULER_do_work().
void GNUNET_async_scope_get | ( | struct GNUNET_AsyncScopeSave * | scope_ret | ) |
Get the current async scope.
[out] | scope_ret | pointer to where the result is stored |
Definition at line 1519 of file common_logging.c.
References current_async_scope.
Referenced by add_without_sets(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_do_work(), and setup_job_headers().
void GNUNET_async_scope_fresh | ( | struct GNUNET_AsyncScopeId * | aid_ret | ) |
Generate a fresh async scope identifier.
[out] | aid_ret | pointer to where the result is stored |
Definition at line 1505 of file common_logging.c.
References GNUNET_CRYPTO_QUALITY_WEAK, and GNUNET_CRYPTO_random_block().
int GNUNET_try_compression | ( | const char * | data, |
size_t | old_size, | ||
char ** | result, | ||
size_t * | new_size | ||
) |
Try to compress the given block of data using libz.
Only returns the compressed block if compression worked and the new block is actually smaller. Decompress using GNUNET_decompress().
data | block to compress; if compression resulted in a smaller block, the first bytes of data are updated to the compressed data | |
old_size | number of bytes in data | |
[out] | result | set to the compressed data, if compression worked |
[out] | new_size | set to size of result, if compression worked |
Definition at line 33 of file compress.c.
References data, GNUNET_free, GNUNET_malloc, GNUNET_NO, GNUNET_YES, and result.
Referenced by GNUNET_FS_meta_data_serialize(), and strata_estimator_write().
char * GNUNET_decompress | ( | const char * | input, |
size_t | input_size, | ||
size_t | output_size | ||
) |
Decompress input, return the decompressed data as output.
Dual to GNUNET_try_compression(). Caller must set output_size to the number of bytes that were originally compressed.
input | compressed data |
input_size | number of bytes in input |
output_size | expected size of the output |
Definition at line 70 of file compress.c.
References GNUNET_free, and GNUNET_malloc.
Referenced by GNUNET_FS_meta_data_deserialize(), and strata_estimator_read().
size_t GNUNET_CONTAINER_bloomfilter_get_element_addresses | ( | const struct GNUNET_CONTAINER_BloomFilter * | bf | ) |
Get the number of the addresses set per element in the bloom filter.
bf | the filter |
Definition at line 88 of file container_bloomfilter.c.
References GNUNET_CONTAINER_BloomFilter::addressesPerElement.
struct GNUNET_CONTAINER_MultiHashMap32Iterator * GNUNET_CONTAINER_multihashmap32_iterator_create | ( | const struct GNUNET_CONTAINER_MultiHashMap32 * | map | ) |
Create an iterator for a 32-bit multihashmap.
The iterator can be used to retrieve all the elements in the multihashmap one by one, without having to handle all elements at once (in contrast to GNUNET_CONTAINER_multihashmap32_iterate). Note that the iterator can not be used anymore if elements have been removed from 'map' after the creation of the iterator, or 'map' has been destroyed. Adding elements to 'map' may result in skipped or repeated elements.
map | the map to create an iterator for |
Create an iterator for a 32-bit multihashmap.
The iterator can be used to retrieve all the elements in the multihashmap one by one, without having to handle all elements at once (in contrast to GNUNET_CONTAINER_multihashmap_iterate()). Note that the iterator can not be used anymore if elements have been removed from 'map' after the creation of the iterator, or 'map' has been destroyed. Adding elements to 'map' may result in skipped or repeated elements.
map | the map to create an iterator for |
Definition at line 536 of file container_multihashmap32.c.
References GNUNET_new, GNUNET_CONTAINER_MultiHashMap32Iterator::map, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiHashMap32Iterator::me, GNUNET_CONTAINER_MultiHashMap32Iterator::modification_counter, and GNUNET_CONTAINER_MultiPeerMap::modification_counter.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_iterator_next | ( | struct GNUNET_CONTAINER_MultiHashMap32Iterator * | iter, |
uint32_t * | key, | ||
const void ** | value | ||
) |
Retrieve the next element from the hash map at the iterator's position.
If there are no elements left, GNUNET_NO is returned, and 'key' and 'value' are not modified. This operation is only allowed if no elements have been removed from the multihashmap since the creation of 'iter', and the map has not been destroyed. Adding elements may result in repeating or skipping elements.
iter | the iterator to get the next element from |
key | pointer to store the key in, can be NULL |
value | pointer to store the value in, can be NULL |
Definition at line 564 of file container_multihashmap32.c.
References GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_CONTAINER_MultiHashMap32Iterator::idx, key, MapEntry::key, GNUNET_CONTAINER_MultiHashMap32::map, GNUNET_CONTAINER_MultiHashMap32Iterator::map, GNUNET_CONTAINER_MultiHashMap32::map_length, GNUNET_CONTAINER_MultiHashMap32Iterator::me, GNUNET_CONTAINER_MultiHashMap32::modification_counter, GNUNET_CONTAINER_MultiHashMap32Iterator::modification_counter, MapEntry::next, value, and MapEntry::value.
void GNUNET_CONTAINER_multihashmap32_iterator_destroy | ( | struct GNUNET_CONTAINER_MultiHashMapIterator * | iter | ) |
Destroy a 32-bit multihashmap iterator.
iter | the iterator to destroy |
Destroy a 32-bit multihashmap iterator.
iter | the iterator to destroy |
Definition at line 599 of file container_multihashmap32.c.
References GNUNET_free.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_heap_peek2 | ( | const struct GNUNET_CONTAINER_Heap * | heap, |
void ** | element, | ||
GNUNET_CONTAINER_HeapCostType * | cost | ||
) |
Get element and cost stored at the root of heap.
[in] | heap | Heap to inspect. |
[out] | element | Root element is returned here. |
[out] | cost | Cost of element is returned here. |
Definition at line 171 of file container_heap.c.
References GNUNET_CONTAINER_HeapNode::cost, GNUNET_CONTAINER_HeapNode::element, GNUNET_NO, GNUNET_YES, and GNUNET_CONTAINER_Heap::root.
Referenced by GCP_attach_path().
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.
sum | current sum, initially 0 |
buf | buffer to calculate CRC over (must be 16-bit aligned) |
len | number of bytes in buf, must be multiple of 2 |
Definition at line 110 of file crypto_crc.c.
References consensus-simulation::sum.
Referenced by GNUNET_CRYPTO_crc16_n(), GNUNET_TUN_calculate_icmp_checksum(), GNUNET_TUN_calculate_tcp4_checksum(), GNUNET_TUN_calculate_tcp6_checksum(), GNUNET_TUN_calculate_udp4_checksum(), and GNUNET_TUN_calculate_udp6_checksum().
uint16_t GNUNET_CRYPTO_crc16_finish | ( | uint32_t | sum | ) |
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
sum | cumulative sum |
Definition at line 123 of file crypto_crc.c.
References consensus-simulation::sum.
Referenced by GNUNET_CRYPTO_crc16_n(), GNUNET_TUN_calculate_icmp_checksum(), GNUNET_TUN_calculate_tcp4_checksum(), GNUNET_TUN_calculate_tcp6_checksum(), GNUNET_TUN_calculate_udp4_checksum(), and GNUNET_TUN_calculate_udp6_checksum().
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.
iv | initialization vector |
skey | session key |
salt | salt for the derivation |
salt_len | size of the salt |
argp | pairs of void * & size_t for context chunks, terminated by NULL |
Definition at line 221 of file crypto_symmetric.c.
References GNUNET_CRYPTO_SymmetricInitializationVector::aes_iv, GNUNET_CRYPTO_SymmetricSessionKey::aes_key, GNUNET_CRYPTO_kdf_v(), GNUNET_memcpy, salt, GNUNET_CRYPTO_SymmetricInitializationVector::twofish_iv, and GNUNET_CRYPTO_SymmetricSessionKey::twofish_key.
Referenced by GNUNET_CRYPTO_symmetric_derive_iv().
void GNUNET_CRYPTO_pow_hash | ( | const struct GNUNET_CRYPTO_PowSalt * | salt, |
const void * | buf, | ||
size_t | buf_len, | ||
struct GNUNET_HashCode * | result | ||
) |
Calculate the 'proof-of-work' hash (an expensive hash).
salt | salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. |
buf | data to hash |
buf_len | number of bytes in buf |
result | where to write the resulting hash |
We're using a non-standard formula to avoid issues with ASICs appearing (see #3795).
salt | salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. |
buf | data to hash |
buf_len | number of bytes in buf |
result | where to write the resulting hash |
Definition at line 42 of file crypto_pow.c.
References GNUNET_break, result, and salt.
Referenced by check_proof_of_work(), find_proof(), GNUNET_GNSRECORD_check_pow(), and GNUNET_GNSRECORD_pow_round().
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start | ( | void | ) |
Start incremental hashing operation.
Definition at line 350 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_new, and GNUNET_HashContext::hd.
Referenced by create_randomized_element_iterator(), create_receiver(), decode_and_send(), GCCH_hash_port(), GNUNET_CRYPTO_edx25519_private_key_derive(), GNUNET_SET_element_hash(), GNUNET_SETI_element_hash(), GNUNET_SETU_element_hash(), handle_union_p2p_inquiry(), hash_addresses(), mq_init(), and setup_sender().
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_copy | ( | const struct GNUNET_HashContext * | hc | ) |
Make a copy of the hash computation.
hc | hash context to use (to continue hashing independently) |
Definition at line 377 of file crypto_hash.c.
References GNUNET_assert, GNUNET_new, and GNUNET_HashContext::hd.
void GNUNET_CRYPTO_hash_context_read | ( | struct GNUNET_HashContext * | hc, |
const void * | buf, | ||
size_t | size | ||
) |
Add data to be hashed.
hc | cumulative hash context |
buf | data to add |
size | number of bytes in buf |
Definition at line 366 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_HashContext::hd, and size.
Referenced by create_randomized_element_iterator(), create_receiver(), decode_and_send(), GCCH_hash_port(), GNUNET_CRYPTO_edx25519_private_key_derive(), GNUNET_SET_element_hash(), GNUNET_SETI_element_hash(), GNUNET_SETU_element_hash(), handle_union_p2p_inquiry(), hash_addresses(), mq_init(), and setup_sender().
void GNUNET_CRYPTO_hash_context_finish | ( | struct GNUNET_HashContext * | hc, |
struct GNUNET_HashCode * | r_hash | ||
) |
Finish the hash computation.
hc | hash context to use, is freed in the process |
r_hash | where to write the latest / final hash code |
Definition at line 390 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_CRYPTO_hash_context_abort(), GNUNET_memcpy, GNUNET_HashContext::hd, and res.
Referenced by create_randomized_element_iterator(), create_receiver(), decode_and_send(), GCCH_hash_port(), GNUNET_CRYPTO_edx25519_private_key_derive(), GNUNET_SET_element_hash(), GNUNET_SETI_element_hash(), GNUNET_SETU_element_hash(), handle_union_p2p_inquiry(), hash_addresses(), mq_init(), and setup_sender().
void GNUNET_CRYPTO_hash_context_abort | ( | struct GNUNET_HashContext * | hc | ) |
Abort hashing, do not bother calculating final result.
hc | hash context to destroy |
Definition at line 408 of file crypto_hash.c.
References GNUNET_free, and GNUNET_HashContext::hd.
Referenced by GNUNET_CRYPTO_hash_context_finish().
void GNUNET_CRYPTO_hmac_raw | ( | const void * | key, |
size_t | key_len, | ||
const void * | plaintext, | ||
size_t | plaintext_len, | ||
struct GNUNET_HashCode * | hmac | ||
) |
Calculate HMAC of a message (RFC 2104) TODO: Shouldn't this be the standard hmac function and the above be renamed?
key | secret key |
key_len | secret key length |
plaintext | input plaintext |
plaintext_len | length of plaintext |
hmac | where to store the hmac |
Definition at line 300 of file crypto_hash.c.
References GNUNET_HashCode::bits, GNUNET_assert, GNUNET_memcpy, key, mc, and once.
Referenced by calculate_hmac(), GNUNET_CRYPTO_hmac(), and OIDC_generate_id_token_hmac().
void GNUNET_CRYPTO_hash_file_cancel | ( | struct GNUNET_CRYPTO_FileHashContext * | fhc | ) |
Cancel a file hashing operation.
fhc | operation to cancel (callback must not yet have been invoked) |
Definition at line 225 of file crypto_hash_file.c.
References GNUNET_CRYPTO_FileHashContext::fh, GNUNET_CRYPTO_FileHashContext::filename, GNUNET_break, GNUNET_DISK_file_close(), GNUNET_free, GNUNET_OK, GNUNET_SCHEDULER_cancel(), GNUNET_CRYPTO_FileHashContext::md, and GNUNET_CRYPTO_FileHashContext::task.
Referenced by client_disconnect_cb(), GNUNET_FS_indexing_done(), GNUNET_FS_unindex_signal_suspend_(), GNUNET_FS_unindex_stop(), and publish_cleanup().
unsigned int GNUNET_CRYPTO_hash_count_leading_zeros | ( | const struct GNUNET_HashCode * | h | ) |
Count the number of leading 0 bits in h.
h | a hash |
Definition at line 177 of file crypto_hash.c.
References GNUNET_ntohll(), GNUNET_static_assert, h, and ret.
Referenced by check_proof_of_work(), find_bucket(), find_proof(), GDS_DATACACHE_handle_put(), get_matching_bits(), GNUNET_GNSRECORD_check_pow(), GNUNET_GNSRECORD_pow_round(), and select_peer().
unsigned int GNUNET_CRYPTO_hash_count_tailing_zeros | ( | const struct GNUNET_HashCode * | h | ) |
Count the number of tailing 0 bits in h.
h | a hash |
Definition at line 199 of file crypto_hash.c.
References GNUNET_ntohll(), GNUNET_static_assert, h, and ret.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf_v | ( | void * | result, |
size_t | out_len, | ||
const void * | xts, | ||
size_t | xts_len, | ||
const void * | skm, | ||
size_t | skm_len, | ||
va_list | argp | ||
) |
Derive key.
result | buffer for the derived key, allocated by caller |
out_len | desired length of the derived key |
xts | salt |
xts_len | length of xts |
skm | source key material |
skm_len | length of skm |
argp | va_list of void * & size_t pairs for context chunks |
Definition at line 38 of file crypto_kdf.c.
References GNUNET_CRYPTO_hkdf_gnunet_v(), and result.
Referenced by GNUNET_CRYPTO_hmac_derive_key_v(), GNUNET_CRYPTO_kdf(), and GNUNET_CRYPTO_symmetric_derive_iv_v().
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.
[out] | r | MPI value set to the FDH |
n | MPI to work modulo | |
xts | salt | |
xts_len | length of xts | |
skm | source key material | |
skm_len | length of skm | |
ctx | context string |
Definition at line 87 of file crypto_kdf.c.
References bsize, ctx, GNUNET_assert, GNUNET_CRYPTO_kdf(), and GNUNET_YES.
Referenced by cs_full_domain_hash(), rsa_blinding_key_derive(), and rsa_full_domain_hash().
char * GNUNET_CRYPTO_ecdsa_public_key_to_string | ( | const struct GNUNET_CRYPTO_EcdsaPublicKey * | pub | ) |
Convert a public key to a string.
pub | key to convert |
Definition at line 228 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, GNUNET_STRINGS_data_to_string(), and pub.
Referenced by get_ego().
char * GNUNET_CRYPTO_ecdsa_private_key_to_string | ( | const struct GNUNET_CRYPTO_EcdsaPrivateKey * | priv | ) |
Convert a private key to a string.
priv | key to convert |
Definition at line 309 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, and GNUNET_STRINGS_data_to_string().
char * GNUNET_CRYPTO_eddsa_private_key_to_string | ( | const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv | ) |
Convert a private key to a string.
priv | key to convert |
Definition at line 282 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, and GNUNET_STRINGS_data_to_string().
Referenced by run().
char * GNUNET_CRYPTO_eddsa_public_key_to_string | ( | const struct GNUNET_CRYPTO_EddsaPublicKey * | pub | ) |
Convert a public key to a string.
pub | key to convert |
Definition at line 255 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, GNUNET_STRINGS_data_to_string(), and pub.
Referenced by conversation_value_to_string(), create_keys(), GCP_2s(), GNUNET_i2s(), GNUNET_i2s2(), GNUNET_i2s_full(), messenger_value_to_string(), print_key(), run(), and uri_loc_to_string().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_public_key_from_string | ( | const char * | enc, |
size_t | enclen, | ||
struct GNUNET_CRYPTO_EcdsaPublicKey * | pub | ||
) |
Convert a string representing a public key to a public key.
enc | encoded public key |
enclen | number of bytes in enc (without 0-terminator) |
pub | where to store the public key |
Definition at line 336 of file crypto_ecc.c.
References enc, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, and pub.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_private_key_from_string | ( | const char * | enc, |
size_t | enclen, | ||
struct GNUNET_CRYPTO_EddsaPrivateKey * | priv | ||
) |
Convert a string representing a private key to a private key.
enc | encoded public key |
enclen | number of bytes in enc (without 0-terminator) |
priv | where to store the private key |
Definition at line 386 of file crypto_ecc.c.
References enc, GNUNET_break, GNUNET_OK, GNUNET_STRINGS_string_to_data(), and GNUNET_SYSERR.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_public_key_from_string | ( | const char * | enc, |
size_t | enclen, | ||
struct GNUNET_CRYPTO_EddsaPublicKey * | pub | ||
) |
Convert a string representing a public key to a public key.
enc | encoded public key |
enclen | number of bytes in enc (without 0-terminator) |
pub | where to store the public key |
Definition at line 361 of file crypto_ecc.c.
References enc, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, and pub.
Referenced by conversation_string_to_value(), create_keys(), gns_string_to_value(), messenger_string_to_value(), on_identity(), run(), s2i_full(), show_peer(), and uri_loc_parse().
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.
max | maximum value the factor can be |
mem | memory to use (should be smaller than max), must not be zero. |
Definition at line 65 of file crypto_ecc_dlog.c.
References edc, GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CRYPTO_ecc_scalar_from_int(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, consensus-simulation::int, key, GNUNET_CRYPTO_EccDlogContext::map, GNUNET_CRYPTO_EccDlogContext::max, max, GNUNET_CRYPTO_EccDlogContext::mem, and GNUNET_CRYPTO_EccScalar::v.
Referenced by run().
int GNUNET_CRYPTO_ecc_dlog | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
const struct GNUNET_CRYPTO_EccPoint * | input | ||
) |
Calculate ECC discrete logarithm for small factors.
Opposite of GNUNET_CRYPTO_ecc_dexp().
edc | precalculated values, determine range of factors |
input | point on the curve to factor |
Definition at line 112 of file crypto_ecc_dlog.c.
References edc, GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, INT_MAX, key, GNUNET_CRYPTO_EccDlogContext::map, GNUNET_CRYPTO_EccDlogContext::max, GNUNET_CRYPTO_EccDlogContext::mem, q, res, GNUNET_CRYPTO_EccPoint::v, and GNUNET_CRYPTO_EccScalar::v.
Referenced by handle_bobs_cryptodata_message().
void GNUNET_CRYPTO_ecc_dexp | ( | int | val, |
struct GNUNET_CRYPTO_EccPoint * | r | ||
) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val.
Afterwards, point addition will correspond to integer addition. GNUNET_CRYPTO_ecc_dlog() can be used to convert a point back to an integer (as long as the integer is smaller than the MAX of the edc context).
val | value to encode into a point |
r | where to write the point (must be allocated) |
Definition at line 210 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_ecc_scalar_from_int(), GNUNET_CRYPTO_EccPoint::v, and GNUNET_CRYPTO_EccScalar::v.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_dexp_mpi | ( | const struct GNUNET_CRYPTO_EccScalar * | val, |
struct GNUNET_CRYPTO_EccPoint * | r | ||
) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val.
val | (positive) value to encode into a point |
r | where to write the point (must be allocated) |
Definition at line 223 of file crypto_ecc_dlog.c.
References GNUNET_OK, GNUNET_SYSERR, GNUNET_CRYPTO_EccPoint::v, and GNUNET_CRYPTO_EccScalar::v.
Referenced by send_alices_cryptodata_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_pmul_mpi | ( | const struct GNUNET_CRYPTO_EccPoint * | p, |
const struct GNUNET_CRYPTO_EccScalar * | val, | ||
struct GNUNET_CRYPTO_EccPoint * | r | ||
) |
Multiply the point p on the elliptic curve by val.
p | point to multiply |
val | (positive) value to encode into a point |
r | where to write the point (must be allocated) |
Definition at line 249 of file crypto_ecc_dlog.c.
References GNUNET_OK, GNUNET_SYSERR, p, GNUNET_CRYPTO_EccPoint::v, and GNUNET_CRYPTO_EccScalar::v.
Referenced by handle_alices_cryptodata_message(), and handle_bobs_cryptodata_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_add | ( | const struct GNUNET_CRYPTO_EccPoint * | a, |
const struct GNUNET_CRYPTO_EccPoint * | b, | ||
struct GNUNET_CRYPTO_EccPoint * | r | ||
) |
Add two points on the elliptic curve.
a | some value |
b | some value |
r | where to write the point (must be allocated) |
Definition at line 235 of file crypto_ecc_dlog.c.
References GNUNET_OK, GNUNET_SYSERR, and GNUNET_CRYPTO_EccPoint::v.
Referenced by handle_alices_cryptodata_message(), and handle_bobs_cryptodata_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_rnd | ( | struct GNUNET_CRYPTO_EccPoint * | r, |
struct GNUNET_CRYPTO_EccPoint * | r_inv | ||
) |
Obtain a random point on the curve and its additive inverse.
[out] | r | set to a random point on the curve |
[out] | r_inv | set to the additive inverse of r |
Definition at line 263 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_ecc_random_mod_n(), GNUNET_OK, GNUNET_SYSERR, GNUNET_CRYPTO_EccPoint::v, and GNUNET_CRYPTO_EccScalar::v.
void GNUNET_CRYPTO_ecc_rnd_mpi | ( | struct GNUNET_CRYPTO_EccScalar * | r, |
struct GNUNET_CRYPTO_EccScalar * | r_neg | ||
) |
Obtain a random scalar for point multiplication on the curve and its additive inverse.
[out] | r | set to a random scalar on the curve |
[out] | r_neg | set to the negation of |
Definition at line 285 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_ecc_random_mod_n(), and GNUNET_CRYPTO_EccScalar::v.
Referenced by run().
void GNUNET_CRYPTO_ecc_random_mod_n | ( | struct GNUNET_CRYPTO_EccScalar * | r | ) |
Generate a random value mod n.
[out] | r | random value mod n. |
Definition at line 195 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccScalar::v.
Referenced by GNUNET_CRYPTO_ecc_rnd(), GNUNET_CRYPTO_ecc_rnd_mpi(), and send_alices_cryptodata_message().
void GNUNET_CRYPTO_ecc_dlog_release | ( | struct GNUNET_CRYPTO_EccDlogContext * | dlc | ) |
Release precalculated values.
dlc | dlog context |
Definition at line 202 of file crypto_ecc_dlog.c.
References edc, GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_free, and GNUNET_CRYPTO_EccDlogContext::map.
Referenced by shutdown_task().
void GNUNET_CRYPTO_ecc_scalar_from_int | ( | int64_t | val, |
struct GNUNET_CRYPTO_EccScalar * | r | ||
) |
Create a scalar from int value.
val | the int value | |
[out] | r | where to write the salar |
Definition at line 295 of file crypto_ecc_dlog.c.
References GNUNET_assert, GNUNET_htonll(), and GNUNET_CRYPTO_EccScalar::v.
Referenced by GNUNET_CRYPTO_ecc_dexp(), GNUNET_CRYPTO_ecc_dlog_prepare(), handle_alices_cryptodata_message(), and send_alices_cryptodata_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_sk_to_x25519 | ( | const struct GNUNET_CRYPTO_PrivateKey * | sk, |
struct GNUNET_CRYPTO_EcdhePrivateKey * | x25519 | ||
) |
Convert a GNUnet identity key to a key sutiable for HPKE (X25519)
sk | the private key |
x25519 | the new key |
Definition at line 1013 of file crypto_hpke.c.
References GNUNET_CRYPTO_EcdhePrivateKey::d, GNUNET_CRYPTO_EcdsaPrivateKey::d, GNUNET_CRYPTO_EddsaPrivateKey::d, GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_CRYPTO_PrivateKey::eddsa_key, GNUNET_OK, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, and GNUNET_CRYPTO_PrivateKey::type.
Referenced by decrypt_message(), eddsa_priv_to_hpke_key(), and read_encrypted_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_pk_to_x25519 | ( | const struct GNUNET_CRYPTO_PublicKey * | pk, |
struct GNUNET_CRYPTO_EcdhePublicKey * | x25519 | ||
) |
Convert a GNUnet identity key to a key sutiable for HPKE (X25519)
pk | the public key |
x25519 | the new key |
Definition at line 989 of file crypto_hpke.c.
References GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_CRYPTO_PrivateKey::eddsa_key, GNUNET_OK, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, pk, GNUNET_CRYPTO_EcdhePublicKey::q_y, and GNUNET_CRYPTO_PrivateKey::type.
Referenced by eddsa_pub_to_hpke_key(), encrypt_message(), and write_encrypted_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_sender_setup | ( | const struct GNUNET_CRYPTO_EcdhePublicKey * | pkR, |
const uint8_t * | info, | ||
size_t | info_len, | ||
struct GNUNET_CRYPTO_HpkeEncapsulation * | enc, | ||
struct GNUNET_CRYPTO_HpkeContext * | ctx | ||
) |
RFC9180 HPKE encryption.
This sets the encryption context up for a sender of encrypted messages. Algorithm: DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305
The encapsulation "enc" must be exchanged with the receiver. From then on, encrypted messages can be created and sent using "ctx"
pkR | the X25519 receiver public key |
info | the info context separator |
info_len | length of info in bytes |
enc | the encapsulation to exchange with the other party |
ctx | the encryption context allocated by caller |
Definition at line 738 of file crypto_hpke.c.
References ctx, enc, GNUNET_CRYPTO_ecdhe_key_create(), GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256, GNUNET_CRYPTO_HPKE_MODE_BASE, GNUNET_CRYPTO_hpke_sender_setup2(), and info.
Referenced by GNUNET_CRYPTO_hpke_seal_oneshot().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_sender_setup2 | ( | enum GNUNET_CRYPTO_HpkeKem | kem, |
enum GNUNET_CRYPTO_HpkeMode | mode, | ||
struct GNUNET_CRYPTO_EcdhePrivateKey * | skE, | ||
struct GNUNET_CRYPTO_EcdhePrivateKey * | skS, | ||
const struct GNUNET_CRYPTO_EcdhePublicKey * | pkR, | ||
const uint8_t * | info, | ||
size_t | info_len, | ||
const uint8_t * | psk, | ||
size_t | psk_len, | ||
const uint8_t * | psk_id, | ||
size_t | psk_id_len, | ||
struct GNUNET_CRYPTO_HpkeEncapsulation * | enc, | ||
struct GNUNET_CRYPTO_HpkeContext * | ctx | ||
) |
RFC9180 HPKE encryption.
This sets the encryption context up for a sender of encrypted messages. Algorithm: DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305
The encapsulation "enc" must be exchanged with the receiver. From then on, encrypted messages can be created and sent using "ctx"
kem | the HPKE KEM to use |
mode | the HPKE mode |
skE | the X25519 ephemeral key to use as encapsulation |
skR | the X25519 sender private key (may be null for non-Auth modes) |
info | the info context separator |
info_len | length of info in bytes |
psk | the pre-shared key (must not be set non-PSK modes) |
psk_len | length of psk in bytes |
psk_id | the ID of the pre-shared key (must be set of psk is set) |
psk_id_len | length of psk_id in bytes |
enc | the encapsulation to exchange with the other party |
ctx | the encryption context allocated by caller |
Definition at line 670 of file crypto_hpke.c.
References ctx, enc, GNUNET_CRYPTO_hpke_authkem_encaps_norand(), GNUNET_CRYPTO_hpke_elligator_kem_encaps_norand(), GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256, GNUNET_CRYPTO_HPKE_KEM_DH_X25519ELLIGATOR_HKDF256, GNUNET_CRYPTO_hpke_kem_encaps_norand(), GNUNET_CRYPTO_HPKE_MODE_AUTH, GNUNET_CRYPTO_HPKE_MODE_AUTH_PSK, GNUNET_CRYPTO_HPKE_MODE_BASE, GNUNET_CRYPTO_HPKE_MODE_PSK, GNUNET_CRYPTO_HPKE_ROLE_S, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_block(), GNUNET_OK, GNUNET_SYSERR, info, key_schedule(), and mode.
Referenced by GNUNET_CRYPTO_hpke_sender_setup().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_receiver_setup2 | ( | enum GNUNET_CRYPTO_HpkeKem | kem, |
enum GNUNET_CRYPTO_HpkeMode | mode, | ||
const struct GNUNET_CRYPTO_HpkeEncapsulation * | enc, | ||
const struct GNUNET_CRYPTO_EcdhePrivateKey * | skR, | ||
const struct GNUNET_CRYPTO_EcdhePublicKey * | pkS, | ||
const uint8_t * | info, | ||
size_t | info_len, | ||
const uint8_t * | psk, | ||
size_t | psk_len, | ||
const uint8_t * | psk_id, | ||
size_t | psk_id_len, | ||
struct GNUNET_CRYPTO_HpkeContext * | ctx | ||
) |
RFC9180 HPKE encryption.
This sets the encryption context up for a receiver of encrypted messages. Algorithm: DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305
The encapsulation "enc" must be exchanged with the receiver. From then on, encrypted messages can be decrypted using "ctx"
kem | the HPKE KEM to use |
mode | the HPKE mode |
enc | the encapsulation from the sender |
skR | the X25519 receiver secret key |
pkS | the X25519 sender public key (may be NULL for non-Auth modes) |
info | the info context separator |
info_len | length of info in bytes |
psk | the pre-shared key (must not be set non-PSK modes) |
psk_len | length of psk in bytes |
psk_id | the ID of the pre-shared key (must be set of psk is set) |
psk_id_len | length of psk_id in bytes |
ctx | the encryption context allocated by caller |
Definition at line 760 of file crypto_hpke.c.
References ctx, enc, GNUNET_CRYPTO_hpke_authkem_decaps(), GNUNET_CRYPTO_hpke_elligator_kem_decaps(), GNUNET_CRYPTO_hpke_kem_decaps(), GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256, GNUNET_CRYPTO_HPKE_KEM_DH_X25519ELLIGATOR_HKDF256, GNUNET_CRYPTO_HPKE_MODE_AUTH, GNUNET_CRYPTO_HPKE_MODE_AUTH_PSK, GNUNET_CRYPTO_HPKE_MODE_BASE, GNUNET_CRYPTO_HPKE_MODE_PSK, GNUNET_CRYPTO_HPKE_ROLE_R, GNUNET_OK, GNUNET_SYSERR, info, key_schedule(), and mode.
Referenced by GNUNET_CRYPTO_hpke_receiver_setup().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_receiver_setup | ( | const struct GNUNET_CRYPTO_HpkeEncapsulation * | enc, |
const struct GNUNET_CRYPTO_EcdhePrivateKey * | skR, | ||
const uint8_t * | info, | ||
size_t | info_len, | ||
struct GNUNET_CRYPTO_HpkeContext * | ctx | ||
) |
RFC9180 HPKE encryption.
This sets the encryption context up for a receiver of encrypted messages. Algorithm: DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305
The encapsulation "enc" must be exchanged with the receiver. From then on, encrypted messages can be decrypted using "ctx"
enc | the encapsulation from the sender |
skR | the X25519 receiver secret key |
info | the info context separator |
info_len | length of info in bytes |
ctx | the encryption context allocated by caller |
Definition at line 817 of file crypto_hpke.c.
References ctx, enc, GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256, GNUNET_CRYPTO_HPKE_MODE_BASE, GNUNET_CRYPTO_hpke_receiver_setup2(), and info.
Referenced by GNUNET_CRYPTO_hpke_open_oneshot().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_seal | ( | struct GNUNET_CRYPTO_HpkeContext * | ctx, |