[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30554 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30554 - gnunet/src/util |
Date: |
Tue, 5 Nov 2013 23:44:07 +0100 |
Author: grothoff
Date: 2013-11-05 23:44:07 +0100 (Tue, 05 Nov 2013)
New Revision: 30554
Modified:
gnunet/src/util/crypto_ecc.c
Log:
-addressing final crypto fixme
Modified: gnunet/src/util/crypto_ecc.c
===================================================================
--- gnunet/src/util/crypto_ecc.c 2013-11-05 22:43:35 UTC (rev 30553)
+++ gnunet/src/util/crypto_ecc.c 2013-11-05 22:44:07 UTC (rev 30554)
@@ -1396,6 +1396,7 @@
gcry_sexp_t pub_sexpr;
gcry_mpi_t result_x;
unsigned char xbuf[256 / 8];
+ size_t rsize;
/* first, extract the q = dP value from the public key */
if (0 != gcry_sexp_build (&pub_sexpr, NULL,
@@ -1427,8 +1428,16 @@
gcry_mpi_point_release (result);
gcry_ctx_release (ctx);
- /* FIXME: mpi_print creates an unsigned integer - is that intended
- or should we convert it to a signed integer (2-compl)? */
+ rsize = sizeof (xbuf);
+ GNUNET_assert (! gcry_mpi_get_flag (result_x, GCRYMPI_FLAG_OPAQUE));
+ /* result_x can be negative here, so we do not use 'mpi_print'
+ as that does not include the sign bit; x should be a 255-bit
+ value, so with the sign it should fit snugly into the 256-bit
+ xbuf */
+ GNUNET_assert (0 ==
+ gcry_mpi_print (GCRYMPI_FMT_STD, xbuf, rsize, &rsize,
+ result_x));
+ GNUNET_assert (rsize == sizeof (xbuf));
mpi_print (xbuf, sizeof (xbuf), result_x);
GNUNET_CRYPTO_hash (xbuf, sizeof (xbuf), key_material);
gcry_mpi_release (result_x);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30554 - gnunet/src/util,
gnunet <=