aboutsummaryrefslogtreecommitdiffstats
path: root/libblake_internal_blake2xb_init0.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-19 22:39:52 +0100
committerMattias Andrée <maandree@kth.se>2022-01-19 22:39:52 +0100
commitcb9fd292424291ef4927f5bceb5910bf52a88a58 (patch)
tree83c6eadf1986d16c87941396accfba360ea4648c /libblake_internal_blake2xb_init0.c
parentAdd todos about more tests being needed (diff)
downloadlibblake-cb9fd292424291ef4927f5bceb5910bf52a88a58.tar.gz
libblake-cb9fd292424291ef4927f5bceb5910bf52a88a58.tar.bz2
libblake-cb9fd292424291ef4927f5bceb5910bf52a88a58.tar.xz
Fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake_internal_blake2xb_init0.c')
-rw-r--r--libblake_internal_blake2xb_init0.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/libblake_internal_blake2xb_init0.c b/libblake_internal_blake2xb_init0.c
index c045cec..7bfabc2 100644
--- a/libblake_internal_blake2xb_init0.c
+++ b/libblake_internal_blake2xb_init0.c
@@ -37,15 +37,22 @@ libblake_internal_blake2xb_init0(struct libblake_blake2xb_state *state, const st
state->b2b.f[0] = 0;
state->b2b.f[1] = 0;
- if (offsetof(struct libblake_blake2xb_params, inner_len) == 17) {
- state->b2b.h[0] ^= le64(((uint_least64_t *)params)[0]);
- state->b2b.h[1] ^= le64(((uint_least64_t *)params)[1]);
+ if (CODE_KILLER(offsetof(struct libblake_blake2xb_params, inner_len) == 17)) {
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wcast-align"
+#endif
+ state->b2b.h[0] ^= le64(((const uint_least64_t *)params)[0]);
+ state->b2b.h[1] ^= le64(((const uint_least64_t *)params)[1]);
state->b2b.h[2] ^= le64(((uint_least64_t)params->node_depth << 0) |
((uint_least64_t)params->inner_len << 8));
- state->b2b.h[4] ^= le64(*(uint_least64_t *)&params->salt[0]);
- state->b2b.h[5] ^= le64(*(uint_least64_t *)&params->salt[8]);
- state->b2b.h[6] ^= le64(*(uint_least64_t *)&params->pepper[0]);
- state->b2b.h[7] ^= le64(*(uint_least64_t *)&params->pepper[8]);
+ state->b2b.h[4] ^= le64(*(const uint_least64_t *)&params->salt[0]);
+ state->b2b.h[5] ^= le64(*(const uint_least64_t *)&params->salt[8]);
+ state->b2b.h[6] ^= le64(*(const uint_least64_t *)&params->pepper[0]);
+ state->b2b.h[7] ^= le64(*(const uint_least64_t *)&params->pepper[8]);
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
} else {
state->b2b.h[0] ^= ((uint_least64_t)params->digest_len & 255) << 0;
state->b2b.h[0] ^= ((uint_least64_t)params->key_len & 255) << 8;