summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-10-13 21:44:09 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-10-13 21:44:09 +0200
commit50b83be77b44fa173e3d2e59bb845e761e80caaa (patch)
treee1f2ca1841e7ff0abc240a4dc688b7620f5fd5a4 /src
parentb63d267e79a54b1c1f0c3e987a28535055d5f574 (diff)
downloadfastd-50b83be77b44fa173e3d2e59bb845e761e80caaa.tar
fastd-50b83be77b44fa173e3d2e59bb845e761e80caaa.zip
ec25519-fhmqvc: improve unknown key message
Diffstat (limited to 'src')
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index 50fc594..e975e6d 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -519,6 +519,13 @@ void fastd_protocol_ec25519_fhmqvc_handshake_init(fastd_socket_t *sock, const fa
}
+static inline void print_unknown_key(const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES]) {
+ char buf[65];
+ hexdump(buf, key);
+
+ pr_verbose("ignoring handshake from %I (unknown key %s)", addr, buf);
+}
+
#ifdef WITH_DYNAMIC_PEERS
/** Data attached to an asynchronous on-verify run */
@@ -529,7 +536,7 @@ typedef struct verify_data {
/** Adds a dynamic peer for an unknown key */
static fastd_peer_t * add_dynamic(fastd_socket_t *sock, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES]) {
if (!fastd_allow_verify()) {
- pr_debug("ignoring handshake from %I (unknown key)", addr);
+ print_unknown_key(addr, key);
return NULL;
}
@@ -606,8 +613,8 @@ void fastd_protocol_ec25519_fhmqvc_handle_verify_return(fastd_peer_t *peer, fast
#else
/** Dummy add dynamic function for fastd versions without on-verify support */
-static inline fastd_peer_t * add_dynamic(UNUSED fastd_socket_t *sock, const fastd_peer_address_t *addr, UNUSED const unsigned char key[PUBLICKEYBYTES]) {
- pr_debug("ignoring handshake from %I (unknown key)", addr);
+static inline fastd_peer_t * add_dynamic(UNUSED fastd_socket_t *sock, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES]) {
+ print_unknown_key(addr, key);
return NULL;
}