Two changes in the crypto directory: 1) 16 vs 32 bit errors in DES and 2)
authorKeith Vetter <keithv@fusion.com>
Wed, 15 Mar 1995 01:57:23 +0000 (01:57 +0000)
committerKeith Vetter <keithv@fusion.com>
Wed, 15 Mar 1995 01:57:23 +0000 (01:57 +0000)
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

16 files changed:
src/lib/crypto/ChangeLog
src/lib/crypto/Makefile.in
src/lib/crypto/crc32/ChangeLog
src/lib/crypto/crc32/crc.c
src/lib/crypto/des/ChangeLog
src/lib/crypto/des/f_cbc.c
src/lib/crypto/des/f_cksum.c
src/lib/crypto/des/f_pcbc.c
src/lib/crypto/libcrypt.def [deleted file]
src/lib/crypto/md4/ChangeLog
src/lib/crypto/md4/md4crypto.c
src/lib/crypto/md5/ChangeLog
src/lib/crypto/md5/md5crypto.c
src/lib/crypto/os/ChangeLog
src/lib/crypto/os/Makefile.in
src/lib/crypto/win_glue.c [deleted file]

index 14712af9ba3ebc227e2f763fcffad46c604cd5fe..fc069cdb460be484a8f0f0adf89d0228801a47fd 100644 (file)
@@ -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.
index 7f30190a5612d7d69f92c5cb4694782b3619bc58..63968b12fa330830a69db8e3686238d97eb9a73c 100644 (file)
@@ -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
-
index f439d8e5250199285d5f6029d0b52b3e9ec66020..1b8f3eae61799d63e49035934ad63d241fa5cea1 100644 (file)
@@ -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 
index a6966630f8247c75a89de915a0099d1b5a091dc0..cb41e17341231e5291cfba4c518d1b10682840ef 100644 (file)
@@ -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
index 049ac76882f14a78ab09a07e19dc0b86b2e3988b..6a6be5466ec411d78c41f612c13b888ce75dd0ac 100644 (file)
@@ -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.
index f2f78daf73d065d4dc69be88551fc868566bb4a3..b7e4d02310497c5b0d96134bbfbde3ea36668000 100644 (file)
@@ -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;
index aeace4451a668881e0ec4441cba604932da88837..2514a0f9e157a7369dbe567d51e51be9ee231cc1 100644 (file)
@@ -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;
index 511ac379c37dd13be65d8b77a975f9b703a5570a..d547da7da742edba55c0d4666d3ddaebb11bcc2c 100644 (file)
@@ -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 (file)
index ca38a4e..0000000
+++ /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
index 095530c7379ef44284a461221f013f44898c092b..d3b30d1b77acbf4d1583e72c61a9d99c00899d3a 100644 (file)
@@ -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 
index ecc524203b9ec595e57b8d6877632bacd861a0ff..38a3a4a3b41157539875c84e5a2db4c7ba72248b 100644 (file)
@@ -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
index 5b1e7397359be07fc8a4f72dfb04000b5c04bf03..0804d160de5a496f34cc0246942e6203ae9ef4dc 100644 (file)
@@ -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 
index c4276ab75b60dcc67b916ad5c3010a53a4fbb171..bb2fba504015827b10d090987547ecbc722361d3 100644 (file)
@@ -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
index 9848d4be60227ddaf580d995be2c30aa1eac624b..a956697075635e5ea9a6164780ed235be84a2056 100644 (file)
@@ -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
index 7bf4dd8e851d08c4786b346b2dc4b0b6353098ef..4a7fb4f210d1018db22da55936b6afe0e1fd2306 100644 (file)
@@ -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 (file)
index 0680f80..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#define NEED_SOCKETS
-#include <k5-int.h>
-
-/* 
- * 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;
-}