Ethereal-dev: Re: [Ethereal-dev] libnettle.lib

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gerald Combs <gerald@xxxxxxxxxxxx>
Date: Thu, 21 Oct 2004 16:03:56 -0500
Greg Morris wrote:
> Has anyone built libnettle.lib for win32? Trying to build Ethereal on
> Win32 with nettle support.

Attached is a patch that adds "Makefile.msvc6" and supporting files to
nettle 1.10.  It hasn't been tested extensively.
diff -urN nettle-1.10.orig/Makefile.msvc6 nettle-1.10/Makefile.msvc6
--- nettle-1.10.orig/Makefile.msvc6	1969-12-31 18:00:00.000000000 -0600
+++ nettle-1.10/Makefile.msvc6	2004-10-15 09:46:55.825516200 -0500
@@ -0,0 +1,65 @@
+include <win32.mak>
+
+CC = cl
+LINK = link
+
+CFLAGS=/I. -DUNUSED=""
+
+libnettle_SRC = aes.c \
+		      aes-decrypt-table.c aes-decrypt.c \
+		      aes-encrypt-table.c aes-encrypt.c \
+		      aes-set-encrypt-key.c aes-set-decrypt-key.c aes-meta.c \
+		      arcfour.c arcfour-crypt.c arcfour-meta.c \
+		      base16-encode.c base16-decode.c base16-meta.c \
+                      base64-encode.c base64-decode.c base64-meta.c\
+		      cast128.c cast128-meta.c \
+		      blowfish.c \
+		      cbc.c \
+		      des.c \
+		      des3.c des-compat.c \
+		      hmac.c hmac-md5.c hmac-sha1.c hmac-sha256.c \
+		      knuth-lfib.c \
+		      md2.c md2-meta.c md4.c md4-meta.c \
+		      md5.c md5-compat.c md5-meta.c \
+		      sha1.c sha1-compress.c sha1-meta.c sha256.c sha256-meta.c \
+		      serpent.c serpent-meta.c \
+		      twofish.c twofish-meta.c \
+		      yarrow256.c yarrow_key_event.c \
+		      sexp.c sexp-format.c \
+		      sexp-transport.c sexp-transport-format.c \
+		      bignum.c bignum-random.c sexp2bignum.c \
+		      pkcs1.c pkcs1-rsa-md5.c pkcs1-rsa-sha1.c \
+		      rsa.c rsa-sign.c rsa-verify.c \
+		      rsa-md5-sign.c rsa-md5-verify.c \
+		      rsa-sha1-sign.c rsa-sha1-verify.c \
+		      rsa-encrypt.c rsa-decrypt.c \
+		      rsa-keygen.c rsa-compat.c \
+		      rsa2sexp.c sexp2rsa.c \
+		      dsa.c dsa-sign.c dsa-verify.c dsa-keygen.c \
+		      sexp2dsa.c \
+		      pgp-encode.c rsa2openpgp.c \
+		      buffer.c buffer-init.c realloc.c \
+		      memxor.c \
+		      nettle-internal.c
+
+libnettle_OBJECTS = $(libnettle_SRC:.c=.obj)
+
+.c.obj::
+	$(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
+
+
+all: libnettle.lib
+
+libnettle.lib    : config.h nettle-types.h $(libnettle_OBJECTS)
+	link /lib /out:libnettle.lib $(libnettle_OBJECTS)
+
+config.h: config.h.win32
+	cp config.h.win32 config.h
+
+nettle-types.h: nettle-types.h.win32
+	cp nettle-types.h.win32 nettle-types.h
+
+clean:
+	rm -rf *.lib *.obj config.h nettle-types.h
+
+des.o: des.c des.h $(des_headers)
diff -urN nettle-1.10.orig/README.ethereal nettle-1.10/README.ethereal
--- nettle-1.10.orig/README.ethereal	1969-12-31 18:00:00.000000000 -0600
+++ nettle-1.10/README.ethereal	2004-10-14 10:54:09.750879400 -0500
@@ -0,0 +1,8 @@
+The contents of this archive are identical to libnettle v1.10, available
+at http://www.lysator.liu.se/~nisse/nettle/, except for the following:
+
+- This README has been added.
+
+- Makefile.msvc, config.h.win32, and nettle-types.h have been added.
+
+- The library has been compiled with MSVC++ 6.0 using Makefile.msvc.
diff -urN nettle-1.10.orig/config.h.win32 nettle-1.10/config.h.win32
--- nettle-1.10.orig/config.h.win32	1969-12-31 18:00:00.000000000 -0600
+++ nettle-1.10/config.h.win32	2004-10-14 10:08:37.123303600 -0500
@@ -0,0 +1,169 @@
+/* config.h.win32.  Generated manually. */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+/* #undef HAVE_ALLOCA */
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define if the compiler understands __attribute__ */
+/* #undef HAVE_GCC_ATTRIBUTE */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define if you have openssl's libcrypto (used for benchmarking) */
+/* #undef HAVE_LIBCRYPTO */
+
+/* Define to 1 if you have the `gmp' library (-lgmp). */
+/* #undef HAVE_LIBGMP */
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memxor' function. */
+/* #undef HAVE_MEMXOR */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Name of package */
+#define PACKAGE "nettle"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "nettle"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "nettle 1.10"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "nettle"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.10"
+
+/* The size of a `char', as computed by sizeof. */
+#define SIZEOF_CHAR 1
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of a `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* The size of a `void*', as computed by sizeof. */
+#define SIZEOF_VOIDP 4
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+/* #undef TIME_WITH_SYS_TIME */
+
+/* Version number of package */
+#define VERSION "1.10"
+
+/* Define to enable public key features */
+/* #undef WITH_PUBLIC_KEY */
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define gid_t int
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#define size_t unsigned
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define uid_t int
+
+/* AIX requires this to be the first thing in the file.  */
+#ifndef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#else /* defined __GNUC__ */
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# endif
+#endif
+/* Needed for alloca on windows */
+#if HAVE_MALLOC_H
+# include <malloc.h>
+#endif
+
+
+#if __GNUC__ && HAVE_GCC_ATTRIBUTE
+# define NORETURN __attribute__ ((__noreturn__))
+# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a)))
+# define UNUSED __attribute__ ((__unused__))
+#else
+# define NORETURN
+# define PRINTF_STYLE(f, a)
+# define UNUSED
+#endif
+
diff -urN nettle-1.10.orig/nettle-types.h.win32 nettle-1.10/nettle-types.h.win32
--- nettle-1.10.orig/nettle-types.h.win32	1969-12-31 18:00:00.000000000 -0600
+++ nettle-1.10/nettle-types.h.win32	2004-10-15 09:46:06.474766100 -0500
@@ -0,0 +1,24 @@
+#ifndef _NETTLE_NETTLE_TYPES_H
+#define _NETTLE_NETTLE_TYPES_H 1
+
+#ifndef _GENERATED_STDINT_H
+#define _GENERATED_STDINT_H "nettle 1.10"
+/* generated by hand from an auto-generated nettle-types.h on Linux */
+#define _STDINT_HAVE_STDINT_H 1
+#endif
+
+#include <stddef.h>
+
+typedef unsigned char   uint8_t;
+typedef unsigned short  uint16_t;
+typedef unsigned int    uint32_t;
+
+typedef          char    int8_t;
+typedef          short   int16_t;
+typedef          int     int32_t;
+
+#define _HAVE_UINT64_T
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+#endif /* _NETTLE_NETTLE_TYPES_H */