summaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c3
-rw-r--r--src/crypto/cipher/salsa20/nacl/salsa20_nacl.c3
-rw-r--r--src/crypto/cipher/salsa20/xmm/salsa20_xmm.c3
-rw-r--r--src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c3
-rw-r--r--src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c3
5 files changed, 10 insertions, 5 deletions
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 <openssl/evp.h>
@@ -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);
diff --git a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
index 6179bc2..b9c2175 100644
--- a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
+++ b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
@@ -30,6 +30,7 @@
*/
+#include "../../../../alloc.h"
#include "../../../../crypto.h"
#include <crypto_stream_salsa20.h>
@@ -43,7 +44,7 @@ struct fastd_cipher_state {
/** Initializes the cipher state */
static fastd_cipher_state_t* salsa20_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);
memcpy(state->key, key, crypto_stream_salsa20_KEYBYTES);
return state;
diff --git a/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c b/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c
index a85ed72..abf717f 100644
--- a/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c
+++ b/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c
@@ -33,6 +33,7 @@
*/
+#include "../../../../alloc.h"
#include "../../../../crypto.h"
#include "../../../../cpuid.h"
@@ -67,7 +68,7 @@ static bool salsa20_available(void) {
/** Initializes the cipher state */
static fastd_cipher_state_t* salsa20_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);
memcpy(state->key, key, KEYBYTES);
return state;
diff --git a/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c b/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c
index 18ec502..24450dc 100644
--- a/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c
+++ b/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c
@@ -30,6 +30,7 @@
*/
+#include "../../../../alloc.h"
#include "../../../../crypto.h"
#include <crypto_stream_salsa2012.h>
@@ -43,7 +44,7 @@ struct fastd_cipher_state {
/** Initializes the cipher state */
static fastd_cipher_state_t* salsa2012_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);
memcpy(state->key, key, crypto_stream_salsa2012_KEYBYTES);
return state;
diff --git a/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c b/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c
index 7e6fe80..6180702 100644
--- a/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c
+++ b/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c
@@ -33,6 +33,7 @@
*/
+#include "../../../../alloc.h"
#include "../../../../crypto.h"
#include "../../../../cpuid.h"
@@ -67,7 +68,7 @@ static bool salsa2012_available(void) {
/** Initializes the cipher state */
static fastd_cipher_state_t* salsa2012_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);
memcpy(state->key, key, KEYBYTES);
return state;