aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_crypto_ecdhe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_crypto_ecdhe.c')
-rw-r--r--src/util/test_crypto_ecdhe.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/util/test_crypto_ecdhe.c b/src/util/test_crypto_ecdhe.c
index 0cfb7f2c3..6f887e9f3 100644
--- a/src/util/test_crypto_ecdhe.c
+++ b/src/util/test_crypto_ecdhe.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2002-2013 GNUnet e.V. 3 Copyright (C) 2002-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 17
20*/ 18*/
21/** 19/**
@@ -50,16 +48,21 @@ main (int argc, char *argv[])
50 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0); 48 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0);
51 GNUNET_log_setup ("test-crypto-ecdhe", "WARNING", NULL); 49 GNUNET_log_setup ("test-crypto-ecdhe", "WARNING", NULL);
52 50
53 priv1 = GNUNET_CRYPTO_ecdhe_key_create (); 51 for (unsigned int i=0;i<100;i++)
54 priv2 = GNUNET_CRYPTO_ecdhe_key_create (); 52 {
55 GNUNET_CRYPTO_ecdhe_key_get_public (priv1, &pub1); 53 fprintf (stderr,
56 GNUNET_CRYPTO_ecdhe_key_get_public (priv2, &pub2); 54 ".");
57 GNUNET_CRYPTO_ecc_ecdh (priv1, &pub2, &ecdh1); 55 priv1 = GNUNET_CRYPTO_ecdhe_key_create ();
58 GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &ecdh2); 56 priv2 = GNUNET_CRYPTO_ecdhe_key_create ();
59 GNUNET_assert (0 == memcmp (&ecdh1, &ecdh2, 57 GNUNET_CRYPTO_ecdhe_key_get_public (priv1, &pub1);
60 sizeof (struct GNUNET_HashCode))); 58 GNUNET_CRYPTO_ecdhe_key_get_public (priv2, &pub2);
61 GNUNET_free (priv1); 59 GNUNET_CRYPTO_ecc_ecdh (priv1, &pub2, &ecdh1);
62 GNUNET_free (priv2); 60 GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &ecdh2);
61 GNUNET_assert (0 == memcmp (&ecdh1, &ecdh2,
62 sizeof (struct GNUNET_HashCode)));
63 GNUNET_free (priv1);
64 GNUNET_free (priv2);
65 }
63 return 0; 66 return 0;
64} 67}
65 68