From 26bcae14eec6b4392500ecb144e345b2948ef544 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Wed, 15 Mar 1995 01:57:23 +0000 Subject: [PATCH] Two changes in the crypto directory: 1) 16 vs 32 bit errors in DES and 2) removed crud for making a DLL (will be done at a higher level.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5123 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/ChangeLog | 5 ++++ src/lib/crypto/Makefile.in | 21 ++++--------- src/lib/crypto/crc32/ChangeLog | 5 ++++ src/lib/crypto/crc32/crc.c | 16 ++-------- src/lib/crypto/des/ChangeLog | 5 ++++ src/lib/crypto/des/f_cbc.c | 30 +++++++++---------- src/lib/crypto/des/f_cksum.c | 30 +++++++++---------- src/lib/crypto/des/f_pcbc.c | 32 ++++++++++---------- src/lib/crypto/libcrypt.def | 55 ---------------------------------- src/lib/crypto/md4/ChangeLog | 5 ++++ src/lib/crypto/md4/md4crypto.c | 12 -------- src/lib/crypto/md5/ChangeLog | 5 ++++ src/lib/crypto/md5/md5crypto.c | 12 -------- src/lib/crypto/os/ChangeLog | 5 ++++ src/lib/crypto/os/Makefile.in | 4 +-- src/lib/crypto/win_glue.c | 53 -------------------------------- 16 files changed, 85 insertions(+), 210 deletions(-) delete mode 100644 src/lib/crypto/libcrypt.def delete mode 100644 src/lib/crypto/win_glue.c diff --git a/src/lib/crypto/ChangeLog b/src/lib/crypto/ChangeLog index 14712af9b..fc069cdb4 100644 --- a/src/lib/crypto/ChangeLog +++ b/src/lib/crypto/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 14 17:31:01 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: removed all DLL stuff--it now happens up a directory. + * win_glue.c, libcrypto.def: removed + Tue Mar 7 17:26:06 1995 Keith Vetter (keithv@fusion.com) * cryptoco.c: Added more windows syntactic sugar for segmenting. diff --git a/src/lib/crypto/Makefile.in b/src/lib/crypto/Makefile.in index 7f30190a5..63968b12f 100644 --- a/src/lib/crypto/Makefile.in +++ b/src/lib/crypto/Makefile.in @@ -22,18 +22,7 @@ all:: all-$(WHAT) all-unix:: -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) libcrypto.def - link /co /noe /nologo win_glue,libcrypto.dll,nul,\ - crypto.lib winsock ldllcew libw,libcrypto.def - rc /p /k $@ +all-windows:: $(OBJS) libcrypto.a: des/DONE md4/DONE md5/DONE crc32/DONE os/DONE $(OBJS) (cd des; $(TST) $(ARADD) ../$@ `cat DONE` ; fi) @@ -44,14 +33,17 @@ libcrypto.a: des/DONE md4/DONE md5/DONE crc32/DONE os/DONE $(OBJS) $(ARADD) $@ $(OBJS) $(RANLIB) $@ +libcrypto.lib: + libdir crypto.lib + install:: libcrypto.a $(INSTALL_DATA) libcrypto.a $(DESTDIR)$(KRB5_LIBDIR)/libcrypto.a $(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/libcrypto.a clean:: clean-$(WHAT) - $(RM) libcrypto.$(LIBEXT) libcrypto.dll libcrypto.bak clean-unix:: + $(RM) libcrypto.a clean-windows:: $(RM) crypto.lib crypto.bak @@ -114,6 +106,3 @@ 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 f439d8e52..1b8f3eae6 100644 --- a/src/lib/crypto/crc32/ChangeLog +++ b/src/lib/crypto/crc32/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 14 17:20:47 1995 Keith Vetter (keithv@fusion.com) + + * crc.c: removed method for pulling in a data structure (windows), + and turned an int into a size_t for corrected 'signed'ness. + Fri Mar 3 19:01:59 1995 Keith Vetter (keithv@fusion.com) * crc.c: added a method to pull in a data structure diff --git a/src/lib/crypto/crc32/crc.c b/src/lib/crypto/crc32/crc.c index a6966630f..cb41e1734 100644 --- a/src/lib/crypto/crc32/crc.c +++ b/src/lib/crypto/crc32/crc.c @@ -158,10 +158,10 @@ krb5_checksum FAR *outcksum; register u_char *data; register u_long c = 0; register int idx; - int i; + size_t i; data = (u_char *)in; - for (i=0; i < (int) in_length;i++) { + for (i = 0; i < in_length; i++) { idx = (int) (data[i] ^ c); idx &= 0xff; c >>= 8; @@ -185,15 +185,3 @@ krb5_checksum_entry crc32_cksumtable_entry = { 0, /* not collision proof */ 0, /* doesn't use key */ }; - -#if defined(_WINDOWS) -/* -** Windows can't pull in data from a DLL library. So we must provide a -** method to do so. If the crypto library is merged in with the other -** libraries, and this never gets called by an end-user, then we -** can get rid of this. -*/ -krb5_checksum_entry * INTERFACE load_crc32_cksumtable_entry (void) { - return &crc32_cksumtable_entry; -} -#endif diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 049ac7688..6a6be5466 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 14 17:28:35 1995 Keith Vetter (keithv@fusion.com) + + * f_cbc.c, f_cksum.c, f_pcbc.c: added casts so that chars get promoted + to longs instead of ints when doing 32 bit bit manipulations. + Thu Mar 2 17:50:39 1995 Keith Vetter (keithv@fusion.com) * Makefile.in: changed LIBNAME for the PC. diff --git a/src/lib/crypto/des/f_cbc.c b/src/lib/crypto/des/f_cbc.c index f2f78daf7..b7e4d0231 100644 --- a/src/lib/crypto/des/f_cbc.c +++ b/src/lib/crypto/des/f_cbc.c @@ -80,14 +80,14 @@ mit_des_cbc_encrypt(in, out, length, schedule, ivec, encrypt) * forward. Otherwise we have to fart around. */ if (length >= 8) { - left ^= ((*ip++) & 0xff) << 24; - left ^= ((*ip++) & 0xff) << 16; - left ^= ((*ip++) & 0xff) << 8; - left ^= (*ip++) & 0xff; - right ^= ((*ip++) & 0xff) << 24; - right ^= ((*ip++) & 0xff) << 16; - right ^= ((*ip++) & 0xff) << 8; - right ^= (*ip++) & 0xff; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 24; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 16; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 8; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)); + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 24; + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 16; + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 8; + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)); length -= 8; } else { /* @@ -98,19 +98,19 @@ mit_des_cbc_encrypt(in, out, length, schedule, ivec, encrypt) ip += (int) length; switch(length) { case 7: - right ^= (*(--ip) & 0xff) << 8; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 8; case 6: - right ^= (*(--ip) & 0xff) << 16; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 16; case 5: - right ^= (*(--ip) & 0xff) << 24; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 24; case 4: - left ^= *(--ip) & 0xff; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)); case 3: - left ^= (*(--ip) & 0xff) << 8; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 8; case 2: - left ^= (*(--ip) & 0xff) << 16; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 16; case 1: - left ^= (*(--ip) & 0xff) << 24; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 24; break; } length = 0; diff --git a/src/lib/crypto/des/f_cksum.c b/src/lib/crypto/des/f_cksum.c index aeace4451..2514a0f9e 100644 --- a/src/lib/crypto/des/f_cksum.c +++ b/src/lib/crypto/des/f_cksum.c @@ -63,14 +63,14 @@ mit_des_cbc_cksum(in, out, length, schedule, ivec) * forward. Otherwise we have to fart around. */ if (len >= 8) { - left ^= ((*ip++) & 0xff) << 24; - left ^= ((*ip++) & 0xff) << 16; - left ^= ((*ip++) & 0xff) << 8; - left ^= (*ip++) & 0xff; - right ^= ((*ip++) & 0xff) << 24; - right ^= ((*ip++) & 0xff) << 16; - right ^= ((*ip++) & 0xff) << 8; - right ^= (*ip++) & 0xff; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 24; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 16; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 8; + left ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)); + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 24; + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 16; + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)) << 8; + right ^= ((unsigned KRB_INT32) ((*ip++) & 0xff)); len -= 8; } else { /* @@ -81,19 +81,19 @@ mit_des_cbc_cksum(in, out, length, schedule, ivec) ip += (int) len; switch(len) { case 7: - right ^= (*(--ip) & 0xff) << 8; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 8; case 6: - right ^= (*(--ip) & 0xff) << 16; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 16; case 5: - right ^= (*(--ip) & 0xff) << 24; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 24; case 4: - left ^= *(--ip) & 0xff; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)); case 3: - left ^= (*(--ip) & 0xff) << 8; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 8; case 2: - left ^= (*(--ip) & 0xff) << 16; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 16; case 1: - left ^= (*(--ip) & 0xff) << 24; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 24; break; } len = 0; diff --git a/src/lib/crypto/des/f_pcbc.c b/src/lib/crypto/des/f_pcbc.c index 511ac379c..d547da7da 100644 --- a/src/lib/crypto/des/f_pcbc.c +++ b/src/lib/crypto/des/f_pcbc.c @@ -79,21 +79,21 @@ mit_des_pcbc_encrypt(in, out, length, schedule, ivec, encrypt) ip += (int) length; switch(length) { case 8: - right ^= *(--ip) & 0xff; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)); case 7: - right ^= (*(--ip) & 0xff) << 8; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 8; case 6: - right ^= (*(--ip) & 0xff) << 16; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 16; case 5: - right ^= (*(--ip) & 0xff) << 24; + right ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 24; case 4: - left ^= *(--ip) & 0xff; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)); case 3: - left ^= (*(--ip) & 0xff) << 8; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 8; case 2: - left ^= (*(--ip) & 0xff) << 16; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 16; case 1: - left ^= (*(--ip) & 0xff) << 24; + left ^= ((unsigned KRB_INT32) (*(--ip) & 0xff)) << 24; break; } length = 0; @@ -178,21 +178,21 @@ mit_des_pcbc_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/libcrypt.def b/src/lib/crypto/libcrypt.def deleted file mode 100644 index ca38a4eaa..000000000 --- a/src/lib/crypto/libcrypt.def +++ /dev/null @@ -1,55 +0,0 @@ -;----------------------------- -; LIBCRYPTO.DEF - module definition file -;----------------------------- - -LIBRARY LIBCRYPT -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 - LOAD_CRC32_CKSUMTABLE_ENTRY @41 - LOAD_RSA_MD4_DES_CKSUMTABLE_ENTRY @42 - LOAD_RSA_MD5_DES_CKSUMTABLE_ENTRY @43 diff --git a/src/lib/crypto/md4/ChangeLog b/src/lib/crypto/md4/ChangeLog index 095530c73..d3b30d1b7 100644 --- a/src/lib/crypto/md4/ChangeLog +++ b/src/lib/crypto/md4/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 14 17:24:57 1995 Keith Vetter (keithv@fusion.com) + + * md4crypto.c: removed method for DLL data since everything's + going into one DLL. + Fri Mar 3 19:01:59 1995 Keith Vetter (keithv@fusion.com) * md4crypto.c: added a method to pull in a data structure diff --git a/src/lib/crypto/md4/md4crypto.c b/src/lib/crypto/md4/md4crypto.c index ecc524203..38a3a4a3b 100644 --- a/src/lib/crypto/md4/md4crypto.c +++ b/src/lib/crypto/md4/md4crypto.c @@ -87,15 +87,3 @@ krb5_checksum_entry rsa_md4_des_cksumtable_entry = { 1, /* is collision proof */ 1, /* uses key */ }; - -#if defined(_WINDOWS) -/* -** Windows can't pull in data from a DLL library. So we must provide a -** method to do so. If the crypto library is merged in with the other -** libraries, and this never gets called by an end-user, then we -** can get rid of this. -*/ -krb5_checksum_entry * INTERFACE load_rsa_md4_des_cksumtable_entry (void) { - return &rsa_md4_des_cksumtable_entry; -} -#endif diff --git a/src/lib/crypto/md5/ChangeLog b/src/lib/crypto/md5/ChangeLog index 5b1e73973..0804d160d 100644 --- a/src/lib/crypto/md5/ChangeLog +++ b/src/lib/crypto/md5/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 14 17:24:57 1995 Keith Vetter (keithv@fusion.com) + + * md5crypto.c: removed method for DLL data since everything's + going into one DLL. + Fri Mar 3 19:01:59 1995 Keith Vetter (keithv@fusion.com) * md5crypto.c: added a method to pull in a data structure diff --git a/src/lib/crypto/md5/md5crypto.c b/src/lib/crypto/md5/md5crypto.c index c4276ab75..bb2fba504 100644 --- a/src/lib/crypto/md5/md5crypto.c +++ b/src/lib/crypto/md5/md5crypto.c @@ -61,15 +61,3 @@ krb5_checksum_entry rsa_md5_des_cksumtable_entry = { 1, /* is collision proof */ 1, /* uses key */ }; - -#if defined(_WINDOWS) -/* -** Windows can't pull in data from a DLL library. So we must provide a -** method to do so. If the crypto library is merged in with the other -** libraries, and this never gets called by an end-user, then we -** can get rid of this. -*/ -krb5_checksum_entry * INTERFACE load_rsa_md5_des_cksumtable_entry (void) { - return &rsa_md5_des_cksumtable_entry; -} -#endif diff --git a/src/lib/crypto/os/ChangeLog b/src/lib/crypto/os/ChangeLog index 9848d4be6..a95669707 100644 --- a/src/lib/crypto/os/ChangeLog +++ b/src/lib/crypto/os/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 14 17:23:02 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: no longer need to bring in ustime and localaddr for + windows since everything's going into one DLL in the end. + Thu Mar 2 17:56:48 1995 Keith Vetter (keithv@fusion.com) * Makefile.in: changed LIBNAME for the PC, and brought in ustime diff --git a/src/lib/crypto/os/Makefile.in b/src/lib/crypto/os/Makefile.in index 7bf4dd8e8..4a7fb4f21 100644 --- a/src/lib/crypto/os/Makefile.in +++ b/src/lib/crypto/os/Makefile.in @@ -9,13 +9,13 @@ LIBOBJS = @LIBOBJS@ OBJS= rnd_confoun.$(OBJEXT) localaddr.$(OBJEXT) ustime.$(OBJEXT) $(LIBOBJS) -SRCS= rnd_confoun.c localaddr.c ustime.c +SRCS= rnd_confoun.c all:: all-$(WHAT) all-unix:: $(OBJS) -all-windows: rnd_confoun.obj localaddr.obj ustime.obj +all-windows: rnd_confoun.obj localaddr.c: ..$(S)..$(S)krb5$(S)os$(S)localaddr.c -$(LN) $(srcdir)$(S)..$(S)..$(S)krb5$(S)os$(S)localaddr.c $@ diff --git a/src/lib/crypto/win_glue.c b/src/lib/crypto/win_glue.c deleted file mode 100644 index 0680f80c3..000000000 --- a/src/lib/crypto/win_glue.c +++ /dev/null @@ -1,53 +0,0 @@ -#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; -} -- 2.26.2