[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28339 - in gnunet/src: fs util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28339 - in gnunet/src: fs util |
Date: |
Tue, 30 Jul 2013 17:43:08 +0200 |
Author: grothoff
Date: 2013-07-30 17:43:08 +0200 (Tue, 30 Jul 2013)
New Revision: 28339
Modified:
gnunet/src/fs/fs_api.c
gnunet/src/fs/fs_namespace.c
gnunet/src/fs/fs_pseudonym.c
gnunet/src/util/disk.c
Log:
-make use of deterministic ECDSA in FS, requires libgcrypt from Git as of
yesterday
Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c 2013-07-30 13:45:46 UTC (rev 28338)
+++ gnunet/src/fs/fs_api.c 2013-07-30 15:43:08 UTC (rev 28339)
@@ -2725,7 +2725,6 @@
}
if (NULL != parent)
{
- GNUNET_abort (); // for debugging for now - FIXME
GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
}
if (NULL != search)
Modified: gnunet/src/fs/fs_namespace.c
===================================================================
--- gnunet/src/fs/fs_namespace.c 2013-07-30 13:45:46 UTC (rev 28338)
+++ gnunet/src/fs/fs_namespace.c 2013-07-30 15:43:08 UTC (rev 28339)
@@ -723,10 +723,10 @@
sizeof (ub_enc->verification_key),
&query);
GNUNET_FS_pseudonym_sign (ns->key,
- &ub_enc->purpose,
- NULL,
- &signing_key,
- &ub_enc->signature);
+ &ub_enc->purpose,
+ NULL,
+ &signing_key,
+ &ub_enc->signature);
psc = GNUNET_malloc (sizeof (struct GNUNET_FS_PublishSksContext));
psc->uri = sks_uri;
psc->cont = cont;
Modified: gnunet/src/fs/fs_pseudonym.c
===================================================================
--- gnunet/src/fs/fs_pseudonym.c 2013-07-30 13:45:46 UTC (rev 28338)
+++ gnunet/src/fs/fs_pseudonym.c 2013-07-30 15:43:08 UTC (rev 28339)
@@ -1,10 +1,10 @@
/*
This file is part of GNUnet
- (C) 2003, 2004, 2005, 2006, 2007, 2008, 2013 Christian Grothoff (and
other contributing authors)
+ (C) 2003-2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
@@ -1042,30 +1042,48 @@
* S-expression suitable for signature operations.
*
* @param purpose data to convert
+ * @param rfc6979 GNUNET_YES if we are to use deterministic ECDSA
* @return converted s-expression
*/
static gcry_sexp_t
-data_to_pkcs1 (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose)
+data_to_pkcs1 (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose,
+ int rfc6979)
{
struct GNUNET_CRYPTO_ShortHashCode hc;
size_t bufSize;
gcry_sexp_t data;
+ const char *fmt;
+ int rc;
GNUNET_CRYPTO_short_hash (purpose, ntohl (purpose->size), &hc);
-#define FORMATSTRING
"(4:data(5:flags3:raw)(5:value32:01234567890123456789012345678901))"
- bufSize = strlen (FORMATSTRING) + 1;
+ if (rfc6979)
{
- char buff[bufSize];
-
- memcpy (buff, FORMATSTRING, bufSize);
- memcpy (&buff
- [bufSize -
- strlen
- ("01234567890123456789012345678901))")
- - 1], &hc, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
- GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0));
+ if (0 != (rc = gcry_sexp_build (&data, NULL,
+ "(data(flags rfc6979)(hash %s %b))",
+ "sha256",
+ sizeof (hc),
+ &hc)))
+ {
+ LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
+ return NULL;
+ }
}
-#undef FORMATSTRING
+ else
+ {
+ fmt = "(data(flags raw)(5:value32:01234567890123456789012345678901))";
+ bufSize = strlen (fmt) + 1;
+ {
+ char buff[bufSize];
+
+ memcpy (buff, fmt, bufSize);
+ memcpy (&buff
+ [bufSize -
+ strlen
+ ("01234567890123456789012345678901))")
+ - 1], &hc, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
+ GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0));
+ }
+ }
return data;
}
@@ -1159,8 +1177,12 @@
}
gcry_mpi_release (dh);
/* prepare data for signing */
- data = data_to_pkcs1 (purpose);
-
+ data = data_to_pkcs1 (purpose, NULL != seed);
+ if (NULL == data)
+ {
+ gcry_sexp_release (spriv);
+ return GNUNET_SYSERR;
+ }
/* get 'k' value from seed, if available */
if (NULL != seed)
{
@@ -1170,6 +1192,8 @@
size, &size)))
{
LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc);
+ gcry_sexp_release (spriv);
+ gcry_sexp_release (data);
return GNUNET_SYSERR;
}
}
@@ -1461,8 +1485,12 @@
/* build s-expression for data that was signed */
- data = data_to_pkcs1 (purpose);
-
+ data = data_to_pkcs1 (purpose, GNUNET_NO);
+ if (NULL == data)
+ {
+ gcry_sexp_release (sig_sexpr);
+ return GNUNET_SYSERR;
+ }
/* create context of public key and initialize Q */
size = sizeof (verification_key->q_x);
if (0 != (rc = gcry_mpi_scan (&q_x, GCRYMPI_FMT_USG,
Modified: gnunet/src/util/disk.c
===================================================================
--- gnunet/src/util/disk.c 2013-07-30 13:45:46 UTC (rev 28338)
+++ gnunet/src/util/disk.c 2013-07-30 15:43:08 UTC (rev 28339)
@@ -1,10 +1,10 @@
/*
This file is part of GNUnet.
- (C) 2001--2012 Christian Grothoff (and other contributing authors)
+ (C) 2001--2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
@@ -587,7 +587,7 @@
}
if (!S_ISDIR (filestat.st_mode))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"A file already exits with the same name %s\n", fil);
return GNUNET_NO;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28339 - in gnunet/src: fs util,
gnunet <=