summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/cipher')
-rw-r--r--src/crypto/cipher/CMakeLists.txt35
-rw-r--r--src/crypto/cipher/aes128_ctr/CMakeLists.txt2
-rw-r--r--src/crypto/cipher/aes128_ctr/aes128_ctr.c33
-rw-r--r--src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c4
-rw-r--r--src/crypto/cipher/blowfish_ctr/CMakeLists.txt2
-rw-r--r--src/crypto/cipher/blowfish_ctr/blowfish_ctr.c33
-rw-r--r--src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c4
-rw-r--r--src/crypto/cipher/ciphers.c.in40
-rw-r--r--src/crypto/cipher/null/CMakeLists.txt2
-rw-r--r--src/crypto/cipher/null/memcpy/null_memcpy.c4
-rw-r--r--src/crypto/cipher/null/null.c33
-rw-r--r--src/crypto/cipher/salsa20/CMakeLists.txt2
-rw-r--r--src/crypto/cipher/salsa20/nacl/salsa20_nacl.c4
-rw-r--r--src/crypto/cipher/salsa20/salsa20.c33
-rw-r--r--src/crypto/cipher/salsa2012/CMakeLists.txt2
-rw-r--r--src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c4
-rw-r--r--src/crypto/cipher/salsa2012/salsa2012.c33
17 files changed, 215 insertions, 55 deletions
diff --git a/src/crypto/cipher/CMakeLists.txt b/src/crypto/cipher/CMakeLists.txt
index b538227..e32b697 100644
--- a/src/crypto/cipher/CMakeLists.txt
+++ b/src/crypto/cipher/CMakeLists.txt
@@ -1,26 +1,25 @@
add_library(ciphers STATIC "${CMAKE_CURRENT_BINARY_DIR}/ciphers.c")
-function(fastd_cipher name)
- string(REPLACE - _ name_ "${name}")
- string(TOUPPER "${name_}" NAME)
+macro(fastd_cipher name)
+ fastd_module(cipher enabled "cipher" ${name} ${ARGN})
- set(WITH_CIPHER_${NAME} TRUE CACHE BOOL "Include the ${name} cipher")
-
- if(WITH_CIPHER_${NAME})
+ if(${enabled})
set_property(GLOBAL APPEND PROPERTY FASTD_CIPHERS ${name})
- endif(WITH_CIPHER_${NAME})
-endfunction(fastd_cipher)
+ endif(${enabled})
+endmacro(fastd_cipher)
macro(fastd_cipher_impl cipher name)
string(REPLACE - _ cipher_ "${cipher}")
string(TOUPPER "${cipher_}" CIPHER)
- fastd_module(cipher enabled "cipher implementation" "${cipher} ${name}" ${ARGN})
+ if(WITH_CIPHER_${CIPHER})
+ fastd_module(cipher enabled "cipher implementation" "${cipher} ${name}" ${ARGN})
- if(${enabled})
- set_property(GLOBAL APPEND PROPERTY FASTD_CIPHER_${CIPHER}_IMPLS ${name})
- endif(${enabled})
+ if(${enabled})
+ set_property(TARGET "cipher_${cipher_}" APPEND PROPERTY FASTD_CIPHER_IMPLS ${name})
+ endif(${enabled})
+ endif(WITH_CIPHER_${CIPHER})
endmacro(fastd_cipher_impl)
macro(fastd_cipher_impl_include_directories cipher name)
@@ -52,16 +51,18 @@ foreach(cipher ${CIPHERS})
string(REPLACE - _ cipher_ "${cipher}")
string(TOUPPER "${cipher_}" CIPHER)
- set(CIPHER_LIST "${CIPHER_LIST}\n{\"${cipher}\", cipher_${cipher_}_impls},")
- set(CIPHER_IMPLS "${CIPHER_IMPLS}\nstatic const fastd_cipher_t *const cipher_${cipher_}_impls[] = {")
+ set(CIPHER_DEFINITIONS "${CIPHER_DEFINITIONS}\nextern const fastd_cipher_info_t fastd_cipher_info_${cipher_};")
+ set(CIPHER_LIST "${CIPHER_LIST}\n{\"${cipher}\", &fastd_cipher_info_${cipher_}, cipher_${cipher_}_impls},")
+ set(CIPHER_IMPLS "${CIPHER_IMPLS}\nstatic const fastd_cipher_impl_t cipher_${cipher_}_impls[] = {")
+
- get_property(IMPLS GLOBAL PROPERTY FASTD_CIPHER_${CIPHER}_IMPLS)
+ get_property(IMPLS TARGET "cipher_${cipher_}" PROPERTY FASTD_CIPHER_IMPLS)
foreach(impl ${IMPLS})
set(CIPHER_DEFINITIONS "${CIPHER_DEFINITIONS}\nextern const fastd_cipher_t fastd_cipher_${cipher_}_${impl};")
- set(CIPHER_IMPLS "${CIPHER_IMPLS}&fastd_cipher_${cipher_}_${impl}, ")
+ set(CIPHER_IMPLS "${CIPHER_IMPLS}{\"${impl}\", &fastd_cipher_${cipher_}_${impl}}, ")
endforeach(impl)
- set(CIPHER_IMPLS "${CIPHER_IMPLS}NULL};")
+ set(CIPHER_IMPLS "${CIPHER_IMPLS}{NULL, NULL}};")
endforeach(cipher)
get_property(LIBS TARGET ciphers PROPERTY FASTD_LINK_LIBRARIES)
diff --git a/src/crypto/cipher/aes128_ctr/CMakeLists.txt b/src/crypto/cipher/aes128_ctr/CMakeLists.txt
index 16eeeab..27b507b 100644
--- a/src/crypto/cipher/aes128_ctr/CMakeLists.txt
+++ b/src/crypto/cipher/aes128_ctr/CMakeLists.txt
@@ -1,2 +1,2 @@
-fastd_cipher(aes128-ctr)
+fastd_cipher(aes128-ctr aes128_ctr.c)
add_subdirectory(nacl)
diff --git a/src/crypto/cipher/aes128_ctr/aes128_ctr.c b/src/crypto/cipher/aes128_ctr/aes128_ctr.c
new file mode 100644
index 0000000..b228602
--- /dev/null
+++ b/src/crypto/cipher/aes128_ctr/aes128_ctr.c
@@ -0,0 +1,33 @@
+/*
+ Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "../../../crypto.h"
+
+
+const fastd_cipher_info_t fastd_cipher_info_aes128_ctr = {
+ .key_length = 16,
+ .iv_length = 16,
+};
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 a520732..e5f6379 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
@@ -67,10 +67,6 @@ 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,
.init_state = aes128_ctr_init_state,
diff --git a/src/crypto/cipher/blowfish_ctr/CMakeLists.txt b/src/crypto/cipher/blowfish_ctr/CMakeLists.txt
index 56d283f..8cabb57 100644
--- a/src/crypto/cipher/blowfish_ctr/CMakeLists.txt
+++ b/src/crypto/cipher/blowfish_ctr/CMakeLists.txt
@@ -1,2 +1,2 @@
-fastd_cipher(blowfish-ctr)
+fastd_cipher(blowfish-ctr blowfish_ctr.c)
add_subdirectory(builtin)
diff --git a/src/crypto/cipher/blowfish_ctr/blowfish_ctr.c b/src/crypto/cipher/blowfish_ctr/blowfish_ctr.c
new file mode 100644
index 0000000..1e8010b
--- /dev/null
+++ b/src/crypto/cipher/blowfish_ctr/blowfish_ctr.c
@@ -0,0 +1,33 @@
+/*
+ Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "../../../crypto.h"
+
+
+const fastd_cipher_info_t fastd_cipher_info_blowfish_ctr = {
+ .key_length = 56,
+ .iv_length = 8,
+};
diff --git a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
index 0ca8d2d..f3424b9 100644
--- a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
+++ b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
@@ -274,10 +274,6 @@ static void blowfish_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_
}
const fastd_cipher_t fastd_cipher_blowfish_ctr_builtin = {
- .name = "builtin",
- .key_length = 56,
- .iv_length = 8,
-
.initialize = blowfish_ctr_initialize,
.init_state = blowfish_ctr_init_state,
diff --git a/src/crypto/cipher/ciphers.c.in b/src/crypto/cipher/ciphers.c.in
index c912e60..508196e 100644
--- a/src/crypto/cipher/ciphers.c.in
+++ b/src/crypto/cipher/ciphers.c.in
@@ -30,14 +30,20 @@
@CIPHER_DEFINITIONS@
-typedef struct cipher_impl_list {
+typedef struct fastd_cipher_impl {
const char *name;
- const fastd_cipher_t *const *impls;
-} cipher_impl_list_t;
+ const fastd_cipher_t *impl;
+} fastd_cipher_impl_t;
+
+typedef struct cipher_entry {
+ const char *name;
+ const fastd_cipher_info_t *info;
+ const fastd_cipher_impl_t *impls;
+} cipher_entry_t;
@CIPHER_IMPLS@
-static const cipher_impl_list_t ciphers[] = { @CIPHER_LIST@
+static const cipher_entry_t ciphers[] = { @CIPHER_LIST@
};
@@ -46,7 +52,7 @@ const fastd_cipher_t** fastd_cipher_config_alloc(void) {
size_t i;
for (i = 0; i < array_size(ciphers); i++)
- cipher_conf[i] = ciphers[i].impls[0];
+ cipher_conf[i] = ciphers[i].impls[0].impl;
return cipher_conf;
}
@@ -60,9 +66,9 @@ bool fastd_cipher_config(const fastd_cipher_t **cipher_conf, const char *name, c
for (i = 0; i < array_size(ciphers); i++) {
if (!strcmp(ciphers[i].name, name)) {
size_t j;
- for (j = 0; ciphers[i].impls[j]; j++) {
- if (!strcmp(ciphers[i].impls[j]->name, impl)) {
- cipher_conf[i] = ciphers[i].impls[j];
+ for (j = 0; ciphers[i].impls[j].impl; j++) {
+ if (!strcmp(ciphers[i].impls[j].name, impl)) {
+ cipher_conf[i] = ciphers[i].impls[j].impl;
return true;
}
}
@@ -92,20 +98,28 @@ void fastd_cipher_free(fastd_context_t *ctx) {
free(ctx->cipher_contexts);
}
-bool fastd_cipher_available(const char *name) {
+const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) {
size_t i;
for (i = 0; i < array_size(ciphers); i++) {
- if (!strcmp(ciphers[i].name, name))
- return ciphers[i].impls[0];
+ if (strcmp(ciphers[i].name, name))
+ continue;
+
+ if (!ciphers[i].impls[0].impl)
+ continue;
+
+ return ciphers[i].info;
}
- return false;
+ return NULL;
}
-const fastd_cipher_t* fastd_cipher_get_by_name(fastd_context_t *ctx, const char *name, const fastd_cipher_context_t **cctx) {
+const fastd_cipher_t* fastd_cipher_get_by_name(fastd_context_t *ctx, const char *name, const fastd_cipher_info_t **info, const fastd_cipher_context_t **cctx) {
size_t i;
for (i = 0; i < array_size(ciphers); i++) {
if (!strcmp(ciphers[i].name, name)) {
+ if (info)
+ *info = ciphers[i].info;
+
if (cctx)
*cctx = ctx->cipher_contexts[i];
diff --git a/src/crypto/cipher/null/CMakeLists.txt b/src/crypto/cipher/null/CMakeLists.txt
index e835d73..a05fdc5 100644
--- a/src/crypto/cipher/null/CMakeLists.txt
+++ b/src/crypto/cipher/null/CMakeLists.txt
@@ -1,2 +1,2 @@
-fastd_cipher(null)
+fastd_cipher(null null.c)
add_subdirectory(memcpy)
diff --git a/src/crypto/cipher/null/memcpy/null_memcpy.c b/src/crypto/cipher/null/memcpy/null_memcpy.c
index 45ad297..1784ac9 100644
--- a/src/crypto/cipher/null/memcpy/null_memcpy.c
+++ b/src/crypto/cipher/null/memcpy/null_memcpy.c
@@ -47,10 +47,6 @@ static void null_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *cctx
}
const fastd_cipher_t fastd_cipher_null_memcpy = {
- .name = "memcpy",
- .key_length = 0,
- .iv_length = 0,
-
.initialize = null_initialize,
.init_state = null_init_state,
diff --git a/src/crypto/cipher/null/null.c b/src/crypto/cipher/null/null.c
new file mode 100644
index 0000000..07994f7
--- /dev/null
+++ b/src/crypto/cipher/null/null.c
@@ -0,0 +1,33 @@
+/*
+ Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "../../../crypto.h"
+
+
+const fastd_cipher_info_t fastd_cipher_info_null = {
+ .key_length = 0,
+ .iv_length = 0,
+};
diff --git a/src/crypto/cipher/salsa20/CMakeLists.txt b/src/crypto/cipher/salsa20/CMakeLists.txt
index 3d325dc..3d9654e 100644
--- a/src/crypto/cipher/salsa20/CMakeLists.txt
+++ b/src/crypto/cipher/salsa20/CMakeLists.txt
@@ -1,2 +1,2 @@
-fastd_cipher(salsa20)
+fastd_cipher(salsa20 salsa20.c)
add_subdirectory(nacl)
diff --git a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
index 93daad3..ddcc124 100644
--- a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
+++ b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c
@@ -60,10 +60,6 @@ static void salsa20_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *cc
}
const fastd_cipher_t fastd_cipher_salsa20_nacl = {
- .name = "nacl",
- .key_length = crypto_stream_salsa20_KEYBYTES,
- .iv_length = crypto_stream_salsa20_NONCEBYTES,
-
.initialize = salsa20_initialize,
.init_state = salsa20_init_state,
diff --git a/src/crypto/cipher/salsa20/salsa20.c b/src/crypto/cipher/salsa20/salsa20.c
new file mode 100644
index 0000000..bf6dc48
--- /dev/null
+++ b/src/crypto/cipher/salsa20/salsa20.c
@@ -0,0 +1,33 @@
+/*
+ Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "../../../crypto.h"
+
+
+const fastd_cipher_info_t fastd_cipher_info_salsa20 = {
+ .key_length = 32,
+ .iv_length = 8,
+};
diff --git a/src/crypto/cipher/salsa2012/CMakeLists.txt b/src/crypto/cipher/salsa2012/CMakeLists.txt
index 405ae9a..eb853e0 100644
--- a/src/crypto/cipher/salsa2012/CMakeLists.txt
+++ b/src/crypto/cipher/salsa2012/CMakeLists.txt
@@ -1,2 +1,2 @@
-fastd_cipher(salsa2012)
+fastd_cipher(salsa2012 salsa2012.c)
add_subdirectory(nacl)
diff --git a/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c b/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c
index 2703f0e..36985a6 100644
--- a/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c
+++ b/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c
@@ -60,10 +60,6 @@ static void salsa2012_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *
}
const fastd_cipher_t fastd_cipher_salsa2012_nacl = {
- .name = "nacl",
- .key_length = crypto_stream_salsa2012_KEYBYTES,
- .iv_length = crypto_stream_salsa2012_NONCEBYTES,
-
.initialize = salsa2012_initialize,
.init_state = salsa2012_init_state,
diff --git a/src/crypto/cipher/salsa2012/salsa2012.c b/src/crypto/cipher/salsa2012/salsa2012.c
new file mode 100644
index 0000000..780702d
--- /dev/null
+++ b/src/crypto/cipher/salsa2012/salsa2012.c
@@ -0,0 +1,33 @@
+/*
+ Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "../../../crypto.h"
+
+
+const fastd_cipher_info_t fastd_cipher_info_salsa2012 = {
+ .key_length = 32,
+ .iv_length = 8,
+};