aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2014-08-24 03:29:56 +0000
committerFlorian Dold <florian.dold@gmail.com>2014-08-24 03:29:56 +0000
commit87666a4506350d93292909c37afdfe3514e86455 (patch)
tree3501b073f5971d221b9565f1b016fd0b3a869168
parent7d91829ad8087a77c6b04fc5547e68684cdbf513 (diff)
downloadgnunet-87666a4506350d93292909c37afdfe3514e86455.tar.gz
gnunet-87666a4506350d93292909c37afdfe3514e86455.zip
secretsharing cleanup
-rw-r--r--src/secretsharing/gnunet-service-secretsharing.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/secretsharing/gnunet-service-secretsharing.c b/src/secretsharing/gnunet-service-secretsharing.c
index 9425a6c7b..c286f81cc 100644
--- a/src/secretsharing/gnunet-service-secretsharing.c
+++ b/src/secretsharing/gnunet-service-secretsharing.c
@@ -1001,7 +1001,19 @@ restore_fair (const struct GNUNET_CRYPTO_PaillierPublicKey *ppub,
1001 gcry_mpi_mulm (xres, xres, b_1, elgamal_q); 1001 gcry_mpi_mulm (xres, xres, b_1, elgamal_q);
1002 } 1002 }
1003 1003
1004 // FIXME: cleanup! 1004 gcry_mpi_release (a_1);
1005 gcry_mpi_release (a_2);
1006 gcry_mpi_release (b_1);
1007 gcry_mpi_release (b_2);
1008 gcry_mpi_release (big_a);
1009 gcry_mpi_release (big_b);
1010 gcry_mpi_release (big_t);
1011 gcry_mpi_release (n);
1012 gcry_mpi_release (t_1);
1013 gcry_mpi_release (t_2);
1014 gcry_mpi_release (t);
1015 gcry_mpi_release (r);
1016 gcry_mpi_release (v);
1005} 1017}
1006 1018
1007 1019
@@ -1040,6 +1052,7 @@ verify_fair (const struct GNUNET_CRYPTO_PaillierPublicKey *ppub, const struct GN
1040 gcry_mpi_t tmp2; 1052 gcry_mpi_t tmp2;
1041 gcry_mpi_t y; 1053 gcry_mpi_t y;
1042 gcry_mpi_t big_y; 1054 gcry_mpi_t big_y;
1055 int res;
1043 1056
1044 GNUNET_assert (NULL != (n_sq = gcry_mpi_new (0))); 1057 GNUNET_assert (NULL != (n_sq = gcry_mpi_new (0)));
1045 GNUNET_assert (NULL != (tmp1 = gcry_mpi_new (0))); 1058 GNUNET_assert (NULL != (tmp1 = gcry_mpi_new (0)));
@@ -1068,7 +1081,8 @@ verify_fair (const struct GNUNET_CRYPTO_PaillierPublicKey *ppub, const struct GN
1068 if (0 == gcry_mpi_cmp (t1, tmp1)) 1081 if (0 == gcry_mpi_cmp (t1, tmp1))
1069 { 1082 {
1070 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "fair encryption invalid (t1)\n"); 1083 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "fair encryption invalid (t1)\n");
1071 return GNUNET_NO; 1084 res = GNUNET_NO;
1085 goto cleanup;
1072 } 1086 }
1073 1087
1074 gcry_mpi_powm (big_y, big_y, e, n_sq); 1088 gcry_mpi_powm (big_y, big_y, e, n_sq);
@@ -1086,10 +1100,26 @@ verify_fair (const struct GNUNET_CRYPTO_PaillierPublicKey *ppub, const struct GN
1086 if (0 == gcry_mpi_cmp (t2, tmp1)) 1100 if (0 == gcry_mpi_cmp (t2, tmp1))
1087 { 1101 {
1088 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "fair encryption invalid (t2)\n"); 1102 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "fair encryption invalid (t2)\n");
1089 return GNUNET_NO; 1103 res = GNUNET_NO;
1104 goto cleanup;
1090 } 1105 }
1091 1106
1092 return GNUNET_YES; 1107 res = GNUNET_YES;
1108
1109cleanup:
1110
1111 gcry_mpi_release (n);
1112 gcry_mpi_release (n_sq);
1113 gcry_mpi_release (z);
1114 gcry_mpi_release (t1);
1115 gcry_mpi_release (t2);
1116 gcry_mpi_release (e);
1117 gcry_mpi_release (w);
1118 gcry_mpi_release (tmp1);
1119 gcry_mpi_release (tmp2);
1120 gcry_mpi_release (y);
1121 gcry_mpi_release (big_y);
1122 return res;
1093} 1123}
1094 1124
1095 1125