build: use pkg-config for i18n
[exim.git] / src / src / hash.h
index 09b65944d393f3ee6e392edc7b539062d41e1058..9ad837b62958f0abc0f2d92d865b8a364e3cd1be 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Exim - an Internet mail transport agent
 /*
  *  Exim - an Internet mail transport agent
- *
- *  Copyright (C) 2016  Exim maintainers
+ *  Copyright (c) The Exim Maintainers 1995 - 2022
+ *  SPDX-License-Identifier: GPL-2.0-or-later
  *
  *  Hash interface functions
  */
  *
  *  Hash interface functions
  */
@@ -12,7 +12,6 @@
 #define HASH_H
 
 #include "sha_ver.h"
 #define HASH_H
 
 #include "sha_ver.h"
-#include "blob.h"
 
 #ifdef SHA_OPENSSL
 # include <openssl/sha.h>
 
 #ifdef SHA_OPENSSL
 # include <openssl/sha.h>
 # include <gnutls/crypto.h>
 #elif defined(SHA_GCRYPT)
 # include <gcrypt.h>
 # include <gnutls/crypto.h>
 #elif defined(SHA_GCRYPT)
 # include <gcrypt.h>
-#elif defined(SHA_POLARSSL)
-# include "pdkim/pdkim.h"              /*XXX ugly */
-# include "pdkim/polarssl/sha1.h"
-# include "pdkim/polarssl/sha2.h"
 #endif
 
 
 #endif
 
 
 
 typedef enum hashmethod {
   HASH_BADTYPE,
 
 typedef enum hashmethod {
   HASH_BADTYPE,
+  HASH_NULL,
   HASH_SHA1,
   HASH_SHA1,
-  HASH_SHA256,
+
+  HASH_SHA2_256,
+  HASH_SHA2_384,
+  HASH_SHA2_512,
+
   HASH_SHA3_224,
   HASH_SHA3_256,
   HASH_SHA3_384,
   HASH_SHA3_224,
   HASH_SHA3_256,
   HASH_SHA3_384,
@@ -46,7 +46,11 @@ typedef struct {
 #ifdef SHA_OPENSSL
   union {
     SHA_CTX      sha1;       /* SHA1 block                                */
 #ifdef SHA_OPENSSL
   union {
     SHA_CTX      sha1;       /* SHA1 block                                */
-    SHA256_CTX   sha2;       /* SHA256 block                              */
+    SHA256_CTX   sha2_256;   /* SHA256 or 224 block                       */
+    SHA512_CTX   sha2_512;   /* SHA512 or 384 block                       */
+#ifdef EXIM_HAVE_SHA3
+    EVP_MD_CTX * mctx;      /* SHA3 block                                */
+#endif
   } u;
 
 #elif defined(SHA_GNUTLS)
   } u;
 
 #elif defined(SHA_GNUTLS)
@@ -55,12 +59,6 @@ typedef struct {
 #elif defined(SHA_GCRYPT)
   gcry_md_hd_t sha;          /* Either SHA1 or SHA256 block               */
 
 #elif defined(SHA_GCRYPT)
   gcry_md_hd_t sha;          /* Either SHA1 or SHA256 block               */
 
-#elif defined(SHA_POLARSSL)
-  union {
-    sha1_context sha1;       /* SHA1 block                                */
-    sha2_context sha2;       /* SHA256 block                              */
-  } u;
-
 #elif defined(SHA_NATIVE)
   sha1 sha1;
 #endif
 #elif defined(SHA_NATIVE)
   sha1 sha1;
 #endif
@@ -69,8 +67,8 @@ typedef struct {
 
 extern BOOL     exim_sha_init(hctx *, hashmethod);
 extern void     exim_sha_update(hctx *, const uschar *a, int);
 
 extern BOOL     exim_sha_init(hctx *, hashmethod);
 extern void     exim_sha_update(hctx *, const uschar *a, int);
+extern void     exim_sha_update_string(hctx *, const uschar *a);
 extern void     exim_sha_finish(hctx *, blob *);
 extern void     exim_sha_finish(hctx *, blob *);
-extern int      exim_sha_hashlen(hctx *);
 
 #endif
 /* End of File */
 
 #endif
 /* End of File */