libtc  20160415
Threshold Cryptography functions library
Functions
structs_init.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tc_internal.h"

Go to the source code of this file.

Functions

void * alloc (size_t size)
 
bytes_ttc_init_bytes (void *bs, size_t len)
 
bytes_ttc_init_bytes_copy (void *bs, size_t len)
 
void tc_clear_bytes (bytes_t *bytes)
 
void * tc_release_bytes (bytes_t *bytes, uint32_t *len)
 
void tc_clear_bytes_n (bytes_t *bytes,...)
 
public_key_ttc_init_public_key ()
 
void tc_clear_public_key (public_key_t *pk)
 
key_metainfo_ttc_init_key_metainfo (uint16_t k, uint16_t l)
 
int tc_key_meta_info_k (const key_metainfo_t *i)
 
int tc_key_meta_info_l (const key_metainfo_t *i)
 
const public_key_ttc_key_meta_info_public_key (const key_metainfo_t *i)
 
int tc_key_share_id (const key_share_t *k)
 
const bytes_ttc_public_key_n (const public_key_t *pk)
 
const bytes_ttc_public_key_e (const public_key_t *pk)
 
int tc_signature_share_id (const signature_share_t *s)
 
void tc_clear_key_metainfo (key_metainfo_t *info)
 
key_share_ttc_init_key_share ()
 
key_share_t ** tc_init_key_shares (key_metainfo_t *info)
 
void tc_clear_key_share (key_share_t *share)
 
void tc_clear_key_shares (key_share_t **shares, key_metainfo_t *info)
 
signature_share_ttc_init_signature_share ()
 
void tc_clear_signature_share (signature_share_t *ss)
 

Function Documentation

void* alloc ( size_t  size)

Definition at line 9 of file structs_init.c.

void tc_clear_bytes ( bytes_t bytes)

Clears the memory stored in bytes and its structure.

Definition at line 39 of file structs_init.c.

void tc_clear_bytes_n ( bytes_t bytes,
  ... 
)

Clears several bytes_t structures at once. The parameter list should end with a NULL sentinel.

Definition at line 61 of file structs_init.c.

void tc_clear_key_metainfo ( key_metainfo_t info)

Clears the memory of the structure

Definition at line 136 of file structs_init.c.

void tc_clear_key_share ( key_share_t share)

Clears the memory of the structure

Definition at line 167 of file structs_init.c.

void tc_clear_key_shares ( key_share_t **  shares,
key_metainfo_t info 
)

Clears the memory of all the key shares in the shares structure

Definition at line 172 of file structs_init.c.

void tc_clear_public_key ( public_key_t pk)

Definition at line 85 of file structs_init.c.

void tc_clear_signature_share ( signature_share_t ss)

Clears the memory of the structure

Definition at line 191 of file structs_init.c.

bytes_t* tc_init_bytes ( void *  bs,
size_t  len 
)

Function that allocates and initialize a bytes_t structure that contains len bytes in the bs pointer. The bytes_t structure will own the data pointed by bs. Any bytes_t structure initialized by this function should be deinitialized by tc_clear_bytes.

Parameters
[in]bspointer to data
[in]lendata stored in len
Returns
a new bytes_t structure that stores bs with its len

Definition at line 18 of file structs_init.c.

bytes_t* tc_init_bytes_copy ( void *  bs,
size_t  len 
)

Function that allocates and initialize a bytes_t structure that contains a copy of the len bytes stored by the bs pointer. The data stored in the structure is a copy of the original data. Any bytes_t structure initialized by this function should be deinitialized by tc_clear_bytes.

Parameters
[in]bspointer to data
[in]lendata stored in len
Returns
a new bytes_t structure that stores a copy of bs with its len

Definition at line 26 of file structs_init.c.

key_metainfo_t* tc_init_key_metainfo ( uint16_t  k,
uint16_t  l 
)

Definition at line 90 of file structs_init.c.

key_share_t* tc_init_key_share ( )

Definition at line 145 of file structs_init.c.

key_share_t** tc_init_key_shares ( key_metainfo_t info)

Definition at line 154 of file structs_init.c.

public_key_t* tc_init_public_key ( )

Definition at line 75 of file structs_init.c.

signature_share_t* tc_init_signature_share ( )

Definition at line 180 of file structs_init.c.

int tc_key_meta_info_k ( const key_metainfo_t i)
Parameters
[in]ithe metainfo of the key shares array.
Returns
the threshold number of the key shares array.

Definition at line 108 of file structs_init.c.

int tc_key_meta_info_l ( const key_metainfo_t i)
Parameters
[in]ithe metainfo of the key shares array.
Returns
the number of key shares in the originally generated key shares array.

Definition at line 112 of file structs_init.c.

const public_key_t* tc_key_meta_info_public_key ( const key_metainfo_t i)
Parameters
[in]ithe metainfo of the key shares array.
Returns
the public key structure of the key shares array

Definition at line 116 of file structs_init.c.

int tc_key_share_id ( const key_share_t k)
Parameters
[in]ka key share.
Returns
the id of the node that stores that key share

Definition at line 120 of file structs_init.c.

const bytes_t* tc_public_key_e ( const public_key_t pk)
Parameters
[in]pka public key.
Returns
the public exponent of the RSA public key.

Definition at line 128 of file structs_init.c.

const bytes_t* tc_public_key_n ( const public_key_t pk)
Parameters
[in]pka public key.
Returns
the modulus of the RSA public key.

Definition at line 124 of file structs_init.c.

void* tc_release_bytes ( bytes_t bytes,
uint32_t *  len 
)

Clears just the bytes structure, and returns a pointer to bytes' data.

Parameters
[in]bytesthe bytes_t structure to be freed.
[out]lena pointer to store the length of the data stored in bytes.
Returns
a pointer to the data stored by bytes

Definition at line 44 of file structs_init.c.

int tc_signature_share_id ( const signature_share_t s)
Parameters
[in]sa signature share.
Returns
the id of the node that generated the signature share.

Definition at line 132 of file structs_init.c.