aboutsummaryrefslogtreecommitdiffstats
path: root/marshal.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-09 21:30:06 +0100
committerMattias Andrée <maandree@kth.se>2019-02-09 21:30:06 +0100
commitae42e15f211feb8625450e5dcc899ae29d885ba7 (patch)
treebddb7469da7d1f32502df31e0d7c0d57aee66fde /marshal.c
parentImprove makefile: mv LIBEXT and LIBFLAGS to config.mk (diff)
downloadlibsha2-ae42e15f211feb8625450e5dcc899ae29d885ba7.tar.gz
libsha2-ae42e15f211feb8625450e5dcc899ae29d885ba7.tar.bz2
libsha2-ae42e15f211feb8625450e5dcc899ae29d885ba7.tar.xz
Fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/marshal.c b/marshal.c
index 21f0f79..8265c38 100644
--- a/marshal.c
+++ b/marshal.c
@@ -24,9 +24,7 @@ libsha2_marshal(const struct libsha2_state *restrict state, char *restrict buf)
*(size_t *)&buf[off] = state->message_size;
off += sizeof(size_t);
- switch (state->algorithm) {
- case LIBSHA2_224:
- case LIBSHA2_256:
+ if (state->algorithm <= LIBSHA2_256) {
if (buf)
memcpy(&buf[off], state->k.b32, sizeof(state->k.b32));
off += sizeof(state->k.b32);
@@ -36,9 +34,7 @@ libsha2_marshal(const struct libsha2_state *restrict state, char *restrict buf)
if (buf)
memcpy(&buf[off], state->h.b32, sizeof(state->h.b32));
off += sizeof(state->h.b32);
- break;
-
- default:
+ } else {
if (buf)
memcpy(&buf[off], state->k.b64, sizeof(state->k.b64));
off += sizeof(state->k.b64);
@@ -48,7 +44,6 @@ libsha2_marshal(const struct libsha2_state *restrict state, char *restrict buf)
if (buf)
memcpy(&buf[off], state->h.b64, sizeof(state->h.b64));
off += sizeof(state->h.b64);
- break;
}
if (buf)