From b9c8603931203f5d94091f7a05a5967304b62fbd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 20 Apr 2014 04:36:34 +0200 Subject: Make conf global --- src/methods/cipher_test/cipher_test.c | 2 +- src/methods/common.c | 6 +++--- src/methods/common.h | 2 +- src/methods/composed_gmac/composed_gmac.c | 6 +++--- src/methods/generic_gmac/generic_gmac.c | 4 ++-- src/methods/generic_poly1305/generic_poly1305.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/methods') diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c index b33133a..0cec4b0 100644 --- a/src/methods/cipher_test/cipher_test.c +++ b/src/methods/cipher_test/cipher_test.c @@ -79,7 +79,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c fastd_method_common_init(ctx, &session->common, initiator); session->method = method; - session->cipher = fastd_cipher_get(ctx, method->cipher_info); + session->cipher = fastd_cipher_get(method->cipher_info); session->cipher_state = session->cipher->init(secret); pr_warn(ctx, "using cipher-test method; this method must be used for testing and benchmarks only"); diff --git a/src/methods/common.c b/src/methods/common.c index 26bdf2e..166d3ab 100644 --- a/src/methods/common.c +++ b/src/methods/common.c @@ -30,8 +30,8 @@ void fastd_method_common_init(fastd_context_t *ctx, fastd_method_common_t *session, bool initiator) { memset(session, 0, sizeof(*session)); - session->valid_till = fastd_in_seconds(ctx, ctx->conf->key_valid); - session->refresh_after = fastd_in_seconds(ctx, ctx->conf->key_refresh - fastd_rand(ctx, 0, ctx->conf->key_refresh_splay)); + session->valid_till = fastd_in_seconds(ctx, conf.key_valid); + session->refresh_after = fastd_in_seconds(ctx, conf.key_refresh - fastd_rand(ctx, 0, conf.key_refresh_splay)); if (initiator) { session->send_nonce[COMMON_NONCEBYTES-1] = 3; @@ -79,7 +79,7 @@ bool fastd_method_reorder_check(fastd_context_t *ctx, fastd_peer_t *peer, fastd_ session->receive_reorder_seen |= (1 << (shift-1)); memcpy(session->receive_nonce, nonce, COMMON_NONCEBYTES); - session->reorder_timeout = fastd_in_seconds(ctx, ctx->conf->reorder_time); + session->reorder_timeout = fastd_in_seconds(ctx, conf.reorder_time); return true; } else if (age == 0 || session->receive_reorder_seen & (1 << (age-1))) { diff --git a/src/methods/common.h b/src/methods/common.h index 4d9c4c0..510ad3f 100644 --- a/src/methods/common.h +++ b/src/methods/common.h @@ -73,7 +73,7 @@ static inline bool fastd_method_session_common_want_refresh(fastd_context_t *ctx } static inline void fastd_method_session_common_superseded(fastd_context_t *ctx, fastd_method_common_t *session) { - struct timespec valid_max = fastd_in_seconds(ctx, ctx->conf->key_valid_old); + struct timespec valid_max = fastd_in_seconds(ctx, conf.key_valid_old); if (timespec_after(&session->valid_till, &valid_max)) session->valid_till = valid_max; diff --git a/src/methods/composed_gmac/composed_gmac.c b/src/methods/composed_gmac/composed_gmac.c index d420f31..c848bbf 100644 --- a/src/methods/composed_gmac/composed_gmac.c +++ b/src/methods/composed_gmac/composed_gmac.c @@ -122,10 +122,10 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c fastd_method_common_init(ctx, &session->common, initiator); session->method = method; - session->cipher = fastd_cipher_get(ctx, method->cipher_info); + session->cipher = fastd_cipher_get(method->cipher_info); session->cipher_state = session->cipher->init(secret); - session->gmac_cipher = fastd_cipher_get(ctx, method->gmac_cipher_info); + session->gmac_cipher = fastd_cipher_get(method->gmac_cipher_info); session->gmac_cipher_state = session->gmac_cipher->init(secret + method->cipher_info->key_length); fastd_block128_t H; @@ -142,7 +142,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c return NULL; } - session->ghash = fastd_mac_get(ctx, method->ghash_info); + session->ghash = fastd_mac_get(method->ghash_info); session->ghash_state = session->ghash->init(H.b); return session; diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c index a15083b..88c1880 100644 --- a/src/methods/generic_gmac/generic_gmac.c +++ b/src/methods/generic_gmac/generic_gmac.c @@ -99,7 +99,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c fastd_method_common_init(ctx, &session->common, initiator); session->method = method; - session->cipher = fastd_cipher_get(ctx, method->cipher_info); + session->cipher = fastd_cipher_get(method->cipher_info); session->cipher_state = session->cipher->init(secret); static const fastd_block128_t zeroblock = {}; @@ -115,7 +115,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c return NULL; } - session->ghash = fastd_mac_get(ctx, method->ghash_info); + session->ghash = fastd_mac_get(method->ghash_info); session->ghash_state = session->ghash->init(H.b); return session; diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c index d9db73f..a8eb3d1 100644 --- a/src/methods/generic_poly1305/generic_poly1305.c +++ b/src/methods/generic_poly1305/generic_poly1305.c @@ -88,7 +88,7 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c fastd_method_common_init(ctx, &session->common, initiator); session->method = method; - session->cipher = fastd_cipher_get(ctx, session->method->cipher_info); + session->cipher = fastd_cipher_get(session->method->cipher_info); session->cipher_state = session->cipher->init(secret); return session; -- cgit v1.2.3