10 mpz_t x, xi, z, c, n, e, v, u, vk_i, delta, xtilde, xi2, neg_c, v_prime, xi_neg_2c, x_prime, aux;
11 mpz_inits(x, xi, z, c, n, e, v, u, vk_i, delta, xtilde, xi2, neg_c, v_prime, xi_neg_2c, x_prime, aux, NULL);
25 if(mpz_jacobi(x, n) == -1) {
28 mpz_powm(ue, u, e, n);
39 mpz_powm_ui(xtilde, x, 4ul, n);
44 mpz_powm_ui(xi2, xi, 2, n);
49 mpz_powm(v_prime, vk_i, neg_c, n);
51 mpz_powm(aux, v, z, n);
52 mpz_mul(v_prime, v_prime, aux);
53 mpz_mod(v_prime, v_prime, n);
57 mpz_mul_si(aux, neg_c, 2);
58 mpz_powm(xi_neg_2c, xi, aux, n);
60 mpz_powm(aux, xtilde, z, n);
61 mpz_mul(x_prime, aux, xi_neg_2c);
62 mpz_mod(x_prime, x_prime, n);
64 size_t v_len, u_len, xtilde_len, v_i_len, xi2_len, v_prime_len, x_prime_len;
71 void * v_prime_bytes =
TC_TO_OCTETS(&v_prime_len, v_prime);
72 void * x_prime_bytes =
TC_TO_OCTETS(&x_prime_len, x_prime);
77 MHASH sha = mhash_init(MHASH_SHA256);
79 mhash(sha, v_bytes, v_len);
80 mhash(sha, u_bytes, u_len);
81 mhash(sha, xtilde_bytes, xtilde_len);
82 mhash(sha, v_i_bytes, v_i_len);
83 mhash(sha, xi2_bytes, xi2_len);
84 mhash(sha, v_prime_bytes, v_prime_len);
85 mhash(sha, x_prime_bytes, x_prime_len);
87 mhash_deinit(sha, hash);
89 void (*freefunc) (
void *, size_t);
90 mp_get_memory_functions (NULL, NULL, &freefunc);
92 freefunc(v_bytes, v_len);
93 freefunc(u_bytes, u_len);
94 freefunc(xtilde_bytes, xtilde_len);
95 freefunc(v_i_bytes, v_i_len);
96 freefunc(xi2_bytes, xi2_len);
97 freefunc(v_prime_bytes, v_prime_len);
98 freefunc(x_prime_bytes, x_prime_len);
104 int result = mpz_cmp(h, c);
107 mpz_clears(x, xi, z, c, n, e, v, u, vk_i, delta, xtilde, xi2, neg_c, v_prime, xi_neg_2c, x_prime, aux, 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...
#define TC_GET_OCTETS(z, bcount, op)
const unsigned int HASH_LEN
#define TC_BYTES_TO_MPZ(z, bytes)
int tc_verify_signature(const signature_share_t *signature, const bytes_t *doc, const key_metainfo_t *info)
#define TC_TO_OCTETS(count, op)