26 mpz_t x, n, e, s_i, v, u, vk_i, xi, xi_2, r, v_prime, x_tilde, x_prime, c, z;
27 mpz_inits(x, n, e, s_i, v, u, vk_i, xi, xi_2, r, v_prime, x_tilde, x_prime, c, z, NULL);
37 const unsigned long n_bits = mpz_sizeinbase(n, 2);
40 if(mpz_jacobi(x, n) == -1) {
43 mpz_powm(ue, u, e, n);
50 mpz_mul_ui(xi, s_i, 2);
51 mpz_powm(xi, x, xi, n);
54 mpz_powm_ui(xi_2, xi, 2, n);
60 mpz_powm(v_prime, v, r, n);
63 mpz_powm_ui(x_tilde, x, 4ul, n);
66 mpz_powm(x_prime, x_tilde, r, n);
69 size_t v_len, u_len, x_tilde_len, v_i_len, xi_2_len, v_prime_len, x_prime_len;
74 void * x_tilde_bytes =
TC_TO_OCTETS(&x_tilde_len, x_tilde);
77 void * v_prime_bytes =
TC_TO_OCTETS(&v_prime_len, v_prime);
78 void * x_prime_bytes =
TC_TO_OCTETS(&x_prime_len, x_prime);
83 MHASH sha = mhash_init(MHASH_SHA256);
85 mhash(sha, v_bytes, v_len);
86 mhash(sha, u_bytes, u_len);
87 mhash(sha, x_tilde_bytes, x_tilde_len);
88 mhash(sha, v_i_bytes, v_i_len);
89 mhash(sha, xi_2_bytes, xi_2_len);
90 mhash(sha, v_prime_bytes, v_prime_len);
91 mhash(sha, x_prime_bytes, x_prime_len);
93 mhash_deinit(sha, hash);
95 void (*freefunc) (
void *, size_t);
96 mp_get_memory_functions (NULL, NULL, &freefunc);
98 freefunc(v_bytes, v_len);
99 freefunc(u_bytes, u_len);
100 freefunc(x_tilde_bytes, x_tilde_len);
101 freefunc(v_i_bytes, v_i_len);
102 freefunc(xi_2_bytes, xi_2_len);
103 freefunc(v_prime_bytes, v_prime_len);
104 freefunc(x_prime_bytes, x_prime_len);
118 mpz_clears(x, n, e, s_i, v, u, vk_i, xi, xi_2, r, v_prime, x_tilde, x_prime, c, z, NULL);
#define TC_ID_TO_INDEX(id)
Structure that's stores a pointer that points to data_len bytes.
Structure that represents a signature share, to be joined generating a standard RSA signatures...
signature_share_t * tc_node_sign(const key_share_t *share, const bytes_t *doc, const key_metainfo_t *info)
void random_dev(mpz_t rop, int bit_len)
const unsigned int HASH_LEN
#define TC_GET_OCTETS(z, bcount, op)
signature_share_t * tc_init_signature_share()
#define TC_BYTES_TO_MPZ(z, bytes)
void * alloc(size_t size)
Structure that represents one key share, to be used to generate a signature share.
#define TC_TO_OCTETS(count, op)
#define TC_MPZ_TO_BYTES(bytes, z)