summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-10-25 18:20:56 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-10-25 18:20:56 +0100
commitf5a723399dfc3969bdb712b22616721ec740f818 (patch)
treefa01c15187091d3f4ed105f657c5fc50ebf83b59
parent11bca5a7af4b448ee0a37cd243e34ecd0e652b3d (diff)
downloadfastd-f5a723399dfc3969bdb712b22616721ec740f818.tar
fastd-f5a723399dfc3969bdb712b22616721ec740f818.zip
Update libuecc dependency to v6 and remove use of deprecated API
-rw-r--r--cmake/Findlibuecc.cmake2
-rw-r--r--src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c6
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c6
-rw-r--r--src/protocols/ec25519_fhmqvc/state.c4
-rw-r--r--src/protocols/ec25519_fhmqvc/util.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/cmake/Findlibuecc.cmake b/cmake/Findlibuecc.cmake
index dfee8bc..b1852d6 100644
--- a/cmake/Findlibuecc.cmake
+++ b/cmake/Findlibuecc.cmake
@@ -12,7 +12,7 @@ else(ANDROID)
find_package(PkgConfig REQUIRED QUIET)
endif(ANDROID)
-pkg_check_modules(_LIBUECC libuecc>=5)
+pkg_check_modules(_LIBUECC libuecc>=6)
find_path(LIBUECC_INCLUDE_DIR NAMES libuecc/ecc.h HINTS ${_LIBUECC_INCLUDE_DIRS})
find_library(LIBUECC_LIBRARIES NAMES uecc HINTS ${_LIBUECC_LIBRARY_DIRS})
diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c
index ec97901..0696bf0 100644
--- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c
+++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c
@@ -68,8 +68,8 @@ static fastd_protocol_config_t * protocol_init(void) {
exit_error("invalid secret key");
ecc_25519_work_t work;
- ecc_25519_scalarmult_base(&work, &protocol_config->key.secret);
- ecc_25519_store_packed(&protocol_config->key.public.int256, &work);
+ ecc_25519_scalarmult(&work, &protocol_config->key.secret, &ecc_25519_work_base_legacy);
+ ecc_25519_store_packed_legacy(&protocol_config->key.public.int256, &work);
if (!divide_key(&protocol_config->key.secret))
exit_error("invalid secret key");
@@ -82,7 +82,7 @@ static fastd_protocol_key_t * protocol_read_key(const char *key) {
fastd_protocol_key_t *ret = fastd_new(fastd_protocol_key_t);
if (read_key(ret->key.u8, key)) {
- if (ecc_25519_load_packed(&ret->unpacked, &ret->key.int256)) {
+ if (ecc_25519_load_packed_legacy(&ret->unpacked, &ret->key.int256)) {
if (!ecc_25519_is_identity(&ret->unpacked))
return ret;
}
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index ee26892..0609355 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -198,7 +198,7 @@ static bool make_shared_handshake_key(bool initiator, const keypair_t *handshake
const aligned_int256_t *A, *B, *X, *Y;
ecc_25519_work_t work, workXY;
- if (!ecc_25519_load_packed(&workXY, &peer_handshake_key->int256))
+ if (!ecc_25519_load_packed_legacy(&workXY, &peer_handshake_key->int256))
return false;
if (ecc_25519_is_identity(&workXY))
@@ -261,7 +261,7 @@ static bool make_shared_handshake_key(bool initiator, const keypair_t *handshake
if (ecc_25519_is_identity(&work))
return false;
- ecc_25519_store_packed(&sigma->int256, &work);
+ ecc_25519_store_packed_legacy(&sigma->int256, &work);
if (shared_handshake_key)
derive_key(shared_handshake_key, 1, zero_salt, "", A, B, X, Y, sigma);
@@ -561,7 +561,7 @@ static fastd_peer_t * add_dynamic(fastd_socket_t *sock, const fastd_peer_address
fastd_protocol_key_t peer_key;
memcpy(&peer_key.key, key, PUBLICKEYBYTES);
- if (!ecc_25519_load_packed(&peer_key.unpacked, &peer_key.key.int256)
+ if (!ecc_25519_load_packed_legacy(&peer_key.unpacked, &peer_key.key.int256)
|| ecc_25519_is_identity(&peer_key.unpacked)) {
pr_debug("ignoring handshake from %I (invalid key)", addr);
return NULL;
diff --git a/src/protocols/ec25519_fhmqvc/state.c b/src/protocols/ec25519_fhmqvc/state.c
index 855df77..463b2ef 100644
--- a/src/protocols/ec25519_fhmqvc/state.c
+++ b/src/protocols/ec25519_fhmqvc/state.c
@@ -50,8 +50,8 @@ static void new_handshake_key(keypair_t *key) {
ecc_25519_gf_sanitize_secret(&key->secret, &key->secret);
ecc_25519_work_t work;
- ecc_25519_scalarmult_base(&work, &key->secret);
- ecc_25519_store_packed(&key->public.int256, &work);
+ ecc_25519_scalarmult(&work, &key->secret, &ecc_25519_work_base_legacy);
+ ecc_25519_store_packed_legacy(&key->public.int256, &work);
if (!divide_key(&key->secret))
exit_bug("generated invalid ephemeral key");
diff --git a/src/protocols/ec25519_fhmqvc/util.c b/src/protocols/ec25519_fhmqvc/util.c
index 6ee1a39..11aa0ef 100644
--- a/src/protocols/ec25519_fhmqvc/util.c
+++ b/src/protocols/ec25519_fhmqvc/util.c
@@ -53,8 +53,8 @@ void fastd_protocol_ec25519_fhmqvc_generate_key(void) {
ecc_25519_gf_sanitize_secret(&secret_key, &secret_key);
ecc_25519_work_t work;
- ecc_25519_scalarmult_base(&work, &secret_key);
- ecc_25519_store_packed(&public_key, &work);
+ ecc_25519_scalarmult(&work, &secret_key, &ecc_25519_work_base_legacy);
+ ecc_25519_store_packed_legacy(&public_key, &work);
if (conf.machine_readable) {
print_hexdump("", secret_key.p);