diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-10 14:38:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-10 14:38:55 +0000 |
commit | 9351b1e9bdf2b067b6db06562c26ba658cff42b8 (patch) | |
tree | 68dc4ab447e7e8b6a20a706858cd36238c1c7c5f /src/transport/gnunet-service-transport_validation.c | |
parent | 8beabcd96c0cf1e1873c0b5ff96e537f1beb0b34 (diff) | |
download | gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.tar.gz gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.zip |
separating ECC crypto into functions/structs for ECDHE, ECDSA and EDDSA
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 6018e2c7b..f5f3d6d56 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -148,7 +148,7 @@ struct TransportPongMessage | |||
148 | /** | 148 | /** |
149 | * Signature. | 149 | * Signature. |
150 | */ | 150 | */ |
151 | struct GNUNET_CRYPTO_EccSignature signature; | 151 | struct GNUNET_CRYPTO_EddsaSignature signature; |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN to confirm that this is a | 154 | * GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN to confirm that this is a |
@@ -189,7 +189,7 @@ struct ValidationEntry | |||
189 | /** | 189 | /** |
190 | * Public key of the peer. | 190 | * Public key of the peer. |
191 | */ | 191 | */ |
192 | struct GNUNET_CRYPTO_EccPublicSignKey public_key; | 192 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * The identity of the peer. FIXME: duplicated (also in 'address') | 195 | * The identity of the peer. FIXME: duplicated (also in 'address') |
@@ -199,7 +199,7 @@ struct ValidationEntry | |||
199 | /** | 199 | /** |
200 | * Cached PONG signature | 200 | * Cached PONG signature |
201 | */ | 201 | */ |
202 | struct GNUNET_CRYPTO_EccSignature pong_sig_cache; | 202 | struct GNUNET_CRYPTO_EddsaSignature pong_sig_cache; |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * ID of task that will clean up this entry if nothing happens. | 205 | * ID of task that will clean up this entry if nothing happens. |
@@ -678,7 +678,7 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
678 | * if we don't have an existing entry and no public key was given | 678 | * if we don't have an existing entry and no public key was given |
679 | */ | 679 | */ |
680 | static struct ValidationEntry * | 680 | static struct ValidationEntry * |
681 | find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, | 681 | find_validation_entry (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, |
682 | const struct GNUNET_HELLO_Address *address) | 682 | const struct GNUNET_HELLO_Address *address) |
683 | { | 683 | { |
684 | struct ValidationEntryMatchContext vemc; | 684 | struct ValidationEntryMatchContext vemc; |
@@ -701,7 +701,7 @@ find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, | |||
701 | ve->public_key = *public_key; | 701 | ve->public_key = *public_key; |
702 | ve->pid = address->peer; | 702 | ve->pid = address->peer; |
703 | ve->pong_sig_valid_until = GNUNET_TIME_absolute_get_zero_(); | 703 | ve->pong_sig_valid_until = GNUNET_TIME_absolute_get_zero_(); |
704 | memset (&ve->pong_sig_cache, '\0', sizeof (struct GNUNET_CRYPTO_EccSignature)); | 704 | memset (&ve->pong_sig_cache, '\0', sizeof (struct GNUNET_CRYPTO_EddsaSignature)); |
705 | ve->latency = GNUNET_TIME_UNIT_FOREVER_REL; | 705 | ve->latency = GNUNET_TIME_UNIT_FOREVER_REL; |
706 | ve->challenge = | 706 | ve->challenge = |
707 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); | 707 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); |
@@ -733,7 +733,7 @@ add_valid_address (void *cls, const struct GNUNET_HELLO_Address *address, | |||
733 | struct ValidationEntry *ve; | 733 | struct ValidationEntry *ve; |
734 | struct GNUNET_PeerIdentity pid; | 734 | struct GNUNET_PeerIdentity pid; |
735 | struct GNUNET_ATS_Information ats; | 735 | struct GNUNET_ATS_Information ats; |
736 | struct GNUNET_CRYPTO_EccPublicSignKey public_key; | 736 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; |
737 | 737 | ||
738 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) | 738 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) |
739 | return GNUNET_OK; /* expired */ | 739 | return GNUNET_OK; /* expired */ |
@@ -855,7 +855,7 @@ GST_validation_stop () | |||
855 | */ | 855 | */ |
856 | static void | 856 | static void |
857 | multicast_pong (void *cls, | 857 | multicast_pong (void *cls, |
858 | const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, | 858 | const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, |
859 | struct GNUNET_TIME_Absolute valid_until, | 859 | struct GNUNET_TIME_Absolute valid_until, |
860 | struct GNUNET_TIME_Absolute validation_block, | 860 | struct GNUNET_TIME_Absolute validation_block, |
861 | const struct GNUNET_HELLO_Address *address) | 861 | const struct GNUNET_HELLO_Address *address) |
@@ -901,7 +901,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
901 | const struct TransportPingMessage *ping; | 901 | const struct TransportPingMessage *ping; |
902 | struct TransportPongMessage *pong; | 902 | struct TransportPongMessage *pong; |
903 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 903 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
904 | struct GNUNET_CRYPTO_EccSignature *sig_cache; | 904 | struct GNUNET_CRYPTO_EddsaSignature *sig_cache; |
905 | struct GNUNET_TIME_Absolute *sig_cache_exp; | 905 | struct GNUNET_TIME_Absolute *sig_cache_exp; |
906 | const char *addr; | 906 | const char *addr; |
907 | const char *addrend; | 907 | const char *addrend; |
@@ -1022,7 +1022,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1022 | { | 1022 | { |
1023 | addrend = NULL; /* make gcc happy */ | 1023 | addrend = NULL; /* make gcc happy */ |
1024 | slen = 0; | 1024 | slen = 0; |
1025 | static struct GNUNET_CRYPTO_EccSignature no_address_signature; | 1025 | static struct GNUNET_CRYPTO_EddsaSignature no_address_signature; |
1026 | static struct GNUNET_TIME_Absolute no_address_signature_expiration; | 1026 | static struct GNUNET_TIME_Absolute no_address_signature_expiration; |
1027 | 1027 | ||
1028 | sig_cache = &no_address_signature; | 1028 | sig_cache = &no_address_signature; |
@@ -1063,7 +1063,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1063 | *sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME); | 1063 | *sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME); |
1064 | pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); | 1064 | pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); |
1065 | if (GNUNET_OK != | 1065 | if (GNUNET_OK != |
1066 | GNUNET_CRYPTO_ecc_sign (GST_my_private_key, &pong->purpose, | 1066 | GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, &pong->purpose, |
1067 | sig_cache)) | 1067 | sig_cache)) |
1068 | { | 1068 | { |
1069 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1069 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -1141,7 +1141,7 @@ struct ValidateAddressContext | |||
1141 | /** | 1141 | /** |
1142 | * Public key of the peer whose address is being validated. | 1142 | * Public key of the peer whose address is being validated. |
1143 | */ | 1143 | */ |
1144 | struct GNUNET_CRYPTO_EccPublicSignKey public_key; | 1144 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; |
1145 | }; | 1145 | }; |
1146 | 1146 | ||
1147 | 1147 | ||
@@ -1274,7 +1274,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1274 | { | 1274 | { |
1275 | /* We have a cached and valid signature for this peer, | 1275 | /* We have a cached and valid signature for this peer, |
1276 | * try to compare instead of verify */ | 1276 | * try to compare instead of verify */ |
1277 | if (0 == memcmp (&ve->pong_sig_cache, &pong->signature, sizeof (struct GNUNET_CRYPTO_EccSignature))) | 1277 | if (0 == memcmp (&ve->pong_sig_cache, &pong->signature, sizeof (struct GNUNET_CRYPTO_EddsaSignature))) |
1278 | { | 1278 | { |
1279 | /* signatures are identical, we can skip verification */ | 1279 | /* signatures are identical, we can skip verification */ |
1280 | sig_res = GNUNET_OK; | 1280 | sig_res = GNUNET_OK; |
@@ -1290,7 +1290,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1290 | if (GNUNET_YES == do_verify) | 1290 | if (GNUNET_YES == do_verify) |
1291 | { | 1291 | { |
1292 | /* Do expensive verification */ | 1292 | /* Do expensive verification */ |
1293 | sig_res = GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, | 1293 | sig_res = GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, |
1294 | &pong->purpose, &pong->signature, | 1294 | &pong->purpose, &pong->signature, |
1295 | &ve->public_key); | 1295 | &ve->public_key); |
1296 | if (sig_res == GNUNET_SYSERR) | 1296 | if (sig_res == GNUNET_SYSERR) |