diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-02-04 10:24:40 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-02-04 10:24:40 +0000 |
commit | a1f0862b225f7eae19d41ac4ed7d4f663af594cf (patch) | |
tree | 93282b1e7109a178d70504db236740a2a1a06dde /src/util | |
parent | 9728378c983196c86c2fc6b7902964955e41e379 (diff) | |
download | gnunet-a1f0862b225f7eae19d41ac4ed7d4f663af594cf.tar.gz gnunet-a1f0862b225f7eae19d41ac4ed7d4f663af594cf.zip |
- added caller-hom-ops soft-cap logics
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/crypto_paillier.c | 3 | ||||
-rw-r--r-- | src/util/test_crypto_paillier.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/util/crypto_paillier.c b/src/util/crypto_paillier.c index 6873d159f..eb5bfe87c 100644 --- a/src/util/crypto_paillier.c +++ b/src/util/crypto_paillier.c | |||
@@ -131,6 +131,9 @@ GNUNET_CRYPTO_paillier_encrypt (const struct GNUNET_CRYPTO_PaillierPublicKey *pu | |||
131 | 131 | ||
132 | if (possible_opts < 1) | 132 | if (possible_opts < 1) |
133 | possible_opts = 0; | 133 | possible_opts = 0; |
134 | //soft-cap by caller | ||
135 | possible_opts = (desired_ops < possible_opts)? desired_ops : possible_opts; | ||
136 | |||
134 | ciphertext->remaining_ops = htonl (possible_opts); | 137 | ciphertext->remaining_ops = htonl (possible_opts); |
135 | 138 | ||
136 | GNUNET_assert (0 != (n_square = gcry_mpi_new (0))); | 139 | GNUNET_assert (0 != (n_square = gcry_mpi_new (0))); |
diff --git a/src/util/test_crypto_paillier.c b/src/util/test_crypto_paillier.c index 0dad500ba..cd8c77e5e 100644 --- a/src/util/test_crypto_paillier.c +++ b/src/util/test_crypto_paillier.c | |||
@@ -88,11 +88,11 @@ test_hom() | |||
88 | gcry_mpi_mul_2exp(m2,m2,GNUNET_CRYPTO_PAILLIER_BITS-3); | 88 | gcry_mpi_mul_2exp(m2,m2,GNUNET_CRYPTO_PAILLIER_BITS-3); |
89 | gcry_mpi_add(result,m1,m2); | 89 | gcry_mpi_add(result,m1,m2); |
90 | 90 | ||
91 | if (1 != (ret = GNUNET_CRYPTO_paillier_encrypt (&public_key, m1, 0, &c1))){ | 91 | if (1 != (ret = GNUNET_CRYPTO_paillier_encrypt (&public_key, m1, 2, &c1))){ |
92 | printf ("GNUNET_CRYPTO_paillier_encrypt 1 failed, should return 1 allowed operation, got %d!\n", ret); | 92 | printf ("GNUNET_CRYPTO_paillier_encrypt 1 failed, should return 1 allowed operation, got %d!\n", ret); |
93 | return 1; | 93 | return 1; |
94 | } | 94 | } |
95 | if (1 != (ret = GNUNET_CRYPTO_paillier_encrypt (&public_key, m2, 0, &c2))){ | 95 | if (1 != (ret = GNUNET_CRYPTO_paillier_encrypt (&public_key, m2, 2, &c2))){ |
96 | printf ("GNUNET_CRYPTO_paillier_encrypt 2 failed, should return 1 allowed operation, got %d!\n", ret); | 96 | printf ("GNUNET_CRYPTO_paillier_encrypt 2 failed, should return 1 allowed operation, got %d!\n", ret); |
97 | return 1; | 97 | return 1; |
98 | } | 98 | } |