[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29029 - gnunet/src/scalarproduct
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29029 - gnunet/src/scalarproduct |
Date: |
Thu, 5 Sep 2013 15:23:47 +0200 |
Author: cfuchs
Date: 2013-09-05 15:23:47 +0200 (Thu, 05 Sep 2013)
New Revision: 29029
Modified:
gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
Log:
service no longer asserts if it can not convert the result of a computation for
the client, but just signals an error
errors are signaled as negative result with zero-length product. Bob determines
his computation succeeded if he gets zero-length and zero as sign
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2013-09-05
13:11:59 UTC (rev 29028)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2013-09-05
13:23:47 UTC (rev 29029)
@@ -778,6 +778,7 @@
msg->header.size = htons (sizeof (struct
GNUNET_SCALARPRODUCT_client_response));
// 0 size and the first char in the product is 0, which should never be zero
if encoding is used.
msg->product_length = htonl (0);
+ msg->range = 1;
msg_obj = GNUNET_new (struct MessageObject);
msg_obj->msg = &msg->header;
@@ -1692,7 +1693,8 @@
size_t product_length = 0;
uint16_t msg_length = 0;
struct MessageObject * msg_obj;
- int8_t range = 0;
+ int8_t range = -1;
+ gcry_error_t rc;
int sign;
GNUNET_CONTAINER_DLL_remove (tasklist_head, tasklist_tail, task);
@@ -1705,24 +1707,29 @@
sign = gcry_mpi_cmp_ui(session->product, 0);
// libgcrypt can not handle a print of a negative number
if (0 > sign){
- range = -1;
gcry_mpi_sub(value, value, session->product);
}
else if(0 < sign){
range = 1;
gcry_mpi_add(value, value, session->product);
}
+ else
+ range = 0;
// get representation as string
// unfortunately libgcrypt is too stupid to implement print-support in
// signed GCRYMPI_FMT_STD format, and simply asserts in that case.
// here is the associated sourcecode:
// if (a->sign) return gcry_error (GPG_ERR_INTERNAL); /* Can't handle it
yet. */
- if (range)
- GNUNET_assert ( ! gcry_mpi_aprint (GCRYMPI_FMT_USG, // FIXME: just
log (& survive!)
+ if (range
+ && (0 != (rc = gcry_mpi_aprint (GCRYMPI_FMT_USG,
&product_exported,
&product_length,
- session->product));
+ session->product)))){
+ LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc);
+ product_length = 0;
+ range = -1; // signal error with product-length = 0 and range = -1
+ }
gcry_mpi_release (session->product);
session->product = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29029 - gnunet/src/scalarproduct,
gnunet <=