aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-11 16:57:26 +0100
committerMattias Andrée <maandree@kth.se>2019-02-11 16:57:54 +0100
commit3547923d8653d72fe8a6a305107ed2e5dca6577c (patch)
treeaa08e3ca8cb8d7f7b64126a6687af4abbe0994ef
parentSplit most .c files into one per function and flatten file hierarchy (diff)
downloadlibkeccak-3547923d8653d72fe8a6a305107ed2e5dca6577c.tar.gz
libkeccak-3547923d8653d72fe8a6a305107ed2e5dca6577c.tar.bz2
libkeccak-3547923d8653d72fe8a6a305107ed2e5dca6577c.tar.xz
Deprecate typedefs
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--Makefile4
-rw-r--r--benchmark.c4
-rw-r--r--digest.c28
-rw-r--r--libkeccak-legacy.h14
-rw-r--r--libkeccak.h239
-rw-r--r--libkeccak_degeneralise_spec.322
-rw-r--r--libkeccak_degeneralise_spec.c6
-rw-r--r--libkeccak_digest.36
-rw-r--r--libkeccak_fast_digest.36
-rw-r--r--libkeccak_fast_squeeze.32
-rw-r--r--libkeccak_fast_update.36
-rw-r--r--libkeccak_generalised_spec_initialise.32
-rw-r--r--libkeccak_generalised_sum_fd.36
-rw-r--r--libkeccak_generalised_sum_fd.c2
-rw-r--r--libkeccak_hmac_copy.34
-rw-r--r--libkeccak_hmac_copy.c2
-rw-r--r--libkeccak_hmac_create.36
-rw-r--r--libkeccak_hmac_destroy.32
-rw-r--r--libkeccak_hmac_digest.32
-rw-r--r--libkeccak_hmac_digest.c2
-rw-r--r--libkeccak_hmac_duplicate.34
-rw-r--r--libkeccak_hmac_fast_destroy.32
-rw-r--r--libkeccak_hmac_fast_digest.32
-rw-r--r--libkeccak_hmac_fast_digest.c2
-rw-r--r--libkeccak_hmac_fast_free.32
-rw-r--r--libkeccak_hmac_fast_update.32
-rw-r--r--libkeccak_hmac_fast_update.c2
-rw-r--r--libkeccak_hmac_free.32
-rw-r--r--libkeccak_hmac_initialise.32
-rw-r--r--libkeccak_hmac_marshal.32
-rw-r--r--libkeccak_hmac_marshal_size.32
-rw-r--r--libkeccak_hmac_reset.32
-rw-r--r--libkeccak_hmac_set_key.32
-rw-r--r--libkeccak_hmac_set_key.c2
-rw-r--r--libkeccak_hmac_unmarshal.32
-rw-r--r--libkeccak_hmac_unmarshal.c4
-rw-r--r--libkeccak_hmac_update.32
-rw-r--r--libkeccak_hmac_update.c2
-rw-r--r--libkeccak_hmac_wipe.32
-rw-r--r--libkeccak_hmac_wipe.c2
-rw-r--r--libkeccak_keccaksum_fd.36
-rw-r--r--libkeccak_rawshakesum_fd.34
-rw-r--r--libkeccak_sha3sum_fd.34
-rw-r--r--libkeccak_shakesum_fd.34
-rw-r--r--libkeccak_simple_squeeze.32
-rw-r--r--libkeccak_spec_check.36
-rw-r--r--libkeccak_spec_rawshake.36
-rw-r--r--libkeccak_spec_sha3.36
-rw-r--r--libkeccak_spec_shake.36
-rw-r--r--libkeccak_squeeze.32
-rw-r--r--libkeccak_state_copy.34
-rw-r--r--libkeccak_state_copy.c4
-rw-r--r--libkeccak_state_create.36
-rw-r--r--libkeccak_state_destroy.32
-rw-r--r--libkeccak_state_duplicate.36
-rw-r--r--libkeccak_state_fast_destroy.32
-rw-r--r--libkeccak_state_fast_free.32
-rw-r--r--libkeccak_state_free.32
-rw-r--r--libkeccak_state_initialise.32
-rw-r--r--libkeccak_state_initialise.c2
-rw-r--r--libkeccak_state_marshal.32
-rw-r--r--libkeccak_state_marshal.c6
-rw-r--r--libkeccak_state_marshal_size.32
-rw-r--r--libkeccak_state_reset.32
-rw-r--r--libkeccak_state_unmarshal.32
-rw-r--r--libkeccak_state_unmarshal.c6
-rw-r--r--libkeccak_state_unmarshal_skip.c4
-rw-r--r--libkeccak_state_wipe.32
-rw-r--r--libkeccak_state_wipe.c2
-rw-r--r--libkeccak_state_wipe_message.32
-rw-r--r--libkeccak_state_wipe_message.c2
-rw-r--r--libkeccak_state_wipe_sponge.32
-rw-r--r--libkeccak_state_wipe_sponge.c2
-rw-r--r--libkeccak_update.36
-rw-r--r--test.c34
75 files changed, 289 insertions, 274 deletions
diff --git a/Makefile b/Makefile
index 9a51de9..d1d43f7 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ OBJ =\
HDR =\
libkeccak.h\
+ libkeccak-legacy.h\
common.h
MAN3 =\
@@ -155,7 +156,7 @@ install: libkeccak.$(LIBEXT) libkeccak.a
ln -sf -- libkeccak.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libkeccak.$(LIBMAJOREXT)"
ln -sf -- libkeccak.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libkeccak.$(LIBEXT)"
cp -- libkeccak.a "$(DESTDIR)$(PREFIX)/lib/libkeccak.a"
- cp -- libkeccak.h "$(DESTDIR)$(PREFIX)/include/"
+ cp -- libkeccak.h libkeccak-legacy.h "$(DESTDIR)$(PREFIX)/include/"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7"
cp -- $(MAN3) "$(DESTDIR)$(MANPREFIX)/man3"
@@ -170,6 +171,7 @@ uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libkeccak.a"
-rm -rf -- "$(DESTDIR)$(PREFIX)/include/libkeccak"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libkeccak.h"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/include/libkeccak-legacy.h"
-cd -- "$(DESTDIR)$(MANPREFIX)/man3" && rm -f -- $(MAN3)
-cd -- "$(DESTDIR)$(MANPREFIX)/man7" && rm -f -- $(MAN7)
-rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/libkeccak"
diff --git a/benchmark.c b/benchmark.c
index 101c269..3554165 100644
--- a/benchmark.c
+++ b/benchmark.c
@@ -53,8 +53,8 @@ int
main(void)
{
char message[MESSAGE_LEN];
- libkeccak_spec_t spec;
- libkeccak_state_t state;
+ struct libkeccak_spec spec;
+ struct libkeccak_state state;
char hashsum[OUTPUT / 8];
#ifndef IGNORE_BEHEXING
char hexsum[OUTPUT / 8 * 2 + 1];
diff --git a/digest.c b/digest.c
index 891b471..1541849 100644
--- a/digest.c
+++ b/digest.c
@@ -1,5 +1,5 @@
/* See LICENSE file for copyright and license details. */
-#include "../common.h"
+#include "common.h"
/**
@@ -78,7 +78,7 @@ static const uint_fast64_t RC[] = {
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __hot__)))
static void
-libkeccak_f_round(register libkeccak_state_t *restrict state, register int_fast64_t rc)
+libkeccak_f_round(register struct libkeccak_state *restrict state, register int_fast64_t rc)
{
int_fast64_t *restrict A = state->S;
int_fast64_t B[25];
@@ -126,7 +126,7 @@ libkeccak_f_round(register libkeccak_state_t *restrict state, register int_fast6
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __hot__)))
static void
-libkeccak_f_round64(register libkeccak_state_t *restrict state, register int_fast64_t rc)
+libkeccak_f_round64(register struct libkeccak_state *restrict state, register int_fast64_t rc)
{
int_fast64_t *restrict A = state->S;
int_fast64_t B[25];
@@ -171,7 +171,7 @@ libkeccak_f_round64(register libkeccak_state_t *restrict state, register int_fas
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __gnu_inline__)))
static inline void
-libkeccak_f(register libkeccak_state_t *restrict state)
+libkeccak_f(register struct libkeccak_state *restrict state)
{
register long int i = 0;
register long int nr = state->nr;
@@ -245,7 +245,7 @@ libkeccak_to_lane64(register const char *restrict message, register size_t msgle
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __gnu_inline__)))
static inline void
-libkeccak_pad10star1(register libkeccak_state_t *restrict state, register size_t bits)
+libkeccak_pad10star1(register struct libkeccak_state *restrict state, register size_t bits)
{
register size_t r = (size_t)(state->r);
register size_t nrf = state->mptr - !!bits;
@@ -276,7 +276,7 @@ libkeccak_pad10star1(register libkeccak_state_t *restrict state, register size_t
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
static void
-libkeccak_absorption_phase(register libkeccak_state_t *restrict state, register size_t len)
+libkeccak_absorption_phase(register struct libkeccak_state *restrict state, register size_t len)
{
register long int rr = state->r >> 3;
register long int ww = state->w >> 3;
@@ -315,7 +315,7 @@ libkeccak_absorption_phase(register libkeccak_state_t *restrict state, register
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __hot__)))
static void
-libkeccak_squeezing_phase(register libkeccak_state_t *restrict state, long int rr,
+libkeccak_squeezing_phase(register struct libkeccak_state *restrict state, long int rr,
long int nn, long int ww, register unsigned char *restrict hashsum)
{
register int_fast64_t v;
@@ -347,7 +347,7 @@ libkeccak_squeezing_phase(register libkeccak_state_t *restrict state, long int r
* @return Zero on success, -1 on error
*/
int
-libkeccak_fast_update(libkeccak_state_t *restrict state, const void *restrict msg, size_t msglen)
+libkeccak_fast_update(struct libkeccak_state *restrict state, const void *restrict msg, size_t msglen)
{
size_t len;
auto char *restrict new;
@@ -383,7 +383,7 @@ libkeccak_fast_update(libkeccak_state_t *restrict state, const void *restrict ms
* @return Zero on success, -1 on error
*/
int
-libkeccak_update(libkeccak_state_t *restrict state, const void *restrict msg, size_t msglen)
+libkeccak_update(struct libkeccak_state *restrict state, const void *restrict msg, size_t msglen)
{
size_t len;
auto char *restrict new;
@@ -424,7 +424,7 @@ libkeccak_update(libkeccak_state_t *restrict state, const void *restrict msg, si
* @return Zero on success, -1 on error
*/
int
-libkeccak_fast_digest(libkeccak_state_t *restrict state, const void *restrict msg_, size_t msglen,
+libkeccak_fast_digest(struct libkeccak_state *restrict state, const void *restrict msg_, size_t msglen,
size_t bits, const char *restrict suffix, void *restrict hashsum)
{
const char *restrict msg = msg_;
@@ -493,7 +493,7 @@ libkeccak_fast_digest(libkeccak_state_t *restrict state, const void *restrict ms
* @return Zero on success, -1 on error
*/
int
-libkeccak_digest(libkeccak_state_t *restrict state, const void *restrict msg_, size_t msglen,
+libkeccak_digest(struct libkeccak_state *restrict state, const void *restrict msg_, size_t msglen,
size_t bits, const char *restrict suffix, void *restrict hashsum)
{
const char *restrict msg = msg_;
@@ -558,7 +558,7 @@ libkeccak_digest(libkeccak_state_t *restrict state, const void *restrict msg_, s
* @param times The number of rounds
*/
void
-libkeccak_simple_squeeze(register libkeccak_state_t *restrict state, register long int times)
+libkeccak_simple_squeeze(register struct libkeccak_state *restrict state, register long int times)
{
while (times--)
libkeccak_f(state);
@@ -572,7 +572,7 @@ libkeccak_simple_squeeze(register libkeccak_state_t *restrict state, register lo
* @param times The number of digests
*/
void
-libkeccak_fast_squeeze(register libkeccak_state_t *restrict state, register long int times)
+libkeccak_fast_squeeze(register struct libkeccak_state *restrict state, register long int times)
{
times *= (state->n - 1) / state->r + 1;
while (times--)
@@ -587,7 +587,7 @@ libkeccak_fast_squeeze(register libkeccak_state_t *restrict state, register long
* @param hashsum Output parameter for the hashsum
*/
void
-libkeccak_squeeze(register libkeccak_state_t *restrict state, register void *restrict hashsum)
+libkeccak_squeeze(register struct libkeccak_state *restrict state, register void *restrict hashsum)
{
libkeccak_f(state);
libkeccak_squeezing_phase(state, state->r >> 3, (state->n + 7) >> 3, state->w >> 3, hashsum);
diff --git a/libkeccak-legacy.h b/libkeccak-legacy.h
new file mode 100644
index 0000000..7641711
--- /dev/null
+++ b/libkeccak-legacy.h
@@ -0,0 +1,14 @@
+/* See LICENSE file for copyright and license details. */
+
+
+LIBKECCAK_GCC_ONLY(__attribute__((__deprecated__("Use struct libkeccak_spec instead of libkeccak_spec_t"))))
+typedef struct libkeccak_spec libkeccak_spec_t;
+
+LIBKECCAK_GCC_ONLY(__attribute__((__deprecated__("Use struct libkeccak_generalised_spec instead of libkeccak_generalised_spec_t"))))
+typedef struct libkeccak_generalised_spec libkeccak_generalised_spec_t;
+
+LIBKECCAK_GCC_ONLY(__attribute__((__deprecated__("Use struct libkeccak_state instead of libkeccak_state_t"))))
+typedef struct libkeccak_state libkeccak_state_t;
+
+LIBKECCAK_GCC_ONLY(__attribute__((__deprecated__("Use struct libkeccak_hmac_state instead of libkeccak_hmac_state_t"))))
+typedef struct libkeccak_hmac_state libkeccak_hmac_state_t;
diff --git a/libkeccak.h b/libkeccak.h
index 7a95f91..b53d158 100644
--- a/libkeccak.h
+++ b/libkeccak.h
@@ -39,50 +39,50 @@
/**
- * Invalid `libkeccak_spec_t.bitrate`: non-positive
+ * Invalid `struct libkeccak_spec.bitrate`: non-positive
*/
#define LIBKECCAK_SPEC_ERROR_BITRATE_NONPOSITIVE 1
/**
- * Invalid `libkeccak_spec_t.bitrate`: not a multiple of 8
+ * Invalid `struct libkeccak_spec.bitrate`: not a multiple of 8
*/
#define LIBKECCAK_SPEC_ERROR_BITRATE_MOD_8 2
/**
- * Invalid `libkeccak_spec_t.capacity`: non-positive
+ * Invalid `struct libkeccak_spec.capacity`: non-positive
*/
#define LIBKECCAK_SPEC_ERROR_CAPACITY_NONPOSITIVE 3
/**
- * Invalid `libkeccak_spec_t.capacity`: not a multiple of 8
+ * Invalid `struct libkeccak_spec.capacity`: not a multiple of 8
*/
#define LIBKECCAK_SPEC_ERROR_CAPACITY_MOD_8 4
/**
- * Invalid `libkeccak_spec_t.output`: non-positive
+ * Invalid `struct libkeccak_spec.output`: non-positive
*/
#define LIBKECCAK_SPEC_ERROR_OUTPUT_NONPOSITIVE 5
/**
- * Invalid `libkeccak_spec_t` values: `.bitrate + `.capacity`
+ * Invalid `struct libkeccak_spec` values: `.bitrate + `.capacity`
* is greater 1600 which is the largest supported state size
*/
#define LIBKECCAK_SPEC_ERROR_STATE_TOO_LARGE 6
/**
- * Invalid `libkeccak_spec_t` values:
+ * Invalid `struct libkeccak_spec` values:
* `.bitrate + `.capacity` is not a multiple of 25
*/
#define LIBKECCAK_SPEC_ERROR_STATE_MOD_25 7
/**
- * Invalid `libkeccak_spec_t` values: `.bitrate + `.capacity`
+ * Invalid `struct libkeccak_spec` values: `.bitrate + `.capacity`
* is a not a 2-potent multiple of 25
*/
#define LIBKECCAK_SPEC_ERROR_WORD_NON_2_POTENT 8
/**
- * Invalid `libkeccak_spec_t` values: `.bitrate + `.capacity`
+ * Invalid `struct libkeccak_spec` values: `.bitrate + `.capacity`
* is a not multiple of 100, and thus the word size is not
* a multiple of 8
*/
@@ -90,65 +90,65 @@
/**
- * Value for `libkeccak_generalised_spec_t` member that
+ * Value for `struct libkeccak_generalised_spec` member that
* is used to automatically select the value
*/
#define LIBKECCAK_GENERALISED_SPEC_AUTOMATIC (-65536L)
/**
- * Invalid `libkeccak_generalised_spec_t.state_size`: non-positive
+ * Invalid `struct libkeccak_generalised_spec.state_size`: non-positive
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_NONPOSITIVE 1
/**
- * Invalid `libkeccak_generalised_spec_t.state_size`: larger than 1600
+ * Invalid `struct libkeccak_generalised_spec.state_size`: larger than 1600
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_TOO_LARGE 2
/**
- * Invalid `libkeccak_generalised_spec_t.state_size`: not a multiple of 25
+ * Invalid `struct libkeccak_generalised_spec.state_size`: not a multiple of 25
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_MOD_25 3
/**
- * Invalid `libkeccak_generalised_spec_t.word_size`: non-positive
+ * Invalid `struct libkeccak_generalised_spec.word_size`: non-positive
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_WORD_NONPOSITIVE 4
/**
- * Invalid `libkeccak_generalised_spec_t.word_size`: larger than 1600 / 25
+ * Invalid `struct libkeccak_generalised_spec.word_size`: larger than 1600 / 25
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_WORD_TOO_LARGE 5
/**
- * Invalid `libkeccak_generalised_spec_t.word_size` and
- * `libkeccak_generalised_spec_t.state_size`: `.word_size * 25 != .state_size`
+ * Invalid `struct libkeccak_generalised_spec.word_size` and
+ * `struct libkeccak_generalised_spec.state_size`: `.word_size * 25 != .state_size`
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_WORD_INCOHERENCY 6
/**
- * Invalid `libkeccak_generalised_spec_t.capacity`: non-positive
+ * Invalid `struct libkeccak_generalised_spec.capacity`: non-positive
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_CAPACITY_NONPOSITIVE 7
/**
- * Invalid `libkeccak_generalised_spec_t.capacity`: not a multiple of 8
+ * Invalid `struct libkeccak_generalised_spec.capacity`: not a multiple of 8
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_CAPACITY_MOD_8 8
/**
- * Invalid `libkeccak_generalised_spec_t.bitrate`: non-positive
+ * Invalid `struct libkeccak_generalised_spec.bitrate`: non-positive
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_BITRATE_NONPOSITIVE 9
/**
- * Invalid `libkeccak_generalised_spec_t.bitrate`: not a multiple of 8
+ * Invalid `struct libkeccak_generalised_spec.bitrate`: not a multiple of 8
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_BITRATE_MOD_8 10
/**
- * Invalid `libkeccak_generalised_spec_t.output`: non-positive
+ * Invalid `struct libkeccak_generalised_spec.output`: non-positive
*/
#define LIBKECCAK_GENERALISED_SPEC_ERROR_OUTPUT_NONPOSITIVE 11
@@ -157,7 +157,7 @@
* Data structure that describes the parameters
* that should be used when hashing
*/
-typedef struct libkeccak_spec {
+struct libkeccak_spec {
/**
* The bitrate
*/
@@ -172,15 +172,13 @@ typedef struct libkeccak_spec {
* The output size
*/
long int output;
-
-} libkeccak_spec_t;
+};
/**
* Generalised datastructure that describes the
* parameters that should be used when hashing
*/
-typedef struct libkeccak_generalised_spec
-{
+struct libkeccak_generalised_spec {
/**
* The bitrate
*/
@@ -205,15 +203,14 @@ typedef struct libkeccak_generalised_spec
* The word size
*/
long int word_size;
-
-} libkeccak_generalised_spec_t;
+};
/**
* Data structure that describes the state of a hashing process
*
* The `char`-size of the output hashsum is calculated by `(.n + 7) / 8`
*/
-typedef struct libkeccak_state {
+struct libkeccak_state {
/**
* The lanes (state/sponge)
*/
@@ -273,19 +270,18 @@ typedef struct libkeccak_state {
* Left over water to fill the sponge with at next update
*/
char *M;
-
-} libkeccak_state_t;
+};
/**
- * Fill in a `libkeccak_spec_t` for a SHA3-x hashing
+ * Fill in a `struct libkeccak_spec` for a SHA3-x hashing
*
* @param spec The specifications datastructure to fill in
* @param x The value of x in `SHA3-x`, the output size
*/
-LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow)))
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
static inline void
-libkeccak_spec_sha3(libkeccak_spec_t *restrict spec, long int x)
+libkeccak_spec_sha3(struct libkeccak_spec *restrict spec, long int x)
{
spec->bitrate = 1600 - 2 * x;
spec->capacity = 2 * x;
@@ -293,15 +289,15 @@ libkeccak_spec_sha3(libkeccak_spec_t *restrict spec, long int x)
}
/**
- * Fill in a `libkeccak_spec_t` for a RawSHAKEx hashing
+ * Fill in a `struct libkeccak_spec` for a RawSHAKEx hashing
*
* @param spec The specifications datastructure to fill in
* @param x The value of x in `RawSHAKEx`, half the capacity
* @param d The output size
*/
-LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow)))
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
static inline void
-libkeccak_spec_rawshake(libkeccak_spec_t *restrict spec, long int x, long int d)
+libkeccak_spec_rawshake(struct libkeccak_spec *restrict spec, long int x, long int d)
{
spec->bitrate = 1600 - 2 * x;
spec->capacity = 2 * x;
@@ -309,26 +305,27 @@ libkeccak_spec_rawshake(libkeccak_spec_t *restrict spec, long int x, long int d)
}
/**
- * Fill in a `libkeccak_spec_t` for a SHAKEx hashing
+ * Fill in a `struct libkeccak_spec` for a SHAKEx hashing
*
- * @param spec:libkeccak_spec_t* The specifications datastructure to fill in
- * @param x:long The value of x in `SHAKEx`, half the capacity
- * @param d:long The output size
+ * @param spec:struct libkeccak_spec * The specifications datastructure to fill in
+ * @param x:long The value of x in `SHAKEx`, half the capacity
+ * @param d:long The output size
*/
#define libkeccak_spec_shake libkeccak_spec_rawshake
/**
- * Check for errors in a `libkeccak_spec_t`
+ * Check for errors in a `struct libkeccak_spec`
*
* @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)))
+LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__, __warn_unused_result__, __pure__)))
static inline int
-libkeccak_spec_check(const libkeccak_spec_t *restrict spec)
+libkeccak_spec_check(const struct libkeccak_spec *restrict spec)
{
long int state_size = spec->capacity + spec->bitrate;
int32_t word_size = (int32_t)(state_size / 25);
+
if (spec->bitrate <= 0) return LIBKECCAK_SPEC_ERROR_BITRATE_NONPOSITIVE;
if (spec->bitrate % 8) return LIBKECCAK_SPEC_ERROR_BITRATE_MOD_8;
if (spec->capacity <= 0) return LIBKECCAK_SPEC_ERROR_CAPACITY_NONPOSITIVE;
@@ -355,7 +352,7 @@ libkeccak_spec_check(const libkeccak_spec_t *restrict spec)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__)))
static inline void
-libkeccak_generalised_spec_initialise(libkeccak_generalised_spec_t *restrict spec)
+libkeccak_generalised_spec_initialise(struct libkeccak_generalised_spec *restrict spec)
{
spec->bitrate = LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
spec->capacity = LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
@@ -365,14 +362,14 @@ libkeccak_generalised_spec_initialise(libkeccak_generalised_spec_t *restrict spe
}
/**
- * Convert a `libkeccak_generalised_spec_t` to a `libkeccak_spec_t`
+ * Convert a `struct libkeccak_generalised_spec` to a `struct libkeccak_spec`
*
* @param spec The generalised input specifications, will be update with resolved automatic values
* @param output_spec The specification datastructure to fill in
* @return Zero if `spec` is valid, a `LIBKECCAK_GENERALISED_SPEC_ERROR_*` if an error was found
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__, __nothrow__)))
-int libkeccak_degeneralise_spec(libkeccak_generalised_spec_t *restrict, libkeccak_spec_t *restrict);
+int libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *restrict, struct libkeccak_spec *restrict);
/**
* Initialise a state according to hashing specifications
@@ -382,7 +379,7 @@ int libkeccak_degeneralise_spec(libkeccak_generalised_spec_t *restrict, libkecca
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__)))
-int libkeccak_state_initialise(libkeccak_state_t *restrict, const libkeccak_spec_t *restrict);
+int libkeccak_state_initialise(struct libkeccak_state *restrict, const struct libkeccak_spec *restrict);
/**
* Reset a state according to hashing specifications
@@ -391,7 +388,7 @@ int libkeccak_state_initialise(libkeccak_state_t *restrict, const libkeccak_spec
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__)))
static inline void
-libkeccak_state_reset(libkeccak_state_t *restrict state)
+libkeccak_state_reset(struct libkeccak_state *restrict state)
{
state->mptr = 0;
memset(state->S, 0, sizeof(state->S));
@@ -403,7 +400,7 @@ libkeccak_state_reset(libkeccak_state_t *restrict state)
* @param state The state that should be destroyed
*/
static inline void
-libkeccak_state_fast_destroy(libkeccak_state_t *restrict state)
+libkeccak_state_fast_destroy(struct libkeccak_state *restrict state)
{
if (state) {
free(state->M);
@@ -417,7 +414,7 @@ libkeccak_state_fast_destroy(libkeccak_state_t *restrict state)
* @param state The state that should be wipe
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__, __nothrow__, __optimize__("-O0"))))
-void libkeccak_state_wipe_message(volatile libkeccak_state_t *restrict);
+void libkeccak_state_wipe_message(volatile struct libkeccak_state *restrict);
/**
* Wipe data in the state's sponge wihout freeing any data
@@ -425,7 +422,7 @@ void libkeccak_state_wipe_message(volatile libkeccak_state_t *restrict);
* @param state The state that should be wipe
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__, __nothrow__, __optimize__("-O0"))))
-void libkeccak_state_wipe_sponge(volatile libkeccak_state_t *restrict);
+void libkeccak_state_wipe_sponge(volatile struct libkeccak_state *restrict);
/**
* Wipe sensitive data wihout freeing any data
@@ -433,7 +430,7 @@ void libkeccak_state_wipe_sponge(volatile libkeccak_state_t *restrict);
* @param state The state that should be wipe
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __optimize__("-O0"))))
-void libkeccak_state_wipe(volatile libkeccak_state_t *restrict);
+void libkeccak_state_wipe(volatile struct libkeccak_state *restrict);
/**
* Release resources allocation for a state and wipe sensitive data
@@ -442,7 +439,7 @@ void libkeccak_state_wipe(volatile libkeccak_state_t *restrict);
*/
LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
static inline void
-libkeccak_state_destroy(volatile libkeccak_state_t *restrict state)
+libkeccak_state_destroy(volatile struct libkeccak_state *restrict state)
{
if (state) {
libkeccak_state_wipe(state);
@@ -458,10 +455,10 @@ libkeccak_state_destroy(volatile libkeccak_state_t *restrict state)
* @return The state, `NULL` on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline libkeccak_state_t *
-libkeccak_state_create(const libkeccak_spec_t *restrict spec)
+static inline struct libkeccak_state *
+libkeccak_state_create(const struct libkeccak_spec *restrict spec)
{
- libkeccak_state_t *restrict state = malloc(sizeof(libkeccak_state_t));
+ struct libkeccak_state *restrict state = malloc(sizeof(struct libkeccak_state));
if (!state || libkeccak_state_initialise(state, spec)) {
free(state);
return NULL;
@@ -476,7 +473,7 @@ libkeccak_state_create(const libkeccak_spec_t *restrict spec)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__unused__)))
static inline void
-libkeccak_state_fast_free(libkeccak_state_t *restrict state)
+libkeccak_state_fast_free(struct libkeccak_state *restrict state)
{
libkeccak_state_fast_destroy(state);
free(state);
@@ -489,14 +486,14 @@ libkeccak_state_fast_free(libkeccak_state_t *restrict state)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
static inline void
-libkeccak_state_free(volatile libkeccak_state_t *restrict state)
+libkeccak_state_free(volatile struct libkeccak_state *restrict state)
{
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-qual"
#endif
libkeccak_state_destroy(state);
- free((libkeccak_state_t *)state);
+ free((struct libkeccak_state *)state);
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
@@ -510,7 +507,7 @@ libkeccak_state_free(volatile libkeccak_state_t *restrict state)
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__)))
-int libkeccak_state_copy(libkeccak_state_t *restrict, const libkeccak_state_t *restrict);
+int libkeccak_state_copy(struct libkeccak_state *restrict, const struct libkeccak_state *restrict);
/**
* A wrapper for `libkeccak_state_copy` that also allocates the duplicate
@@ -519,10 +516,10 @@ int libkeccak_state_copy(libkeccak_state_t *restrict, const libkeccak_state_t *r
* @return The duplicate, `NULL` on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline libkeccak_state_t *
-libkeccak_state_duplicate(const libkeccak_state_t *restrict src)
+static inline struct libkeccak_state *
+libkeccak_state_duplicate(const struct libkeccak_state *restrict src)
{
- libkeccak_state_t *restrict dest = malloc(sizeof(libkeccak_state_t));
+ struct libkeccak_state *restrict dest = malloc(sizeof(struct libkeccak_state));
if (!dest || libkeccak_state_copy(dest, src)) {
libkeccak_state_free(dest);
return NULL;
@@ -539,33 +536,33 @@ libkeccak_state_duplicate(const libkeccak_state_t *restrict src)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__, __warn_unused_result__, __pure__)))
static inline size_t
-libkeccak_state_marshal_size(const libkeccak_state_t *restrict state)
+libkeccak_state_marshal_size(const struct libkeccak_state *restrict state)
{
- return sizeof(libkeccak_state_t) - sizeof(char *) + state->mptr * sizeof(char);
+ return sizeof(struct libkeccak_state) - sizeof(char *) + state->mptr * sizeof(char);
}
/**
- * Marshal a `libkeccak_state_t` into a buffer
+ * Marshal a `struct libkeccak_state` into a buffer
*
* @param state The state to marshal
* @param data The output buffer
* @return The number of bytes stored to `data`
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__, __nothrow__)))
-size_t libkeccak_state_marshal(const libkeccak_state_t *restrict, void *restrict);
+size_t libkeccak_state_marshal(const struct libkeccak_state *restrict, void *restrict);
/**
- * Unmarshal a `libkeccak_state_t` from a buffer
+ * Unmarshal a `struct libkeccak_state` from a buffer
*
* @param state The slot for the unmarshalled state, must not be initialised (memory leak otherwise)
* @param data The input buffer
* @return The number of bytes read from `data`, 0 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__leaf__, __nonnull__)))
-size_t libkeccak_state_unmarshal(libkeccak_state_t *restrict, const void *restrict);
+size_t libkeccak_state_unmarshal(struct libkeccak_state *restrict, const void *restrict);
/**
- * Gets the number of bytes the `libkeccak_state_t` stored
+ * Gets the number of bytes the `struct libkeccak_state` stored
* at the beginning of `data` occupies
*
* @param data The data buffer
@@ -584,7 +581,7 @@ size_t libkeccak_state_unmarshal_skip(const void *restrict);
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__)))
-int libkeccak_fast_update(libkeccak_state_t *restrict, const void *restrict, size_t);
+int libkeccak_fast_update(struct libkeccak_state *restrict, const void *restrict, size_t);
/**
* Absorb more of the message to the Keccak sponge
@@ -596,7 +593,7 @@ int libkeccak_fast_update(libkeccak_state_t *restrict, const void *restrict, siz
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__)))
-int libkeccak_update(libkeccak_state_t *restrict, const void *restrict, size_t);
+int libkeccak_update(struct libkeccak_state *restrict, const void *restrict, size_t);
/**
* Absorb the last part of the message and squeeze the Keccak sponge
@@ -611,7 +608,7 @@ int libkeccak_update(libkeccak_state_t *restrict, const void *restrict, size_t);
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_fast_digest(libkeccak_state_t *restrict, const void *restrict, size_t,
+int libkeccak_fast_digest(struct libkeccak_state *restrict, const void *restrict, size_t,
size_t, const char *restrict, void *restrict);
/**
@@ -627,7 +624,7 @@ int libkeccak_fast_digest(libkeccak_state_t *restrict, const void *restrict, siz
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_digest(libkeccak_state_t *restrict, const void *restrict, size_t,
+int libkeccak_digest(struct libkeccak_state *restrict, const void *restrict, size_t,
size_t, const char *restrict, void *restrict);
/**
@@ -637,7 +634,7 @@ int libkeccak_digest(libkeccak_state_t *restrict, const void *restrict, size_t,
* @param times The number of rounds
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
-void libkeccak_simple_squeeze(register libkeccak_state_t *restrict, register long int);
+void libkeccak_simple_squeeze(register struct libkeccak_state *restrict, register long int);
/**
* Squeeze as much as is needed to get a digest a number of times
@@ -646,7 +643,7 @@ void libkeccak_simple_squeeze(register libkeccak_state_t *restrict, register lon
* @param times The number of digests
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
-void libkeccak_fast_squeeze(register libkeccak_state_t *restrict, register long int);
+void libkeccak_fast_squeeze(register struct libkeccak_state *restrict, register long int);
/**
* Squeeze out another digest
@@ -655,7 +652,7 @@ void libkeccak_fast_squeeze(register libkeccak_state_t *restrict, register long
* @param hashsum Output parameter for the hashsum
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
-void libkeccak_squeeze(register libkeccak_state_t *restrict, register void *restrict);
+void libkeccak_squeeze(register struct libkeccak_state *restrict, register void *restrict);
/**
* Convert a binary hashsum to lower case hexadecimal representation
@@ -700,7 +697,7 @@ void libkeccak_unhex(void *restrict, const char *restrict);
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2, 3))))
-int libkeccak_generalised_sum_fd(int, libkeccak_state_t *restrict, const libkeccak_spec_t *restrict,
+int libkeccak_generalised_sum_fd(int, struct libkeccak_state *restrict, const struct libkeccak_spec *restrict,
const char *restrict, void *restrict);
/**
@@ -716,7 +713,8 @@ int libkeccak_generalised_sum_fd(int, libkeccak_state_t *restrict, const libkecc
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2, 3), __artificial__, __gnu_inline__)))
static inline int
-libkeccak_keccaksum_fd(int fd, libkeccak_state_t *restrict state, const libkeccak_spec_t *restrict spec, void *restrict hashsum)
+libkeccak_keccaksum_fd(int fd, struct libkeccak_state *restrict state,
+ const struct libkeccak_spec *restrict spec, void *restrict hashsum)
{
return libkeccak_generalised_sum_fd(fd, state, spec, NULL, hashsum);
}
@@ -734,9 +732,9 @@ libkeccak_keccaksum_fd(int fd, libkeccak_state_t *restrict state, const libkecca
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__, __gnu_inline__)))
static inline int
-libkeccak_sha3sum_fd(int fd, libkeccak_state_t *restrict state, long output, void *restrict hashsum)
+libkeccak_sha3sum_fd(int fd, struct libkeccak_state *restrict state, long output, void *restrict hashsum)
{
- libkeccak_spec_t spec;
+ struct libkeccak_spec spec;
libkeccak_spec_sha3(&spec, output);
return libkeccak_generalised_sum_fd(fd, state, &spec, LIBKECCAK_SHA3_SUFFIX, hashsum);
}
@@ -755,9 +753,9 @@ libkeccak_sha3sum_fd(int fd, libkeccak_state_t *restrict state, long output, voi
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__, __gnu_inline__)))
static inline int
-libkeccak_rawshakesum_fd(int fd, libkeccak_state_t *restrict state, long semicapacity, long output, void *restrict hashsum)
+libkeccak_rawshakesum_fd(int fd, struct libkeccak_state *restrict state, long semicapacity, long output, void *restrict hashsum)
{
- libkeccak_spec_t spec;
+ struct libkeccak_spec spec;
libkeccak_spec_rawshake(&spec, semicapacity, output);
return libkeccak_generalised_sum_fd(fd, state, &spec, LIBKECCAK_RAWSHAKE_SUFFIX, hashsum);
}
@@ -776,9 +774,9 @@ libkeccak_rawshakesum_fd(int fd, libkeccak_state_t *restrict state, long semicap
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(2), __artificial__, __gnu_inline__)))
static inline int
-libkeccak_shakesum_fd(int fd, libkeccak_state_t *restrict state, long semicapacity, long output, void *restrict hashsum)
+libkeccak_shakesum_fd(int fd, struct libkeccak_state *restrict state, long semicapacity, long output, void *restrict hashsum)
{
- libkeccak_spec_t spec;
+ struct libkeccak_spec spec;
libkeccak_spec_shake(&spec, semicapacity, output);
return libkeccak_generalised_sum_fd(fd, state, &spec, LIBKECCAK_SHAKE_SUFFIX, hashsum);
}
@@ -792,10 +790,9 @@ libkeccak_shakesum_fd(int fd, libkeccak_state_t *restrict state, long semicapaci
/**
- * Datastructure that describes the state of an HMAC-hashing process
+ * Data structure that describes the state of an HMAC-hashing process
*/
-typedef struct libkeccak_hmac_state
-{
+struct libkeccak_hmac_state {
/**
* The key right-padded and XOR:ed with the outer pad
*/
@@ -816,7 +813,7 @@ typedef struct libkeccak_hmac_state
/**
* The state of the underlaying hash-algorithm
*/
- libkeccak_state_t sponge;
+ struct libkeccak_state sponge;
/**
* Buffer used to temporarily store bit shift message if
@@ -835,8 +832,7 @@ typedef struct libkeccak_hmac_state
char leftover;
char __pad[sizeof(void *) / sizeof(char) - 1];
-
-} libkeccak_hmac_state_t;
+};
/**
@@ -848,7 +844,7 @@ typedef struct libkeccak_hmac_state
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_hmac_set_key(libkeccak_hmac_state_t *restrict, const void *restrict, size_t);
+int libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict, const void *restrict, size_t);
/**
* Initialise an HMAC hashing-state according to hashing specifications
@@ -861,7 +857,7 @@ int libkeccak_hmac_set_key(libkeccak_hmac_state_t *restrict, const void *restric
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__)))
static inline int
-libkeccak_hmac_initialise(libkeccak_hmac_state_t *restrict state, const libkeccak_spec_t *restrict spec,
+libkeccak_hmac_initialise(struct libkeccak_hmac_state *restrict state, const struct libkeccak_spec *restrict spec,
const void *restrict key, size_t key_length)
{
if (libkeccak_state_initialise(&state->sponge, spec) < 0)
@@ -885,10 +881,10 @@ libkeccak_hmac_initialise(libkeccak_hmac_state_t *restrict state, const libkecca
* @return The state, `NULL` on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline libkeccak_hmac_state_t *
-libkeccak_hmac_create(const libkeccak_spec_t *restrict spec, const void *restrict key, size_t key_length)
+static inline struct libkeccak_hmac_state *
+libkeccak_hmac_create(const struct libkeccak_spec *restrict spec, const void *restrict key, size_t key_length)
{
- libkeccak_hmac_state_t *restrict state = malloc(sizeof(libkeccak_hmac_state_t));
+ struct libkeccak_hmac_state *restrict state = malloc(sizeof(struct libkeccak_hmac_state));
if (!state || libkeccak_hmac_initialise(state, spec, key, key_length)) {
free(state);
return NULL;
@@ -907,7 +903,7 @@ libkeccak_hmac_create(const libkeccak_spec_t *restrict spec, const void *restric
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1), __unused__)))
static inline int
-libkeccak_hmac_reset(libkeccak_hmac_state_t *restrict state, const void *restrict key, size_t key_length)
+libkeccak_hmac_reset(struct libkeccak_hmac_state *restrict state, const void *restrict key, size_t key_length)
{
libkeccak_state_reset(&state->sponge);
return key ? libkeccak_hmac_set_key(state, key, key_length) : 0;
@@ -919,7 +915,7 @@ libkeccak_hmac_reset(libkeccak_hmac_state_t *restrict state, const void *restric
* @param state The state that should be wipe
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __optimize__("-O0"))))
-void libkeccak_hmac_wipe(volatile libkeccak_hmac_state_t *restrict);
+void libkeccak_hmac_wipe(volatile struct libkeccak_hmac_state *restrict);
/**
* Release resources allocation for an HMAC hashing-state without wiping sensitive data
@@ -927,7 +923,7 @@ void libkeccak_hmac_wipe(volatile libkeccak_hmac_state_t *restrict);
* @param state The state that should be destroyed
*/
static inline void
-libkeccak_hmac_fast_destroy(libkeccak_hmac_state_t *restrict state)
+libkeccak_hmac_fast_destroy(struct libkeccak_hmac_state *restrict state)
{
if (!state)
return;
@@ -947,10 +943,10 @@ libkeccak_hmac_fast_destroy(libkeccak_hmac_state_t *restrict state)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
static inline void
-libkeccak_hmac_destroy(volatile libkeccak_hmac_state_t *restrict state)
+libkeccak_hmac_destroy(volatile struct libkeccak_hmac_state *restrict state)
{
if (!state)
- return;
+ return;
libkeccak_hmac_wipe(state);
free(state->key_opad);
state->key_opad = NULL;
@@ -969,7 +965,7 @@ libkeccak_hmac_destroy(volatile libkeccak_hmac_state_t *restrict state)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__unused__)))
static inline void
-libkeccak_hmac_fast_free(libkeccak_hmac_state_t *restrict state)
+libkeccak_hmac_fast_free(struct libkeccak_hmac_state *restrict state)
{
libkeccak_hmac_fast_destroy(state);
free(state);
@@ -982,14 +978,14 @@ libkeccak_hmac_fast_free(libkeccak_hmac_state_t *restrict state)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__unused__, __optimize__("-O0"))))
static inline void
-libkeccak_hmac_free(volatile libkeccak_hmac_state_t *restrict state)
+libkeccak_hmac_free(volatile struct libkeccak_hmac_state *restrict state)
{
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-qual"
#endif
libkeccak_hmac_destroy(state);
- free((libkeccak_hmac_state_t*)state);
+ free((struct libkeccak_hmac_state*)state);
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
@@ -1003,7 +999,7 @@ libkeccak_hmac_free(volatile libkeccak_hmac_state_t *restrict state)
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__)))
-int libkeccak_hmac_copy(libkeccak_hmac_state_t *restrict, const libkeccak_hmac_state_t *restrict);
+int libkeccak_hmac_copy(struct libkeccak_hmac_state *restrict, const struct libkeccak_hmac_state *restrict);
/**
* A wrapper for `libkeccak_hmac_copy` that also allocates the duplicate
@@ -1012,10 +1008,10 @@ int libkeccak_hmac_copy(libkeccak_hmac_state_t *restrict, const libkeccak_hmac_s
* @return The duplicate, `NULL` on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __unused__, __warn_unused_result__, __malloc__)))
-static inline libkeccak_hmac_state_t *
-libkeccak_hmac_duplicate(const libkeccak_hmac_state_t *restrict src)
+static inline struct libkeccak_hmac_state *
+libkeccak_hmac_duplicate(const struct libkeccak_hmac_state *restrict src)
{
- libkeccak_hmac_state_t* restrict dest = malloc(sizeof(libkeccak_hmac_state_t));
+ struct libkeccak_hmac_state* restrict dest = malloc(sizeof(struct libkeccak_hmac_state));
if (!dest || libkeccak_hmac_copy(dest, src))
return libkeccak_hmac_free(dest), NULL;
return dest;
@@ -1030,14 +1026,14 @@ libkeccak_hmac_duplicate(const libkeccak_hmac_state_t *restrict src)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__, __unused__, __warn_unused_result__, __pure__)))
static inline size_t
-libkeccak_hmac_marshal_size(const libkeccak_hmac_state_t *restrict state)
+libkeccak_hmac_marshal_size(const struct libkeccak_hmac_state *restrict state)
{
return libkeccak_state_marshal_size(&state->sponge) + sizeof(size_t) +
((state->key_length + 7) >> 3) + 2 * sizeof(char);
}
/**
- * Marshal a `libkeccak_hmac_state_t` into a buffer
+ * Marshal a `struct libkeccak_hmac_state` into a buffer
*
* @param state The state to marshal
* @param data The output buffer
@@ -1045,7 +1041,7 @@ libkeccak_hmac_marshal_size(const libkeccak_hmac_state_t *restrict state)
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__, __nothrow__)))
static inline size_t
-libkeccak_hmac_marshal(const libkeccak_hmac_state_t *restrict state, void *restrict data_)
+libkeccak_hmac_marshal(const struct libkeccak_hmac_state *restrict state, void *restrict data_)
{
char *restrict data = data_;
size_t written = libkeccak_state_marshal(&state->sponge, data);
@@ -1060,17 +1056,17 @@ libkeccak_hmac_marshal(const libkeccak_hmac_state_t *restrict state, void *restr
}
/**
- * Unmarshal a `libkeccak_hmac_state_t` from a buffer
+ * Unmarshal a `struct libkeccak_hmac_state` from a buffer
*
* @param state The slot for the unmarshalled state, must not be initialised (memory leak otherwise)
* @param data The input buffer
* @return The number of bytes read from `data`, 0 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__)))
-size_t libkeccak_hmac_unmarshal(libkeccak_hmac_state_t *restrict, const void *restrict);
+size_t libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *restrict, const void *restrict);
/**
- * Gets the number of bytes the `libkeccak_hmac_state_t` stored
+ * Gets the number of bytes the `struct libkeccak_hmac_state` stored
* at the beginning of `data` occupies
*
* @param data The data buffer
@@ -1096,7 +1092,7 @@ libkeccak_hmac_unmarshal_skip(const void *restrict data_)
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_hmac_fast_update(libkeccak_hmac_state_t *restrict state, const void *restrict msg, size_t msglen);
+int libkeccak_hmac_fast_update(struct libkeccak_hmac_state *restrict state, const void *restrict msg, size_t msglen);
/**
* Absorb more, or the first part, of the message
@@ -1108,7 +1104,7 @@ int libkeccak_hmac_fast_update(libkeccak_hmac_state_t *restrict state, const voi
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_hmac_update(libkeccak_hmac_state_t *restrict state, const void *restrict msg, size_t msglen);
+int libkeccak_hmac_update(struct libkeccak_hmac_state *restrict state, const void *restrict msg, size_t msglen);
/**
* Absorb the last part of the message and fetch the hash
@@ -1125,7 +1121,7 @@ int libkeccak_hmac_update(libkeccak_hmac_state_t *restrict state, const void *re
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_hmac_fast_digest(libkeccak_hmac_state_t *restrict state, const void *restrict msg, size_t msglen,
+int libkeccak_hmac_fast_digest(struct libkeccak_hmac_state *restrict state, const void *restrict msg, size_t msglen,
size_t bits, const char *restrict suffix, void *restrict hashsum);
/**
@@ -1143,8 +1139,11 @@ int libkeccak_hmac_fast_digest(libkeccak_hmac_state_t *restrict state, const voi
* @return Zero on success, -1 on error
*/
LIBKECCAK_GCC_ONLY(__attribute__((__nonnull__(1))))
-int libkeccak_hmac_digest(libkeccak_hmac_state_t *restrict state, const void *restrict msg, size_t msglen,
+int libkeccak_hmac_digest(struct libkeccak_hmac_state *restrict state, const void *restrict msg, size_t msglen,
size_t bits, const char *restrict suffix, void *restrict hashsum);
+#include "libkeccak-legacy.h"
+
+
#endif
diff --git a/libkeccak_degeneralise_spec.3 b/libkeccak_degeneralise_spec.3
index 7ec2b72..bed40c4 100644
--- a/libkeccak_degeneralise_spec.3
+++ b/libkeccak_degeneralise_spec.3
@@ -5,7 +5,7 @@ libkeccak_degeneralise_spec - Set all specification parameters to automatic
.nf
#include <libkeccak.h>
-int libkeccak_degeneralise_spec(libkeccak_generalised_spec_t *\fIspec\fP, libkeccak_spec_t *\fIoutput_spec\fP);
+int libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *\fIspec\fP, struct libkeccak_spec *\fIoutput_spec\fP);
.fi
.PP
Link with
@@ -30,13 +30,13 @@ function after calling
.BR libkeccak_degeneralise_spec ().
.PP
.nf
-typedef struct libkeccak_generalised_spec {
- long int bitrate; /* bitrate (in bits) */
- long int capacity; /* capacity (in bits) */
- long int output; /* output size (in bits) */
- long int state_size; /* state size (in bits) */
- long int word_size; /* word size (in bits) */
-} libkeccak_generalised_spec_t;
+struct libkeccak_generalised_spec {
+ long int bitrate; /* bitrate (in bits) */
+ long int capacity; /* capacity (in bits) */
+ long int output; /* output size (in bits) */
+ long int state_size; /* state size (in bits) */
+ long int word_size; /* word size (in bits) */
+};
.fi
.SH RETURN VALUES
The
@@ -94,13 +94,13 @@ function cannot fail.
.fi
.SH EXAMPLE
This examples configure a
-.B libkeccak_spec_t
+.B struct libkeccak_spec
to specify settings for Keccak[c = 512]:
.PP
.nf
int r;
-libkeccak_spec_t spec;
-libkeccak_generalised_spec_t gspec;
+struct libkeccak_spec spec;
+struct libkeccak_generalised_spec gspec;
libkeccak_generalised_spec_initialise(&gspec);
gspec.capacity = 512;
if ((r = libkeccak_degeneralise_spec(&gspec, &spec)))
diff --git a/libkeccak_degeneralise_spec.c b/libkeccak_degeneralise_spec.c
index 13963f8..ec3eb56 100644
--- a/libkeccak_degeneralise_spec.c
+++ b/libkeccak_degeneralise_spec.c
@@ -13,7 +13,7 @@
/**
- * Convert a `libkeccak_generalised_spec_t` to a `libkeccak_spec_t`
+ * Convert a `struct libkeccak_generalised_spec` to a `struct libkeccak_spec`
*
* If you are interrested in finding errors, you should call
* `libkeccak_spec_check(output)` if this function returns zero
@@ -23,8 +23,8 @@
* @return Zero if `spec` is valid, a `LIBKECCAK_GENERALISED_SPEC_ERROR_*` if an error was found
*/
int
-libkeccak_degeneralise_spec(libkeccak_generalised_spec_t *restrict spec,
- libkeccak_spec_t *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 = have(state_size);
diff --git a/libkeccak_digest.3 b/libkeccak_digest.3
index 5f42796..1df8e2e 100644
--- a/libkeccak_digest.3
+++ b/libkeccak_digest.3
@@ -5,7 +5,7 @@ libkeccak_digest - Complete the hashing of a message with erasure
.nf
#include <libkeccak.h>
-int libkeccak_digest(libkeccak_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
+int libkeccak_digest(struct libkeccak_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
size_t \fIbits\fP, const char *\fIsuffix\fP, void *\fIhashsum\fP);
.fi
.PP
@@ -96,8 +96,8 @@ hash of the input from stdin, and prints the hash, in hexadecimal
form, to stdout.
.PP
.nf
-libkeccak_state_t state;
-libkeccak_spec_t spec;
+struct libkeccak_state state;
+struct libkeccak_spec spec;
char binhash[256 / 8];
char hexhash[256 / 8 * 2 + 1];
char chunk[4 << 10];
diff --git a/libkeccak_fast_digest.3 b/libkeccak_fast_digest.3
index 9e9c1f3..149b023 100644
--- a/libkeccak_fast_digest.3
+++ b/libkeccak_fast_digest.3
@@ -6,7 +6,7 @@ libkeccak_fast_digest - Complete the hashing of a message without erasure
.nf
#include <libkeccak.h>
-int libkeccak_fast_digest(libkeccak_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
+int libkeccak_fast_digest(struct libkeccak_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
size_t \fIbits\fP, const char *\fIsuffix\fP, void *\fIhashsum\fP);
.fi
.P
@@ -98,8 +98,8 @@ hash of the input from stdin, and prints the hash, in hexadecimal
form, to stdout.
.PP
.nf
-libkeccak_state_t state;
-libkeccak_spec_t spec;
+struct libkeccak_state state;
+struct libkeccak_spec spec;
char binhash[256 / 8];
char hexhash[256 / 8 * 2 + 1];
char chunk[4 << 10];
diff --git a/libkeccak_fast_squeeze.3 b/libkeccak_fast_squeeze.3
index 393e264..c575eef 100644
--- a/libkeccak_fast_squeeze.3
+++ b/libkeccak_fast_squeeze.3
@@ -5,7 +5,7 @@ libkeccak_fast_squeeze - Runs the squeeze phase a number of times
.nf
#include <libkeccak.h>
-void libkeccak_fast_squeeze(libkeccak_state_t *\fIstate\fP, long int \fItimes\fP);
+void libkeccak_fast_squeeze(struct libkeccak_state *\fIstate\fP, long int \fItimes\fP);
.fi
.PP
Link with
diff --git a/libkeccak_fast_update.3 b/libkeccak_fast_update.3
index 3398984..f2497be 100644
--- a/libkeccak_fast_update.3
+++ b/libkeccak_fast_update.3
@@ -5,7 +5,7 @@ libkeccak_fast_update - Partially hash a message without erasure
.nf
#include <libkeccak.h>
-int libkeccak_fast_update(libkeccak_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
+int libkeccak_fast_update(struct libkeccak_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
.fi
.PP
Link with
@@ -50,8 +50,8 @@ hash of the input from stdin, and prints the hash, in hexadecimal
form, to stdout.
.PP
.nf
-libkeccak_state_t state;
-libkeccak_spec_t spec;
+struct libkeccak_state state;
+struct libkeccak_spec spec;
char binhash[256 / 8];
char hexhash[256 / 8 * 2 + 1];
char chunk[4 << 10];
diff --git a/libkeccak_generalised_spec_initialise.3 b/libkeccak_generalised_spec_initialise.3
index 1a3bccb..d258f77 100644
--- a/libkeccak_generalised_spec_initialise.3
+++ b/libkeccak_generalised_spec_initialise.3
@@ -5,7 +5,7 @@ libkeccak_generalised_spec_initialise - Set all specification parameters to auto
.nf
#include <libkeccak.h>
-void libkeccak_generalised_spec_initialise(libkeccak_generalised_spec_t *\fIspec\fP);
+void libkeccak_generalised_spec_initialise(struct libkeccak_generalised_spec *\fIspec\fP);
.fi
.PP
Link with
diff --git a/libkeccak_generalised_sum_fd.3 b/libkeccak_generalised_sum_fd.3
index bae5bae..3ff7e8c 100644
--- a/libkeccak_generalised_sum_fd.3
+++ b/libkeccak_generalised_sum_fd.3
@@ -5,7 +5,7 @@ libkeccak_generalised_sum_fd - Calculate the hash of a file
.nf
#include <libkeccak.h>
-int libkeccak_generalised_sum_fd(int \fIfd\fP, libkeccak_state_t *\fIstate\fP, const libkeccak_spec_t *\fIspec\fP,
+int libkeccak_generalised_sum_fd(int \fIfd\fP, struct libkeccak_state *\fIstate\fP, const struct libkeccak_spec *\fIspec\fP,
const char *\fIsuffix\fP, void *\fIhashsum\fP);
.fi
.PP
@@ -96,8 +96,8 @@ hash of the input from stdin, and prints the hash, in hexadecimal
form, to stdout.
.PP
.nf
-libkeccak_state_t state;
-libkeccak_spec_t spec;
+struct libkeccak_state state;
+struct libkeccak_spec spec;
char binhash[256 / 8];
char hexhash[256 / 8 * 2 + 1];
diff --git a/libkeccak_generalised_sum_fd.c b/libkeccak_generalised_sum_fd.c
index 133ffa9..634d2c2 100644
--- a/libkeccak_generalised_sum_fd.c
+++ b/libkeccak_generalised_sum_fd.c
@@ -15,7 +15,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_generalised_sum_fd(int fd, libkeccak_state_t *restrict state, const libkeccak_spec_t *restrict spec,
+libkeccak_generalised_sum_fd(int fd, struct libkeccak_state *restrict state, const struct libkeccak_spec *restrict spec,
const char *restrict suffix, void *restrict hashsum)
{
ssize_t got;
diff --git a/libkeccak_hmac_copy.3 b/libkeccak_hmac_copy.3
index 0f29ae8..eb80c6e 100644
--- a/libkeccak_hmac_copy.3
+++ b/libkeccak_hmac_copy.3
@@ -5,7 +5,7 @@ libkeccak_hmac_copy - Copies an HMAC-hashing state
.nf
#include <libkeccak.h>
-int libkeccak_hmac_copy(libkeccak_hmac_state_t *\fIdest\fP, const libkeccak_hmac_state_t *\fIsrc\fP);
+int libkeccak_hmac_copy(struct libkeccak_hmac_state *\fIdest\fP, const struct libkeccak_hmac_state *\fIsrc\fP);
.fi
.PP
Link with
@@ -18,7 +18,7 @@ function initialises
to be identical to
.IR *src .
This includes all members of the
-.B libkeccak_hmac_state_t
+.B struct libkeccak_hmac_state
structure, including the state of the sponge and the
message chunk buffer.
.SH RETURN VALUES
diff --git a/libkeccak_hmac_copy.c b/libkeccak_hmac_copy.c
index 49fc1e7..0e389c1 100644
--- a/libkeccak_hmac_copy.c
+++ b/libkeccak_hmac_copy.c
@@ -10,7 +10,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_hmac_copy(libkeccak_hmac_state_t *restrict dest, const libkeccak_hmac_state_t *restrict src)
+libkeccak_hmac_copy(struct libkeccak_hmac_state *restrict dest, const struct libkeccak_hmac_state *restrict src)
{
size_t size;
diff --git a/libkeccak_hmac_create.3 b/libkeccak_hmac_create.3
index 91bb8a1..d804f31 100644
--- a/libkeccak_hmac_create.3
+++ b/libkeccak_hmac_create.3
@@ -5,7 +5,7 @@ libkeccak_hmac_create - Allocate and initialise HMAC-hashing state
.nf
#include <libkeccak.h>
-libkeccak_hmac_state_t *libkeccak_hmac_create(const libkeccak_spec_t *\fIspec\fP, const void *\fIkey\fP, size_t \fIkey_length\fP);
+struct libkeccak_hmac_state *libkeccak_hmac_create(const struct libkeccak_spec *\fIspec\fP, const void *\fIkey\fP, size_t \fIkey_length\fP);
.fi
.PP
Link with
@@ -14,7 +14,7 @@ Link with
The
.BR libkeccak_hmac_create ()
function allocates a new
-.I libkeccak_hmac_state_t*
+.I struct libkeccak_hmac_state *
with one initialised element, and sets the
algorithm tuning parameters to those specified by
.IR *spec ,
@@ -26,7 +26,7 @@ of length
The
.BR libkeccak_hmac_create ()
function returns a newly allocated
-.I libkeccak_hmac_state_t*
+.I struct libkeccak_hmac_state *
(of one initialised element) upon successful completion.
On error,
.I NULL
diff --git a/libkeccak_hmac_destroy.3 b/libkeccak_hmac_destroy.3
index 0038eca..e2d5b1c 100644
--- a/libkeccak_hmac_destroy.3
+++ b/libkeccak_hmac_destroy.3
@@ -5,7 +5,7 @@ libkeccak_hmac_destroy - Destroys an HMAC-hashing state with erasure
.nf
#include <libkeccak.h>
-void libkeccak_hmac_destroy(libkeccak_hmac_state_t *\fIstate\fP);
+void libkeccak_hmac_destroy(struct libkeccak_hmac_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_digest.3 b/libkeccak_hmac_digest.3
index 99e460a..9c0ee6b 100644
--- a/libkeccak_hmac_digest.3
+++ b/libkeccak_hmac_digest.3
@@ -5,7 +5,7 @@ libkeccak_hmac_digest - Complete the HMAC-hashing of a message with erasure
.nf
#include <libkeccak.h>
-int libkeccak_hmac_digest(libkeccak_hmac_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
+int libkeccak_hmac_digest(struct libkeccak_hmac_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
size_t \fIbits\fP, const char *\fIsuffix\fP, void *\fIhashsum\fP);
.fi
.PP
diff --git a/libkeccak_hmac_digest.c b/libkeccak_hmac_digest.c
index 1cba224..aebb80b 100644
--- a/libkeccak_hmac_digest.c
+++ b/libkeccak_hmac_digest.c
@@ -17,7 +17,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_hmac_digest(libkeccak_hmac_state_t *restrict state, const void *restrict msg_, size_t msglen,
+libkeccak_hmac_digest(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen,
size_t bits, const char *restrict suffix, void *restrict hashsum)
{
const char *restrict msg = msg_;
diff --git a/libkeccak_hmac_duplicate.3 b/libkeccak_hmac_duplicate.3
index bb16139..b1cdc30 100644
--- a/libkeccak_hmac_duplicate.3
+++ b/libkeccak_hmac_duplicate.3
@@ -5,7 +5,7 @@ libkeccak_hmac_duplicate - Allocate a duplicate an HMAC-hashing state
.nf
#include <libkeccak.h>
-libkeccak_hmac_state_t *libkeccak_hmac_duplicate(const libkeccak_hmac_state_t *\fIsrc\fP);
+struct libkeccak_hmac_state *libkeccak_hmac_duplicate(const struct libkeccak_hmac_state *\fIsrc\fP);
.fi
.PP
Link with
@@ -17,7 +17,7 @@ function allocates a new hash state and initialises
it to be identical to
.IR *src .
This includes all members of the
-.B libkeccak_hmac_state_t
+.B struct libkeccak_hmac_state
structure, including the state of the sponge and the
message chunk buffer.
.SH RETURN VALUES
diff --git a/libkeccak_hmac_fast_destroy.3 b/libkeccak_hmac_fast_destroy.3
index 31bf894..05a8e2e 100644
--- a/libkeccak_hmac_fast_destroy.3
+++ b/libkeccak_hmac_fast_destroy.3
@@ -5,7 +5,7 @@ libkeccak_hmac_fast_destroy - Destroys an HMAC-hashing state without erasure
.nf
#include <libkeccak.h>
-void libkeccak_hamc_fast_destroy(libkeccak_hmac_state_t *\fIstate\fP);
+void libkeccak_hamc_fast_destroy(struct libkeccak_hmac_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_fast_digest.3 b/libkeccak_hmac_fast_digest.3
index 68fcc69..6f21b70 100644
--- a/libkeccak_hmac_fast_digest.3
+++ b/libkeccak_hmac_fast_digest.3
@@ -5,7 +5,7 @@ libkeccak_hmac_fast_digest - Complete the HMAC-hashing of a message without eras
.nf
#include <libkeccak.h>
-int libkeccak_hmac_fast_digest(libkeccak_hmac_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
+int libkeccak_hmac_fast_digest(struct libkeccak_hmac_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP,
size_t \fIbits\fP, const char *\fIsuffix\fP, void *\fIhashsum\fP);
.fi
.PP
diff --git a/libkeccak_hmac_fast_digest.c b/libkeccak_hmac_fast_digest.c
index d4bacb8..c203716 100644
--- a/libkeccak_hmac_fast_digest.c
+++ b/libkeccak_hmac_fast_digest.c
@@ -17,7 +17,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_hmac_fast_digest(libkeccak_hmac_state_t *restrict state, const void *restrict msg_, size_t msglen,
+libkeccak_hmac_fast_digest(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen,
size_t bits, const char *restrict suffix, void *restrict hashsum)
{
const char *restrict msg = msg_;
diff --git a/libkeccak_hmac_fast_free.3 b/libkeccak_hmac_fast_free.3
index f888872..87cb556 100644
--- a/libkeccak_hmac_fast_free.3
+++ b/libkeccak_hmac_fast_free.3
@@ -5,7 +5,7 @@ libkeccak_hmac_fast_free - Destroys and deallocates an HMAC-hashing state withou
.nf
#include <libkeccak.h>
-void libkeccak_hmac_fast_free(libkeccak_hmac_state_t *\fIstate\fP);
+void libkeccak_hmac_fast_free(struct libkeccak_hmac_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_fast_update.3 b/libkeccak_hmac_fast_update.3
index a41b72f..ca62baf 100644
--- a/libkeccak_hmac_fast_update.3
+++ b/libkeccak_hmac_fast_update.3
@@ -5,7 +5,7 @@ libkeccak_hmac_fast_update - Partially HMAC-hash a message without erasure
.nf
#include <libkeccak.h>
-int libkeccak_hmac_fast_update(libkeccak_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
+int libkeccak_hmac_fast_update(struct libkeccak_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_fast_update.c b/libkeccak_hmac_fast_update.c
index d4a3fbe..fe49960 100644
--- a/libkeccak_hmac_fast_update.c
+++ b/libkeccak_hmac_fast_update.c
@@ -12,7 +12,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_hmac_fast_update(libkeccak_hmac_state_t *restrict state, const void *restrict msg_, size_t msglen)
+libkeccak_hmac_fast_update(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen)
{
const char *restrict msg = msg_;
char *old;
diff --git a/libkeccak_hmac_free.3 b/libkeccak_hmac_free.3
index c70f369..91b103e 100644
--- a/libkeccak_hmac_free.3
+++ b/libkeccak_hmac_free.3
@@ -5,7 +5,7 @@ libkeccak_hmac_free - Destroys and deallocates an HMAC-hashing state with erasur
.nf
#include <libkeccak.h>
-void libkeccak_hmac_free(libkeccak_hmac_state_t *\fIstate\fP);
+void libkeccak_hmac_free(struct libkeccak_hmac_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_initialise.3 b/libkeccak_hmac_initialise.3
index 17b2b9f..5d1b923 100644
--- a/libkeccak_hmac_initialise.3
+++ b/libkeccak_hmac_initialise.3
@@ -5,7 +5,7 @@ libkeccak_hmac_initialise - Initialise HMAC-hashing state
.nf
#include <libkeccak.h>
-int libkeccak_hmac_initialise(libkeccak_hmac_state_t *\fIstate\fP, const libkeccak_spec_t *\fIspec\fP,
+int libkeccak_hmac_initialise(struct libkeccak_hmac_state *\fIstate\fP, const struct libkeccak_spec *\fIspec\fP,
const void *\fIkey\fP, size_t \fIkey_length\fP);
.fi
.PP
diff --git a/libkeccak_hmac_marshal.3 b/libkeccak_hmac_marshal.3
index 2e31dd7..7693050 100644
--- a/libkeccak_hmac_marshal.3
+++ b/libkeccak_hmac_marshal.3
@@ -5,7 +5,7 @@ libkeccak_hmac_marshal - Marshals an HMAC-hashing state
.nf
#include <libkeccak.h>
-size_t libkeccak_hmac_marshal(const libkeccak_hmac_state_t *\fIstate\fP, void *\fIdata\fP);
+size_t libkeccak_hmac_marshal(const struct libkeccak_hmac_state *\fIstate\fP, void *\fIdata\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_marshal_size.3 b/libkeccak_hmac_marshal_size.3
index fe8ec2f..b2b8595 100644
--- a/libkeccak_hmac_marshal_size.3
+++ b/libkeccak_hmac_marshal_size.3
@@ -5,7 +5,7 @@ libkeccak_hmac_marshal_size - Calculates the marshal-size of an HMAC-hashing sta
.nf
#include <libkeccak.h>
-size_t libkeccak_hmac_marshal_size(const libkeccak_hmac_state_t *\fIstate\fP);
+size_t libkeccak_hmac_marshal_size(const struct libkeccak_hmac_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_reset.3 b/libkeccak_hmac_reset.3
index 4a9aadf..963ad4c 100644
--- a/libkeccak_hmac_reset.3
+++ b/libkeccak_hmac_reset.3
@@ -5,7 +5,7 @@ libkeccak_hmac_reset - Reinitialise a HMAC-hashing state
.nf
#include <libkeccak.h>
-int libkeccak_hmac_reset(libkeccak_hmac_state_t *\fIstate\fP, const void *\fIkey\fP, size_t \fIkey_length\fP);
+int libkeccak_hmac_reset(struct libkeccak_hmac_state *\fIstate\fP, const void *\fIkey\fP, size_t \fIkey_length\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_set_key.3 b/libkeccak_hmac_set_key.3
index ea8084e..f961ade 100644
--- a/libkeccak_hmac_set_key.3
+++ b/libkeccak_hmac_set_key.3
@@ -5,7 +5,7 @@ libkeccak_hmac_set_key - Changes key for a the HMAC-hashing state
.nf
#include <libkeccak.h>
-int libkeccak_hmac_set_key(libkeccak_hmac_state_t *\fIstate\fP, const void *\fIkey\fP, size_t \fIkey_length\fP);
+int libkeccak_hmac_set_key(struct libkeccak_hmac_state *\fIstate\fP, const void *\fIkey\fP, size_t \fIkey_length\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_set_key.c b/libkeccak_hmac_set_key.c
index 4f450f8..89c01e6 100644
--- a/libkeccak_hmac_set_key.c
+++ b/libkeccak_hmac_set_key.c
@@ -11,7 +11,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_hmac_set_key(libkeccak_hmac_state_t *restrict state, const void *restrict key, size_t key_length)
+libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict state, const void *restrict key, size_t key_length)
{
size_t i, size, new_key_length, key_bytes;
char *old;
diff --git a/libkeccak_hmac_unmarshal.3 b/libkeccak_hmac_unmarshal.3
index c3ed187..a0d98fd 100644
--- a/libkeccak_hmac_unmarshal.3
+++ b/libkeccak_hmac_unmarshal.3
@@ -5,7 +5,7 @@ libkeccak_hmac_unmarshal - Unharshals an HMAC-hashing state
.nf
#include <libkeccak.h>
-size_t libkeccak_hmac_unmarshal(libkeccak_hmac_state_t *\fIstate\fP, const void *\fIdata\fP);
+size_t libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *\fIstate\fP, const void *\fIdata\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_unmarshal.c b/libkeccak_hmac_unmarshal.c
index e64cd08..81d2121 100644
--- a/libkeccak_hmac_unmarshal.c
+++ b/libkeccak_hmac_unmarshal.c
@@ -3,14 +3,14 @@
/**
- * Unmarshal a `libkeccak_hmac_state_t` from a buffer
+ * Unmarshal a `struct libkeccak_hmac_state` from a buffer
*
* @param state The slot for the unmarshalled state, must not be initialised (memory leak otherwise)
* @param data The input buffer
* @return The number of bytes read from `data`, 0 on error
*/
size_t
-libkeccak_hmac_unmarshal(libkeccak_hmac_state_t *restrict state, const void *restrict data_)
+libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *restrict state, const void *restrict data_)
{
const char *restrict data = data_;
size_t parsed, size, i;
diff --git a/libkeccak_hmac_update.3 b/libkeccak_hmac_update.3
index 13891cb..e34bb98 100644
--- a/libkeccak_hmac_update.3
+++ b/libkeccak_hmac_update.3
@@ -5,7 +5,7 @@ libkeccak_hmac_update - Partially HMAC-hash a message with erasure
.nf
#include <libkeccak.h>
-int libkeccak_hmac_update(libkeccak_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
+int libkeccak_hmac_update(struct libkeccak_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_update.c b/libkeccak_hmac_update.c
index b2321f2..6182a0a 100644
--- a/libkeccak_hmac_update.c
+++ b/libkeccak_hmac_update.c
@@ -12,7 +12,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_hmac_update(libkeccak_hmac_state_t *restrict state, const void *restrict msg_, size_t msglen)
+libkeccak_hmac_update(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen)
{
const char *restrict msg = msg_;
size_t i;
diff --git a/libkeccak_hmac_wipe.3 b/libkeccak_hmac_wipe.3
index 471a9a8..ceee5d7 100644
--- a/libkeccak_hmac_wipe.3
+++ b/libkeccak_hmac_wipe.3
@@ -5,7 +5,7 @@ libkeccak_hmac_wipe - Securely erase sensitive data from a HMAC-hashing state
.nf
#include <libkeccak.h>
-int libkeccak_hmac_wipe(libkeccak_hmac_state_t *\fIstate\fP);
+int libkeccak_hmac_wipe(struct libkeccak_hmac_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_hmac_wipe.c b/libkeccak_hmac_wipe.c
index fd99c48..77b4449 100644
--- a/libkeccak_hmac_wipe.c
+++ b/libkeccak_hmac_wipe.c
@@ -8,7 +8,7 @@
* @param state The state that should be wipe
*/
void
-libkeccak_hmac_wipe(volatile libkeccak_hmac_state_t *restrict state)
+libkeccak_hmac_wipe(volatile struct libkeccak_hmac_state *restrict state)
{
volatile char *restrict key_pads;
size_t i, size;
diff --git a/libkeccak_keccaksum_fd.3 b/libkeccak_keccaksum_fd.3
index ccd1f8a..82d1fb9 100644
--- a/libkeccak_keccaksum_fd.3
+++ b/libkeccak_keccaksum_fd.3
@@ -5,7 +5,7 @@ libkeccak_keccaksum_fd - Calculate a Keccak hashsum of a file
.nf
#include <libkeccak.h>
-int libkeccak_keccaksum_fd(int \fIfd\fP, libkeccak_state_t *\fIstate\fP, const libkeccak_spec_t *\fIspec\fP, void *\fIhashsum\fP);
+int libkeccak_keccaksum_fd(int \fIfd\fP, struct libkeccak_state *\fIstate\fP, const struct libkeccak_spec *\fIspec\fP, void *\fIhashsum\fP);
.fi
.PP
Link with
@@ -86,8 +86,8 @@ hash of the input from stdin, and prints the hash, in hexadecimal
form, to stdout.
.LP
.nf
-libkeccak_state_t state;
-libkeccak_spec_t spec;
+struct libkeccak_state state;
+struct libkeccak_spec spec;
char binhash[256 / 8];
char hexhash[256 / 8 * 2 + 1];
diff --git a/libkeccak_rawshakesum_fd.3 b/libkeccak_rawshakesum_fd.3
index 8fad150..5678389 100644
--- a/libkeccak_rawshakesum_fd.3
+++ b/libkeccak_rawshakesum_fd.3
@@ -5,7 +5,7 @@ libkeccak_rawshakesum_fd - Calculate a RawSHAKE hashsum of a file
.nf
#include <libkeccak.h>
-int libkeccak_rawshakesum_fd(int \fIfd\fP, libkeccak_state_t *\fIstate\fP, long int \fIsemicapacity\fP, long int \fIoutput\fP, void *\fIhashsum\fP);
+int libkeccak_rawshakesum_fd(int \fIfd\fP, struct libkeccak_state *\fIstate\fP, long int \fIsemicapacity\fP, long int \fIoutput\fP, void *\fIhashsum\fP);
.fi
.PP
Link with
@@ -88,7 +88,7 @@ This example calculates the RawSHAKE256(, 512) hash of the input
from stdin, and prints the hash, in hexadecimal form, to stdout.
.LP
.nf
-libkeccak_state_t state;
+struct libkeccak_state state;
if (libkeccak_rawshakesum_fd(STDIN_FILENO, &state, 256, 512, binhash) < 0)
goto fail;
libkeccak_behex_lower(hexhash, binhash, sizeof(binhash));
diff --git a/libkeccak_sha3sum_fd.3 b/libkeccak_sha3sum_fd.3
index 0d697e6..d27618d 100644
--- a/libkeccak_sha3sum_fd.3
+++ b/libkeccak_sha3sum_fd.3
@@ -5,7 +5,7 @@ libkeccak_sha3sum_fd - Calculate a SHA-3 hashsum of a file
.nf
#include <libkeccak.h>
-int libkeccak_sha3sum_fd(int \fIfd\fP, libkeccak_state_t *\fIstate\fP, long int \fIoutput\fP, void *\fIhashsum\fP);
+int libkeccak_sha3sum_fd(int \fIfd\fP, struct libkeccak_state *\fIstate\fP, long int \fIoutput\fP, void *\fIhashsum\fP);
.fi
.PP
Link with
@@ -85,7 +85,7 @@ This example calculates the SHA3-256 hash of the input
from stdin, and prints the hash, in hexadecimal form, to stdout.
.LP
.nf
-libkeccak_state_t state;
+struct libkeccak_state state;
if (libkeccak_sha3sum_fd(STDIN_FILENO, &state, 256, binhash) < 0)
goto fail;
libkeccak_behex_lower(hexhash, binhash, sizeof(binhash));
diff --git a/libkeccak_shakesum_fd.3 b/libkeccak_shakesum_fd.3
index 441c549..58b980d 100644
--- a/libkeccak_shakesum_fd.3
+++ b/libkeccak_shakesum_fd.3
@@ -5,7 +5,7 @@ libkeccak_shakesum_fd - Calculate a SHAKE hashsum of a file
.nf
#include <libkeccak.h>
-int libkeccak_shakesum_fd(int \fIfd\fP, libkeccak_state_t *\fIstate\fP, long int \fIsemicapacity\fP, long int \fIoutput\fP, void *\fIhashsum\fP);
+int libkeccak_shakesum_fd(int \fIfd\fP, struct libkeccak_state *\fIstate\fP, long int \fIsemicapacity\fP, long int \fIoutput\fP, void *\fIhashsum\fP);
.fi
.PP
Link with
@@ -88,7 +88,7 @@ This example calculates the SHAKE256(, 512) hash of the input
from stdin, and prints the hash, in hexadecimal form, to stdout.
.LP
.nf
-libkeccak_state_t state;
+struct libkeccak_state state;
if (libkeccak_shakesum_fd(STDIN_FILENO, &state, 256, 512, binhash) < 0)
goto fail;
libkeccak_behex_lower(hexhash, binhash, sizeof(binhash));
diff --git a/libkeccak_simple_squeeze.3 b/libkeccak_simple_squeeze.3
index 8626f5a..defa936 100644
--- a/libkeccak_simple_squeeze.3
+++ b/libkeccak_simple_squeeze.3
@@ -5,7 +5,7 @@ libkeccak_simple_squeeze - Runs Keccak-f a number of times
.nf
#include <libkeccak.h>
-void libkeccak_simple_squeeze(libkeccak_state_t *\fIstate\fP, long int \fItimes\fP);
+void libkeccak_simple_squeeze(struct libkeccak_state *\fIstate\fP, long int \fItimes\fP);
.fi
.PP
Link with
diff --git a/libkeccak_spec_check.3 b/libkeccak_spec_check.3
index 7dd19d8..f7a9c64 100644
--- a/libkeccak_spec_check.3
+++ b/libkeccak_spec_check.3
@@ -5,7 +5,7 @@ libkeccak_spec_check - Validate hashing parameters
.nf
#include <libkeccak.h>
-int libkeccak_spec_check(const libkeccak_spec_t *\fIspec\fP);
+int libkeccak_spec_check(const struct libkeccak_spec *\fIspec\fP);
.fi
.PP
Link with
@@ -24,11 +24,11 @@ or, especially, after settings the parameters
manually for Keccak hashing.
.PP
.nf
-typedef struct libkeccak_spec {
+struct libkeccak_spec {
long int bitrate; /* bitrate (in bits) */
long int capacity; /* capacity (in bits) */
long int output; /* output size (in bits) */
-} libkeccak_spec_t;
+};
.fi
.SH RETURN VALUES
The
diff --git a/libkeccak_spec_rawshake.3 b/libkeccak_spec_rawshake.3
index f5f16b8..3e70b3a 100644
--- a/libkeccak_spec_rawshake.3
+++ b/libkeccak_spec_rawshake.3
@@ -5,7 +5,7 @@ libkeccak_spec_rawshake - Configure RawSHAKE hashing parameters
.nf
#include <libkeccak.h>
-void libkeccak_spec_rawshake(libkeccak_spec_t *\fIspec\fP, long int \fIx\fP, long int \fId\fP);
+void libkeccak_spec_rawshake(struct libkeccak_spec *\fIspec\fP, long int \fIx\fP, long int \fId\fP);
.fi
.PP
Link with
@@ -31,11 +31,11 @@ The
function cannot fail.
.SH EXAMPLE
This example configure a
-.B libkeccak_spec_t
+.B struct libkeccak_spec
to specify the Keccak parameters used for RawSHAKE256(, 512):
.PP
.nf
-libkeccak_spec_t spec;
+struct libkeccak_spec spec;
libkeccak_spec_rawshake(&spec, 256, 512);
.fi
.SH SEE ALSO
diff --git a/libkeccak_spec_sha3.3 b/libkeccak_spec_sha3.3
index 1320631..701a18a 100644
--- a/libkeccak_spec_sha3.3
+++ b/libkeccak_spec_sha3.3
@@ -5,7 +5,7 @@ libkeccak_spec_sha3 - Configure SHA-3 hashing parameters
.nf
#include <libkeccak.h>
-void libkeccak_spec_sha3(libkeccak_spec_t *\fIspec\fP, long int \fIx\fP);
+void libkeccak_spec_sha3(struct libkeccak_spec *\fIspec\fP, long int \fIx\fP);
.fi
.PP
Link with
@@ -30,11 +30,11 @@ The
function cannot fail.
.SH EXAMPLE
This example configure a
-.B libkeccak_spec_t
+.B struct libkeccak_spec
to specify the Keccak parameters used for SHA3-256:
.PP
.nf
-libkeccak_spec_t spec;
+struct libkeccak_spec spec;
libkeccak_spec_sha3(&spec, 256);
.fi
.SH SEE ALSO
diff --git a/libkeccak_spec_shake.3 b/libkeccak_spec_shake.3
index 4beea49..1b97540 100644
--- a/libkeccak_spec_shake.3
+++ b/libkeccak_spec_shake.3
@@ -5,7 +5,7 @@ libkeccak_spec_shake - Configure SHAKE hashing parameters
.nf
#include <libkeccak.h>
-void libkeccak_spec_shake(libkeccak_spec_t *\fIspec\fP, long int \fIx\fP, long int \fId\fP);
+void libkeccak_spec_shake(struct libkeccak_spec *\fIspec\fP, long int \fIx\fP, long int \fId\fP);
.fi
.PP
Link with
@@ -31,11 +31,11 @@ The
function cannot fail.
.SH EXAMPLE
This example configure a
-.B libkeccak_spec_t
+.B struct libkeccak_spec
to specify the Keccak parameters used for SHAKE256(, 512):
.PP
.nf
-libkeccak_spec_t spec;
+struct libkeccak_spec spec;
libkeccak_spec_shake(&spec, 256, 512);
.fi
.SH SEE ALSO
diff --git a/libkeccak_squeeze.3 b/libkeccak_squeeze.3
index 67430a4..1a595bb 100644
--- a/libkeccak_squeeze.3
+++ b/libkeccak_squeeze.3
@@ -5,7 +5,7 @@ libkeccak_squeeze - Runs the squeeze phase
.nf
#include <libkeccak.h>
-void libkeccak_squeeze(libkeccak_state_t *\fIstate\fP, void *\fIhashsum\fP);
+void libkeccak_squeeze(struct libkeccak_state *\fIstate\fP, void *\fIhashsum\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_copy.3 b/libkeccak_state_copy.3
index 4bd892c..84f6352 100644
--- a/libkeccak_state_copy.3
+++ b/libkeccak_state_copy.3
@@ -5,7 +5,7 @@ libkeccak_state_copy - Copies hash state
.nf
#include <libkeccak.h>
-int libkeccak_state_copy(libkeccak_state_t *\fIdest\fP, const libkeccak_state_t *\fIsrc\fP);
+int libkeccak_state_copy(struct libkeccak_state *\fIdest\fP, const struct libkeccak_state *\fIsrc\fP);
.fi
.PP
Link with
@@ -18,7 +18,7 @@ function initialises
to be identical to
.IR *src .
This includes all members of the
-.B libkeccak_state_t
+.B struct libkeccak_state
structure, including the state of the sponge and the
message chunk buffer.
.SH RETURN VALUES
diff --git a/libkeccak_state_copy.c b/libkeccak_state_copy.c
index 76672d2..97a76ef 100644
--- a/libkeccak_state_copy.c
+++ b/libkeccak_state_copy.c
@@ -10,9 +10,9 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_state_copy(libkeccak_state_t *restrict dest, const libkeccak_state_t *restrict src)
+libkeccak_state_copy(struct libkeccak_state *restrict dest, const struct libkeccak_state *restrict src)
{
- memcpy(dest, src, sizeof(libkeccak_state_t));
+ memcpy(dest, src, sizeof(struct libkeccak_state));
dest->M = malloc(src->mlen * sizeof(char));
if (!dest->M)
return -1;
diff --git a/libkeccak_state_create.3 b/libkeccak_state_create.3
index f27e124..d037435 100644
--- a/libkeccak_state_create.3
+++ b/libkeccak_state_create.3
@@ -5,7 +5,7 @@ libkeccak_state_create - Allocate and initialise hash state
.nf
#include <libkeccak.h>
-libkeccak_state_t *libkeccak_state_create(const libkeccak_spec_t *\fIspec\fP);
+struct libkeccak_state *libkeccak_state_create(const struct libkeccak_spec *\fIspec\fP);
.fi
.PP
Link with
@@ -14,7 +14,7 @@ Link with
The
.BR libkeccak_state_create ()
function allocates a new
-.I libkeccak_state_t*
+.I struct libkeccak_state *
with one initialised element, and sets the algorithm
tuning parameters to those specified by
.IR *spec .
@@ -22,7 +22,7 @@ tuning parameters to those specified by
The
.BR libkeccak_state_create ()
function returns a newly allocated
-.I libkeccak_state_t*
+.I struct libkeccak_state *
(of one initialised element) upon successful completion.
On error,
.I NULL
diff --git a/libkeccak_state_destroy.3 b/libkeccak_state_destroy.3
index 2df1f49..34365f1 100644
--- a/libkeccak_state_destroy.3
+++ b/libkeccak_state_destroy.3
@@ -5,7 +5,7 @@ libkeccak_state_destroy - Destroys a hash state with erasure
.nf
#include <libkeccak.h>
-void libkeccak_state_destroy(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_destroy(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_duplicate.3 b/libkeccak_state_duplicate.3
index dfd0612..ef0bcba 100644
--- a/libkeccak_state_duplicate.3
+++ b/libkeccak_state_duplicate.3
@@ -5,7 +5,7 @@ libkeccak_state_duplicate - Allocate a duplicate hash state
.nf
#include <libkeccak.h>
-libkeccak_state_t *libkeccak_state_duplicate(const libkeccak_state_t *\fIsrc\fP);
+struct libkeccak_state *libkeccak_state_duplicate(const struct libkeccak_state *\fIsrc\fP);
.fi
.PP
Link with
@@ -17,14 +17,14 @@ function allocates a new hash state and initialises it
to be identical to
.IR *src .
This includes all members of the
-.B libkeccak_state_t
+.B struct libkeccak_state
structure, including the state of the sponge and the
message chunk buffer.
.SH RETURN VALUES
The
.BR libkeccak_state_duplicate ()
function returns a newly allocated
-.I libkeccak_state_t*
+.I struct libkeccak_state*
(of one initialised element) upon successful completion.
On error,
.I NULL
diff --git a/libkeccak_state_fast_destroy.3 b/libkeccak_state_fast_destroy.3
index f346611..bcfdc42 100644
--- a/libkeccak_state_fast_destroy.3
+++ b/libkeccak_state_fast_destroy.3
@@ -5,7 +5,7 @@ libkeccak_state_fast_destroy - Destroys a hash state without erasure
.nf
#include <libkeccak.h>
-void libkeccak_state_fast_destroy(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_fast_destroy(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_fast_free.3 b/libkeccak_state_fast_free.3
index 01d0ed8..63eac25 100644
--- a/libkeccak_state_fast_free.3
+++ b/libkeccak_state_fast_free.3
@@ -5,7 +5,7 @@ libkeccak_state_fast_free - Destroys and deallocates a hash state without erasur
.nf
#include <libkeccak.h>
-void libkeccak_state_fast_free(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_fast_free(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_free.3 b/libkeccak_state_free.3
index 8761d54..529276e 100644
--- a/libkeccak_state_free.3
+++ b/libkeccak_state_free.3
@@ -5,7 +5,7 @@ libkeccak_state_free - Destroys and deallocates a hash state with erasure
.nf
#include <libkeccak.h>
-void libkeccak_state_free(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_free(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_initialise.3 b/libkeccak_state_initialise.3
index cef4d3d..b08b924 100644
--- a/libkeccak_state_initialise.3
+++ b/libkeccak_state_initialise.3
@@ -5,7 +5,7 @@ libkeccak_state_initialise - Initialise hash state
.nf
#include <libkeccak.h>
-int libkeccak_state_initialise(libkeccak_state_t *\fIstate\fP, const libkeccak_spec_t *\fIspec\fP);
+int libkeccak_state_initialise(struct libkeccak_state *\fIstate\fP, const struct libkeccak_spec *\fIspec\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_initialise.c b/libkeccak_state_initialise.c
index 2559f47..390fb87 100644
--- a/libkeccak_state_initialise.c
+++ b/libkeccak_state_initialise.c
@@ -10,7 +10,7 @@
* @return Zero on success, -1 on error
*/
int
-libkeccak_state_initialise(libkeccak_state_t *restrict state, const libkeccak_spec_t *restrict spec)
+libkeccak_state_initialise(struct libkeccak_state *restrict state, const struct libkeccak_spec *restrict spec)
{
long int x;
state->r = spec->bitrate;
diff --git a/libkeccak_state_marshal.3 b/libkeccak_state_marshal.3
index ae21d17..9e49c17 100644
--- a/libkeccak_state_marshal.3
+++ b/libkeccak_state_marshal.3
@@ -5,7 +5,7 @@ libkeccak_state_marshal - Marshals a hash state
.nf
#include <libkeccak.h>
-size_t libkeccak_state_marshal(const libkeccak_state_t *\fIstate\fP, void *\fIdata\fP);
+size_t libkeccak_state_marshal(const struct libkeccak_state *\fIstate\fP, void *\fIdata\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_marshal.c b/libkeccak_state_marshal.c
index 2714a52..f5b086e 100644
--- a/libkeccak_state_marshal.c
+++ b/libkeccak_state_marshal.c
@@ -3,14 +3,14 @@
/**
- * Marshal a `libkeccak_state_t` into a buffer
+ * Marshal a `struct libkeccak_state` into a buffer
*
* @param state The state to marshal
* @param data The output buffer
* @return The number of bytes stored to `data`
*/
size_t
-libkeccak_state_marshal(const libkeccak_state_t *restrict state, void *restrict data_)
+libkeccak_state_marshal(const struct libkeccak_state *restrict state, void *restrict data_)
{
#define set(type, var) *((type *)data) = state->var, data += sizeof(type) / sizeof(char)
char *restrict data = data_;
@@ -28,6 +28,6 @@ libkeccak_state_marshal(const libkeccak_state_t *restrict state, void *restrict
set(size_t, mlen);
memcpy(data, state->M, state->mptr * sizeof(char));
data += state->mptr;
- return sizeof(libkeccak_state_t) - sizeof(char *) + state->mptr * sizeof(char);
+ return sizeof(struct libkeccak_state) - sizeof(char *) + state->mptr * sizeof(char);
#undef set
}
diff --git a/libkeccak_state_marshal_size.3 b/libkeccak_state_marshal_size.3
index 9eca42b..312c415 100644
--- a/libkeccak_state_marshal_size.3
+++ b/libkeccak_state_marshal_size.3
@@ -5,7 +5,7 @@ libkeccak_state_marshal_size - Calculates the marshal-size of a hash state
.nf
#include <libkeccak.h>
-size_t libkeccak_state_marshal_size(const libkeccak_state_t *\fIstate\fP);
+size_t libkeccak_state_marshal_size(const struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_reset.3 b/libkeccak_state_reset.3
index 566bd6b..e847501 100644
--- a/libkeccak_state_reset.3
+++ b/libkeccak_state_reset.3
@@ -5,7 +5,7 @@ libkeccak_state_reset - Reinitialise hash state
.nf
#include <libkeccak.h>
-void libkeccak_state_reset(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_reset(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_unmarshal.3 b/libkeccak_state_unmarshal.3
index 8643164..3881550 100644
--- a/libkeccak_state_unmarshal.3
+++ b/libkeccak_state_unmarshal.3
@@ -5,7 +5,7 @@ libkeccak_state_unmarshal - Unharshals a hash state
.nf
#include <libkeccak.h>
-size_t libkeccak_state_unmarshal(libkeccak_state_t *\fIstate\fP, const void *\fIdata\fP);
+size_t libkeccak_state_unmarshal(struct libkeccak_state *\fIstate\fP, const void *\fIdata\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_unmarshal.c b/libkeccak_state_unmarshal.c
index 7177bd5..ca2013a 100644
--- a/libkeccak_state_unmarshal.c
+++ b/libkeccak_state_unmarshal.c
@@ -3,14 +3,14 @@
/**
- * Unmarshal a `libkeccak_state_t` from a buffer
+ * Unmarshal a `struct libkeccak_state` from a buffer
*
* @param state The slot for the unmarshalled state, must not be initialised (memory leak otherwise)
* @param data The input buffer
* @return The number of bytes read from `data`, 0 on error
*/
size_t
-libkeccak_state_unmarshal(libkeccak_state_t *restrict state, const void *restrict data_)
+libkeccak_state_unmarshal(struct libkeccak_state *restrict state, const void *restrict data_)
{
#define get(type, var) state->var = *((const type *)data), data += sizeof(type) / sizeof(char)
const char *restrict data = data_;
@@ -31,6 +31,6 @@ libkeccak_state_unmarshal(libkeccak_state_t *restrict state, const void *restric
return 0;
memcpy(state->M, data, state->mptr * sizeof(char));
data += state->mptr;
- return sizeof(libkeccak_state_t) - sizeof(char *) + state->mptr * sizeof(char);
+ return sizeof(struct libkeccak_state) - sizeof(char *) + state->mptr * sizeof(char);
#undef get
}
diff --git a/libkeccak_state_unmarshal_skip.c b/libkeccak_state_unmarshal_skip.c
index df488bf..b8c244c 100644
--- a/libkeccak_state_unmarshal_skip.c
+++ b/libkeccak_state_unmarshal_skip.c
@@ -3,7 +3,7 @@
/**
- * Gets the number of bytes the `libkeccak_state_t` stored
+ * Gets the number of bytes the `struct libkeccak_state` stored
* at the beginning of `data` occupies
*
* @param data The data buffer
@@ -14,5 +14,5 @@ libkeccak_state_unmarshal_skip(const void *restrict data_)
{
const char *restrict data = data_;
data += (7 * sizeof(long int) + 26 * sizeof(int64_t)) / sizeof(char);
- return sizeof(libkeccak_state_t) - sizeof(char *) + *(const size_t *)data * sizeof(char);
+ return sizeof(struct libkeccak_state) - sizeof(char *) + *(const size_t *)data * sizeof(char);
}
diff --git a/libkeccak_state_wipe.3 b/libkeccak_state_wipe.3
index 1ae2759..9028dcc 100644
--- a/libkeccak_state_wipe.3
+++ b/libkeccak_state_wipe.3
@@ -5,7 +5,7 @@ libkeccak_state_wipe - Securely erase sensitive data
.nf
#include <libkeccak.h>
-void libkeccak_state_wipe(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_wipe(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_wipe.c b/libkeccak_state_wipe.c
index e5c721c..601fc36 100644
--- a/libkeccak_state_wipe.c
+++ b/libkeccak_state_wipe.c
@@ -8,7 +8,7 @@
* @param state The state that should be wipe
*/
void
-libkeccak_state_wipe(volatile libkeccak_state_t *restrict state)
+libkeccak_state_wipe(volatile struct libkeccak_state *restrict state)
{
libkeccak_state_wipe_message(state);
libkeccak_state_wipe_sponge(state);
diff --git a/libkeccak_state_wipe_message.3 b/libkeccak_state_wipe_message.3
index 7d53afb..27c838a 100644
--- a/libkeccak_state_wipe_message.3
+++ b/libkeccak_state_wipe_message.3
@@ -5,7 +5,7 @@ libkeccak_state_wipe_message - Securely erase the message chunk buffer
.nf
#include <libkeccak.h>
-void libkeccak_state_wipe_message(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_wipe_message(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_wipe_message.c b/libkeccak_state_wipe_message.c
index d6bc8a0..115320e 100644
--- a/libkeccak_state_wipe_message.c
+++ b/libkeccak_state_wipe_message.c
@@ -8,7 +8,7 @@
* @param state The state that should be wipe
*/
void
-libkeccak_state_wipe_message(volatile libkeccak_state_t *restrict state)
+libkeccak_state_wipe_message(volatile struct libkeccak_state *restrict state)
{
volatile char *restrict M = state->M;
size_t i;
diff --git a/libkeccak_state_wipe_sponge.3 b/libkeccak_state_wipe_sponge.3
index 31d6c66..b36e5b4 100644
--- a/libkeccak_state_wipe_sponge.3
+++ b/libkeccak_state_wipe_sponge.3
@@ -5,7 +5,7 @@ libkeccak_state_wipe_sponge - Securely erase the Keccak sponge state
.nf
#include <libkeccak.h>
-void libkeccak_state_wipe_sponge(libkeccak_state_t *\fIstate\fP);
+void libkeccak_state_wipe_sponge(struct libkeccak_state *\fIstate\fP);
.fi
.PP
Link with
diff --git a/libkeccak_state_wipe_sponge.c b/libkeccak_state_wipe_sponge.c
index ad8c29f..eb564c0 100644
--- a/libkeccak_state_wipe_sponge.c
+++ b/libkeccak_state_wipe_sponge.c
@@ -8,7 +8,7 @@
* @param state The state that should be wipe
*/
void
-libkeccak_state_wipe_sponge(volatile libkeccak_state_t *restrict state)
+libkeccak_state_wipe_sponge(volatile struct libkeccak_state *restrict state)
{
volatile int64_t *restrict S = state->S;
size_t i;
diff --git a/libkeccak_update.3 b/libkeccak_update.3
index 4e9f584..ea94849 100644
--- a/libkeccak_update.3
+++ b/libkeccak_update.3
@@ -5,7 +5,7 @@ libkeccak_update - Partially hash a message with erasure
.nf
#include <libkeccak.h>
-int libkeccak_update(libkeccak_state_t *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
+int libkeccak_update(struct libkeccak_state *\fIstate\fP, const void *\fImsg\fP, size_t \fImsglen\fP);
.fi
.PP
Link with
@@ -49,8 +49,8 @@ hash of the input from stdin, and prints the hash, in hexadecimal
form, to stdout.
.PP
.nf
-libkeccak_state_t state;
-libkeccak_spec_t spec;
+struct libkeccak_state state;
+struct libkeccak_spec spec;
char binhash[256 / 8];
char hexhash[256 / 8 * 2 + 1];
char chunk[4 << 10];
diff --git a/test.c b/test.c
index 9b9cdc1..7f5d54c 100644
--- a/test.c
+++ b/test.c
@@ -60,10 +60,10 @@ test_hex(void)
* @return Zero on success, -1 on error
*/
static int
-test_state(libkeccak_spec_t *restrict spec)
+test_state(struct libkeccak_spec *restrict spec)
{
- libkeccak_state_t *restrict state;
- libkeccak_state_t *restrict state2;
+ struct libkeccak_state *restrict state;
+ struct libkeccak_state *restrict state2;
size_t marshal_size, marshalled_size, i, n;
char *restrict marshalled_data;
@@ -90,7 +90,7 @@ test_state(libkeccak_spec_t *restrict spec)
libkeccak_state_free(state);
- if (state = malloc(sizeof(libkeccak_state_t)), state == NULL)
+ if (state = malloc(sizeof(struct libkeccak_state)), state == NULL)
return perror("malloc"), -1;
marshalled_size = libkeccak_state_unmarshal(state, marshalled_data);
if (marshalled_size == 0)
@@ -122,10 +122,10 @@ test_state(libkeccak_spec_t *restrict spec)
* @return Zero on success, -1 on error
*/
static int
-test_digest_case(const libkeccak_spec_t *restrict spec, const char *restrict suffix,
+test_digest_case(const struct libkeccak_spec *restrict spec, const char *restrict suffix,
const char *restrict msg, long bits, const char *restrict expected_answer)
{
- libkeccak_state_t state;
+ struct libkeccak_state state;
char *restrict hashsum;
char *restrict hexsum;
int ok;
@@ -205,7 +205,7 @@ static int test_digest(void)
test_digest_case(&spec, "", message, 0, answer))
- libkeccak_spec_t spec;
+ struct libkeccak_spec spec;
const char *answer;
printf("Testing libkeccak_digest:\n");
@@ -384,10 +384,10 @@ static int test_digest(void)
* @return Zero on success, -1 on error
*/
static int
-test_update_case(const libkeccak_spec_t *restrict spec, const char *restrict suffix,
+test_update_case(const struct libkeccak_spec *restrict spec, const char *restrict suffix,
const char *restrict msg, const char *restrict expected_answer)
{
- libkeccak_state_t state;
+ struct libkeccak_state state;
char *restrict hashsum;
char *restrict hexsum;
int ok;
@@ -442,7 +442,7 @@ static int test_update(void)
libkeccak_spec_sha3(&spec, output),\
test_update_case(&spec, LIBKECCAK_SHA3_SUFFIX, message, answer))
- libkeccak_spec_t spec;
+ struct libkeccak_spec spec;
const char* answer;
printf("Testing libkeccak_update:\n");
@@ -499,7 +499,7 @@ static int test_update(void)
* @param expected_answer The hashum we expect, must be in lowercase hexadecimal
* @return Zero on success, -1 on error
*/
-static int test_squeeze_case(libkeccak_state_t *restrict state, const libkeccak_spec_t *restrict spec,
+static int test_squeeze_case(struct libkeccak_state *restrict state, const struct libkeccak_spec *restrict spec,
long fast_squeezes, long squeezes, int fast_digest, char* restrict hashsum,
char *restrict hexsum, const char *restrict expected_answer)
{
@@ -542,8 +542,8 @@ test_squeeze(void)
#define run_test(fast_squeezes, squeezes, fast_digest)\
test_squeeze_case(&state, &spec, fast_squeezes, squeezes, fast_digest, hashsum, hexsum, answer##squeezes)
- libkeccak_spec_t spec;
- libkeccak_state_t state;
+ struct libkeccak_spec spec;
+ struct libkeccak_state state;
char *restrict hashsum;
char *restrict hexsum;
@@ -613,10 +613,10 @@ test_squeeze(void)
* @return Zero on success, -1 on error
*/
static int
-test_file(const libkeccak_spec_t *restrict spec, const char *restrict suffix,
+test_file(const struct libkeccak_spec *restrict spec, const char *restrict suffix,
const char *restrict filename, const char *restrict expected_answer)
{
- libkeccak_state_t state;
+ struct libkeccak_state state;
char *restrict hashsum;
char *restrict hexsum;
int ok, fd;
@@ -670,8 +670,8 @@ test_file(const libkeccak_spec_t *restrict spec, const char *restrict suffix,
int
main(void)
{
- libkeccak_generalised_spec_t gspec;
- libkeccak_spec_t spec;
+ struct libkeccak_generalised_spec gspec;
+ struct libkeccak_spec spec;
libkeccak_generalised_spec_initialise(&gspec);
if (libkeccak_degeneralise_spec(&gspec, &spec))