aboutsummaryrefslogtreecommitdiff
path: root/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto.c')
-rw-r--r--crypto.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/crypto.c b/crypto.c
index eb7e944..600fbb8 100644
--- a/crypto.c
+++ b/crypto.c
@@ -816,12 +816,12 @@ quit:
816void 816void
817fp_pub_prep_outcome (struct BRANDT_Auction *ad) 817fp_pub_prep_outcome (struct BRANDT_Auction *ad)
818{ 818{
819 gcry_mpi_t coeff = gcry_mpi_copy (GCRYMPI_CONST_ONE); 819 gcry_mpi_t coeff = gcry_mpi_copy (GCRYMPI_CONST_ONE);
820 gcry_mpi_point_t tmp = gcry_mpi_point_new (0); 820 gcry_mpi_point_t tmp = gcry_mpi_point_new (0);
821 gcry_mpi_point_t *tlta1; 821 gcry_mpi_point_t *tlta1;
822 gcry_mpi_point_t *tltb1; 822 gcry_mpi_point_t *tltb1;
823 gcry_mpi_point_t **tlta2; 823 gcry_mpi_point_t **tlta2;
824 gcry_mpi_point_t **tltb2; 824 gcry_mpi_point_t **tltb2;
825 825
826 ad->gamma2 = smc_init2 (ad->n, ad->k); 826 ad->gamma2 = smc_init2 (ad->n, ad->k);
827 brandt_assert (ad->gamma2); 827 brandt_assert (ad->gamma2);
@@ -1045,7 +1045,7 @@ quit:
1045void 1045void
1046fp_pub_prep_decryption (struct BRANDT_Auction *ad) 1046fp_pub_prep_decryption (struct BRANDT_Auction *ad)
1047{ 1047{
1048 gcry_mpi_point_t tmp = gcry_mpi_point_new (0); 1048 gcry_mpi_point_t tmp = gcry_mpi_point_new (0);
1049 1049
1050 ad->phi2 = smc_init2 (ad->n, ad->k); 1050 ad->phi2 = smc_init2 (ad->n, ad->k);
1051 brandt_assert (ad->phi2); 1051 brandt_assert (ad->phi2);
@@ -1162,15 +1162,16 @@ quit:
1162} 1162}
1163 1163
1164 1164
1165struct BRANDT_Result *fp_pub_determine_outcome (struct BRANDT_Auction *ad, 1165struct BRANDT_Result *
1166 uint16_t *len) 1166fp_pub_determine_outcome (struct BRANDT_Auction *ad,
1167 uint16_t *len)
1167{ 1168{
1168 struct BRANDT_Result *ret; 1169 struct BRANDT_Result *ret;
1169 int32_t price = -1; 1170 int32_t price = -1;
1170 int32_t winner = -1; 1171 int32_t winner = -1;
1171 int dlogi = -1; 1172 int dlogi = -1;
1172 gcry_mpi_point_t sum_gamma = gcry_mpi_point_new (0); 1173 gcry_mpi_point_t sum_gamma = gcry_mpi_point_new (0);
1173 gcry_mpi_point_t sum_phi = gcry_mpi_point_new (0); 1174 gcry_mpi_point_t sum_phi = gcry_mpi_point_new (0);
1174 1175
1175 brandt_assert (ad); 1176 brandt_assert (ad);
1176 1177
@@ -1208,7 +1209,7 @@ struct BRANDT_Result *fp_pub_determine_outcome (struct BRANDT_Auction *ad,
1208 if (-1 == winner || -1 == price) 1209 if (-1 == winner || -1 == price)
1209 return NULL; 1210 return NULL;
1210 1211
1211 ret = GNUNET_new(struct BRANDT_Result); 1212 ret = GNUNET_new (struct BRANDT_Result);
1212 ret->bidder = winner; 1213 ret->bidder = winner;
1213 ret->price = price; 1214 ret->price = price;
1214 ret->status = BRANDT_bidder_won; 1215 ret->status = BRANDT_bidder_won;
@@ -1221,14 +1222,14 @@ struct BRANDT_Result *fp_pub_determine_outcome (struct BRANDT_Auction *ad,
1221void 1222void
1222fp_priv_prep_outcome (struct BRANDT_Auction *ad) 1223fp_priv_prep_outcome (struct BRANDT_Auction *ad)
1223{ 1224{
1224 gcry_mpi_point_t tmpa = gcry_mpi_point_new (0); 1225 gcry_mpi_point_t tmpa = gcry_mpi_point_new (0);
1225 gcry_mpi_point_t tmpb = gcry_mpi_point_new (0); 1226 gcry_mpi_point_t tmpb = gcry_mpi_point_new (0);
1226 gcry_mpi_point_t *tlta1; 1227 gcry_mpi_point_t *tlta1;
1227 gcry_mpi_point_t *tltb1; 1228 gcry_mpi_point_t *tltb1;
1228 gcry_mpi_point_t **tlta2; 1229 gcry_mpi_point_t **tlta2;
1229 gcry_mpi_point_t **tltb2; 1230 gcry_mpi_point_t **tltb2;
1230 gcry_mpi_point_t **tlta3; 1231 gcry_mpi_point_t **tlta3;
1231 gcry_mpi_point_t **tltb3; 1232 gcry_mpi_point_t **tltb3;
1232 1233
1233 ad->gamma3 = smc_init3 (ad->n, ad->n, ad->k); 1234 ad->gamma3 = smc_init3 (ad->n, ad->n, ad->k);
1234 brandt_assert (ad->gamma3); 1235 brandt_assert (ad->gamma3);
@@ -1452,7 +1453,7 @@ quit:
1452void 1453void
1453fp_priv_prep_decryption (struct BRANDT_Auction *ad) 1454fp_priv_prep_decryption (struct BRANDT_Auction *ad)
1454{ 1455{
1455 gcry_mpi_point_t tmp = gcry_mpi_point_new (0); 1456 gcry_mpi_point_t tmp = gcry_mpi_point_new (0);
1456 1457
1457 ad->phi3 = smc_init3 (ad->n, ad->n, ad->k); 1458 ad->phi3 = smc_init3 (ad->n, ad->n, ad->k);
1458 brandt_assert (ad->phi3); 1459 brandt_assert (ad->phi3);
@@ -1682,10 +1683,10 @@ fp_priv_recv_decryption_bidder (struct BRANDT_Auction *ad,
1682 ec_point_parse (phi, (struct ec_mpi *)cur); 1683 ec_point_parse (phi, (struct ec_mpi *)cur);
1683 proof2 = (struct proof_2dle *)(cur + sizeof (struct ec_mpi)); 1684 proof2 = (struct proof_2dle *)(cur + sizeof (struct ec_mpi));
1684 if (smc_zkp_2dle_check (phi, 1685 if (smc_zkp_2dle_check (phi,
1685 ad->y[h], 1686 ad->y[h],
1686 ad->phi3[h][i][j], 1687 ad->phi3[h][i][j],
1687 ec_gen, 1688 ec_gen,
1688 proof2)) 1689 proof2))
1689 { 1690 {
1690 weprintf ("wrong zkp2 for phi, y received from seller"); 1691 weprintf ("wrong zkp2 for phi, y received from seller");
1691 goto quit; 1692 goto quit;
@@ -1717,8 +1718,9 @@ fp_priv_recv_decryption (struct BRANDT_Auction *ad,
1717} 1718}
1718 1719
1719 1720
1720struct BRANDT_Result *fp_priv_determine_outcome (struct BRANDT_Auction *ad, 1721struct BRANDT_Result *
1721 uint16_t *len) 1722fp_priv_determine_outcome (struct BRANDT_Auction *ad,
1723 uint16_t *len)
1722{ 1724{
1723 struct BRANDT_Result *ret; 1725 struct BRANDT_Result *ret;
1724 int32_t price = -1; 1726 int32_t price = -1;
@@ -1762,7 +1764,7 @@ struct BRANDT_Result *fp_priv_determine_outcome (struct BRANDT_Auction *ad,
1762 if (-1 == winner || -1 == price) 1764 if (-1 == winner || -1 == price)
1763 return NULL; 1765 return NULL;
1764 1766
1765 ret = GNUNET_new(struct BRANDT_Result); 1767 ret = GNUNET_new (struct BRANDT_Result);
1766 ret->bidder = winner; 1768 ret->bidder = winner;
1767 ret->price = price; 1769 ret->price = price;
1768 ret->status = BRANDT_bidder_won; 1770 ret->status = BRANDT_bidder_won;