diff options
Diffstat (limited to 'src/crypto/cipher/aes128_ctr')
-rw-r--r-- | src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c | 17 | ||||
-rw-r--r-- | src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c | 19 |
2 files changed, 7 insertions, 29 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 783a9d1..f4756a3 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 @@ -33,11 +33,7 @@ struct __attribute__((aligned(16))) fastd_cipher_state { }; -static fastd_cipher_context_t* aes128_ctr_initialize(fastd_context_t *ctx UNUSED) { - return NULL; -} - -static fastd_cipher_state_t* aes128_ctr_init_state(fastd_context_t *ctx, const fastd_cipher_context_t *cctx UNUSED, const uint8_t *key) { +static fastd_cipher_state_t* aes128_ctr_init(fastd_context_t *ctx, const uint8_t *key) { fastd_block128_t k; memcpy(k.b, key, sizeof(fastd_block128_t)); @@ -56,24 +52,17 @@ static bool aes128_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_sta return true; } -static void aes128_ctr_free_state(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) { +static void aes128_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) { if (state) { secure_memzero(state, sizeof(*state)); free(state); } } -static void aes128_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *cctx UNUSED) { -} - const fastd_cipher_t fastd_cipher_aes128_ctr_nacl = { .available = fastd_true, - .initialize = aes128_ctr_initialize, - .init_state = aes128_ctr_init_state, - + .init = aes128_ctr_init, .crypt = aes128_ctr_crypt, - - .free_state = aes128_ctr_free_state, .free = aes128_ctr_free, }; diff --git a/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c b/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c index 6917333..b3c739c 100644 --- a/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c +++ b/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c @@ -28,16 +28,12 @@ #include <openssl/evp.h> -struct __attribute__((aligned(16))) fastd_cipher_state { +struct fastd_cipher_state { EVP_CIPHER_CTX *aes; }; -static fastd_cipher_context_t* aes128_ctr_initialize(fastd_context_t *ctx UNUSED) { - return NULL; -} - -static fastd_cipher_state_t* aes128_ctr_init_state(fastd_context_t *ctx UNUSED, const fastd_cipher_context_t *cctx UNUSED, const uint8_t *key) { +static fastd_cipher_state_t* aes128_ctr_init(fastd_context_t *ctx UNUSED, const uint8_t *key) { fastd_cipher_state_t *state = malloc(sizeof(fastd_cipher_state_t)); state->aes = EVP_CIPHER_CTX_new(); @@ -64,24 +60,17 @@ static bool aes128_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_sta return true; } -static void aes128_ctr_free_state(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) { +static void aes128_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) { if (state) { EVP_CIPHER_CTX_free(state->aes); free(state); } } -static void aes128_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *cctx UNUSED) { -} - const fastd_cipher_t fastd_cipher_aes128_ctr_openssl = { .available = fastd_true, - .initialize = aes128_ctr_initialize, - .init_state = aes128_ctr_init_state, - + .init = aes128_ctr_init, .crypt = aes128_ctr_crypt, - - .free_state = aes128_ctr_free_state, .free = aes128_ctr_free, }; |