From: Ian Jackson Date: Thu, 13 Feb 2020 16:55:51 +0000 (+0000) Subject: sha1: Provide sha1_hash_if X-Git-Tag: v0.6.0~14 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=1ec6890c3ada332d82a33492beb36df5748c1824;hp=686e21aa2afbd14c3e59962f02a31c4dcd62e5d8;p=secnet.git sha1: Provide sha1_hash_if This will be useful in a moment. As a side effect, the sha1 st is statically allocated now. Signed-off-by: Ian Jackson --- diff --git a/secnet.h b/secnet.h index 5c351af..ffe8360 100644 --- a/secnet.h +++ b/secnet.h @@ -786,6 +786,8 @@ struct hash_if { hash_final_fn *final; }; +extern struct hash_if *const sha1_hash_if; /* for where this is hardcoded */ + /* BUFFER interface */ struct buffer_if { diff --git a/sha1.c b/sha1.c index f442e08..a78345a 100644 --- a/sha1.c +++ b/sha1.c @@ -314,9 +314,11 @@ struct sha1 { struct hash_if ops; }; +static struct sha1 st[1]; +struct hash_if *const sha1_hash_if = &st->ops; + void sha1_module(dict_t *dict) { - struct sha1 *st; cstring_t testinput="abcdbcdecdefdefgefghfghigh" "ijhijkijkljklmklmnlmnomnopnopq"; uint8_t expected[20]= @@ -328,7 +330,6 @@ void sha1_module(dict_t *dict) uint8_t digest[20]; int i; - NEW(st); st->cl.description="sha1"; st->cl.type=CL_HASH; st->cl.apply=NULL;