aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-11-05 20:15:56 +0100
committerMattias Andrée <maandree@operamail.com>2014-11-05 20:15:56 +0100
commitdbf07c027699b95984fcdb53808d0f58316f7424 (patch)
tree70592b5d62c9f1796d81f135d2e48cf375aed24e
parentprepare check rule for the test reading the license file (diff)
downloadlibkeccak-dbf07c027699b95984fcdb53808d0f58316f7424.tar.gz
libkeccak-dbf07c027699b95984fcdb53808d0f58316f7424.tar.bz2
libkeccak-dbf07c027699b95984fcdb53808d0f58316f7424.tar.xz
add libkeccak_state_reset
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/libkeccak/state.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libkeccak/state.h b/src/libkeccak/state.h
index 7f4f3b6..e11ac80 100644
--- a/src/libkeccak/state.h
+++ b/src/libkeccak/state.h
@@ -112,6 +112,20 @@ int libkeccak_state_initialise(libkeccak_state_t* restrict state, const libkecca
/**
+ * Reset a state according to hashing specifications
+ *
+ * @param state The state that should be reset
+ * @return Zero on success, -1 on error
+ */
+__attribute__((nonnull, nothrow, unused))
+static inline void libkeccak_state_reset(libkeccak_state_t* restrict state)
+{
+ state->mptr = 0;
+ __builtin_memset(state->S, 0, sizeof(state->S));
+}
+
+
+/**
* Release resources allocation for a state without wiping sensitive data
*
* @param state The state that should be destroyed