publish a UBLOCK in GNUnet More...
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "fs_publish_ublock.h"
#include "fs_api.h"
#include "fs_tree.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_FS_PublishUblockContext |
Context for 'ublock_put_cont'. More... | |
Functions | |
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. More... | |
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. More... | |
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_(). More... | |
static void | run_cont (void *cls) |
Run the continuation. More... | |
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. More... | |
void | GNUNET_FS_publish_ublock_cancel_ (struct GNUNET_FS_PublishUblockContext *uc) |
Abort UBlock publishing operation. More... | |
publish a UBLOCK in GNUnet
Definition in file fs_publish_ublock.c.
|
static |
Derive the key for symmetric encryption/decryption from the public key and the label.
skey | where to store symmetric key |
iv | where to store the IV |
label | label to use for key derivation |
pub | public key to use for key derivation |
Definition at line 46 of file fs_publish_ublock.c.
References GNUNET_assert, GNUNET_CRYPTO_hash_to_aes_key(), GNUNET_CRYPTO_kdf(), GNUNET_YES, key, and pub.
Referenced by GNUNET_FS_publish_ublock_(), and GNUNET_FS_ublock_decrypt_().
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.
input | input data |
input_len | number of bytes in input |
ns | public key under which the UBlock was stored |
label | label under which the UBlock was stored |
output | where to write the result, has input_len bytes |
Definition at line 66 of file fs_publish_ublock.c.
References derive_ublock_encryption_key(), GNUNET_CRYPTO_symmetric_decrypt(), and ns.
Referenced by decrypt_block_with_keyword(), process_kblock_for_unindex(), and process_sblock().
|
static |
Continuation of GNUNET_FS_publish_ublock_().
cls | closure of type "struct GNUNET_FS_PublishUblockContext*" |
success | GNUNET_SYSERR on failure (including timeout/queue drop) GNUNET_NO if content was already there GNUNET_YES (or other positive value) on success |
min_expiration | minimum expiration time required for 0-priority content to be stored by the datacache at this time, zero for unknown, forever if we have no space for 0-priority content |
msg | NULL on success, otherwise an error message |
Definition at line 123 of file fs_publish_ublock.c.
References GNUNET_free, msg, and uc.
Referenced by GNUNET_FS_publish_ublock_().
|
static |
Run the continuation.
cls | the struct GNUNET_FS_PublishUblockContext * |
Definition at line 142 of file fs_publish_ublock.c.
References GNUNET_free, and uc.
Referenced by 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.
h | handle to the file sharing subsystem |
dsh | datastore handle to use for storage operation |
label | identifier to use |
ulabel | update label to use, may be an empty string for none |
ns | namespace to publish in |
meta | metadata to use |
uri | URI to refer to in the UBlock |
bo | per-block options |
options | publication options |
cont | continuation |
cont_cls | closure for cont |
Definition at line 153 of file fs_publish_ublock.c.
References _, GNUNET_FS_BlockOptions::anonymity_level, bo, GNUNET_FS_BlockOptions::content_priority, derive_ublock_encryption_key(), dsh, GNUNET_FS_BlockOptions::expiration_time, GNUNET_assert, GNUNET_BLOCK_TYPE_FS_UBLOCK, GNUNET_break, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_ecdsa_sign_(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_symmetric_encrypt(), GNUNET_DATASTORE_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_meta_data_get_serialized_size(), GNUNET_FS_meta_data_serialize(), GNUNET_FS_META_DATA_SERIALIZE_PART, GNUNET_FS_uri_to_string(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_new, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, MAX_UBLOCK_SIZE, meta, ns, pub, UBlock::purpose, GNUNET_CRYPTO_EccSignaturePurpose::purpose, GNUNET_FS_BlockOptions::replication_level, run_cont(), UBlock::signature, GNUNET_CRYPTO_EccSignaturePurpose::size, size, ublock_put_cont(), uc, uri, and UBlock::verification_key.
Referenced by GNUNET_FS_publish_sks(), and publish_ksk_cont().
void GNUNET_FS_publish_ublock_cancel_ | ( | struct GNUNET_FS_PublishUblockContext * | uc | ) |
Abort UBlock publishing operation.
uc | operation to abort. |
Definition at line 289 of file fs_publish_ublock.c.
References GNUNET_DATASTORE_cancel(), GNUNET_free, GNUNET_SCHEDULER_cancel(), and uc.
Referenced by GNUNET_FS_publish_ksk_cancel(), and GNUNET_FS_publish_sks_cancel().