diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-30 05:34:49 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-30 05:35:18 +0100 |
commit | aa1d894e102e23d162b8e2bccd4b3bf1700de2f2 (patch) | |
tree | 3027bc84e829650a798071ad9e13f4391260328b /src/methods/generic_gmac | |
parent | 5f7258ade2dd8bad076d17d3a85fb04d9bf71bda (diff) | |
download | fastd-aa1d894e102e23d162b8e2bccd4b3bf1700de2f2.tar fastd-aa1d894e102e23d162b8e2bccd4b3bf1700de2f2.zip |
Make the crypto implementations independent of fastd.h (and fix more minor bugs)
Diffstat (limited to 'src/methods/generic_gmac')
-rw-r--r-- | src/methods/generic_gmac/generic_gmac.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c index f7ea086..e9224f6 100644 --- a/src/methods/generic_gmac/generic_gmac.c +++ b/src/methods/generic_gmac/generic_gmac.c @@ -96,10 +96,10 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c session->method = method; session->cipher = fastd_cipher_get(ctx, method->cipher_info); - session->cipher_state = session->cipher->init(ctx, secret); + session->cipher_state = session->cipher->init(secret); session->ghash = fastd_mac_get(ctx, method->ghash_info); - session->ghash_state = session->ghash->init(ctx, secret + method->cipher_info->key_length); + session->ghash_state = session->ghash->init(secret + method->cipher_info->key_length); return session; } @@ -120,10 +120,10 @@ static void method_session_superseded(fastd_context_t *ctx, fastd_method_session fastd_method_session_common_superseded(ctx, &session->common); } -static void method_session_free(fastd_context_t *ctx, fastd_method_session_state_t *session) { +static void method_session_free(fastd_context_t *ctx UNUSED, fastd_method_session_state_t *session) { if (session) { - session->cipher->free(ctx, session->cipher_state); - session->ghash->free(ctx, session->ghash_state); + session->cipher->free(session->cipher_state); + session->ghash->free(session->ghash_state); free(session); } @@ -160,7 +160,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast fastd_block128_t *outblocks = out->data; fastd_block128_t sig; - bool ok = session->cipher->crypt(ctx, session->cipher_state, outblocks, inblocks, n_blocks*sizeof(fastd_block128_t), nonce); + bool ok = session->cipher->crypt(session->cipher_state, outblocks, inblocks, n_blocks*sizeof(fastd_block128_t), nonce); if (ok) { if (tail_len) @@ -168,7 +168,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer UNUSED, fast put_size(&outblocks[n_blocks], in.len-sizeof(fastd_block128_t)); - ok = session->ghash->hash(ctx, session->ghash_state, &sig, outblocks+1, n_blocks); + ok = session->ghash->hash(session->ghash_state, &sig, outblocks+1, n_blocks); } if (!ok) { @@ -224,7 +224,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho fastd_block128_t *outblocks = out->data; fastd_block128_t sig; - bool ok = session->cipher->crypt(ctx, session->cipher_state, outblocks, inblocks, n_blocks*sizeof(fastd_block128_t), nonce); + bool ok = session->cipher->crypt(session->cipher_state, outblocks, inblocks, n_blocks*sizeof(fastd_block128_t), nonce); if (ok) { if (tail_len) @@ -232,7 +232,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho put_size(&inblocks[n_blocks], in.len-sizeof(fastd_block128_t)); - ok = session->ghash->hash(ctx, session->ghash_state, &sig, inblocks+1, n_blocks); + ok = session->ghash->hash(session->ghash_state, &sig, inblocks+1, n_blocks); } if (!ok || memcmp(&sig, &outblocks[0], sizeof(fastd_block128_t)) != 0) { |