Expansions: add ${sha3:<string>} item
[exim.git] / src / src / hash.h
index d3531ccd9251ea438eecda202bd244de3fa6f3a4..9e91f1aad776ad28b80448a0c1a294bf6f6c8c92 100644 (file)
 
 /* Hash context for the exim_sha_* routines */
 
+typedef enum hashmethod {
+  HASH_BADTYPE,
+  HASH_SHA1,
+  HASH_SHA256,
+  HASH_SHA3_224,
+  HASH_SHA3_256,
+  HASH_SHA3_384,
+  HASH_SHA3_512,
+} hashmethod;
+
 typedef struct {
-  int sha1;
-  int hashlen;
+  hashmethod   method;
+  int          hashlen;
 
 #ifdef SHA_OPENSSL
   union {
@@ -50,11 +60,14 @@ typedef struct {
     sha1_context sha1;       /* SHA1 block                                */
     sha2_context sha2;       /* SHA256 block                              */
   } u;
+
+#elif defined(SHA_NATIVE)
+  sha1 sha1;
 #endif
 
 } hctx;
 
-extern void     exim_sha_init(hctx *, BOOL);
+extern void     exim_sha_init(hctx *, hashmethod);
 extern void     exim_sha_update(hctx *, const uschar *a, int);
 extern void     exim_sha_finish(hctx *, blob *);
 extern int      exim_sha_hashlen(hctx *);