commit 259a1691a0e11c77d81be3c8ea183f663082fec5 parent ca3243667cc999e0a221b9b696fc5127ccb6cb77 Author: t3sserakt <t3ss@posteo.de> Date: Wed, 10 Dec 2025 19:49:17 +0100 Update GNUnet dependencies to v0.26.1 Diffstat:
56 files changed, 2988 insertions(+), 1426 deletions(-)
diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/block_dns.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/block_dns.h @@ -52,7 +52,7 @@ struct GNUNET_DNS_Advertisement * Beginning of signed portion of the record, signs everything until * the end of the struct. */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_SignaturePurpose purpose; /** * When does this signature expire? diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/block_fs.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/block_fs.h @@ -60,7 +60,7 @@ struct UBlock /** * What is being signed and why? */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_SignaturePurpose purpose; /** * Public key used to sign this block. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/block_regex.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/block_regex.h @@ -53,7 +53,7 @@ struct RegexAcceptBlock * Accept blocks must be signed. Signature * goes over expiration time and key. */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_SignaturePurpose purpose; /** * When does the signature expire? diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnu_name_system_record_types.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnu_name_system_record_types.h @@ -188,6 +188,18 @@ extern "C" { /** + * GNS zone delegation (FAESTKEY) + */ +#define GNUNET_GNSRECORD_TYPE_FAESTKEY 65562 + + +/** + * Record type to store epoch keys from a messenger room + */ +#define GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_EPOCH_KEY 65563 + + +/** * Private metadata for a delegation registration */ #define GNUNET_GNSRECORD_TYPE_GNS_REGISTRAR_METADATA 4294901760 diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_abd_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_abd_service.h @@ -107,7 +107,7 @@ struct GNUNET_ABD_DelegationRecordSet /** * Public key of the subject this attribute was delegated to */ - struct GNUNET_CRYPTO_PublicKey subject_key; + struct GNUNET_CRYPTO_BlindablePublicKey subject_key; /** * Length of attribute, may be 0 @@ -127,7 +127,7 @@ struct GNUNET_ABD_DelegationSet /** * Public key of the subject this attribute was delegated to */ - struct GNUNET_CRYPTO_PublicKey subject_key; + struct GNUNET_CRYPTO_BlindablePublicKey subject_key; uint32_t subject_attribute_len; @@ -147,12 +147,12 @@ struct GNUNET_ABD_Delegation /** * The issuer of the delegation */ - struct GNUNET_CRYPTO_PublicKey issuer_key; + struct GNUNET_CRYPTO_BlindablePublicKey issuer_key; /** * Public key of the subject this attribute was delegated to */ - struct GNUNET_CRYPTO_PublicKey subject_key; + struct GNUNET_CRYPTO_BlindablePublicKey subject_key; /** * Length of the attribute @@ -185,17 +185,17 @@ struct GNUNET_ABD_Delegate /** * The issuer of the credential */ - struct GNUNET_CRYPTO_PublicKey issuer_key; + struct GNUNET_CRYPTO_BlindablePublicKey issuer_key; /** * Public key of the subject this credential was issued to */ - struct GNUNET_CRYPTO_PublicKey subject_key; + struct GNUNET_CRYPTO_BlindablePublicKey subject_key; /** * Signature of this credential */ - struct GNUNET_CRYPTO_Signature signature; + struct GNUNET_CRYPTO_BlindableKeySignature signature; /** * Expiration of this credential @@ -322,9 +322,9 @@ typedef void (*GNUNET_ABD_RemoveDelegateResultProcessor) (void *cls, */ struct GNUNET_ABD_Request* GNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle, - const struct GNUNET_CRYPTO_PublicKey *issuer_key, + const struct GNUNET_CRYPTO_BlindablePublicKey *issuer_key, const char *issuer_attribute, - const struct GNUNET_CRYPTO_PublicKey *subject_key, + const struct GNUNET_CRYPTO_BlindablePublicKey *subject_key, uint32_t delegate_count, const struct GNUNET_ABD_Delegate *delegates, enum GNUNET_ABD_AlgoDirectionFlags direction, @@ -335,9 +335,10 @@ struct GNUNET_ABD_Request* struct GNUNET_ABD_Request* GNUNET_ABD_collect (struct GNUNET_ABD_Handle *handle, - const struct GNUNET_CRYPTO_PublicKey *issuer_key, + const struct GNUNET_CRYPTO_BlindablePublicKey *issuer_key, const char *issuer_attribute, - const struct GNUNET_CRYPTO_PrivateKey *subject_key, + const struct GNUNET_CRYPTO_BlindablePrivateKey * + subject_key, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, @@ -360,7 +361,7 @@ struct GNUNET_ABD_Request * GNUNET_ABD_add_delegation (struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, - struct GNUNET_CRYPTO_PublicKey *subject, + struct GNUNET_CRYPTO_BlindablePublicKey *subject, const char *delegated_attribute, GNUNET_ABD_DelegateResultProcessor proc, void *proc_cls); @@ -393,8 +394,9 @@ GNUNET_ABD_remove_delegation (struct GNUNET_ABD_Handle *handle, * @return handle to the queued request */ struct GNUNET_ABD_Delegate* -GNUNET_ABD_delegate_issue (const struct GNUNET_CRYPTO_PrivateKey *issuer, - struct GNUNET_CRYPTO_PublicKey *subject, +GNUNET_ABD_delegate_issue (const struct GNUNET_CRYPTO_BlindablePrivateKey * + issuer, + struct GNUNET_CRYPTO_BlindablePublicKey *subject, const char *iss_attr, const char *sub_attr, struct GNUNET_TIME_Absolute *expiration); diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_buffer_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_buffer_lib.h @@ -28,7 +28,7 @@ * @author Florian Dold */ -#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) +#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__) #error "Only <gnunet_util_lib.h> can be included directly." #endif @@ -78,7 +78,18 @@ struct GNUNET_Buffer * @param capacity the capacity (in bytes) to allocate for @a buf */ void -GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity); +GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, + size_t capacity); + + +/** + * Informs the buffer library to expect this buffer to be potentially + * very large (exceeding #GNUNET_malloc() limits). + * + * @param[in,out] buf buffer to set as large buffer + */ +void +GNUNET_buffer_large (struct GNUNET_Buffer *buf); /** @@ -88,7 +99,8 @@ GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity); * @param n number of bytes that should be available to write */ void -GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n); +GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, + size_t n); /** @@ -102,7 +114,9 @@ GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n); * */ void -GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len); +GNUNET_buffer_write (struct GNUNET_Buffer *buf, + const char *data, + size_t len); /** @@ -114,7 +128,8 @@ GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len); * @param str the string to write to @a buf */ void -GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str); +GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, + const char *str); /** @@ -141,7 +156,8 @@ GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf, * @param str string containing the new path component */ void -GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str); +GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, + const char *str); /** @@ -155,7 +171,9 @@ GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str); * @param ... format arguments */ void -GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...) +GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, + const char *fmt, + ...) __attribute__ ((format (printf, 2, 3))); @@ -170,8 +188,9 @@ __attribute__ ((format (printf, 2, 3))); * @param args format argument list */ void -GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, const char *fmt, va_list - args); +GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, + const char *fmt, + va_list args); /** @@ -198,13 +217,16 @@ GNUNET_buffer_reap_str (struct GNUNET_Buffer *buf); * @returns the data contained in the string */ void * -GNUNET_buffer_reap (struct GNUNET_Buffer *buf, size_t *size); +GNUNET_buffer_reap (struct GNUNET_Buffer *buf, + size_t *size); /** * Free the backing memory of the given buffer. * Does not free the memory of the buffer control structure, * which is typically stack-allocated. + * + * @param[in] buf buffer to clear */ void GNUNET_buffer_clear (struct GNUNET_Buffer *buf); diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_common.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_common.h @@ -55,11 +55,13 @@ #if defined(__FreeBSD__) #include <sys/endian.h> +#define bswap_16(x) bswap16 (x) #define bswap_32(x) bswap32 (x) #define bswap_64(x) bswap64 (x) #elif defined(__OpenBSD__) +#define bswap_16(x) swap16 (x) #define bswap_32(x) swap32 (x) #define bswap_64(x) swap64 (x) @@ -67,6 +69,7 @@ #include <machine/bswap.h> #if defined(__BSWAP_RENAME) && ! defined(__bswap_32) +#define bswap_16(x) bswap16 (x) #define bswap_32(x) bswap32 (x) #define bswap_64(x) bswap64 (x) #endif diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_conversation_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_conversation_service.h @@ -151,7 +151,8 @@ typedef void struct GNUNET_CONVERSATION_Caller * caller, const struct - GNUNET_CRYPTO_PublicKey *caller_id); + GNUNET_CRYPTO_BlindablePublicKey * + caller_id); /** diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_core_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_core_service.h @@ -47,6 +47,175 @@ extern "C" { #include "gnunet_util_lib.h" /** + * Size of the services info field in the cake handshake + * TODO + */ +#define GNUNET_CORE_SVC_INFO_LEN 64 + +/** + * The peer class gives a hint about the capabilities of a peer. The general + * idea is to signal capabilities like connectivity/bandwidth, computational + * and storage capabilities and stability in the network. + * + * TODO + * - this might move out of core to a more generic place + * - for now it is static, but it could in the future also include more + * detailed and dynamic attributes like 'battery-bound', 'behind more + * expensive mobile-bandwidth-connection', ... + * - it is only a general idea and it needs to be seen in the future how this + * will be used. With it's usage it will probably evolve into whatever seems + * to be useful + */ +enum GNUNET_CORE_PeerClass +{ + /** + * The device's capabilities are currently unknown. + */ + GNUNET_CORE_CLASS_UNKNOWN, + + /** + * This device is currently unwilling to spend more then the absolutely + * necessary resources. + */ + GNUNET_CORE_CLASS_UNWILLING, + + /** + * This is a mobile device. A smartphone or laptop. Could be battery bound, + * could be behind a costly mobile broadband connection. + */ + GNUNET_CORE_CLASS_MOBILE, + + /** + * This is a desktop computer. Probably on continuous power supply and a + * decent, rather stable internet connection. Probably not online 24/7. + * Probably behind NAT. + */ + GNUNET_CORE_CLASS_DESKTOP, + + /** + * This is a piece of network infrastructure. General computational and + * storage capabilities not overly high. Good placement in a network. + * Probably online 24/7 + */ + GNUNET_CORE_CLASS_ROUTER, + + /** + * This is something like a server. Has good computational and storage + * capabilities. Has a stable connection with decent bandwidth. Is online + * 24/7. Might not be behind NAT. + */ + GNUNET_CORE_CLASS_SERVER +}; + + +/** + * Identifiers for services that communicate over CORE. + */ +enum GNUNET_CORE_Service +{ + /** + * Identifier for cadet service + */ + GNUNET_CORE_SERVICE_CADET, + + /** + * Identifier for fs (file sharing) service + */ + GNUNET_CORE_SERVICE_FS, + + /** + * Identifier for dht (distributed hash table) service + */ + GNUNET_CORE_SERVICE_DHT, + + /** + * Identifier for nse (network size estimation) service + */ + GNUNET_CORE_SERVICE_NSE, + + /** + * Identifier for revocation service + */ + GNUNET_CORE_SERVICE_REVOCATION, + + /** + * Identifier for hostlist service + */ + GNUNET_CORE_SERVICE_HOSTLIST, + + /** + * Identifier for topology service + */ + GNUNET_CORE_SERVICE_TOPOLOGY, + + /** + * Identifier for rps (random peer sampling) service + */ + GNUNET_CORE_SERVICE_RPS, + + // Note: Services using core need to define their own Identifier here + + /** + * Identifier for testing the api + */ + GNUNET_CORE_SERVICE_TEST +}; + +/** + * A gnunet service version for services above CORE + * TODO we might want to be compatible with https://semver.org + */ +struct GNUNET_CORE_ServiceVersion +{ + /** + * Major version number + */ + uint32_t major; + + /** + * Minor version number + */ + uint32_t minor; + + /** + * Patch level + * Will probably not be needed + */ + // uint32_t patch; +}; + + +/** + * Gnunet service info - identifying compatibility with a range of version of a + * service communicating over CORE. + * + * Note: This will replace some parts of src/include/gnunet_protocols.h + */ +struct GNUNET_CORE_ServiceInfo +{ + /** + * Identifier of the service on top of CORE + */ + enum GNUNET_CORE_Service service; + + /** + * Version of this service implementation + */ + struct GNUNET_CORE_ServiceVersion version; + + /** + * Maximal compatible version number of @a service + */ + struct GNUNET_CORE_ServiceVersion version_max; + + /** + * Minimal compatible version number of @a service + */ + struct GNUNET_CORE_ServiceVersion version_min; +}; + + +/** * Version number of GNUnet-core API. */ #define GNUNET_CORE_VERSION 0x00000001 @@ -57,6 +226,7 @@ extern "C" { GNUNET_NETWORK_STRUCT_BEGIN + /** * Message transmitted with the signed ephemeral key of a peer. The * session key is then derived from the two ephemeral keys (ECDHE). @@ -82,7 +252,7 @@ struct EphemeralKeyMessage /** * Information about what is being signed. */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_SignaturePurpose purpose; /** * At what time was this key created (beginning of validity). @@ -110,7 +280,7 @@ struct EphemeralKeyMessage /** * We're sending an (encrypted) PING to the other peer to check if it * can decrypt. The other peer should respond with a PONG with the - * same content, except this time encrypted with the receiver's key. + * same content, except this time encrypted with the responder's key. */ struct PingMessage { @@ -186,6 +356,12 @@ struct PongMessage * that decryption actually worked. */ struct GNUNET_PeerIdentity target; + + /** + * The peer class of the sending peer + * TODO is it correct to send an enum like this? + */ + enum GNUNET_CORE_PeerClass peer_class; }; #else @@ -193,7 +369,7 @@ struct PongMessage /** * We're sending an (encrypted) PING to the other peer to check if it * can decrypt. The other peer should respond with a PONG with the - * same content, except this time encrypted with the receiver's key. + * same content, except this time encrypted with the responder's key. */ struct PingMessage { @@ -250,12 +426,16 @@ struct PongMessage * that decryption actually worked. */ struct GNUNET_PeerIdentity target; + + /** + * The peer class of the sending peer + * TODO is it correct to send an enum like this? + */ + enum GNUNET_CORE_PeerClass peer_class; }; #endif - - GNUNET_NETWORK_STRUCT_END /** @@ -267,15 +447,19 @@ struct GNUNET_CORE_Handle; /** * Method called whenever a given peer connects. * + * TODO provide with the service info about connecting peer/service + * * @param cls closure * @param peer peer identity this notification is about + * @param class the class of the connecting peer * @return closure associated with @a peer. given to mq callbacks and * #GNUNET_CORE_DisconnectEventHandler */ typedef void *(*GNUNET_CORE_ConnectEventHandler) ( void *cls, const struct GNUNET_PeerIdentity *peer, - struct GNUNET_MQ_Handle *mq); + struct GNUNET_MQ_Handle *mq, + enum GNUNET_CORE_PeerClass class); /** @@ -295,12 +479,13 @@ typedef void (*GNUNET_CORE_DisconnectEventHandler) ( /** * Function called after #GNUNET_CORE_connect has succeeded (or failed * for good). Note that the private key of the peer is intentionally - * not exposed here; if you need it, your process should try to read - * the private key file directly (which should work if you are - * authorized...). Implementations of this function must not call + * not exposed here; if you need to sign something, do this via the + * pils service. Implementations of this function must not call * #GNUNET_CORE_disconnect (other than by scheduling a new task to * do this later). * + * TODO we could potentially also remove the identity argument + * * @param cls closure * @param my_identity ID of this peer, NULL if we failed */ @@ -330,6 +515,8 @@ typedef void (*GNUNET_CORE_StartupCallback) ( * note that the core is allowed to drop notifications about inbound * messages if the client does not process them fast enough (for this * notification type, a bounded queue is used) + * @param service_info information about the connecting service and its + * compatibility with other service versions * @return handle to the core service (only useful for disconnect until @a init is called), * NULL on error (in this case, init is never called) */ @@ -339,7 +526,8 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, - const struct GNUNET_MQ_MessageHandler *handlers); + const struct GNUNET_MQ_MessageHandler *handlers, + const struct GNUNET_CORE_ServiceInfo *service_info); /** @@ -353,6 +541,11 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle); /** * Obtain the message queue for a connected peer. + * Messages may only be queued with #GNUNET_MQ_send once the init callback has + * been called for the given handle. + * + * TODO does this function in this form make sense? it's not used anywhere. + * Also it probably should take a hello as argument. * * @param h the core handle * @param pid the identity of the peer @@ -370,6 +563,8 @@ struct GNUNET_CORE_MonitorHandle; /** + * TODO how does this harmonize with CAKE_CRYPTO_ENABLED? + * * State machine for our P2P encryption handshake. Everyone starts in * #GNUNET_CORE_KX_STATE_DOWN, if we receive the other peer's key * (other peer initiated) we start in state @@ -390,21 +585,44 @@ enum GNUNET_CORE_KxState GNUNET_CORE_KX_STATE_DOWN = 0, /** - * We've sent our session key. + * We sent the initiator hello. + */ + GNUNET_CORE_KX_STATE_INITIATOR_HELLO_SENT, + + /** + * We are awating the initiator hello. + */ + GNUNET_CORE_KX_STATE_AWAIT_INITIATION, + + /** + * We've received the initiator hello. + */ + GNUNET_CORE_KX_STATE_INITIATOR_HELLO_RECEIVED, + + /** + * We sent the responder hello. */ - GNUNET_CORE_KX_STATE_KEY_SENT, + GNUNET_CORE_KX_STATE_RESPONDER_HELLO_SENT, /** - * We've received the other peers session key. + * We've received the initiator hello. */ - GNUNET_CORE_KX_STATE_KEY_RECEIVED, + GNUNET_CORE_KX_STATE_RESPONDER_HELLO_RECEIVED, /** - * The other peer has confirmed our session key + PING with a PONG - * message encrypted with their session key (which we got). Key - * exchange is done. + * We sent initiator done. */ - GNUNET_CORE_KX_STATE_UP, + GNUNET_CORE_KX_STATE_INITIATOR_DONE_SENT, + + /** + * Connected as initiator. + */ + GNUNET_CORE_KX_STATE_INITIATOR_CONNECTED, + + /** + * Connected as responder. + */ + GNUNET_CORE_KX_STATE_RESPONDER_CONNECTED, /** * We're rekeying (or had a timeout), so we have sent the other peer @@ -495,6 +713,8 @@ GNUNET_CORE_monitor_stop (struct GNUNET_CORE_MonitorHandle *mh); * 'versioned', 'official' API. This function returns * synchronously after looking in the CORE API cache. * + * FIXME not implemented + * * @param h the core handle * @param pid the identity of the peer to check if it has been connected to us * @return #GNUNET_YES if the peer is connected to us; #GNUNET_NO if not @@ -504,24 +724,6 @@ GNUNET_CORE_is_peer_connected_sync (const struct GNUNET_CORE_Handle *h, const struct GNUNET_PeerIdentity *pid); -/** - * Create a message queue for sending messages to a peer with CORE. - * Messages may only be queued with #GNUNET_MQ_send once the init callback has - * been called for the given handle. - * There must only be one queue per peer for each core handle. - * The message queue can only be used to transmit messages, - * not to receive them. - * - * @param h the core handle - * @param target the target peer for this queue, may not be NULL - * @return a message queue for sending messages over the core handle - * to the target peer - */ -struct GNUNET_MQ_Handle * -GNUNET_CORE_mq_create (struct GNUNET_CORE_Handle *h, - const struct GNUNET_PeerIdentity *target); - - #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_crypto_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_crypto_lib.h @@ -59,6 +59,7 @@ extern "C" { #endif +#include "gnunet_common.h" #include <stdbool.h> #include <sodium.h> @@ -137,7 +138,7 @@ GNUNET_NETWORK_STRUCT_BEGIN * this must be followed by "size - 8" bytes of * the actual signed data */ -struct GNUNET_CRYPTO_EccSignaturePurpose +struct GNUNET_CRYPTO_SignaturePurpose { /** * How many bytes does this signature sign? @@ -230,7 +231,6 @@ struct GNUNET_PeerIdentity struct GNUNET_CRYPTO_EddsaPublicKey public_key; }; - /** * Public ECC key (always for Curve25519) encoded in a format suitable * for network transmission and encryption (ECDH), @@ -396,7 +396,7 @@ enum GNUNET_CRYPTO_KeyType * Note that these types are NOT packed and MUST NOT be used in RPC * messages. Use the respective serialization functions. */ -struct GNUNET_CRYPTO_PrivateKey +struct GNUNET_CRYPTO_BlindablePrivateKey { /** * Type of public key. @@ -423,7 +423,7 @@ struct GNUNET_CRYPTO_PrivateKey /** * An identity key as per LSD0001. */ -struct GNUNET_CRYPTO_PublicKey +struct GNUNET_CRYPTO_BlindablePublicKey { /** * Type of public key. @@ -446,11 +446,55 @@ struct GNUNET_CRYPTO_PublicKey }; }; +/** + * A public key used for decryption. + * Right now, only X25519/ECDHE keys supported. + */ +struct GNUNET_CRYPTO_HpkePrivateKey +{ + /** + * Type of key. + * In NBO. + */ + uint32_t type; + + union + { + /** + * An ECDHE/X25519 key + */ + struct GNUNET_CRYPTO_EcdhePrivateKey ecdhe_key; + + }; +}; + + +/** + * A public key used for encryption. + * Right now, only X25519/ECDHE keys supported. + */ +struct GNUNET_CRYPTO_HpkePublicKey +{ + /** + * Type of key. + * In NBO. + */ + uint32_t type; + + union + { + /** + * An ECDHE/X25519 key + */ + struct GNUNET_CRYPTO_EcdhePublicKey ecdhe_key; + + }; +}; /** * An identity signature as per LSD0001. */ -struct GNUNET_CRYPTO_Signature +struct GNUNET_CRYPTO_BlindableKeySignature { /** * Type of signature. @@ -986,7 +1030,7 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc, * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding */ #define GNUNET_CRYPTO_hash_from_string(enc, result) \ - GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result) + GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result) /** @@ -1361,6 +1405,7 @@ GNUNET_CRYPTO_hkdf_extract (struct GNUNET_ShortHashCode *prk, * @brief HKDF-Expand using SHA256. RFC 5869 * @param result buffer for the derived key, allocated by caller * @param out_len desired length of the derived key + * @param prk pesudorandom key * @param ... pair of void * & size_t for context chunks, terminated by NULL * @return #GNUNET_YES on success */ @@ -1802,7 +1847,7 @@ GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); * @param pk location of the key */ void -GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_PrivateKey *pk); +GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_BlindablePrivateKey *pk); /** @@ -1853,11 +1898,15 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, * could not be retrieved */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_sign_by_peer_identity (const struct - GNUNET_CONFIGURATION_Handle *cfg, - const struct - GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct GNUNET_CRYPTO_EddsaSignature *sig); +GNUNET_CRYPTO_blinded_key_sign_by_peer_identity (const struct + GNUNET_CONFIGURATION_Handle * + cfg, + const struct + GNUNET_CRYPTO_SignaturePurpose + *purpose, + struct + GNUNET_CRYPTO_EddsaSignature * + sig); /** @@ -1873,7 +1922,7 @@ GNUNET_CRYPTO_sign_by_peer_identity (const struct enum GNUNET_GenericReturnValue GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose, const struct - GNUNET_CRYPTO_EccSignaturePurpose *validate, + GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_PeerIdentity *identity); @@ -2134,27 +2183,51 @@ enum GNUNET_CRYPTO_HpkeMode // Overhead required for ciphertext #define GNUNET_CRYPTO_HPKE_SEAL_ONESHOT_OVERHEAD_BYTES \ - GNUNET_CRYPTO_HPKE_SEAL_OVERHEAD_BYTES \ - + sizeof (struct GNUNET_CRYPTO_HpkeEncapsulation) + GNUNET_CRYPTO_HPKE_SEAL_OVERHEAD_BYTES \ + + sizeof (struct GNUNET_CRYPTO_HpkeEncapsulation) +/** + * Role of the HPKE participant. + */ enum GNUNET_CRYPTO_HpkeRole { + // Receiver GNUNET_CRYPTO_HPKE_ROLE_R = 0, + // Sender GNUNET_CRYPTO_HPKE_ROLE_S = 1 }; + +/** + * HPKE crypto context. + */ struct GNUNET_CRYPTO_HpkeContext { + // Participant role enum GNUNET_CRYPTO_HpkeRole role; + + // Encapsulated/Decapsulated key uint8_t key[GNUNET_CRYPTO_HPKE_KEY_LEN]; + + // Base nonce uint8_t base_nonce[GNUNET_CRYPTO_HPKE_NONCE_LEN]; + + // Sequence number uint64_t seq; + + // Exporter secret struct GNUNET_ShortHashCode exporter_secret; }; +/** + * HPKE KEM identifier + * TODO: Elligator KEM was requested at IANA; Number is currently a placeholder. + */ enum GNUNET_CRYPTO_HpkeKem { + // Non-elligator X25519 KEM using HKDF256 GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256 = 0x0020, + // Elligator X25519 KEM using HKDF256 GNUNET_CRYPTO_HPKE_KEM_DH_X25519ELLIGATOR_HKDF256 = 0x0030, }; @@ -2177,12 +2250,13 @@ struct GNUNET_CRYPTO_HpkeEncapsulation * Convert a GNUnet identity key to a key sutiable for HPKE (X25519) * * @param sk the private key - * @param x25519 the new key + * @param sk_enc the new key * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_sk_to_x25519 (const struct GNUNET_CRYPTO_PrivateKey *sk, - struct GNUNET_CRYPTO_EcdhePrivateKey *x25519); +GNUNET_CRYPTO_hpke_sk_to_x25519 (const struct + GNUNET_CRYPTO_BlindablePrivateKey *sk, + struct GNUNET_CRYPTO_HpkePrivateKey *sk_enc); /** @@ -2193,8 +2267,9 @@ GNUNET_CRYPTO_hpke_sk_to_x25519 (const struct GNUNET_CRYPTO_PrivateKey *sk, * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_pk_to_x25519 (const struct GNUNET_CRYPTO_PublicKey *pk, - struct GNUNET_CRYPTO_EcdhePublicKey *x25519); +GNUNET_CRYPTO_hpke_pk_to_x25519 (const struct GNUNET_CRYPTO_BlindablePublicKey * + pk, + struct GNUNET_CRYPTO_HpkePublicKey *pk_enc); /** * @ingroup crypto @@ -2210,7 +2285,7 @@ GNUNET_CRYPTO_hpke_pk_to_x25519 (const struct GNUNET_CRYPTO_PublicKey *pk, */ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_kem_decaps (const struct - GNUNET_CRYPTO_EcdhePrivateKey *priv, + GNUNET_CRYPTO_HpkePrivateKey *priv, const struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *prk); @@ -2227,7 +2302,7 @@ GNUNET_CRYPTO_hpke_kem_decaps (const struct * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_kem_encaps (const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, +GNUNET_CRYPTO_hpke_kem_encaps (const struct GNUNET_CRYPTO_HpkePublicKey *pkR, struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *prk); @@ -2245,78 +2320,14 @@ GNUNET_CRYPTO_hpke_kem_encaps (const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, */ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_kem_encaps_norand (const struct - GNUNET_CRYPTO_EcdhePublicKey *pkR, + GNUNET_CRYPTO_HpkePublicKey *pkR, struct GNUNET_CRYPTO_HpkeEncapsulation *c, const struct - GNUNET_CRYPTO_EcdhePrivateKey *skE, + GNUNET_CRYPTO_HpkePrivateKey *skE, struct GNUNET_ShortHashCode *prk); /** * @ingroup crypto - * Encapsulate authenticated key material for a X25519 public key. - * Deterministic variant of #GNUNET_CRYPTO_hpke_authkem_encaps. - * Dual to #GNUNET_CRYPTO_hpke_authkem_decaps. - * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific - * keys from the key material. - * - * @param pkR public key of receiver - * @param skS secret of the authenticating sender - * @param c public key from X25519 to use for the ECDH (X=h(x)G) - * @param shared_secret where to write the key material - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_authkem_encaps_norand ( - const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, - const struct GNUNET_CRYPTO_EcdhePrivateKey *skS, - struct GNUNET_CRYPTO_HpkeEncapsulation *c, - const struct GNUNET_CRYPTO_EcdhePrivateKey *skE, - struct GNUNET_ShortHashCode *shared_secret); - -/** - * @ingroup crypto - * Encapsulate authenticated key material for a X25519 public key. - * Dual to #GNUNET_CRYPTO_hpke_kem_encaps. - * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific - * keys from the key material. - * - * @param pkR public key of receiver - * @param skS secret of the authenticating sender - * @param c public key from X25519 to use for the ECDH (X=h(x)G) - * @param shared_secret where to write the key material - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_authkem_encaps ( - const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, - const struct GNUNET_CRYPTO_EcdhePrivateKey *skS, - struct GNUNET_CRYPTO_HpkeEncapsulation *c, - struct GNUNET_ShortHashCode *shared_secret); - - -/** - * @ingroup crypto - * Decapsulate a key for a private X25519 key. - * Dual to #GNUNET_CRYPTO_hpke_authkem_encaps. - * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific - * keys from the key material. - * - * @param skR secret key of receiver - * @param pkS public key of the authenticating sender - * @param c the encapsulated key - * @param shared_secret where to write the key material - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_authkem_decaps ( - const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, - const struct GNUNET_CRYPTO_EcdhePublicKey *pkS, - const struct GNUNET_CRYPTO_HpkeEncapsulation *c, - struct GNUNET_ShortHashCode *shared_secret); - - -/** - * @ingroup crypto * Carries out ecdh encapsulation with given public key and the private key from a freshly created ephemeral key pair. * Following the terminology in https://eprint.iacr.org/2021/509.pdf. * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific @@ -2332,7 +2343,7 @@ GNUNET_CRYPTO_hpke_authkem_decaps ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_elligator_kem_encaps_norand ( uint8_t random_tweak, - const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, + const struct GNUNET_CRYPTO_HpkePublicKey *pkR, struct GNUNET_CRYPTO_HpkeEncapsulation *c, const struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey *skE, struct GNUNET_ShortHashCode *shared_secret); @@ -2351,7 +2362,7 @@ GNUNET_CRYPTO_hpke_elligator_kem_encaps_norand ( */ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_elligator_kem_encaps ( - const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, + const struct GNUNET_CRYPTO_HpkePublicKey *pkR, struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *shared_secret); @@ -2369,73 +2380,7 @@ GNUNET_CRYPTO_hpke_elligator_kem_encaps ( */ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_elligator_kem_decaps ( - const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, - const struct GNUNET_CRYPTO_HpkeEncapsulation *c, - struct GNUNET_ShortHashCode *shared_secret); - -/** - * @ingroup crypto - * Encapsulate authenticated key material for a X25519 public key. - * Elligator variant. - * Deterministic variant of #GNUNET_CRYPTO_hpke_authkem_encaps. - * Dual to #GNUNET_CRYPTO_hpke_authkem_decaps. - * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific - * keys from the key material. - * - * @param pkR public key of receiver - * @param skS secret of the authenticating sender - * @param c public key from X25519 to use for the ECDH (X=h(x)G) - * @param shared_secret where to write the key material - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_elligator_authkem_encaps_norand ( - const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, - const struct GNUNET_CRYPTO_EcdhePrivateKey *skS, - struct GNUNET_CRYPTO_HpkeEncapsulation *c, - const struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey *skE, - struct GNUNET_ShortHashCode *shared_secret); - -/** - * @ingroup crypto - * Encapsulate authenticated key material for a X25519 public key. - * Elligator variant. - * Dual to #GNUNET_CRYPTO_hpke_kem_encaps. - * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific - * keys from the key material. - * - * @param pkR public key of receiver - * @param skS secret of the authenticating sender - * @param c public key from X25519 to use for the ECDH (X=h(x)G) - * @param shared_secret where to write the key material - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_elligator_authkem_encaps ( - const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, - const struct GNUNET_CRYPTO_EcdhePrivateKey *skS, - struct GNUNET_CRYPTO_HpkeEncapsulation *c, - struct GNUNET_ShortHashCode *shared_secret); - - -/** - * @ingroup crypto - * Decapsulate a key for a private X25519 key. - * Elligator variant. - * Dual to #GNUNET_CRYPTO_hpke_authkem_encaps. - * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific - * keys from the key material. - * - * @param skR private key from X25519 to use for the ECDH (x) - * @param pkS public key of the authenticating sender - * @param c the encapsulated key - * @param shared_secret where to write the key material - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_elligator_authkem_decaps ( - const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, - const struct GNUNET_CRYPTO_EcdhePublicKey *pkS, + const struct GNUNET_CRYPTO_HpkePrivateKey *skR, const struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *shared_secret); @@ -2464,8 +2409,8 @@ GNUNET_CRYPTO_eddsa_kem_decaps (const struct * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific * keys from the key material. * - * @param priv private key to use for the ECDH (y) - * @param c public key from EdDSA to use for the ECDH (X=h(x)G) + * @param pub public key from EdDSA to use for the ECDH (X=h(x)G) + * @param c encapsulation of prk * @param prk where to write the key material HKDF-Extract(c||aX)=HKDF-Extract(c||x(aG)) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ @@ -2492,7 +2437,7 @@ GNUNET_CRYPTO_eddsa_kem_encaps (const struct GNUNET_CRYPTO_EddsaPublicKey *pub, * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_sender_setup (const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, +GNUNET_CRYPTO_hpke_sender_setup (const struct GNUNET_CRYPTO_HpkePublicKey *pkR, const uint8_t *info, size_t info_len, struct GNUNET_CRYPTO_HpkeEncapsulation *enc, struct GNUNET_CRYPTO_HpkeContext *ctx); @@ -2524,9 +2469,9 @@ 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, + struct GNUNET_CRYPTO_HpkePrivateKey *skE, + struct GNUNET_CRYPTO_HpkePrivateKey *skS, + const struct GNUNET_CRYPTO_HpkePublicKey *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, @@ -2561,8 +2506,8 @@ 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 struct GNUNET_CRYPTO_HpkePrivateKey *skR, + const struct GNUNET_CRYPTO_HpkePublicKey *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, @@ -2588,7 +2533,7 @@ GNUNET_CRYPTO_hpke_receiver_setup2 ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_receiver_setup ( const struct GNUNET_CRYPTO_HpkeEncapsulation *enc, - const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, + const struct GNUNET_CRYPTO_HpkePrivateKey *skR, const uint8_t *info, size_t info_len, struct GNUNET_CRYPTO_HpkeContext *ctx); @@ -2640,7 +2585,7 @@ GNUNET_CRYPTO_hpke_seal (struct GNUNET_CRYPTO_HpkeContext *ctx, * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_hpke_seal_oneshot (const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, +GNUNET_CRYPTO_hpke_seal_oneshot (const struct GNUNET_CRYPTO_HpkePublicKey *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, @@ -2692,7 +2637,7 @@ GNUNET_CRYPTO_hpke_open (struct GNUNET_CRYPTO_HpkeContext *ctx, */ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_open_oneshot ( - const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, + const struct GNUNET_CRYPTO_HpkePrivateKey *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, @@ -2791,7 +2736,7 @@ GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_ ( const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig); @@ -2808,15 +2753,15 @@ GNUNET_CRYPTO_eddsa_sign_ ( * @param[out] sig where to write the signature */ #define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \ - /* check size is set correctly */ \ - GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \ - /* check 'ps' begins with the purpose */ \ - GNUNET_static_assert (((void*) (ps)) == \ - ((void*) &(ps)->purpose)); \ - GNUNET_assert (GNUNET_OK == \ - GNUNET_CRYPTO_eddsa_sign_ (priv, \ - &(ps)->purpose, \ - sig)); \ + /* check size is set correctly */ \ + GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \ + /* check 'ps' begins with the purpose */ \ + GNUNET_static_assert (((void*) (ps)) == \ + ((void*) &(ps)->purpose)); \ + GNUNET_assert (GNUNET_OK == \ + GNUNET_CRYPTO_eddsa_sign_ (priv, \ + &(ps)->purpose, \ + sig)); \ } while (0) @@ -2838,7 +2783,7 @@ GNUNET_CRYPTO_eddsa_sign_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_ ( const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig); /** @@ -2870,15 +2815,15 @@ GNUNET_CRYPTO_eddsa_sign_raw ( * @param[out] sig where to write the signature */ #define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \ - /* check size is set correctly */ \ - GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ - /* check 'ps' begins with the purpose */ \ - GNUNET_static_assert (((void*) (ps)) == \ - ((void*) &(ps)->purpose)); \ - GNUNET_assert (GNUNET_OK == \ - GNUNET_CRYPTO_ecdsa_sign_ (priv, \ - &(ps)->purpose, \ - sig)); \ + /* check size is set correctly */ \ + GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ + /* check 'ps' begins with the purpose */ \ + GNUNET_static_assert (((void*) (ps)) == \ + ((void*) &(ps)->purpose)); \ + GNUNET_assert (GNUNET_OK == \ + GNUNET_CRYPTO_ecdsa_sign_ (priv, \ + &(ps)->purpose, \ + sig)); \ } while (0) /** @@ -2899,7 +2844,7 @@ GNUNET_CRYPTO_eddsa_sign_raw ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_sign_ ( const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_Edx25519Signature *sig); @@ -2917,15 +2862,15 @@ GNUNET_CRYPTO_edx25519_sign_ ( * @param[out] sig where to write the signature */ #define GNUNET_CRYPTO_edx25519_sign(priv,ps,sig) do { \ - /* check size is set correctly */ \ - GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ - /* check 'ps' begins with the purpose */ \ - GNUNET_static_assert (((void*) (ps)) == \ - ((void*) &(ps)->purpose)); \ - GNUNET_assert (GNUNET_OK == \ - GNUNET_CRYPTO_edx25519_sign_ (priv, \ - &(ps)->purpose, \ - sig)); \ + /* check size is set correctly */ \ + GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ + /* check 'ps' begins with the purpose */ \ + GNUNET_static_assert (((void*) (ps)) == \ + ((void*) &(ps)->purpose)); \ + GNUNET_assert (GNUNET_OK == \ + GNUNET_CRYPTO_edx25519_sign_ (priv, \ + &(ps)->purpose, \ + sig)); \ } while (0) @@ -2950,7 +2895,7 @@ GNUNET_CRYPTO_edx25519_sign_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_CRYPTO_EddsaPublicKey *pub); @@ -2965,9 +2910,9 @@ GNUNET_CRYPTO_eddsa_verify_ ( * * @param purp purpose of the signature, must match 'ps->purpose.purpose' * (except in host byte order) - * @param priv private key to use for the signing * @param ps packed struct with what to sign, MUST begin with a purpose * @param sig where to write the signature + * @param pub public key key to use for the verification */ #define GNUNET_CRYPTO_eddsa_verify(purp,ps,sig,pub) ({ \ /* check size is set correctly */ \ @@ -3002,7 +2947,7 @@ GNUNET_CRYPTO_eddsa_verify_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_EcdsaSignature *sig, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub); @@ -3054,7 +2999,7 @@ GNUNET_CRYPTO_ecdsa_verify_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_Edx25519Signature *sig, const struct GNUNET_CRYPTO_Edx25519PublicKey *pub); @@ -3140,7 +3085,7 @@ GNUNET_CRYPTO_ecdsa_sign_derived ( const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, const char *context, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig); @@ -3205,7 +3150,7 @@ GNUNET_CRYPTO_eddsa_sign_derived ( const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey, const char *label, const char *context, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig); @@ -4595,10 +4540,10 @@ GNUNET_CRYPTO_blind_sig_verify ( /** - * Get the compacted length of a #GNUNET_CRYPTO_PublicKey. + * Get the compacted length of a #GNUNET_CRYPTO_BlindablePublicKey. * Compacted means that it returns the minimum number of bytes this * key is long, as opposed to the union structure inside - * #GNUNET_CRYPTO_PublicKey. + * #GNUNET_CRYPTO_BlindablePublicKey. * Useful for compact serializations. * * @param key the key. @@ -4606,12 +4551,12 @@ GNUNET_CRYPTO_blind_sig_verify ( */ ssize_t GNUNET_CRYPTO_public_key_get_length (const struct - GNUNET_CRYPTO_PublicKey *key); + GNUNET_CRYPTO_BlindablePublicKey *key); /** - * Reads a #GNUNET_CRYPTO_PublicKey from a compact buffer. + * Reads a #GNUNET_CRYPTO_BlindablePublicKey from a compact buffer. * The buffer has to contain at least the compacted length of - * a #GNUNET_CRYPTO_PublicKey in bytes. + * a #GNUNET_CRYPTO_BlindablePublicKey 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. * @@ -4625,28 +4570,28 @@ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_public_key_from_buffer ( const void *buffer, size_t len, - struct GNUNET_CRYPTO_PublicKey *key, + struct GNUNET_CRYPTO_BlindablePublicKey *key, size_t *read); /** - * Get the compacted length of a #GNUNET_CRYPTO_PrivateKey. + * Get the compacted length of a #GNUNET_CRYPTO_BlindablePrivateKey. * Compacted means that it returns the minimum number of bytes this * key is long, as opposed to the union structure inside - * #GNUNET_CRYPTO_PrivateKey. + * #GNUNET_CRYPTO_BlindablePrivateKey. * Useful for compact serializations. * * @param key the key. * @return -1 on error, else the compacted length of the key. */ ssize_t -GNUNET_CRYPTO_private_key_get_length ( - const struct GNUNET_CRYPTO_PrivateKey *key); +GNUNET_CRYPTO_blindable_sk_get_length ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *key); /** - * Writes a #GNUNET_CRYPTO_PublicKey to a compact buffer. + * Writes a #GNUNET_CRYPTO_BlindablePublicKey to a compact buffer. * The buffer requires space for at least the compacted length of - * a #GNUNET_CRYPTO_PublicKey in bytes. + * a #GNUNET_CRYPTO_BlindablePublicKey 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. * @@ -4656,16 +4601,17 @@ GNUNET_CRYPTO_private_key_get_length ( * @return -1 or -2 on error, else the amount of bytes written to the buffer */ ssize_t -GNUNET_CRYPTO_write_public_key_to_buffer (const struct - GNUNET_CRYPTO_PublicKey *key, - void*buffer, - size_t len); +GNUNET_CRYPTO_write_blindable_pk_to_buffer (const struct + GNUNET_CRYPTO_BlindablePublicKey * + key, + void*buffer, + size_t len); /** - * Reads a #GNUNET_CRYPTO_PrivateKey from a compact buffer. + * Reads a #GNUNET_CRYPTO_BlindablePrivateKey from a compact buffer. * The buffer has to contain at least the compacted length of - * a #GNUNET_CRYPTO_PrivateKey in bytes. + * a #GNUNET_CRYPTO_BlindablePrivateKey in bytes. * If the buffer is too small, the function returns GNUNET_SYSERR as error. * * @param buffer the buffer @@ -4678,14 +4624,14 @@ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_private_key_from_buffer ( const void*buffer, size_t len, - struct GNUNET_CRYPTO_PrivateKey *key, + struct GNUNET_CRYPTO_BlindablePrivateKey *key, size_t *read); /** - * Writes a #GNUNET_CRYPTO_PrivateKey to a compact buffer. + * Writes a #GNUNET_CRYPTO_BlindablePrivateKey to a compact buffer. * The buffer requires space for at least the compacted length of - * a #GNUNET_CRYPTO_PrivateKey in bytes. + * a #GNUNET_CRYPTO_BlindablePrivateKey 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. * @@ -4695,8 +4641,8 @@ GNUNET_CRYPTO_read_private_key_from_buffer ( * @return -1 or -2 on error, else the amount of bytes written to the buffer */ ssize_t -GNUNET_CRYPTO_write_private_key_to_buffer ( - const struct GNUNET_CRYPTO_PrivateKey *key, +GNUNET_CRYPTO_write_blindable_sk_to_buffer ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *key, void*buffer, size_t len); @@ -4712,8 +4658,8 @@ GNUNET_CRYPTO_write_private_key_to_buffer ( * @return -1 on error, else the compacted length of the signature. */ ssize_t -GNUNET_CRYPTO_signature_get_length ( - const struct GNUNET_CRYPTO_Signature *sig); +GNUNET_CRYPTO_blinded_key_signature_get_length ( + const struct GNUNET_CRYPTO_BlindableKeySignature *sig); /** @@ -4727,13 +4673,13 @@ GNUNET_CRYPTO_signature_get_length ( * @return -1 on error, else the compacted length of the signature. */ ssize_t -GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type); +GNUNET_CRYPTO_blinded_key_signature_get_length_by_type (uint32_t type); /** - * Reads a #GNUNET_CRYPTO_Signature from a compact buffer. + * Reads a #GNUNET_CRYPTO_BlindableKeySignature from a compact buffer. * The buffer has to contain at least the compacted length of - * a #GNUNET_CRYPTO_Signature in bytes. + * a #GNUNET_CRYPTO_BlindableKeySignature 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. * @@ -4743,16 +4689,16 @@ GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type); * @return -1 or -2 on error, else the amount of bytes read from the buffer */ ssize_t -GNUNET_CRYPTO_read_signature_from_buffer ( - struct GNUNET_CRYPTO_Signature *sig, +GNUNET_CRYPTO_read_blinded_key_signature_from_buffer ( + struct GNUNET_CRYPTO_BlindableKeySignature *sig, const void*buffer, size_t len); /** - * Writes a #GNUNET_CRYPTO_Signature to a compact buffer. + * Writes a #GNUNET_CRYPTO_BlindableKeySignature to a compact buffer. * The buffer requires space for at least the compacted length of - * a #GNUNET_CRYPTO_Signature in bytes. + * a #GNUNET_CRYPTO_BlindableKeySignature 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. * @@ -4762,8 +4708,8 @@ GNUNET_CRYPTO_read_signature_from_buffer ( * @return -1 or -2 on error, else the amount of bytes written to the buffer */ ssize_t -GNUNET_CRYPTO_write_signature_to_buffer ( - const struct GNUNET_CRYPTO_Signature *sig, +GNUNET_CRYPTO_write_blinded_key_signature_to_buffer ( + const struct GNUNET_CRYPTO_BlindableKeySignature *sig, void*buffer, size_t len); @@ -4774,7 +4720,7 @@ GNUNET_CRYPTO_write_signature_to_buffer ( * The @a purpose data is the beginning of the data of which the signature is * to be created. The `size` field in @a 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. + * use #GNUNET_CRYPTO_blinded_key_sign() instead of this function. * * @param priv private key to use for the signing * @param purpose what to sign (size, purpose) @@ -4782,10 +4728,10 @@ GNUNET_CRYPTO_write_signature_to_buffer ( * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_sign_ ( - const struct GNUNET_CRYPTO_PrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct GNUNET_CRYPTO_Signature *sig); +GNUNET_CRYPTO_blinded_key_sign_ ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *priv, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, + struct GNUNET_CRYPTO_BlindableKeySignature *sig); /** * @brief Sign a given block. @@ -4801,14 +4747,14 @@ GNUNET_CRYPTO_sign_ ( * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_sign_raw_ ( - const struct GNUNET_CRYPTO_PrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, +GNUNET_CRYPTO_blinded_key_sign_raw_ ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *priv, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, unsigned char *sig); /** - * @brief Sign a given block with #GNUNET_CRYPTO_PrivateKey. + * @brief Sign a given block with #GNUNET_CRYPTO_BlindablePrivateKey. * * The @a ps data must be a fixed-size struct for which the signature is to be * created. The `size` field in @a ps->purpose must correctly indicate the @@ -4818,16 +4764,16 @@ GNUNET_CRYPTO_sign_raw_ ( * @param ps packed struct with what to sign, MUST begin with a purpose * @param[out] sig where to write the signature */ -#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \ - /* check size is set correctly */ \ - GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ - /* check 'ps' begins with the purpose */ \ - GNUNET_static_assert (((void*) (ps)) == \ - ((void*) &(ps)->purpose)); \ - GNUNET_assert (GNUNET_OK == \ - GNUNET_CRYPTO_sign_ (priv, \ - &(ps)->purpose, \ - sig)); \ +#define GNUNET_CRYPTO_blinded_key_sign(priv,ps,sig) do { \ + /* check size is set correctly */ \ + GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ + /* check 'ps' begins with the purpose */ \ + GNUNET_static_assert (((void*) (ps)) == \ + ((void*) &(ps)->purpose)); \ + GNUNET_assert (GNUNET_OK == \ + GNUNET_CRYPTO_blinded_key_sign_ (priv, \ + &(ps)->purpose, \ + sig)); \ } while (0) @@ -4839,7 +4785,7 @@ GNUNET_CRYPTO_sign_raw_ ( * the number of bytes of the data structure, including its header. If @a * purpose does not match the purpose given in @a validate (the latter must be * in big endian), signature verification fails. If possible, - * use #GNUNET_CRYPTO_signature_verify() instead of this function (only if @a validate + * use #GNUNET_CRYPTO_blinded_key_signature_verify() instead of this function (only if @a validate * is not fixed-size, you must use this function directly). * * @param purpose what is the purpose that the signature should have? @@ -4849,11 +4795,11 @@ GNUNET_CRYPTO_sign_raw_ ( * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_signature_verify_ ( +GNUNET_CRYPTO_blinded_key_signature_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, - const struct GNUNET_CRYPTO_Signature *sig, - const struct GNUNET_CRYPTO_PublicKey *pub); + const struct GNUNET_CRYPTO_SignaturePurpose *validate, + const struct GNUNET_CRYPTO_BlindableKeySignature *sig, + const struct GNUNET_CRYPTO_BlindablePublicKey *pub); /** * @brief Verify a given signature. @@ -4871,15 +4817,15 @@ GNUNET_CRYPTO_signature_verify_ ( * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_signature_verify_raw_ ( +GNUNET_CRYPTO_blinded_key_signature_verify_raw_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const unsigned char *sig, - const struct GNUNET_CRYPTO_PublicKey *pub); + const struct GNUNET_CRYPTO_BlindablePublicKey *pub); /** - * @brief Verify a given signature with #GNUNET_CRYPTO_PublicKey. + * @brief Verify a given signature with #GNUNET_CRYPTO_BlindablePublicKey. * * The @a ps data must be a fixed-size struct for which the signature is to be * created. The `size` field in @a ps->purpose must correctly indicate the @@ -4891,16 +4837,16 @@ GNUNET_CRYPTO_signature_verify_raw_ ( * @param sig where to read the signature from * @param pub public key to use for the verifying */ -#define GNUNET_CRYPTO_signature_verify(purp,ps,sig,pub) ({ \ +#define GNUNET_CRYPTO_blinded_key_signature_verify(purp,ps,sig,pub) ({ \ /* check size is set correctly */ \ GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ /* check 'ps' begins with the purpose */ \ GNUNET_static_assert (((void*) (ps)) == \ ((void*) &(ps)->purpose)); \ - GNUNET_CRYPTO_signature_verify_ (purp, \ - &(ps)->purpose, \ - sig, \ - pub); \ + GNUNET_CRYPTO_blinded_key_signature_verify_ (purp, \ + &(ps)->purpose, \ + sig, \ + pub); \ }) @@ -4913,8 +4859,8 @@ GNUNET_CRYPTO_signature_verify_raw_ ( * @return the string representation of the key, or NULL on error. */ char * -GNUNET_CRYPTO_public_key_to_string ( - const struct GNUNET_CRYPTO_PublicKey *key); +GNUNET_CRYPTO_blindable_public_key_to_string ( + const struct GNUNET_CRYPTO_BlindablePublicKey *key); /** @@ -4926,34 +4872,38 @@ GNUNET_CRYPTO_public_key_to_string ( * @return the string representation of the key, or NULL on error. */ char * -GNUNET_CRYPTO_private_key_to_string ( - const struct GNUNET_CRYPTO_PrivateKey *key); +GNUNET_CRYPTO_blindable_private_key_to_string ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *key); /** * Parses a (Base32) string representation of the public key. - * See also #GNUNET_CRYPTO_public_key_to_string. + * See also #GNUNET_CRYPTO_blindable_public_key_to_string. * * @param str the encoded key. * @param key where to write the key. * @return GNUNET_SYSERR on error. */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_public_key_from_string (const char*str, - struct GNUNET_CRYPTO_PublicKey *key); +GNUNET_CRYPTO_blindable_public_key_from_string (const char*str, + struct + GNUNET_CRYPTO_BlindablePublicKey + *key); /** * Parses a (Base32) string representation of the private key. - * See also #GNUNET_CRYPTO_private_key_to_string. + * See also #GNUNET_CRYPTO_blindable_private_key_to_string. * * @param str the encoded key. * @param key where to write the key. * @return GNUNET_SYSERR on error. */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_private_key_from_string (const char*str, - struct GNUNET_CRYPTO_PrivateKey *key); +GNUNET_CRYPTO_blindable_private_key_from_string (const char*str, + struct + GNUNET_CRYPTO_BlindablePrivateKey + *key); /** @@ -4964,9 +4914,11 @@ GNUNET_CRYPTO_private_key_from_string (const char*str, * @return GNUNET_SYSERR on error. */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_key_get_public (const struct - GNUNET_CRYPTO_PrivateKey *privkey, - struct GNUNET_CRYPTO_PublicKey *key); +GNUNET_CRYPTO_blindable_key_get_public (const struct + GNUNET_CRYPTO_BlindablePrivateKey * + privkey, + struct GNUNET_CRYPTO_BlindablePublicKey + *key); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_dht_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_dht_service.h @@ -57,7 +57,7 @@ extern "C" * Default republication frequency for stored data in the DHT. */ #define GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MINUTES, 60) + GNUNET_TIME_UNIT_MINUTES, 60) /** @@ -133,7 +133,7 @@ struct GNUNET_DHT_HopSignature /** * Must be #GNUNET_SIGNATURE_PURPOSE_DHT_HOP. */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_SignaturePurpose purpose; /** * Expiration time of the block. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_disk_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_disk_lib.h @@ -361,13 +361,15 @@ GNUNET_DISK_file_get_identifiers (const char *filename, * 6 random characters will be appended to the name to create a unique * filename. * + * @param pd project data to use to determine paths * @param t component to use for the name; * does NOT contain "XXXXXX" or "/tmp/". * @return NULL on error, otherwise name of fresh * file on disk in directory for temporary files */ char * -GNUNET_DISK_mktemp (const char *t); +GNUNET_DISK_mktemp (const struct GNUNET_OS_ProjectData *pd, + const char *t); /** @@ -375,12 +377,14 @@ GNUNET_DISK_mktemp (const char *t); * absolute path, the current 'TMPDIR' will be prepended. In any case, 6 * random characters will be appended to the name to create a unique name. * + * @param pd project data to use to determine paths * @param t component to use for the name; * does NOT contain "XXXXXX" or "/tmp/". * @return NULL on error, otherwise name of freshly created directory */ char * -GNUNET_DISK_mkdtemp (const char *t); +GNUNET_DISK_mkdtemp (const struct GNUNET_OS_ProjectData *pd, + const char *t); /** diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_gns_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_gns_service.h @@ -137,7 +137,7 @@ enum GNUNET_GNS_LocalOptions struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, const char *name, - const struct GNUNET_CRYPTO_PublicKey *zone, + const struct GNUNET_CRYPTO_BlindablePublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, @@ -161,7 +161,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, const char *name, - const struct GNUNET_CRYPTO_PublicKey *zone, + const struct GNUNET_CRYPTO_BlindablePublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, uint16_t recursion_depth_limit, @@ -236,7 +236,7 @@ GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr); */ enum GNUNET_GenericReturnValue GNUNET_GNS_parse_ztld (const char *name, - struct GNUNET_CRYPTO_PublicKey *ztld_key); + struct GNUNET_CRYPTO_BlindablePublicKey *ztld_key); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_gnsrecord_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_gnsrecord_lib.h @@ -368,7 +368,7 @@ struct GNUNET_GNSRECORD_ReverseRecord /** * The public key of the namespace the is delegating to our namespace */ - struct GNUNET_CRYPTO_PublicKey pkey; + struct GNUNET_CRYPTO_BlindablePublicKey pkey; /** * The expiration time of the delegation @@ -523,7 +523,7 @@ GNUNET_GNSRECORD_string_normalize (const char *src); * #GNUNET_GNSRECORD_z2s. */ const char * -GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z); +GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_BlindablePublicKey *z); /** @@ -537,7 +537,8 @@ GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z); * key in an encoding suitable for DNS labels. */ const char * -GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey); +GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_BlindablePublicKey * + pkey); /** @@ -551,7 +552,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey); */ int GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, - struct GNUNET_CRYPTO_PublicKey *pkey); + struct GNUNET_CRYPTO_BlindablePublicKey *pkey); /** @@ -563,7 +564,7 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, */ void GNUNET_GNSRECORD_query_from_private_key ( - const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, struct GNUNET_HashCode *query); @@ -577,7 +578,7 @@ GNUNET_GNSRECORD_query_from_private_key ( */ void GNUNET_GNSRECORD_query_from_public_key ( - const struct GNUNET_CRYPTO_PublicKey *pub, const char *label, + const struct GNUNET_CRYPTO_BlindablePublicKey *pub, const char *label, struct GNUNET_HashCode *query); @@ -591,7 +592,7 @@ GNUNET_GNSRECORD_query_from_public_key ( */ ssize_t GNUNET_GNSRECORD_block_calculate_size (const struct - GNUNET_CRYPTO_PrivateKey *key, + GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count); @@ -605,7 +606,7 @@ GNUNET_GNSRECORD_block_calculate_size (const struct */ enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_sign (const struct - GNUNET_CRYPTO_PrivateKey *key, + GNUNET_CRYPTO_BlindablePrivateKey *key, const char *label, struct GNUNET_GNSRECORD_Block *block); @@ -621,7 +622,8 @@ GNUNET_GNSRECORD_block_sign (const struct * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key, +GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_BlindablePrivateKey * + key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, @@ -646,7 +648,7 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key, */ enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create_unsigned (const struct - GNUNET_CRYPTO_PrivateKey *key, + GNUNET_CRYPTO_BlindablePrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, @@ -668,7 +670,8 @@ GNUNET_GNSRECORD_block_create_unsigned (const struct * @return GNUNET_OK on success. */ enum GNUNET_GenericReturnValue -GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_PrivateKey *key, +GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_BlindablePrivateKey * + key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, @@ -701,7 +704,7 @@ GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_decrypt ( const struct GNUNET_GNSRECORD_Block *block, - const struct GNUNET_CRYPTO_PublicKey *zone_key, const char *label, + const struct GNUNET_CRYPTO_BlindablePublicKey *zone_key, const char *label, GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); @@ -781,7 +784,8 @@ enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_identity_from_data (const char *data, size_t data_size, uint32_t type, - struct GNUNET_CRYPTO_PublicKey *key); + struct GNUNET_CRYPTO_BlindablePublicKey * + key); /** @@ -795,7 +799,7 @@ GNUNET_GNSRECORD_identity_from_data (const char *data, */ enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_data_from_identity (const struct - GNUNET_CRYPTO_PublicKey *key, + GNUNET_CRYPTO_BlindablePublicKey *key, char **data, size_t *data_size, uint32_t *type); @@ -862,8 +866,8 @@ GNUNET_GNSRECORD_label_check (const char*label, char **emsg); * Maximum length of a revocation */ #define GNUNET_MAX_POW_SIZE sizeof(struct GNUNET_GNSRECORD_PowP) \ - + sizeof(struct GNUNET_CRYPTO_PublicKey) \ - + 1024 // FIXME max sig_len + + sizeof(struct GNUNET_CRYPTO_BlindablePublicKey) \ + + 1024 // FIXME max sig_len /** * The proof-of-work narrowing factor. @@ -906,7 +910,7 @@ struct GNUNET_GNSRECORD_SignaturePurposePS /** * The signature purpose */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_SignaturePurpose purpose; /** * The timestamp of the revocation @@ -946,7 +950,7 @@ GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, * @param pow the pow object to work with in the calculation. */ void -GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, +GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_BlindablePrivateKey *key, struct GNUNET_GNSRECORD_PowP *pow); diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_hello_uri_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_hello_uri_lib.h @@ -67,21 +67,22 @@ struct GNUNET_HELLO_Parser; /** * Allocate builder. * - * @param pid peer the builder is for * @return new builder */ struct GNUNET_HELLO_Builder * -GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity *pid); +GNUNET_HELLO_builder_new (); /** * Allocate builder from parser. * * @param parser the parser + * @param pid the peer identity from the parsed hello * @return new builder */ struct GNUNET_HELLO_Builder * -GNUNET_HELLO_builder_from_parser (const struct GNUNET_HELLO_Parser *parser); +GNUNET_HELLO_builder_from_parser (const struct GNUNET_HELLO_Parser *parser, + struct GNUNET_PeerIdentity *pid); /** * Get the PeerIdentity for this builder. @@ -122,12 +123,24 @@ GNUNET_HELLO_parser_from_msg (const struct GNUNET_MessageHeader *msg); * * @param block DHT block to parse * @param block_size number of bytes in @a block - * @return builder, NULL on failure + * @return parser, NULL on failure */ struct GNUNET_HELLO_Parser * GNUNET_HELLO_parser_from_block (const void *block, size_t block_size); +/** + * Parse @a block. Optionally Do not verify signature. + * + * @param block DHT block to parse + * @param block_size number of bytes in @a block + * @param noverify not verifying signature if #GNUNET_YES + * @return parser, NULL on failure + */ +struct GNUNET_HELLO_Parser * +GNUNET_HELLO_parser_from_block_ (const void *block, + size_t block_size, + int noverify); /** * Parse GNUnet HELLO @a url. @@ -152,20 +165,6 @@ GNUNET_HELLO_get_expiration_time_from_msg (const struct /** * Generate envelope with GNUnet HELLO message (including - * peer ID) from a @a builder - * - * @param builder builder to serialize - * @param priv private key to use to sign the result - * @return HELLO message matching @a builder - */ -struct GNUNET_MQ_Envelope * -GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - struct GNUNET_TIME_Relative expiration_time); - - -/** - * Generate envelope with GNUnet HELLO message (including * peer ID) from a @a parser * * @param builder builder to serialize @@ -174,18 +173,6 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, struct GNUNET_MQ_Envelope * GNUNET_HELLO_parser_to_env (const struct GNUNET_HELLO_Parser *parser); -/** - * Generate DHT HELLO message (without peer ID) from a @a builder - * - * @param builder builder to serialize - * @param priv private key to use to sign the result - * @return HELLO message matching @a builder - */ -struct GNUNET_MessageHeader * -GNUNET_HELLO_builder_to_dht_hello_msg ( - const struct GNUNET_HELLO_Builder *builder, - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - struct GNUNET_TIME_Relative expiration_time); /** * Generate GNUnet HELLO URI from a @a parser @@ -196,48 +183,6 @@ GNUNET_HELLO_builder_to_dht_hello_msg ( char * GNUNET_HELLO_parser_to_url (const struct GNUNET_HELLO_Parser *parser); -/** - * Generate GNUnet HELLO URI from a @a builder - * - * @param builder builder to serialize - * @param priv private key to use to sign the result - * @return hello URI - */ -char * -GNUNET_HELLO_builder_to_url (const struct GNUNET_HELLO_Builder *builder, - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); - -/** - * Generate GNUnet HELLO URI from a @a builder - * - * @param builder builder to serialize - * @param priv private key to use to sign the result - * @param expiration_time the expiration time to use. - * @return hello URI - */ -char * -GNUNET_HELLO_builder_to_url2 (const struct GNUNET_HELLO_Builder *builder, - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - struct GNUNET_TIME_Relative expiration_time); - -/** - * Generate DHT block from a @a builder - * - * @param builder the builder to serialize - * @param priv private key to use to sign the result - * @param[out] block where to write the block, NULL to only calculate @a block_size - * @param[in,out] block_size input is number of bytes available in @a block, - * output is number of bytes needed in @a block - * @return #GNUNET_OK on success, #GNUNET_NO if @a block_size was too small - * or if @a block was NULL - */ -enum GNUNET_GenericReturnValue -GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - void *block, - size_t *block_size, - struct GNUNET_TIME_Relative expiration_time); - /** * Generate DHT block from a @a parser @@ -250,8 +195,8 @@ GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, * or if @a block was NULL */ enum GNUNET_GenericReturnValue -GNUNET_HELLO_parser_to_block(const struct GNUNET_HELLO_Parser *parser, - void *block, size_t *block_size); +GNUNET_HELLO_parser_to_block (const struct GNUNET_HELLO_Parser *parser, + void *block, size_t *block_size); /** * Add individual @a address to the @a builder @@ -292,6 +237,19 @@ typedef void /** + * Iterate over URIs in a builder. + * + * @param builder builder to iterate over + * @param uc callback invoked for each URI, can be NULL + * @param uc_cls closure for @a addrgen + * @return pid of the peer the @a builder is for, can be NULL + */ +void +GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, + GNUNET_HELLO_UriCallback uc, + void *uc_cls); + +/** * Iterate over URIs in a parser. * * @param builder builder to iterate over @@ -336,23 +294,148 @@ char * GNUNET_HELLO_address_to_prefix (const char *address); /** - * Build address record by signing raw information with private key. + * @param builder builder to serialize + * @param pid peer identity + * @param sig signature of the hello + * @param expiration_time expiration time + */ +enum GNUNET_GenericReturnValue +GNUNET_HELLO_build_url (const struct GNUNET_HELLO_Builder *builder, + const struct GNUNET_PeerIdentity *pid, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + struct GNUNET_TIME_Absolute expiration, + char **result); + +/** + * Generate DHT HELLO message (without peer ID) from a @a builder + * + * @param builder builder to serialize + * @param pid peer identity + * @param sig signature of the hello + * @param expiration_time expiration time + * @return handle to the message + */ +struct GNUNET_MessageHeader * +GNUNET_HELLO_builder_to_dht_hello_msg ( + const struct GNUNET_HELLO_Builder *builder, + const struct GNUNET_PeerIdentity *pid, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + struct GNUNET_TIME_Absolute expiration_time); + +/** + * Generate DHT HELLO message from a @a parser + * + * @param parser builder to serialize + * @return handle to the message + */ +struct GNUNET_MessageHeader * +GNUNET_HELLO_parser_to_dht_hello_msg ( + const struct GNUNET_HELLO_Parser *parser); + +/** + * Generate DHT block from a @a builder + * + * @param builder builder to serialize + * @param pid peer identity + * @param sig signature of the hello + * @param expiration_time expiration time + * @param outbuf the buffer to the block + */ +void +GNUNET_HELLO_builder_to_block ( + const struct GNUNET_HELLO_Builder *builder, + const struct GNUNET_PeerIdentity *pid, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + struct GNUNET_TIME_Absolute expiration_time, + char *outbuf); + +/** + * Compute @a hash over addresses in @a builder. + * + * Note: Duplicate of hash_addresses in src/lib/hello/hello-uri.c * - * @param address text address to sign - * @param nt network type of @a address - * @param mono_time when was @a address valid - * @param private_key signing key to use - * @param[out] result where to write address record (allocated) - * @param[out] result_size set to size of @a result + * @param builder the builder to hash addresses of + * @param[out] hash where to write the hash */ void -GNUNET_HELLO_sign_address ( - const char *address, - enum GNUNET_NetworkType nt, - struct GNUNET_TIME_Absolute mono_time, - const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, - void **result, - size_t *result_size); +GNUNET_HELLO_builder_hash_addresses (const struct GNUNET_HELLO_Builder *builder, + struct GNUNET_HashCode *hash); + +/** + * Generate envelope with GNUnet HELLO message (including + * peer ID) from a @a builder + * + * @param builder builder to serialize + * @param pid peer identity + * @param sig signature of the hello + * @param expiration_time expiration time + * @return HELLO message matching @a builder + */ +struct GNUNET_MQ_Envelope* +GNUNET_HELLO_builder_to_env ( + const struct GNUNET_HELLO_Builder *builder, + const struct GNUNET_PeerIdentity *pid, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + struct GNUNET_TIME_Absolute expiration_time); + +/** + * Get projected block size for builder + * + * @param builder builder to serialize + * @return block size + */ +size_t +GNUNET_HELLO_get_builder_to_block_size (const struct GNUNET_HELLO_Builder * + builder); + +/** + * Generate GNUnet HELLO URI from a @a builder + * + * @param builder builder to serialize + * @param pid peer identity + * @param sig signature of the hello + * @return GNUNET_SYSERR on error + */ +enum GNUNET_GenericReturnValue +GNUNET_HELLO_builder_to_url ( + const struct GNUNET_HELLO_Builder *builder, + const struct GNUNET_PeerIdentity *pid, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + char **result); + + +/** + * Generate GNUnet HELLO URI from a @a builder + * + * @param builder builder to serialize + * @param pid peer identity + * @param sig signature of the hello + * @param validity relative validity target of hello + * @return GNUNET_SYSERR on error + */ +enum GNUNET_GenericReturnValue +GNUNET_HELLO_builder_to_url2 ( + const struct GNUNET_HELLO_Builder *builder, + const struct GNUNET_PeerIdentity *pid, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + struct GNUNET_TIME_Absolute validity, + char **result); + +/** + * Compare address lists of two builders. + * Assumes that address lists are already sorted. + * Will also return GNUNET_YES if address lists + * are usorted, but values match! + * + * @param abuilder the first builder + * @param bbuilder the second builder + * @return GNUNET_YES if address lists are the same + */ +enum GNUNET_GenericReturnValue +GNUNET_HELLO_builder_address_list_cmp (const struct GNUNET_HELLO_Builder * + abuilder, + const struct GNUNET_HELLO_Builder * + bbuilder); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_identity_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_identity_service.h @@ -85,7 +85,7 @@ struct GNUNET_IDENTITY_Operation; * @param ego the ego * @return associated ECC key, valid as long as the ego is valid */ -const struct GNUNET_CRYPTO_PrivateKey * +const struct GNUNET_CRYPTO_BlindablePrivateKey * GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); @@ -106,7 +106,8 @@ GNUNET_IDENTITY_ego_get_anonymous (void); */ void GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, - struct GNUNET_CRYPTO_PublicKey *pk); + struct GNUNET_CRYPTO_BlindablePublicKey *pk) +; /** @@ -174,22 +175,6 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, /** - * Obtain the ego that is currently preferred/default for a service. - * - * @param id identity service to query - * @param service_name for which service is an identity wanted - * @param cb function to call with the result (will only be called once) - * @param cb_cls closure for @a cb - * @return handle to abort the operation - */ -struct GNUNET_IDENTITY_Operation * -GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, - const char *service_name, - GNUNET_IDENTITY_Callback cb, - void *cb_cls); - - -/** * Function called once the requested operation has * been completed. * @@ -202,24 +187,6 @@ typedef void /** - * Set the preferred/default ego for a service. - * - * @param id identity service to inform - * @param service_name for which service is an identity set - * @param ego new default identity to be set for this service - * @param cont function to call once the operation finished - * @param cont_cls closure for @a cont - * @return handle to abort the operation - */ -struct GNUNET_IDENTITY_Operation * -GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, - const char *service_name, - struct GNUNET_IDENTITY_Ego *ego, - GNUNET_IDENTITY_Continuation cont, - void *cont_cls); - - -/** * Disconnect from identity service. * * @param h identity service to disconnect @@ -239,7 +206,7 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); typedef void (*GNUNET_IDENTITY_CreateContinuation) ( void *cls, - const struct GNUNET_CRYPTO_PrivateKey *pk, + const struct GNUNET_CRYPTO_BlindablePrivateKey *pk, enum GNUNET_ErrorCode ec); @@ -257,7 +224,7 @@ typedef void struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, const char *name, - const struct GNUNET_CRYPTO_PrivateKey *privkey, + const struct GNUNET_CRYPTO_BlindablePrivateKey *privkey, enum GNUNET_CRYPTO_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls); @@ -361,7 +328,7 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el); typedef void (*GNUNET_IDENTITY_EgoSuffixCallback) ( void *cls, - const struct GNUNET_CRYPTO_PrivateKey *priv, + const struct GNUNET_CRYPTO_BlindablePrivateKey *priv, const char *ego_name); diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_json_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_json_lib.h @@ -273,7 +273,7 @@ GNUNET_JSON_spec_json (const char *name, /** - * JSON object, reference counter not incremented. + * JSON object, reference counter incremented. * * @param name name of the JSON field * @param[out] jsonp where to store the JSON found under @a name @@ -284,7 +284,7 @@ GNUNET_JSON_spec_object_copy (const char *name, /** - * JSON array, reference counter not incremented. + * JSON array, reference counter incremented. * * @param name name of the JSON field * @param[out] jsonp where to store the JSON found under @a name @@ -924,6 +924,32 @@ GNUNET_JSON_pack_data64_varsize (const char *name, /** + * Generate packer instruction of a time rounder interval. + * + * @param name name of the field to add to the object + * @param ri rounder interval to add + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +GNUNET_JSON_pack_time_rounder_interval (const char *name, + enum GNUNET_TIME_RounderInterval ri); + + +/** + * Provide specification to parse a time rounder interval. + * The value must be provided as a descriptive string. + * + * @param name name of the time rounder interval type in the JSON + * @param[out] ri where to store the time rounder interval + * @return spec for parsing trigger event type + */ +struct GNUNET_JSON_Specification +GNUNET_JSON_spec_time_rounder_interval ( + const char *name, + enum GNUNET_TIME_RounderInterval *ri); + + +/** * Generate packer instruction for a JSON field of type * timestamp. * diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_messenger_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_messenger_service.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2020--2024 GNUnet e.V. + Copyright (C) 2020--2025 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -44,9 +44,9 @@ extern "C" { /** * Version number of GNUnet Messenger API. * - * Current version of the Messenger: 0.5 + * Current version of the Messenger: 0.6 */ -#define GNUNET_MESSENGER_VERSION 0x00000005 +#define GNUNET_MESSENGER_VERSION 0x00000006 /** * Identifier of GNUnet MESSENGER Service. @@ -71,8 +71,37 @@ struct GNUNET_MESSENGER_Contact; GNUNET_NETWORK_STRUCT_BEGIN /** + * A room key code specifies an identifier of a room and + * its individual properties. + * + * Size: 64 bytes + */ +struct GNUNET_MESSENGER_RoomKeyCode +{ + uint8_t public_bit : 1; + uint8_t group_bit : 1; + uint8_t feed_bit : 1; + uint8_t unused_bits : 5; + uint8_t bits[sizeof(struct GNUNET_HashCode) - 1]; /* = 63 */ +}; + +/** + * A room key unifies a room key code and its 512bit hash + * representation. + * + * Size: 64 bytes + */ +union GNUNET_MESSENGER_RoomKey +{ + struct GNUNET_HashCode hash; + struct GNUNET_MESSENGER_RoomKeyCode code; +}; + +/** * A room entry record specifies which peer is hosting a given room and * may also specify the key to enter it. + * + * Record-size: 96 bytes */ struct GNUNET_MESSENGER_RoomEntryRecord { @@ -87,13 +116,11 @@ struct GNUNET_MESSENGER_RoomEntryRecord struct GNUNET_HashCode key GNUNET_PACKED; }; -GNUNET_NETWORK_STRUCT_END - - GNUNET_NETWORK_STRUCT_BEGIN - /** * A room details record specifies a custom name for a given room and * some additional space for flags. + * + * Record-size: 260 bytes */ struct GNUNET_MESSENGER_RoomDetailsRecord { @@ -108,6 +135,91 @@ struct GNUNET_MESSENGER_RoomDetailsRecord uint32_t flags; }; +/** + * An epoch identifier code specifies an epoch or group key inside + * a room and it provides the information about its group size. + * + * Size: 32 bytes + */ +struct GNUNET_MESSENGER_EpochIdentifierCode +{ + uint8_t group_bit : 1; + uint8_t level_bits : 7; + uint8_t bits[sizeof(struct GNUNET_ShortHashCode) - 1]; /* = 31 */ +}; + +/** + * An epoch identifier unifies an epoch identifier code and its + * 256bit hash representation. + * + * Size: 32 bytes + */ +union GNUNET_MESSENGER_EpochIdentifier +{ + struct GNUNET_ShortHashCode hash; + struct GNUNET_MESSENGER_EpochIdentifierCode code; +}; + +/** + * A room epoch key record specifies an epoch key for a given room + * that can be identified via a given key to enter it and an epoch + * identifier. + * + * Record-size: 228 + */ +struct GNUNET_MESSENGER_RoomEpochKeyRecord +{ + /** + * The hash identifying the port of the room. + */ + struct GNUNET_HashCode key GNUNET_PACKED; + + /** + * The hash identifying the epoch. + */ + struct GNUNET_HashCode hash GNUNET_PACKED; + + /** + * The short hash identifying the epoch or group key. + */ + struct GNUNET_ShortHashCode identifier GNUNET_PACKED; + + /** + * The shared epoch or group key in the room. + */ + struct GNUNET_CRYPTO_SymmetricSessionKey shared_key; + + /** + * The flags of the epoch or group key. + */ + uint32_t flags; +}; + +#define GNUNET_MESSENGER_EPOCH_NONCE_BYTES \ + sizeof (struct GNUNET_ShortHashCode) + +/** + * Struct to store a unique epoch nonce for message data encryption. + * + * Size: 32 bytes + */ +struct GNUNET_MESSENGER_EpochNonceData +{ + uint8_t nonce[GNUNET_MESSENGER_EPOCH_NONCE_BYTES]; +}; + +/** + * An epoch nonce unifies the epoch nonce data and its + * 256bit hash representation. + * + * Size: 32 bytes + */ +union GNUNET_MESSENGER_EpochNonce +{ + struct GNUNET_ShortHashCode hash; + struct GNUNET_MESSENGER_EpochNonceData data; +}; + GNUNET_NETWORK_STRUCT_END /** @@ -186,9 +298,9 @@ enum GNUNET_MESSENGER_MessageKind GNUNET_MESSENGER_KIND_PRIVATE = 14, /** - * The delete kind. The message contains a #GNUNET_MESSENGER_MessageDelete body. + * The deletion kind. The message contains a #GNUNET_MESSENGER_MessageDeletion body. */ - GNUNET_MESSENGER_KIND_DELETE = 15, + GNUNET_MESSENGER_KIND_DELETION = 15, /** * The connection kind. The message contains a #GNUNET_MESSENGER_MessageConnection body. @@ -211,9 +323,9 @@ enum GNUNET_MESSENGER_MessageKind GNUNET_MESSENGER_KIND_TAG = 19, /** - * The subscribe kind. The message contains a #GNUNET_MESSENGER_MessageSubscribe body. + * The subscription kind. The message contains a #GNUNET_MESSENGER_MessageSubscribtion body. */ - GNUNET_MESSENGER_KIND_SUBSCRIBE = 20, + GNUNET_MESSENGER_KIND_SUBSCRIBTION = 20, /** * The talk kind. The message contains a #GNUNET_MESSENGER_MessageTalk body. @@ -221,6 +333,41 @@ enum GNUNET_MESSENGER_MessageKind GNUNET_MESSENGER_KIND_TALK = 21, /** + * The announcement kind. The message contains a #GNUNET_MESSENGER_MessageAnnouncement body. + */ + GNUNET_MESSENGER_KIND_ANNOUNCEMENT = 22, + + /** + * The secret kind. The message contains a #GNUNET_MESSENGER_MessageSecret body. + */ + GNUNET_MESSENGER_KIND_SECRET = 23, + + /** + * The appeal kind. The message contains a #GNUNET_MESSENGER_MessageAppeal body. + */ + GNUNET_MESSENGER_KIND_APPEAL = 24, + + /** + * The access kind. The message contains a #GNUNET_MESSENGER_MessageAccess body. + */ + GNUNET_MESSENGER_KIND_ACCESS = 25, + + /** + * The revolution kind. The message contains a #GNUNET_MESSENGER_MessageRevolution body. + */ + GNUNET_MESSENGER_KIND_REVOLUTION = 26, + + /** + * The group kind. The message contains a #GNUNET_MESSENGER_MessageGroup body. + */ + GNUNET_MESSENGER_KIND_GROUP = 27, + + /** + * The authorization kind. The message contains a #GNUNET_MESSENGER_MessageAuthorization body. + */ + GNUNET_MESSENGER_KIND_AUTHORIZATION = 28, + + /** * The unknown kind. The message contains an unknown body. */ GNUNET_MESSENGER_KIND_UNKNOWN = 0 @@ -231,24 +378,41 @@ enum GNUNET_MESSENGER_MessageKind /** * Get the name of a message <i>kind</i>. * - * @param kind Kind of a message + * @param[in] kind Kind of a message * @return Name of that kind */ const char* GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind); /** + * Creates a room <i>key</i> from given optional <i>input</i> string using certain + * properties for this targeted room. + * + * @param[out] key Room key + * @param[in] input Input string or NULL + * @param[in] is_public Public property + * @param[in] is_group Group property + * @param[in] is_feed Feed property + */ +void +GNUNET_MESSENGER_create_room_key (union GNUNET_MESSENGER_RoomKey *key, + const char *input, + enum GNUNET_GenericReturnValue is_public, + enum GNUNET_GenericReturnValue is_group, + enum GNUNET_GenericReturnValue is_feed); + +/** * The header of a #GNUNET_MESSENGER_Message. * This allows authentication of the sender, temporal ordering and finding potentially missed messages. * - * Message-header-size: 40+ bytes + * Message-header-size: 140+ bytes */ struct GNUNET_MESSENGER_MessageHeader { /** * The signature of the senders private key. */ - struct GNUNET_CRYPTO_Signature signature; + struct GNUNET_CRYPTO_BlindableKeySignature signature; /** * The timestamp of the message. @@ -275,7 +439,7 @@ struct GNUNET_MESSENGER_MessageHeader * An info message body. * This allows ensuring member ids are unique and this first message can be verified. * - * Message-body-size: 8+ bytes + * Message-body-size: 4 bytes */ struct GNUNET_MESSENGER_MessageInfo { @@ -293,24 +457,33 @@ struct GNUNET_MESSENGER_MessageInfo * A join message body. * This allows informing others about joining the room with a given key pair. * - * Message-body-size: 4+ bytes + * Message-body-size: 68+ bytes */ struct GNUNET_MESSENGER_MessageJoin { /** + * The previous epoch the message was sent from. + */ + struct GNUNET_HashCode epoch; + + /** * The senders public key to verify its signatures. */ - struct GNUNET_CRYPTO_PublicKey key; + struct GNUNET_CRYPTO_BlindablePublicKey key; }; /** * A leave message body. * This allows informing others about leaving the room. * - * Message-body-size: 0 bytes + * Message-body-size: 64 bytes */ struct GNUNET_MESSENGER_MessageLeave { + /** + * The previous epoch the message was sent from. + */ + struct GNUNET_HashCode epoch; }; /** @@ -338,7 +511,7 @@ struct GNUNET_MESSENGER_MessageKey /** * The new public key which replaces the current senders public key. */ - struct GNUNET_CRYPTO_PublicKey key; + struct GNUNET_CRYPTO_BlindablePublicKey key; }; /** @@ -359,7 +532,7 @@ struct GNUNET_MESSENGER_MessagePeer * An id message body. * This allows replacing the member id with a newly unique generated one. * - * Message-body-size: 8 bytes + * Message-body-size: 32 bytes */ struct GNUNET_MESSENGER_MessageId { @@ -387,11 +560,16 @@ struct GNUNET_MESSENGER_MessageMiss * A merge message body. * This allows merging message history branches together. * - * Message-body-size: 16 bytes + * Message-body-size: 192 bytes */ struct GNUNET_MESSENGER_MessageMerge { /** + * The previous epochs the message was sent from. + */ + struct GNUNET_HashCode epochs[2]; + + /** * The hash of a second previous message. */ struct GNUNET_HashCode previous; @@ -401,7 +579,7 @@ struct GNUNET_MESSENGER_MessageMerge * A request message body. * This allows requesting the content of a specific message which is currently missing. * - * Message-body-size: 16 bytes + * Message-body-size: 64 bytes */ struct GNUNET_MESSENGER_MessageRequest { @@ -415,7 +593,7 @@ struct GNUNET_MESSENGER_MessageRequest * An invite message body. * This allows sharing information about other rooms in form of an invitation. * - * Message-body-size: 48 bytes + * Message-body-size: 96 bytes */ struct GNUNET_MESSENGER_MessageInvite { @@ -427,7 +605,7 @@ struct GNUNET_MESSENGER_MessageInvite /** * The hash identifying the port of the room. */ - struct GNUNET_HashCode key; + union GNUNET_MESSENGER_RoomKey key; }; /** @@ -448,7 +626,7 @@ struct GNUNET_MESSENGER_MessageText * A file message body. * This allows sending necessary details about an uploaded encrypted file to allow access to it. * - * Message-body-size: 335+ bytes + * Message-body-size: 383+ bytes */ struct GNUNET_MESSENGER_MessageFile { @@ -477,16 +655,11 @@ struct GNUNET_MESSENGER_MessageFile * A private message body. * This allows to encapsulate any message to be encrypted for only one specific member to receive in a room. * - * Message-body-size: 32+ bytes + * Message-body-size: 0+ bytes */ struct GNUNET_MESSENGER_MessagePrivate { /** - * The ECDH key to decrypt the message. - */ - struct GNUNET_CRYPTO_EcdhePublicKey key; - - /** * The length of the encrypted message. */ uint16_t length; @@ -498,12 +671,12 @@ struct GNUNET_MESSENGER_MessagePrivate }; /** - * A delete message body + * A deletion message body * This allows deletion of an own previous message with any custom automatic delay. * - * Message-body-size: 24 bytes + * Message-body-size: 72 bytes */ -struct GNUNET_MESSENGER_MessageDelete +struct GNUNET_MESSENGER_MessageDeletion { /** * The hash of the message to delete. @@ -553,7 +726,7 @@ struct GNUNET_MESSENGER_MessageTicket * A transcript message body * This allows reading the content of a sent private message. * - * Message-body-size: 68+ + * Message-body-size: 68+ bytes */ struct GNUNET_MESSENGER_MessageTranscript { @@ -565,7 +738,7 @@ struct GNUNET_MESSENGER_MessageTranscript /** * The key from the recipient of the original message. */ - struct GNUNET_CRYPTO_PublicKey key; + struct GNUNET_CRYPTO_BlindablePublicKey key; /** * The length of the transcribed message. @@ -582,7 +755,7 @@ struct GNUNET_MESSENGER_MessageTranscript * A tag message body * This allows tagging a message with a custom tag. * - * Message-body-size: 32+ + * Message-body-size: 64+ bytes */ struct GNUNET_MESSENGER_MessageTag { @@ -598,15 +771,15 @@ struct GNUNET_MESSENGER_MessageTag }; /** - * A subscribe message body + * A subscription message body * This allows subscribing to a discourse. * - * Message-body-size: 44 + * Message-body-size: 44 bytes */ -struct GNUNET_MESSENGER_MessageSubscribe +struct GNUNET_MESSENGER_MessageSubscribtion { /** - * The hash of the discourse to subscribe. + * The hash of the discourse to subscription. */ struct GNUNET_ShortHashCode discourse; @@ -625,7 +798,7 @@ struct GNUNET_MESSENGER_MessageSubscribe * A talk message body * This allows talking in a discourse. * - * Message-body-size: 34+ + * Message-body-size: 32+ bytes */ struct GNUNET_MESSENGER_MessageTalk { @@ -646,6 +819,214 @@ struct GNUNET_MESSENGER_MessageTalk }; /** + * An announcement message body + * This allows announcing group and epoch keys. + * + * Message-body-size: 168 bytes + */ +struct GNUNET_MESSENGER_MessageAnnouncement +{ + /** + * The identifier of the announcement in an epoch. + */ + union GNUNET_MESSENGER_EpochIdentifier identifier; + + /** + * The public key to appeal access. + */ + struct GNUNET_CRYPTO_EcdhePublicKey key; + + /** + * The nonce of the announcement. + */ + union GNUNET_MESSENGER_EpochNonce nonce; + + /** + * The timeout of the announcement. + */ + struct GNUNET_TIME_RelativeNBO timeout; + + /** + * The hmac of the announcement. + */ + struct GNUNET_HashCode hmac; +}; + +#define GNUNET_MESSENGER_SECRET_IV_BYTES \ + sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector) + +/** + * A secret message body + * This allows exchanging encrypted messages. + * + * Message-body-size: 128+ bytes + */ +struct GNUNET_MESSENGER_MessageSecret +{ + /** + * The identifier of the announcement in an epoch. + */ + union GNUNET_MESSENGER_EpochIdentifier identifier; + + /** + * The IV of the secret message. + */ + uint8_t iv[GNUNET_MESSENGER_SECRET_IV_BYTES]; + + /** + * The hmac of the encrypted message. + */ + struct GNUNET_HashCode hmac; + + /** + * The length of the encrypted message. + */ + uint16_t length; + + /** + * The data of the encrypted message. + */ + char *data; +}; + +/** + * An appeal message body + * This allows appealing to receive an epoch key. + * + * Message-body-size: 104 bytes + */ +struct GNUNET_MESSENGER_MessageAppeal +{ + /** + * The hash of the linked announcement message event. + */ + struct GNUNET_HashCode event; + + /** + * The public key to receive access. + */ + struct GNUNET_CRYPTO_EcdhePublicKey key; + + /** + * The timeout of the appeal. + */ + struct GNUNET_TIME_RelativeNBO timeout; +}; + +#define GNUNET_MESSENGER_ACCESS_KEY_BYTES \ + sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey) + \ + GNUNET_CRYPTO_HPKE_SEAL_ONESHOT_OVERHEAD_BYTES + +/** + * An access message body + * This allows providing access to a group or an epoch key using a public key. + * + * Message-body-size: 240 bytes + */ +struct GNUNET_MESSENGER_MessageAccess +{ + /** + * The hash of the linked announcement or group message event. + */ + struct GNUNET_HashCode event; + + /** + * The encrypted group or epoch key. + */ + uint8_t key[GNUNET_MESSENGER_ACCESS_KEY_BYTES]; + + /** + * The hmac of the access. + */ + struct GNUNET_HashCode hmac; +}; + +/** + * A revolution message body + * This allows revolutionizing a group or epoch. + * + * Message-body-size: 128 bytes + */ +struct GNUNET_MESSENGER_MessageRevolution +{ + /** + * The identifier of the announcement in an epoch. + */ + union GNUNET_MESSENGER_EpochIdentifier identifier; + + /** + * The nonce of the revolution. + */ + union GNUNET_MESSENGER_EpochNonce nonce; + + /** + * The hmac of the revolution. + */ + struct GNUNET_HashCode hmac; +}; + +/** + * A group message body + * This allows forming an epoch group. + * + * Message-body-size: 168 bytes + */ +struct GNUNET_MESSENGER_MessageGroup +{ + /** + * The identifier of the group in an epoch. + */ + union GNUNET_MESSENGER_EpochIdentifier identifier; + + /** + * The hash of the initiator group announcement. + */ + struct GNUNET_HashCode initiator; + + /** + * The hash of the partner group announcement. + */ + struct GNUNET_HashCode partner; + + /** + * The timeout of the group formation. + */ + struct GNUNET_TIME_RelativeNBO timeout; +}; + +#define GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES \ + sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey) + +/** + * An authorization message body + * This allows providing access to a group or an epoch key using an established shared key. + * + * Message-body-size: 224 bytes + */ +struct GNUNET_MESSENGER_MessageAuthorization +{ + /** + * The identifier of the group in an epoch. + */ + union GNUNET_MESSENGER_EpochIdentifier identifier; + + /** + * The hash of the linked group message event. + */ + struct GNUNET_HashCode event; + + /** + * The encrypted group or epoch key. + */ + uint8_t key[GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES]; + + /** + * The hmac of the authorization. + */ + struct GNUNET_HashCode hmac; +}; + +/** * The unified body of a #GNUNET_MESSENGER_Message. */ struct GNUNET_MESSENGER_MessageBody @@ -666,13 +1047,20 @@ struct GNUNET_MESSENGER_MessageBody struct GNUNET_MESSENGER_MessageText text; struct GNUNET_MESSENGER_MessageFile file; struct GNUNET_MESSENGER_MessagePrivate privacy; - struct GNUNET_MESSENGER_MessageDelete deletion; + struct GNUNET_MESSENGER_MessageDeletion deletion; struct GNUNET_MESSENGER_MessageConnection connection; struct GNUNET_MESSENGER_MessageTicket ticket; struct GNUNET_MESSENGER_MessageTranscript transcript; struct GNUNET_MESSENGER_MessageTag tag; - struct GNUNET_MESSENGER_MessageSubscribe subscribe; + struct GNUNET_MESSENGER_MessageSubscribtion subscription; struct GNUNET_MESSENGER_MessageTalk talk; + struct GNUNET_MESSENGER_MessageAnnouncement announcement; + struct GNUNET_MESSENGER_MessageSecret secret; + struct GNUNET_MESSENGER_MessageAppeal appeal; + struct GNUNET_MESSENGER_MessageAccess access; + struct GNUNET_MESSENGER_MessageRevolution revolution; + struct GNUNET_MESSENGER_MessageGroup group; + struct GNUNET_MESSENGER_MessageAuthorization authorization; }; }; @@ -732,6 +1120,16 @@ enum GNUNET_MESSENGER_MessageFlags * The delete flag. The flag indicates that the message was deleted by the service. */ GNUNET_MESSENGER_FLAG_DELETE = 32, + + /** + * The secret flag. The flag indicates that the message was encrypted as epoch secret. + */ + GNUNET_MESSENGER_FLAG_SECRET = 64, + + /** + * The member flag. The flag indicates that the message introduces a new member to the client. + */ + GNUNET_MESSENGER_FLAG_MEMBER = 128, }; /** @@ -773,6 +1171,20 @@ enum GNUNET_MESSENGER_SubscriptionFlags GNUNET_MESSENGER_FLAG_SUBSCRIPTION_KEEP_ALIVE = 2, }; +enum GNUNET_MESSENGER_EpochFlags +{ + /** + * The none flag. This flag indicates that the epoch or group key is not affected by + * any modifications. + */ + GNUNET_MESSENGER_FLAG_EPOCH_NONE = 0, + + /** + * The valid flag. This flag indicates whether an epoch or group key is still valid. + */ + GNUNET_MESSENGER_FLAG_EPOCH_VALID = 1, +}; + /** * Method called whenever a message is sent or received from a <i>room</i>. * @@ -827,7 +1239,7 @@ typedef enum GNUNET_GenericReturnValue struct GNUNET_MESSENGER_Handle* GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, - const struct GNUNET_CRYPTO_PrivateKey *key, + const struct GNUNET_CRYPTO_BlindablePrivateKey *key, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); @@ -866,7 +1278,7 @@ GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, * @param[in] handle Messenger handle to use * @return Used public key or NULL */ -const struct GNUNET_CRYPTO_PublicKey* +const struct GNUNET_CRYPTO_BlindablePublicKey* GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); /** @@ -880,7 +1292,7 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); */ enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key (struct GNUNET_MESSENGER_Handle *handle, - const struct GNUNET_CRYPTO_PrivateKey *key); + const struct GNUNET_CRYPTO_BlindablePrivateKey *key); /** * Open a room to send and receive messages. The room will use the specified <i>key</i> as port for the underlying cadet @@ -900,7 +1312,7 @@ GNUNET_MESSENGER_set_key (struct GNUNET_MESSENGER_Handle *handle, */ struct GNUNET_MESSENGER_Room* GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, - const struct GNUNET_HashCode *key); + const union GNUNET_MESSENGER_RoomKey *key); /** * Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room. @@ -923,7 +1335,7 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room* GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, - const struct GNUNET_HashCode *key); + const union GNUNET_MESSENGER_RoomKey *key); /** * Close a <i>room</i> which was entered, opened or both in various order and variety. Closing a room will destroy all @@ -1006,7 +1418,7 @@ GNUNET_MESSENGER_contact_get_name (const struct * @param[in] contact Contact handle * @return Public key used by <i>contact</i> or NULL */ -const struct GNUNET_CRYPTO_PublicKey* +const struct GNUNET_CRYPTO_BlindablePublicKey* GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact); @@ -1060,14 +1472,14 @@ GNUNET_MESSENGER_delete_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_TIME_Relative delay); /** - * Get the message in a <i>room</i> identified by its <i>hash</i>. + * Get the message in a <i>room</i> identified by its <i>hash</i> and requests it if necessary. * - * @param[in] room Room handle + * @param[in,out] room Room handle * @param[in] hash Hash identifying a message * @return Message struct or NULL if no message with that hash is known */ const struct GNUNET_MESSENGER_Message* -GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, +GNUNET_MESSENGER_get_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); /** @@ -1092,6 +1504,6 @@ GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, } #endif -#endif //GNUNET_MESSENGER_SERVICE_H +#endif // GNUNET_MESSENGER_SERVICE_H /** @} *//* end of group */ diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_namestore_plugin.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_namestore_plugin.h @@ -64,7 +64,8 @@ typedef void uint64_t serial, const char *editor_hint, const struct - GNUNET_CRYPTO_PrivateKey *private_key, + GNUNET_CRYPTO_BlindablePrivateKey * + private_key, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); @@ -92,11 +93,11 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*store_records)(void *cls, - const struct GNUNET_CRYPTO_PrivateKey *zone, - const char *label, - unsigned int rd_count, - const struct GNUNET_GNSRECORD_Data *rd); + (*store_records)(void *cls, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, + const char *label, + unsigned int rd_count, + const struct GNUNET_GNSRECORD_Data *rd); /** * Lookup records in the datastore for which we are the authority. @@ -109,11 +110,11 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*lookup_records)(void *cls, - const struct GNUNET_CRYPTO_PrivateKey *zone, - const char *label, - GNUNET_NAMESTORE_RecordIterator iter, - void *iter_cls); + (*lookup_records)(void *cls, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, + const char *label, + GNUNET_NAMESTORE_RecordIterator iter, + void *iter_cls); /** @@ -131,12 +132,12 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO if there were no more results, #GNUNET_SYSERR on error */ enum GNUNET_GenericReturnValue - (*iterate_records)(void *cls, - const struct GNUNET_CRYPTO_PrivateKey *zone, - uint64_t serial, - uint64_t limit, - GNUNET_NAMESTORE_RecordIterator iter, - void *iter_cls); + (*iterate_records)(void *cls, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, + uint64_t serial, + uint64_t limit, + GNUNET_NAMESTORE_RecordIterator iter, + void *iter_cls); /** @@ -151,11 +152,11 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ enum GNUNET_GenericReturnValue - (*zone_to_name)(void *cls, - const struct GNUNET_CRYPTO_PrivateKey *zone, - const struct GNUNET_CRYPTO_PublicKey *value_zone, - GNUNET_NAMESTORE_RecordIterator iter, - void *iter_cls); + (*zone_to_name)(void *cls, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, + const struct GNUNET_CRYPTO_BlindablePublicKey *value_zone, + GNUNET_NAMESTORE_RecordIterator iter, + void *iter_cls); /** Transaction-based API draft **/ @@ -173,12 +174,12 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*edit_records)(void *cls, - const char *editor_hint, - const struct GNUNET_CRYPTO_PrivateKey *zone, - const char *label, - GNUNET_NAMESTORE_RecordIterator iter, - void *iter_cls); + (*edit_records)(void *cls, + const char *editor_hint, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, + const char *label, + GNUNET_NAMESTORE_RecordIterator iter, + void *iter_cls); /** * This clears the editor hint, unless it does not match the @@ -196,11 +197,11 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*clear_editor_hint)(void *cls, - const char *editor_hint, - const char *editor_hint_replacement, - const struct GNUNET_CRYPTO_PrivateKey *zone, - const char *label); + (*clear_editor_hint)(void *cls, + const char *editor_hint, + const char *editor_hint_replacement, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, + const char *label); /** * Tell plugin that a set of procedures are coming that @@ -212,7 +213,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*begin_tx)(void *cls); + (*begin_tx)(void *cls); /** * Tell plugin the we finished what we started with @@ -222,7 +223,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*commit_tx)(void *cls); + (*commit_tx)(void *cls); /** * Tell plugin to rollback what we started with @@ -233,7 +234,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*rollback_tx)(void *cls); + (*rollback_tx)(void *cls); /** * Setup the database. @@ -242,7 +243,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*create_tables)(void *cls); + (*create_tables)(void *cls); /** @@ -253,7 +254,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR */ enum GNUNET_GenericReturnValue - (*drop_tables)(void *cls); + (*drop_tables)(void *cls); }; diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_namestore_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_namestore_service.h @@ -154,7 +154,8 @@ typedef void */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct + GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, @@ -191,7 +192,7 @@ GNUNET_NAMESTORE_record_set_store (struct GNUNET_NAMESTORE_Handle *h, struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store ( struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, unsigned int rd_set_count, const struct GNUNET_NAMESTORE_RecordInfo *record_info, unsigned int *rds_sent, @@ -221,12 +222,14 @@ GNUNET_NAMESTORE_records_store ( */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store_ (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct + GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, int is_zonemaster, - GNUNET_NAMESTORE_ContinuationWithStatus cont, + GNUNET_NAMESTORE_ContinuationWithStatus cont + , void *cont_cls); @@ -242,7 +245,7 @@ GNUNET_NAMESTORE_record_set_store_ (struct GNUNET_NAMESTORE_Handle *h, typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, const struct - GNUNET_CRYPTO_PrivateKey *zone, + GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); @@ -279,7 +282,7 @@ typedef void typedef void (*GNUNET_NAMESTORE_RecordSetMonitor) (void *cls, const struct - GNUNET_CRYPTO_PrivateKey *zone, + GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, @@ -303,7 +306,7 @@ typedef void struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, const struct - GNUNET_CRYPTO_PrivateKey *pkey, + GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, @@ -328,7 +331,7 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h, const struct - GNUNET_CRYPTO_PrivateKey *pkey, + GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, @@ -356,9 +359,10 @@ GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h, */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *zone, + const struct GNUNET_CRYPTO_BlindablePrivateKey * + zone, const struct - GNUNET_CRYPTO_PublicKey *value_zone, + GNUNET_CRYPTO_BlindablePublicKey *value_zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, @@ -408,7 +412,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, const struct - GNUNET_CRYPTO_PrivateKey *zone, + GNUNET_CRYPTO_BlindablePrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, @@ -445,7 +449,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start2 (struct GNUNET_NAMESTORE_Handle *h, const struct - GNUNET_CRYPTO_PrivateKey *zone, + GNUNET_CRYPTO_BlindablePrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordSetMonitor proc, @@ -518,7 +522,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor; struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start ( const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_PrivateKey *zone, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, @@ -558,7 +562,7 @@ GNUNET_NAMESTORE_zone_monitor_start ( struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start2 ( const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_PrivateKey *zone, + const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, @@ -629,7 +633,7 @@ GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm); struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_edit_begin (struct GNUNET_NAMESTORE_Handle *h, const struct - GNUNET_CRYPTO_PrivateKey *pkey, + GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, const char *editor_hint, GNUNET_NAMESTORE_EditRecordSetBeginCallback @@ -658,7 +662,8 @@ GNUNET_NAMESTORE_record_set_edit_begin (struct GNUNET_NAMESTORE_Handle *h, struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_edit_cancel (struct GNUNET_NAMESTORE_Handle *h, const struct - GNUNET_CRYPTO_PrivateKey *pkey, + GNUNET_CRYPTO_BlindablePrivateKey *pkey + , const char *label, const char *editor_hint, const char *editor_hint_replacement, diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_os_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_os_lib.h @@ -321,6 +321,15 @@ GNUNET_OS_project_data_gnunet (void); /** + * Setting project data used by 'libgnunetutil' for GNUnet. + * + * @param project_data data to set instead of default. + */ +void +GNUNET_OS_project_data_gnunet_set (const struct GNUNET_OS_ProjectData *project_data); + + +/** * Setup OS subsystem for the given project data and package. * Initializes GNU Gettext. * diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_pq_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_pq_lib.h @@ -999,6 +999,22 @@ struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_int64 (const char *name, int64_t *i64); +/** + * Allow NULL values in an array to be found in the database for the given value. + * + * @param rs result spec entry to modify, MUST be one for the _array_ types + * @param[out] is_nulls location where to put the array of bools, + * whose elements will be set to 'true' if the value was indeed NULL, + * or to 'false' if the value was non-NULL. + * This parameter MUST NOT be NULL itself. + * The length of the allocated array will be equal to the length of + * the result for the values in @a rs. + * @return array entry for the result specification to use + */ +struct GNUNET_PQ_ResultSpec +GNUNET_PQ_result_spec_array_allow_nulls ( + struct GNUNET_PQ_ResultSpec rs, + bool **is_nulls); /** * array of bool expected. @@ -1121,7 +1137,7 @@ GNUNET_PQ_result_spec_array_timestamp ( * @param name name of the field in the table * @param[out] num where to store the number of elements * @param[out] sizes where to store the @a num size's of byte-buffers in @a dst - * @param[out] dst where to store the continuous array of @a num byte-buffers , allocated + * @param[out] dst where to store the continuous array of @a num byte-buffers of sizes given in @a size, allocated * @return array entry for the result specification to use */ struct GNUNET_PQ_ResultSpec @@ -1140,7 +1156,7 @@ GNUNET_PQ_result_spec_array_variable_size ( * @param name name of the field in the table * @param size number of bytes expected in each element of @a dst * @param[out] num where to store the number of elements - * @param[out] dst where to store the results, an continuous array of fixed-size elements + * @param[out] dst where to store the results, an continuous array of @num fixed-size elements * @return array entry for the result specification to use */ struct GNUNET_PQ_ResultSpec @@ -1201,6 +1217,32 @@ GNUNET_PQ_result_spec_blind_sign_pub ( /** + * Blinded signature expected. + * + * @param name name of the field in the table + * @param[out] b_sig where to store the blinded signature + * @return array entry for the result specification to use + */ +struct GNUNET_PQ_ResultSpec +GNUNET_PQ_result_spec_blinded_sig ( + const char *name, + struct GNUNET_CRYPTO_BlindedSignature **b_sig); + + +/** + * Unblinded signature expected. + * + * @param name name of the field in the table + * @param[out] ub_sig where to store the unblinded signature + * @return array entry for the result specification to use + */ +struct GNUNET_PQ_ResultSpec +GNUNET_PQ_result_spec_unblinded_sig ( + const char *name, + struct GNUNET_CRYPTO_UnblindedSignature **ub_sig); + + +/** * Blind sign private key expected. * * @param name name of the field in the table diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_program_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_program_lib.h @@ -147,35 +147,36 @@ GNUNET_PROGRAM_monolith_main (const struct GNUNET_OS_ProjectData *pd, struct GNUNET_CONFIGURATION_Handle *cfg); #ifndef HAVE_GNUNET_MONOLITH -#define GNUNET_DAEMON_MAIN(daemon_name, daemon_help, init_cb) \ - int \ - main (int argc, \ - char *const *argv) \ - { \ - int ret; \ - struct GNUNET_GETOPT_CommandLineOption options[] = { \ - GNUNET_GETOPT_OPTION_END \ - }; \ - ret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (), \ - argc, \ - argv, \ - daemon_name, \ - daemon_help, \ - options, \ - init_cb, \ - NULL); \ - return ret; \ - } + +#define GNUNET_DAEMON_MAIN(daemon_id, daemon_name, daemon_help, init_cb) \ + int main(int argc, char *const *argv) \ + { \ + int ret; \ + struct GNUNET_GETOPT_CommandLineOption options[] = { \ + GNUNET_GETOPT_OPTION_END \ + }; \ + ret = GNUNET_PROGRAM_run(GNUNET_OS_project_data_gnunet(), \ + argc, \ + argv, \ + daemon_name, \ + daemon_help, \ + options, \ + init_cb, \ + NULL); \ + return ret; \ + } + #else -#define GNUNET_DAEMON_MAIN(daemon_name, daemon_help, init_cb) \ - int init (void); \ - int __attribute__ ((constructor)) \ - init (void) \ - { \ - return GNUNET_DAEMON_register (daemon_name, \ - daemon_help, \ - init_cb); \ - } + +#define GNUNET_DAEMON_MAIN(daemon_id, daemon_name, daemon_help, init_cb) \ + static int init_##daemon_id(void); \ + int __attribute__((constructor)) init_##daemon_id(void) \ + { \ + return GNUNET_DAEMON_register(daemon_name, \ + daemon_help, \ + init_cb); \ + } + #endif diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_protocols.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_protocols.h @@ -391,45 +391,41 @@ extern "C" { */ #define GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY 79 -/** - * Encapsulation for an encrypted message between peers. - */ -#define GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE 82 /** - * Check that other peer is alive (challenge). + * for more detail on the following messages see https://lsd.gnunet.org/lsd0012/draft-schanzen-cake.html */ -#define GNUNET_MESSAGE_TYPE_CORE_PING 83 /** - * Confirmation that other peer is alive. + * First message of the handshake - sent by the initiator */ -#define GNUNET_MESSAGE_TYPE_CORE_PONG 84 +#define GNUNET_MESSAGE_TYPE_CORE_INITIATOR_HELLO 80 /** - * Request by the other peer to terminate the connection. + * Reply to the first message from the initiator - first message sent by the + * responder */ -#define GNUNET_MESSAGE_TYPE_CORE_HANGUP 85 +#define GNUNET_MESSAGE_TYPE_CORE_RESPONDER_HELLO 81 /** - * gzip-compressed type map of the sender + * Third and final message of the handshake, second of the initiator */ -#define GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP 86 +#define GNUNET_MESSAGE_TYPE_CORE_INITIATOR_DONE 82 /** - * uncompressed type map of the sender + * Encrypted message */ -#define GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP 87 +#define GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE_CAKE 83 // TODO rename /** - * Session key exchange between peers. + * Message updating the keys of the peers */ -#define GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY 88 +#define GNUNET_MESSAGE_TYPE_CORE_HEARTBEAT 84 /** - * Other peer confirms having received the type map + * Acknowledgement of prior messages */ -#define GNUNET_MESSAGE_TYPE_CORE_CONFIRM_TYPE_MAP 89 +#define GNUNET_MESSAGE_TYPE_CORE_ACK 85 /******************************************************************************* @@ -3662,6 +3658,64 @@ extern "C" { #define GNUNET_TYPE_BURST_SYNC 1801 +/*********************************************************************************/ +/********************************* CORE (cont.) ********************************/ +/*********************************************************************************/ +/* CORE: message types 1811-1830 + */ + +/** + * Message exchanged between peers for burst synchronisation. + */ +#define GNUNET_MESSAGE_TYPE_CORE_PEER_ID 1811 + + + +/*********************************************************************************/ +/************************************* PILS ************************************/ +/*********************************************************************************/ +/* PILS: message types 1830-1850 + */ + +/** + * Message passing the new peer id from the service to the client. + */ +#define GNUNET_MESSAGE_TYPE_PILS_PEER_ID 1831 + +/** + * The client requests data to be signed with the peer identity. + */ +#define GNUNET_MESSAGE_TYPE_PILS_SIGN_REQUEST 1832 + +/** + * The service sends the requested signature to the client. + */ +#define GNUNET_MESSAGE_TYPE_PILS_SIGN_RESULT 1833 + +/** + * The client (core) provides new addresses to the service, + * so the service can generate the new peer id. + * (The client does not pass the actual addresses, but rather their hash.) + */ +#define GNUNET_MESSAGE_TYPE_PILS_FEED_ADDRESSES 1834 + +/** + * Decaps request. + */ +#define GNUNET_MESSAGE_TYPE_PILS_KEM_DECAPS 1835 + +/** + * Decaps result. + */ +#define GNUNET_MESSAGE_TYPE_PILS_DECAPS_RESULT 1836 + + +/*********************************************************************************/ +/************************************* FREE ************************************/ +/*********************************************************************************/ +/* message types 1850-65534 + */ + /** * Type used to match 'all' message types. */ diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_reclaim_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_reclaim_service.h @@ -85,12 +85,12 @@ struct GNUNET_RECLAIM_Ticket /** * The ticket issuer (= the user) */ - //struct GNUNET_CRYPTO_PublicKey identity; + // struct GNUNET_CRYPTO_BlindablePublicKey identity; /** * The ticket random identifier */ - //struct GNUNET_RECLAIM_Identifier rnd; + // struct GNUNET_RECLAIM_Identifier rnd; /** @@ -98,7 +98,7 @@ struct GNUNET_RECLAIM_Ticket * 0-terminated string. * Example: "urn:gns:000G002B4RF1XPBXDPGZA0PT16BHQCS427YQK4NC84KZMK7TK8C2Z5GMK8" */ - //char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN]; + // char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN]; }; @@ -114,7 +114,7 @@ struct GNUNET_RECLAIM_Ticket typedef void (*GNUNET_RECLAIM_TicketCallback) ( void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, - const char* rp_uri); + const char*rp_uri); /** * Method called when a token has been issued. @@ -150,7 +150,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, * @param attr The attribute */ typedef void (*GNUNET_RECLAIM_AttributeResult) ( - void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, + void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr); /** @@ -162,7 +162,7 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) ( * @param presentation The presentation for the credential (may be NULL) */ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( - void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, + void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation); @@ -176,7 +176,7 @@ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( * @param attributes the parsed attributes */ typedef void (*GNUNET_RECLAIM_CredentialResult) ( - void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, + void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *identity, const struct GNUNET_RECLAIM_Credential *credential); @@ -205,7 +205,7 @@ GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); @@ -226,7 +226,7 @@ GNUNET_RECLAIM_attribute_store ( struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_store ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, @@ -247,7 +247,7 @@ GNUNET_RECLAIM_credential_store ( struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_delete ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); @@ -265,7 +265,7 @@ GNUNET_RECLAIM_attribute_delete ( struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_delete ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *pkey, + const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *cred, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); @@ -297,7 +297,7 @@ GNUNET_RECLAIM_credential_delete ( struct GNUNET_RECLAIM_AttributeIterator * GNUNET_RECLAIM_get_attributes_start ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *identity, + const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); @@ -353,7 +353,7 @@ GNUNET_RECLAIM_get_attributes_stop ( struct GNUNET_RECLAIM_CredentialIterator * GNUNET_RECLAIM_get_credentials_start ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *identity, + const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_CredentialResult proc, @@ -370,7 +370,7 @@ GNUNET_RECLAIM_get_credentials_start ( */ void GNUNET_RECLAIM_get_credentials_next ( - struct GNUNET_RECLAIM_CredentialIterator *ait); + struct GNUNET_RECLAIM_CredentialIterator *ait); /** @@ -382,7 +382,7 @@ GNUNET_RECLAIM_get_credentials_next ( */ void GNUNET_RECLAIM_get_credentials_stop ( - struct GNUNET_RECLAIM_CredentialIterator *ait); + struct GNUNET_RECLAIM_CredentialIterator *ait); /** @@ -401,7 +401,7 @@ GNUNET_RECLAIM_get_credentials_stop ( struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_issue ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *iss, + const struct GNUNET_CRYPTO_BlindablePrivateKey *iss, const char *rp_uri, const struct GNUNET_RECLAIM_AttributeList *attrs, GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); @@ -423,7 +423,7 @@ GNUNET_RECLAIM_ticket_issue ( struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *identity, + const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); @@ -467,7 +467,7 @@ GNUNET_RECLAIM_ticket_consume ( struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start ( struct GNUNET_RECLAIM_Handle *h, - const struct GNUNET_CRYPTO_PrivateKey *identity, + const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_revocation_service.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_revocation_service.h @@ -88,7 +88,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls, */ struct GNUNET_REVOCATION_Query * GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_PublicKey *key, + const struct GNUNET_CRYPTO_BlindablePublicKey *key, GNUNET_REVOCATION_Callback func, void *func_cls); @@ -134,8 +134,6 @@ void GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); - - #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_strings_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_strings_lib.h @@ -203,7 +203,7 @@ GNUNET_STRINGS_from_utf8 (const char *input, * * @param input input string * @param output output buffer - * @return GNUNET_OK on success + * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_tolower (const char *input, @@ -292,6 +292,7 @@ GNUNET_STRINGS_buffer_tokenize (const char *buffer, const char * GNUNET_STRINGS_timestamp_to_string (struct GNUNET_TIME_Timestamp t); + /** * @ingroup time * Like `asctime`, except for GNUnet time. Converts a GNUnet internal diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_testing_core_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_testing_core_lib.h @@ -30,6 +30,11 @@ #include "gnunet_testing_lib.h" +#define MTYPE 12345 + +#define NODE_ID_LEN 16 + + /** * Struct to store information needed in callbacks. */ @@ -121,6 +126,83 @@ struct GNUNET_TESTING_ConnectPeersState }; +struct GNUNET_TESTING_CORE_ConnectState; + + +struct GNUNET_TESTING_CORE_Channel +{ + struct GNUNET_TESTING_CORE_Channel *next; + struct GNUNET_TESTING_CORE_Channel *prev; + struct GNUNET_TESTING_CORE_ConnectState *connect_state; + struct GNUNET_MQ_Handle *mq; + struct GNUNET_PeerIdentity peer_id; +}; + + +struct GNUNET_TESTING_CORE_Message +{ + struct GNUNET_MessageHeader header; + // The following will be used for debugging + uint64_t id; // id of the message + uint64_t batch; // first batch of that peer (for this test 0 or 1) + // uint64_t peer; // number of sending peer (for this test 0 or 1) + char node_id[NODE_ID_LEN]; +}; + + +typedef void * +(*GNUNET_TESTING_CORE_connect_cb) ( + void *cls, + const struct GNUNET_PeerIdentity *peer_id, + struct GNUNET_MQ_Handle *mq); + + +struct GNUNET_TESTING_CORE_ConnectCb +{ + GNUNET_TESTING_CORE_connect_cb callback; + void *cls; +}; + + +typedef void +(*GNUNET_TESTING_CORE_handle_msg)( + void *cls, + struct GNUNET_TESTING_CORE_Channel *channel, + const struct GNUNET_TESTING_CORE_Message *msg); + + +struct GNUNET_TESTING_CORE_ConnectState +{ + struct GNUNET_CORE_Handle *h; + + // FIXME why is this const? Borrowed pointer?! + const char*node_id; + struct GNUNET_PeerIdentity peer_id; + char *arm_service_label; + const struct GNUNET_CONFIGURATION_Handle *cfg; + enum GNUNET_GenericReturnValue finished; + + /** + * Receive callback + */ + GNUNET_TESTING_CORE_handle_msg *recv_handlers; + uint32_t recv_handlers_len; + void *recv_handlers_cls; + + /** + * Connect callback + * TODO we probably only need a single one. + */ + struct GNUNET_TESTING_CORE_ConnectCb *connect_cbs; + uint32_t connect_cbs_len; + + struct GNUNET_TESTING_CORE_Channel *channels_head; + struct GNUNET_TESTING_CORE_Channel *channels_tail; + + struct GNUNET_TESTING_AsyncContext ac; +}; + + /** * FIXME: document properly! * Create command @@ -144,13 +226,34 @@ GNUNET_CORE_cmd_connect_peers ( unsigned int wait_for_connect, struct GNUNET_MQ_MessageHandler *handlers); +const struct GNUNET_TESTING_Command +GNUNET_TESTING_CORE_cmd_connect ( + const char *label, + const char*node_id, + char *arm_service_label); + + +const struct GNUNET_TESTING_Command +GNUNET_TESTING_CORE_cmd_recv ( + const char *label, + uint64_t num_messages); + + +const struct GNUNET_TESTING_Command +GNUNET_TESTING_CORE_cmd_send ( + const char *label, + uint64_t num_messages, + enum GNUNET_GenericReturnValue await_new_connection); + /** * Call #op on all simple traits. */ #define GNUNET_CORE_TESTING_SIMPLE_TRAITS(op, prefix) \ op (prefix, connect_peer_state, const struct \ - GNUNET_TESTING_ConnectPeersState) + GNUNET_TESTING_ConnectPeersState) \ + op (prefix, connect, struct \ + GNUNET_TESTING_CORE_ConnectState) GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_CORE_TESTING) diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_testing_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_testing_lib.h @@ -640,7 +640,7 @@ GNUNET_TESTING_cmd_make_unblocking ( * @param timeout how long to wait at most for @a cmd_ref to finish * @return a finish-command. */ -const struct GNUNET_TESTING_Command +struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_finish ( const char *finish_label, const char *cmd_ref, @@ -680,7 +680,7 @@ GNUNET_TESTING_cmd_sleep ( * * @param label Label of the command. */ -const struct GNUNET_TESTING_Command +struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_exec ( const char *label, enum GNUNET_OS_ProcessStatusType expected_type, @@ -692,8 +692,8 @@ GNUNET_TESTING_cmd_exec ( * Command to execute a command. * * @param label Label of the command. -*/ -const struct GNUNET_TESTING_Command + */ +struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_exec_va ( const char *label, enum GNUNET_OS_ProcessStatusType expected_type, diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_time_lib.h b/android_studio/distribution/libgnunet/lib/arm64-v8a/include/gnunet_time_lib.h @@ -233,6 +233,119 @@ GNUNET_NETWORK_STRUCT_END /** + * Quantities by which we support round up absolute time values. + */ +enum GNUNET_TIME_RounderInterval +{ + /** + * No rounding up. + */ + GNUNET_TIME_RI_NONE = 0, + + /** + * Round up to a multiple of seconds. + */ + GNUNET_TIME_RI_SECOND, + + /** + * Round up to the next minute. + */ + GNUNET_TIME_RI_MINUTE, + + /** + * Round up to the next hour. + */ + GNUNET_TIME_RI_HOUR, + + /** + * Round up to the next day. + */ + GNUNET_TIME_RI_DAY, + + /** + * Round up to the next calendar week. + */ + GNUNET_TIME_RI_WEEK, + + /** + * Round up to the next month. + */ + GNUNET_TIME_RI_MONTH, + + /** + * Round up to the next quarter. + */ + GNUNET_TIME_RI_QUARTER, + + /** + * Round up to the next year. + */ + GNUNET_TIME_RI_YEAR +}; + + +/** + * Convert a relative time to the corresponding rounding + * interval. + * + * @param rel relative time to convert + * @return rounding interval, #GNUNET_TIME_RI_NONE if + * either @a rel is zero or if the input does not match exactly + * any of the supported rounding intervals + */ +enum GNUNET_TIME_RounderInterval +GNUNET_TIME_relative_to_round_interval (struct GNUNET_TIME_Relative rel); + + +/** + * Convert rounding interval given as a string to the enum value. + * + * @param ri_str rounding interval as string + * @param[out] ri set to enum value + * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure + */ +enum GNUNET_GenericReturnValue +GNUNET_TIME_string_to_round_interval (const char *ri_str, + enum GNUNET_TIME_RounderInterval *ri); + + +/** + * Convert rounding interval to string. + * + * @param ri the rounding interval + * @return NULL on failure (invalid enum value) + */ +const char * +GNUNET_TIME_round_interval2s (enum GNUNET_TIME_RounderInterval ri); + + +/** + * Round up the given @a at to the interval @a ri. + * NEVER/FOREVER always remains NEVER/FOREVER. + * + * @param at some absolute time to round + * @param ri how much to round up + * @return rounded up value of @a at + */ +struct GNUNET_TIME_Absolute +GNUNET_TIME_round_up (struct GNUNET_TIME_Absolute at, + enum GNUNET_TIME_RounderInterval ri); + + +/** + * Round @at down to the start of the next interval @a ri. + * NEVER/FOREVER always remains NEVER/FOREVER. + * + * @param at some absolute time to round + * @param ri how much to round down + * @return rounded up value of @a at + */ +struct GNUNET_TIME_Absolute +GNUNET_TIME_round_down (struct GNUNET_TIME_Absolute at, + enum GNUNET_TIME_RounderInterval ri); + + +/** * Convert @a ts to human-readable timestamp. * Note that the returned value will be overwritten if this function * is called again. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunet.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunet.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetblock.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetblock.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetblockgroup.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetblockgroup.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetgnsrecord.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetgnsrecord.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunethello.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunethello.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetjson.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetjson.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetregexblock.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetregexblock.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetutil.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetutil.so Binary files differ. diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_buffer_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_buffer_lib.h @@ -28,7 +28,7 @@ * @author Florian Dold */ -#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) +#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__) #error "Only <gnunet_util_lib.h> can be included directly." #endif @@ -78,7 +78,18 @@ struct GNUNET_Buffer * @param capacity the capacity (in bytes) to allocate for @a buf */ void -GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity); +GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, + size_t capacity); + + +/** + * Informs the buffer library to expect this buffer to be potentially + * very large (exceeding #GNUNET_malloc() limits). + * + * @param[in,out] buf buffer to set as large buffer + */ +void +GNUNET_buffer_large (struct GNUNET_Buffer *buf); /** @@ -88,7 +99,8 @@ GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity); * @param n number of bytes that should be available to write */ void -GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n); +GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, + size_t n); /** @@ -102,7 +114,9 @@ GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n); * */ void -GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len); +GNUNET_buffer_write (struct GNUNET_Buffer *buf, + const char *data, + size_t len); /** @@ -114,7 +128,8 @@ GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len); * @param str the string to write to @a buf */ void -GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str); +GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, + const char *str); /** @@ -141,7 +156,8 @@ GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf, * @param str string containing the new path component */ void -GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str); +GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, + const char *str); /** @@ -155,7 +171,9 @@ GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str); * @param ... format arguments */ void -GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...) +GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, + const char *fmt, + ...) __attribute__ ((format (printf, 2, 3))); @@ -170,8 +188,9 @@ __attribute__ ((format (printf, 2, 3))); * @param args format argument list */ void -GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, const char *fmt, va_list - args); +GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, + const char *fmt, + va_list args); /** @@ -198,13 +217,16 @@ GNUNET_buffer_reap_str (struct GNUNET_Buffer *buf); * @returns the data contained in the string */ void * -GNUNET_buffer_reap (struct GNUNET_Buffer *buf, size_t *size); +GNUNET_buffer_reap (struct GNUNET_Buffer *buf, + size_t *size); /** * Free the backing memory of the given buffer. * Does not free the memory of the buffer control structure, * which is typically stack-allocated. + * + * @param[in] buf buffer to clear */ void GNUNET_buffer_clear (struct GNUNET_Buffer *buf); diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_client_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_client_lib.h @@ -70,7 +70,7 @@ extern "C" * the necessary information about the service, or if * we could not check (e.g. socket() failed) */ -int +enum GNUNET_GenericReturnValue GNUNET_CLIENT_test (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name); diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_common.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_common.h @@ -55,11 +55,13 @@ #if defined(__FreeBSD__) #include <sys/endian.h> +#define bswap_16(x) bswap16 (x) #define bswap_32(x) bswap32 (x) #define bswap_64(x) bswap64 (x) #elif defined(__OpenBSD__) +#define bswap_16(x) swap16 (x) #define bswap_32(x) swap32 (x) #define bswap_64(x) swap64 (x) @@ -67,6 +69,7 @@ #include <machine/bswap.h> #if defined(__BSWAP_RENAME) && ! defined(__bswap_32) +#define bswap_16(x) bswap16 (x) #define bswap_32(x) bswap32 (x) #define bswap_64(x) bswap64 (x) #endif @@ -81,7 +84,9 @@ the header file. Because this header file uses gettext, this include statement makes sure gettext macros are defined even when platform.h is unavailable. */ +#ifndef _LIBGETTEXT_H #include "gettext.h" +#endif #ifdef __cplusplus extern "C" { @@ -330,29 +335,6 @@ struct GNUNET_MessageHeader /** - * Answer from service to client about last operation. - */ -struct GNUNET_OperationResultMessage -{ - struct GNUNET_MessageHeader header; - - uint32_t reserved GNUNET_PACKED; - - /** - * Operation ID. - */ - uint64_t op_id GNUNET_PACKED; - - /** - * Status code for the operation. - */ - uint64_t result_code GNUNET_PACKED; - - /* Followed by data. */ -}; - - -/** * Identifier for an asynchronous execution context. */ struct GNUNET_AsyncScopeId @@ -552,7 +534,7 @@ __attribute__ ((format (printf, 3, 4))); GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ (comp), \ __FILE__, \ - __FUNCTION__, \ + __func__, \ __LINE__); \ if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \ { \ @@ -578,7 +560,7 @@ __attribute__ ((format (printf, 3, 4))); GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ NULL, \ __FILE__, \ - __FUNCTION__, \ + __func__, \ __LINE__); \ if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \ { \ @@ -911,6 +893,36 @@ GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid); const char * GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen); +/** + * @ingroup logging + * Parse an ascii-encoded hexadecimal string into the + * buffer. The buffer must be (strlen (src) / 2) bytes + * in length. + * + * @param src the string + * @param dst the destination buffer + * @param dst_len the length of the @a dst buffer + * @param invert read from @a src in inverted direction. + * @return number of bytes written. + */ +size_t +GNUNET_hex2b (const char *src, void *dst, size_t dstlen, int invert); + +/** + * @ingroup logging + * Print a byte string in hexadecimal ascii notation + * + * @param buf the byte string + * @param buf_len the length of the @a buf buffer + * @param fold insert newline after this number of bytes + (0 for no folding) + * @param in_be Output byte string in NBO + */ +void +GNUNET_print_bytes (const void *buf, + size_t buf_len, + int fold, + int in_be); /** * @ingroup logging @@ -1147,7 +1159,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); /* ************************* endianness conversion ****************** */ -#ifdef htonbe64 +#ifdef htobe64 #define GNUNET_htonll(n) htobe64 (n) @@ -1333,32 +1345,6 @@ GNUNET_is_zero_ (const void *a, /** * @ingroup memory - * Allocate a size @a n times @a m array - * with structs or unions of the given @a type. - * - * @param n size of the first dimension - * @param m size of the second dimension - * @param type name of the struct or union, i.e. pass 'struct Foo'. - */ -#define GNUNET_new_array_2d(n, m, type) \ - (type **) GNUNET_xnew_array_2d_ (n, m, sizeof(type), __FILE__, __LINE__) - -/** - * @ingroup memory - * Allocate a size @a n times @a m times @a o array - * with structs or unions of the given @a type. - * - * @param n size of the first dimension - * @param m size of the second dimension - * @param o size of the third dimension - * @param type name of the struct or union, i.e. pass 'struct Foo'. - */ -#define GNUNET_new_array_3d(n, m, o, type) \ - (type ***) GNUNET_xnew_array_3d_ (n, m, o, sizeof(type), __FILE__, \ - __LINE__) - -/** - * @ingroup memory * Wrapper around malloc. Allocates size bytes of memory. * The memory will be zero'ed out. * @@ -1609,52 +1595,6 @@ GNUNET_xmalloc_ (size_t size, /** - * Allocate memory for a two dimensional array in one block - * and set up pointers. Aborts if no more memory is available. - * Don't use GNUNET_xnew_array_2d_ directly. Use the - * #GNUNET_new_array_2d macro. - * The memory of the elements will be zero'ed out. - * - * @param n size of the first dimension - * @param m size of the second dimension - * @param elementSize size of a single element in bytes - * @param filename where is this call being made (for debugging) - * @param linenumber line where this call is being made (for debugging) - * @return allocated memory, never NULL - */ -void ** -GNUNET_xnew_array_2d_ (size_t n, - size_t m, - size_t elementSize, - const char *filename, - int linenumber); - - -/** - * Allocate memory for a three dimensional array in one block - * and set up pointers. Aborts if no more memory is available. - * Don't use GNUNET_xnew_array_3d_ directly. Use the - * #GNUNET_new_array_3d macro. - * The memory of the elements will be zero'ed out. - * - * @param n size of the first dimension - * @param m size of the second dimension - * @param o size of the third dimension - * @param elementSize size of a single element in bytes - * @param filename where is this call being made (for debugging) - * @param linenumber line where this call is being made (for debugging) - * @return allocated memory, never NULL - */ -void *** -GNUNET_xnew_array_3d_ (size_t n, - size_t m, - size_t o, - size_t elementSize, - 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. diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_config.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_config.h @@ -31,19 +31,19 @@ */ /* The version of GNUnet */ -#define GNUNET_VERSION "0.21.1-145-g8bfe56861" +#define GNUNET_VERSION "0.24.1-19-gf8d2003a0" /* Major version */ #define GNUNET_MAJOR_VERSION 0 /* Micro version */ -#define GNUNET_MINOR_VERSION 21 +#define GNUNET_MINOR_VERSION 24 /* Mico version */ #define GNUNET_MICRO_VERSION 1 /* Set to 1 is this is an experimental build */ -#define GNUNET_EXPERIMENTAL 1 +#define GNUNET_EXPERIMENTAL 0 /* Set to 1 if GnuTLS has DANE support */ #define GNUNET_CURL_GNUTLS 0 diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_configuration_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_configuration_lib.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2006, 2008, 2009, 2018 GNUnet e.V. + Copyright (C) 2006, 2008, 2009, 2018, 2024 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -35,7 +35,7 @@ #ifndef GNUNET_CONFIGURATION_LIB_H #define GNUNET_CONFIGURATION_LIB_H - +#include "gnunet_os_lib.h" #include "gnunet_time_lib.h" #ifdef __cplusplus @@ -53,10 +53,12 @@ struct GNUNET_CONFIGURATION_Handle; /** * Create a new configuration object. + * + * @param pd project data to use to determine paths * @return fresh configuration object */ struct GNUNET_CONFIGURATION_Handle * -GNUNET_CONFIGURATION_create (void); +GNUNET_CONFIGURATION_create (const struct GNUNET_OS_ProjectData *pd); /** @@ -85,7 +87,7 @@ GNUNET_CONFIGURATION_destroy ( * defaults and then parse the specific configuration file * to overwrite the defaults. * - * @param cfg configuration to update + * @param[in,out] cfg configuration to update * @param filename name of the configuration file, NULL to load defaults * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ @@ -110,27 +112,17 @@ GNUNET_CONFIGURATION_load_from ( /** - * Return GNUnet's default configuration. A new configuration is allocated - * each time and it's up to the caller to destroy it when done. This function - * returns GNUnet's configuration even when #GNUNET_OS_init has been called - * with a value different from #GNUNET_OS_project_data_default. - * - * @return a freshly allocated configuration - */ -struct GNUNET_CONFIGURATION_Handle * -GNUNET_CONFIGURATION_default (void); - - -/** * Return the filename of the default configuration filename * that is used when no explicit configuration entry point * has been specified. * + * @param pd project data to use to determine paths * @returns NULL if no default configuration file can be located, * a newly allocated string otherwise */ char * -GNUNET_CONFIGURATION_default_filename (void); +GNUNET_CONFIGURATION_default_filename ( + const struct GNUNET_OS_ProjectData *pd); /** @@ -264,6 +256,7 @@ typedef enum GNUNET_GenericReturnValue * @a cb with the resulting configuration object. Then free the * configuration object and return the status value from @a cb. * + * @param pd project data to use to determine paths * @param filename configuration to parse, NULL for "default" * @param cb function to run * @param cb_cls closure for @a cb @@ -272,6 +265,7 @@ typedef enum GNUNET_GenericReturnValue */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse_and_run ( + const struct GNUNET_OS_ProjectData *pd, const char *filename, GNUNET_CONFIGURATION_Callback cb, void *cb_cls); @@ -288,6 +282,17 @@ GNUNET_CONFIGURATION_enable_diagnostics ( /** + * Return the project data associated with this configuration. + * + * @param cfg a configuration + * @return associated project data, never NULL + */ +const struct GNUNET_OS_ProjectData * +GNUNET_CONFIGURATION_get_project_data ( + const struct GNUNET_CONFIGURATION_Handle *cfg); + + +/** * Function to iterate over options. * * @param cls closure @@ -360,7 +365,9 @@ GNUNET_CONFIGURATION_remove_section ( * @param section section of interest * @param option option of interest * @param number where to store the numeric value of the option - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value is malformed) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number ( @@ -369,6 +376,20 @@ GNUNET_CONFIGURATION_get_value_number ( const char *option, unsigned long long *number); +/** + * Set a configuration value that should be a float. + * Note that this possibly truncates your float value. + * + * @param cfg configuration to update + * @param section section of interest + * @param option option of interest + * @param number value to set + */ +void +GNUNET_CONFIGURATION_set_value_float (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section, + const char *option, + float number); /** * Get a configuration value that should be a floating point number. @@ -377,7 +398,9 @@ GNUNET_CONFIGURATION_get_value_number ( * @param section section of interest * @param option option of interest * @param number where to store the floating value of the option - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value is malformed) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_float ( @@ -394,7 +417,9 @@ GNUNET_CONFIGURATION_get_value_float ( * @param section section of interest * @param option option of interest * @param time set to the time value stored in the configuration - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value is malformed) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time ( @@ -411,7 +436,9 @@ GNUNET_CONFIGURATION_get_value_time ( * @param section section of interest * @param option option of interest * @param size set to the size in bytes as stored in the configuration - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value is malformed) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_size ( @@ -443,7 +470,9 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param option option of interest * @param value will be set to a freshly allocated configuration * value, or NULL if option is not specified - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value is malformed) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string ( @@ -462,7 +491,9 @@ GNUNET_CONFIGURATION_get_value_string ( * @param option option of interest * @param value will be set to a freshly allocated configuration * value, or NULL if option is not specified - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value is malformed) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename ( @@ -517,7 +548,9 @@ GNUNET_CONFIGURATION_iterate_section_values ( * @param choices NULL-terminated list of legal values * @param value will be set to an entry in the legal list, * or NULL if option is not specified and no default given - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + * @return #GNUNET_OK on success, + * #GNUNET_NO if option is not set + * #GNUNET_SYSERR on error (value not in @a choices) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_choice ( @@ -535,7 +568,9 @@ GNUNET_CONFIGURATION_get_value_choice ( * @param cfg configuration to inspect * @param section section of interest * @param option option of interest - * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR + * @return #GNUNET_OK if option is set to "YES" + * #GNUNET_NO if option is not set or "NO" + * #GNUNET_SYSERR on error (neither YES nor NO) */ enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno ( @@ -595,10 +630,11 @@ GNUNET_CONFIGURATION_expand_dollar ( * @param number value to set */ void -GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle *cfg, - const char *section, - const char *option, - unsigned long long number); +GNUNET_CONFIGURATION_set_value_number ( + struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section, + const char *option, + unsigned long long number); /** diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_container_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_container_lib.h @@ -1797,14 +1797,15 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( #define GNUNET_CONTAINER_DLL_insert(head, tail, element) \ do \ { \ - GNUNET_assert (((element)->prev == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next == NULL) && ((tail) != (element))); \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next) && ((tail) != (element))); \ (element)->next = (head); \ (element)->prev = NULL; \ - if ((tail) == NULL) \ - (tail) = element; \ + if (NULL == (tail)) \ + (tail) = element; \ else \ - (head)->prev = element; \ + (head)->prev = element; \ (head) = (element); \ } while (0) @@ -1821,14 +1822,15 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( #define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element) \ do \ { \ - GNUNET_assert (((element)->prev == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next == NULL) && ((tail) != (element))); \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next) && ((tail) != (element))); \ (element)->prev = (tail); \ (element)->next = NULL; \ - if ((head) == NULL) \ - (head) = element; \ + if (NULL == (head)) \ + (head) = element; \ else \ - (tail)->next = element; \ + (tail)->next = element; \ (tail) = (element); \ } while (0) @@ -1846,8 +1848,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( #define GNUNET_CONTAINER_DLL_insert_after(head, tail, other, element) \ do \ { \ - GNUNET_assert (((element)->prev == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next == NULL) && ((tail) != (element))); \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next) && ((tail) != (element))); \ (element)->prev = (other); \ if (NULL == other) \ { \ @@ -1860,9 +1863,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (other)->next = (element); \ } \ if (NULL == (element)->next) \ - (tail) = (element); \ + (tail) = (element); \ else \ - (element)->next->prev = (element); \ + (element)->next->prev = (element); \ } while (0) @@ -1879,8 +1882,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( #define GNUNET_CONTAINER_DLL_insert_before(head, tail, other, element) \ do \ { \ - GNUNET_assert (((element)->prev == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next == NULL) && ((tail) != (element))); \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next) && ((tail) != (element))); \ (element)->next = (other); \ if (NULL == other) \ { \ @@ -1893,9 +1897,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (other)->prev = (element); \ } \ if (NULL == (element)->prev) \ - (head) = (element); \ + (head) = (element); \ else \ - (element)->prev->next = (element); \ + (element)->prev->next = (element); \ } while (0) @@ -1916,16 +1920,16 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( #define GNUNET_CONTAINER_DLL_remove(head, tail, element) \ do \ { \ - GNUNET_assert (((element)->prev != NULL) || ((head) == (element))); \ - GNUNET_assert (((element)->next != NULL) || ((tail) == (element))); \ - if ((element)->prev == NULL) \ - (head) = (element)->next; \ + GNUNET_assert ((NULL != (element)->prev) || ((head) == (element))); \ + GNUNET_assert ((NULL != (element)->next) || ((tail) == (element))); \ + if (NULL == (element)->prev) \ + (head) = (element)->next; \ else \ - (element)->prev->next = (element)->next; \ - if ((element)->next == NULL) \ - (tail) = (element)->prev; \ + (element)->prev->next = (element)->next; \ + if (NULL == (element)->next) \ + (tail) = (element)->prev; \ else \ - (element)->next->prev = (element)->prev; \ + (element)->next->prev = (element)->prev; \ (element)->next = NULL; \ (element)->prev = NULL; \ } while (0) @@ -1944,18 +1948,19 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( * @param tail pointer to the tail of the MDLL * @param element element to insert */ -#define GNUNET_CONTAINER_MDLL_insert(mdll, head, tail, element) \ - do \ - { \ - GNUNET_assert (((element)->prev_ ## mdll == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next_ ## mdll == NULL) && ((tail) != (element))); \ +#define GNUNET_CONTAINER_MDLL_insert(mdll, head, tail, element) \ + do \ + { \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev_ ## mdll) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next_ ## mdll) && ((tail) != (element))); \ (element)->next_ ## mdll = (head); \ (element)->prev_ ## mdll = NULL; \ - if ((tail) == NULL) \ - (tail) = element; \ - else \ - (head)->prev_ ## mdll = element; \ - (head) = (element); \ + if (NULL == (tail)) \ + (tail) = element; \ + else \ + (head)->prev_ ## mdll = element; \ + (head) = (element); \ } while (0) @@ -1969,18 +1974,19 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( * @param tail pointer to the tail of the MDLL * @param element element to insert */ -#define GNUNET_CONTAINER_MDLL_insert_tail(mdll, head, tail, element) \ - do \ - { \ - GNUNET_assert (((element)->prev_ ## mdll == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next_ ## mdll == NULL) && ((tail) != (element))); \ +#define GNUNET_CONTAINER_MDLL_insert_tail(mdll, head, tail, element) \ + do \ + { \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev_ ## mdll) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next_ ## mdll) && ((tail) != (element))); \ (element)->prev_ ## mdll = (tail); \ (element)->next_ ## mdll = NULL; \ - if ((head) == NULL) \ - (head) = element; \ - else \ - (tail)->next_ ## mdll = element; \ - (tail) = (element); \ + if (NULL == (head)) \ + (head) = element; \ + else \ + (tail)->next_ ## mdll = element; \ + (tail) = (element); \ } while (0) @@ -1995,26 +2001,27 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( * @param other prior element, NULL for insertion at head of MDLL * @param element element to insert */ -#define GNUNET_CONTAINER_MDLL_insert_after(mdll, head, tail, other, element) \ - do \ - { \ - GNUNET_assert (((element)->prev_ ## mdll == NULL) && ((head) != (element))); \ - GNUNET_assert (((element)->next_ ## mdll == NULL) && ((tail) != (element))); \ +#define GNUNET_CONTAINER_MDLL_insert_after(mdll, head, tail, other, element) \ + do \ + { \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ + GNUNET_assert ((NULL == (element)->prev_ ## mdll) && ((head) != (element))); \ + GNUNET_assert ((NULL == (element)->next_ ## mdll) && ((tail) != (element))); \ (element)->prev_ ## mdll = (other); \ - if (NULL == other) \ - { \ + if (NULL == other) \ + { \ (element)->next_ ## mdll = (head); \ - (head) = (element); \ - } \ - else \ - { \ - (element)->next_ ## mdll = (other)->next_ ## mdll; \ + (head) = (element); \ + } \ + else \ + { \ + (element)->next_ ## mdll = (other)->next_ ## mdll; \ (other)->next_ ## mdll = (element); \ - } \ + } \ if (NULL == (element)->next_ ## mdll) \ - (tail) = (element); \ - else \ - (element)->next_ ## mdll->prev_ ## mdll = (element); \ + (tail) = (element); \ + else \ + (element)->next_ ## mdll->prev_ ## mdll = (element); \ } while (0) @@ -2029,26 +2036,27 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( * @param other prior element, NULL for insertion at head of MDLL * @param element element to insert */ -#define GNUNET_CONTAINER_MDLL_insert_before(mdll, head, tail, other, element) \ - do \ - { \ +#define GNUNET_CONTAINER_MDLL_insert_before(mdll, head, tail, other, element) \ + do \ + { \ + GNUNET_assert ((NULL == (head)) == (NULL == (tail))); \ GNUNET_assert (((element)->prev_ ## mdll == NULL) && ((head) != (element))); \ GNUNET_assert (((element)->next_ ## mdll == NULL) && ((tail) != (element))); \ (element)->next_ ## mdll = (other); \ - if (NULL == other) \ - { \ - (element)->prev = (tail); \ - (tail) = (element); \ - } \ - else \ - { \ - (element)->prev_ ## mdll = (other)->prev_ ## mdll; \ + if (NULL == other) \ + { \ + (element)->prev = (tail); \ + (tail) = (element); \ + } \ + else \ + { \ + (element)->prev_ ## mdll = (other)->prev_ ## mdll; \ (other)->prev_ ## mdll = (element); \ - } \ + } \ if (NULL == (element)->prev_ ## mdll) \ - (head) = (element); \ - else \ - (element)->prev_ ## mdll->next_ ## mdll = (element); \ + (head) = (element); \ + else \ + (element)->prev_ ## mdll->next_ ## mdll = (element); \ } while (0) @@ -2063,19 +2071,19 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( * @param tail pointer to the tail of the MDLL * @param element element to remove */ -#define GNUNET_CONTAINER_MDLL_remove(mdll, head, tail, element) \ - do \ - { \ - GNUNET_assert (((element)->prev_ ## mdll != NULL) || ((head) == (element))); \ - GNUNET_assert (((element)->next_ ## mdll != NULL) || ((tail) == (element))); \ - if ((element)->prev_ ## mdll == NULL) \ - (head) = (element)->next_ ## mdll; \ - else \ - (element)->prev_ ## mdll->next_ ## mdll = (element)->next_ ## mdll; \ - if ((element)->next_ ## mdll == NULL) \ - (tail) = (element)->prev_ ## mdll; \ - else \ - (element)->next_ ## mdll->prev_ ## mdll = (element)->prev_ ## mdll; \ +#define GNUNET_CONTAINER_MDLL_remove(mdll, head, tail, element) \ + do \ + { \ + GNUNET_assert ((NULL != (element)->prev_ ## mdll) || ((head) == (element))); \ + GNUNET_assert ((NULL != (element)->next_ ## mdll) || ((tail) == (element))); \ + if (NULL == (element)->prev_ ## mdll) \ + (head) = (element)->next_ ## mdll; \ + else \ + (element)->prev_ ## mdll->next_ ## mdll = (element)->next_ ## mdll; \ + if (NULL == (element)->next_ ## mdll) \ + (tail) = (element)->prev_ ## mdll; \ + else \ + (element)->next_ ## mdll->prev_ ## mdll = (element)->prev_ ## mdll; \ (element)->next_ ## mdll = NULL; \ (element)->prev_ ## mdll = NULL; \ } while (0) @@ -2112,13 +2120,13 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( TYPE *pos; \ \ for (pos = head; NULL != pos; pos = pos->next) \ - if (0 < comparator (comparator_cls, element, pos)) \ - break; /* element < pos */ \ - if (NULL == pos) /* => element > tail */ \ + if (0 < comparator (comparator_cls, element, pos)) \ + break; /* element < pos */ \ + if (NULL == pos) /* => element > tail */ \ { \ GNUNET_CONTAINER_DLL_insert_tail (head, tail, element); \ } \ - else /* prev < element < pos */ \ + else /* prev < element < pos */ \ { \ GNUNET_CONTAINER_DLL_insert_after (head, tail, pos->prev, element); \ } \ diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_crypto_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_crypto_lib.h @@ -59,6 +59,7 @@ extern "C" { #endif +#include "gnunet_common.h" #include <stdbool.h> #include <sodium.h> @@ -137,7 +138,7 @@ GNUNET_NETWORK_STRUCT_BEGIN * this must be followed by "size - 8" bytes of * the actual signed data */ -struct GNUNET_CRYPTO_EccSignaturePurpose +struct GNUNET_CRYPTO_SignaturePurpose { /** * How many bytes does this signature sign? @@ -230,7 +231,6 @@ struct GNUNET_PeerIdentity struct GNUNET_CRYPTO_EddsaPublicKey public_key; }; - /** * Public ECC key (always for Curve25519) encoded in a format suitable * for network transmission and encryption (ECDH), @@ -349,6 +349,19 @@ struct GNUNET_CRYPTO_Edx25519Signature }; /** + * Special private ECC key generated by GNUNET_CRYPTO_ecdhe_elligator_key_create. + * To be used only for the Elligator KEM. + * Encoded for transmission. + */ +struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey +{ + /** + * d is a value mod n, where n has at most 256 bits. + */ + unsigned char d[256 / 8]; +}; + +/** * Elligator representative (always for Curve25519) */ struct GNUNET_CRYPTO_ElligatorRepresentative @@ -357,7 +370,7 @@ struct GNUNET_CRYPTO_ElligatorRepresentative * Represents an element of Curve25519 finite field. * Always smaller than 2 ^ 254 - 10 -> Needs to be serialized into a random-looking byte stream before transmission. */ - unsigned char r[256 / 8]; + uint8_t r[256 / 8]; }; /** @@ -383,7 +396,7 @@ enum GNUNET_CRYPTO_KeyType * Note that these types are NOT packed and MUST NOT be used in RPC * messages. Use the respective serialization functions. */ -struct GNUNET_CRYPTO_PrivateKey +struct GNUNET_CRYPTO_BlindablePrivateKey { /** * Type of public key. @@ -410,7 +423,7 @@ struct GNUNET_CRYPTO_PrivateKey /** * An identity key as per LSD0001. */ -struct GNUNET_CRYPTO_PublicKey +struct GNUNET_CRYPTO_BlindablePublicKey { /** * Type of public key. @@ -433,11 +446,55 @@ struct GNUNET_CRYPTO_PublicKey }; }; +/** + * A public key used for decryption. + * Right now, only X25519/ECDHE keys supported. + */ +struct GNUNET_CRYPTO_HpkePrivateKey +{ + /** + * Type of key. + * In NBO. + */ + uint32_t type; + + union + { + /** + * An ECDHE/X25519 key + */ + struct GNUNET_CRYPTO_EcdhePrivateKey ecdhe_key; + + }; +}; + + +/** + * A public key used for encryption. + * Right now, only X25519/ECDHE keys supported. + */ +struct GNUNET_CRYPTO_HpkePublicKey +{ + /** + * Type of key. + * In NBO. + */ + uint32_t type; + + union + { + /** + * An ECDHE/X25519 key + */ + struct GNUNET_CRYPTO_EcdhePublicKey ecdhe_key; + + }; +}; /** * An identity signature as per LSD0001. */ -struct GNUNET_CRYPTO_Signature +struct GNUNET_CRYPTO_BlindableKeySignature { /** * Type of signature. @@ -1348,6 +1405,7 @@ GNUNET_CRYPTO_hkdf_extract (struct GNUNET_ShortHashCode *prk, * @brief HKDF-Expand using SHA256. RFC 5869 * @param result buffer for the derived key, allocated by caller * @param out_len desired length of the derived key + * @param prk pesudorandom key * @param ... pair of void * & size_t for context chunks, terminated by NULL * @return #GNUNET_YES on success */ @@ -1379,7 +1437,7 @@ GNUNET_CRYPTO_hkdf_expand_v (void *result, * truncating the PRK, it uses it as a 64 byte key in the HKDF-Expand * phase with SHA256. * (Truncated NMAC would require us to, well, truncate it to 32 byte.) - * ONLY USE FOR COMPATIBLITY WITH OLDER KEY DERIVATIONS. + * ONLY USE FOR COMPATIBILITY WITH OLDER KEY DERIVATIONS. * Use the more standard #GNUNET_CRYPTO_hkdf_extract and * #GNUNET_CRYPTO_HKDF_expand instead! * @@ -1493,7 +1551,7 @@ GNUNET_CRYPTO_kdf (void *result, * @ingroup crypto * Extract the public key for the given private key. * - * @param priv the private key + * @param priv the special elligator private key * @param pub where to write the public key */ void @@ -1789,7 +1847,7 @@ GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); * @param pk location of the key */ void -GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_PrivateKey *pk); +GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_BlindablePrivateKey *pk); /** @@ -1840,11 +1898,15 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, * could not be retrieved */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_sign_by_peer_identity (const struct - GNUNET_CONFIGURATION_Handle *cfg, - const struct - GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct GNUNET_CRYPTO_EddsaSignature *sig); +GNUNET_CRYPTO_blinded_key_sign_by_peer_identity (const struct + GNUNET_CONFIGURATION_Handle * + cfg, + const struct + GNUNET_CRYPTO_SignaturePurpose + *purpose, + struct + GNUNET_CRYPTO_EddsaSignature * + sig); /** @@ -1860,7 +1922,7 @@ GNUNET_CRYPTO_sign_by_peer_identity (const struct enum GNUNET_GenericReturnValue GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose, const struct - GNUNET_CRYPTO_EccSignaturePurpose *validate, + GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_PeerIdentity *identity); @@ -2066,122 +2128,523 @@ GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material); + /** * @ingroup crypto - * Decapsulate a key for a private EdDSA key. - * Dual to #GNUNET_CRRYPTO_eddsa_kem_encaps. + * Derive key material from a ECDH public key and a private X25519 key. + * Dual to #GNUNET_CRRYPTO_ecdh_x25519. + * NOTE: Whenever you can get away with it, use separate key pairs + * for signing and encryption (DH)! * - * @param priv private key from EdDSA to use for the ECDH (x) - * @param c the encapsulated key - * @param key_material where to write the key material H(h(x)yG) + * @param sk private key from X25519 to use for the ECDH (x) + * @param pk public key to use for the ECDH (yG) + * @param additional_data this is fed into HKDF-Extract along with + the ECDH shared secret + * @param ad_len Length of the additional data + * @param dh the DH shared secret (NOTE: Derive key from this before use!) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_eddsa_kem_decaps (const struct - GNUNET_CRYPTO_EddsaPrivateKey *priv, - const struct GNUNET_CRYPTO_EcdhePublicKey *c, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_x25519_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *sk, + const struct GNUNET_CRYPTO_EcdhePublicKey *pk, + struct GNUNET_CRYPTO_EcdhePublicKey *dh); + + +/** HPKE RFC 9180 **/ + +/** + * The HPKE Mode + * "PSK" stands for "Pre-Shared Key". + * The "AUTH" variants use an authenticating KEM + * construction. + */ +enum GNUNET_CRYPTO_HpkeMode +{ + GNUNET_CRYPTO_HPKE_MODE_BASE = 0x00, + GNUNET_CRYPTO_HPKE_MODE_PSK = 0x01, + GNUNET_CRYPTO_HPKE_MODE_AUTH = 0x02, + GNUNET_CRYPTO_HPKE_MODE_AUTH_PSK = 0x03 +}; + +// Nt +#define GNUNET_CRYPTO_HPKE_AEAD_ID 0x0003 + +// Nn +#define GNUNET_CRYPTO_HPKE_NONCE_LEN 12 + +// Nk +#define GNUNET_CRYPTO_HPKE_KEY_LEN 32 + +// Nt +#define GNUNET_CRYPTO_HPKE_TAG_LEN 16 + +// Overhead required for ciphertext +#define GNUNET_CRYPTO_HPKE_SEAL_OVERHEAD_BYTES GNUNET_CRYPTO_HPKE_TAG_LEN + +// Overhead required for ciphertext +#define GNUNET_CRYPTO_HPKE_SEAL_ONESHOT_OVERHEAD_BYTES \ + GNUNET_CRYPTO_HPKE_SEAL_OVERHEAD_BYTES \ + + sizeof (struct GNUNET_CRYPTO_HpkeEncapsulation) + +/** + * Role of the HPKE participant. + */ +enum GNUNET_CRYPTO_HpkeRole +{ + // Receiver + GNUNET_CRYPTO_HPKE_ROLE_R = 0, + // Sender + GNUNET_CRYPTO_HPKE_ROLE_S = 1 +}; + + +/** + * HPKE crypto context. + */ +struct GNUNET_CRYPTO_HpkeContext +{ + // Participant role + enum GNUNET_CRYPTO_HpkeRole role; + + // Encapsulated/Decapsulated key + uint8_t key[GNUNET_CRYPTO_HPKE_KEY_LEN]; + + // Base nonce + uint8_t base_nonce[GNUNET_CRYPTO_HPKE_NONCE_LEN]; + + // Sequence number + uint64_t seq; + + // Exporter secret + struct GNUNET_ShortHashCode exporter_secret; +}; + +/** + * HPKE KEM identifier + * TODO: Elligator KEM was requested at IANA; Number is currently a placeholder. + */ +enum GNUNET_CRYPTO_HpkeKem +{ + // Non-elligator X25519 KEM using HKDF256 + GNUNET_CRYPTO_HPKE_KEM_DH_X25519_HKDF256 = 0x0020, + // Elligator X25519 KEM using HKDF256 + GNUNET_CRYPTO_HPKE_KEM_DH_X25519ELLIGATOR_HKDF256 = 0x0030, +}; + + +/** + * HPKE DHKEM encapsulation (X25519) + * See RFC 9180 + */ +struct GNUNET_CRYPTO_HpkeEncapsulation +{ + /** + * Q consists of an x- and a y-value, each mod p (256 bits), given + * here in affine coordinates and Ed25519 standard compact format. + */ + unsigned char q_y[256 / 8]; +}; + + +/** + * Convert a GNUnet identity key to a key sutiable for HPKE (X25519) + * + * @param sk the private key + * @param sk_enc the new key + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_sk_to_x25519 (const struct + GNUNET_CRYPTO_BlindablePrivateKey *sk, + struct GNUNET_CRYPTO_HpkePrivateKey *sk_enc); + + +/** + * Convert a GNUnet identity key to a key sutiable for HPKE (X25519) + * + * @param pk the public key + * @param x25519 the new key + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_pk_to_x25519 (const struct GNUNET_CRYPTO_BlindablePublicKey * + pk, + struct GNUNET_CRYPTO_HpkePublicKey *pk_enc); /** * @ingroup crypto - * Encapsulate key material for a EdDSA public key. - * Dual to #GNUNET_CRRYPTO_eddsa_kem_decaps. + * Decapsulate a key for a private X25519 key. + * Dual to #GNUNET_CRYPTO_hpke_kem_encaps. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. * - * @param priv private key to use for the ECDH (y) - * @param c public key from EdDSA to use for the ECDH (X=h(x)G) - * @param key_material where to write the key material H(yX)=H(h(x)yG) + * @param priv private key from X25519 to use for the ECDH (x) + * @param c the encapsulated key + * @param prk where to write the key material * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_eddsa_kem_encaps (const struct GNUNET_CRYPTO_EddsaPublicKey *pub, - struct GNUNET_CRYPTO_EcdhePublicKey *c, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_hpke_kem_decaps (const struct + GNUNET_CRYPTO_HpkePrivateKey *priv, + const struct GNUNET_CRYPTO_HpkeEncapsulation *c, + struct GNUNET_ShortHashCode *prk); /** - * This is the encapsulated key of our FO-KEM. + * @ingroup crypto + * Encapsulate key material for a X25519 public key. + * Dual to #GNUNET_CRYPTO_hpke_kem_decaps. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param pkR public key of receiver + * @param c public key from X25519 to use for the ECDH (X=h(x)G) + * @param prk where to write the key material + * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ -struct GNUNET_CRYPTO_FoKemC -{ - /* The output of the FO-OWTF F(x) */ - struct GNUNET_HashCode y; - - /* The ephemeral public key from the DH in the KEM */ - struct GNUNET_CRYPTO_EcdhePublicKey pub; -}; +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_kem_encaps (const struct GNUNET_CRYPTO_HpkePublicKey *pkR, + struct GNUNET_CRYPTO_HpkeEncapsulation *c, + struct GNUNET_ShortHashCode *prk); /** * @ingroup crypto - * Encapsulate key material using a CCA-secure KEM. - * The KEM is using a OWTF with image oracle constructed from - * a Fujusaki-Okamoto transformation using ElGamal (DH plus XOR OTP). - * Dual to #GNUNET_CRRYPTO_eddsa_fo_kem_decaps. - * - * @param pub public key to encapsulated for - * @param[out] c the encapsulation - * @param[out] key_material the encapsulated key + * Deterministic variant of #GNUNET_CRYPTO_hpke_kem_encaps. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param pkR public key of receiver + * @param c public key from X25519 to use for the ECDH (X=h(x)G) + * @param skE ephemeral private key from X25519 to use + * @param prk where to write the key material * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_eddsa_fo_kem_encaps ( - const struct GNUNET_CRYPTO_EddsaPublicKey *pub, - struct GNUNET_CRYPTO_FoKemC *c, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_hpke_kem_encaps_norand (const struct + GNUNET_CRYPTO_HpkePublicKey *pkR, + struct GNUNET_CRYPTO_HpkeEncapsulation *c, + const struct + GNUNET_CRYPTO_HpkePrivateKey *skE, + struct GNUNET_ShortHashCode *prk); +/** + * @ingroup crypto + * Carries out ecdh encapsulation with given public key and the private key from a freshly created ephemeral key pair. + * Following the terminology in https://eprint.iacr.org/2021/509.pdf. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param random_tweak random 8-bit value used as seed + * @param pkR public key of receiver + * @param c representative of ephemeral public key A to use for the ECDH (direct_map(r)=A=aG) + * @param skE special elligator ephemeral private key from X25519 to use + * @param shared_secret where to write the key material HKDF-Extract(r||aX)=HKDF-Extract(r||x(aG)) + * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_elligator_kem_encaps_norand ( + uint8_t random_tweak, + const struct GNUNET_CRYPTO_HpkePublicKey *pkR, + struct GNUNET_CRYPTO_HpkeEncapsulation *c, + const struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey *skE, + struct GNUNET_ShortHashCode *shared_secret); /** * @ingroup crypto - * Decapsulate key material using a CCA-secure KEM. - * The KEM is using a OWTF with image oracle constructed from - * a Fujusaki-Okamoto transformation using ElGamal (DH plus XOR OTP). - * Dual to #GNUNET_CRRYPTO_eddsa_fo_kem_encaps. - * - * @param priv private key this encapsulation is for - * @param c the encapsulation - * @param[out] key_material the encapsulated key + * Carries out ecdh encapsulation with given public key and the private key from a freshly created ephemeral key pair. + * Following the terminology in https://eprint.iacr.org/2021/509.pdf. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param pkR Receiver public key (X) + * @param c representative of ephemeral public key A to use for the ECDH (direct_map(r)=A=aG) + * @param shared_secret where to write the key material HKDF-Extract(r||aX)=HKDF-Extract(r||x(aG)) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_eddsa_fo_kem_decaps (const struct - GNUNET_CRYPTO_EddsaPrivateKey *priv, - const struct GNUNET_CRYPTO_FoKemC *c, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_hpke_elligator_kem_encaps ( + const struct GNUNET_CRYPTO_HpkePublicKey *pkR, + struct GNUNET_CRYPTO_HpkeEncapsulation *c, + struct GNUNET_ShortHashCode *shared_secret); /** * @ingroup crypto - * Encapsulate key material using a CCA-secure KEM. - * The KEM is using a OWTF with image oracle constructed from - * a Fujusaki-Okamoto transformation using ElGamal (DH plus XOR OTP). - * Dual to #GNUNET_CRRYPTO_eddsa_fo_kem_decaps. - * - * @param pub public key to encapsulated for - * @param[out] c the encapsulation - * @param[out] key_material the encapsulated key + * Carries out ecdh decapsulation with own private key and the representative of the received public key. + * Following the terminology in https://eprint.iacr.org/2021/509.pdf. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param skR sender private key (x) + * @param r received representative r, from which we can obtain the public key A (direct_map(r)=A=aG) + * @param shared_secret where to write the key material HKDF-Extract(r||aX)=HKDF-Extract(r||x(aG)) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_ecdsa_fo_kem_encaps (const struct - GNUNET_CRYPTO_EcdsaPublicKey *pub, - struct GNUNET_CRYPTO_FoKemC *c, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_hpke_elligator_kem_decaps ( + const struct GNUNET_CRYPTO_HpkePrivateKey *skR, + const struct GNUNET_CRYPTO_HpkeEncapsulation *c, + struct GNUNET_ShortHashCode *shared_secret); +/** + * @ingroup crypto + * Decapsulate a key for a private EdDSA key. + * Dual to #GNUNET_CRRYPTO_eddsa_kem_encaps. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param priv private key from EdDSA to use for the ECDH (x) + * @param c the encapsulated key + * @param prk where to write the key material HKDF-Extract(c||aX)=HKDF-Extract(c||x(aG)) + * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_eddsa_kem_decaps (const struct + GNUNET_CRYPTO_EddsaPrivateKey *priv, + const struct GNUNET_CRYPTO_HpkeEncapsulation *c, + struct GNUNET_ShortHashCode *prk); /** * @ingroup crypto - * Decapsulate key material using a CCA-secure KEM. - * The KEM is using a OWTF with image oracle constructed from - * a Fujusaki-Okamoto transformation using ElGamal (DH plus XOR OTP). - * Dual to #GNUNET_CRRYPTO_eddsa_fo_kem_encaps. - * - * @param priv private key this encapsulation is for - * @param c the encapsulation - * @param[out] key_material the encapsulated key + * Encapsulate key material for a EdDSA public key. + * Dual to #GNUNET_CRRYPTO_eddsa_kem_decaps. + * Use #GNUNET_CRYPTO_hkdf_expand to derive further context-specific + * keys from the key material. + * + * @param pub public key from EdDSA to use for the ECDH (X=h(x)G) + * @param c encapsulation of prk + * @param prk where to write the key material HKDF-Extract(c||aX)=HKDF-Extract(c||x(aG)) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_ecdsa_fo_kem_decaps (const struct - GNUNET_CRYPTO_EcdsaPrivateKey *priv, - struct GNUNET_CRYPTO_FoKemC *c, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_eddsa_kem_encaps (const struct GNUNET_CRYPTO_EddsaPublicKey *pub, + struct GNUNET_CRYPTO_HpkeEncapsulation *c, + struct GNUNET_ShortHashCode *prk); + + +/** + * 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" + * + * @param pkR the X25519 receiver public key + * @param info the info context separator + * @param info_len length of info in bytes + * @param enc the encapsulation to exchange with the other party + * @param ctx the encryption context allocated by caller + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_sender_setup (const struct GNUNET_CRYPTO_HpkePublicKey *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" + * + * @param kem the HPKE KEM to use + * @param mode the HPKE mode + * @param skE the X25519 ephemeral key to use as encapsulation + * @param skR the X25519 sender private key (may be null for non-Auth modes) + * @param info the info context separator + * @param info_len length of info in bytes + * @param psk the pre-shared key (must not be set non-PSK modes) + * @param psk_len length of psk in bytes + * @param psk_id the ID of the pre-shared key (must be set of psk is set) + * @param psk_id_len length of psk_id in bytes + * @param enc the encapsulation to exchange with the other party + * @param ctx the encryption context allocated by caller + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_sender_setup2 ( + enum GNUNET_CRYPTO_HpkeKem kem, + enum GNUNET_CRYPTO_HpkeMode mode, + struct GNUNET_CRYPTO_HpkePrivateKey *skE, + struct GNUNET_CRYPTO_HpkePrivateKey *skS, + const struct GNUNET_CRYPTO_HpkePublicKey *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 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" + * + * @param kem the HPKE KEM to use + * @param mode the HPKE mode + * @param enc the encapsulation from the sender + * @param skR the X25519 receiver secret key + * @param pkS the X25519 sender public key (may be NULL for non-Auth modes) + * @param info the info context separator + * @param info_len length of info in bytes + * @param psk the pre-shared key (must not be set non-PSK modes) + * @param psk_len length of psk in bytes + * @param psk_id the ID of the pre-shared key (must be set of psk is set) + * @param psk_id_len length of psk_id in bytes + * @param ctx the encryption context allocated by caller + * @return GNUNET_OK on success + */ +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_HpkePrivateKey *skR, + const struct GNUNET_CRYPTO_HpkePublicKey *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" + * + * @param enc the encapsulation from the sender + * @param skR the X25519 receiver secret key + * @param info the info context separator + * @param info_len length of info in bytes + * @param ctx the encryption context allocated by caller + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_receiver_setup ( + const struct GNUNET_CRYPTO_HpkeEncapsulation *enc, + const struct GNUNET_CRYPTO_HpkePrivateKey *skR, + const uint8_t *info, + size_t info_len, + struct GNUNET_CRYPTO_HpkeContext *ctx); + +/** + * 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" + * + * @param ctx the encryption context + * @param aad addition authenticated data to send (not encrypted) + * @param aad_len length of aad in bytes + * @param pt plaintext data to encrypt + * @param pt_len length of pt in bytes + * @param ct ciphertext to send (to be allocated by caller) + * @param ct_len[out] length of written bytes in ct. may be NULL + * @return GNUNET_OK on success + */ +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" + * + * @param pkR the X25519 receiver secret key + * @param info the info context separator + * @param info_len length of info in bytes + * @param aad addition authenticated data to send (not encrypted) + * @param aad_len length of aad in bytes + * @param pt plaintext data to encrypt + * @param pt_len length of pt in bytes + * @param ct ciphertext to send (to be allocated by caller) + * @param ct_len[out] length of written bytes in ct. may be NULL + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_seal_oneshot (const struct GNUNET_CRYPTO_HpkePublicKey *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. + * 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" + * + * @param ctx the encryption context + * @param aad addition authenticated data to send (not encrypted) + * @param aad_len length of aad in bytes + * @param ct ciphertext to decrypt + * @param ct_len length of ct in bytes + * @param pt plaintext (to be allocated by caller) + * @param pt_len length of written bytes in pt. May be NULL + * @return GNUNET_OK on success + */ +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" + * + * @param skR the X25519 receiver secret key + * @param info the info context separator + * @param info_len length of info in bytes + * @param aad addition authenticated data to send (not encrypted) + * @param aad_len length of aad in bytes + * @param ct ciphertext to decrypt + * @param ct_len length of ct in bytes + * @param pt plaintext (to be allocated by caller) + * @param pt_len length of written bytes in pt. May be NULL + * @return GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_hpke_open_oneshot ( + const struct GNUNET_CRYPTO_HpkePrivateKey *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); + + +/** HPKE END **/ /** * @ingroup crypto @@ -2205,6 +2668,8 @@ GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, * Dual to #GNUNET_CRRYPTO_eddsa_ecdh. * This converts the Edwards25519 public key @a pub to a Curve25519 * public key before computing a X25519 DH (see #GNUNET_CRYPTO_ecc_ecdh). + * The resulting X25519 secret is then derived to a key using + * SHA-512. * NOTE: Whenever you can get away with it, use separate key pairs * for signing and encryption (DH)! * @@ -2221,6 +2686,24 @@ GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, /** * @ingroup crypto + * Derive key material from a EdDSA public key and a private ECDH key. + * Dual to #GNUNET_CRRYPTO_x25519_ecdh. + * NOTE: Whenever you can get away with it, use separate key pairs + * for signing and encryption (DH)! + * + * @param priv private key to use for the ECDH (y) + * @param pub public key from EdDSA to use for the ECDH (X=h(x)G) + * @param dh the DH shared secret (NOTE: Derive key from this before use!) + * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +GNUNET_CRYPTO_ecdh_x25519 (const struct GNUNET_CRYPTO_EcdhePrivateKey * + priv, + const struct GNUNET_CRYPTO_EcdhePublicKey *pub, + struct GNUNET_CRYPTO_EcdhePublicKey *dh); + +/** + * @ingroup crypto * Derive key material from a EcDSA public key and a private ECDH key. * Dual to #GNUNET_CRRYPTO_ecdsa_ecdh. * @@ -2253,7 +2736,7 @@ GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_ ( const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig); @@ -2300,7 +2783,7 @@ GNUNET_CRYPTO_eddsa_sign_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_ ( const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig); /** @@ -2361,7 +2844,7 @@ GNUNET_CRYPTO_eddsa_sign_raw ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_sign_ ( const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_Edx25519Signature *sig); @@ -2412,7 +2895,7 @@ GNUNET_CRYPTO_edx25519_sign_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_CRYPTO_EddsaPublicKey *pub); @@ -2427,9 +2910,9 @@ GNUNET_CRYPTO_eddsa_verify_ ( * * @param purp purpose of the signature, must match 'ps->purpose.purpose' * (except in host byte order) - * @param priv private key to use for the signing * @param ps packed struct with what to sign, MUST begin with a purpose * @param sig where to write the signature + * @param pub public key key to use for the verification */ #define GNUNET_CRYPTO_eddsa_verify(purp,ps,sig,pub) ({ \ /* check size is set correctly */ \ @@ -2464,7 +2947,7 @@ GNUNET_CRYPTO_eddsa_verify_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_EcdsaSignature *sig, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub); @@ -2516,7 +2999,7 @@ GNUNET_CRYPTO_ecdsa_verify_ ( enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const struct GNUNET_CRYPTO_Edx25519Signature *sig, const struct GNUNET_CRYPTO_Edx25519PublicKey *pub); @@ -2602,7 +3085,7 @@ GNUNET_CRYPTO_ecdsa_sign_derived ( const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, const char *context, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig); @@ -2667,7 +3150,7 @@ GNUNET_CRYPTO_eddsa_sign_derived ( const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey, const char *label, const char *context, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig); @@ -2734,21 +3217,22 @@ GNUNET_CRYPTO_ecdhe_elligator_decoding ( bool *high_y, const struct GNUNET_CRYPTO_ElligatorRepresentative *representative); + /** * @ingroup crypto * Encodes a point on Curve25519 to a an element of the underlying finite field. * This transformation is deterministic. * + * @param random_tweak random 8-bit value used as seed * @param r storage for the calculated representative * @param pub a point on the curve - * @param high_y encodes if y-coordinate is > 2 ^254 - 10, which determines the representative value out of two * @return 'true' if the given point can be encoded into a representative. Otherwise 'false' is returned and the content of the representative storage is undefined */ bool GNUNET_CRYPTO_ecdhe_elligator_encoding ( + uint8_t random_tweak, struct GNUNET_CRYPTO_ElligatorRepresentative *r, - const struct GNUNET_CRYPTO_EcdhePublicKey *pub, - bool high_y); + const struct GNUNET_CRYPTO_EcdhePublicKey *pub); /** @@ -2756,59 +3240,45 @@ GNUNET_CRYPTO_ecdhe_elligator_encoding ( * Generates a valid public key for elligator's inverse map by adding a lower order point to a prime order point. * Following Method 1 in description https://elligator.org/key-exchange section Step 2: Generate a “special” public key. * + * @param random_tweak random 8-bit value used as seed + * @param sk private key for generating valid public key * @param pub valid public key for elligator inverse map - * @param pk private key for generating valid public key + * @param repr storage for a calculated representative * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_ecdhe_elligator_generate_public_key ( +GNUNET_CRYPTO_ecdhe_elligator_key_get_public_norand ( + uint8_t random_tweak, + const struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey *sk, struct GNUNET_CRYPTO_EcdhePublicKey *pub, - struct GNUNET_CRYPTO_EcdhePrivateKey *pk); - + struct GNUNET_CRYPTO_ElligatorRepresentative *repr); /** * @ingroup crypto - * Generates a private key for Curve25519 and the elligator representative of the corresponding public key. - * - * @param repr representative of the public key - * @param pk Curve25519 private key - */ -void -GNUNET_CRYPTO_ecdhe_elligator_key_create ( - struct GNUNET_CRYPTO_ElligatorRepresentative *repr, - struct GNUNET_CRYPTO_EcdhePrivateKey *pk); - -/** - * @ingroup crypto - * Carries out ecdh encapsulation with given public key and the private key from a freshly created ephemeral key pair. - * Following the terminology in https://eprint.iacr.org/2021/509.pdf. + * Generates a valid public key for elligator's inverse map by adding a lower order point to a prime order point. + * Following Method 1 in description https://elligator.org/key-exchange section Step 2: Generate a “special” public key. * - * @param pub given edwards curve public key (X) - * @param r representative of ephemeral public key A to use for the ECDH (direct_map(r)=A=aG) - * @param key_material where to write the key material H(aX)=H(x(aG)) - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + * @param sk private key for generating valid public key + * @param pub valid public key for elligator inverse map + * @param repr storage for a calculated representative + * @return GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_eddsa_elligator_kem_encaps ( - const struct GNUNET_CRYPTO_EddsaPublicKey *pub, - struct GNUNET_CRYPTO_ElligatorRepresentative *r, - struct GNUNET_HashCode *key_material); +GNUNET_CRYPTO_ecdhe_elligator_key_get_public ( + const struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey *sk, + struct GNUNET_CRYPTO_EcdhePublicKey *pub, + struct GNUNET_CRYPTO_ElligatorRepresentative *repr); + /** * @ingroup crypto - * Carries out ecdh decapsulation with own private key and the representative of the received public key. - * Following the terminology in https://eprint.iacr.org/2021/509.pdf. + * Generates a private key for Curve25519. * - * @param priv own private key (x) - * @param r received representative r, from which we can obtain the public key A (direct_map(r)=A=aG) - * @param key_material where to write the key material H(xA)=H(a(xG)) - * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + * @param sk Curve25519 private key */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_eddsa_elligator_kem_decaps ( - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, - const struct GNUNET_CRYPTO_ElligatorRepresentative *r, - struct GNUNET_HashCode *key_material); +void +GNUNET_CRYPTO_ecdhe_elligator_key_create ( + struct GNUNET_CRYPTO_ElligatorEcdhePrivateKey *sk); /** @@ -4070,10 +4540,10 @@ GNUNET_CRYPTO_blind_sig_verify ( /** - * Get the compacted length of a #GNUNET_CRYPTO_PublicKey. + * Get the compacted length of a #GNUNET_CRYPTO_BlindablePublicKey. * Compacted means that it returns the minimum number of bytes this * key is long, as opposed to the union structure inside - * #GNUNET_CRYPTO_PublicKey. + * #GNUNET_CRYPTO_BlindablePublicKey. * Useful for compact serializations. * * @param key the key. @@ -4081,12 +4551,12 @@ GNUNET_CRYPTO_blind_sig_verify ( */ ssize_t GNUNET_CRYPTO_public_key_get_length (const struct - GNUNET_CRYPTO_PublicKey *key); + GNUNET_CRYPTO_BlindablePublicKey *key); /** - * Reads a #GNUNET_CRYPTO_PublicKey from a compact buffer. + * Reads a #GNUNET_CRYPTO_BlindablePublicKey from a compact buffer. * The buffer has to contain at least the compacted length of - * a #GNUNET_CRYPTO_PublicKey in bytes. + * a #GNUNET_CRYPTO_BlindablePublicKey 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. * @@ -4100,28 +4570,28 @@ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_public_key_from_buffer ( const void *buffer, size_t len, - struct GNUNET_CRYPTO_PublicKey *key, + struct GNUNET_CRYPTO_BlindablePublicKey *key, size_t *read); /** - * Get the compacted length of a #GNUNET_CRYPTO_PrivateKey. + * Get the compacted length of a #GNUNET_CRYPTO_BlindablePrivateKey. * Compacted means that it returns the minimum number of bytes this * key is long, as opposed to the union structure inside - * #GNUNET_CRYPTO_PrivateKey. + * #GNUNET_CRYPTO_BlindablePrivateKey. * Useful for compact serializations. * * @param key the key. * @return -1 on error, else the compacted length of the key. */ ssize_t -GNUNET_CRYPTO_private_key_get_length ( - const struct GNUNET_CRYPTO_PrivateKey *key); +GNUNET_CRYPTO_blindable_sk_get_length ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *key); /** - * Writes a #GNUNET_CRYPTO_PublicKey to a compact buffer. + * Writes a #GNUNET_CRYPTO_BlindablePublicKey to a compact buffer. * The buffer requires space for at least the compacted length of - * a #GNUNET_CRYPTO_PublicKey in bytes. + * a #GNUNET_CRYPTO_BlindablePublicKey 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. * @@ -4131,16 +4601,17 @@ GNUNET_CRYPTO_private_key_get_length ( * @return -1 or -2 on error, else the amount of bytes written to the buffer */ ssize_t -GNUNET_CRYPTO_write_public_key_to_buffer (const struct - GNUNET_CRYPTO_PublicKey *key, - void*buffer, - size_t len); +GNUNET_CRYPTO_write_blindable_pk_to_buffer (const struct + GNUNET_CRYPTO_BlindablePublicKey * + key, + void*buffer, + size_t len); /** - * Reads a #GNUNET_CRYPTO_PrivateKey from a compact buffer. + * Reads a #GNUNET_CRYPTO_BlindablePrivateKey from a compact buffer. * The buffer has to contain at least the compacted length of - * a #GNUNET_CRYPTO_PrivateKey in bytes. + * a #GNUNET_CRYPTO_BlindablePrivateKey in bytes. * If the buffer is too small, the function returns GNUNET_SYSERR as error. * * @param buffer the buffer @@ -4153,14 +4624,14 @@ enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_private_key_from_buffer ( const void*buffer, size_t len, - struct GNUNET_CRYPTO_PrivateKey *key, + struct GNUNET_CRYPTO_BlindablePrivateKey *key, size_t *read); /** - * Writes a #GNUNET_CRYPTO_PrivateKey to a compact buffer. + * Writes a #GNUNET_CRYPTO_BlindablePrivateKey to a compact buffer. * The buffer requires space for at least the compacted length of - * a #GNUNET_CRYPTO_PrivateKey in bytes. + * a #GNUNET_CRYPTO_BlindablePrivateKey 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. * @@ -4170,8 +4641,8 @@ GNUNET_CRYPTO_read_private_key_from_buffer ( * @return -1 or -2 on error, else the amount of bytes written to the buffer */ ssize_t -GNUNET_CRYPTO_write_private_key_to_buffer ( - const struct GNUNET_CRYPTO_PrivateKey *key, +GNUNET_CRYPTO_write_blindable_sk_to_buffer ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *key, void*buffer, size_t len); @@ -4187,8 +4658,8 @@ GNUNET_CRYPTO_write_private_key_to_buffer ( * @return -1 on error, else the compacted length of the signature. */ ssize_t -GNUNET_CRYPTO_signature_get_length ( - const struct GNUNET_CRYPTO_Signature *sig); +GNUNET_CRYPTO_blinded_key_signature_get_length ( + const struct GNUNET_CRYPTO_BlindableKeySignature *sig); /** @@ -4202,13 +4673,13 @@ GNUNET_CRYPTO_signature_get_length ( * @return -1 on error, else the compacted length of the signature. */ ssize_t -GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type); +GNUNET_CRYPTO_blinded_key_signature_get_length_by_type (uint32_t type); /** - * Reads a #GNUNET_CRYPTO_Signature from a compact buffer. + * Reads a #GNUNET_CRYPTO_BlindableKeySignature from a compact buffer. * The buffer has to contain at least the compacted length of - * a #GNUNET_CRYPTO_Signature in bytes. + * a #GNUNET_CRYPTO_BlindableKeySignature 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. * @@ -4218,16 +4689,16 @@ GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type); * @return -1 or -2 on error, else the amount of bytes read from the buffer */ ssize_t -GNUNET_CRYPTO_read_signature_from_buffer ( - struct GNUNET_CRYPTO_Signature *sig, +GNUNET_CRYPTO_read_blinded_key_signature_from_buffer ( + struct GNUNET_CRYPTO_BlindableKeySignature *sig, const void*buffer, size_t len); /** - * Writes a #GNUNET_CRYPTO_Signature to a compact buffer. + * Writes a #GNUNET_CRYPTO_BlindableKeySignature to a compact buffer. * The buffer requires space for at least the compacted length of - * a #GNUNET_CRYPTO_Signature in bytes. + * a #GNUNET_CRYPTO_BlindableKeySignature 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. * @@ -4237,8 +4708,8 @@ GNUNET_CRYPTO_read_signature_from_buffer ( * @return -1 or -2 on error, else the amount of bytes written to the buffer */ ssize_t -GNUNET_CRYPTO_write_signature_to_buffer ( - const struct GNUNET_CRYPTO_Signature *sig, +GNUNET_CRYPTO_write_blinded_key_signature_to_buffer ( + const struct GNUNET_CRYPTO_BlindableKeySignature *sig, void*buffer, size_t len); @@ -4249,7 +4720,7 @@ GNUNET_CRYPTO_write_signature_to_buffer ( * The @a purpose data is the beginning of the data of which the signature is * to be created. The `size` field in @a 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. + * use #GNUNET_CRYPTO_blinded_key_sign() instead of this function. * * @param priv private key to use for the signing * @param purpose what to sign (size, purpose) @@ -4257,10 +4728,10 @@ GNUNET_CRYPTO_write_signature_to_buffer ( * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_sign_ ( - const struct GNUNET_CRYPTO_PrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct GNUNET_CRYPTO_Signature *sig); +GNUNET_CRYPTO_blinded_key_sign_ ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *priv, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, + struct GNUNET_CRYPTO_BlindableKeySignature *sig); /** * @brief Sign a given block. @@ -4276,14 +4747,14 @@ GNUNET_CRYPTO_sign_ ( * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_sign_raw_ ( - const struct GNUNET_CRYPTO_PrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, +GNUNET_CRYPTO_blinded_key_sign_raw_ ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *priv, + const struct GNUNET_CRYPTO_SignaturePurpose *purpose, unsigned char *sig); /** - * @brief Sign a given block with #GNUNET_CRYPTO_PrivateKey. + * @brief Sign a given block with #GNUNET_CRYPTO_BlindablePrivateKey. * * The @a ps data must be a fixed-size struct for which the signature is to be * created. The `size` field in @a ps->purpose must correctly indicate the @@ -4293,16 +4764,16 @@ GNUNET_CRYPTO_sign_raw_ ( * @param ps packed struct with what to sign, MUST begin with a purpose * @param[out] sig where to write the signature */ -#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \ +#define GNUNET_CRYPTO_blinded_key_sign(priv,ps,sig) do { \ /* check size is set correctly */ \ GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ /* check 'ps' begins with the purpose */ \ GNUNET_static_assert (((void*) (ps)) == \ ((void*) &(ps)->purpose)); \ GNUNET_assert (GNUNET_OK == \ - GNUNET_CRYPTO_sign_ (priv, \ - &(ps)->purpose, \ - sig)); \ + GNUNET_CRYPTO_blinded_key_sign_ (priv, \ + &(ps)->purpose, \ + sig)); \ } while (0) @@ -4314,7 +4785,7 @@ GNUNET_CRYPTO_sign_raw_ ( * the number of bytes of the data structure, including its header. If @a * purpose does not match the purpose given in @a validate (the latter must be * in big endian), signature verification fails. If possible, - * use #GNUNET_CRYPTO_signature_verify() instead of this function (only if @a validate + * use #GNUNET_CRYPTO_blinded_key_signature_verify() instead of this function (only if @a validate * is not fixed-size, you must use this function directly). * * @param purpose what is the purpose that the signature should have? @@ -4324,11 +4795,11 @@ GNUNET_CRYPTO_sign_raw_ ( * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_signature_verify_ ( +GNUNET_CRYPTO_blinded_key_signature_verify_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, - const struct GNUNET_CRYPTO_Signature *sig, - const struct GNUNET_CRYPTO_PublicKey *pub); + const struct GNUNET_CRYPTO_SignaturePurpose *validate, + const struct GNUNET_CRYPTO_BlindableKeySignature *sig, + const struct GNUNET_CRYPTO_BlindablePublicKey *pub); /** * @brief Verify a given signature. @@ -4346,15 +4817,15 @@ GNUNET_CRYPTO_signature_verify_ ( * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_signature_verify_raw_ ( +GNUNET_CRYPTO_blinded_key_signature_verify_raw_ ( uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_SignaturePurpose *validate, const unsigned char *sig, - const struct GNUNET_CRYPTO_PublicKey *pub); + const struct GNUNET_CRYPTO_BlindablePublicKey *pub); /** - * @brief Verify a given signature with #GNUNET_CRYPTO_PublicKey. + * @brief Verify a given signature with #GNUNET_CRYPTO_BlindablePublicKey. * * The @a ps data must be a fixed-size struct for which the signature is to be * created. The `size` field in @a ps->purpose must correctly indicate the @@ -4366,111 +4837,20 @@ GNUNET_CRYPTO_signature_verify_raw_ ( * @param sig where to read the signature from * @param pub public key to use for the verifying */ -#define GNUNET_CRYPTO_signature_verify(purp,ps,sig,pub) ({ \ +#define GNUNET_CRYPTO_blinded_key_signature_verify(purp,ps,sig,pub) ({ \ /* check size is set correctly */ \ GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ /* check 'ps' begins with the purpose */ \ GNUNET_static_assert (((void*) (ps)) == \ ((void*) &(ps)->purpose)); \ - GNUNET_CRYPTO_signature_verify_ (purp, \ - &(ps)->purpose, \ - sig, \ - pub); \ + GNUNET_CRYPTO_blinded_key_signature_verify_ (purp, \ + &(ps)->purpose, \ + sig, \ + pub); \ }) /** - * Encrypt a block with #GNUNET_CRYPTO_PublicKey and derives a - * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption - * using ecdh to derive a symmetric key. - * - * @param block the block to encrypt - * @param size the size of the @a block - * @param pub public key to use for ecdh - * @param ecc where to write the ecc public key - * @param result the output parameter in which to store the encrypted result - * can be the same or overlap with @c block - * @returns the size of the encrypted block, -1 for errors. - * Due to the use of CFB and therefore an effective stream cipher, - * this size should be the same as @c len. - */ -ssize_t -GNUNET_CRYPTO_encrypt_old (const void *block, - size_t size, - const struct GNUNET_CRYPTO_PublicKey *pub, - struct GNUNET_CRYPTO_EcdhePublicKey *ecc, - void *result); - - -/** - * Decrypt a given block with #GNUNET_CRYPTO_PrivateKey and a given - * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key. - * - * @param block the data to decrypt, encoded as returned by encrypt - * @param size the size of the @a block to decrypt - * @param priv private key to use for ecdh - * @param ecc the ecc public key - * @param result address to store the result at - * can be the same or overlap with @c block - * @return -1 on failure, size of decrypted block on success. - * Due to the use of CFB and therefore an effective stream cipher, - * this size should be the same as @c size. - */ -ssize_t -GNUNET_CRYPTO_decrypt_old ( - const void *block, - size_t size, - const struct GNUNET_CRYPTO_PrivateKey *priv, - const struct GNUNET_CRYPTO_EcdhePublicKey *ecc, - void *result); - -#define GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \ - + sizeof (struct \ - GNUNET_CRYPTO_FoKemC)) - -/** - * Encrypt a block with #GNUNET_CRYPTO_PublicKey and derives a - * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption - * using ecdh to derive a symmetric key. - * - * Note that the result buffer for the ciphertext must be the length of - * the message to encrypt plus #GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES. - * - * @param block the block to encrypt - * @param size the size of the @a block - * @param pub public key to encrypt for - * @param result the output parameter in which to store the encrypted result - * can be the same or overlap with @c block - * @returns GNUNET_OK on success. - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_encrypt (const void *block, - size_t size, - const struct GNUNET_CRYPTO_PublicKey *pub, - void *result, - size_t result_size); - - -/** - * Decrypt a given block with #GNUNET_CRYPTO_PrivateKey and a given - * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key. - * - * @param block the data to decrypt, encoded as returned by encrypt - * @param size the size of the @a block to decrypt - * @param priv private key to use for ecdh - * @param result address to store the result at - * can be the same or overlap with @c block - * @returns GNUNET_OK on success. - */ -enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_decrypt (const void *block, - size_t size, - const struct GNUNET_CRYPTO_PrivateKey *priv, - void *result, - size_t result_size); - - -/** * 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. @@ -4479,8 +4859,8 @@ GNUNET_CRYPTO_decrypt (const void *block, * @return the string representation of the key, or NULL on error. */ char * -GNUNET_CRYPTO_public_key_to_string ( - const struct GNUNET_CRYPTO_PublicKey *key); +GNUNET_CRYPTO_blindable_public_key_to_string ( + const struct GNUNET_CRYPTO_BlindablePublicKey *key); /** @@ -4492,34 +4872,38 @@ GNUNET_CRYPTO_public_key_to_string ( * @return the string representation of the key, or NULL on error. */ char * -GNUNET_CRYPTO_private_key_to_string ( - const struct GNUNET_CRYPTO_PrivateKey *key); +GNUNET_CRYPTO_blindable_private_key_to_string ( + const struct GNUNET_CRYPTO_BlindablePrivateKey *key); /** * Parses a (Base32) string representation of the public key. - * See also #GNUNET_CRYPTO_public_key_to_string. + * See also #GNUNET_CRYPTO_blindable_public_key_to_string. * * @param str the encoded key. * @param key where to write the key. * @return GNUNET_SYSERR on error. */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_public_key_from_string (const char*str, - struct GNUNET_CRYPTO_PublicKey *key); +GNUNET_CRYPTO_blindable_public_key_from_string (const char*str, + struct + GNUNET_CRYPTO_BlindablePublicKey + *key); /** * Parses a (Base32) string representation of the private key. - * See also #GNUNET_CRYPTO_private_key_to_string. + * See also #GNUNET_CRYPTO_blindable_private_key_to_string. * * @param str the encoded key. * @param key where to write the key. * @return GNUNET_SYSERR on error. */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_private_key_from_string (const char*str, - struct GNUNET_CRYPTO_PrivateKey *key); +GNUNET_CRYPTO_blindable_private_key_from_string (const char*str, + struct + GNUNET_CRYPTO_BlindablePrivateKey + *key); /** @@ -4530,9 +4914,11 @@ GNUNET_CRYPTO_private_key_from_string (const char*str, * @return GNUNET_SYSERR on error. */ enum GNUNET_GenericReturnValue -GNUNET_CRYPTO_key_get_public (const struct - GNUNET_CRYPTO_PrivateKey *privkey, - struct GNUNET_CRYPTO_PublicKey *key); +GNUNET_CRYPTO_blindable_key_get_public (const struct + GNUNET_CRYPTO_BlindablePrivateKey * + privkey, + struct GNUNET_CRYPTO_BlindablePublicKey + *key); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_getopt_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_getopt_lib.h @@ -166,10 +166,12 @@ struct GNUNET_GETOPT_CommandLineOption * Defining the option to print the command line * help text (-h option). * + * @param pd project data to determine details about the application * @param about string with brief description of the application */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_option_help (const char *about); +GNUNET_GETOPT_option_help (const struct GNUNET_OS_ProjectData *pd, + const char *about); /** diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_helper_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_helper_lib.h @@ -70,6 +70,7 @@ typedef void * restarted when it dies except when it is stopped using GNUNET_HELPER_stop() * or when the exp_cb callback is not NULL. * + * @param pd project data to use to determine paths * @param with_control_pipe does the helper support the use of a control pipe for signalling? * @param binary_name name of the binary to run * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this @@ -82,7 +83,8 @@ typedef void * @return the new Handle, NULL on error */ struct GNUNET_HELPER_Handle * -GNUNET_HELPER_start (int with_control_pipe, +GNUNET_HELPER_start (const struct GNUNET_OS_ProjectData *pd, + int with_control_pipe, const char *binary_name, char *const binary_argv[], GNUNET_MessageTokenizerCallback cb, @@ -134,7 +136,8 @@ GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h); * stdin; #GNUNET_NO to signal termination by sending SIGTERM to helper */ void -GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill); +GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, + int soft_kill); /** diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_mq_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_mq_lib.h @@ -38,8 +38,6 @@ * @defgroup mq MQ library * General-purpose message queue * - * @see [Documentation](https://gnunet.org/message-queue-api) - * * @{ */ #ifndef GNUNET_MQ_LIB_H @@ -396,7 +394,7 @@ typedef void * is used with DLLs defined outside of the MQ module. This * is just in case some application needs to also manage a * FIFO of envelopes independent of MQ itself and wants to - * re-use the pointers internal to @a env. Use with caution. + * reuse the pointers internal to @a env. Use with caution. * * @param[in,out] env_head of envelope DLL * @param[in,out] env_tail tail of envelope DLL @@ -414,7 +412,7 @@ GNUNET_MQ_dll_insert_head (struct GNUNET_MQ_Envelope **env_head, * is used with DLLs defined outside of the MQ module. This * is just in case some application needs to also manage a * FIFO of envelopes independent of MQ itself and wants to - * re-use the pointers internal to @a env. Use with caution. + * reuse the pointers internal to @a env. Use with caution. * * @param[in,out] env_head of envelope DLL * @param[in,out] env_tail tail of envelope DLL @@ -432,7 +430,7 @@ GNUNET_MQ_dll_insert_tail (struct GNUNET_MQ_Envelope **env_head, * is used with DLLs defined outside of the MQ module. This * is just in case some application needs to also manage a * FIFO of envelopes independent of MQ itself and wants to - * re-use the pointers internal to @a env. Use with caution. + * reuse the pointers internal to @a env. Use with caution. * * @param[in,out] env_head of envelope DLL * @param[in,out] env_tail tail of envelope DLL diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_plugin_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_plugin_lib.h @@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL3.0-or-later */ -#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) +#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__) #error "Only <gnunet_util_lib.h> can be included directly." #endif @@ -67,11 +67,13 @@ typedef void * * Note that the library must export a symbol called * "library_name_init" for the test to succeed. * + * @param pd project data with library search path * @param library_name name of the plugin to test if it is installed * @return #GNUNET_YES if the plugin exists, #GNUNET_NO if not */ enum GNUNET_GenericReturnValue -GNUNET_PLUGIN_test (const char *library_name); +GNUNET_PLUGIN_test (const struct GNUNET_OS_ProjectData *pd, + const char *library_name); /** @@ -82,12 +84,14 @@ GNUNET_PLUGIN_test (const char *library_name); * "library_name_init" and "library_name_done". These will be called * when the library is loaded and unloaded respectively. * + * @param pd project data with library search path * @param library_name name of the plugin to load * @param arg argument to the plugin initialization function * @return whatever the initialization function returned, NULL on error */ void * -GNUNET_PLUGIN_load (const char *library_name, +GNUNET_PLUGIN_load (const struct GNUNET_OS_ProjectData *pd, + const char *library_name, void *arg); @@ -114,41 +118,21 @@ typedef void * "basename_ANYTHING_init" and "basename_ANYTHING__done". These will * be called when the library is loaded and unloaded respectively. * + * @param pd project data with library search path * @param basename basename of the plugins to load * @param arg argument to the plugin initialization function * @param cb function to call for each plugin found * @param cb_cls closure for @a cb */ void -GNUNET_PLUGIN_load_all (const char *basename, +GNUNET_PLUGIN_load_all (const struct GNUNET_OS_ProjectData *pd, + const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls); /** - * Load all compatible plugins with the given base name while inside the given - * context (i.e. a specific project data structure.) - * - * Note that the library must export symbols called `basename_ANYTHING_init` - * and `basename_ANYTHING__done`. These will be called when the library is - * loaded and unloaded respectively. - * - * @param ctx the context used to find the plugins - * @param basename basename of the plugins to load - * @param arg argument to the plugin initialization function - * @param cb function to call for each plugin found - * @param cb_cls closure for @a cb - */ -void -GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx, - const char *basename, - void *arg, - GNUNET_PLUGIN_LoaderCallback cb, - void *cb_cls); - - -/** * Unload plugin (runs the "done" callback and returns whatever "done" * returned). The plugin is then unloaded. * diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_program_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_program_lib.h @@ -72,6 +72,7 @@ typedef void * Run a standard GNUnet command startup sequence (initialize loggers * and configuration, parse options). * + * @param pd project data for the project the program belongs to * @param argc number of command line arguments in @a argv * @param argv command line arguments * @param binaryName our expected name @@ -87,7 +88,8 @@ typedef void * #GNUNET_OK on success (#a task was invoked) */ enum GNUNET_GenericReturnValue -GNUNET_PROGRAM_run2 (int argc, +GNUNET_PROGRAM_run2 (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, const char *binaryName, const char *binaryHelp, @@ -101,6 +103,7 @@ GNUNET_PROGRAM_run2 (int argc, * Run a standard GNUnet command startup sequence (initialize loggers * and configuration, parse options). * + * @param pd project data for the project the program belongs to * @param argc number of command line arguments * @param argv command line arguments * @param binaryName our expected name @@ -114,7 +117,8 @@ GNUNET_PROGRAM_run2 (int argc, * #GNUNET_OK on success (#a task was invoked) */ enum GNUNET_GenericReturnValue -GNUNET_PROGRAM_run (int argc, +GNUNET_PROGRAM_run (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, const char *binaryName, const char *binaryHelp, @@ -122,59 +126,70 @@ GNUNET_PROGRAM_run (int argc, GNUNET_PROGRAM_Main task, void *task_cls); + enum GNUNET_GenericReturnValue GNUNET_DAEMON_register (const char *daemon_name, const char *daemon_desc, - GNUNET_SCHEDULER_TaskCallback task); + GNUNET_PROGRAM_Main task); + /** - * Start all services and daemons in a single prozess. + * Start all services and daemons in a single process. + * + * @param pd project data for the project the program belongs to + * @param argc number of command line arguments + * @param argv command line arguments */ void -GNUNET_PROGRAM_monolith_main (int argc, +GNUNET_PROGRAM_monolith_main (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, struct GNUNET_CONFIGURATION_Handle *cfg); #ifndef HAVE_GNUNET_MONOLITH -#define GNUNET_DAEMON_MAIN(daemon_name, daemon_help, init_cb) \ - int \ - main (int argc, \ - char *const *argv) \ - { \ - int ret; \ - struct GNUNET_GETOPT_CommandLineOption options[] = { \ - GNUNET_GETOPT_OPTION_END \ - }; \ - if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, \ - &argv)) \ - return 2; \ - ret = GNUNET_PROGRAM_run (argc, \ - argv, \ - daemon_name, \ - daemon_help, \ - options, \ - init_cb, \ - NULL); \ - GNUNET_free_nz ((void*) argv); \ - return ret; \ - } + +#define GNUNET_DAEMON_MAIN(daemon_id, daemon_name, daemon_help, init_cb) \ + int main(int argc, char *const *argv) \ + { \ + int ret; \ + struct GNUNET_GETOPT_CommandLineOption options[] = { \ + GNUNET_GETOPT_OPTION_END \ + }; \ + ret = GNUNET_PROGRAM_run(GNUNET_OS_project_data_gnunet(), \ + argc, \ + argv, \ + daemon_name, \ + daemon_help, \ + options, \ + init_cb, \ + NULL); \ + return ret; \ + } + #else -#define GNUNET_DAEMON_MAIN(daemon_name, daemon_help, init_cb) \ - static int __attribute__ ((constructor)) \ - init (void) \ - { \ - return GNUNET_DAEMON_register (daemon_name, \ - daemon_help, \ - init_cb); \ - } + +#define GNUNET_DAEMON_MAIN(daemon_id, daemon_name, daemon_help, init_cb) \ + static int init_##daemon_id(void); \ + int __attribute__((constructor)) init_##daemon_id(void) \ + { \ + return GNUNET_DAEMON_register(daemon_name, \ + daemon_help, \ + init_cb); \ + } + #endif /** * Create configuration handle from options and configuration file. + * + * @param pd project data for the project the program belongs to + * @param argc number of command line arguments + * @param argv command line arguments */ enum GNUNET_GenericReturnValue -GNUNET_PROGRAM_conf_and_options (int argc, +GNUNET_PROGRAM_conf_and_options (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, struct GNUNET_CONFIGURATION_Handle *cfg); @@ -182,15 +197,19 @@ GNUNET_PROGRAM_conf_and_options (int argc, /** * Run the mainloop in a monolithic libgnunet. * Must be called such that services are actually launched. + * + * @param pd project data for the project the program belongs to + * @param argc number of command line arguments + * @param argv command line arguments */ void -GNUNET_DAEMON_main (int argc, +GNUNET_DAEMON_main (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_GenericReturnValue with_scheduler); - #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_protocols.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_protocols.h @@ -391,45 +391,41 @@ extern "C" { */ #define GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY 79 -/** - * Encapsulation for an encrypted message between peers. - */ -#define GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE 82 /** - * Check that other peer is alive (challenge). + * for more detail on the following messages see https://lsd.gnunet.org/lsd0012/draft-schanzen-cake.html */ -#define GNUNET_MESSAGE_TYPE_CORE_PING 83 /** - * Confirmation that other peer is alive. + * First message of the handshake - sent by the initiator */ -#define GNUNET_MESSAGE_TYPE_CORE_PONG 84 +#define GNUNET_MESSAGE_TYPE_CORE_INITIATOR_HELLO 80 /** - * Request by the other peer to terminate the connection. + * Reply to the first message from the initiator - first message sent by the + * responder */ -#define GNUNET_MESSAGE_TYPE_CORE_HANGUP 85 +#define GNUNET_MESSAGE_TYPE_CORE_RESPONDER_HELLO 81 /** - * gzip-compressed type map of the sender + * Third and final message of the handshake, second of the initiator */ -#define GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP 86 +#define GNUNET_MESSAGE_TYPE_CORE_INITIATOR_DONE 82 /** - * uncompressed type map of the sender + * Encrypted message */ -#define GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP 87 +#define GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE_CAKE 83 // TODO rename /** - * Session key exchange between peers. + * Message updating the keys of the peers */ -#define GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY 88 +#define GNUNET_MESSAGE_TYPE_CORE_HEARTBEAT 84 /** - * Other peer confirms having received the type map + * Acknowledgement of prior messages */ -#define GNUNET_MESSAGE_TYPE_CORE_CONFIRM_TYPE_MAP 89 +#define GNUNET_MESSAGE_TYPE_CORE_ACK 85 /******************************************************************************* @@ -2121,14 +2117,8 @@ extern "C" { #define GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE 626 /** - * Client requests to know default identity for a subsystem. - */ -#define GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT 627 - -/** - * Client sets default identity; or service informs about default identity. + * 627 and 628 unused */ -#define GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT 628 /** * Create new identity (client->service). @@ -3421,6 +3411,16 @@ extern "C" { #define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_END 1252 /** + * Burst message we send to another peer for hole punching. + */ +#define GNUNET_MESSAGE_TYPE_TRANSPORT_START_BURST 1253 + +/** + * Burst message we send to another peer for hole punching. + */ +#define GNUNET_MESSAGE_TYPE_TRANSPORT_BURST_FINISHED 1254 + +/** * Message exchanged between communicators to confirm * successful KX (and address validation). */ @@ -3644,6 +3644,78 @@ extern "C" { */ #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT_CANCEL 1752 +/*********************************************************************************/ + +/*********************************************************************************/ +/********************************** UTIL (cont.) **************************/ +/*********************************************************************************/ +/* NAMESTORE: message types 1801-1810 + */ + +/** + * Message exchanged between peers for burst synchronisation. + */ +#define GNUNET_TYPE_BURST_SYNC 1801 + + +/*********************************************************************************/ +/********************************* CORE (cont.) ********************************/ +/*********************************************************************************/ +/* CORE: message types 1811-1830 + */ + +/** + * Message exchanged between peers for burst synchronisation. + */ +#define GNUNET_MESSAGE_TYPE_CORE_PEER_ID 1811 + + + +/*********************************************************************************/ +/************************************* PILS ************************************/ +/*********************************************************************************/ +/* PILS: message types 1830-1850 + */ + +/** + * Message passing the new peer id from the service to the client. + */ +#define GNUNET_MESSAGE_TYPE_PILS_PEER_ID 1831 + +/** + * The client requests data to be signed with the peer identity. + */ +#define GNUNET_MESSAGE_TYPE_PILS_SIGN_REQUEST 1832 + +/** + * The service sends the requested signature to the client. + */ +#define GNUNET_MESSAGE_TYPE_PILS_SIGN_RESULT 1833 + +/** + * The client (core) provides new addresses to the service, + * so the service can generate the new peer id. + * (The client does not pass the actual addresses, but rather their hash.) + */ +#define GNUNET_MESSAGE_TYPE_PILS_FEED_ADDRESSES 1834 + +/** + * Decaps request. + */ +#define GNUNET_MESSAGE_TYPE_PILS_KEM_DECAPS 1835 + +/** + * Decaps result. + */ +#define GNUNET_MESSAGE_TYPE_PILS_DECAPS_RESULT 1836 + + +/*********************************************************************************/ +/************************************* FREE ************************************/ +/*********************************************************************************/ +/* message types 1850-65534 + */ + /** * Type used to match 'all' message types. */ diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_service_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_service_lib.h @@ -176,6 +176,7 @@ typedef void * * The service must be stopped using #GNUNET_SERVICE_stop(). * + * @param pd project data for the service * @param service_name name of the service to run * @param cfg configuration to use * @param connect_cb function to call whenever a client connects @@ -187,7 +188,8 @@ typedef void * @return NULL on error */ struct GNUNET_SERVICE_Handle * -GNUNET_SERVICE_start (const char *service_name, +GNUNET_SERVICE_start (const struct GNUNET_OS_ProjectData *pd, + const char *service_name, const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_SERVICE_ConnectHandler connect_cb, GNUNET_SERVICE_DisconnectHandler disconnect_cb, @@ -231,6 +233,7 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv); * dropped. Additionally, clients can be dropped at any time using * #GNUNET_SERVICE_client_drop(). * + * @param pd project data for the service * @param argc number of command-line arguments in @a argv * @param argv array of command-line arguments * @param service_name name of the service to run @@ -245,7 +248,8 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv); * @return 0 on success, non-zero on error */ int -GNUNET_SERVICE_run_ (int argc, +GNUNET_SERVICE_run_ (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, const char *service_name, enum GNUNET_SERVICE_Options options, @@ -284,6 +288,7 @@ GNUNET_SERVICE_run_ (int argc, * dropped. Additionally, clients can be dropped at any time using * #GNUNET_SERVICE_client_drop(). * + * @param pd project data for the service * @param service_name name of the service to run * @param options options controlling shutdown of the service * @param service_init_cb function to call once the service is ready @@ -297,6 +302,7 @@ GNUNET_SERVICE_run_ (int argc, */ int GNUNET_SERVICE_register_ ( + const struct GNUNET_OS_ProjectData *pd, const char *service_name, enum GNUNET_SERVICE_Options options, GNUNET_SERVICE_InitCallback service_init_cb, @@ -364,7 +370,8 @@ GNUNET_SERVICE_register_ ( * </code> */ #ifndef HAVE_GNUNET_MONOLITH -#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, \ +#define GNUNET_SERVICE_MAIN(pd, service_name, service_options, init_cb, \ + connect_cb, \ disconnect_cb, cls, ...) \ int \ main (int argc, \ @@ -373,7 +380,8 @@ GNUNET_SERVICE_register_ ( struct GNUNET_MQ_MessageHandler mh[] = { \ __VA_ARGS__ \ }; \ - return GNUNET_SERVICE_run_ (argc, \ + return GNUNET_SERVICE_run_ (pd, \ + argc, \ argv, \ service_name, \ service_options, \ @@ -384,7 +392,8 @@ GNUNET_SERVICE_register_ ( mh); \ } #else -#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, \ +#define GNUNET_SERVICE_MAIN(pd, service_name, service_options, init_cb, \ + connect_cb, \ disconnect_cb, cls, ...) \ static int __attribute__ ((constructor)) \ init (void) \ @@ -392,7 +401,8 @@ GNUNET_SERVICE_register_ ( struct GNUNET_MQ_MessageHandler mh[] = { \ __VA_ARGS__ \ }; \ - return GNUNET_SERVICE_register_ (service_name, \ + return GNUNET_SERVICE_register_ (pd, \ + service_name, \ service_options, \ init_cb, \ connect_cb, \ @@ -407,9 +417,11 @@ GNUNET_SERVICE_register_ ( * Must be called such that services are actually launched. */ void -GNUNET_SERVICE_main (int argc, +GNUNET_SERVICE_main (const struct GNUNET_OS_ProjectData *pd, + int argc, char *const *argv, - struct GNUNET_CONFIGURATION_Handle *cfg); + struct GNUNET_CONFIGURATION_Handle *cfg, + enum GNUNET_GenericReturnValue with_scheduler); /** * Suspend accepting connections from the listen socket temporarily. @@ -459,8 +471,8 @@ GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c); * @param c client for which to disable the warning */ void -GNUNET_SERVICE_client_disable_continue_warning (struct - GNUNET_SERVICE_Client *c); +GNUNET_SERVICE_client_disable_continue_warning ( + struct GNUNET_SERVICE_Client *c); /** diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_strings_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_strings_lib.h @@ -203,7 +203,7 @@ GNUNET_STRINGS_from_utf8 (const char *input, * * @param input input string * @param output output buffer - * @return GNUNET_OK on success + * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_tolower (const char *input, @@ -286,6 +286,20 @@ GNUNET_STRINGS_buffer_tokenize (const char *buffer, * Note that the returned value will be overwritten if this function * is called again. * + * @param t the timestamp to convert + * @return timestamp in human-readable form in local time + */ +const char * +GNUNET_STRINGS_timestamp_to_string (struct GNUNET_TIME_Timestamp t); + + +/** + * @ingroup time + * Like `asctime`, except for GNUnet time. Converts a GNUnet internal + * absolute time (which is in UTC) to a string in local time. + * Note that the returned value will be overwritten if this function + * is called again. + * * @param t the absolute time to convert * @return timestamp in human-readable form in local time */ @@ -635,25 +649,6 @@ GNUNET_STRINGS_to_address_ip (const char *addr, /** - * Returns utf-8 encoded arguments. Does nothing (returns a copy of - * @a argc and @a argv) on any platform other than W32. Returned @a - * argv has `u8argv[u8argc] == NULL`. Returned @a argv is a single - * memory block, and can be freed with a single GNUNET_free() call. - * - * @param argc argc (as given by main()) - * @param argv argv (as given by main()) - * @param u8argc a location to store new argc in (though it's th same as argc) - * @param u8argv a location to store new argv in - * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure - */ -enum GNUNET_GenericReturnValue -GNUNET_STRINGS_get_utf8_args (int argc, - char *const *argv, - int *u8argc, - char *const **u8argv); - - -/** * Like strlcpy but portable. The given string @a src is copied in full length * (until its null byte). The destination buffer is guaranteed to be * null-terminated. @@ -766,7 +761,7 @@ struct GNUNET_STRINGS_IPv6NetworkPolicy * * @param routeListX a string specifying the IPv4 subnets * @return the converted list, terminated with all zeros; - * NULL if the synatx is flawed + * NULL if the syntax is flawed */ struct GNUNET_STRINGS_IPv4NetworkPolicy * GNUNET_STRINGS_parse_ipv4_policy (const char *routeListX); @@ -781,7 +776,7 @@ GNUNET_STRINGS_parse_ipv4_policy (const char *routeListX); * Note that the netmask is mandatory if ports are specified. * * @param routeListX a string specifying the policy - * @return the converted list, 0-terminated, NULL if the synatx is flawed + * @return the converted list, 0-terminated, NULL if the syntax is flawed */ struct GNUNET_STRINGS_IPv6NetworkPolicy * GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX); diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_time_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_time_lib.h @@ -54,17 +54,19 @@ struct GNUNET_TIME_Absolute { /** * The actual value. + * UINT64_MAX to represents "never". */ uint64_t abs_value_us; }; /** - * Rounded time for timestamps used by GNUnet, in seconds. + * Time for timestamps used by GNUnet, in microseconds rounded to seconds. */ struct GNUNET_TIME_Timestamp { /** - * The actual value. Must be round number in seconds. + * The actual value. Must be a round number of seconds in microseconds, + * or UINT64_MAX to represent "never". */ struct GNUNET_TIME_Absolute abs_time; }; @@ -77,6 +79,7 @@ struct GNUNET_TIME_Relative { /** * The actual value. + * UINT64_MAX represents "forever". */ uint64_t rel_value_us; }; @@ -90,6 +93,7 @@ struct GNUNET_TIME_RelativeNBO { /** * The actual value (in network byte order). + * UINT64_MAX represents "forever". */ uint64_t rel_value_us__ GNUNET_PACKED; }; @@ -102,6 +106,7 @@ struct GNUNET_TIME_AbsoluteNBO { /** * The actual value (in network byte order). + * UINT64_MAX represents "never". */ uint64_t abs_value_us__ GNUNET_PACKED; }; @@ -112,7 +117,8 @@ struct GNUNET_TIME_AbsoluteNBO struct GNUNET_TIME_TimestampNBO { /** - * The actual value. Must be round number in seconds. + * The actual value. Must be round number in seconds *or* + * UINT64_MAX to represent "never". */ struct GNUNET_TIME_AbsoluteNBO abs_time_nbo; }; @@ -163,53 +169,55 @@ GNUNET_NETWORK_STRUCT_END * One day. */ #define GNUNET_TIME_UNIT_DAYS GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_HOURS, 24) + GNUNET_TIME_UNIT_HOURS, 24) /** * One week. */ #define GNUNET_TIME_UNIT_WEEKS GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_DAYS, 7) + GNUNET_TIME_UNIT_DAYS, 7) /** * One month (30 days). */ #define GNUNET_TIME_UNIT_MONTHS GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_DAYS, 30) + GNUNET_TIME_UNIT_DAYS, 30) /** * One year (365 days). */ #define GNUNET_TIME_UNIT_YEARS GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_DAYS, 365) + GNUNET_TIME_UNIT_DAYS, 365) /** * Constant used to specify "forever". This constant * will be treated specially in all time operations. */ #define GNUNET_TIME_UNIT_FOREVER_REL \ - ((struct GNUNET_TIME_Relative){UINT64_MAX}) + ((struct GNUNET_TIME_Relative){UINT64_MAX}) /** * Constant used to specify "forever". This constant * will be treated specially in all time operations. */ #define GNUNET_TIME_UNIT_FOREVER_ABS \ - ((struct GNUNET_TIME_Absolute){UINT64_MAX}) + ((struct GNUNET_TIME_Absolute){UINT64_MAX}) +#define GNUNET_TIME_UNIT_NEVER_ABS \ + ((struct GNUNET_TIME_Absolute){UINT64_MAX}) /** * Constant used to specify "forever". This constant * will be treated specially in all time operations. */ #define GNUNET_TIME_UNIT_FOREVER_TS \ - ((struct GNUNET_TIME_Timestamp){{UINT64_MAX}}) + ((struct GNUNET_TIME_Timestamp){{UINT64_MAX}}) /** * Threshold after which exponential backoff should not increase (15 m). */ #define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD \ - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) /** @@ -219,9 +227,122 @@ GNUNET_NETWORK_STRUCT_END * @param r current backoff time, initially zero */ #define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min ( \ - GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ - GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)) + GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ + GNUNET_TIME_relative_multiply ( \ + GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)) + + +/** + * Quantities by which we support round up absolute time values. + */ +enum GNUNET_TIME_RounderInterval +{ + /** + * No rounding up. + */ + GNUNET_TIME_RI_NONE = 0, + + /** + * Round up to a multiple of seconds. + */ + GNUNET_TIME_RI_SECOND, + + /** + * Round up to the next minute. + */ + GNUNET_TIME_RI_MINUTE, + + /** + * Round up to the next hour. + */ + GNUNET_TIME_RI_HOUR, + + /** + * Round up to the next day. + */ + GNUNET_TIME_RI_DAY, + + /** + * Round up to the next calendar week. + */ + GNUNET_TIME_RI_WEEK, + + /** + * Round up to the next month. + */ + GNUNET_TIME_RI_MONTH, + + /** + * Round up to the next quarter. + */ + GNUNET_TIME_RI_QUARTER, + + /** + * Round up to the next year. + */ + GNUNET_TIME_RI_YEAR +}; + + +/** + * Convert a relative time to the corresponding rounding + * interval. + * + * @param rel relative time to convert + * @return rounding interval, #GNUNET_TIME_RI_NONE if + * either @a rel is zero or if the input does not match exactly + * any of the supported rounding intervals + */ +enum GNUNET_TIME_RounderInterval +GNUNET_TIME_relative_to_round_interval (struct GNUNET_TIME_Relative rel); + + +/** + * Convert rounding interval given as a string to the enum value. + * + * @param ri_str rounding interval as string + * @param[out] ri set to enum value + * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure + */ +enum GNUNET_GenericReturnValue +GNUNET_TIME_string_to_round_interval (const char *ri_str, + enum GNUNET_TIME_RounderInterval *ri); + + +/** + * Convert rounding interval to string. + * + * @param ri the rounding interval + * @return NULL on failure (invalid enum value) + */ +const char * +GNUNET_TIME_round_interval2s (enum GNUNET_TIME_RounderInterval ri); + + +/** + * Round up the given @a at to the interval @a ri. + * NEVER/FOREVER always remains NEVER/FOREVER. + * + * @param at some absolute time to round + * @param ri how much to round up + * @return rounded up value of @a at + */ +struct GNUNET_TIME_Absolute +GNUNET_TIME_round_up (struct GNUNET_TIME_Absolute at, + enum GNUNET_TIME_RounderInterval ri); + + +/** + * Round @at down to the start of the next interval @a ri. + * NEVER/FOREVER always remains NEVER/FOREVER. + * + * @param at some absolute time to round + * @param ri how much to round down + * @return rounded up value of @a at + */ +struct GNUNET_TIME_Absolute +GNUNET_TIME_round_down (struct GNUNET_TIME_Absolute at, + enum GNUNET_TIME_RounderInterval ri); /** @@ -411,7 +532,7 @@ GNUNET_TIME_timestamp_get (void); * @return true if @a t1 @a op @a t2 */ #define GNUNET_TIME_absolute_cmp(t1,op,t2) \ - ((void) (1 op 2), (t1).abs_value_us op (t2).abs_value_us) + ((void) (1 op 2), (t1).abs_value_us op (t2).abs_value_us) /** @@ -423,7 +544,7 @@ GNUNET_TIME_timestamp_get (void); * @return true if @a t1 @a op @a t2 */ #define GNUNET_TIME_timestamp_cmp(t1,op,t2) \ - GNUNET_TIME_absolute_cmp ((t1).abs_time,op,(t2).abs_time) + GNUNET_TIME_absolute_cmp ((t1).abs_time,op,(t2).abs_time) /** @@ -435,7 +556,7 @@ GNUNET_TIME_timestamp_get (void); * @return true if @a t1 @a op @a t2 */ #define GNUNET_TIME_relative_cmp(t1,op,t2) \ - ((void) (1 op 2), (t1).rel_value_us op (t2).rel_value_us) + ((void) (1 op 2), (t1).rel_value_us op (t2).rel_value_us) /** diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_tun_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_tun_lib.h @@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL3.0-or-later */ -#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) +#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__) #error "Only <gnunet_util_lib.h> can be included directly." #endif @@ -59,7 +59,7 @@ /** - * Maximum regex string length for use with #GNUNET_TUN_ipv4toregexsearch. + * Maximum regex string length for use with #GNUNET_REGEX_ipv4toregexsearch. * * 8 bytes for IPv4, 4 bytes for port, 1 byte for "4", 2 bytes for "-", * one byte for 0-termination. @@ -69,7 +69,7 @@ /** - * Maximum regex string length for use with #GNUNET_TUN_ipv6toregexsearch + * Maximum regex string length for use with #GNUNET_REGEX_ipv6toregexsearch * * 32 bytes for IPv4, 4 bytes for port, 1 byte for "4", 2 bytes for "-", * one byte for 0-termination. @@ -876,60 +876,6 @@ GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, /** - * Create a regex in @a rxstr from the given @a ip and @a port. - * - * @param ip IPv4 representation. - * @param port destination port - * @param rxstr generated regex, must be at least #GNUNET_TUN_IPV4_REGEXLEN - * bytes long. - */ -void -GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, - uint16_t port, - char *rxstr); - - -/** - * Create a regex in @a rxstr from the given @a ipv6 and @a port. - * - * @param ipv6 IPv6 representation. - * @param port destination port - * @param rxstr generated regex, must be at least #GNUNET_TUN_IPV6_REGEXLEN - * bytes long. - */ -void -GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6, - uint16_t port, - char *rxstr); - - -/** - * Convert an exit policy to a regular expression. The exit policy - * specifies a set of subnets this peer is willing to serve as an - * exit for; the resulting regular expression will match the - * IPv6 address strings as returned by #GNUNET_TUN_ipv6toregexsearch. - * - * @param policy exit policy specification - * @return regular expression, NULL on error - */ -char * -GNUNET_TUN_ipv6policy2regex (const char *policy); - - -/** - * Convert an exit policy to a regular expression. The exit policy - * specifies a set of subnets this peer is willing to serve as an - * exit for; the resulting regular expression will match the - * IPv4 address strings as returned by #GNUNET_TUN_ipv4toregexsearch. - * - * @param policy exit policy specification - * @return regular expression, NULL on error - */ -char * -GNUNET_TUN_ipv4policy2regex (const char *policy); - - -/** * Hash the service name of a hosted service to the * hash code that is used to identify the service on * the network. diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_util_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_util_lib.h @@ -77,6 +77,7 @@ extern "C" #include "gnunet_helper_lib.h" #include "gnunet_mst_lib.h" #include "gnunet_mq_lib.h" +#include "gnunet_nat_lib.h" #include "gnunet_nt_lib.h" #include "gnunet_nc_lib.h" #include "gnunet_os_lib.h"