diff options
Diffstat (limited to 'src/methods/generic_poly1305/generic_poly1305.c')
-rw-r--r-- | src/methods/generic_poly1305/generic_poly1305.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c index 3820907..c40e70f 100644 --- a/src/methods/generic_poly1305/generic_poly1305.c +++ b/src/methods/generic_poly1305/generic_poly1305.c @@ -38,12 +38,11 @@ struct fastd_method_session_state { const fastd_cipher_info_t *cipher_info; const fastd_cipher_t *cipher; - const fastd_cipher_context_t *cipher_ctx; fastd_cipher_state_t *cipher_state; }; -static bool cipher_get(fastd_context_t *ctx, const char *name, const fastd_cipher_info_t **cipher_info, const fastd_cipher_t **cipher, const fastd_cipher_context_t **cctx) { +static bool cipher_get(fastd_context_t *ctx, const char *name, const fastd_cipher_info_t **cipher_info, const fastd_cipher_t **cipher) { size_t len = strlen(name); if (len < 9) @@ -59,7 +58,7 @@ static bool cipher_get(fastd_context_t *ctx, const char *name, const fastd_ciphe const fastd_cipher_info_t *info = NULL; if (ctx) { - *cipher = fastd_cipher_get_by_name(ctx, cipher_name, &info, cctx); + *cipher = fastd_cipher_get_by_name(ctx, cipher_name, &info); if (!*cipher) return false; } @@ -80,12 +79,12 @@ static bool cipher_get(fastd_context_t *ctx, const char *name, const fastd_ciphe static bool method_provides(const char *name) { - return cipher_get(NULL, name, NULL, NULL, NULL); + return cipher_get(NULL, name, NULL, NULL); } static size_t method_key_length(fastd_context_t *ctx, const char *name) { const fastd_cipher_info_t *cipher_info; - if (!cipher_get(NULL, name, &cipher_info, NULL, NULL)) + if (!cipher_get(NULL, name, &cipher_info, NULL)) exit_bug(ctx, "generic-poly1305: can't get cipher key length"); return cipher_info->key_length; @@ -96,10 +95,10 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c fastd_method_common_init(ctx, &session->common, initiator); - if (!cipher_get(ctx, name, &session->cipher_info, &session->cipher, &session->cipher_ctx)) + if (!cipher_get(ctx, name, &session->cipher_info, &session->cipher)) exit_bug(ctx, "generic-poly1305: can't instanciate cipher"); - session->cipher_state = session->cipher->init_state(ctx, session->cipher_ctx, secret); + session->cipher_state = session->cipher->init(ctx, secret); if (session->cipher_info->iv_length <= COMMON_NONCEBYTES) exit_bug(ctx, "generic-poly1305: iv_length to small"); @@ -125,7 +124,7 @@ static void method_session_superseded(fastd_context_t *ctx, fastd_method_session static void method_session_free(fastd_context_t *ctx, fastd_method_session_state_t *session) { if (session) { - session->cipher->free_state(ctx, session->cipher_state); + session->cipher->free(ctx, session->cipher_state); free(session); } } |