aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-14 09:48:34 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-14 09:48:34 +0200
commite1c3f8bc91d21b98369cfecdc503928860f8cb77 (patch)
tree020a4cbc61e56810863e38dd20b9b2b07df86ab7
parentadd libsha2_sum_fd (diff)
downloadlibsha2-e1c3f8bc91d21b98369cfecdc503928860f8cb77.tar.gz
libsha2-e1c3f8bc91d21b98369cfecdc503928860f8cb77.tar.bz2
libsha2-e1c3f8bc91d21b98369cfecdc503928860f8cb77.tar.xz
mashalling state
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libsha2/state.c1
-rw-r--r--src/libsha2/state.h12
2 files changed, 13 insertions, 0 deletions
diff --git a/src/libsha2/state.c b/src/libsha2/state.c
index e907cec..fb6b4fc 100644
--- a/src/libsha2/state.c
+++ b/src/libsha2/state.c
@@ -79,6 +79,7 @@ int libsha2_state_initialise(libsha2_state_t* restrict state, libsha2_algorithm_
size_t i;
+ memset(state, 0, sizeof(*state));
state->message_size = 0;
state->algorithm = algorithm;
diff --git a/src/libsha2/state.h b/src/libsha2/state.h
index 1dfd4be..1ac2667 100644
--- a/src/libsha2/state.h
+++ b/src/libsha2/state.h
@@ -71,6 +71,12 @@ typedef enum libsha2_algorithm
* exposing two versions of each function: one to wipe data,
* and one not to wipe data to gain speed, now you can use use
* `explicit_bzero` (or `memset`) when you are done.
+ *
+ * This datastructure is flat (it contains dynamic pointers)
+ * and can be marshalled and unmarshalled naïvely, and does
+ * not need destroyed; however, if you when to marshall it
+ * using as little memory as possible, this are comments
+ * about data that does not need to be mashalled
*/
typedef struct libsha2_state
{
@@ -98,6 +104,8 @@ typedef struct libsha2_state
/**
* Words
+ *
+ * Does not need to be marshalled
*/
union
{
@@ -132,6 +140,8 @@ typedef struct libsha2_state
/**
* Temporary hashing values
+ *
+ * Does not need to be marshalled
*/
union
{
@@ -156,6 +166,8 @@ typedef struct libsha2_state
/**
* Space for storing the last bits and
* the padding
+ *
+ * Does not need to be marshalled
*/
char appendix[256];