diff options
Diffstat (limited to 'src/util/test_crypto_ecc.c')
-rw-r--r-- | src/util/test_crypto_ecc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/util/test_crypto_ecc.c b/src/util/test_crypto_ecc.c index 58a9816a2..9a70eb055 100644 --- a/src/util/test_crypto_ecc.c +++ b/src/util/test_crypto_ecc.c | |||
@@ -43,13 +43,13 @@ testSignVerify () | |||
43 | { | 43 | { |
44 | struct GNUNET_CRYPTO_EccSignature sig; | 44 | struct GNUNET_CRYPTO_EccSignature sig; |
45 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; | 45 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; |
46 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 46 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; |
47 | int i; | 47 | int i; |
48 | struct GNUNET_TIME_Absolute start; | 48 | struct GNUNET_TIME_Absolute start; |
49 | int ok = GNUNET_OK; | 49 | int ok = GNUNET_OK; |
50 | 50 | ||
51 | FPRINTF (stderr, "%s", "W"); | 51 | FPRINTF (stderr, "%s", "W"); |
52 | GNUNET_CRYPTO_ecc_key_get_public (key, &pkey); | 52 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey); |
53 | start = GNUNET_TIME_absolute_get (); | 53 | start = GNUNET_TIME_absolute_get (); |
54 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); | 54 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); |
55 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); | 55 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); |
@@ -92,11 +92,11 @@ testDeriveSignVerify () | |||
92 | struct GNUNET_CRYPTO_EccSignature sig; | 92 | struct GNUNET_CRYPTO_EccSignature sig; |
93 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; | 93 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; |
94 | struct GNUNET_CRYPTO_EccPrivateKey *dpriv; | 94 | struct GNUNET_CRYPTO_EccPrivateKey *dpriv; |
95 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 95 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; |
96 | struct GNUNET_CRYPTO_EccPublicKey dpub; | 96 | struct GNUNET_CRYPTO_EccPublicSignKey dpub; |
97 | 97 | ||
98 | dpriv = GNUNET_CRYPTO_ecc_key_derive (key, "test-derive", "test-CTX"); | 98 | dpriv = GNUNET_CRYPTO_ecc_key_derive (key, "test-derive", "test-CTX"); |
99 | GNUNET_CRYPTO_ecc_key_get_public (key, &pkey); | 99 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey); |
100 | GNUNET_CRYPTO_ecc_public_key_derive (&pkey, "test-derive", "test-CTX", &dpub); | 100 | GNUNET_CRYPTO_ecc_public_key_derive (&pkey, "test-derive", "test-CTX", &dpub); |
101 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); | 101 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); |
102 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); | 102 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); |
@@ -146,7 +146,7 @@ testSignPerformance () | |||
146 | { | 146 | { |
147 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; | 147 | struct GNUNET_CRYPTO_EccSignaturePurpose purp; |
148 | struct GNUNET_CRYPTO_EccSignature sig; | 148 | struct GNUNET_CRYPTO_EccSignature sig; |
149 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 149 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; |
150 | int i; | 150 | int i; |
151 | struct GNUNET_TIME_Absolute start; | 151 | struct GNUNET_TIME_Absolute start; |
152 | int ok = GNUNET_OK; | 152 | int ok = GNUNET_OK; |
@@ -154,7 +154,7 @@ testSignPerformance () | |||
154 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); | 154 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); |
155 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); | 155 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); |
156 | FPRINTF (stderr, "%s", "W"); | 156 | FPRINTF (stderr, "%s", "W"); |
157 | GNUNET_CRYPTO_ecc_key_get_public (key, &pkey); | 157 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey); |
158 | start = GNUNET_TIME_absolute_get (); | 158 | start = GNUNET_TIME_absolute_get (); |
159 | for (i = 0; i < ITER; i++) | 159 | for (i = 0; i < ITER; i++) |
160 | { | 160 | { |
@@ -177,22 +177,22 @@ testSignPerformance () | |||
177 | static int | 177 | static int |
178 | testCreateFromFile () | 178 | testCreateFromFile () |
179 | { | 179 | { |
180 | struct GNUNET_CRYPTO_EccPublicKey p1; | 180 | struct GNUNET_CRYPTO_EccPublicSignKey p1; |
181 | struct GNUNET_CRYPTO_EccPublicKey p2; | 181 | struct GNUNET_CRYPTO_EccPublicSignKey p2; |
182 | 182 | ||
183 | key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE); | 183 | key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE); |
184 | GNUNET_assert (NULL != key); | 184 | GNUNET_assert (NULL != key); |
185 | GNUNET_CRYPTO_ecc_key_get_public (key, &p1); | 185 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &p1); |
186 | GNUNET_free (key); | 186 | GNUNET_free (key); |
187 | key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE); | 187 | key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE); |
188 | GNUNET_assert (NULL != key); | 188 | GNUNET_assert (NULL != key); |
189 | GNUNET_CRYPTO_ecc_key_get_public (key, &p2); | 189 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &p2); |
190 | GNUNET_assert (0 == memcmp (&p1, &p2, sizeof (p1))); | 190 | GNUNET_assert (0 == memcmp (&p1, &p2, sizeof (p1))); |
191 | GNUNET_free (key); | 191 | GNUNET_free (key); |
192 | GNUNET_assert (0 == UNLINK (KEYFILE)); | 192 | GNUNET_assert (0 == UNLINK (KEYFILE)); |
193 | key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE); | 193 | key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE); |
194 | GNUNET_assert (NULL != key); | 194 | GNUNET_assert (NULL != key); |
195 | GNUNET_CRYPTO_ecc_key_get_public (key, &p2); | 195 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &p2); |
196 | GNUNET_assert (0 != memcmp (&p1, &p2, sizeof (p1))); | 196 | GNUNET_assert (0 != memcmp (&p1, &p2, sizeof (p1))); |
197 | GNUNET_free (key); | 197 | GNUNET_free (key); |
198 | return GNUNET_OK; | 198 | return GNUNET_OK; |
@@ -204,15 +204,15 @@ test_ecdh () | |||
204 | { | 204 | { |
205 | struct GNUNET_CRYPTO_EccPrivateKey *priv1; | 205 | struct GNUNET_CRYPTO_EccPrivateKey *priv1; |
206 | struct GNUNET_CRYPTO_EccPrivateKey *priv2; | 206 | struct GNUNET_CRYPTO_EccPrivateKey *priv2; |
207 | struct GNUNET_CRYPTO_EccPublicKey pub1; | 207 | struct GNUNET_CRYPTO_EccPublicSignKey pub1; |
208 | struct GNUNET_CRYPTO_EccPublicKey pub2; | 208 | struct GNUNET_CRYPTO_EccPublicSignKey pub2; |
209 | struct GNUNET_HashCode ecdh1; | 209 | struct GNUNET_HashCode ecdh1; |
210 | struct GNUNET_HashCode ecdh2; | 210 | struct GNUNET_HashCode ecdh2; |
211 | 211 | ||
212 | priv1 = GNUNET_CRYPTO_ecc_key_create (); | 212 | priv1 = GNUNET_CRYPTO_ecc_key_create (); |
213 | priv2 = GNUNET_CRYPTO_ecc_key_create (); | 213 | priv2 = GNUNET_CRYPTO_ecc_key_create (); |
214 | GNUNET_CRYPTO_ecc_key_get_public (priv1, &pub1); | 214 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv1, &pub1); |
215 | GNUNET_CRYPTO_ecc_key_get_public (priv2, &pub2); | 215 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv2, &pub2); |
216 | GNUNET_CRYPTO_ecc_ecdh (priv1, &pub2, &ecdh1); | 216 | GNUNET_CRYPTO_ecc_ecdh (priv1, &pub2, &ecdh1); |
217 | GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &ecdh2); | 217 | GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &ecdh2); |
218 | GNUNET_assert (0 == memcmp (&ecdh1, &ecdh2, | 218 | GNUNET_assert (0 == memcmp (&ecdh1, &ecdh2, |