diff options
author | Mattias Andrée <maandree@kth.se> | 2024-09-15 00:37:13 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-09-15 00:37:13 +0200 |
commit | 0ab7b5a1ce4ed6735b40e167f8b05b8bf1fede59 (patch) | |
tree | af2a138767835010d50611790265bbd2bdc2adae /libkeccak_hmac_unmarshal.c | |
parent | m (diff) | |
download | libkeccak-0ab7b5a1ce4ed6735b40e167f8b05b8bf1fede59.tar.gz libkeccak-0ab7b5a1ce4ed6735b40e167f8b05b8bf1fede59.tar.bz2 libkeccak-0ab7b5a1ce4ed6735b40e167f8b05b8bf1fede59.tar.xz |
Split libkeccak.h and fix support for architectures that do not allow misaligned memory
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libkeccak_hmac_unmarshal.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkeccak_hmac_unmarshal.c b/libkeccak_hmac_unmarshal.c index d4fb647..070c7b5 100644 --- a/libkeccak_hmac_unmarshal.c +++ b/libkeccak_hmac_unmarshal.c @@ -28,7 +28,7 @@ libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *restrict state, const void return 0; data += parsed; - size = *(const size_t *)data; + __builtin_memcpy(&size, data, sizeof(size)); data += sizeof(size_t); if (state) size = state->key_length; @@ -44,7 +44,7 @@ libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *restrict state, const void data += size; if (data[0]) { - state->key_ipad = state->key_opad + size; + state->key_ipad = &state->key_opad[size]; memcpy(state->key_ipad, state->key_opad, size); for (i = 0; i < size; i++) state->key_ipad[i] ^= (char)(HMAC_OUTER_PAD ^ HMAC_INNER_PAD); |