aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2013-10-14 13:00:11 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2013-10-14 13:00:11 +0000
commitba5f1e5d05604ab91319aa1d7260ba7cd8a03b99 (patch)
tree26c9d13e2f62b9cb42b9e9c6e7071e5e51365100 /src/scalarproduct
parente9dda4933275bc7e260981a8757ba8803c585907 (diff)
downloadgnunet-ba5f1e5d05604ab91319aa1d7260ba7cd8a03b99.tar.gz
gnunet-ba5f1e5d05604ab91319aa1d7260ba7cd8a03b99.zip
more work on doxygenization for SP
Diffstat (limited to 'src/scalarproduct')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct.c10
-rw-r--r--src/scalarproduct/scalarproduct.h2
-rw-r--r--src/scalarproduct/scalarproduct_api.c34
3 files changed, 25 insertions, 21 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c
index d78f92d40..15692de4a 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct.c
@@ -384,7 +384,7 @@ generate_keyset ()
384 my_lambda = gcry_mpi_new (0); 384 my_lambda = gcry_mpi_new (0);
385 385
386 // calculate lambda 386 // calculate lambda
387 // lambda = \frac{(p-1)*(q-1)}{gcd(p-1,q-1)} 387 // lambda = frac{(p-1)*(q-1)}{gcd(p-1,q-1)}
388 gcry_mpi_sub_ui (tmp1, p, 1); 388 gcry_mpi_sub_ui (tmp1, p, 1);
389 gcry_mpi_sub_ui (tmp2, q, 1); 389 gcry_mpi_sub_ui (tmp2, q, 1);
390 gcry_mpi_gcd (gcd, tmp1, tmp2); 390 gcry_mpi_gcd (gcd, tmp1, tmp2);
@@ -1149,10 +1149,10 @@ prepare_service_response (gcry_mpi_t s,
1149/** 1149/**
1150 * executed by bob: 1150 * executed by bob:
1151 * compute the values 1151 * compute the values
1152 * (1)[]: $E_A(a_{\pi(i)}) \otimes E_A(- r_{\pi(i)} - b_{\pi(i)}) &= E_A(a_{\pi(i)} - r_{\pi(i)} - b_{\pi(i)})$ 1152 * (1)[]: $E_A(a_{pi(i)}) otimes E_A(- r_{pi(i)} - b_{pi(i)}) &= E_A(a_{pi(i)} - r_{pi(i)} - b_{pi(i)})$
1153 * (2)[]: $E_A(a_{\pi'(i)}) \otimes E_A(- r_{\pi'(i)}) &= E_A(a_{\pi'(i)} - r_{\pi'(i)})$ 1153 * (2)[]: $E_A(a_{pi'(i)}) otimes E_A(- r_{pi'(i)}) &= E_A(a_{pi'(i)} - r_{pi'(i)})$
1154 * S: $S := E_A(\sum (r_i + b_i)^2)$ 1154 * S: $S := E_A(sum (r_i + b_i)^2)$
1155 * S': $S' := E_A(\sum r_i^2)$ 1155 * S': $S' := E_A(sum r_i^2)$
1156 * 1156 *
1157 * @param request the requesting session + bob's requesting peer 1157 * @param request the requesting session + bob's requesting peer
1158 * @param response the responding session + bob's client handle 1158 * @param response the responding session + bob's client handle
diff --git a/src/scalarproduct/scalarproduct.h b/src/scalarproduct/scalarproduct.h
index d476ae8ff..2e6b6bd8f 100644
--- a/src/scalarproduct/scalarproduct.h
+++ b/src/scalarproduct/scalarproduct.h
@@ -52,7 +52,7 @@ extern "C"
52 * Maximum count of elements we can put into a multipart message 52 * Maximum count of elements we can put into a multipart message
53 */ 53 */
54#define MULTIPART_ELEMENT_CAPACITY ((GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct GNUNET_SCALARPRODUCT_multipart_message)) / PAILLIER_ELEMENT_LENGTH) 54#define MULTIPART_ELEMENT_CAPACITY ((GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct GNUNET_SCALARPRODUCT_multipart_message)) / PAILLIER_ELEMENT_LENGTH)
55 55
56/** 56/**
57 * Log an error message at log-level 'level' that indicates 57 * Log an error message at log-level 'level' that indicates
58 * a failure of the command 'cmd' with the message given 58 * a failure of the command 'cmd' with the message given
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index 0f8a409cc..96b176080 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -95,6 +95,9 @@ struct GNUNET_SCALARPRODUCT_ComputationHandle
95 */ 95 */
96 struct GNUNET_SCALARPRODUCT_client_request * msg; 96 struct GNUNET_SCALARPRODUCT_client_request * msg;
97 97
98 /**
99 * The msg handler callback
100 */
98 union 101 union
99 { 102 {
100 /** 103 /**
@@ -145,11 +148,11 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h);
145 148
146 149
147/** 150/**
148 * Handles the RESULT received in reply of prepare_response from the 151 * Handles the STATUS received from the service for a response, does not contain a payload
149 * service
150 * 152 *
151 * @param cls Handle to the Master Context 153 * @param cls our Handle
152 * @param msg Pointer to the response received 154 * @param msg Pointer to the response received
155 * @param status the condition the request was terminated with (eg: disconnect)
153 */ 156 */
154static void 157static void
155process_status_message (void *cls, 158process_status_message (void *cls,
@@ -163,11 +166,11 @@ process_status_message (void *cls,
163 166
164 167
165/** 168/**
166 * Handles the RESULT received in reply of prepare_response from the 169 * Handles the RESULT received from the service for a request, should contain a result MPI value
167 * service
168 * 170 *
169 * @param cls Handle to the Master Context 171 * @param cls our Handle
170 * @param msg Pointer to the response received 172 * @param msg Pointer to the response received
173 * @param status the condition the request was terminated with (eg: disconnect)
171 */ 174 */
172static void 175static void
173process_result_message (void *cls, 176process_result_message (void *cls,
@@ -212,7 +215,7 @@ process_result_message (void *cls,
212 215
213 216
214/** 217/**
215 * Called when a response is received from the service. After basic check 218 * Called when a response is received from the service. After basic check, the
216 * handler in qe->response_proc is called. This functions handles the response 219 * handler in qe->response_proc is called. This functions handles the response
217 * to the client which used the API. 220 * to the client which used the API.
218 * 221 *
@@ -255,7 +258,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
255 258
256 259
257/** 260/**
258 * Transmits the request to the VectorProduct Sevice 261 * Transmits the request to the VectorProduct Service
259 * 262 *
260 * @param cls Closure 263 * @param cls Closure
261 * @param size Size of the buffer 264 * @param size Size of the buffer
@@ -309,8 +312,8 @@ transmit_request (void *cls, size_t size,
309/** 312/**
310 * Used by Bob's client to cooperate with Alice, 313 * Used by Bob's client to cooperate with Alice,
311 * 314 *
312 * @param h handle to the master context 315 * @param cfg the gnunet configuration handle
313 * @param key Session key - unique to the requesting client 316 * @param key Session key unique to the requesting client
314 * @param elements Array of elements of the vector 317 * @param elements Array of elements of the vector
315 * @param element_count Number of elements in the vector 318 * @param element_count Number of elements in the vector
316 * @param cont Callback function 319 * @param cont Callback function
@@ -394,8 +397,8 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg,
394/** 397/**
395 * Request by Alice's client for computing a scalar product 398 * Request by Alice's client for computing a scalar product
396 * 399 *
397 * @param h handle to the master context 400 * @param cfg the gnunet configuration handle
398 * @param key Session key - unique to the requesting client 401 * @param key Session key should be unique to the requesting client
399 * @param peer PeerID of the other peer 402 * @param peer PeerID of the other peer
400 * @param elements Array of elements of the vector 403 * @param elements Array of elements of the vector
401 * @param element_count Number of elements in the vector 404 * @param element_count Number of elements in the vector
@@ -488,9 +491,10 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
488 491
489 492
490/** 493/**
491 * Disconnect from the scalarproduct service. 494 * Cancel an ongoing computation or revoke our collaboration offer.
495 * Closes the connection to the service
492 * 496 *
493 * @param h a computation handle to cancel 497 * @param h computation handle to terminate
494 */ 498 */
495void 499void
496GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h) 500GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h)
@@ -513,7 +517,7 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h)
513 } 517 }
514} 518}
515/** 519/**
516 * Cancel ALL our ongoing scalar product computations and collaboration offers. 520 * Cancel ALL ongoing computation or revoke our collaboration offer.
517 * Closes ALL connections to the service 521 * Closes ALL connections to the service
518 */ 522 */
519void 523void