chiark / gitweb /
hash: Put hash state on the caller's stack
[secnet.git] / secnet.h
index d2575f17ae9a2d71e3fca8b037b75504e1b10760..c6e8f4966164762c4dd3d0a918f5e4c5308cefc8 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -643,11 +643,12 @@ struct dh_if {
 
 /* HASH interface */
 
-typedef void *hash_init_fn(void);
+typedef void hash_init_fn(void *st /* slen bytes alloc'd by caller */);
 typedef void hash_update_fn(void *st, const void *buf, int32_t len);
-typedef void hash_final_fn(void *st, uint8_t *digest);
+typedef void hash_final_fn(void *st, uint8_t *digest /* hlen bytes */);
 struct hash_if {
-    int32_t len; /* Hash output length in bytes */
+    int32_t slen; /* State length in bytes */
+    int32_t hlen; /* Hash output length in bytes */
     hash_init_fn *init;
     hash_update_fn *update;
     hash_final_fn *final;