OBJ_EXIM = acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
directory.o dns.o drtables.o enq.o exim.o expand.o filter.o \
- filtertest.o globals.o dkim.o \
+ filtertest.o globals.o dkim.o hash.o \
header.o host.o ip.o log.o lss.o match.o moan.o \
os.o parse.o queue.o \
rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o \
filter.o: $(HDRS) filter.c
filtertest.o: $(HDRS) filtertest.c
globals.o: $(HDRS) globals.c
+hash.o: $(HDRS) sha_ver.h hash.h blob.h hash.c
header.o: $(HDRS) header.c
host.o: $(HDRS) host.c
ip.o: $(HDRS) ip.c
# but local_scan.c does not, because its location is taken from the build-time
# configuration. Likewise for the os.c file, which gets build dynamically.
-for f in dbfunctions.h dbstuff.h exim.h functions.h globals.h local_scan.h \
- macros.h mytypes.h osfunctions.h store.h structs.h lookupapi.h \
+for f in blob.h dbfunctions.h dbstuff.h exim.h functions.h globals.h \
+ hash.h local_scan.h \
+ macros.h mytypes.h osfunctions.h store.h structs.h lookupapi.h sha_ver.h \
\
acl.c buildconfig.c base64.c child.c crypt16.c daemon.c dbfn.c debug.c deliver.c \
directory.c dns.c drtables.c dummies.c enq.c exim.c exim_dbmbuild.c \
exim_dbutil.c exim_lock.c expand.c filter.c filtertest.c globals.c \
- header.c host.c ip.c log.c lss.c match.c moan.c parse.c perl.c queue.c \
+ hash.c header.c host.c ip.c log.c lss.c match.c moan.c parse.c perl.c queue.c \
rda.c readconf.c receive.c retry.c rewrite.c rfc2047.c route.c search.c \
setenv.c environment.c \
sieve.c smtp_in.c smtp_out.c spool_in.c spool_out.c std-crypto.c store.c \
ln -s ../src/$f $f
done
-# WITH_OLD_DEMIME
-for f in demime.c demime.h
-do
- ln -s ../src/$f $f
-done
-
# EXPERIMENTAL_*
for f in bmi_spam.c bmi_spam.h dcc.c dcc.h dane.c dane-gnu.c dane-openssl.c \
danessl.h imap_utf7.c spf.c spf.h srs.c srs.h utf8.c
/*
- * PDKIM - a RFC4871 (DKIM) implementation
+ * Blob - a general pointer/size item for a memory chunk
*
* Copyright (C) 2016 Exim maintainers
- *
- * RSA signing/verification interface
*/
#ifndef BLOB_H /* entire file */
/*
- * PDKIM - a RFC4871 (DKIM) implementation
+ * Exim - an Internet mail transport agent
*
* Copyright (C) 2016 Exim maintainers
*
* Hash interface functions
*/
-#include "../exim.h"
-
-#ifndef DISABLE_DKIM /* entire file */
+#include "exim.h"
#ifndef SUPPORT_TLS
# error Need SUPPORT_TLS for DKIM
#endif
-#include "crypt_ver.h"
+#include "sha_ver.h"
+#include "hash.h"
+
+#ifdef notdef
#ifdef RSA_OPENSSL
# include <openssl/rsa.h>
# include <openssl/ssl.h>
# include <gnutls/abstract.h>
# endif
#endif
-
-#ifdef SHA_GNUTLS
-# include <gnutls/crypto.h>
#endif
-#include "hash.h"
-
/******************************************************************************/
#ifdef SHA_OPENSSL
}
-#endif /*DISABLE_DKIM*/
/* End of File */
/*
- * PDKIM - a RFC4871 (DKIM) implementation
+ * Exim - an Internet mail transport agent
*
* Copyright (C) 2016 Exim maintainers
*
* Hash interface functions
*/
-#include "../exim.h"
+#include "exim.h"
-#if !defined(DISABLE_DKIM) && !defined(PDKIM_HASH_H) /* entire file */
-#define PDKIM_HASH_H
+#if !defined(HASH_H) /* entire file */
+#define HASH_H
-#ifndef SUPPORT_TLS
-# error Need SUPPORT_TLS for DKIM
-#endif
-
-#include "crypt_ver.h"
+#include "sha_ver.h"
#include "blob.h"
-#ifdef RSA_OPENSSL
-# include <openssl/rsa.h>
-# include <openssl/ssl.h>
-# include <openssl/err.h>
-#elif defined(RSA_GNUTLS)
-# include <gnutls/gnutls.h>
-# include <gnutls/x509.h>
-#endif
-
-#ifdef SHA_GNUTLS
+#ifdef SHA_OPENSSL
+# include <openssl/sha.h>
+#elif defined SHA_GNUTLS
# include <gnutls/crypto.h>
#elif defined(SHA_GCRYPT)
# include <gcrypt.h>
#elif defined(SHA_POLARSSL)
-# include "pdkim.h"
-# include "polarssl/sha1.h"
-# include "polarssl/sha2.h"
+# include "pdkim/pdkim.h" /*XXX ugly */
+# include "pdkim/polarssl/sha1.h"
+# include "pdkim/polarssl/sha2.h"
#endif
-/* Hash context */
+
+/* Hash context for the exim_sha_* routines */
+
typedef struct {
int sha1;
int hashlen;
} hctx;
-#if defined(SHA_OPENSSL)
-# include "pdkim.h"
-#elif defined(SHA_GCRYPT)
-# include "pdkim.h"
-#endif
-
-
extern void exim_sha_init(hctx *, BOOL);
extern void exim_sha_update(hctx *, const uschar *a, int);
extern void exim_sha_finish(hctx *, blob *);
extern int exim_sha_hashlen(hctx *);
-#endif /*DISABLE_DKIM*/
+#endif
/* End of File */
# Make file for building the pdkim library.
-OBJ = pdkim.o hash.o rsa.o
+OBJ = pdkim.o rsa.o
pdkim.a: $(OBJ)
@$(RM_COMMAND) -f pdkim.a
.c.o:; @echo "$(CC) $*.c"
$(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -I. $*.c
-pdkim.o: $(HDRS) crypt_ver.h hash.h blob.h pdkim.h pdkim.c
-hash.o: $(HDRS) crypt_ver.h hash.h blob.h pdkim.h hash.c
-rsa.o: $(HDRS) crypt_ver.h rsa.h blob.h rsa.c
+pdkim.o: $(HDRS) ../sha_ver.h crypt_ver.h ../hash.h ../blob.h pdkim.h pdkim.c
+rsa.o: $(HDRS) ../sha_ver.h crypt_ver.h rsa.h ../blob.h rsa.c
# End
/* RSA and SHA routine selection for PDKIM */
#include "../exim.h"
+#include "../sha_ver.h"
#ifdef USE_GNUTLS
# define RSA_GCRYPT
# endif
-# if GNUTLS_VERSION_NUMBER >= 0x020a00
-# define SHA_GNUTLS
-# else
-# define SHA_GCRYPT
-# endif
-
#else
# define RSA_OPENSSL
-# define SHA_OPENSSL
#endif
#ifndef PDKIM_H
#define PDKIM_H
-#include "blob.h"
-#include "hash.h"
+#include "../blob.h"
+#include "../hash.h"
/* -------------------------------------------------------------------------- */
/* Length of the preallocated buffer for the "answer" from the dns/txt
--- /dev/null
+/*
+ * PDKIM - a RFC4871 (DKIM) implementation
+ *
+ * Copyright (C) 2016 Exim maintainers
+ *
+ * Hash interface functions
+ */
+
+#include "../exim.h"
+
+#if !defined(HASH_H) /* entire file */
+#define HASH_H
+
+#ifndef SUPPORT_TLS
+# error Need SUPPORT_TLS for DKIM
+#endif
+
+#include "crypt_ver.h"
+#include "../blob.h"
+#include "../hash.h"
+
+#ifdef RSA_OPENSSL
+# include <openssl/rsa.h>
+# include <openssl/ssl.h>
+# include <openssl/err.h>
+#elif defined(RSA_GNUTLS)
+# include <gnutls/gnutls.h>
+# include <gnutls/x509.h>
+#endif
+
+#if defined(SHA_OPENSSL)
+# include "pdkim.h"
+#elif defined(SHA_GCRYPT)
+# include "pdkim.h"
+#endif
+
+#endif
+/* End of File */
# include <libtasn1.h>
#endif
-#include "blob.h"
+#include "../blob.h"
#ifdef RSA_OPENSSL
--- /dev/null
+/*************************************************
+* Exim - an Internet mail transport agent *
+*************************************************/
+
+/* Copyright (c) Jeremy Harris 2016 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+/* SHA routine selection */
+
+#include "exim.h"
+
+#ifdef SUPPORT_TLS
+
+# define EXIM_HAVE_SHA2
+
+# ifdef USE_GNUTLS
+# include <gnutls/gnutls.h>
+
+# if GNUTLS_VERSION_NUMBER >= 0x020a00
+# define SHA_GNUTLS
+# else
+# define SHA_GCRYPT
+# endif
+
+# else
+# define SHA_OPENSSL
+# endif
+
+#else
+# define SHA_NATIVE
+#endif
+