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_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_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... | |
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 494 of file gnunet_common.h.
#define GN_UNLIKELY | ( | expr | ) | (expr) |
Definition at line 495 of file gnunet_common.h.
#define GNUNET_LOG_CALL_STATUS -1 |
Definition at line 499 of file gnunet_common.h.
#define GNUNET_log_from | ( | kind, | |
comp, | |||
... | |||
) |
Definition at line 522 of file gnunet_common.h.
#define GNUNET_log | ( | kind, | |
... | |||
) |
Definition at line 548 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 641 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 1033 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 1247 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 1276 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 1304 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 1317 of file gnunet_common.h.
#define __func__ "<unknown>" |
Definition at line 1760 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 381 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 397 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 1772 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, GNUNET_Buffer::position, and SIZE_MAX.
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 dump_os_ipk(), 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 374 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_xstrdup_(), and GNUNET_xstrndup_().
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 73 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 103 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 122 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 182 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 206 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 246 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 269 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 1487 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 1502 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 1528 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 1514 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 347 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 374 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 363 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 387 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 405 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 297 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 226 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 174 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 196 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 113 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 211 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 224 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 250 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 236 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 264 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 286 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 196 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 203 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 296 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, |
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.
Encrypt messages in a context. 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"
ctx | the encryption context |
aad | addition authenticated data to send (not encrypted) |
aad_len | length of aad in bytes |
pt | plaintext data to encrypt |
pt_len | length of pt in bytes |
ct | ciphertext to send (to be allocated by caller) |
ct_len[out] | length of written bytes in ct. may be NULL |
Definition at line 863 of file crypto_hpke.c.
References compute_nonce(), ctx, GNUNET_CRYPTO_HPKE_NONCE_LEN, GNUNET_CRYPTO_HPKE_ROLE_S, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and increment_seq().
Referenced by GNUNET_CRYPTO_hpke_seal_oneshot().
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.
Encrypt messages in a context. 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"
pkR | the X25519 receiver secret key |
info | the info context separator |
info_len | length of info in bytes |
aad | addition authenticated data to send (not encrypted) |
aad_len | length of aad in bytes |
pt | plaintext data to encrypt |
pt_len | length of pt in bytes |
ct | ciphertext to send (to be allocated by caller) |
ct_len[out] | length of written bytes in ct. may be NULL |
Definition at line 929 of file crypto_hpke.c.
References ctx, enc, GNUNET_CRYPTO_hpke_seal(), GNUNET_CRYPTO_hpke_sender_setup(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and info.
Referenced by encrypt_message(), and write_encrypted_message().
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.
Decrypt messages in a context. 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"
ctx | the encryption context |
aad | addition authenticated data to send (not encrypted) |
aad_len | length of aad in bytes |
ct | ciphertext to decrypt |
ct_len | length of ct in bytes |
pt | plaintext (to be allocated by caller) |
pt_len | length of written bytes in pt. May be NULL |
Definition at line 894 of file crypto_hpke.c.
References compute_nonce(), ctx, GNUNET_CRYPTO_HPKE_NONCE_LEN, GNUNET_CRYPTO_HPKE_ROLE_R, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and increment_seq().
Referenced by GNUNET_CRYPTO_hpke_open_oneshot().
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.
Decrypt messages in a context. 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"
skR | the X25519 receiver secret key |
info | the info context separator |
info_len | length of info in bytes |
aad | addition authenticated data to send (not encrypted) |
aad_len | length of aad in bytes |
ct | ciphertext to decrypt |
ct_len | length of ct in bytes |
pt | plaintext (to be allocated by caller) |
pt_len | length of written bytes in pt. May be NULL |
Definition at line 958 of file crypto_hpke.c.
References ctx, enc, GNUNET_CRYPTO_hpke_open(), GNUNET_CRYPTO_hpke_receiver_setup(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and info.
Referenced by decrypt_message(), and read_encrypted_message().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_raw | ( | const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv, |
void * | data, | ||
size_t | size, | ||
struct GNUNET_CRYPTO_EddsaSignature * | sig | ||
) |
priv | |
data | |
size | |
sig |
Definition at line 604 of file crypto_ecc.c.
References GNUNET_CRYPTO_EddsaPrivateKey::d, data, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, pk, res, and size.
Referenced by ego_sign_data_cb().
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.
pkey | original private key |
label | label to use for key deriviation |
context | additional context to use for HKDF of 'h'; typically the name of the subsystem/application |
purpose | the signature purpose |
sig | the resulting signature |
Definition at line 181 of file crypto_ecc_gnsrecord.c.
References context, GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_ecdsa_sign_(), GNUNET_free, key, and res.
Referenced by block_sign_ecdsa().
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.
pkey | original private key |
label | label to use for key deriviation |
context | additional context to use for HKDF of 'h'; typically the name of the subsystem/application |
purpose | the signature purpose |
sig | the resulting signature |
Derive the private key
Instead of expanding the private here, we already have the secret scalar as input. Use it. Note that sk is not plain SHA512 (d). sk[0..31] contains the derived private scalar sk[0..31] = h * SHA512 (d)[0..31] sk[32..63] = SHA512 (d)[32..63]
Calculate the derived zone key zk' from the derived private scalar.
Calculate r: r = SHA512 (sk[32..63] | M) where M is our message (purpose). Note that sk[32..63] is the other half of the expansion from the original, non-derived private key "d".
Temporarily put zk into S
Reduce the scalar value r
Calculate R := r * G of the signature
Calculate hram := SHA512 (R | zk' | M)
Reduce the resulting scalar value
Calculate S := r + hram * s mod L
Definition at line 78 of file crypto_ecc_gnsrecord.c.
References context, GNUNET_CRYPTO_eddsa_private_key_derive(), GNUNET_OK, pkey, GNUNET_CRYPTO_EddsaSignature::r, GNUNET_CRYPTO_EddsaSignature::s, GNUNET_CRYPTO_EddsaPrivateScalar::s, and GNUNET_CRYPTO_EccSignaturePurpose::size.
Referenced by block_sign_eddsa().
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.
s | the private scalar |
pkey | the resulting public key |
Calculate the derived zone key zk' from the derived private scalar.
Definition at line 444 of file crypto_ecc_gnsrecord.c.
References pkey, and GNUNET_CRYPTO_EddsaPrivateScalar::s.
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.
The MPI val may not be negative.
buf | where to output to |
size | number of bytes in buf |
val | value to write to buf |
Definition at line 79 of file crypto_mpi.c.
References adjust(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_memcpy, LOG_GCRY, p, and size.
Referenced by cs_full_domain_hash(), decrypt_conclude(), encrypt_fair(), GNUNET_CRYPTO_ecdsa_key_get_anonymous(), GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_ecdsa_public_key_derive(), GNUNET_CRYPTO_ecdsa_sign_(), GNUNET_CRYPTO_eddsa_private_key_derive(), GNUNET_CRYPTO_eddsa_public_key_derive(), GNUNET_CRYPTO_paillier_create(), GNUNET_CRYPTO_paillier_encrypt(), GNUNET_CRYPTO_paillier_encrypt1(), GNUNET_CRYPTO_paillier_hom_add(), GNUNET_SECRETSHARING_encrypt(), GNUNET_SECRETSHARING_plaintext_generate_i(), insert_decrypt_element(), insert_round1_element(), insert_round2_element(), and keygen_round2_conclude().
void GNUNET_CRYPTO_mpi_scan_unsigned | ( | gcry_mpi_t * | result, |
const void * | data, | ||
size_t | size | ||
) |
Convert data buffer into MPI value.
The buffer is interpreted as network byte order, unsigned integer.
result | where to store MPI value (allocated) |
data | raw data (GCRYMPI_FMT_USG) |
size | number of bytes in data |
Definition at line 132 of file crypto_mpi.c.
References data, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, LOG_GCRY, result, and size.
Referenced by cs_full_domain_hash(), decrypt_conclude(), decrypt_new_element(), encrypt_fair(), get_fair_encryption_challenge(), GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_ecdsa_public_key_derive(), GNUNET_CRYPTO_eddsa_private_key_derive(), GNUNET_CRYPTO_eddsa_public_key_derive(), GNUNET_CRYPTO_paillier_decrypt(), GNUNET_CRYPTO_paillier_encrypt(), GNUNET_CRYPTO_paillier_encrypt1(), GNUNET_CRYPTO_paillier_hom_add(), GNUNET_SECRETSHARING_encrypt(), insert_decrypt_element(), keygen_reveal_get_exp_coeff(), keygen_reveal_get_exp_preshare(), keygen_round1_new_element(), restore_fair(), and verify_fair().
void GNUNET_CRYPTO_paillier_create | ( | struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
struct GNUNET_CRYPTO_PaillierPrivateKey * | private_key | ||
) |
Create a freshly generated paillier public key.
[out] | public_key | Where to store the public key? |
[out] | private_key | Where to store the private key? |
Definition at line 40 of file crypto_paillier.c.
References GNUNET_assert, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_CRYPTO_PaillierPrivateKey::lambda, GNUNET_CRYPTO_PaillierPrivateKey::mu, p, and q.
Referenced by handle_client_keygen(), and run().
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.
public_key | Public key to use. | |
m | Plaintext to encrypt. | |
desired_ops | How many homomorphic ops the caller intends to use | |
[out] | ciphertext | Encryption of plaintext with public_key. |
Definition at line 221 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_MIN, GNUNET_SYSERR, m, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
Referenced by compute_service_response(), and send_alices_cryptodata_message().
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.
private_key | Private key to use for decryption. | |
public_key | Public key to use for decryption. | |
ciphertext | Ciphertext to decrypt. | |
[out] | m | Decryption of ciphertext with private_key. |
Definition at line 328 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PaillierPrivateKey::lambda, m, and GNUNET_CRYPTO_PaillierPrivateKey::mu.
Referenced by compute_scalar_product(), and keygen_round2_new_element().
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.
Note that this operation can only be done a finite number of times before an overflow occurs.
public_key | Public key to use for encryption. | |
c1 | Paillier cipher text. | |
c2 | Paillier cipher text. | |
[out] | result | Result of the homomorphic operation. |
Definition at line 392 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_MIN, GNUNET_SYSERR, GNUNET_CRYPTO_PaillierCiphertext::remaining_ops, and result.
Referenced by compute_service_response().
int GNUNET_CRYPTO_paillier_hom_get_remaining | ( | const struct GNUNET_CRYPTO_PaillierCiphertext * | c | ) |
Get the number of remaining supported homomorphic operations.
c | Paillier cipher text. |
Definition at line 455 of file crypto_paillier.c.
References GNUNET_assert, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_create | ( | unsigned int | len | ) |
Create a new private key.
Caller must free return value.
len | length of the key in bits (e.g. 2048) |
Definition at line 144 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_new, and ret.
Referenced by GNUNET_CRYPTO_blind_sign_keys_create_va(), and output_vectors().
void GNUNET_CRYPTO_rsa_private_key_free | ( | struct GNUNET_CRYPTO_RsaPrivateKey * | key | ) |
Free memory occupied by the private key.
key | pointer to the memory to free |
Definition at line 173 of file crypto_rsa.c.
References GNUNET_free, and key.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sign_priv_decref(), GNUNET_CRYPTO_rsa_private_key_decode(), and output_vectors().
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.
key | the private key | |
[out] | buffer | set to a buffer with the encoded key |
Definition at line 181 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_malloc, and key.
Referenced by GNUNET_CRYPTO_rsa_private_key_cmp(), output_vectors(), and qconv_blind_sign_priv().
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.
buf | the buffer where the private key data is stored |
buf_size | the size of the data in buf |
Definition at line 204 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_private_key_free(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_new, key, and LOG.
Referenced by checkvec(), and extract_blind_sign_priv().
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_dup | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | key | ) |
Duplicate the given private key.
key | the private key to duplicate |
Definition at line 1248 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_new, key, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
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.
priv | the private key |
Definition at line 233 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_break_op, GNUNET_new, key_from_sexp(), pub, result, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
Referenced by GNUNET_CRYPTO_blind_sign_keys_create_va(), GNUNET_CRYPTO_rsa_sign_fdh(), output_vectors(), and rsa_sign_mpi().
void GNUNET_CRYPTO_rsa_public_key_hash | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key, |
struct GNUNET_HashCode * | hc | ||
) |
Compute hash over the public key.
key | public key to hash |
hc | where to store the hash code |
Definition at line 407 of file crypto_rsa.c.
References GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_free, and key.
Referenced by GNUNET_CRYPTO_blind_sign_keys_create_va().
bool GNUNET_CRYPTO_rsa_public_key_check | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Check if key is well-formed.
Definition at line 301 of file crypto_rsa.c.
References key, key_from_sexp(), and ret.
unsigned int GNUNET_CRYPTO_rsa_public_key_len | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Obtain the length of the RSA key in bits.
key | the public key to introspect |
Definition at line 680 of file crypto_rsa.c.
References GNUNET_break, key, and key_from_sexp().
void GNUNET_CRYPTO_rsa_public_key_free | ( | struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Free memory occupied by the public key.
key | pointer to the memory to free |
Definition at line 268 of file crypto_rsa.c.
References GNUNET_free, and key.
Referenced by checkvec(), clean_rsa_pub(), clean_rsa_public_key(), GNUNET_CRYPTO_blind_sign_pub_decref(), GNUNET_CRYPTO_rsa_sign_fdh(), output_vectors(), and rsa_sign_mpi().
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.
key | the private key | |
[out] | buffer | set to a buffer with the encoded key |
Definition at line 325 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_break, GNUNET_malloc, key, key_from_sexp(), GNUNET_CRYPTO_RsaPublicKeyHeaderP::modulus_length, GNUNET_CRYPTO_RsaPublicKeyHeaderP::public_exponent_length, and ret.
Referenced by bind_rsa_pub(), checkvec(), GNUNET_CRYPTO_rsa_public_key_cmp(), GNUNET_CRYPTO_rsa_public_key_hash(), GNUNET_JSON_from_rsa_public_key(), output_vectors(), qconv_blind_sign_pub(), qconv_rsa_public_key(), and rsa_full_domain_hash().
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.
buf | the buffer where the public key data is stored |
len | the length of the data in buf |
Definition at line 423 of file crypto_rsa.c.
References data, GNUNET_break, GNUNET_break_op, GNUNET_new, key, GNUNET_CRYPTO_RsaPublicKeyHeaderP::modulus_length, and GNUNET_CRYPTO_RsaPublicKeyHeaderP::public_exponent_length.
Referenced by checkvec(), extract_blind_sign_pub(), extract_rsa_pub(), extract_rsa_public_key(), and parse_rsa_public_key().
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_dup | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Duplicate the given public key.
key | the public key to duplicate |
Definition at line 1099 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_new, key, and GNUNET_CRYPTO_RsaPublicKey::sexp.
int GNUNET_CRYPTO_rsa_signature_cmp | ( | const struct GNUNET_CRYPTO_RsaSignature * | s1, |
const struct GNUNET_CRYPTO_RsaSignature * | s2 | ||
) |
Compare the values of two signatures.
s1 | one signature |
s2 | the other signature |
Definition at line 602 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_free, and ret.
Referenced by GNUNET_CRYPTO_blind_sig_cmp(), and GNUNET_CRYPTO_ub_sig_cmp().
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.
p1 | one private key |
p2 | the other private key |
Definition at line 654 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_private_key_encode(), GNUNET_free, and ret.
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.
p1 | one public key |
p2 | the other public key |
Definition at line 628 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_free, and ret.
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.
message | the message to sign | |
message_size | number of bytes in message | |
bks | the blinding key | |
pkey | the public key of the signer | |
[out] | bm | set to the blinded message |
Definition at line 807 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg_size, data, GNUNET_break, GNUNET_NO, GNUNET_YES, key_from_sexp(), numeric_mpi_alloc_n_print(), pkey, RsaBlindingKey::r, ret, rsa_blinding_key_derive(), rsa_blinding_key_free(), and rsa_full_domain_hash().
Referenced by checkvec(), GNUNET_CRYPTO_message_blind_to_sign(), and output_vectors().
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.
key | private key to use for the signing |
bm | the (blinded) message to sign |
Definition at line 970 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg_size, GNUNET_assert, key, and rsa_sign_mpi().
Referenced by checkvec(), GNUNET_CRYPTO_blind_sign(), and output_vectors().
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.
key | private key to use for the signing |
message | the message to sign |
message_size | number of bytes in message |
Definition at line 992 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_private_key_get_public(), GNUNET_CRYPTO_rsa_public_key_free(), key, pkey, rsa_full_domain_hash(), and rsa_sign_mpi().
void GNUNET_CRYPTO_rsa_blinded_message_free | ( | struct GNUNET_CRYPTO_RsaBlindedMessage * | bm | ) |
Free memory occupied by blinded message.
Only frees contents, not bm itself.
[in] | bm | memory to free |
Definition at line 799 of file crypto_rsa.c.
References GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, and GNUNET_free.
Referenced by checkvec(), and output_vectors().
void GNUNET_CRYPTO_rsa_signature_free | ( | struct GNUNET_CRYPTO_RsaSignature * | sig | ) |
Free memory occupied by signature.
[in] | sig | memory to free |
Definition at line 1015 of file crypto_rsa.c.
References GNUNET_free, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by checkvec(), clean_rsa_sig(), clean_rsa_signature(), GNUNET_CRYPTO_blinded_sig_decref(), GNUNET_CRYPTO_unblinded_sig_decref(), and output_vectors().
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.
sig | the signature | |
[out] | buffer | set to a buffer with the encoded key |
Definition at line 1023 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_malloc, key_from_sexp(), ret, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by bind_rsa_sig(), checkvec(), GNUNET_CRYPTO_rsa_signature_cmp(), GNUNET_JSON_from_rsa_signature(), output_vectors(), qconv_blinded_sig(), qconv_rsa_signature(), and qconv_unblinded_sig().
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.
buf | the buffer where the public key data is stored |
buf_size | the number of bytes of the data in buf |
Definition at line 1063 of file crypto_rsa.c.
References data, GNUNET_break, GNUNET_break_op, GNUNET_new, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by extract_rsa_sig(), extract_rsa_signature(), and parse_rsa_signature().
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_dup | ( | const struct GNUNET_CRYPTO_RsaSignature * | sig | ) |
Duplicate the given rsa signature.
sig | the signature to duplicate |
Definition at line 1268 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_new, key_from_sexp(), ret, and GNUNET_CRYPTO_RsaSignature::sexp.
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.
The signature should have been generated with #GNUNET_CRYPTO_rsa_sign() using a hash that was blinded with GNUNET_CRYPTO_rsa_blind().
sig | the signature made on the blinded signature purpose |
bks | the blinding key secret used to blind the signature purpose |
pkey | the public key of the signer |
Definition at line 1118 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_break_op, GNUNET_new, key_from_sexp(), pkey, RsaBlindingKey::r, ret, rsa_blinding_key_derive(), rsa_blinding_key_free(), and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sig_unblind(), and output_vectors().
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.
message | the message to sign |
message_size | number of bytes in message |
sig | signature that is being validated |
public_key | public key of the signer |
Definition at line 1199 of file crypto_rsa.c.
References _, BENCHMARK_END, BENCHMARK_START, data, GNUNET_break_op, GNUNET_ERROR_TYPE_WARNING, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, LOG, mpi_to_sexp(), pkey, rsa_full_domain_hash(), and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sig_verify(), and output_vectors().
void GNUNET_CRYPTO_cs_private_key_generate | ( | struct GNUNET_CRYPTO_CsPrivateKey * | priv | ) |
Create a new random private key.
[out] | priv | where to write the fresh private key |
Create a new random private key.
This is an implementation of the Clause Blind Schnorr Signature Scheme using Curve25519. Further details about the Clause Blind Schnorr Signature Scheme can be found here: https://eprint.iacr.org/2019/877.pdf
We use libsodium wherever possible.
Definition at line 45 of file crypto_cs.c.
References GNUNET_CRYPTO_Cs25519Scalar::d, and GNUNET_CRYPTO_CsPrivateKey::scalar.
Referenced by GNUNET_CRYPTO_blind_sign_keys_create_va(), and output_vectors().
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.
priv | the private key | |
[out] | pub | where to write the public key |
Definition at line 52 of file crypto_cs.c.
References GNUNET_CRYPTO_Cs25519Scalar::d, GNUNET_assert, pub, and GNUNET_CRYPTO_CsPrivateKey::scalar.
Referenced by GNUNET_CRYPTO_blind_sign_keys_create_va(), and output_vectors().
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.
In original papers r is generated randomly To provide abort-idempotency, r needs to be derived but still needs to be UNPREDICTABLE To ensure unpredictability a new nonce should be used when a new r needs to be derived. Uses HKDF internally. Comment: Can be done in one HKDF shot and split output.
nonce | is a random nonce | |
seed | seed to use in derivation | |
lts | is a long-term-secret in form of a private key | |
[out] | r | array containing derived secrets r0 and r1 |
Definition at line 79 of file crypto_cs.c.
References GNUNET_assert, GNUNET_CRYPTO_kdf(), GNUNET_YES, map_to_scalar_subgroup(), and seed.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sign(), GNUNET_CRYPTO_get_blinding_input_values(), and output_vectors().
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.
r_priv | the private key | |
[out] | r_pub | where to write the public key |
Definition at line 98 of file crypto_cs.c.
References GNUNET_CRYPTO_Cs25519Scalar::d, GNUNET_assert, GNUNET_CRYPTO_CsRPublic::point, GNUNET_CRYPTO_CsRSecret::scalar, and GNUNET_CRYPTO_Cs25519Point::y.
Referenced by checkvec(), GNUNET_CRYPTO_get_blinding_input_values(), and output_vectors().
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.
In original papers blinding factors are generated randomly To provide abort-idempotency, blinding factors need to be derived but still need to be UNPREDICTABLE. To ensure unpredictability a new nonce has to be used. Uses HKDF internally.
blind_seed | is the blinding seed to derive blinding factors | |
[out] | bs | array containing the two derived blinding secrets |
Definition at line 108 of file crypto_cs.c.
References alpha, beta, GNUNET_assert, GNUNET_CRYPTO_hkdf_gnunet(), GNUNET_YES, and map_to_scalar_subgroup().
Referenced by checkvec(), GNUNET_CRYPTO_blind_sig_unblind(), GNUNET_CRYPTO_message_blind_to_sign(), and output_vectors().
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.
Comment: One would be insecure due to Wagner's algorithm solving ROS
bs | array of the two blinding factor structs each containing alpha and beta | |
r_pub | array of the two signer's nonce R | |
pub | the public key of the signer | |
msg | the message to blind in preparation for signing | |
msg_len | length of message msg | |
[out] | blinded_c | array of the two blinded c's |
[out] | r_pub_blind | array of the two blinded R |
Definition at line 240 of file crypto_cs.c.
References GNUNET_CRYPTO_CsBlindingSecret::beta, calc_r_dash(), cs_full_domain_hash(), GNUNET_CRYPTO_Cs25519Scalar::d, msg, pub, GNUNET_CRYPTO_CSPublicRPairP::r_pub, and GNUNET_CRYPTO_CsC::scalar.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sig_unblind(), GNUNET_CRYPTO_message_blind_to_sign(), and output_vectors().
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.
This function derives b from a nonce and a longterm secret. In the original papers b is generated randomly. To provide abort-idempotency, b needs to be derived but still need to be UNPREDICTABLE. To ensure unpredictability a new nonce has to be used for every signature. HKDF is used internally for derivation. r0 and r1 can be derived prior by using GNUNET_CRYPTO_cs_r_derive.
priv | private key to use for the signing and as LTS in HKDF | |
r | array of the two secret inputs from the signer | |
bm | blinded message, including array of the two blinded c to sign c_b and the random nonce | |
[out] | cs_blind_sig | where to write the blind signature |
Definition at line 284 of file crypto_cs.c.
References GNUNET_CRYPTO_CsBlindSignature::b, GNUNET_CRYPTO_CsBlindedMessage::c, GNUNET_CRYPTO_Cs25519Scalar::d, GNUNET_assert, GNUNET_CRYPTO_hkdf_gnunet(), GNUNET_YES, GNUNET_CRYPTO_CsBlindedMessage::nonce, GNUNET_CRYPTO_CsBlindSignature::s_scalar, GNUNET_CRYPTO_CsPrivateKey::scalar, GNUNET_CRYPTO_CsRSecret::scalar, GNUNET_CRYPTO_CsC::scalar, and GNUNET_CRYPTO_CsBlindS::scalar.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sign(), and output_vectors().
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.
blinded_signature_scalar | the signature made on the blinded c | |
bs | the blinding factors used in the blinding | |
[out] | signature_scalar | where to write the unblinded signature |
Definition at line 318 of file crypto_cs.c.
References GNUNET_CRYPTO_CsBlindingSecret::alpha, GNUNET_CRYPTO_Cs25519Scalar::d, GNUNET_CRYPTO_CsS::scalar, and GNUNET_CRYPTO_CsBlindS::scalar.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sig_unblind(), and output_vectors().
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.
sig | signature that is being validated |
pub | public key of the signer |
msg | is the message that should be signed by sig (message is used to calculate c) |
msg_len | is the message length |
Definition at line 330 of file crypto_cs.c.
References cs_full_domain_hash(), GNUNET_CRYPTO_Cs25519Scalar::d, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, msg, GNUNET_CRYPTO_CsRPublic::point, pub, GNUNET_CRYPTO_CsSignature::r_point, GNUNET_CRYPTO_CsSignature::s_scalar, GNUNET_CRYPTO_CsC::scalar, GNUNET_CRYPTO_CsS::scalar, and GNUNET_CRYPTO_Cs25519Point::y.
Referenced by checkvec(), GNUNET_CRYPTO_blind_sig_verify(), and output_vectors().
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.
bsign_priv | private key to compute input values for |
nonce | session nonce to derive input values from |
salt | salt to include in derivation logic |
Definition at line 431 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPrivateKey::cipher, GNUNET_CRYPTO_BlindingInputValues::cipher, GNUNET_CRYPTO_BlindSessionNonce::cs_nonce, GNUNET_CRYPTO_BlindSignPrivateKey::cs_private_key, GNUNET_CRYPTO_BlindingInputValues::cs_values, GNUNET_CRYPTO_BlindSignPrivateKey::details, GNUNET_CRYPTO_BlindingInputValues::details, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_cs_r_derive(), GNUNET_CRYPTO_cs_r_get_public(), GNUNET_free, GNUNET_new, GNUNET_CRYPTO_CSPublicRPairP::r_pub, GNUNET_CRYPTO_BlindingInputValues::rc, and salt.
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.
[in] | bsign_pub | key to free |
Definition at line 79 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindSignPublicKey::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_public_key_free(), GNUNET_free, GNUNET_CRYPTO_BlindSignPublicKey::rc, and GNUNET_CRYPTO_BlindSignPublicKey::rsa_public_key.
Referenced by clean_blind_sign_pub().
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.
[in] | bsign_priv | key to free |
Definition at line 50 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPrivateKey::cipher, GNUNET_CRYPTO_BlindSignPrivateKey::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_private_key_free(), GNUNET_free, GNUNET_CRYPTO_BlindSignPrivateKey::rc, and GNUNET_CRYPTO_BlindSignPrivateKey::rsa_private_key.
Referenced by clean_blind_sign_priv().
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.
[in] | ub_sig | signature to free |
Definition at line 107 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_UnblindedSignature::cipher, GNUNET_CRYPTO_UnblindedSignature::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_signature_free(), GNUNET_free, GNUNET_CRYPTO_UnblindedSignature::rc, and GNUNET_CRYPTO_UnblindedSignature::rsa_signature.
Referenced by clean_unblinded_sig().
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.
[in] | blind_sig | signature to free |
Definition at line 136 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindedSignature::blinded_rsa_signature, GNUNET_CRYPTO_BlindedSignature::cipher, GNUNET_CRYPTO_BlindedSignature::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_signature_free(), GNUNET_free, and GNUNET_CRYPTO_BlindedSignature::rc.
Referenced by clean_blinded_sig().
void GNUNET_CRYPTO_blinded_message_decref | ( | struct GNUNET_CRYPTO_BlindedMessage * | bm | ) |
Decrement reference counter of a bm, and free it if it reaches zero.
[in] | bm | blinded message to free |
Definition at line 166 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_BlindedMessage::cipher, GNUNET_CRYPTO_BlindedMessage::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_free, GNUNET_CRYPTO_BlindedMessage::rc, and GNUNET_CRYPTO_BlindedMessage::rsa_blinded_message.
Referenced by clean_blinded_message().
struct GNUNET_CRYPTO_BlindedMessage * GNUNET_CRYPTO_blinded_message_incref | ( | struct GNUNET_CRYPTO_BlindedMessage * | bm | ) |
Increment reference counter of the given bm.
[in,out] | bm | blinded message to increment reference counter for |
Definition at line 189 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindedMessage::rc.
struct GNUNET_CRYPTO_BlindingInputValues * GNUNET_CRYPTO_blinding_input_values_incref | ( | struct GNUNET_CRYPTO_BlindingInputValues * | bm | ) |
Increment reference counter of the given bi.
[in,out] | bi | blinding input values to increment reference counter for |
Definition at line 198 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindingInputValues::rc.
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.
[in,out] | bi | blinding input values to decrement reference counter for |
Definition at line 26 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindingInputValues::cipher, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_free, and GNUNET_CRYPTO_BlindingInputValues::rc.
struct GNUNET_CRYPTO_BlindSignPublicKey * GNUNET_CRYPTO_bsign_pub_incref | ( | struct GNUNET_CRYPTO_BlindSignPublicKey * | bsign_pub | ) |
Increment reference counter of the given bsign_pub.
[in,out] | bsign_pub | public key to increment reference counter for |
Definition at line 207 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPublicKey::rc.
struct GNUNET_CRYPTO_BlindSignPrivateKey * GNUNET_CRYPTO_bsign_priv_incref | ( | struct GNUNET_CRYPTO_BlindSignPrivateKey * | bsign_priv | ) |
Increment reference counter of the given bsign_priv.
[in,out] | bsign_priv | private key to increment reference counter for |
Definition at line 216 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPrivateKey::rc.
struct GNUNET_CRYPTO_UnblindedSignature * GNUNET_CRYPTO_ub_sig_incref | ( | struct GNUNET_CRYPTO_UnblindedSignature * | ub_sig | ) |
Increment reference counter of the given ub_sig.
[in,out] | ub_sig | signature to increment reference counter for |
Definition at line 225 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_UnblindedSignature::rc.
struct GNUNET_CRYPTO_BlindedSignature * GNUNET_CRYPTO_blind_sig_incref | ( | struct GNUNET_CRYPTO_BlindedSignature * | blind_sig | ) |
Increment reference counter of the given blind_sig.
[in,out] | blind_sig | signature to increment reference counter for |
Definition at line 233 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindedSignature::rc.
int GNUNET_CRYPTO_bsign_pub_cmp | ( | const struct GNUNET_CRYPTO_BlindSignPublicKey * | bp1, |
const struct GNUNET_CRYPTO_BlindSignPublicKey * | bp2 | ||
) |
Compare two denomination public keys.
bp1 | first key |
bp2 | second key |
Definition at line 242 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_memcmp, and GNUNET_CRYPTO_BlindSignPublicKey::pub_key_hash.
int GNUNET_CRYPTO_ub_sig_cmp | ( | const struct GNUNET_CRYPTO_UnblindedSignature * | sig1, |
const struct GNUNET_CRYPTO_UnblindedSignature * | sig2 | ||
) |
Compare two denomination signatures.
sig1 | first signature |
sig2 | second signature |
Definition at line 266 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_UnblindedSignature::cipher, GNUNET_CRYPTO_UnblindedSignature::cs_signature, GNUNET_CRYPTO_UnblindedSignature::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_signature_cmp(), GNUNET_memcmp, and GNUNET_CRYPTO_UnblindedSignature::rsa_signature.
int GNUNET_CRYPTO_blind_sig_cmp | ( | const struct GNUNET_CRYPTO_BlindedSignature * | sig1, |
const struct GNUNET_CRYPTO_BlindedSignature * | sig2 | ||
) |
Compare two blinded denomination signatures.
sig1 | first signature |
sig2 | second signature |
Definition at line 290 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindedSignature::blinded_cs_answer, GNUNET_CRYPTO_BlindedSignature::blinded_rsa_signature, GNUNET_CRYPTO_BlindedSignature::cipher, GNUNET_CRYPTO_BlindedSignature::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_signature_cmp(), and GNUNET_memcmp.
int GNUNET_CRYPTO_blinded_message_cmp | ( | const struct GNUNET_CRYPTO_BlindedMessage * | bp1, |
const struct GNUNET_CRYPTO_BlindedMessage * | bp2 | ||
) |
Compare two blinded messages.
bp1 | first blinded message |
bp2 | second blinded message |
Definition at line 315 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg_size, GNUNET_CRYPTO_BlindedMessage::cipher, GNUNET_CRYPTO_BlindedMessage::cs_blinded_message, GNUNET_CRYPTO_BlindedMessage::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_memcmp, and GNUNET_CRYPTO_BlindedMessage::rsa_blinded_message.
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.
For GNUNET_CRYPTO_BSA_RSA, an additional "unsigned int" argument with the number of bits for 'n' (e.g. 2048) must be passed.
[out] | bsign_priv | where to write the private key with RC 1 |
[out] | bsign_pub | where to write the public key with RC 1 |
cipher | which type of cipher to use | |
... | RSA key size (eg. 2048/3072/4096) |
Definition at line 344 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindedSignature::cipher, GNUNET_CRYPTO_blind_sign_keys_create_va(), and ret.
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.
For GNUNET_CRYPTO_BSA_RSA, an additional "unsigned int" argument with the number of bits for 'n' (e.g. 2048) must be passed.
[out] | bsign_priv | where to write the private key with RC 1 |
[out] | bsign_pub | where to write the public key with RC 1 |
cipher | which type of cipher to use | |
ap | RSA key size (eg. 2048/3072/4096) |
Definition at line 365 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindSignPrivateKey::cipher, GNUNET_CRYPTO_BlindSignPrivateKey::cs_private_key, GNUNET_CRYPTO_BlindSignPrivateKey::details, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_cs_private_key_generate(), GNUNET_CRYPTO_cs_private_key_get_public(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_rsa_private_key_create(), GNUNET_CRYPTO_rsa_private_key_get_public(), GNUNET_CRYPTO_rsa_public_key_hash(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_SYSERR, pub, GNUNET_CRYPTO_BlindSignPrivateKey::rc, and GNUNET_CRYPTO_BlindSignPrivateKey::rsa_private_key.
Referenced by GNUNET_CRYPTO_blind_sign_keys_create().
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.
bsign_pub | public key to blind for |
bks | blinding secret to use |
nonce | nonce used to obtain alg_values can be NULL if input values are not used for the cipher |
message | message to sign |
message_size | number of bytes in message |
alg_values | algorithm specific values to blind the message |
Definition at line 471 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_CsBlindedMessage::c, GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindedMessage::cipher, GNUNET_CRYPTO_BlindedMessage::cs_blinded_message, GNUNET_CRYPTO_BlindSessionNonce::cs_nonce, GNUNET_CRYPTO_BlindSignPublicKey::cs_public_key, GNUNET_CRYPTO_BlindingInputValues::cs_values, GNUNET_CRYPTO_BlindSignPublicKey::details, GNUNET_CRYPTO_BlindedMessage::details, GNUNET_CRYPTO_BlindingInputValues::details, GNUNET_break, GNUNET_break_op, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_cs_blinding_secrets_derive(), GNUNET_CRYPTO_cs_calc_blinded_c(), GNUNET_CRYPTO_rsa_blind(), GNUNET_free, GNUNET_new, GNUNET_YES, GNUNET_CRYPTO_CsBlindedMessage::nonce, GNUNET_CRYPTO_BlindingSecretP::nonce, GNUNET_CRYPTO_CSPublicRPairP::r_pub, GNUNET_CRYPTO_BlindedMessage::rc, GNUNET_CRYPTO_BlindingSecretP::rsa_bks, GNUNET_CRYPTO_BlindedMessage::rsa_blinded_message, and GNUNET_CRYPTO_BlindSignPublicKey::rsa_public_key.
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.
bsign_priv | private key to use for signing |
salt | salt value to use for the HKDF, can be NULL if input values are not used for the cipher |
blinded_message | the already blinded message to sign |
Definition at line 536 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_BlindedSignature::blinded_cs_answer, GNUNET_CRYPTO_BlindedSignature::blinded_rsa_signature, GNUNET_CRYPTO_BlindedSignature::cipher, GNUNET_CRYPTO_BlindSignPrivateKey::cipher, GNUNET_CRYPTO_BlindedMessage::cipher, GNUNET_CRYPTO_BlindedMessage::cs_blinded_message, GNUNET_CRYPTO_BlindSignPrivateKey::cs_private_key, GNUNET_CRYPTO_BlindedSignature::details, GNUNET_CRYPTO_BlindSignPrivateKey::details, GNUNET_CRYPTO_BlindedMessage::details, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_cs_r_derive(), GNUNET_CRYPTO_cs_sign_derive(), GNUNET_CRYPTO_rsa_sign_blinded(), GNUNET_free, GNUNET_new, GNUNET_CRYPTO_CsBlindedMessage::nonce, GNUNET_CRYPTO_BlindedSignature::rc, GNUNET_CRYPTO_BlindedMessage::rsa_blinded_message, GNUNET_CRYPTO_BlindSignPrivateKey::rsa_private_key, and salt.
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.
blinded_sig | the blind signature |
bks | blinding secret to use |
message | message that was supposedly signed |
message_size | number of bytes in message |
alg_values | algorithm specific values |
bsign_pub | public key used for signing |
Definition at line 593 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_CsBlindSignature::b, GNUNET_CRYPTO_BlindedSignature::blinded_cs_answer, GNUNET_CRYPTO_BlindedSignature::blinded_rsa_signature, GNUNET_CRYPTO_UnblindedSignature::cipher, GNUNET_CRYPTO_BlindedSignature::cipher, GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindingInputValues::cipher, GNUNET_CRYPTO_BlindSignPublicKey::cs_public_key, GNUNET_CRYPTO_UnblindedSignature::cs_signature, GNUNET_CRYPTO_BlindingInputValues::cs_values, GNUNET_CRYPTO_UnblindedSignature::details, GNUNET_CRYPTO_BlindedSignature::details, GNUNET_CRYPTO_BlindSignPublicKey::details, GNUNET_CRYPTO_BlindingInputValues::details, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_cs_blinding_secrets_derive(), GNUNET_CRYPTO_cs_calc_blinded_c(), GNUNET_CRYPTO_cs_unblind(), GNUNET_CRYPTO_rsa_unblind(), GNUNET_free, GNUNET_new, GNUNET_CRYPTO_BlindingSecretP::nonce, GNUNET_CRYPTO_CsSignature::r_point, GNUNET_CRYPTO_CSPublicRPairP::r_pub, GNUNET_CRYPTO_UnblindedSignature::rc, GNUNET_CRYPTO_BlindingSecretP::rsa_bks, GNUNET_CRYPTO_BlindSignPublicKey::rsa_public_key, GNUNET_CRYPTO_UnblindedSignature::rsa_signature, GNUNET_CRYPTO_CsSignature::s_scalar, and GNUNET_CRYPTO_CsBlindSignature::s_scalar.
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.
bsign_pub | public key |
ub_sig | signature made blindly with the private key |
message | message that was supposedly signed |
message_size | number of bytes in message |
Definition at line 669 of file crypto_blind_sign.c.
References GNUNET_CRYPTO_UnblindedSignature::cipher, GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindSignPublicKey::cs_public_key, GNUNET_CRYPTO_UnblindedSignature::cs_signature, GNUNET_CRYPTO_UnblindedSignature::details, GNUNET_CRYPTO_BlindSignPublicKey::details, GNUNET_break, GNUNET_break_op, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_cs_verify(), GNUNET_CRYPTO_rsa_verify(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_CRYPTO_BlindSignPublicKey::rsa_public_key, and GNUNET_CRYPTO_UnblindedSignature::rsa_signature.
ssize_t GNUNET_CRYPTO_public_key_get_length | ( | const struct GNUNET_CRYPTO_PublicKey * | key | ) |
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
Compacted means that it returns the minimum number of bytes this key is long, as opposed to the union structure inside GNUNET_CRYPTO_PublicKey. Useful for compact serializations.
key | the key. |
Definition at line 85 of file crypto_pkey.c.
References GNUNET_break, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, and key.
Referenced by attr_iter_cb(), check_signature_identity(), consume_result_cb(), cred_iter_cb(), ego_callback(), get_message_body_size(), GNR_create_signature_message(), gns_string_to_value(), GNUNET_CRYPTO_public_key_to_string(), GNUNET_CRYPTO_read_public_key_from_buffer(), GNUNET_CRYPTO_write_public_key_to_buffer(), GNUNET_GNS_lookup_limited(), GNUNET_GNSRECORD_check_pow(), GNUNET_GNSRECORD_data_from_identity(), GNUNET_GNSRECORD_pow_round(), GNUNET_GNSRECORD_proof_get_size(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_REVOCATION_query(), handle_client_call_message(), publicize_rm(), run(), run_edkey(), run_pkey(), run_with_key(), run_with_zone_pkey(), send_enter_room(), send_open_room(), and sign_pow_identity().
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.
The buffer has to contain at least the compacted length of a GNUNET_CRYPTO_PublicKey in bytes. If the buffer is too small, the function returns -1 as error. If the buffer does not contain a valid key, it returns -2 as error.
buffer | the buffer |
len | the length of buffer |
key | the key |
the | amount of bytes read from the buffer |
Definition at line 102 of file crypto_pkey.c.
References GNUNET_CRYPTO_public_key_get_length(), GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, and key.
Referenced by block_plugin_revocation_check_block(), block_plugin_revocation_get_key(), check_room_initial_key(), handle_attribute_result(), handle_cadet_ring_message(), handle_consume_ticket_result(), handle_credential_result(), handle_lookup(), handle_phone_ring(), handle_query_message(), handle_zone_to_name(), and initialize_handle_via_key().
ssize_t GNUNET_CRYPTO_private_key_get_length | ( | const struct GNUNET_CRYPTO_PrivateKey * | key | ) |
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
Compacted means that it returns the minimum number of bytes this key is long, as opposed to the union structure inside GNUNET_CRYPTO_PrivateKey. Useful for compact serializations.
key | the key. |
Definition at line 64 of file crypto_pkey.c.
References GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, and key.
Referenced by create_update_message(), GNUNET_CRYPTO_private_key_to_string(), GNUNET_CRYPTO_read_private_key_from_buffer(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_IDENTITY_create(), GNUNET_IDENTITY_ego_get_anonymous(), GNUNET_MESSENGER_connect(), GNUNET_MESSENGER_set_key(), GNUNET_NAMESTORE_record_set_edit_begin(), GNUNET_NAMESTORE_record_set_edit_cancel(), GNUNET_NAMESTORE_records_store(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_attribute_store(), GNUNET_RECLAIM_credential_delete(), GNUNET_RECLAIM_credential_store(), GNUNET_RECLAIM_get_attributes_start(), GNUNET_RECLAIM_get_credentials_start(), GNUNET_RECLAIM_ticket_issue(), GNUNET_RECLAIM_ticket_iteration_start(), GNUNET_RECLAIM_ticket_revoke(), handle_gns_response(), handle_identity_update(), handle_zone_to_name_it(), notify_listeners(), records_lookup(), and send_lookup_response_with_filter().
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.
The buffer requires space for at least the compacted length of a GNUNET_CRYPTO_PublicKey in bytes. If the buffer is too small, the function returns -1 as error. If the key is not valid, it returns -2 as error.
key | the key |
buffer | the buffer |
len | the length of buffer |
Definition at line 128 of file crypto_pkey.c.
References GNUNET_CRYPTO_public_key_get_length(), GNUNET_memcpy, and key.
Referenced by attr_iter_cb(), consume_result_cb(), cred_iter_cb(), GNR_create_signature_message(), GNUNET_GNS_lookup_limited(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_REVOCATION_query(), handle_client_call_message(), send_enter_room(), and send_open_room().
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.
The buffer has to contain at least the compacted length of a GNUNET_CRYPTO_PrivateKey in bytes. If the buffer is too small, the function returns GNUNET_SYSERR as error.
buffer | the buffer |
len | the length of buffer |
key | the key |
the | amount of bytes read from the buffer |
Definition at line 146 of file crypto_pkey.c.
References GNUNET_CRYPTO_private_key_get_length(), GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, and key.
Referenced by handle_attribute_delete_message(), handle_attribute_store_message(), handle_client_call_message(), handle_create_message(), handle_credential_delete_message(), handle_credential_iteration_start(), handle_credential_store_message(), handle_edit_record_set(), handle_edit_record_set_cancel(), handle_identity_update(), handle_issue_ticket_message(), handle_iteration_start(), handle_lookup_result(), handle_monitor_start(), handle_record_lookup(), handle_record_result(), handle_record_store(), handle_result(), handle_revoke_ticket_message(), handle_ticket_iteration_start(), handle_zone_to_name(), and handle_zone_to_name_response().
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.
The buffer requires space for at least the compacted length of a GNUNET_CRYPTO_PrivateKey in bytes. If the buffer is too small, the function returns -1 as error. If the key is not valid, it returns -2 as error.
key | the key |
buffer | the buffer |
len | the length of buffer |
Definition at line 172 of file crypto_pkey.c.
References GNUNET_CRYPTO_private_key_get_length(), GNUNET_memcpy, and key.
Referenced by create_update_message(), GNUNET_IDENTITY_create(), GNUNET_NAMESTORE_record_set_edit_begin(), GNUNET_NAMESTORE_record_set_edit_cancel(), GNUNET_NAMESTORE_records_store(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_attribute_store(), GNUNET_RECLAIM_credential_delete(), GNUNET_RECLAIM_credential_store(), GNUNET_RECLAIM_get_attributes_start(), GNUNET_RECLAIM_get_credentials_start(), GNUNET_RECLAIM_ticket_issue(), GNUNET_RECLAIM_ticket_iteration_start(), GNUNET_RECLAIM_ticket_revoke(), handle_gns_response(), handle_zone_to_name_it(), notify_listeners(), reconnect(), records_lookup(), and send_lookup_response_with_filter().
ssize_t GNUNET_CRYPTO_signature_get_length | ( | const struct GNUNET_CRYPTO_Signature * | sig | ) |
Get the compacted length of a GNUNET_CRYPTO_Signature.
Compacted means that it returns the minimum number of bytes this signature is long, as opposed to the union structure inside GNUNET_CRYPTO_Signature. Useful for compact serializations.
sig | the signature. |
Definition at line 190 of file crypto_pkey.c.
References GNUNET_CRYPTO_Signature::ecdsa_signature, GNUNET_CRYPTO_Signature::eddsa_signature, GNUNET_break, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, and GNUNET_CRYPTO_Signature::type.
Referenced by get_message_size(), GNUNET_CRYPTO_read_signature_from_buffer(), GNUNET_CRYPTO_write_signature_to_buffer(), handle_client_call_message(), and hash_message().
ssize_t GNUNET_CRYPTO_signature_get_raw_length_by_type | ( | uint32_t | type | ) |
Get the compacted length of a signature by type.
Compacted means that it returns the minimum number of bytes this signature is long, as opposed to the union structure inside GNUNET_CRYPTO_Signature. Useful for compact serializations.
sig | the signature. |
Definition at line 209 of file crypto_pkey.c.
References GNUNET_break, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, and type.
Referenced by GNUNET_GNSRECORD_proof_get_size().
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.
The buffer has to contain at least the compacted length of a GNUNET_CRYPTO_Signature in bytes. If the buffer is too small, the function returns -1 as error. If the buffer does not contain a valid key, it returns -2 as error.
sig | the signature |
buffer | the buffer |
len | the length of buffer |
Definition at line 227 of file crypto_pkey.c.
References GNUNET_CRYPTO_Signature::ecdsa_signature, GNUNET_CRYPTO_signature_get_length(), GNUNET_memcpy, and GNUNET_CRYPTO_Signature::type.
Referenced by decode_message(), and handle_cadet_ring_message().
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.
The buffer requires space for at least the compacted length of a GNUNET_CRYPTO_Signature in bytes. If the buffer is too small, the function returns -1 as error. If the key is not valid, it returns -2 as error.
sig | the signature |
buffer | the buffer |
len | the length of buffer |
Definition at line 248 of file crypto_pkey.c.
References GNUNET_CRYPTO_Signature::ecdsa_signature, GNUNET_CRYPTO_signature_get_length(), GNUNET_memcpy, and GNUNET_CRYPTO_Signature::type.
Referenced by handle_client_call_message().
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.
The purpose data is the beginning of the data of which the signature is to be created. The size
field in purpose must correctly indicate the number of bytes of the data structure, including its header. If possible, use GNUNET_CRYPTO_sign() instead of this function.
priv | private key to use for the signing | |
purpose | what to sign (size, purpose) | |
[out] | sig | where to write the signature |
Definition at line 293 of file crypto_pkey.c.
References GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_CRYPTO_Signature::ecdsa_signature, GNUNET_CRYPTO_PrivateKey::eddsa_key, GNUNET_CRYPTO_Signature::eddsa_signature, GNUNET_break, GNUNET_CRYPTO_ecdsa_sign_(), GNUNET_CRYPTO_eddsa_sign_(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, GNUNET_CRYPTO_PrivateKey::type, and GNUNET_CRYPTO_Signature::type.
Referenced by GNUNET_ABD_delegate_issue(), and OIDC_build_authz_code().
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.
The purpose data is the beginning of the data of which the signature is to be created. The size
field in purpose must correctly indicate the number of bytes of the data structure, including its header. The signature payload and length depends on the key type.
priv | private key to use for the signing | |
purpose | what to sign (size, purpose) | |
[out] | sig | where to write the signature |
Definition at line 266 of file crypto_pkey.c.
References GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_CRYPTO_PrivateKey::eddsa_key, GNUNET_break, GNUNET_CRYPTO_ecdsa_sign_(), GNUNET_CRYPTO_eddsa_sign_(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, and GNUNET_CRYPTO_PrivateKey::type.
Referenced by sign_pow_identity().
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.
The validate data is the beginning of the data of which the signature is to be verified. The size
field in validate must correctly indicate the number of bytes of the data structure, including its header. If purpose does not match the purpose given in validate (the latter must be in big endian), signature verification fails. If possible, use GNUNET_CRYPTO_signature_verify() instead of this function (only if validate is not fixed-size, you must use this function directly).
purpose | what is the purpose that the signature should have? |
validate | block to validate (size, purpose, data) |
sig | signature that is being validated |
pub | public key of the signer |
Definition at line 319 of file crypto_pkey.c.
References GNUNET_CRYPTO_Signature::ecdsa_signature, GNUNET_CRYPTO_Signature::eddsa_signature, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_ecdsa_verify_(), GNUNET_CRYPTO_eddsa_verify_(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, pub, and GNUNET_CRYPTO_Signature::type.
Referenced by GNUNET_ABD_delegate_deserialize(), GNUNET_ABD_delegate_serialize(), and OIDC_parse_authz_code().
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.
The validate data is the beginning of the data of which the signature is to be verified. The size
field in validate must correctly indicate the number of bytes of the data structure, including its header. If purpose does not match the purpose given in validate (the latter must be in big endian), signature verification fails.
purpose | what is the purpose that the signature should have? |
validate | block to validate (size, purpose, data) |
sig | signature that is being validated |
pub | public key of the signer |
Definition at line 348 of file crypto_pkey.c.
References GNUNET_break, GNUNET_CRYPTO_ecdsa_verify_(), GNUNET_CRYPTO_eddsa_verify_(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, and pub.
Referenced by check_signature_identity().
char * GNUNET_CRYPTO_public_key_to_string | ( | const struct GNUNET_CRYPTO_PublicKey * | key | ) |
Creates a (Base32) string representation of the public key.
The resulting string encodes a compacted representation of the key. See also #GNUNET_CRYPTO_key_get_length.
key | the key. |
Definition at line 379 of file crypto_pkey.c.
References GNUNET_CRYPTO_public_key_get_length(), GNUNET_STRINGS_data_to_string_alloc(), key, and size.
Referenced by abd_value_to_string(), create_finished(), delegation_chain_fw_resolution_start(), DID_ego_to_did(), DID_pkey_to_did(), forward_resolution(), get_store_contact(), gns_value_to_string(), GNUNET_ABD_delegate_to_string(), GNUNET_GNSRECORD_pkey_to_zkey(), handle_intermediate_result(), handle_verify_result(), issue_ticket(), list_ego(), print_deleset(), print_ego(), save_member_session(), send_enter_room(), send_open_room(), store_cb(), and verify_member_session_as_sender().
char * GNUNET_CRYPTO_private_key_to_string | ( | const struct GNUNET_CRYPTO_PrivateKey * | key | ) |
Creates a (Base32) string representation of the private key.
The resulting string encodes a compacted representation of the key. See also #GNUNET_CRYPTO_key_get_length.
key | the key. |
Definition at line 389 of file crypto_pkey.c.
References GNUNET_CRYPTO_private_key_get_length(), GNUNET_STRINGS_data_to_string_alloc(), key, and size.
Referenced by create_finished(), display_record(), ego_get_all(), ego_get_response(), and print_ego().
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.
See also GNUNET_CRYPTO_public_key_to_string.
str | the encoded key. |
key | where to write the key. |
Definition at line 399 of file crypto_pkey.c.
References check_key_type(), GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, key, and ret.
Referenced by abd_string_to_value(), authorize_endpoint(), code_redirect(), consume_fail(), consume_ticket(), create_response(), DID_did_to_pkey(), DID_public_key_from_did(), get_identity_for_string(), gns_string_to_value(), GNUNET_ABD_delegate_from_string(), GNUNET_GNS_lookup_with_tld(), GNUNET_GNS_parse_ztld(), GNUNET_GNSRECORD_zkey_to_pkey(), identity_cb(), load_member_session(), load_member_session_next(), run(), run_with_zone_pkey(), sign_cb(), tld_iter(), and write_encrypted_message().
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.
See also GNUNET_CRYPTO_private_key_to_string.
str | the encoded key. |
key | where to write the key. |
Definition at line 415 of file crypto_pkey.c.
References check_key_type(), GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, key, and ret.
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.
privkey | the private key. |
key | the public key result. |
Definition at line 430 of file crypto_pkey.c.
References GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_CRYPTO_PrivateKey::eddsa_key, GNUNET_break, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_OK, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, key, and GNUNET_CRYPTO_PrivateKey::type.
Referenced by attr_iter_cb(), authorize_endpoint(), create_finished(), create_message_join(), create_message_key(), cred_iter_cb(), dequeue_message_from_room(), DID_create_namestore_lookup_cb(), get_nick_record(), GNUNET_ABD_delegate_issue(), GNUNET_GNSRECORD_block_calculate_size(), GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_sign(), GNUNET_GNSRECORD_query_from_private_key(), GNUNET_IDENTITY_ego_get_public_key(), handle_attribute_store_message(), handle_client_call_message(), handle_collect(), handle_credential_store_message(), identity_zone_cb(), issue_ticket(), run_edkey(), run_pkey(), run_with_key(), set_handle_key(), and sign_pow().
struct GNUNET_OP_Handle * GNUNET_OP_create | ( | ) |
Create new operations handle.
void GNUNET_OP_destroy | ( | struct GNUNET_OP_Handle * | h | ) |
Destroy operations handle.
uint64_t GNUNET_OP_get_next_id | ( | struct GNUNET_OP_Handle * | h | ) |
Get a unique operation ID to distinguish between asynchronous requests.
h | Operations handle. |
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.
h | Operations handle. | |
op_id | Operation ID to look up. | |
[out] | result_cb | If an operation was found, its result callback is returned here. |
[out] | cls | If an operation was found, its closure is returned here. |
[out] | ctx | User context. |
uint64_t GNUNET_OP_add | ( | struct GNUNET_OP_Handle * | h, |
GNUNET_ResultCallback | result_cb, | ||
void * | cls, | ||
void * | ctx | ||
) |
Add a new operation.
h | Operations handle. |
result_cb | Function to call with the result of the operation. |
cls | Closure for result_cb. |
ctx | User context. |
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.
h | Operations handle. | |
op_id | Operation ID. | |
result_code | Result of the operation. | |
data | Data result of the operation. | |
data_size | Size of data. | |
[out] | ctx | User context. |
int GNUNET_OP_remove | ( | struct GNUNET_OP_Handle * | h, |
uint64_t | op_id | ||
) |
Remove / cancel an operation.
h | Operations handle. |
op_id | Operation ID. |
uint32_t GNUNET_HashCode::bits[512/8/sizeof(uint32_t)] |
Definition at line 285 of file gnunet_common.h.
Referenced by find_bucket(), GNUNET_CRYPTO_hash_difference(), GNUNET_CRYPTO_hash_distance_u32(), GNUNET_CRYPTO_hash_sum(), GNUNET_CRYPTO_hmac_raw(), and main().
uint32_t GNUNET_ShortHashCode::bits[256/8/sizeof(uint32_t)] |
Definition at line 295 of file gnunet_common.h.
uint32_t GNUNET_Uuid::value[4] |
128 random bits.
Definition at line 312 of file gnunet_common.h.
uint16_t GNUNET_MessageHeader::size |
The length of the struct (in bytes, including the length field itself), in big-endian format.
Definition at line 325 of file gnunet_common.h.
Referenced by announce_id(), barrier_reached_run(), build_json_response(), cadet_mq_send_impl(), callback_download(), check_add_global_address(), check_address_change_notification(), check_advertisement(), check_alice_client_message(), check_alice_client_message_multipart(), check_alices_cryptodata_message(), check_arm_list_result(), check_attribute_delete_message(), check_attribute_result(), check_attribute_store_message(), check_backchannel_encapsulation(), check_bob_client_message(), check_bob_client_message_multipart(), check_bobs_cryptodata_message(), check_bobs_cryptodata_multipart(), check_client_hello(), check_client_keygen(), check_client_redirect_to_ip(), check_client_result(), check_client_seed(), check_client_send(), check_client_start_search(), check_collect(), check_communicator_available(), check_communicator_backchannel(), check_connection_create(), check_connection_reversal_request(), check_consume_ticket_message(), check_consume_ticket_result(), check_create_message(), check_credential_delete_message(), check_credential_iteration_start(), check_credential_result(), check_credential_store_message(), check_data(), check_delete_message(), check_dht_local_get_result_seen(), check_dht_local_hello_offer(), check_dht_p2p_put(), check_dht_p2p_result(), check_dv_box(), check_dv_learn(), check_edit_record_set(), check_edit_record_set_cancel(), check_edit_record_set_response(), check_flow_control(), check_fragment_box(), check_get(), check_get_path(), check_helper_init(), check_identity_result_code(), check_identity_update(), check_incoming_msg(), check_index_info(), check_index_start_failed(), check_issue_ticket_message(), check_iterate_start(), check_iteration_start(), check_local_data(), check_lookup(), check_lookup_result(), check_monitor_get_resp(), check_monitor_notify(), check_monitor_put(), check_monitor_start(), check_notify_inbound(), check_p2p_get(), check_p2p_revoke(), check_peer_pull_reply(), check_query_message(), check_record_lookup(), check_record_result(), check_record_store(), check_recv(), check_recv_message(), check_register(), check_reliability_ack(), check_reliability_box(), check_rename_message(), check_request(), check_request_connection_reversal(), check_response(), check_result(), check_revoke_message(), check_revoke_ticket_message(), check_room_initial_key(), check_search(), check_send_message(), check_set(), check_statistics_value(), check_status(), check_stream_input(), check_stun(), check_ticket_iteration_start(), check_ticket_result(), check_tunnel_message(), check_union_p2p_ibf(), check_union_p2p_inquiry(), check_union_p2p_strata_estimator(), check_use_ip(), check_verify(), check_view_update(), check_watch(), check_zone_to_name_response(), consider_for_advertising(), consider_sending_fc(), consider_ss_ack(), core_mq_send_impl(), create_rekey(), demultiplex_with_cmc(), do_pad(), do_restart_typemap_message(), do_send(), enc_notify_cb(), encapsulate_for_dv(), execute_add(), execute_remove(), extract_box_cb(), find_advertisable_hello(), forward_dv_box(), forward_dv_learn(), fragment_message(), GCCH_handle_channel_plaintext_data(), GCCH_handle_local_data(), GCP_set_hello(), GCT_handle_encrypted(), GCT_send(), GCT_send_channel_destroy(), GDS_helper_make_put_message(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_reply(), GNUNET_copy_message(), GNUNET_HELLO_builder_to_dht_hello_msg(), GNUNET_HELLO_dht_msg_to_block(), GNUNET_HELLO_parser_from_msg(), GNUNET_HELPER_send(), GNUNET_MQ_extract_nested_mh_(), GNUNET_MQ_msg_(), GNUNET_MQ_msg_copy(), GNUNET_MQ_msg_nested_mh_(), GNUNET_MQ_send(), GNUNET_MQ_send_copy(), GNUNET_MST_from_buffer(), GNUNET_NAT_register(), GNUNET_PEERSTORE_hello_add(), GNUNET_TRANSPORT_communicator_notify(), GNUNET_TRANSPORT_communicator_receive(), got_hello(), GSC_CLIENTS_deliver_message(), GSC_SESSIONS_confirm_typemap(), GSC_SESSIONS_set_typemap(), GSC_SESSIONS_transmit(), GSC_TYPEMAP_compute_type_map_message(), GSC_TYPEMAP_get_from_message(), handle_add_address(), handle_add_queue_message(), handle_address_change_notification(), handle_arm_list_result(), handle_autoconfig_request(), handle_backchannel_encapsulation(), handle_block_cache(), handle_cadet_audio_message(), handle_call_audio(), handle_client_audio_message(), handle_client_decrypt(), handle_client_init(), handle_client_insert(), handle_client_redirect_to_ip(), handle_client_response(), handle_client_send(), handle_client_set_add(), handle_client_start_search(), handle_communicator_available(), handle_communicator_backchannel(), handle_connection_create(), handle_core_message(), handle_data(), handle_dht_local_get_result_seen(), handle_dht_local_put(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_dns_request(), handle_dns_response(), handle_dummy(), handle_dv_box(), handle_fragment_box(), handle_get(), handle_get_path(), handle_helper_barrier_reached(), handle_helper_init(), handle_icmp_back(), handle_icmp_remote(), handle_icmp_service(), handle_identity_update(), handle_incoming_msg(), handle_intersection_p2p_bf(), handle_iter_element(), handle_local_data(), handle_lookup_block_response(), handle_monitor_get_resp(), handle_monitor_put(), handle_new_element(), handle_p2p_get(), handle_p2p_put(), handle_phone_audio(), handle_plaintext_data(), handle_put(), handle_record_store(), handle_recv(), handle_recv_message(), handle_register(), handle_reliability_ack(), handle_reply(), handle_request(), handle_response(), handle_result(), handle_send_message(), handle_set(), handle_statistics_value(), handle_status(), handle_tcp_back(), handle_tunnel_message(), handle_udp_back(), handle_udp_remote(), handle_udp_service(), handle_union_p2p_elements(), handle_union_p2p_full_element(), handle_union_p2p_ibf(), handle_union_p2p_inquiry(), handle_union_p2p_strata_estimator(), handle_validation_challenge(), handle_verify(), handle_watch(), handle_zone_to_name_it(), hello_add_iter(), hello_iter(), host_processor(), http_recv_data_cb(), impl_send_continue(), initialize_handle_via_key(), inject_message(), inject_rekey(), main(), make_peer(), message_token(), monitor_notify_all(), mq_send(), mq_send_d(), mq_send_impl(), notify_listeners(), on_appsink_new_sample(), pass_plaintext_to_core(), PEERSTORE_parse_record_message(), play(), process_client_result(), process_helper_messages(), process_helper_msgs(), process_notify(), process_record_messages(), publicize_rm(), queue_finish(), queue_send_msg(), recv_from_streams(), recv_message(), reliability_box_message(), route_message(), route_via_neighbour(), run(), save(), schedule_next_hello(), select_read_cb(), select_write_cb(), send_challenge(), send_channel_data_ack(), send_channel_open(), send_icmp_packet_via_tun(), send_keepalive(), send_msg_with_kx(), send_open_ack(), send_start_messages(), send_tcp_packet_via_tun(), send_udp_packet_via_tun(), service_client_mst_cb(), service_mq_send(), set_listen_cb(), setup_estimate_message(), setup_flood_message(), sign_ephemeral_key(), start_burst(), start_dv_learn(), stdin_receiver(), stream_start_response(), task_start_reconcile(), tokenized_cb(), transmit_cummulative_ack_cb(), transmit_ready(), transmit_typemap_task(), try_handle_plaintext(), try_transmission(), validation_transmit_on_queue(), write_message(), and write_page().
uint16_t GNUNET_MessageHeader::type |
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
Definition at line 330 of file gnunet_common.h.
Referenced by check_local_data(), check_reliability_box(), check_union_p2p_strata_estimator(), connection_client_send_impl(), consider_sending_fc(), consider_ss_ack(), create_rekey(), demultiplex_with_cmc(), do_send(), enc_notify_cb(), encapsulate_for_dv(), execute_add(), execute_mutation(), execute_remove(), finished_cb(), forward_dv_learn(), fragment_message(), GCCH_handle_local_data(), GCCH_is_type_to_drop(), GCT_send_channel_destroy(), GDS_helper_make_put_message(), GDS_NEIGHBOURS_handle_get(), GDS_NEIGHBOURS_handle_reply(), get_app(), GNUNET_HELLO_builder_to_dht_hello_msg(), GNUNET_HELLO_dht_msg_to_block(), GNUNET_HELLO_get_expiration_time_from_msg(), GNUNET_HELLO_parser_from_msg(), GNUNET_MQ_destroy(), GNUNET_MQ_msg_(), GNUNET_MQ_send(), GNUNET_MQ_send_cancel(), GNUNET_MST_from_buffer(), GNUNET_NAT_register(), GNUNET_TESTING_loop_notify_children_(), GSC_CLIENTS_deliver_message(), GSC_SESSIONS_set_typemap(), GSC_TYPEMAP_compute_type_map_message(), GSC_TYPEMAP_get_from_message(), handle_backchannel_encapsulation(), handle_client_send(), handle_communicator_backchannel(), handle_dht_local_monitor(), handle_dht_local_monitor_stop(), handle_get(), handle_get_key(), handle_get_zero_anonymity(), handle_icmp_back(), handle_icmp_remote(), handle_icmp_service(), handle_monitor_get(), handle_monitor_get_resp(), handle_monitor_put(), handle_raw_message(), handle_recv(), handle_reliability_box(), handle_tcp_back(), handle_udp_back(), handle_union_p2p_strata_estimator(), handle_validation_challenge(), impl_send_continue(), inject_rekey(), main(), message_token(), monitor_notify_all(), mq_send(), mq_send_impl(), notify_listeners(), play(), process_helper_msgs(), process_record_messages(), queue_finish(), recv_message(), reliability_box_message(), request_done(), route_control_message_without_fc(), route_message(), route_via_neighbour(), run(), save(), send_challenge(), send_channel_data_ack(), send_channel_open(), send_icmp_packet_via_tun(), send_keepalive(), send_open_ack(), send_start_messages(), send_tcp_packet_via_tun(), send_udp_packet_via_tun(), service_client_mst_cb(), service_mq_send(), set_listen_cb(), setup_estimate_message(), setup_flood_message(), sign_ephemeral_key(), start_dv_learn(), stdin_receiver(), task_start_reconcile(), tokenized_cb(), transmit_content(), transmit_cummulative_ack_cb(), transmit_ready(), try_handle_plaintext(), validation_transmit_on_queue(), and write_message().
uint32_t GNUNET_AsyncScopeId::bits[16/sizeof(uint32_t)] |
Definition at line 339 of file gnunet_common.h.
struct GNUNET_AsyncScopeId GNUNET_AsyncScopeSave::scope_id |
Saved scope.
Unused if 'have_scope==GNUNET_NO'.
Definition at line 353 of file gnunet_common.h.
Referenced by GNUNET_async_scope_enter(), GNUNET_SCHEDULER_do_work(), output_message(), and setup_job_headers().
int GNUNET_AsyncScopeSave::have_scope |
GNUNET_YES unless this saved scope is the unnamed root scope.
Definition at line 358 of file gnunet_common.h.
Referenced by GNUNET_async_scope_enter(), GNUNET_SCHEDULER_do_work(), output_message(), and setup_job_headers().
GNUNET_MQ_MessageValidationCallback GNUNET_MQ_MessageHandler::mv |
Callback to validate a message of the specified type.
The closure given to mv will be this struct (not ctx). Using NULL means only size-validation using expected_size. In this case, expected_size must be non-zero.
Definition at line 499 of file gnunet_mq_lib.h.
Referenced by GNUNET_MQ_copy_handlers2().
GNUNET_MQ_MessageCallback GNUNET_MQ_MessageHandler::cb |
Callback, called every time a new message of the specified type has been received.
The closure given to mv will be this struct (not ctx).
Definition at line 506 of file gnunet_mq_lib.h.
Referenced by GNUNET_MQ_copy_handlers2(), and GNUNET_MQ_set_handlers_closure().
void* GNUNET_MQ_MessageHandler::cls |
Closure for mv and cb.
Definition at line 511 of file gnunet_mq_lib.h.
Referenced by connect_task(), core_connects(), core_disconnects(), core_init(), do_shutdown(), GNUNET_MQ_copy_handlers2(), GNUNET_MQ_set_handlers_closure(), nse_callback(), reconnect_task(), and run().
uint16_t GNUNET_MQ_MessageHandler::type |
Type of the message this handler covers, in host byte order.
Definition at line 516 of file gnunet_mq_lib.h.
Referenced by GNUNET_MQ_copy_handlers2().
uint16_t GNUNET_MQ_MessageHandler::expected_size |
Expected size of messages of this type.
Minimum size of the message if mv is non-NULL. Messages of the given type will be discarded (and the connection closed with an error reported to the application) if they do not have the right size.
Definition at line 524 of file gnunet_mq_lib.h.
Referenced by GNUNET_MQ_copy_handlers2().