aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-09 17:42:02 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-09 17:42:13 +0200
commitbb581dc55bfb90fc7f34797111b55d16e69b7af0 (patch)
tree6c0f00adee64e5668da284a94308a6626b6c1331 /src
parent8900fb0e0101cd722e392ffb9aa36245c22ea770 (diff)
downloadgnunet-bb581dc55bfb90fc7f34797111b55d16e69b7af0.tar.gz
gnunet-bb581dc55bfb90fc7f34797111b55d16e69b7af0.zip
remove crypto_bug.c
Diffstat (limited to 'src')
-rw-r--r--src/util/Makefile.am3
-rw-r--r--src/util/crypto_bug.c77
-rw-r--r--src/util/crypto_ecc.c3
-rw-r--r--src/util/crypto_ecc_setup.c3
4 files changed, 1 insertions, 85 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 407f482df..208cab07b 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -598,5 +598,4 @@ EXTRA_DIST = \
598 test_resolver_api_data.conf \ 598 test_resolver_api_data.conf \
599 test_service_data.conf \ 599 test_service_data.conf \
600 test_speedup_data.conf \ 600 test_speedup_data.conf \
601 gnunet-qr.py.in \ 601 gnunet-qr.py.in
602 crypto_bug.c
diff --git a/src/util/crypto_bug.c b/src/util/crypto_bug.c
deleted file mode 100644
index aea801d40..000000000
--- a/src/util/crypto_bug.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2018 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/**
20 * @file util/crypto_bug.c
21 * @brief work around unidentified public key cryptography bug
22 * @author Christian Grothoff
23 */
24
25/**
26 * Enable work-around. Will cause code to call #check_eddsa_key() to
27 * see if we have a bad key, and if so, create a new one.
28 */
29#define CRYPTO_BUG 0
30
31
32#if CRYPTO_BUG
33/**
34 * Check if ECDH works with @a priv_dsa and this version
35 * of libgcrypt.
36 *
37 * @param priv_dsa key to check
38 * @return #GNUNET_OK if key passes
39 */
40static int
41check_eddsa_key (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_dsa)
42{
43 struct GNUNET_CRYPTO_EcdhePrivateKey *priv_ecdh;
44 struct GNUNET_CRYPTO_EddsaPublicKey id1;
45 struct GNUNET_CRYPTO_EcdhePublicKey id2;
46 struct GNUNET_HashCode dh[2];
47
48 GNUNET_CRYPTO_eddsa_key_get_public (priv_dsa,
49 &id1);
50 for (unsigned int j=0;j<4;j++)
51 {
52 priv_ecdh = GNUNET_CRYPTO_ecdhe_key_create ();
53 /* Extract public keys */
54 GNUNET_CRYPTO_ecdhe_key_get_public (priv_ecdh,
55 &id2);
56 /* Do ECDH */
57 GNUNET_assert (GNUNET_OK ==
58 GNUNET_CRYPTO_eddsa_ecdh (priv_dsa,
59 &id2,
60 &dh[0]));
61 GNUNET_assert (GNUNET_OK ==
62 GNUNET_CRYPTO_ecdh_eddsa (priv_ecdh,
63 &id1,
64 &dh[1]));
65 /* Check that both DH results are equal. */
66 if (0 != memcmp (&dh[0],
67 &dh[1],
68 sizeof (struct GNUNET_HashCode)))
69 {
70 GNUNET_break (0); /* bad EdDSA key! */
71 return GNUNET_SYSERR;
72 }
73 GNUNET_free (priv_ecdh);
74 }
75 return GNUNET_OK;
76}
77#endif
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index 789d350ff..07782b181 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -50,9 +50,6 @@
50#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0) 50#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0)
51 51
52 52
53#include "crypto_bug.c"
54
55
56/** 53/**
57 * Extract values from an S-expression. 54 * Extract values from an S-expression.
58 * 55 *
diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c
index 1316a900c..507cbba11 100644
--- a/src/util/crypto_ecc_setup.c
+++ b/src/util/crypto_ecc_setup.c
@@ -39,9 +39,6 @@
39#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0) 39#define LOG_GCRY(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0)
40 40
41 41
42#include "crypto_bug.c"
43
44
45/** 42/**
46 * Wait for a short time (we're trying to lock a file or want 43 * Wait for a short time (we're trying to lock a file or want
47 * to give another process a shot at finishing a disk write, etc.). 44 * to give another process a shot at finishing a disk write, etc.).