simplify encrypt_bid

This commit is contained in:
Markus Teich 2016-10-12 19:19:45 +02:00
parent 6654fc3c01
commit b4694f8d06

View File

@ -714,6 +714,8 @@ smc_encrypt_bid (struct BRANDT_Auction *ad, size_t *buflen)
(sizeof (struct ec_mpi) * 2 + (sizeof (struct ec_mpi) * 2 +
sizeof (*proof3)) + sizeof (*proof3)) +
sizeof (struct proof_2dle)); /* proof2 */ sizeof (struct proof_2dle)); /* proof2 */
if (0 < ad->m)
*buflen += sizeof (struct proof_2dle);
ret = GNUNET_new_array (*buflen, unsigned char); ret = GNUNET_new_array (*buflen, unsigned char);
head = (struct msg_head *)ret; head = (struct msg_head *)ret;
@ -750,11 +752,7 @@ smc_encrypt_bid (struct BRANDT_Auction *ad, size_t *buflen)
* subset of bids as well */ * subset of bids as well */
if (0 < ad->m) if (0 < ad->m)
{ {
struct proof_2dle *proof2; struct proof_2dle *proof2 = (struct proof_2dle *)(ret + *buflen) - 1;
*buflen += sizeof (struct proof_2dle);
ret = GNUNET_realloc (ret, *buflen);
proof2 = (struct proof_2dle *)(ret + *buflen -
sizeof (struct proof_2dle));
smc_zkp_2dle (NULL, NULL, ad->Y, ec_gen, r_sum2, proof2); smc_zkp_2dle (NULL, NULL, ad->Y, ec_gen, r_sum2, proof2);
} }