summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-01-09 10:37:22 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-01-09 10:37:22 +0100
commit2e11c07f23e6c062a5a6659c89b154acd92b5eeb (patch)
treed9ceebf158188534163e88b7f125d222965f750c
parent80645ad3479ca662ca4a9ceb618abbd0fdc6a13a (diff)
downloadfastd-2e11c07f23e6c062a5a6659c89b154acd92b5eeb.tar
fastd-2e11c07f23e6c062a5a6659c89b154acd92b5eeb.zip
Update to libuecc v3, check EC points for validity
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/protocol_ec25519_fhmqvc.c18
2 files changed, 13 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2d5332..1629400 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@ if(NOT CMAKE_USE_PTHREADS_INIT)
endif(NOT CMAKE_USE_PTHREADS_INIT)
find_package(PkgConfig REQUIRED)
-pkg_check_modules(UECC REQUIRED libuecc>=2)
+pkg_check_modules(UECC REQUIRED libuecc>=3)
find_package(NaCl REQUIRED)
diff --git a/src/protocol_ec25519_fhmqvc.c b/src/protocol_ec25519_fhmqvc.c
index c54e19b..15d26b7 100644
--- a/src/protocol_ec25519_fhmqvc.c
+++ b/src/protocol_ec25519_fhmqvc.c
@@ -270,8 +270,10 @@ static void respond_handshake(fastd_context_t *ctx, const fastd_socket_t *sock,
ecc_25519_gf_add(&s, &eb, &handshake_key->secret_key);
ecc_25519_work_t work, workX;
- ecc_25519_load_packed(&work, &peer->config->protocol_config->public_key);
- ecc_25519_load_packed(&workX, peer_handshake_key);
+ if (!ecc_25519_load_packed(&work, &peer->config->protocol_config->public_key))
+ return;
+ if (!ecc_25519_load_packed(&workX, peer_handshake_key))
+ return;
ecc_25519_scalarmult(&work, &d, &work);
ecc_25519_add(&work, &workX, &work);
@@ -387,8 +389,10 @@ static void finish_handshake(fastd_context_t *ctx, fastd_socket_t *sock, const f
ecc_25519_gf_add(&s, &da, &handshake_key->secret_key);
ecc_25519_work_t work, workY;
- ecc_25519_load_packed(&work, &peer->config->protocol_config->public_key);
- ecc_25519_load_packed(&workY, peer_handshake_key);
+ if (!ecc_25519_load_packed(&work, &peer->config->protocol_config->public_key))
+ return;
+ if (!ecc_25519_load_packed(&workY, peer_handshake_key))
+ return;
ecc_25519_scalarmult(&work, &e, &work);
ecc_25519_add(&work, &workY, &work);
@@ -457,8 +461,10 @@ static void handle_finish_handshake(fastd_context_t *ctx, fastd_socket_t *sock,
ecc_25519_gf_add(&s, &eb, &handshake_key->secret_key);
ecc_25519_work_t work, workX;
- ecc_25519_load_packed(&work, &peer->config->protocol_config->public_key);
- ecc_25519_load_packed(&workX, peer_handshake_key);
+ if (!ecc_25519_load_packed(&work, &peer->config->protocol_config->public_key))
+ return;
+ if (!ecc_25519_load_packed(&workX, peer_handshake_key))
+ return;
ecc_25519_scalarmult(&work, &d, &work);
ecc_25519_add(&work, &workX, &work);