From 546ac7936340312cf272969ff83317ae4d50d2b4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 2 Aug 2014 00:53:47 +0200 Subject: Introduce and use alloc helpers These new helpers will terminate fastd on allocation failures and add some additional convenience (allow strdup with NULL; typesafe new(type) macros). --- src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/crypto/cipher/aes128_ctr') 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 0bf4bbc..cbf1ed5 100644 --- a/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c +++ b/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c @@ -30,6 +30,7 @@ */ +#include "../../../../alloc.h" #include "../../../../crypto.h" #include @@ -43,7 +44,7 @@ struct fastd_cipher_state { /** Initializes the cipher state */ static fastd_cipher_state_t* aes128_ctr_init(const uint8_t *key) { - fastd_cipher_state_t *state = malloc(sizeof(fastd_cipher_state_t)); + fastd_cipher_state_t *state = fastd_new(fastd_cipher_state_t); state->aes = EVP_CIPHER_CTX_new(); EVP_EncryptInit(state->aes, EVP_aes_128_ctr(), (const unsigned char*)key, NULL); -- cgit v1.2.3