libtc  20160415
Threshold Cryptography functions library
tc_internal.h
Go to the documentation of this file.
1 #ifndef TC_INTERNAL_H
2 # define TC_INTERNAL_H
3 
4 #include <stddef.h>
5 
6 #include "tc.h"
7 
8 struct public_key {
9  bytes_t * n;
11 };
12 
13 struct key_metainfo {
15  uint16_t k;
16  uint16_t l;
20 };
21 
22 struct key_share {
25  uint16_t id;
26 };
27 
32  uint16_t id;
33 };
34 
35 
36 #define TC_GET_OCTETS(z, bcount, op) mpz_import(z, bcount, 1, 1, 0, 0, op)
37 #define TC_TO_OCTETS(count, op) mpz_export(NULL, count, 1, 1, 0, 0, op)
38 #define TC_ID_TO_INDEX(id) (id-1)
39 
40 #define TC_MPZ_TO_BYTES(bytes, z) \
41  do { bytes_t * b = (bytes); size_t * len = (size_t*)&b->data_len; b->data = TC_TO_OCTETS(len, z); } while(0)
42 #define TC_BYTES_TO_MPZ(z, bytes) \
43  do { const bytes_t * __b = (bytes); size_t len = __b->data_len; mpz_import(z, len, 1, 1, 0, 0, __b->data); } while(0)
44 
45 void *alloc(size_t size);
47 key_metainfo_t *tc_init_key_metainfo(uint16_t k, uint16_t l);
51 
52 #endif
public_key_t * public_key
Definition: tc_internal.h:14
bytes_t * c
Definition: tc_internal.h:30
bytes_t * s_i
Definition: tc_internal.h:23
bytes_t * n
Definition: tc_internal.h:24
Structure that&#39;s stores a pointer that points to data_len bytes.
Definition: tc.h:14
Structure that represents a signature share, to be joined generating a standard RSA signatures...
Definition: tc_internal.h:28
bytes_t * n
Definition: tc_internal.h:9
Structure that represents the data about a key share, including its public key.
Definition: tc_internal.h:13
bytes_t * vk_i
Definition: tc_internal.h:19
uint16_t id
Definition: tc_internal.h:25
bytes_t * z
Definition: tc_internal.h:31
Structure that represents a standard RSA public key. Used to verify signatures.
Definition: tc_internal.h:8
bytes_t * vk_v
Definition: tc_internal.h:17
public_key_t * tc_init_public_key()
Definition: structs_init.c:75
uint16_t k
Definition: tc_internal.h:15
uint16_t l
Definition: tc_internal.h:16
key_share_t ** tc_init_key_shares(key_metainfo_t *info)
Definition: structs_init.c:154
key_share_t * tc_init_key_share()
Definition: structs_init.c:145
signature_share_t * tc_init_signature_share()
Definition: structs_init.c:180
bytes_t * vk_u
Definition: tc_internal.h:18
void * alloc(size_t size)
Definition: structs_init.c:9
Structure that represents one key share, to be used to generate a signature share.
Definition: tc_internal.h:22
key_metainfo_t * tc_init_key_metainfo(uint16_t k, uint16_t l)
Definition: structs_init.c:90
bytes_t * x_i
Definition: tc_internal.h:29
bytes_t * e
Definition: tc_internal.h:10