aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_crypto_ecdh_eddsa.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/util/test_crypto_ecdh_eddsa.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
downloadgnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz
gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/util/test_crypto_ecdh_eddsa.c')
-rw-r--r--src/util/test_crypto_ecdh_eddsa.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/src/util/test_crypto_ecdh_eddsa.c b/src/util/test_crypto_ecdh_eddsa.c
index 5e2d930bc..68f8c4671 100644
--- a/src/util/test_crypto_ecdh_eddsa.c
+++ b/src/util/test_crypto_ecdh_eddsa.c
@@ -30,7 +30,7 @@
30 30
31 31
32static int 32static int
33test_ecdh() 33test_ecdh ()
34{ 34{
35 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_dsa; 35 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_dsa;
36 struct GNUNET_CRYPTO_EcdhePrivateKey *priv_ecdh; 36 struct GNUNET_CRYPTO_EcdhePrivateKey *priv_ecdh;
@@ -39,56 +39,57 @@ test_ecdh()
39 struct GNUNET_HashCode dh[2]; 39 struct GNUNET_HashCode dh[2];
40 40
41 /* Generate keys */ 41 /* Generate keys */
42 priv_dsa = GNUNET_CRYPTO_eddsa_key_create(); 42 priv_dsa = GNUNET_CRYPTO_eddsa_key_create ();
43 GNUNET_CRYPTO_eddsa_key_get_public(priv_dsa, 43 GNUNET_CRYPTO_eddsa_key_get_public (priv_dsa,
44 &id1); 44 &id1);
45 for (unsigned int j = 0; j < 4; j++) 45 for (unsigned int j = 0; j < 4; j++)
46 { 46 {
47 fprintf(stderr, ","); 47 fprintf (stderr, ",");
48 priv_ecdh = GNUNET_CRYPTO_ecdhe_key_create(); 48 priv_ecdh = GNUNET_CRYPTO_ecdhe_key_create ();
49 /* Extract public keys */ 49 /* Extract public keys */
50 GNUNET_CRYPTO_ecdhe_key_get_public(priv_ecdh, 50 GNUNET_CRYPTO_ecdhe_key_get_public (priv_ecdh,
51 &id2); 51 &id2);
52 /* Do ECDH */ 52 /* Do ECDH */
53 GNUNET_assert(GNUNET_OK == 53 GNUNET_assert (GNUNET_OK ==
54 GNUNET_CRYPTO_eddsa_ecdh(priv_dsa, 54 GNUNET_CRYPTO_eddsa_ecdh (priv_dsa,
55 &id2, 55 &id2,
56 &dh[0])); 56 &dh[0]));
57 GNUNET_assert(GNUNET_OK == 57 GNUNET_assert (GNUNET_OK ==
58 GNUNET_CRYPTO_ecdh_eddsa(priv_ecdh, 58 GNUNET_CRYPTO_ecdh_eddsa (priv_ecdh,
59 &id1, 59 &id1,
60 &dh[1])); 60 &dh[1]));
61 /* Check that both DH results are equal. */ 61 /* Check that both DH results are equal. */
62 GNUNET_assert(0 == memcmp(&dh[0], 62 GNUNET_assert (0 == memcmp (&dh[0],
63 &dh[1], 63 &dh[1],
64 sizeof(struct GNUNET_HashCode))); 64 sizeof(struct GNUNET_HashCode)));
65 GNUNET_free(priv_ecdh); 65 GNUNET_free (priv_ecdh);
66 } 66 }
67 GNUNET_free(priv_dsa); 67 GNUNET_free (priv_dsa);
68 return 0; 68 return 0;
69} 69}
70 70
71 71
72int 72int
73main(int argc, char *argv[]) 73main (int argc, char *argv[])
74{ 74{
75 if (!gcry_check_version("1.6.0")) 75 if (! gcry_check_version ("1.6.0"))
76 { 76 {
77 fprintf(stderr, 77 fprintf (stderr,
78 _("libgcrypt has not the expected version (version %s is required).\n"), 78 _ (
79 "1.6.0"); 79 "libgcrypt has not the expected version (version %s is required).\n"),
80 return 0; 80 "1.6.0");
81 } 81 return 0;
82 if (getenv("GNUNET_GCRYPT_DEBUG")) 82 }
83 gcry_control(GCRYCTL_SET_DEBUG_FLAGS, 1u, 0); 83 if (getenv ("GNUNET_GCRYPT_DEBUG"))
84 GNUNET_log_setup("test-crypto-ecdh-eddsa", "WARNING", NULL); 84 gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
85 GNUNET_log_setup ("test-crypto-ecdh-eddsa", "WARNING", NULL);
85 for (unsigned int i = 0; i < 4; i++) 86 for (unsigned int i = 0; i < 4; i++)
86 { 87 {
87 fprintf(stderr, 88 fprintf (stderr,
88 "."); 89 ".");
89 if (0 != test_ecdh()) 90 if (0 != test_ecdh ())
90 return 1; 91 return 1;
91 } 92 }
92 return 0; 93 return 0;
93} 94}
94 95