30#include "gnunet_signatures.h"
57 "UBLOCK-ENC", strlen (
"UBLOCK-ENC"),
58 label, strlen (label),
147 uc->cont (
uc->cont_cls, NULL);
187 slen = strlen (uris) + 1;
191 ulen = strlen (ulabel) + 1;
192 size = mdsize +
sizeof(
struct UBlock) + slen + ulen;
196 mdsize =
size -
sizeof(
struct UBlock) - (slen + ulen);
199 kbe = (
char *) &ub_plain[1];
215 cont (cont_cls,
_ (
"Internal error."));
218 size =
sizeof(
struct UBlock) + slen + mdsize + ulen;
221 "Publishing under identifier `%s'\n",
232 ulen + slen + mdsize,
256 uc->cont_cls = cont_cls;
263 ulen + slen + mdsize +
sizeof(
struct UBlock),
293 if (NULL !=
uc->task)
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MessageHeader * msg
shared definitions for the FS library
static void run_cont(void *cls)
Run the continuation.
static void derive_ublock_encryption_key(struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const char *label, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Derive the key for symmetric encryption/decryption from the public key and the label.
void GNUNET_FS_ublock_decrypt_(const void *input, size_t input_len, const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *label, void *output)
Decrypt the given UBlock, storing the result in output.
void GNUNET_FS_publish_ublock_cancel_(struct GNUNET_FS_PublishUblockContext *uc)
Abort UBlock publishing operation.
static void ublock_put_cont(void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation of GNUNET_FS_publish_ublock_().
struct GNUNET_FS_PublishUblockContext * GNUNET_FS_publish_ublock_(struct GNUNET_FS_Handle *h, struct GNUNET_DATASTORE_Handle *dsh, const char *label, const char *ulabel, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_UBlockContinuation cont, void *cont_cls)
Publish a UBlock.
publish a UBLOCK in GNUnet
void(* GNUNET_FS_UBlockContinuation)(void *cls, const char *emsg)
Signature of a function called as the continuation of a UBlock publication.
Merkle-tree-ish-CHK file encoding for GNUnet.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_NAMECACHE_Handle * ns
Handle to the namecache.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static struct GNUNET_FS_MetaData * meta
Meta-data provided via command-line option.
static struct GNUNET_FS_BlockOptions bo
Options we set for published blocks.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
static struct GNUNET_TIME_Absolute min_expiration
Minimum time that content should have to not be discarded instantly (time stamp of any content that w...
static struct GNUNET_DATASTORE_Handle * dsh
Datastore handle.
static struct GNUNET_FS_UnindexContext * uc
#define MAX_UBLOCK_SIZE
Maximum legal size for a ublock.
struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_private_key_derive(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const char *label, const char *context)
Derive a private key from a given private key and a label.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
ECDSA Sign a given block.
ssize_t GNUNET_CRYPTO_symmetric_encrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Encrypt a block using a symmetric sessionkey.
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
ssize_t GNUNET_CRYPTO_symmetric_decrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Decrypt a given block using a symmetric sessionkey.
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_put(struct GNUNET_DATASTORE_Handle *h, uint32_t rid, const struct GNUNET_HashCode *key, size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the datastore.
GNUNET_FS_PublishOptions
Options for publishing.
char * GNUNET_FS_uri_to_string(const struct GNUNET_FS_Uri *uri)
Convert a URI to a UTF-8 String.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
void GNUNET_CRYPTO_hash_to_aes_key(const struct GNUNET_HashCode *hc, struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
Convert a hashcode into a key.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
static unsigned int size
Size of the "table".
@ GNUNET_BLOCK_TYPE_FS_UBLOCK
Type of a block representing any type of search result (universal).
#define GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK
UBlock Signature, done using DSS, not ECC (GNUnet-FS)
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!...
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
an ECC signature using ECDSA
Handle to the datastore service.
Entry in our priority queue.
Settings for publishing a block (which may of course also apply to an entire directory or file).
uint32_t anonymity_level
At which anonymity level should the block be shared? (0: no anonymity, 1: normal GAP,...
uint32_t content_priority
How important is it for us to store the block? If we run out of space, the highest-priority,...
uint32_t replication_level
How often should we try to migrate the block to other peers? Only used if "CONTENT_PUSHING" is set to...
struct GNUNET_TIME_Absolute expiration_time
At what time should the block expire? Data blocks (DBLOCKS and IBLOCKS) may still be used even if the...
Master context for most FS operations.
Context for 'ublock_put_cont'.
struct GNUNET_DATASTORE_QueueEntry * qre
Handle for active datastore operation.
void * cont_cls
Closure of 'cont'.
struct GNUNET_SCHEDULER_Task * task
Task to run continuation asynchronously.
GNUNET_FS_UBlockContinuation cont
Function to call when done.
A Universal Resource Identifier (URI), opaque.
Entry in list of pending tasks.
Time for absolute times used by GNUnet, in microseconds.
universal block for keyword and namespace search results
struct GNUNET_CRYPTO_EcdsaPublicKey verification_key
Public key used to sign this block.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
What is being signed and why?
struct GNUNET_CRYPTO_EcdsaSignature signature
Signature using pseudonym and search keyword / identifier.