summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-20 01:51:12 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-20 01:51:12 +0100
commitb5112ff67f3dd5bb263f5ca6283f170906acaab6 (patch)
treeb1b3974a9e4ae986c516c53ae723df1c2057974d /src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
parent9bb8a04e288d3df817a4328cce9e0ef8f96a0600 (diff)
downloadfastd-b5112ff67f3dd5bb263f5ca6283f170906acaab6.tar
fastd-b5112ff67f3dd5bb263f5ca6283f170906acaab6.zip
Slightly simplify method/cipher/MAC definitions
Diffstat (limited to 'src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c')
-rw-r--r--src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c b/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
index 5cb4bc7..7c75b7d 100644
--- a/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
+++ b/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c
@@ -37,10 +37,6 @@ static fastd_cipher_context_t* aes128_ctr_initialize(fastd_context_t *ctx UNUSED
return NULL;
}
-static size_t aes128_ctr_key_length(fastd_context_t *ctx UNUSED, const fastd_cipher_context_t *cctx UNUSED) {
- return 16;
-}
-
static fastd_cipher_state_t* aes128_ctr_init_state(fastd_context_t *ctx, const fastd_cipher_context_t *cctx UNUSED, const uint8_t *key) {
fastd_block128_t k;
memcpy(k.b, key, sizeof(fastd_block128_t));
@@ -55,10 +51,6 @@ static fastd_cipher_state_t* aes128_ctr_init_state(fastd_context_t *ctx, const f
return state;
}
-static size_t aes128_ctr_iv_length(fastd_context_t *ctx UNUSED, const fastd_cipher_state_t *state UNUSED) {
- return 16;
-}
-
static bool aes128_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t len, const uint8_t *iv) {
crypto_stream_aes128ctr_xor_afternm(out->b, in->b, len, iv, state->d);
return true;
@@ -76,13 +68,12 @@ static void aes128_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t
const fastd_cipher_t fastd_cipher_aes128_ctr_nacl = {
.name = "nacl",
+ .key_length = 16,
+ .iv_length = 16,
.initialize = aes128_ctr_initialize,
-
- .key_length = aes128_ctr_key_length,
.init_state = aes128_ctr_init_state,
- .iv_length = aes128_ctr_iv_length,
.crypt = aes128_ctr_crypt,
.free_state = aes128_ctr_free_state,