diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-25 14:21:47 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-25 14:21:47 +0200 |
commit | 59a5b833216b62f28c816df7c9129bf0954993e0 (patch) | |
tree | 64c35f8ddcc8eafa9e12663b8eb12ba836ea1886 /src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c | |
parent | 6ce20e2bb6660694e995d890f2846fc26c96c8f7 (diff) | |
download | fastd-59a5b833216b62f28c816df7c9129bf0954993e0.tar fastd-59a5b833216b62f28c816df7c9129bf0954993e0.zip |
Change parse to push API, fix some parser bugs
Diffstat (limited to 'src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c')
-rw-r--r-- | src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c b/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c index 53901ba..4152601 100644 --- a/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c +++ b/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c @@ -36,9 +36,9 @@ #include <crypto_secretbox_xsalsa20poly1305.h> -typedef struct _protocol_config { +typedef struct _protocol_context { ecc_secret_key_256 secret_key; -} protocol_config; +} protocol_context; typedef struct _protocol_peer_config { ecc_public_key_256 public_key; @@ -48,15 +48,13 @@ typedef struct _protocol_peer_state { } protocol_peer_state; -static bool protocol_handle_config(fastd_context *ctx, const fastd_config *conf, const char *option) { - printf("Unknown option: %s\n", option); - return false; -} - static bool protocol_check_config(fastd_context *ctx, const fastd_config *conf) { return true; } +static void protocol_init(fastd_context *ctx) { +} + static size_t protocol_max_packet_size(fastd_context *ctx) { return (fastd_max_packet_size(ctx) - crypto_secretbox_xsalsa20poly1305_NONCEBYTES); } @@ -94,7 +92,7 @@ static char* protocol_peer_str(const fastd_context *ctx, const fastd_peer *peer) return NULL; } -static void protocol_init(fastd_context *ctx, fastd_peer *peer) { +static void protocol_init_peer(fastd_context *ctx, fastd_peer *peer) { pr_info(ctx, "Initializing session with %P...", peer); } @@ -113,14 +111,15 @@ static void protocol_free_peer_private(fastd_context *ctx, fastd_peer *peer) { const fastd_protocol fastd_protocol_ec25519_fhmqvc_xsalsa20_poly1305 = { .name = "ec25519-fhmqvc-xsalsa20-poly1305", - .handle_config = protocol_handle_config, .check_config = protocol_check_config, + .init = protocol_init, + .max_packet_size = protocol_max_packet_size, .peer_str = protocol_peer_str, - .init = protocol_init, + .init_peer = protocol_init_peer, .handle_recv = protocol_handle_recv, .send = protocol_send, |