diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-21 18:29:26 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-21 18:29:26 +0100 |
commit | 839a3d17d257e73be9bc99dfa90e56c0824050ba (patch) | |
tree | 6bb010351447edbb0ae8d910948b01837d2de9e5 /libblake.h | |
parent | Fix memory corruption bug in test.c and simplify message byte-length calculation (diff) | |
download | libblake-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 '')
-rw-r--r-- | libblake.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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]; |