summaryrefslogtreecommitdiffstats
path: root/src/protocols
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-03-10 17:42:08 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-03-10 17:42:08 +0100
commit519972c9c18a103a7689844150c75e939c642115 (patch)
tree4d3def2563b7547b318f0e6f62ed1b3917ee7487 /src/protocols
parentb7fec238bd094d70df001c069cb9ac11056f907c (diff)
downloadfastd-519972c9c18a103a7689844150c75e939c642115.tar
fastd-519972c9c18a103a7689844150c75e939c642115.zip
Make --verify-config option more flexible
Diffstat (limited to 'src/protocols')
-rw-r--r--src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c
index 1e3c36a..7f77a22 100644
--- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c
+++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c
@@ -65,6 +65,15 @@ static fastd_protocol_config_t* protocol_init(fastd_context_t *ctx) {
return protocol_config;
}
+static void protocol_peer_verify(fastd_context_t *ctx, fastd_peer_config_t *peer_conf) {
+ if (!peer_conf->key)
+ exit_error(ctx, "no key configured for peer `%s'", peer_conf->name);
+
+ aligned_int256_t key;
+ if (!read_key(key.u8, peer_conf->key))
+ exit_error(ctx, "invalid key configured for peer `%s'", peer_conf->name);
+}
+
static void protocol_peer_configure(fastd_context_t *ctx, fastd_peer_config_t *peer_conf) {
if (peer_conf->protocol_config)
return;
@@ -188,6 +197,7 @@ const fastd_protocol_t fastd_protocol_ec25519_fhmqvc = {
.name = "ec25519-fhmqvc",
.init = protocol_init,
+ .peer_verify = protocol_peer_verify,
.peer_configure = protocol_peer_configure,
.peer_check = fastd_protocol_ec25519_fhmqvc_peer_check,