From 2acd81bd7a1b364b02831ae5f8e46457d9d07865 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 21 Sep 2012 15:07:11 +0200 Subject: Nicely encapsulate different crypto algorithm implementations --- src/fastd.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/fastd.h') diff --git a/src/fastd.h b/src/fastd.h index 4d435a7..1ee8939 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -163,8 +163,13 @@ struct _fastd_config { char *secret; unsigned key_valid; unsigned key_refresh; - fastd_alg_impl alg_impl_aes128ctr; - fastd_alg_impl alg_impl_ghash; + +#ifdef USE_CRYPTO_AES128CTR + const fastd_crypto_aes128ctr *crypto_aes128ctr; +#endif +#ifdef USE_CRYPTO_GHASH + const fastd_crypto_ghash *crypto_ghash; +#endif fastd_string_stack *peer_dirs; fastd_peer_config *peers; @@ -217,8 +222,12 @@ struct _fastd_context { int sockfd; int sock6fd; - int algfd_ghash; - int algfd_aesctr; +#ifdef USE_CRYPTO_AES128CTR + fastd_crypto_aes128ctr_context *crypto_aes128ctr; +#endif +#ifdef USE_CRYPTO_GHASH + fastd_crypto_ghash_context *crypto_ghash; +#endif size_t eth_addr_size; size_t n_eth_addr; @@ -249,7 +258,7 @@ bool fastd_read_config(fastd_context *ctx, fastd_config *conf, const char *filen bool fastd_config_protocol(fastd_context *ctx, fastd_config *conf, const char *name); bool fastd_config_method(fastd_context *ctx, fastd_config *conf, const char *name); -bool fastd_config_algorithm(fastd_context *ctx, fastd_config *conf, const char *alg, const char *impl); +bool fastd_config_crypto(fastd_context *ctx, fastd_config *conf, const char *alg, const char *impl); bool fastd_config_add_log_file(fastd_context *ctx, fastd_config *conf, const char *name, int level); void fastd_configure(fastd_context *ctx, fastd_config *conf, int argc, char *const argv[]); void fastd_reconfigure(fastd_context *ctx, fastd_config *conf); -- cgit v1.2.3