diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-06-02 16:18:54 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-06-02 23:02:31 +0100 |
commit | 63af6f3a15c5c4779761761bd4d6185e4679eafc (patch) | |
tree | 209a938801467ab4a3a8a80bf5f7b3856473e184 | |
parent | 1a6230a33e235e2b008caabd112f8bc6cb1bcc60 (diff) |
Promote the pdkim variant-implementation sha routines to toplevel
-rw-r--r-- | src/OS/Makefile-Base | 3 | ||||
-rwxr-xr-x | src/scripts/MakeLinks | 13 | ||||
-rw-r--r-- | src/src/blob.h (renamed from src/src/pdkim/blob.h) | 4 | ||||
-rw-r--r-- | src/src/hash.c (renamed from src/src/pdkim/hash.c) | 17 | ||||
-rw-r--r-- | src/src/hash.h (renamed from src/src/pdkim/hash.h) | 46 | ||||
-rw-r--r-- | src/src/pdkim/Makefile | 7 | ||||
-rw-r--r-- | src/src/pdkim/crypt_ver.h | 8 | ||||
-rw-r--r-- | src/src/pdkim/pdkim.h | 4 | ||||
-rw-r--r-- | src/src/pdkim/pdkim_hash.h | 38 | ||||
-rw-r--r-- | src/src/pdkim/rsa.h | 2 | ||||
-rw-r--r-- | src/src/sha_ver.h | 32 |
11 files changed, 105 insertions, 69 deletions
diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base index 3965ba36f..37126869d 100644 --- a/src/OS/Makefile-Base +++ b/src/OS/Makefile-Base @@ -331,7 +331,7 @@ OBJ_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o 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 \ @@ -599,6 +599,7 @@ environment.o: $(HDRS) environment.c 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 diff --git a/src/scripts/MakeLinks b/src/scripts/MakeLinks index 68cecf0a9..7a5649ef8 100755 --- a/src/scripts/MakeLinks +++ b/src/scripts/MakeLinks @@ -95,13 +95,14 @@ cd .. # 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 \ @@ -118,12 +119,6 @@ do 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 diff --git a/src/src/pdkim/blob.h b/src/src/blob.h index e1481c9f4..a3f1e24d4 100644 --- a/src/src/pdkim/blob.h +++ b/src/src/blob.h @@ -1,9 +1,7 @@ /* - * 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 */ diff --git a/src/src/pdkim/hash.c b/src/src/hash.c index 0f7d0f6d4..628df5b4b 100644 --- a/src/src/pdkim/hash.c +++ b/src/src/hash.c @@ -1,21 +1,22 @@ /* - * 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> @@ -27,13 +28,8 @@ # include <gnutls/abstract.h> # endif #endif - -#ifdef SHA_GNUTLS -# include <gnutls/crypto.h> #endif -#include "hash.h" - /******************************************************************************/ #ifdef SHA_OPENSSL @@ -177,5 +173,4 @@ return h->sha1 ? 20 : 32; } -#endif /*DISABLE_DKIM*/ /* End of File */ diff --git a/src/src/pdkim/hash.h b/src/src/hash.h index 52a5507c3..d3531ccd9 100644 --- a/src/src/pdkim/hash.h +++ b/src/src/hash.h @@ -1,43 +1,34 @@ /* - * 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; @@ -63,17 +54,10 @@ typedef struct { } 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 */ diff --git a/src/src/pdkim/Makefile b/src/src/pdkim/Makefile index c72a9426b..61625bd49 100644 --- a/src/src/pdkim/Makefile +++ b/src/src/pdkim/Makefile @@ -1,6 +1,6 @@ # 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 @@ -12,8 +12,7 @@ pdkim.a: $(OBJ) .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 diff --git a/src/src/pdkim/crypt_ver.h b/src/src/pdkim/crypt_ver.h index 0e1db894f..cd2171c82 100644 --- a/src/src/pdkim/crypt_ver.h +++ b/src/src/pdkim/crypt_ver.h @@ -8,6 +8,7 @@ /* RSA and SHA routine selection for PDKIM */ #include "../exim.h" +#include "../sha_ver.h" #ifdef USE_GNUTLS @@ -19,14 +20,7 @@ # 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 diff --git a/src/src/pdkim/pdkim.h b/src/src/pdkim/pdkim.h index 58f9c1353..ba984c1d9 100644 --- a/src/src/pdkim/pdkim.h +++ b/src/src/pdkim/pdkim.h @@ -23,8 +23,8 @@ #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 diff --git a/src/src/pdkim/pdkim_hash.h b/src/src/pdkim/pdkim_hash.h new file mode 100644 index 000000000..143cd19df --- /dev/null +++ b/src/src/pdkim/pdkim_hash.h @@ -0,0 +1,38 @@ +/* + * 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 */ diff --git a/src/src/pdkim/rsa.h b/src/src/pdkim/rsa.h index 32631fdac..6018eba64 100644 --- a/src/src/pdkim/rsa.h +++ b/src/src/pdkim/rsa.h @@ -25,7 +25,7 @@ # include <libtasn1.h> #endif -#include "blob.h" +#include "../blob.h" #ifdef RSA_OPENSSL diff --git a/src/src/sha_ver.h b/src/src/sha_ver.h new file mode 100644 index 000000000..630c78d41 --- /dev/null +++ b/src/src/sha_ver.h @@ -0,0 +1,32 @@ +/************************************************* +* 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 + |