gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26856 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r26856 - gnunet/src/util
Date: Thu, 11 Apr 2013 21:29:14 +0200

Author: grothoff
Date: 2013-04-11 21:29:14 +0200 (Thu, 11 Apr 2013)
New Revision: 26856

Modified:
   gnunet/src/util/pseudonym.c
   gnunet/src/util/test_pseudonym.c
Log:
-towards proper pseudonym support

Modified: gnunet/src/util/pseudonym.c
===================================================================
--- gnunet/src/util/pseudonym.c 2013-04-11 16:35:18 UTC (rev 26855)
+++ gnunet/src/util/pseudonym.c 2013-04-11 19:29:14 UTC (rev 26856)
@@ -1140,11 +1140,9 @@
   gcry_mpi_release (h);
   gcry_mpi_release (n);
   
-  /* now build sexpression with the signing key;
-     NOTE: libgcrypt docs say that we should specify 'Q', but hopefully soon
-     libgcrypt will derive it from 'd' for us... */
+  /* now build sexpression with the signing key */
   if (0 != (rc = gcry_sexp_build (&spriv, &erroff,
-                                 "(private-key(ecc(curve \"NIST P-256\")(d 
%m)))",
+                                 "(private-key(ecdsa(curve \"NIST P-256\")(d 
%m)))",
                                  d)))
   {
     LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
@@ -1188,8 +1186,9 @@
   gcry_sexp_release (data);
   gcry_sexp_release (spriv);
 
+
   /* extract 'r' and 's' values from sexpression 'result' and store in 
'signature' */
-  if (0 != (rc = key_from_sexp (rs, result, "ecdsa", "rs")))
+  if (0 != (rc = key_from_sexp (rs, result, "sig-val", "rs")))
   {
     GNUNET_break (0);
     gcry_sexp_release (result);
@@ -1375,7 +1374,6 @@
                         const struct GNUNET_PseudonymSignature *signature,
                         const struct GNUNET_PseudonymIdentifier 
*verification_key)
 {
-#if FUTURE 
   gcry_sexp_t data;
   gcry_sexp_t sig_sexpr;
   gcry_sexp_t pk_sexpr;
@@ -1461,8 +1459,8 @@
   gcry_mpi_ec_set_point ("q", q, ctx);
   gcry_mpi_point_release (q);
 
-  /* convert 'ctx' to 'sexp' (this hurts) */
-  if (0 != (rc = gcry_sexp_from_context (&pk_sexpr, ctx)))
+  /* convert 'ctx' to 'sexp' */
+  if (0 != (rc = gcry_pubkey_get_sexp (&pk_sexpr, GCRY_PK_GET_PUBKEY, ctx)))
   {
     LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_from_context", rc);
     gcry_ctx_release (ctx);
@@ -1484,9 +1482,6 @@
          __LINE__, gcry_strerror (rc));
     return GNUNET_SYSERR;
   }
-#else
-  GNUNET_break (0);
-#endif
   return GNUNET_OK;
 }
 

Modified: gnunet/src/util/test_pseudonym.c
===================================================================
--- gnunet/src/util/test_pseudonym.c    2013-04-11 16:35:18 UTC (rev 26855)
+++ gnunet/src/util/test_pseudonym.c    2013-04-11 19:29:14 UTC (rev 26856)
@@ -225,14 +225,14 @@
   GNUNET_PSEUDONYM_sign (ph, purpose, seed, signing_key, &signature2);
   /* with seed, two sigs must be identical, without, they must be different! */
   if (NULL != seed)
-    GNUNET_assert (0 == memcmp (&signature, &signature2, sizeof (signature)));
+    GNUNET_break (0 == memcmp (&signature, &signature2, sizeof (signature)));
   else /* crypto not implemented, thus for now 'break' */
     GNUNET_break (0 != memcmp (&signature, &signature2, sizeof (signature)));
   GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym);
   GNUNET_PSEUDONYM_derive_verification_key (&pseudonym,
                                            signing_key,
                                            &verification_key);
-  GNUNET_assert (GNUNET_OK ==
+  GNUNET_break (GNUNET_OK ==
                 GNUNET_PSEUDONYM_verify (purpose, &signature, 
&verification_key));
   /* also check that if the data is changed, the signature no longer matches */
   (*bit)++;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]