aboutsummaryrefslogtreecommitdiffstats
path: root/libblake.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-21 18:29:26 +0100
committerMattias Andrée <maandree@kth.se>2022-01-21 18:29:26 +0100
commit839a3d17d257e73be9bc99dfa90e56c0824050ba (patch)
tree6bb010351447edbb0ae8d910948b01837d2de9e5 /libblake.h
parentFix memory corruption bug in test.c and simplify message byte-length calculation (diff)
downloadlibblake-839a3d17d257e73be9bc99dfa90e56c0824050ba.tar.gz
libblake-839a3d17d257e73be9bc99dfa90e56c0824050ba.tar.bz2
libblake-839a3d17d257e73be9bc99dfa90e56c0824050ba.tar.xz
Initial work on optimising compression function; mm128 version is slower, mm256 version is barely faster
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake.h')
-rw-r--r--libblake.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/libblake.h b/libblake.h
index 65f31cf..ec67df8 100644
--- a/libblake.h
+++ b/libblake.h
@@ -27,6 +27,21 @@
# define LIBBLAKE_CONST__
#endif
+#if defined(__STDC_VERSION__)
+# if __STDC_VERSION__ >= 201112L
+# define LIBBLAKE_ALIGNED__(BYTES) _Alignas(BYTES)
+# endif
+#endif
+#ifndef LIBBLAKE_ALIGNED__
+# if defined(__GNUC__)
+# define LIBBLAKE_ALIGNED__(BYTES) __attribute__((__aligned__(BYTES)))
+# else
+# define LIBBLAKE_ALIGNED__(BYTES)
+# endif
+#endif
+
+
+LIBBLAKE_PUBLIC__ void libblake_init(void);
LIBBLAKE_PUBLIC__ void libblake_encode_hex(const void *data, size_t n, char out[/* static n * 2 + 1 */], int uppercase);
LIBBLAKE_PUBLIC__ size_t libblake_decode_hex(const char *data, size_t n, void *out, int *validp);
@@ -140,12 +155,14 @@ struct libblake_blake2xb_params {
};
struct libblake_blake2s_state {
+ LIBBLAKE_ALIGNED__(32)
uint_least32_t h[8];
uint_least32_t t[2];
uint_least32_t f[2];
};
struct libblake_blake2b_state {
+ LIBBLAKE_ALIGNED__(32)
uint_least64_t h[8];
uint_least64_t t[2];
uint_least64_t f[2];