libhcs
|
This is a structure which is designed to hold a number of shares. More...
#include <gmp.h>
Go to the source code of this file.
Data Structures | |
struct | hcs_shares |
Stores a number of shares, with flags indicating if they are currently to be counted. More... | |
Functions | |
hcs_shares * | hcs_init_shares (unsigned long size) |
Initialise a hcs_shares and return a pointer to the newly created structure. More... | |
void | hcs_set_share (hcs_shares *hs, mpz_t value, unsigned long index) |
Set a share value for the server given by id index . More... | |
void | hcs_set_flag (hcs_shares *hs, unsigned long index) |
Set the flag on hs at index . More... | |
void | hcs_clear_flag (hcs_shares *hs, unsigned long index) |
Clear the flag on hs at index . More... | |
void | hcs_toggle_flag (hcs_shares *hs, unsigned long index) |
Toggle the flag on hs at index . More... | |
int | hcs_tst_flag (hcs_shares *hs, unsigned long index) |
Test if the server given by index is to be counted. More... | |
void | hcs_free_shares (hcs_shares *hs) |
Frees a hcs_shares and all associated memory. More... | |
This is a structure which is designed to hold a number of shares.
It can be thought of as an array of mpz_t values, each with a corresponding bit which signals if the particular value of the share should be counted when combining shares. This is used by all threshold encryption schemes.
The rationale for this is that one may want to test a number of different combinations of shares, and setting a flag simplifies this process.
hcs_shares* hcs_init_shares | ( | unsigned long | size | ) |
Initialise a hcs_shares and return a pointer to the newly created structure.
size | The number of shares this hcs_shares should store |
void hcs_set_share | ( | hcs_shares * | hs, |
mpz_t | value, | ||
unsigned long | index | ||
) |
Set a share value for the server given by id index
.
index
should be less than hs->size
. It is up to the caller to enforce this. The owner of this hs
should have a mapping of server id's to indices, as it is required by a number of other functions involved in threshold system.
hs | A pointer to an initialised hcs_shares |
value | Share stored in an mpz_t variable |
index | Index of the server to store this share in |
void hcs_set_flag | ( | hcs_shares * | hs, |
unsigned long | index | ||
) |
Set the flag on hs
at index
.
This share will then be counted by any share combinining functions that are subsequently called.
hs | A pointer to an initialised hcs_shares |
index | Index of the server to set |
void hcs_clear_flag | ( | hcs_shares * | hs, |
unsigned long | index | ||
) |
Clear the flag on hs
at index
.
This share will NOT be counted by any share combining functions that are subsequently called.
hs | A pointer to an initialised hcs_shares |
index | Index of the server to clear |
void hcs_toggle_flag | ( | hcs_shares * | hs, |
unsigned long | index | ||
) |
Toggle the flag on hs
at index
.
hs | A pointer to an initialised hcs_shares |
index | Index of the server to clear |
int hcs_tst_flag | ( | hcs_shares * | hs, |
unsigned long | index | ||
) |
Test if the server given by index
is to be counted.
hs | A pointer to an initialised hcs_shares |
index | Index of the server to clear |
void hcs_free_shares | ( | hcs_shares * | hs | ) |
Frees a hcs_shares and all associated memory.
hs | A pointer to an initialised hcs_shares |