summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-30 05:34:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-30 05:35:18 +0100
commitaa1d894e102e23d162b8e2bccd4b3bf1700de2f2 (patch)
tree3027bc84e829650a798071ad9e13f4391260328b /src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
parent5f7258ade2dd8bad076d17d3a85fb04d9bf71bda (diff)
downloadfastd-aa1d894e102e23d162b8e2bccd4b3bf1700de2f2.tar
fastd-aa1d894e102e23d162b8e2bccd4b3bf1700de2f2.zip
Make the crypto implementations independent of fastd.h (and fix more minor bugs)
Diffstat (limited to 'src/crypto/cipher/salsa20/nacl/salsa20_nacl.c')
-rw-r--r--src/crypto/cipher/salsa20/nacl/salsa20_nacl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
index ed14c3c..fafc282 100644
--- a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
+++ b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
@@ -25,6 +25,7 @@
#include "../../../../crypto.h"
+
#include <crypto_stream_salsa20.h>
@@ -33,19 +34,19 @@ struct __attribute__((aligned(16))) fastd_cipher_state {
};
-static fastd_cipher_state_t* salsa20_init(fastd_context_t *ctx UNUSED, const uint8_t *key) {
+static fastd_cipher_state_t* salsa20_init(const uint8_t *key) {
fastd_cipher_state_t *state = malloc(sizeof(fastd_cipher_state_t));
memcpy(state->key, key, crypto_stream_salsa20_KEYBYTES);
return state;
}
-static bool salsa20_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) {
+static bool salsa20_crypt(const fastd_cipher_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t len, const uint8_t *iv) {
crypto_stream_salsa20_xor(out->b, in->b, len, iv, state->key);
return true;
}
-static void salsa20_free(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) {
+static void salsa20_free(fastd_cipher_state_t *state) {
if (state) {
secure_memzero(state, sizeof(*state));
free(state);