From: Keith Vetter Date: Fri, 3 Mar 1995 02:20:21 +0000 (+0000) Subject: Added the files and changes needed to create a dll out of libcrypto X-Git-Tag: krb5-1.0-beta5~602 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=02a6367ca07d1d098a67121716cf02dfa0d7a0e2;p=krb5.git Added the files and changes needed to create a dll out of libcrypto git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5068 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/ChangeLog b/src/lib/crypto/ChangeLog index 0c17f78c5..73b1a2925 100644 --- a/src/lib/crypto/ChangeLog +++ b/src/lib/crypto/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 2 17:43:25 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: added rules to make a DLL from a lib. + * win_glue.c, librcrypto.def: needed for making a DLL. + Tue Feb 28 00:15:06 1995 John Gilmore (gnu at toad.com) * cryptoconf.c, des_md5.c: Avoid includes. diff --git a/src/lib/crypto/Makefile.in b/src/lib/crypto/Makefile.in index 66b19507e..fc632bde3 100644 --- a/src/lib/crypto/Makefile.in +++ b/src/lib/crypto/Makefile.in @@ -3,7 +3,7 @@ CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/crc32 -I$(srcdir)/des -I$(srcdir)/md4 \ LDFLAGS = -g ##DOSBUILDTOP = ..\.. -##DOSLIBNAME=libcrypto.$(LIBEXT) +##DOSLIBNAME=crypto.lib ##DOS!include $(BUILDTOP)\config\windows.in TST=if test -n "`cat DONE`" ; then @@ -22,7 +22,18 @@ all:: all-$(WHAT) all-unix:: -all-windows:: $(OBJS) +all-windows:: $(OBJS) win_glue.obj + +win_glue.obj:: win_glue.c + $(CC) $(CFLAGS) /c $*.c + +libcrypto.lib:: libcrypto.dll + implib /nologo $@ $(@R).dll + +libcrypto.dll:: $(LIBNAME) + link /co /noe /nologo win_glue,libcrypto.dll,nul,\ + crypto.lib winsock ldllcew libw,libcrypto.def + rc /p /k $@ libcrypto.a: des/DONE md4/DONE md5/DONE crc32/DONE os/DONE $(OBJS) (cd des; $(TST) $(ARADD) ../$@ `cat DONE` ; fi) @@ -38,10 +49,13 @@ install:: libcrypto.a $(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/libcrypto.a clean:: clean-$(WHAT) - $(RM) libcrypto.$(LIBEXT) libcrypto.bak + $(RM) libcrypto.$(LIBEXT) libcrypto.dll libcrypto.bak clean-unix:: +clean-windows:: + $(RM) crypto.lib crypto.bak + check:: check-$(WHAT) check-unix:: @@ -100,3 +114,6 @@ check-windows:: @echo Making check in ..\os -$(MAKE) -$(MFLAGS) check cd .. + +all-windows:: libcrypto.lib + diff --git a/src/lib/crypto/crc32/ChangeLog b/src/lib/crypto/crc32/ChangeLog index cefe0da64..949a7c66e 100644 --- a/src/lib/crypto/crc32/ChangeLog +++ b/src/lib/crypto/crc32/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 2 17:48:08 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: changed LIBNAME for the PC + * crc.c, crctest.c: added cast on the assignment of bits of + a long into characters. + Mon Feb 20 15:37:10 1995 Keith Vetter (keithv@fusion.com) * crc.c: changed API to INTERFACE diff --git a/src/lib/crypto/crc32/Makefile.in b/src/lib/crypto/crc32/Makefile.in index b8a750c5c..c4e7230bb 100644 --- a/src/lib/crypto/crc32/Makefile.in +++ b/src/lib/crypto/crc32/Makefile.in @@ -1,7 +1,7 @@ CFLAGS = $(CCOPTS) $(DEFS) ##DOSBUILDTOP = ..\..\.. -##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOSLIBNAME=..\crypto.lib ##DOS!include $(BUILDTOP)\config\windows.in OBJS= crc.$(OBJEXT) diff --git a/src/lib/crypto/crc32/crc.c b/src/lib/crypto/crc32/crc.c index 652846b29..6ee533a40 100644 --- a/src/lib/crypto/crc32/crc.c +++ b/src/lib/crypto/crc32/crc.c @@ -161,8 +161,8 @@ krb5_checksum FAR *outcksum; int i; data = (u_char *)in; - for (i=0; i>= 8; c ^= crc_table[idx]; @@ -170,10 +170,10 @@ krb5_checksum FAR *outcksum; /* c now holds the result */ outcksum->checksum_type = CKSUMTYPE_CRC32; outcksum->length = 4; - outcksum->contents[0] = c & 0xff; - outcksum->contents[1] = (c >> 8) & 0xff; - outcksum->contents[2] = (c >> 16) & 0xff; - outcksum->contents[3] = (c >> 24) & 0xff; + outcksum->contents[0] = (krb5_octet) (c & 0xff); + outcksum->contents[1] = (krb5_octet) ((c >> 8) & 0xff); + outcksum->contents[2] = (krb5_octet) ((c >> 16) & 0xff); + outcksum->contents[3] = (krb5_octet) ((c >> 24) & 0xff); return 0; } diff --git a/src/lib/crypto/crc32/crctest.c b/src/lib/crypto/crc32/crctest.c index 7a70a8b82..58388227e 100644 --- a/src/lib/crypto/crc32/crctest.c +++ b/src/lib/crypto/crc32/crctest.c @@ -61,20 +61,20 @@ main() expected_crc); exit(1); } - outbytes[0] = expect & 0xff; - outbytes[1] = (expect >> 8) & 0xff; - outbytes[2] = (expect >> 16) & 0xff; - outbytes[3] = (expect >> 24) & 0xff; + outbytes[0] = (unsigned char) (expect & 0xff); + outbytes[1] = (unsigned char) ((expect >> 8) & 0xff); + outbytes[2] = (unsigned char) ((expect >> 16) & 0xff); + outbytes[3] = (unsigned char) ((expect >> 24) & 0xff); if (sscanf(input, "%lx", &expect) != 1) { fprintf(stderr, "bad expectation '%s', not hex\n", expected_crc); exit(1); } - inbytes[0] = expect & 0xff; - inbytes[1] = (expect >> 8) & 0xff; - inbytes[2] = (expect >> 16) & 0xff; - inbytes[3] = (expect >> 24) & 0xff; + inbytes[0] = (unsigned char) (expect & 0xff); + inbytes[1] = (unsigned char) ((expect >> 8) & 0xff); + inbytes[2] = (unsigned char) ((expect >> 16) & 0xff); + inbytes[3] = (unsigned char) ((expect >> 24) & 0xff); (*crc32_cksumtable_entry.sum_func)((krb5_pointer)inbytes, in_length, 0, 0, &outck); diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 57c8eaab0..049ac7688 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,10 @@ +Thu Mar 2 17:50:39 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: changed LIBNAME for the PC. + * f_tables.h. f_cbc.c: added cast on the assignment of bits of + a long into characters. + * string2k.c: promoted an int into a long. + Thu Mar 2 18:09:28 1995 Theodore Y. Ts'o * Makefile.in (ISODELIB): Remove reference to $(ISODELIB). diff --git a/src/lib/crypto/des/Makefile.in b/src/lib/crypto/des/Makefile.in index 9425744b3..94be80b3d 100644 --- a/src/lib/crypto/des/Makefile.in +++ b/src/lib/crypto/des/Makefile.in @@ -2,7 +2,7 @@ CFLAGS = $(CCOPTS) $(DEFS) LDFLAGS = -g ##DOSBUILDTOP = ..\..\.. -##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOSLIBNAME=..\crypto.lib ##DOS!include $(BUILDTOP)\config\windows.in COMERRLIB=$(BUILDTOP)/util/et/libcom_err.$(LIBEXT) diff --git a/src/lib/crypto/des/f_cbc.c b/src/lib/crypto/des/f_cbc.c index bac00b2d4..f2f78daf7 100644 --- a/src/lib/crypto/des/f_cbc.c +++ b/src/lib/crypto/des/f_cbc.c @@ -189,21 +189,21 @@ mit_des_cbc_encrypt(in, out, length, schedule, ivec, encrypt) op += (int) length; switch(length) { case 8: - *(--op) = right & 0xff; + *(--op) = (unsigned char) (right & 0xff); case 7: - *(--op) = (right >> 8) & 0xff; + *(--op) = (unsigned char) ((right >> 8) & 0xff); case 6: - *(--op) = (right >> 16) & 0xff; + *(--op) = (unsigned char) ((right >> 16) & 0xff); case 5: - *(--op) = (right >> 24) & 0xff; + *(--op) = (unsigned char) ((right >> 24) & 0xff); case 4: - *(--op) = left & 0xff; + *(--op) = (unsigned char) (left & 0xff); case 3: - *(--op) = (left >> 8) & 0xff; + *(--op) = (unsigned char) ((left >> 8) & 0xff); case 2: - *(--op) = (left >> 16) & 0xff; + *(--op) = (unsigned char) ((left >> 16) & 0xff); case 1: - *(--op) = (left >> 24) & 0xff; + *(--op) = (unsigned char) ((left >> 24) & 0xff); break; } break; /* we're done */ diff --git a/src/lib/crypto/des/f_tables.h b/src/lib/crypto/des/f_tables.h index a9c63dcc1..29e186056 100644 --- a/src/lib/crypto/des/f_tables.h +++ b/src/lib/crypto/des/f_tables.h @@ -221,9 +221,9 @@ extern const unsigned KRB_INT32 des_SP_table[8][64]; (lr) |= (unsigned KRB_INT32)(*(ip)++) #define PUT_HALF_BLOCK(lr, op) \ - *(op)++ = ((lr) >> 24) & 0xff; \ - *(op)++ = ((lr) >> 16) & 0xff; \ - *(op)++ = ((lr) >> 8) & 0xff; \ - *(op)++ = (lr) & 0xff + *(op)++ = (unsigned char) (((lr) >> 24) & 0xff); \ + *(op)++ = (unsigned char) (((lr) >> 16) & 0xff); \ + *(op)++ = (unsigned char) (((lr) >> 8) & 0xff); \ + *(op)++ = (unsigned char) ((lr) & 0xff) #endif /* __DES_TABLES_H__ */ diff --git a/src/lib/crypto/des/string2key.c b/src/lib/crypto/des/string2key.c index 4369f1de9..b9dd7115d 100644 --- a/src/lib/crypto/des/string2key.c +++ b/src/lib/crypto/des/string2key.c @@ -51,7 +51,8 @@ const krb5_data FAR * salt; register char *str, *copystr; register krb5_octet *key; - register unsigned temp,i; + register unsigned temp; + register long i; register int j; register long length; unsigned char *k_p; diff --git a/src/lib/crypto/libcrypt.def b/src/lib/crypto/libcrypt.def new file mode 100644 index 000000000..ef3c85aaa --- /dev/null +++ b/src/lib/crypto/libcrypt.def @@ -0,0 +1,52 @@ +;----------------------------- +; CRYPTO.DEF - module definition file +;----------------------------- + +LIBRARY CRYPTO +DESCRIPTION 'DLL for Kerberos cryptography support' +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE SINGLE +HEAPSIZE 8192 + +EXPORTS + WEP @1 RESIDENTNAME + LIBMAIN @2 + CRC32_SUM_FUNC @3 + KRB5_RANDOM_CONFOUNDER @4 + MAKE_KEY_SCHED @5 + MD4_CRYPTO_SUM_FUNC @6 + MD4_SUM_FUNC @7 + MD4FINAL @8 + MD4INIT @9 + MD4UPDATE @10 + MD5_CRYPTO_SUM_FUNC @11 + MD5_SUM_FUNC @12 + MD5FINAL @13 + MD5INIT @14 + MD5UPDATE @15 + MIT_DES_CBC_CHECKSUM @16 + MIT_DES_CBC_CKSUM @17 + MIT_DES_CBC_ENCRYPT @18 + MIT_DES_CHECK_KEY_PARITY @19 + MIT_DES_CRC_DECRYPT_FUNC @20 + MIT_DES_CRC_ENCRYPT_FUNC @21 + MIT_DES_ECB_ENCRYPT @22 + MIT_DES_FINISH_KEY @23 + MIT_DES_FINISH_RANDOM_KEY @24 + MIT_DES_FIXUP_KEY_PARITY @25 + MIT_DES_GENERATE_RANDOM_BLOCK @26 + MIT_DES_INIT_RANDOM_KEY @27 + MIT_DES_INIT_RANDOM_NUMBER_GENERATOR @28 + MIT_DES_IS_WEAK_KEY @29 + MIT_DES_KEY_SCHED @30 + MIT_DES_MD5_DECRYPT_FUNC @31 + MIT_DES_MD5_ENCRYPT_FUNC @32 + MIT_DES_NEW_RANDOM_KEY @33 + MIT_DES_PROCESS_KEY @34 + MIT_DES_RANDOM_KEY @35 + MIT_DES_SET_RANDOM_GENERATOR_SEED @36 + MIT_DES_SET_SEQUENCE_NUMBER @37 + MIT_DES_STRING_TO_KEY @38 + MIT_RAW_DES_DECRYPT_FUNC @39 + MIT_RAW_DES_ENCRYPT_FUNC @40 diff --git a/src/lib/crypto/md4/ChangeLog b/src/lib/crypto/md4/ChangeLog index 907c5c34a..dca4ef84f 100644 --- a/src/lib/crypto/md4/ChangeLog +++ b/src/lib/crypto/md4/ChangeLog @@ -1,3 +1,7 @@ +Thu Mar 2 17:53:35 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: changed LIBNAME for the PC + Tue Feb 28 00:19:06 1995 John Gilmore (gnu at toad.com) * rsa-md4.h: Avoid includes. diff --git a/src/lib/crypto/md4/Makefile.in b/src/lib/crypto/md4/Makefile.in index af6b730bc..6dbe1066b 100644 --- a/src/lib/crypto/md4/Makefile.in +++ b/src/lib/crypto/md4/Makefile.in @@ -3,7 +3,7 @@ CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/../des -I$(srcdir) LDFLAGS = -g ##DOSBUILDTOP = ..\..\.. -##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOSLIBNAME=..\crypto.lib ##DOS!include $(BUILDTOP)\config\windows.in OBJS= md4.$(OBJEXT) md4glue.$(OBJEXT) md4crypto.$(OBJEXT) diff --git a/src/lib/crypto/md5/ChangeLog b/src/lib/crypto/md5/ChangeLog index 35c518e56..3c93d5689 100644 --- a/src/lib/crypto/md5/ChangeLog +++ b/src/lib/crypto/md5/ChangeLog @@ -1,3 +1,7 @@ +Thu Mar 2 17:54:26 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: changed LIBNAME for the PC + Tue Feb 28 00:20:15 1995 John Gilmore (gnu at toad.com) * md5.c, md5crypto.c, md5glue.c, t_mddriver.c: Avoid diff --git a/src/lib/crypto/md5/Makefile.in b/src/lib/crypto/md5/Makefile.in index 259d1fbcd..09a4637b9 100644 --- a/src/lib/crypto/md5/Makefile.in +++ b/src/lib/crypto/md5/Makefile.in @@ -2,7 +2,7 @@ CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/../des LDFLAGS = -g ##DOSBUILDTOP = ..\..\.. -##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOSLIBNAME=..\crypto.lib ##DOS!include $(BUILDTOP)\config\windows.in OBJS= md5.$(OBJEXT) md5glue.$(OBJEXT) md5crypto.$(OBJEXT) diff --git a/src/lib/crypto/os/ChangeLog b/src/lib/crypto/os/ChangeLog index a2e96b464..9848d4be6 100644 --- a/src/lib/crypto/os/ChangeLog +++ b/src/lib/crypto/os/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 2 17:56:48 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: changed LIBNAME for the PC, and brought in ustime + and localaddr from the krb/os directory. + * rnd_conf.c: added cast to the seed assignment. + Mon Feb 20 16:25:36 1995 Keith Vetter (keithv@fusion.com) * Makfile.in: made to work for the PC diff --git a/src/lib/crypto/os/Makefile.in b/src/lib/crypto/os/Makefile.in index 60e9af985..7bf4dd8e8 100644 --- a/src/lib/crypto/os/Makefile.in +++ b/src/lib/crypto/os/Makefile.in @@ -2,7 +2,7 @@ CFLAGS = $(CCOPTS) $(DEFS) LDFLAGS = -g ##DOSBUILDTOP = ..\..\.. -##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOSLIBNAME=..\crypto.lib ##DOS!include $(BUILDTOP)\config\windows.in LIBOBJS = @LIBOBJS@ @@ -15,16 +15,16 @@ all:: all-$(WHAT) all-unix:: $(OBJS) -all-windows: rnd_confoun.obj +all-windows: rnd_confoun.obj localaddr.obj ustime.obj -localaddr.c: ../../krb5/os/localaddr.c - -$(LN) $(srcdir)/../../krb5/os/localaddr.c $@ +localaddr.c: ..$(S)..$(S)krb5$(S)os$(S)localaddr.c + -$(LN) $(srcdir)$(S)..$(S)..$(S)krb5$(S)os$(S)localaddr.c $@ -ustime.c: ../../krb5/os/ustime.c - -$(LN) $(srcdir)/../../krb5/os/ustime.c $@ +ustime.c: ..$(S)..$(S)krb5$(S)os$(S)ustime.c + -$(LN) $(srcdir)$(S)..$(S)..$(S)krb5$(S)os$(S)ustime.c $@ -memmove.c: ../../krb5/posix/memmove.c - -$(LN) $(srcdir)/../../krb5/posix/memmove.c $@ +memmove.c: ..$(S)..$(S)krb5$(S)posix$(S)memmove.c + -$(LN) $(srcdir)$(S)..$(S)..$(S)krb5$(S)posix$(S)memmove.c $@ clean:: $(RM) ustime.c localaddr.c memmove.c diff --git a/src/lib/crypto/os/rnd_confoun.c b/src/lib/crypto/os/rnd_confoun.c index bed3b17ee..7021ec7d5 100644 --- a/src/lib/crypto/os/rnd_confoun.c +++ b/src/lib/crypto/os/rnd_confoun.c @@ -72,7 +72,7 @@ krb5_pointer fillin; if (!seeded) { /* time() defined in 4.12.2.4, but returns a time_t, which is an "arithmetic type" (4.12.1) */ - rval = time(0); + rval = (RAND_TYPE) time(0); SRAND(rval); #ifdef HAVE_GETPID rval = RAND(); diff --git a/src/lib/crypto/win_glue.c b/src/lib/crypto/win_glue.c new file mode 100644 index 000000000..0680f80c3 --- /dev/null +++ b/src/lib/crypto/win_glue.c @@ -0,0 +1,53 @@ +#define NEED_SOCKETS +#include + +/* + * WinSock support. + * + * Do the WinSock initialization call, keeping all the hair here. + * + * This routine is called by SOCKET_INITIALIZE in include/c-windows.h. + * The code is pretty much copied from winsock.txt from winsock-1.1, + * available from: + * ftp://sunsite.unc.edu/pub/micro/pc-stuff/ms-windows/winsock/winsock-1.1 + */ +int +win_socket_initialize() +{ + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = 0x0101; /* We need version 1.1 */ + + err = WSAStartup (wVersionRequested, &wsaData); + if (err != 0) + return err; /* Library couldn't initialize */ + + if (wVersionRequested != wsaData.wVersion) { + /* DLL couldn't support our version of the spec */ + WSACleanup (); + return -104; /* FIXME -- better error? */ + } + + return 0; +} + +BOOL CALLBACK +LibMain(hInst, wDataSeg, cbHeap, CmdLine) + HINSTANCE hInst; + WORD wDataSeg; + WORD cbHeap; + LPSTR CmdLine; +{ + win_socket_initialize (); + return 1; +} + + +int CALLBACK __export +WEP(nParam) + int nParam; +{ + return 1; +}