From 519972c9c18a103a7689844150c75e939c642115 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 10 Mar 2014 17:42:08 +0100 Subject: Make --verify-config option more flexible --- src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/protocols/ec25519_fhmqvc') 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, -- cgit v1.2.3