2 * Exim - an Internet mail transport agent
4 * Copyright (C) 2016 Exim maintainers
6 * Hash interface functions
11 #if !defined(HASH_H) /* entire file */
18 # include <openssl/sha.h>
19 #elif defined SHA_GNUTLS
20 # include <gnutls/crypto.h>
21 #elif defined(SHA_GCRYPT)
23 #elif defined(SHA_POLARSSL)
24 # include "pdkim/pdkim.h" /*XXX ugly */
25 # include "pdkim/polarssl/sha1.h"
26 # include "pdkim/polarssl/sha2.h"
30 /* Hash context for the exim_sha_* routines */
32 typedef enum hashmethod {
48 SHA_CTX sha1; /* SHA1 block */
49 SHA256_CTX sha2; /* SHA256 block */
52 #elif defined(SHA_GNUTLS)
53 gnutls_hash_hd_t sha; /* Either SHA1 or SHA256 block */
55 #elif defined(SHA_GCRYPT)
56 gcry_md_hd_t sha; /* Either SHA1 or SHA256 block */
58 #elif defined(SHA_POLARSSL)
60 sha1_context sha1; /* SHA1 block */
61 sha2_context sha2; /* SHA256 block */
64 #elif defined(SHA_NATIVE)
70 extern BOOL exim_sha_init(hctx *, hashmethod);
71 extern void exim_sha_update(hctx *, const uschar *a, int);
72 extern void exim_sha_finish(hctx *, blob *);
73 extern int exim_sha_hashlen(hctx *);