aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-07-30 18:57:28 +0200
committerMattias Andrée <maandree@kth.se>2021-07-30 18:57:28 +0200
commit024ddbc9c48427a4e98d9258f6aa5b83205d0c62 (patch)
treeac2fffe38c3534f38f9303954e8bf95cc8916528
parentMerge pull request #14 from alebcay/macos-alloca (diff)
downloadlibkeccak-024ddbc9c48427a4e98d9258f6aa5b83205d0c62.tar.gz
libkeccak-024ddbc9c48427a4e98d9258f6aa5b83205d0c62.tar.bz2
libkeccak-024ddbc9c48427a4e98d9258f6aa5b83205d0c62.tar.xz
Use inline instead of static inline for non-deprecated functions
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--Makefile24
-rw-r--r--libkeccak.h100
-rw-r--r--libkeccak_degeneralise_spec.c3
-rw-r--r--libkeccak_generalised_spec_initialise.c5
-rw-r--r--libkeccak_hmac_create.c5
-rw-r--r--libkeccak_hmac_destroy.c5
-rw-r--r--libkeccak_hmac_duplicate.c5
-rw-r--r--libkeccak_hmac_fast_destroy.c5
-rw-r--r--libkeccak_hmac_fast_free.c5
-rw-r--r--libkeccak_hmac_free.c5
-rw-r--r--libkeccak_hmac_initialise.c6
-rw-r--r--libkeccak_hmac_marshal.c5
-rw-r--r--libkeccak_hmac_reset.c5
-rw-r--r--libkeccak_keccaksum_fd.c5
-rw-r--r--libkeccak_rawshakesum_fd.c5
-rw-r--r--libkeccak_sha3sum_fd.c5
-rw-r--r--libkeccak_shakesum_fd.c5
-rw-r--r--libkeccak_spec_check.c5
-rw-r--r--libkeccak_spec_rawshake.c6
-rw-r--r--libkeccak_spec_sha3.c5
-rw-r--r--libkeccak_state_create.c20
-rw-r--r--libkeccak_state_destroy.c5
-rw-r--r--libkeccak_state_duplicate.c20
-rw-r--r--libkeccak_state_fast_destroy.c5
-rw-r--r--libkeccak_state_fast_free.c5
-rw-r--r--libkeccak_state_free.c5
-rw-r--r--libkeccak_state_reset.c5
27 files changed, 217 insertions, 62 deletions
diff --git a/Makefile b/Makefile
index 7338d5d..299c2e7 100644
--- a/Makefile
+++ b/Makefile
@@ -22,18 +22,42 @@ OBJ =\
libkeccak_behex_lower.o\
libkeccak_behex_upper.o\
libkeccak_degeneralise_spec.o\
+ libkeccak_generalised_spec_initialise.o\
libkeccak_generalised_sum_fd.o\
libkeccak_hmac_copy.o\
+ libkeccak_hmac_create.o\
+ libkeccak_hmac_destroy.o\
libkeccak_hmac_digest.o\
+ libkeccak_hmac_duplicate.o\
+ libkeccak_hmac_fast_destroy.o\
libkeccak_hmac_fast_digest.o\
+ libkeccak_hmac_fast_free.o\
libkeccak_hmac_fast_update.o\
+ libkeccak_hmac_free.o\
+ libkeccak_hmac_initialise.o\
+ libkeccak_hmac_marshal.o\
+ libkeccak_hmac_reset.o\
libkeccak_hmac_set_key.o\
libkeccak_hmac_unmarshal.o\
libkeccak_hmac_update.o\
libkeccak_hmac_wipe.o\
+ libkeccak_keccaksum_fd.o\
+ libkeccak_rawshakesum_fd.o\
+ libkeccak_sha3sum_fd.o\
+ libkeccak_shakesum_fd.o\
+ libkeccak_spec_check.o\
+ libkeccak_spec_rawshake.o\
+ libkeccak_spec_sha3.o\
libkeccak_state_copy.o\
+ libkeccak_state_create.o\
+ libkeccak_state_destroy.o\
+ libkeccak_state_duplicate.o\
+ libkeccak_state_fast_destroy.o\
+ libkeccak_state_fast_free.o\
+ libkeccak_state_free.o\
libkeccak_state_initialise.o\
libkeccak_state_marshal.o\
+ libkeccak_state_reset.o\
libkeccak_state_unmarshal.o\
libkeccak_state_wipe.o\
libkeccak_state_wipe_message.o\
diff --git a/libkeccak.h b/libkeccak.h
index 42c9178..f24e58e 100644
--- a/libkeccak.h
+++ b/libkeccak.h
@@ -288,7 +288,7 @@ struct libkeccak_state {
* @param x The value of x in `SHA3-x`, the output size
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
-static inline void
+inline void
libkeccak_spec_sha3(struct libkeccak_spec *restrict spec, long int x)
{
spec->bitrate = 1600 - 2 * x;
@@ -304,7 +304,7 @@ libkeccak_spec_sha3(struct libkeccak_spec *restrict spec, long int x)
* @param d The output size
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
-static inline void
+inline void
libkeccak_spec_rawshake(struct libkeccak_spec *restrict spec, long int x, long int d)
{
spec->bitrate = 1600 - 2 * x;
@@ -327,8 +327,8 @@ libkeccak_spec_rawshake(struct libkeccak_spec *restrict spec, long int x, long i
* @param spec The specifications datastructure to check
* @return Zero if error free, a `LIBKECCAK_SPEC_ERROR_*` if an error was found
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__, __warn_unused_result__, __pure__)))
-static inline int
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __warn_unused_result__, __pure__)))
+inline int
libkeccak_spec_check(const struct libkeccak_spec *restrict spec)
{
long int state_size = spec->capacity + spec->bitrate;
@@ -358,8 +358,8 @@ libkeccak_spec_check(const struct libkeccak_spec *restrict spec)
*
* @param spec The specification datastructure to fill in
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__)))
-static inline void
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
+inline void
libkeccak_generalised_spec_initialise(struct libkeccak_generalised_spec *restrict spec)
{
spec->bitrate = LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
@@ -394,8 +394,8 @@ int libkeccak_state_initialise(struct libkeccak_state *restrict, const struct li
*
* @param state The state that should be reset
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__)))
-static inline void
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
+inline void
libkeccak_state_reset(struct libkeccak_state *restrict state)
{
state->mptr = 0;
@@ -407,7 +407,7 @@ libkeccak_state_reset(struct libkeccak_state *restrict state)
*
* @param state The state that should be destroyed
*/
-static inline void
+inline void
libkeccak_state_fast_destroy(struct libkeccak_state *restrict state)
{
if (state) {
@@ -445,8 +445,8 @@ void libkeccak_state_wipe(volatile struct libkeccak_state *restrict);
*
* @param state The state that should be destroyed
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
-static inline void
+LIBKECCAK_GCC_ONLY(__attribute__((__optimize__("-O0"))))
+inline void
libkeccak_state_destroy(volatile struct libkeccak_state *restrict state)
{
if (state) {
@@ -462,25 +462,15 @@ libkeccak_state_destroy(volatile struct libkeccak_state *restrict state)
* @param spec The specifications for the state
* @return The state, `NULL` on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline struct libkeccak_state *
-libkeccak_state_create(const struct libkeccak_spec *restrict spec)
-{
- struct libkeccak_state *restrict state = malloc(sizeof(struct libkeccak_state));
- if (!state || libkeccak_state_initialise(state, spec)) {
- free(state);
- return NULL;
- }
- return state;
-}
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__, __malloc__)))
+struct libkeccak_state *libkeccak_state_create(const struct libkeccak_spec *restrict);
/**
* Wrapper for `libkeccak_state_fast_destroy` that also frees the allocation of the state
*
* @param state The state that should be freed
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__unused__)))
-static inline void
+inline void
libkeccak_state_fast_free(struct libkeccak_state *restrict state)
{
libkeccak_state_fast_destroy(state);
@@ -492,8 +482,8 @@ libkeccak_state_fast_free(struct libkeccak_state *restrict state)
*
* @param state The state that should be freed
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
-static inline void
+LIBKECCAK_GCC_ONLY(__attribute__((__optimize__("-O0"))))
+inline void
libkeccak_state_free(volatile struct libkeccak_state *restrict state)
{
#ifdef __GNUC__
@@ -523,17 +513,8 @@ int libkeccak_state_copy(struct libkeccak_state *restrict, const struct libkecca
* @param src The state to duplicate
* @return The duplicate, `NULL` on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline struct libkeccak_state *
-libkeccak_state_duplicate(const struct libkeccak_state *restrict src)
-{
- struct libkeccak_state *restrict dest = malloc(sizeof(struct libkeccak_state));
- if (!dest || libkeccak_state_copy(dest, src)) {
- libkeccak_state_free(dest);
- return NULL;
- }
- return dest;
-}
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__, __malloc__)))
+struct libkeccak_state *libkeccak_state_duplicate(const struct libkeccak_state *restrict);
/**
* Marshal a `struct libkeccak_state` into a buffer
@@ -696,8 +677,8 @@ int libkeccak_generalised_sum_fd(int, struct libkeccak_state *restrict, const st
* at least `((spec->output + 7) / 8) * sizeof(char)`, may be `NULL`
* @return Zero on success, -1 on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2, 3), __artificial__, __gnu_inline__)))
-static inline int
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2, 3), __artificial__)))
+inline int
libkeccak_keccaksum_fd(int fd, struct libkeccak_state *restrict state,
const struct libkeccak_spec *restrict spec, void *restrict hashsum)
{
@@ -715,8 +696,8 @@ libkeccak_keccaksum_fd(int fd, struct libkeccak_state *restrict state,
* at least `((output + 7) / 8) * sizeof(char)`, may be `NULL`
* @return Zero on success, -1 on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__, __gnu_inline__)))
-static inline int
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__)))
+inline int
libkeccak_sha3sum_fd(int fd, struct libkeccak_state *restrict state, long output, void *restrict hashsum)
{
struct libkeccak_spec spec;
@@ -736,8 +717,8 @@ libkeccak_sha3sum_fd(int fd, struct libkeccak_state *restrict state, long output
* at least `((output + 7) / 8) * sizeof(char)`, may be `NULL`
* @return Zero on success, -1 on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__, __gnu_inline__)))
-static inline int
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__)))
+inline int
libkeccak_rawshakesum_fd(int fd, struct libkeccak_state *restrict state, long semicapacity, long output, void *restrict hashsum)
{
struct libkeccak_spec spec;
@@ -757,8 +738,8 @@ libkeccak_rawshakesum_fd(int fd, struct libkeccak_state *restrict state, long se
* at least `((output + 7) / 8) * sizeof(char)`, may be `NULL`
* @return Zero on success, -1 on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__, __gnu_inline__)))
-static inline int
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__)))
+inline int
libkeccak_shakesum_fd(int fd, struct libkeccak_state *restrict state, long semicapacity, long output, void *restrict hashsum)
{
struct libkeccak_spec spec;
@@ -841,7 +822,7 @@ int libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict, const void *re
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__)))
-static inline int
+inline int
libkeccak_hmac_initialise(struct libkeccak_hmac_state *restrict state, const struct libkeccak_spec *restrict spec,
const void *restrict key, size_t key_length)
{
@@ -865,8 +846,8 @@ libkeccak_hmac_initialise(struct libkeccak_hmac_state *restrict state, const str
* @param key_length The length of key, in bits
* @return The state, `NULL` on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline struct libkeccak_hmac_state *
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__, __malloc__)))
+inline struct libkeccak_hmac_state *
libkeccak_hmac_create(const struct libkeccak_spec *restrict spec, const void *restrict key, size_t key_length)
{
struct libkeccak_hmac_state *restrict state = malloc(sizeof(struct libkeccak_hmac_state));
@@ -886,8 +867,8 @@ libkeccak_hmac_create(const struct libkeccak_spec *restrict spec, const void *re
* @param key_length The length of key, in bits, ignored if `key == NULL`
* @return Zero on success, -1 on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1), __unused__)))
-static inline int
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
+inline int
libkeccak_hmac_reset(struct libkeccak_hmac_state *restrict state, const void *restrict key, size_t key_length)
{
libkeccak_state_reset(&state->sponge);
@@ -907,7 +888,7 @@ void libkeccak_hmac_wipe(volatile struct libkeccak_hmac_state *restrict);
*
* @param state The state that should be destroyed
*/
-static inline void
+inline void
libkeccak_hmac_fast_destroy(struct libkeccak_hmac_state *restrict state)
{
if (!state)
@@ -926,8 +907,8 @@ libkeccak_hmac_fast_destroy(struct libkeccak_hmac_state *restrict state)
*
* @param state The state that should be destroyed
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
-static inline void
+LIBKECCAK_GCC_ONLY(__attribute__((__optimize__("-O0"))))
+inline void
libkeccak_hmac_destroy(volatile struct libkeccak_hmac_state *restrict state)
{
if (!state)
@@ -948,8 +929,7 @@ libkeccak_hmac_destroy(volatile struct libkeccak_hmac_state *restrict state)
*
* @param state The state that should be freed
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__unused__)))
-static inline void
+inline void
libkeccak_hmac_fast_free(struct libkeccak_hmac_state *restrict state)
{
libkeccak_hmac_fast_destroy(state);
@@ -961,8 +941,8 @@ libkeccak_hmac_fast_free(struct libkeccak_hmac_state *restrict state)
*
* @param state The state that should be freed
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
-static inline void
+LIBKECCAK_GCC_ONLY(__attribute__((__optimize__("-O0"))))
+inline void
libkeccak_hmac_free(volatile struct libkeccak_hmac_state *restrict state)
{
#ifdef __GNUC__
@@ -992,8 +972,8 @@ int libkeccak_hmac_copy(struct libkeccak_hmac_state *restrict, const struct libk
* @param src The state to duplicate
* @return The duplicate, `NULL` on error
*/
-LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline struct libkeccak_hmac_state *
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__, __malloc__)))
+inline struct libkeccak_hmac_state *
libkeccak_hmac_duplicate(const struct libkeccak_hmac_state *restrict src)
{
struct libkeccak_hmac_state *restrict dest = malloc(sizeof(struct libkeccak_hmac_state));
@@ -1012,7 +992,7 @@ libkeccak_hmac_duplicate(const struct libkeccak_hmac_state *restrict src)
* @return The number of bytes stored to `data`
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1), __nothrow__)))
-static inline size_t
+inline size_t
libkeccak_hmac_marshal(const struct libkeccak_hmac_state *restrict state, void *restrict data_)
{
unsigned char *restrict data = data_;
diff --git a/libkeccak_degeneralise_spec.c b/libkeccak_degeneralise_spec.c
index d2c4ea5..d92fa61 100644
--- a/libkeccak_degeneralise_spec.c
+++ b/libkeccak_degeneralise_spec.c
@@ -24,8 +24,7 @@
* @return Zero if `spec` is valid, a `LIBKECCAK_GENERALISED_SPEC_ERROR_*` if an error was found
*/
int
-libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *restrict spec,
- struct libkeccak_spec *restrict output_spec)
+libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *restrict spec, struct libkeccak_spec *restrict output_spec)
{
long int state_size, word_size, capacity, bitrate, output;
const int have_state_size = spec->state_size != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
diff --git a/libkeccak_generalised_spec_initialise.c b/libkeccak_generalised_spec_initialise.c
new file mode 100644
index 0000000..2e05fed
--- /dev/null
+++ b/libkeccak_generalised_spec_initialise.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_generalised_spec_initialise(struct libkeccak_generalised_spec *restrict);
diff --git a/libkeccak_hmac_create.c b/libkeccak_hmac_create.c
new file mode 100644
index 0000000..15286b6
--- /dev/null
+++ b/libkeccak_hmac_create.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline struct libkeccak_hmac_state *libkeccak_hmac_create(const struct libkeccak_spec *restrict, const void *restrict, size_t);
diff --git a/libkeccak_hmac_destroy.c b/libkeccak_hmac_destroy.c
new file mode 100644
index 0000000..70bad72
--- /dev/null
+++ b/libkeccak_hmac_destroy.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_hmac_destroy(volatile struct libkeccak_hmac_state *restrict);
diff --git a/libkeccak_hmac_duplicate.c b/libkeccak_hmac_duplicate.c
new file mode 100644
index 0000000..8253320
--- /dev/null
+++ b/libkeccak_hmac_duplicate.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline struct libkeccak_hmac_state *libkeccak_hmac_duplicate(const struct libkeccak_hmac_state *restrict);
diff --git a/libkeccak_hmac_fast_destroy.c b/libkeccak_hmac_fast_destroy.c
new file mode 100644
index 0000000..d3d4d77
--- /dev/null
+++ b/libkeccak_hmac_fast_destroy.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_hmac_fast_destroy(struct libkeccak_hmac_state *restrict);
diff --git a/libkeccak_hmac_fast_free.c b/libkeccak_hmac_fast_free.c
new file mode 100644
index 0000000..8c6118e
--- /dev/null
+++ b/libkeccak_hmac_fast_free.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_hmac_fast_free(struct libkeccak_hmac_state *restrict);
diff --git a/libkeccak_hmac_free.c b/libkeccak_hmac_free.c
new file mode 100644
index 0000000..4063b68
--- /dev/null
+++ b/libkeccak_hmac_free.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_hmac_free(volatile struct libkeccak_hmac_state *restrict);
diff --git a/libkeccak_hmac_initialise.c b/libkeccak_hmac_initialise.c
new file mode 100644
index 0000000..b2f2552
--- /dev/null
+++ b/libkeccak_hmac_initialise.c
@@ -0,0 +1,6 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int
+libkeccak_hmac_initialise(struct libkeccak_hmac_state *restrict, const struct libkeccak_spec *restrict, const void *restrict, size_t);
diff --git a/libkeccak_hmac_marshal.c b/libkeccak_hmac_marshal.c
new file mode 100644
index 0000000..604bde2
--- /dev/null
+++ b/libkeccak_hmac_marshal.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline size_t libkeccak_hmac_marshal(const struct libkeccak_hmac_state *restrict, void *restrict);
diff --git a/libkeccak_hmac_reset.c b/libkeccak_hmac_reset.c
new file mode 100644
index 0000000..13d7c0e
--- /dev/null
+++ b/libkeccak_hmac_reset.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int libkeccak_hmac_reset(struct libkeccak_hmac_state *restrict, const void *restrict, size_t);
diff --git a/libkeccak_keccaksum_fd.c b/libkeccak_keccaksum_fd.c
new file mode 100644
index 0000000..f738115
--- /dev/null
+++ b/libkeccak_keccaksum_fd.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int libkeccak_keccaksum_fd(int, struct libkeccak_state *restrict, const struct libkeccak_spec *restrict, void *restrict);
diff --git a/libkeccak_rawshakesum_fd.c b/libkeccak_rawshakesum_fd.c
new file mode 100644
index 0000000..a988cf2
--- /dev/null
+++ b/libkeccak_rawshakesum_fd.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int libkeccak_rawshakesum_fd(int, struct libkeccak_state *restrict, long, long, void *restrict);
diff --git a/libkeccak_sha3sum_fd.c b/libkeccak_sha3sum_fd.c
new file mode 100644
index 0000000..6662ad4
--- /dev/null
+++ b/libkeccak_sha3sum_fd.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int libkeccak_sha3sum_fd(int, struct libkeccak_state *restrict, long, void *restrict);
diff --git a/libkeccak_shakesum_fd.c b/libkeccak_shakesum_fd.c
new file mode 100644
index 0000000..45289f7
--- /dev/null
+++ b/libkeccak_shakesum_fd.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int libkeccak_shakesum_fd(int, struct libkeccak_state *restrict, long, long, void *restrict);
diff --git a/libkeccak_spec_check.c b/libkeccak_spec_check.c
new file mode 100644
index 0000000..5a0f731
--- /dev/null
+++ b/libkeccak_spec_check.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline int libkeccak_spec_check(const struct libkeccak_spec *restrict);
diff --git a/libkeccak_spec_rawshake.c b/libkeccak_spec_rawshake.c
new file mode 100644
index 0000000..58347ae
--- /dev/null
+++ b/libkeccak_spec_rawshake.c
@@ -0,0 +1,6 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_spec_rawshake(struct libkeccak_spec *restrict, long int, long int);
+
diff --git a/libkeccak_spec_sha3.c b/libkeccak_spec_sha3.c
new file mode 100644
index 0000000..eaa8189
--- /dev/null
+++ b/libkeccak_spec_sha3.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_spec_sha3(struct libkeccak_spec *restrict, long int);
diff --git a/libkeccak_state_create.c b/libkeccak_state_create.c
new file mode 100644
index 0000000..a9ebc84
--- /dev/null
+++ b/libkeccak_state_create.c
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+/**
+ * Wrapper for `libkeccak_state_initialise` that also allocates the states
+ *
+ * @param spec The specifications for the state
+ * @return The state, `NULL` on error
+ */
+struct libkeccak_state *
+libkeccak_state_create(const struct libkeccak_spec *restrict spec)
+{
+ struct libkeccak_state *restrict state = malloc(sizeof(struct libkeccak_state));
+ if (!state || libkeccak_state_initialise(state, spec)) {
+ free(state);
+ return NULL;
+ }
+ return state;
+}
diff --git a/libkeccak_state_destroy.c b/libkeccak_state_destroy.c
new file mode 100644
index 0000000..a0f330b
--- /dev/null
+++ b/libkeccak_state_destroy.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_state_destroy(volatile struct libkeccak_state *restrict);
diff --git a/libkeccak_state_duplicate.c b/libkeccak_state_duplicate.c
new file mode 100644
index 0000000..ab21c20
--- /dev/null
+++ b/libkeccak_state_duplicate.c
@@ -0,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+/**
+ * A wrapper for `libkeccak_state_copy` that also allocates the duplicate
+ *
+ * @param src The state to duplicate
+ * @return The duplicate, `NULL` on error
+ */
+struct libkeccak_state *
+libkeccak_state_duplicate(const struct libkeccak_state *restrict src)
+{
+ struct libkeccak_state *restrict dest = malloc(sizeof(struct libkeccak_state));
+ if (!dest || libkeccak_state_copy(dest, src)) {
+ libkeccak_state_free(dest);
+ return NULL;
+ }
+ return dest;
+}
diff --git a/libkeccak_state_fast_destroy.c b/libkeccak_state_fast_destroy.c
new file mode 100644
index 0000000..ae29aa7
--- /dev/null
+++ b/libkeccak_state_fast_destroy.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_state_fast_destroy(struct libkeccak_state *restrict);
diff --git a/libkeccak_state_fast_free.c b/libkeccak_state_fast_free.c
new file mode 100644
index 0000000..775c408
--- /dev/null
+++ b/libkeccak_state_fast_free.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_state_fast_free(struct libkeccak_state *restrict);
diff --git a/libkeccak_state_free.c b/libkeccak_state_free.c
new file mode 100644
index 0000000..07fb8f6
--- /dev/null
+++ b/libkeccak_state_free.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_state_free(volatile struct libkeccak_state *restrict);
diff --git a/libkeccak_state_reset.c b/libkeccak_state_reset.c
new file mode 100644
index 0000000..cc8b57f
--- /dev/null
+++ b/libkeccak_state_reset.c
@@ -0,0 +1,5 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+extern inline void libkeccak_state_reset(struct libkeccak_state *restrict);