From aac4294b6a09d05e4c9a5b0e0de1929c45e30010 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Tue, 21 Feb 1995 02:11:06 +0000 Subject: [PATCH] Made the CRYPTO directories work on the PC by adding INTERFACE to all the functions and prototypes, and updating the Makefile.in. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4956 dc483132-0cff-0310-8789-dd5450dbe970 --- src/config/ChangeLog | 4 ++ src/config/windows.in | 5 +- src/include/krb5/ChangeLog | 6 +++ src/include/krb5/Makefile.in | 2 - src/include/krb5/encryption.h | 21 ++++---- src/include/krb5/los-proto.h | 2 +- src/include/krb5/rsa-md5.h | 12 ++--- src/include/krb5/stock/ChangeLog | 6 +++ src/include/krb5/stock/config.h | 2 +- src/include/krb5/stock/config.win | 7 ++- src/lib/crypto/Makefile.in | 83 ++++++++++++++++++++++++++++--- src/lib/crypto/crc32/ChangeLog | 4 ++ src/lib/crypto/crc32/crc.c | 4 +- src/lib/crypto/des/ChangeLog | 9 ++++ src/lib/crypto/des/Makefile.in | 58 +++++++++++---------- src/lib/crypto/des/cbc_cksum.c | 5 +- src/lib/crypto/des/cs_entry.c | 5 +- src/lib/crypto/des/des_int.h | 49 ++++++++++-------- src/lib/crypto/des/f_cbc.c | 2 +- src/lib/crypto/des/f_cksum.c | 2 +- src/lib/crypto/des/f_ecb.c | 2 +- src/lib/crypto/des/f_parity.c | 4 +- src/lib/crypto/des/f_pcbc.c | 2 +- src/lib/crypto/des/f_sched.c | 2 +- src/lib/crypto/des/fin_rndkey.c | 2 +- src/lib/crypto/des/finish_key.c | 5 +- src/lib/crypto/des/init_rkey.c | 3 +- src/lib/crypto/des/key_sched.c | 5 +- src/lib/crypto/des/new_rn_key.c | 12 +++-- src/lib/crypto/des/process_ky.c | 3 +- src/lib/crypto/des/random_key.c | 3 +- src/lib/crypto/des/string2key.c | 15 +++--- src/lib/crypto/des/weak_key.c | 2 +- src/lib/crypto/des_crc.c | 12 ++--- src/lib/crypto/des_md5.c | 10 ++-- src/lib/crypto/md4/ChangeLog | 9 +++- src/lib/crypto/md4/Makefile.in | 25 +++++++--- src/lib/crypto/md4/md4.c | 23 +++++---- src/lib/crypto/md4/md4crypto.c | 12 +++-- src/lib/crypto/md4/md4glue.c | 8 ++- src/lib/crypto/md4/rsa-md4.h | 12 ++--- src/lib/crypto/md5/ChangeLog | 5 ++ src/lib/crypto/md5/Makefile.in | 24 ++++++--- src/lib/crypto/md5/md5.c | 23 +++++---- src/lib/crypto/md5/md5crypto.c | 12 +++-- src/lib/crypto/md5/md5glue.c | 8 ++- src/lib/crypto/os/ChangeLog | 5 ++ src/lib/crypto/os/Makefile.in | 12 +++-- src/lib/crypto/os/rnd_confoun.c | 2 +- src/lib/crypto/raw_des.c | 10 ++-- 50 files changed, 376 insertions(+), 184 deletions(-) diff --git a/src/config/ChangeLog b/src/config/ChangeLog index b0662ed7a..79406c93c 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -1,3 +1,7 @@ +Mon Feb 20 15:48:16 1995 Keith Vetter (keithv@fusion.com) + + * windows.in: changed API to INTERFACE + Mon Feb 6 19:33:57 1995 Keith Vetter (keithv@fusion.com) * pre.in: Added macros for directory syntax, filename extensions diff --git a/src/config/windows.in b/src/config/windows.in index 959efa93a..505245902 100644 --- a/src/config/windows.in +++ b/src/config/windows.in @@ -14,8 +14,8 @@ srcdir = . # /* The name of the C compiler for the target */ CC=cl /nologo CL= -CCOPTS=/ALw /Zpa /GD2s /Os /Zi /Od /W2 -CCOPTS2=/AL /Zpa /G2s /Os /Zi /Od /W2 -DAPI= +CCOPTS=/ALw /Zpa /GD2s /Os /Zi /Od /W2 $(XTRA) +CCOPTS2=/AL /Zpa /G2s /Os /Zi /Od /W2 -DINTERFACE= $(XTRA) CPPFLAGS = -I$(SRCTOP)/include DEFS = $(CPPFLAGS) CFLAGS2 = $(CCOPTS2) $(DEFS) @@ -42,6 +42,7 @@ CP=copy MV=ren LN=copy LIB=lib +AWK=rem ARADD=rem RANLIB=rem diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog index 3579eecd1..55decec66 100644 --- a/src/include/krb5/ChangeLog +++ b/src/include/krb5/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 20 16:54:51 1995 Keith Vetter (keithv@fusion.com) + + * encryption.h, los-proto.h, rsa-md5.h: added windows + INTERFACE keyword. + * Makefile.in: removed isode cruft ala Feb 10 changes but for windows + Thu Feb 16 20:12:23 1995 John Gilmore (gnu at toad.com) * configure.in: Use AC_HAVE_HEADER rather than AC_HEADER_CHECK. diff --git a/src/include/krb5/Makefile.in b/src/include/krb5/Makefile.in index 53b95d1cd..5ceaa0e65 100644 --- a/src/include/krb5/Makefile.in +++ b/src/include/krb5/Makefile.in @@ -22,8 +22,6 @@ all-windows: copy stock\config.win config.h echo /* not used in windows */ > osconf.h echo /* not used in windows */ > autoconf.h - copy $(BUILDTOP)\lib\krb5\asn.1\krb5_decode.h .\asn.1\krb5_decode.h - copy $(BUILDTOP)\lib\krb5\asn.1\krb5_encode.h .\asn.1\krb5_encode.h includes:: autoconf.h diff --git a/src/include/krb5/encryption.h b/src/include/krb5/encryption.h index 9fa7e5ccd..bbee8ec23 100644 --- a/src/include/krb5/encryption.h +++ b/src/include/krb5/encryption.h @@ -61,28 +61,28 @@ typedef struct _krb5_enc_data { /* could be used in a table to find an etype and initialize a block */ typedef struct _krb5_cryptosystem_entry { krb5_magic magic; - krb5_error_code (*encrypt_func) NPROTOTYPE(( krb5_const_pointer /* in */, + krb5_error_code (INTERFACE *encrypt_func) NPROTOTYPE(( krb5_const_pointer /* in */, krb5_pointer /* out */, const size_t, krb5_encrypt_block *, krb5_pointer)); - krb5_error_code (*decrypt_func) NPROTOTYPE(( krb5_const_pointer /* in */, + krb5_error_code (INTERFACE *decrypt_func) NPROTOTYPE(( krb5_const_pointer /* in */, krb5_pointer /* out */, const size_t, krb5_encrypt_block *, krb5_pointer)); - krb5_error_code (*process_key) NPROTOTYPE(( krb5_encrypt_block *, + krb5_error_code (INTERFACE *process_key) NPROTOTYPE(( krb5_encrypt_block *, const krb5_keyblock *)); - krb5_error_code (*finish_key) NPROTOTYPE(( krb5_encrypt_block *)); - krb5_error_code (*string_to_key) NPROTOTYPE(( const krb5_encrypt_block *, + krb5_error_code (INTERFACE *finish_key) NPROTOTYPE(( krb5_encrypt_block *)); + krb5_error_code (INTERFACE *string_to_key) NPROTOTYPE(( const krb5_encrypt_block *, const krb5_keytype, krb5_keyblock *, const krb5_data *, const krb5_data *)); - krb5_error_code (*init_random_key) NPROTOTYPE(( const krb5_keyblock *, + krb5_error_code (INTERFACE *init_random_key) NPROTOTYPE(( const krb5_keyblock *, krb5_pointer *)); - krb5_error_code (*finish_random_key) NPROTOTYPE(( krb5_pointer *)); - krb5_error_code (*random_key) NPROTOTYPE(( const krb5_encrypt_block *, + krb5_error_code (INTERFACE *finish_random_key) NPROTOTYPE(( krb5_pointer *)); + krb5_error_code (INTERFACE *random_key) NPROTOTYPE(( const krb5_encrypt_block *, krb5_pointer, krb5_keyblock **)); int block_length; @@ -103,8 +103,9 @@ typedef struct _krb5_cs_table_entry { } krb5_cs_table_entry; /* could be used in a table to find a sumtype */ -typedef krb5_error_code (API *SUM_FUNC) NPROTOTYPE ((krb5_pointer /* in */, - size_t /* in_length */, +typedef krb5_error_code (INTERFACE *SUM_FUNC) NPROTOTYPE ( + (krb5_pointer /* in */, + size_t /* in_length */, krb5_pointer /* key/seed */, size_t /* key/seed size */, krb5_checksum FAR * /* out_cksum */)); diff --git a/src/include/krb5/los-proto.h b/src/include/krb5/los-proto.h index 3dc63e260..aec2ef0ea 100644 --- a/src/include/krb5/los-proto.h +++ b/src/include/krb5/los-proto.h @@ -104,7 +104,7 @@ krb5_error_code krb5_get_realm_domain krb5_boolean krb5_kuserok PROTOTYPE((krb5_context, krb5_principal, const char *)); -krb5_error_code krb5_random_confounder +krb5_error_code INTERFACE krb5_random_confounder PROTOTYPE((int, krb5_pointer )); krb5_error_code krb5_gen_replay_name diff --git a/src/include/krb5/rsa-md5.h b/src/include/krb5/rsa-md5.h index ee180bf65..f315df1ba 100644 --- a/src/include/krb5/rsa-md5.h +++ b/src/include/krb5/rsa-md5.h @@ -49,13 +49,13 @@ typedef struct { } MD5_CTX; #if defined(__STDC__) || defined(KRB5_PROVIDE_PROTOTYPES) -extern void MD5Init(MD5_CTX *); -extern void MD5Update (MD5_CTX *, unsigned char *, unsigned int); -extern void MD5Final (MD5_CTX *); +extern void INTERFACE MD5Init(MD5_CTX FAR *); +extern void INTERFACE MD5Update (MD5_CTX FAR *, unsigned char FAR *, unsigned int); +extern void INTERFACE MD5Final (MD5_CTX FAR *); #else -extern void MD5Init(); -extern void MD5Update (); -extern void MD5Final (); +extern void INTERFACE MD5Init(); +extern void INTERFACE MD5Update (); +extern void INTERFACE MD5Final (); #endif #define RSA_MD5_CKSUM_LENGTH 16 diff --git a/src/include/krb5/stock/ChangeLog b/src/include/krb5/stock/ChangeLog index 09c718247..4bb518084 100644 --- a/src/include/krb5/stock/ChangeLog +++ b/src/include/krb5/stock/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 20 15:25:26 1995 Keith Vetter (keithv@fusion.com) + + * config.h: changed API to INTERFACE. + * config.win: changed API to INTERFACE and changed BITS16 + to SIZEOF_INT/SIZEOF_LONG to track an autoconf change. + Mon Feb 6 20:5:58 1995 Keith Vetter (keithv@fusion.com) * config.win: new file--windows base template for config.h diff --git a/src/include/krb5/stock/config.h b/src/include/krb5/stock/config.h index 03ff5f9e2..2a0111438 100644 --- a/src/include/krb5/stock/config.h +++ b/src/include/krb5/stock/config.h @@ -80,7 +80,7 @@ * Windows requires a different api interface to each function. Here * just define it as NULL. */ -#define API +#define INTERFACE #define FAR #endif /* KRB5_CONFIG__ */ diff --git a/src/include/krb5/stock/config.win b/src/include/krb5/stock/config.win index 9ce614b93..abce886ab 100644 --- a/src/include/krb5/stock/config.win +++ b/src/include/krb5/stock/config.win @@ -31,6 +31,9 @@ #define KRB5_KDB5_DBM__ /* Don't load kdb_dbm.h */ #define BITS16 +#define SIZEOF_INT 2 +#define SIZEOF_SHORT 2 +#define SIZEOF_LONG 4 #define USE_STRING_H #define HAVE_SRAND @@ -46,8 +49,8 @@ typedef unsigned char u_char; #define _U_LONG_DEFINED #endif -#ifndef API -#define API __far __export __pascal +#ifndef INTERFACE +#define INTERFACE __far __export __pascal #endif #define FAR __far diff --git a/src/lib/crypto/Makefile.in b/src/lib/crypto/Makefile.in index e2275b6a9..66b19507e 100644 --- a/src/lib/crypto/Makefile.in +++ b/src/lib/crypto/Makefile.in @@ -2,19 +2,27 @@ CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/crc32 -I$(srcdir)/des -I$(srcdir)/md4 \ -I$(srcdir)/md5 LDFLAGS = -g +##DOSBUILDTOP = ..\.. +##DOSLIBNAME=libcrypto.$(LIBEXT) +##DOS!include $(BUILDTOP)\config\windows.in + TST=if test -n "`cat DONE`" ; then -OBJS= cryptoconf.o \ - des_crc.o \ - des_md5.o \ - raw_des.o +OBJS= cryptoconf.$(OBJEXT) \ + des_crc.$(OBJEXT) \ + des_md5.$(OBJEXT) \ + raw_des.$(OBJEXT) SRCS= $(srcdir)/cryptoconf.c \ $(srcdir)/des_crc.c \ $(srcdir)/des_md5.c \ $(srcdir)/raw_des.c -all:: +all:: all-$(WHAT) + +all-unix:: + +all-windows:: $(OBJS) libcrypto.a: des/DONE md4/DONE md5/DONE crc32/DONE os/DONE $(OBJS) (cd des; $(TST) $(ARADD) ../$@ `cat DONE` ; fi) @@ -29,5 +37,66 @@ install:: libcrypto.a $(INSTALL_DATA) libcrypto.a $(DESTDIR)$(KRB5_LIBDIR)/libcrypto.a $(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/libcrypto.a -clean:: - $(RM) libcrypto.a +clean:: clean-$(WHAT) + $(RM) libcrypto.$(LIBEXT) libcrypto.bak + +clean-unix:: + +check:: check-$(WHAT) + +check-unix:: + +all-windows:: + cd crc32 + @echo Making in ..\crc32 + -$(MAKE) -$(MFLAGS) + cd ..\des + @echo Making in des + -$(MAKE) -$(MFLAGS) + cd ..\md4 + @echo Making in ..\md4 + -$(MAKE) -$(MFLAGS) + cd ..\md5 + @echo Making in ..\md5 + -$(MAKE) -$(MFLAGS) + cd ..\os + @echo Making in ..\os + -$(MAKE) -$(MFLAGS) + cd .. + +clean-windows:: + cd crc32 + @echo Making clean in ..\crc32 + -$(MAKE) -$(MFLAGS) clean + cd ..\des + @echo Making clean in des + -$(MAKE) -$(MFLAGS) clean + cd ..\md4 + @echo Making clean in ..\md4 + -$(MAKE) -$(MFLAGS) clean + cd ..\md5 + @echo Making clean in ..\md5 + -$(MAKE) -$(MFLAGS) clean + cd ..\os + @echo Making clean in ..\os + -$(MAKE) -$(MFLAGS) clean + cd .. + + +check-windows:: + cd crc32 + @echo Making check in ..\crc32 + -$(MAKE) -$(MFLAGS) check + cd ..\des + @echo Making check in des + -$(MAKE) -$(MFLAGS) check + cd ..\md4 + @echo Making check in ..\md4 + -$(MAKE) -$(MFLAGS) check + cd ..\md5 + @echo Making check in ..\md5 + -$(MAKE) -$(MFLAGS) check + cd ..\os + @echo Making check in ..\os + -$(MAKE) -$(MFLAGS) check + cd .. diff --git a/src/lib/crypto/crc32/ChangeLog b/src/lib/crypto/crc32/ChangeLog index 26f6d0b49..cefe0da64 100644 --- a/src/lib/crypto/crc32/ChangeLog +++ b/src/lib/crypto/crc32/ChangeLog @@ -1,3 +1,7 @@ +Mon Feb 20 15:37:10 1995 Keith Vetter (keithv@fusion.com) + + * crc.c: changed API to INTERFACE + Fri Feb 20 11:08:00 1995 Keith Vetter (keithv@fusion.com) * crc.c: added function prototype and removed a function diff --git a/src/lib/crypto/crc32/crc.c b/src/lib/crypto/crc32/crc.c index 5860a0f38..652846b29 100644 --- a/src/lib/crypto/crc32/crc.c +++ b/src/lib/crypto/crc32/crc.c @@ -143,11 +143,11 @@ static u_long const crc_table[256] = { 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; -krb5_error_code API +krb5_error_code INTERFACE crc32_sum_func NPROTOTYPE((krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); -krb5_error_code API +krb5_error_code INTERFACE crc32_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 7ece77f2f..236cfb207 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,12 @@ +Mon Feb 20 16:10:29 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: made to work under windows PC + * cbc_cksu.c cs_entry.c finish_k.c fin_rndk.c f_cbc.c f_cksum.c + f_ecb.c f_parity.c f_pcbc.c f_sched.c init_rke.c key_sche.c + new_rn_k.c process_.c random_k.c string2k.c weak_key.c: added + windows INTERFACE keyword. + * string2key.c: needed long -> int casts for memset and malloc + Wed Feb 8 13:59:05 1995 Theodore Y. Ts'o (tytso@dcl) * des.h: Add KRB5_INT32 definitions for non-32 int platforms. diff --git a/src/lib/crypto/des/Makefile.in b/src/lib/crypto/des/Makefile.in index ac1af5050..272cde31e 100644 --- a/src/lib/crypto/des/Makefile.in +++ b/src/lib/crypto/des/Makefile.in @@ -1,31 +1,33 @@ CFLAGS = $(CCOPTS) $(DEFS) LDFLAGS = -g -ISODELIB=@ISODELIB@ -COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a +##DOSBUILDTOP = ..\..\.. +##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOS!include $(BUILDTOP)\config\windows.in -all:: $(OBJS) +ISODELIB=@ISODELIB@ +COMERRLIB=$(BUILDTOP)/util/et/libcom_err.$(LIBEXT) -KLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(ISODELIB) $(COMERRLIB) -DEPKLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(COMERRLIB) +KLIB = $(TOPLIBD)/libkrb5.$(LIBEXT) $(TOPLIBD)/libcrypto.$(LIBEXT) $(ISODELIB) $(COMERRLIB) +DEPKLIB = $(TOPLIBD)/libkrb5.$(LIBEXT) $(TOPLIBD)/libcrypto.$(LIBEXT) $(COMERRLIB) OTHERSRCS=$(srcdir)/f_cbc.c $(srcdir)/f_cksum.c \ $(srcdir)/f_sched.c $(srcdir)/f_ecb.c $(srcdir)/f_parity.c \ $(srcdir)/f_tables.c -OTHEROBJS=f_cbc.o f_cksum.o f_sched.o f_ecb.o f_parity.o f_tables.o - -OBJS= cbc_cksum.o \ - cs_entry.o \ - finish_key.o \ - fin_rndkey.o \ - init_rkey.o \ - process_ky.o \ - random_key.o \ - string2key.o \ - new_rn_key.o \ - key_sched.o \ - weak_key.o \ +OTHEROBJS=f_cbc.$(OBJEXT) f_cksum.$(OBJEXT) f_sched.$(OBJEXT) f_ecb.$(OBJEXT) f_parity.$(OBJEXT) f_tables.$(OBJEXT) + +OBJS= cbc_cksum.$(OBJEXT) \ + cs_entry.$(OBJEXT) \ + finish_key.$(OBJEXT) \ + fin_rndkey.$(OBJEXT) \ + init_rkey.$(OBJEXT) \ + process_ky.$(OBJEXT) \ + random_key.$(OBJEXT) \ + string2key.$(OBJEXT) \ + new_rn_key.$(OBJEXT) \ + key_sched.$(OBJEXT) \ + weak_key.$(OBJEXT) \ $(OTHEROBJS) SRCS= $(srcdir)/cs_entry.c \ @@ -41,26 +43,30 @@ SRCS= $(srcdir)/cs_entry.c \ $(srcdir)/weak_key.c \ $(OTHERSRCS) -includes:: depend +all:: $(OBJS) -all:: +includes:: depend depend:: $(SRCS) clean:: $(RM) fp.c ip.c key_perm.h odd.h p.c p_table.h s_table.h -verify: verify.o $(DEPKLIB) - $(CC) -o $@ verify.o $(KLIB) $(LIBS) $(LDFLAGS) +verify: verify.$(OBJEXT) $(DEPKLIB) + $(CC) -o $@ verify.$(OBJEXT) $(KLIB) $(LIBS) $(LDFLAGS) -destest: destest.o $(DEPKLIB) - $(CC) -o $@ destest.o $(KLIB) $(LIBS) $(LDFLAGS) +destest: destest.$(OBJEXT) $(DEPKLIB) + $(CC) -o $@ destest.$(OBJEXT) $(KLIB) $(LIBS) $(LDFLAGS) -check:: destest verify +check:: check-$(WHAT) + +check-unix:: destest verify ./verify -z ./verify -m ./verify ./destest < $(srcdir)/keytest.data +check-windows:: + clean:: - $(RM) destest verify destest.o verify.o + $(RM) destest verify destest.$(OBJEXT) verify.$(OBJEXT) diff --git a/src/lib/crypto/des/cbc_cksum.c b/src/lib/crypto/des/cbc_cksum.c index 7f57b842b..e4868b4a5 100644 --- a/src/lib/crypto/des/cbc_cksum.c +++ b/src/lib/crypto/des/cbc_cksum.c @@ -42,12 +42,13 @@ returns: errors */ -krb5_error_code mit_des_cbc_checksum(in, in_length, key, key_size, cksum) +krb5_error_code INTERFACE +mit_des_cbc_checksum(in, in_length, key, key_size, cksum) krb5_pointer in; size_t in_length; krb5_pointer key; size_t key_size; - krb5_checksum * cksum; + krb5_checksum FAR * cksum; { struct mit_des_ks_struct *schedule; /* pointer to key schedules */ krb5_octet *contents; diff --git a/src/lib/crypto/des/cs_entry.c b/src/lib/crypto/des/cs_entry.c index ba0768238..3004961dd 100644 --- a/src/lib/crypto/des/cs_entry.c +++ b/src/lib/crypto/des/cs_entry.c @@ -27,11 +27,12 @@ #include "k5-int.h" #include "des_int.h" -extern krb5_error_code mit_des_cbc_checksum PROTOTYPE ((krb5_pointer , +extern krb5_error_code INTERFACE mit_des_cbc_checksum PROTOTYPE (( + krb5_pointer , size_t , krb5_pointer , size_t , - krb5_checksum * )); + krb5_checksum FAR * )); krb5_checksum_entry krb5_des_cbc_cksumtable_entry = { diff --git a/src/lib/crypto/des/des_int.h b/src/lib/crypto/des/des_int.h index 10fbe16d3..ea82e07e2 100644 --- a/src/lib/crypto/des/des_int.h +++ b/src/lib/crypto/des/des_int.h @@ -31,76 +31,83 @@ #include /* cbc_cksum.c */ -extern krb5_error_code mit_des_cbc_checksum - PROTOTYPE((krb5_pointer, size_t,krb5_pointer,size_t, krb5_checksum * )); +extern krb5_error_code INTERFACE mit_des_cbc_checksum + PROTOTYPE((krb5_pointer, size_t,krb5_pointer,size_t, krb5_checksum FAR * )); /* cksum.c */ -extern void mit_des_cbc_cksum +extern void INTERFACE mit_des_cbc_cksum PROTOTYPE((krb5_octet *, krb5_octet *, long , mit_des_key_schedule , krb5_octet *)); /* des.c */ -extern int mit_des_ecb_encrypt +extern int INTERFACE mit_des_ecb_encrypt PROTOTYPE((unsigned long *, unsigned long *, mit_des_key_schedule , int )); /* f_cbc.c */ -extern int mit_des_cbc_encrypt +extern int INTERFACE mit_des_cbc_encrypt PROTOTYPE((const mit_des_cblock *in, mit_des_cblock *out, long length, mit_des_key_schedule schedule, mit_des_cblock ivec, int encrypt)); /* fin_rndkey.c */ -extern krb5_error_code mit_des_finish_random_key +extern krb5_error_code INTERFACE mit_des_finish_random_key PROTOTYPE(( krb5_pointer *)); /* finish_key.c */ -extern krb5_error_code mit_des_finish_key - PROTOTYPE(( krb5_encrypt_block *)); +extern krb5_error_code INTERFACE mit_des_finish_key + PROTOTYPE(( krb5_encrypt_block FAR *)); /* init_rkey.c */ -extern krb5_error_code mit_des_init_random_key +extern krb5_error_code INTERFACE mit_des_init_random_key PROTOTYPE(( const krb5_keyblock *, krb5_pointer *)); /* key_parity.c */ -extern void mit_des_fixup_key_parity PROTOTYPE((mit_des_cblock )); -extern int mit_des_check_key_parity PROTOTYPE((mit_des_cblock )); +extern void INTERFACE mit_des_fixup_key_parity PROTOTYPE((mit_des_cblock )); +extern int INTERFACE mit_des_check_key_parity PROTOTYPE((mit_des_cblock )); /* key_sched.c */ -extern int mit_des_key_sched +extern int INTERFACE mit_des_key_sched PROTOTYPE((mit_des_cblock , mit_des_key_schedule )); /* new_rnd_key.c */ -extern int mit_des_new_random_key +extern int INTERFACE mit_des_new_random_key PROTOTYPE((mit_des_cblock , mit_des_random_key_seed *)); -extern void mit_des_init_random_number_generator +extern void INTERFACE mit_des_init_random_number_generator PROTOTYPE((mit_des_cblock, mit_des_random_key_seed *)); -extern void mit_des_set_random_generator_seed +extern void INTERFACE mit_des_set_random_generator_seed PROTOTYPE((mit_des_cblock , mit_des_random_key_seed *)); -extern void mit_des_set_sequence_number +extern void INTERFACE mit_des_set_sequence_number PROTOTYPE((mit_des_cblock , mit_des_random_key_seed *)); -extern void mit_des_generate_random_block +extern void INTERFACE mit_des_generate_random_block PROTOTYPE((mit_des_cblock , mit_des_random_key_seed *)); /* process_ky.c */ -extern krb5_error_code mit_des_process_key +extern krb5_error_code INTERFACE mit_des_process_key PROTOTYPE(( krb5_encrypt_block *, const krb5_keyblock *)); /* random_key.c */ -extern krb5_error_code mit_des_random_key +extern krb5_error_code INTERFACE mit_des_random_key PROTOTYPE(( const krb5_encrypt_block *, krb5_pointer , krb5_keyblock **)); /* string2key.c */ -extern krb5_error_code mit_des_string_to_key +extern krb5_error_code INTERFACE mit_des_string_to_key PROTOTYPE(( const krb5_encrypt_block *, const krb5_keytype, krb5_keyblock *, const krb5_data *, const krb5_data *)); /* weak_key.c */ -extern int mit_des_is_weak_key PROTOTYPE((mit_des_cblock )); +extern int INTERFACE mit_des_is_weak_key PROTOTYPE((mit_des_cblock )); /* cmb_keys.c */ krb5_error_code mit_des_combine_subkeys PROTOTYPE((const krb5_keyblock *, const krb5_keyblock *, krb5_keyblock **)); +/* f_pcbc.c */ +int INTERFACE mit_des_pcbc_encrypt (); + +/* f_sched.c */ +int INTERFACE make_key_sched PROTOTYPE((mit_des_cblock, mit_des_key_schedule)); + + /* misc.c */ extern void swap_bits PROTOTYPE((char *)); extern unsigned long long_swap_bits PROTOTYPE((unsigned long )); diff --git a/src/lib/crypto/des/f_cbc.c b/src/lib/crypto/des/f_cbc.c index 2d6ce9c3b..bac00b2d4 100644 --- a/src/lib/crypto/des/f_cbc.c +++ b/src/lib/crypto/des/f_cbc.c @@ -36,7 +36,7 @@ * cleartext. */ -int +int INTERFACE mit_des_cbc_encrypt(in, out, length, schedule, ivec, encrypt) const des_cblock *in; des_cblock *out; diff --git a/src/lib/crypto/des/f_cksum.c b/src/lib/crypto/des/f_cksum.c index 05f092632..aeace4451 100644 --- a/src/lib/crypto/des/f_cksum.c +++ b/src/lib/crypto/des/f_cksum.c @@ -28,7 +28,7 @@ * multiple of eight bytes. */ -unsigned long +unsigned long INTERFACE mit_des_cbc_cksum(in, out, length, schedule, ivec) des_cblock *in; des_cblock *out; diff --git a/src/lib/crypto/des/f_ecb.c b/src/lib/crypto/des/f_ecb.c index f17073ebf..133ba1301 100644 --- a/src/lib/crypto/des/f_ecb.c +++ b/src/lib/crypto/des/f_ecb.c @@ -16,7 +16,7 @@ /* * des_ecb_encrypt - {en,de}crypt a block in ECB mode */ -int +int INTERFACE mit_des_ecb_encrypt(in, out, schedule, encrypt) des_cblock *in; des_cblock *out; diff --git a/src/lib/crypto/des/f_parity.c b/src/lib/crypto/des/f_parity.c index 7244482d7..4d387f198 100644 --- a/src/lib/crypto/des/f_parity.c +++ b/src/lib/crypto/des/f_parity.c @@ -20,7 +20,7 @@ #define pstep(x,step) (((x)&smask(step))^(((x)>>step)&smask(step))) #define parity_char(x) pstep(pstep(pstep((x),4),2),1) -void +void INTERFACE mit_des_fixup_key_parity(key) register des_cblock key; { @@ -39,7 +39,7 @@ mit_des_fixup_key_parity(key) * See des_fix_key_parity for the definition of * correct des parity. */ -int +int INTERFACE mit_des_check_key_parity(key) register des_cblock key; { diff --git a/src/lib/crypto/des/f_pcbc.c b/src/lib/crypto/des/f_pcbc.c index 462073ba3..511ac379c 100644 --- a/src/lib/crypto/des/f_pcbc.c +++ b/src/lib/crypto/des/f_pcbc.c @@ -16,7 +16,7 @@ /* * des_pcbc_encrypt - {en,de}crypt a stream in PCBC mode */ -int +int INTERFACE mit_des_pcbc_encrypt(in, out, length, schedule, ivec, encrypt) des_cblock *in; des_cblock *out; diff --git a/src/lib/crypto/des/f_sched.c b/src/lib/crypto/des/f_sched.c index 7b8c36f7a..36a44f41f 100644 --- a/src/lib/crypto/des/f_sched.c +++ b/src/lib/crypto/des/f_sched.c @@ -209,7 +209,7 @@ static const unsigned KRB_INT32 PC2_D[4][64] = { /* * Permute the key to give us our key schedule. */ -int +int INTERFACE make_key_sched(key, schedule) mit_des_cblock key; mit_des_key_schedule schedule; diff --git a/src/lib/crypto/des/fin_rndkey.c b/src/lib/crypto/des/fin_rndkey.c index ea718b2be..3872cdcb7 100644 --- a/src/lib/crypto/des/fin_rndkey.c +++ b/src/lib/crypto/des/fin_rndkey.c @@ -29,7 +29,7 @@ free any resources held by "seed" and assigned by init_random_key() */ -krb5_error_code mit_des_finish_random_key (seed) +krb5_error_code INTERFACE mit_des_finish_random_key (seed) krb5_pointer * seed; { memset((char *)*seed, 0, sizeof(mit_des_random_key_seed) ); diff --git a/src/lib/crypto/des/finish_key.c b/src/lib/crypto/des/finish_key.c index 29de40d66..d18c7ba3b 100644 --- a/src/lib/crypto/des/finish_key.c +++ b/src/lib/crypto/des/finish_key.c @@ -32,8 +32,9 @@ returns: errors */ -krb5_error_code mit_des_finish_key (eblock) - krb5_encrypt_block * eblock; +krb5_error_code INTERFACE +mit_des_finish_key (eblock) + krb5_encrypt_block FAR * eblock; { memset((char *)eblock->priv, 0, sizeof(mit_des_key_schedule)); free(eblock->priv); diff --git a/src/lib/crypto/des/init_rkey.c b/src/lib/crypto/des/init_rkey.c index 09eb32703..d70cef1e8 100644 --- a/src/lib/crypto/des/init_rkey.c +++ b/src/lib/crypto/des/init_rkey.c @@ -32,7 +32,8 @@ sequence information. */ -krb5_error_code mit_des_init_random_key (seedblock, seed) +krb5_error_code INTERFACE +mit_des_init_random_key (seedblock, seed) const krb5_keyblock * seedblock; krb5_pointer * seed; { diff --git a/src/lib/crypto/des/key_sched.c b/src/lib/crypto/des/key_sched.c index 914e77a86..19ddbb78c 100644 --- a/src/lib/crypto/des/key_sched.c +++ b/src/lib/crypto/des/key_sched.c @@ -48,9 +48,10 @@ #include "des_int.h" #include -void make_key_sched PROTOTYPE((mit_des_cblock, mit_des_key_schedule)); +int INTERFACE +make_key_sched PROTOTYPE((mit_des_cblock, mit_des_key_schedule)); -int +int INTERFACE mit_des_key_sched(k,schedule) mit_des_cblock k; mit_des_key_schedule schedule; diff --git a/src/lib/crypto/des/new_rn_key.c b/src/lib/crypto/des/new_rn_key.c index b6c14745b..63f68c472 100644 --- a/src/lib/crypto/des/new_rn_key.c +++ b/src/lib/crypto/des/new_rn_key.c @@ -47,7 +47,7 @@ * to be a weak des key. Mit_Des_generate_random_block is used to * provide the random bits. */ -int +int INTERFACE mit_des_new_random_key(key, p_seed) mit_des_cblock key; mit_des_random_key_seed *p_seed; @@ -75,7 +75,8 @@ mit_des_new_random_key(key, p_seed) * Note: this routine calls mit_des_set_random_generator_seed. */ -void mit_des_init_random_number_generator(key,p_seed) +void INTERFACE +mit_des_init_random_number_generator(key,p_seed) mit_des_cblock key; mit_des_random_key_seed *p_seed; { @@ -155,7 +156,7 @@ void mit_des_init_random_number_generator(key,p_seed) * Requires: key is a valid des key. I.e., has correct parity and is not a * weak des key. */ -void +void INTERFACE mit_des_set_random_generator_seed(key, p_seed) mit_des_cblock key; mit_des_random_key_seed *p_seed; @@ -178,7 +179,7 @@ mit_des_set_random_generator_seed(key, p_seed) * * Note that mit_des_set_random_generator_seed resets the sequence number to 0. */ -void +void INTERFACE mit_des_set_sequence_number(new_sequence_number, p_seed) mit_des_cblock new_sequence_number; mit_des_random_key_seed *p_seed; @@ -195,7 +196,8 @@ mit_des_set_sequence_number(new_sequence_number, p_seed) * Requires: mit_des_set_random_generator_seed must have been called at least once * before this routine is called. */ -void mit_des_generate_random_block(block, p_seed) +void INTERFACE +mit_des_generate_random_block(block, p_seed) mit_des_cblock block; mit_des_random_key_seed *p_seed; { diff --git a/src/lib/crypto/des/process_ky.c b/src/lib/crypto/des/process_ky.c index e684f5af5..d21bd93be 100644 --- a/src/lib/crypto/des/process_ky.c +++ b/src/lib/crypto/des/process_ky.c @@ -38,7 +38,8 @@ returns: errors */ -krb5_error_code mit_des_process_key (eblock, keyblock) +krb5_error_code INTERFACE +mit_des_process_key (eblock, keyblock) krb5_encrypt_block * eblock; const krb5_keyblock * keyblock; { diff --git a/src/lib/crypto/des/random_key.c b/src/lib/crypto/des/random_key.c index 1642e111c..055b0fa75 100644 --- a/src/lib/crypto/des/random_key.c +++ b/src/lib/crypto/des/random_key.c @@ -29,7 +29,8 @@ filling in the keyblock address in *keyblock */ -krb5_error_code mit_des_random_key (eblock, seed, keyblock) +krb5_error_code INTERFACE +mit_des_random_key (eblock, seed, keyblock) const krb5_encrypt_block * eblock; krb5_pointer seed; krb5_keyblock ** keyblock; diff --git a/src/lib/crypto/des/string2key.c b/src/lib/crypto/des/string2key.c index 0cbfea2bd..4369f1de9 100644 --- a/src/lib/crypto/des/string2key.c +++ b/src/lib/crypto/des/string2key.c @@ -40,12 +40,13 @@ returns: errors */ -krb5_error_code mit_des_string_to_key (eblock, keytype, keyblock, data, salt) -const krb5_encrypt_block * eblock; +krb5_error_code INTERFACE +mit_des_string_to_key (eblock, keytype, keyblock, data, salt) +const krb5_encrypt_block FAR * eblock; const krb5_keytype keytype; -krb5_keyblock * keyblock; -const krb5_data * data; -const krb5_data * salt; +krb5_keyblock FAR * keyblock; +const krb5_data FAR * data; +const krb5_data FAR * salt; { register char *str, *copystr; register krb5_octet *key; @@ -78,7 +79,7 @@ const krb5_data * salt; else length = data->length; - copystr = malloc(length); + copystr = malloc((size_t) length); if (!copystr) { free(keyblock->contents); keyblock->contents = 0; @@ -148,7 +149,7 @@ const krb5_data * salt; memset((char *)key_sked, 0, sizeof(key_sked)); /* clean & free the input string */ - memset(copystr, 0, length); + memset(copystr, 0, (size_t) length); krb5_xfree(copystr); /* now fix up key parity again */ diff --git a/src/lib/crypto/des/weak_key.c b/src/lib/crypto/des/weak_key.c index bc6b20264..50f21354d 100644 --- a/src/lib/crypto/des/weak_key.c +++ b/src/lib/crypto/des/weak_key.c @@ -67,7 +67,7 @@ static mit_des_cblock weak[16] = { * * Requires: key has correct odd parity. */ -int +int INTERFACE mit_des_is_weak_key(key) mit_des_cblock key; { diff --git a/src/lib/crypto/des_crc.c b/src/lib/crypto/des_crc.c index 51c6e24fc..90bbe87ed 100644 --- a/src/lib/crypto/des_crc.c +++ b/src/lib/crypto/des_crc.c @@ -25,11 +25,11 @@ #include "crc-32.h" #include "des_int.h" -static krb5_error_code mit_des_crc_encrypt_func +krb5_error_code INTERFACE mit_des_crc_encrypt_func PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t, krb5_encrypt_block *, krb5_pointer )); -static krb5_error_code mit_des_crc_decrypt_func +krb5_error_code INTERFACE mit_des_crc_decrypt_func PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t, krb5_encrypt_block *, krb5_pointer )); @@ -58,7 +58,7 @@ krb5_cs_table_entry krb5_des_crc_cst_entry = { }; -static krb5_error_code +krb5_error_code INTERFACE mit_des_crc_encrypt_func(in, out, size, key, ivec) krb5_const_pointer in; krb5_pointer out; @@ -123,7 +123,7 @@ mit_des_crc_encrypt_func(in, out, size, key, ivec) } -static krb5_error_code +krb5_error_code INTERFACE mit_des_crc_decrypt_func(in, out, size, key, ivec) krb5_const_pointer in; krb5_pointer out; @@ -140,8 +140,8 @@ mit_des_crc_decrypt_func(in, out, size, key, ivec) if ( size < 2*sizeof(mit_des_cblock) ) return KRB5_BAD_MSIZE; - retval = mit_des_cbc_encrypt(in, - out, + retval = mit_des_cbc_encrypt((mit_des_cblock FAR *) in, + (mit_des_cblock FAR *) out, size, (struct mit_des_ks_struct *) key->priv, ivec ? ivec : (krb5_pointer)key->key->contents, diff --git a/src/lib/crypto/des_md5.c b/src/lib/crypto/des_md5.c index cb811b73b..0b359867d 100644 --- a/src/lib/crypto/des_md5.c +++ b/src/lib/crypto/des_md5.c @@ -25,11 +25,11 @@ #include #include "des_int.h" -static krb5_error_code mit_des_md5_encrypt_func +krb5_error_code INTERFACE mit_des_md5_encrypt_func PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t, krb5_encrypt_block *, krb5_pointer )); -static krb5_error_code mit_des_md5_decrypt_func +krb5_error_code INTERFACE mit_des_md5_decrypt_func PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t, krb5_encrypt_block *, krb5_pointer )); @@ -59,7 +59,7 @@ krb5_cs_table_entry krb5_des_md5_cst_entry = { }; -static krb5_error_code +krb5_error_code INTERFACE mit_des_md5_encrypt_func(in, out, size, key, ivec) krb5_const_pointer in; krb5_pointer out; @@ -124,7 +124,7 @@ mit_des_md5_encrypt_func(in, out, size, key, ivec) } -static krb5_error_code +krb5_error_code INTERFACE mit_des_md5_decrypt_func(in, out, size, key, ivec) krb5_const_pointer in; krb5_pointer out; @@ -141,7 +141,7 @@ mit_des_md5_decrypt_func(in, out, size, key, ivec) if ( size < 2*sizeof(mit_des_cblock) ) return KRB5_BAD_MSIZE; - retval = mit_des_cbc_encrypt(in, + retval = mit_des_cbc_encrypt((const mit_des_cblock *) in, out, size, (struct mit_des_ks_struct *) key->priv, diff --git a/src/lib/crypto/md4/ChangeLog b/src/lib/crypto/md4/ChangeLog index 1df1f3faa..e5ea22d55 100644 --- a/src/lib/crypto/md4/ChangeLog +++ b/src/lib/crypto/md4/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 20 15:54:1 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: made to work for the PC + * md4.c, md4crypt.c md4glue.c: added windows INTERFACE keyword + * rsa-md4.h: added windows INTERFACE to prototypes + Thu Feb 2 03:00:41 1995 John Gilmore * Makefile.in (CFLAGS): Handle $(srcdir) properly in -I options. @@ -5,7 +11,8 @@ Thu Feb 2 03:00:41 1995 John Gilmore Wed Jan 25 20:08:47 1995 John Gilmore (gnu at toad.com) * Makefile.in (CFLAGS): Add -I../des to pull in DES header file. - * rsa-md4.h: New include file, moved from include/krb5, since + * +rsa-md4.h: New include file, moved from include/krb5, since it's only used locally. * md4.c, md4crypto.c, md4driver.c, md4glue.c: Replace <.../...> includes with "..."s. diff --git a/src/lib/crypto/md4/Makefile.in b/src/lib/crypto/md4/Makefile.in index c4a6f4a8a..af6b730bc 100644 --- a/src/lib/crypto/md4/Makefile.in +++ b/src/lib/crypto/md4/Makefile.in @@ -2,13 +2,19 @@ CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/../des -I$(srcdir) LDFLAGS = -g -all:: $(OBJS) t_mddriver +##DOSBUILDTOP = ..\..\.. +##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOS!include $(BUILDTOP)\config\windows.in +OBJS= md4.$(OBJEXT) md4glue.$(OBJEXT) md4crypto.$(OBJEXT) +SRCS= $(srcdir)/md4.c $(srcdir)/md4glue.c $(srcdir)/md4crypto.c -OBJS= md4.o md4glue.o md4crypto.o +all:: $(OBJS) all-$(WHAT) -SRCS= $(srcdir)/md4.c $(srcdir)/md4glue.c $(srcdir)/md4crypto.c +all-unix:: t_mddriver-unix + +all-windows:: t_mddriver.c: $(srcdir)/../md5/t_mddriver.c $(CP) $(srcdir)/../md5/t_mddriver.c t_mddriver.c @@ -16,11 +22,16 @@ t_mddriver.c: $(srcdir)/../md5/t_mddriver.c t_mddriver.o: t_mddriver.c $(CC) -DMD=4 $(CFLAGS) -c t_mddriver.c -t_mddriver: t_mddriver.o md4.o +t_mddriver-unix: t_mddriver.o md4.o $(CC) $(CFLAGS) -o t_mddriver t_mddriver.o md4.o -check:: t_mddriver - ./t_mddriver -x +t_mddriver-windows: + $(CP) $(srcdir)\..\md5\t_mddriver.c t_mddriver.c + $(CC) -DMD=4 $(CFLAGS2) -o t_mddriver t_mddriver.c md4.c + $(RM) md4.obj + +check:: t_mddriver-$(WHAT) + $(C)t_mddriver$(EXEEXT) -x clean:: - $(RM) t_mddriver t_mddriver.o t_mddriver.c + $(RM) t_mddriver$(EXEEXT) t_mddriver.$(OBJEXT) t_mddriver.c diff --git a/src/lib/crypto/md4/md4.c b/src/lib/crypto/md4/md4.c index 4c46afd63..16f6a2b4b 100644 --- a/src/lib/crypto/md4/md4.c +++ b/src/lib/crypto/md4/md4.c @@ -46,7 +46,7 @@ /* forward declaration */ #if defined(__STDC__) || defined(KRB5_PROVIDE_PROTOTYPES) -static void Transform (krb5_ui_4 *, krb5_ui_4 *); +static void Transform (krb5_ui_4 FAR *, krb5_ui_4 FAR *); #else static void Transform (); #endif @@ -82,8 +82,9 @@ static unsigned char PADDING[64] = { {(a) += H ((b), (c), (d)) + (x) + UL(015666365641); \ (a) = ROTATE_LEFT ((a), (s));} -void MD4Init (mdContext) -MD4_CTX *mdContext; +void INTERFACE +MD4Init (mdContext) +MD4_CTX FAR *mdContext; { mdContext->i[0] = mdContext->i[1] = (krb5_ui_4)0; @@ -95,9 +96,10 @@ MD4_CTX *mdContext; mdContext->buf[3] = UL(0x10325476); } -void MD4Update (mdContext, inBuf, inLen) -MD4_CTX *mdContext; -unsigned char *inBuf; +void INTERFACE +MD4Update (mdContext, inBuf, inLen) +MD4_CTX FAR *mdContext; +unsigned char FAR *inBuf; unsigned int inLen; { krb5_ui_4 in[16]; @@ -130,8 +132,9 @@ unsigned int inLen; } } -void MD4Final (mdContext) -MD4_CTX *mdContext; +void INTERFACE +MD4Final (mdContext) +MD4_CTX FAR *mdContext; { krb5_ui_4 in[16]; int mdi; @@ -173,8 +176,8 @@ MD4_CTX *mdContext; /* Basic MD4 step. Transform buf based on in. */ static void Transform (buf, in) -krb5_ui_4 *buf; -krb5_ui_4 *in; +krb5_ui_4 FAR *buf; +krb5_ui_4 FAR *in; { krb5_ui_4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; diff --git a/src/lib/crypto/md4/md4crypto.c b/src/lib/crypto/md4/md4crypto.c index e6ced5fe8..38a3a4a3b 100644 --- a/src/lib/crypto/md4/md4crypto.c +++ b/src/lib/crypto/md4/md4crypto.c @@ -28,13 +28,17 @@ #include "rsa-md4.h" #include "des_int.h" /* we cheat a bit and call it directly... */ -static krb5_error_code +krb5_error_code INTERFACE +md4_crypto_sum_func NPROTOTYPE((krb5_pointer in, size_t in_length, + krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); + +krb5_error_code INTERFACE md4_crypto_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; size_t seed_length; -krb5_checksum *outcksum; +krb5_checksum FAR *outcksum; { krb5_octet outtmp[RSA_MD4_DES_CKSUM_LENGTH]; krb5_octet *input = (krb5_octet *)in; @@ -62,8 +66,8 @@ krb5_checksum *outcksum; if (retval = mit_des_process_key(&eblock, &keyblock)) return retval; /* now encrypt it */ - retval = mit_des_cbc_encrypt(&outtmp[0], - outcksum->contents, + retval = mit_des_cbc_encrypt((mit_des_cblock *)&outtmp[0], + (mit_des_cblock *)outcksum->contents, RSA_MD4_DES_CKSUM_LENGTH, (struct mit_des_ks_struct *)eblock.priv, keyblock.contents, diff --git a/src/lib/crypto/md4/md4glue.c b/src/lib/crypto/md4/md4glue.c index 03784351f..deebff54a 100644 --- a/src/lib/crypto/md4/md4glue.c +++ b/src/lib/crypto/md4/md4glue.c @@ -26,13 +26,17 @@ #include "k5-int.h" #include "rsa-md4.h" -static krb5_error_code +krb5_error_code INTERFACE +md4_sum_func NPROTOTYPE((krb5_pointer in, size_t in_length, + krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); + +krb5_error_code INTERFACE md4_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; size_t seed_length; -krb5_checksum *outcksum; +krb5_checksum FAR *outcksum; { krb5_octet *input = (krb5_octet *)in; MD4_CTX working; diff --git a/src/lib/crypto/md4/rsa-md4.h b/src/lib/crypto/md4/rsa-md4.h index a8880b4f9..05012168b 100644 --- a/src/lib/crypto/md4/rsa-md4.h +++ b/src/lib/crypto/md4/rsa-md4.h @@ -85,13 +85,13 @@ typedef struct { } MD4_CTX; #ifdef __STDC__ -extern void MD4Init(MD4_CTX *); -extern void MD4Update(MD4_CTX *, unsigned char *, unsigned int); -extern void MD4Final(MD4_CTX *); +extern void INTERFACE MD4Init(MD4_CTX FAR *); +extern void INTERFACE MD4Update(MD4_CTX FAR *, unsigned char FAR *, unsigned int); +extern void INTERFACE MD4Final(MD4_CTX FAR *); #else -void MD4Init (); -void MD4Update (); -void MD4Final (); +void INTERFACE MD4Init (); +void INTERFACE MD4Update (); +void INTERFACE MD4Final (); #endif /* diff --git a/src/lib/crypto/md5/ChangeLog b/src/lib/crypto/md5/ChangeLog index 9f704c3e1..e1e6837c8 100644 --- a/src/lib/crypto/md5/ChangeLog +++ b/src/lib/crypto/md5/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 20 15:54:1 1995 Keith Vetter (keithv@fusion.com) + + * Makefile.in: made to work for the PC + * md5.c, md5crypt.c md5glue.c: added windows INTERFACE keyword + Thu Feb 2 03:01:28 1995 John Gilmore * Makefile.in (CFLAGS): Handle $(srcdir) properly in -I options. diff --git a/src/lib/crypto/md5/Makefile.in b/src/lib/crypto/md5/Makefile.in index 4616b22c5..259d1fbcd 100644 --- a/src/lib/crypto/md5/Makefile.in +++ b/src/lib/crypto/md5/Makefile.in @@ -1,17 +1,29 @@ CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/../des LDFLAGS = -g -all:: $(OBJS) t_mddriver +##DOSBUILDTOP = ..\..\.. +##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOS!include $(BUILDTOP)\config\windows.in -OBJS= md5.o md5glue.o md5crypto.o +OBJS= md5.$(OBJEXT) md5glue.$(OBJEXT) md5crypto.$(OBJEXT) SRCS= $(srcdir)/md5.c $(srcdir)/md5glue.c $(srcdir)/md5crypto.c -t_mddriver: t_mddriver.o md5.o +all:: $(OBJS) all-$(WHAT) + +all-unix:: t_mddriver-unix + +all-windows:: + +t_mddriver-unix: t_mddriver.o md5.o $(CC) $(CFLAGS) -o t_mddriver t_mddriver.o md5.o -check:: t_mddriver - ./t_mddriver -x +t_mddriver-windows: + $(CC) $(CFLAGS2) -o t_mddriver.exe t_mddriver.c md5.c + $(RM) md5.obj + +check:: t_mddriver-$(WHAT) + $(C)t_mddriver$(EXEEXT) -x clean:: - $(RM) t_mddriver t_mddriver.o + $(RM) t_mddriver$(EXEEXT) t_mddriver.$(OBJEXT) diff --git a/src/lib/crypto/md5/md5.c b/src/lib/crypto/md5/md5.c index 40528a2d1..11d358918 100644 --- a/src/lib/crypto/md5/md5.c +++ b/src/lib/crypto/md5/md5.c @@ -56,7 +56,7 @@ */ /* forward declaration */ -static void Transform (); +static void Transform PROTOTYPE((krb5_ui_4 FAR *buf, krb5_ui_4 FAR *in)); static unsigned char PADDING[64] = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -104,8 +104,9 @@ static unsigned char PADDING[64] = { /* The routine MD5Init initializes the message-digest context mdContext. All fields are set to zero. */ -void MD5Init (mdContext) -MD5_CTX *mdContext; +void INTERFACE +MD5Init (mdContext) +MD5_CTX FAR *mdContext; { mdContext->i[0] = mdContext->i[1] = (krb5_ui_4)0; @@ -121,9 +122,10 @@ MD5_CTX *mdContext; account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. */ -void MD5Update (mdContext, inBuf, inLen) -MD5_CTX *mdContext; -unsigned char *inBuf; +void INTERFACE +MD5Update (mdContext, inBuf, inLen) +MD5_CTX FAR *mdContext; +unsigned char FAR *inBuf; unsigned int inLen; { krb5_ui_4 in[16]; @@ -159,8 +161,9 @@ unsigned int inLen; /* The routine MD5Final terminates the message-digest computation and ends with the desired message digest in mdContext->digest[0...15]. */ -void MD5Final (mdContext) -MD5_CTX *mdContext; +void INTERFACE +MD5Final (mdContext) +MD5_CTX FAR *mdContext; { krb5_ui_4 in[16]; int mdi; @@ -201,8 +204,8 @@ MD5_CTX *mdContext; /* Basic MD5 step. Transforms buf based on in. */ static void Transform (buf, in) -krb5_ui_4 *buf; -krb5_ui_4 *in; +krb5_ui_4 FAR *buf; +krb5_ui_4 FAR *in; { register krb5_ui_4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; diff --git a/src/lib/crypto/md5/md5crypto.c b/src/lib/crypto/md5/md5crypto.c index d161a5111..264802a2e 100644 --- a/src/lib/crypto/md5/md5crypto.c +++ b/src/lib/crypto/md5/md5crypto.c @@ -2,13 +2,17 @@ #include #include "des_int.h" /* we cheat a bit and call it directly... */ -static krb5_error_code +krb5_error_code INTERFACE +md5_crypto_sum_func NPROTOTYPE((krb5_pointer in, size_t in_length, + krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); + +krb5_error_code INTERFACE md5_crypto_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; size_t seed_length; -krb5_checksum *outcksum; +krb5_checksum FAR *outcksum; { krb5_octet outtmp[RSA_MD5_DES_CKSUM_LENGTH]; krb5_octet *input = (krb5_octet *)in; @@ -36,8 +40,8 @@ krb5_checksum *outcksum; if (retval = mit_des_process_key(&eblock, &keyblock)) return retval; /* now encrypt it */ - retval = mit_des_cbc_encrypt(&outtmp[0], - outcksum->contents, + retval = mit_des_cbc_encrypt((mit_des_cblock *)&outtmp[0], + (mit_des_cblock *)outcksum->contents, RSA_MD5_DES_CKSUM_LENGTH, (struct mit_des_ks_struct *)eblock.priv, keyblock.contents, diff --git a/src/lib/crypto/md5/md5glue.c b/src/lib/crypto/md5/md5glue.c index 3470664b7..4e9d1e8f7 100644 --- a/src/lib/crypto/md5/md5glue.c +++ b/src/lib/crypto/md5/md5glue.c @@ -1,13 +1,17 @@ #include "k5-int.h" #include -static krb5_error_code +krb5_error_code INTERFACE +md5_sum_func NPROTOTYPE((krb5_pointer in, size_t in_length, + krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); + +krb5_error_code INTERFACE md5_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; size_t seed_length; -krb5_checksum *outcksum; +krb5_checksum FAR *outcksum; { krb5_octet *input = (krb5_octet *)in; MD5_CTX working; diff --git a/src/lib/crypto/os/ChangeLog b/src/lib/crypto/os/ChangeLog index 06148ad60..a2e96b464 100644 --- a/src/lib/crypto/os/ChangeLog +++ b/src/lib/crypto/os/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 20 16:25:36 1995 Keith Vetter (keithv@fusion.com) + + * Makfile.in: made to work for the PC + * rnd_confoun.c: added windows INTERFACE keyword + Wed Jan 25 20:24:35 1995 John Gilmore (gnu at toad.com) * rnd_confoun.c: Replace <.../...> includes with "..."s. diff --git a/src/lib/crypto/os/Makefile.in b/src/lib/crypto/os/Makefile.in index c3bc1df54..60e9af985 100644 --- a/src/lib/crypto/os/Makefile.in +++ b/src/lib/crypto/os/Makefile.in @@ -1,15 +1,21 @@ CFLAGS = $(CCOPTS) $(DEFS) LDFLAGS = -g +##DOSBUILDTOP = ..\..\.. +##DOSLIBNAME=..\libcrypto.$(LIBEXT) +##DOS!include $(BUILDTOP)\config\windows.in + LIBOBJS = @LIBOBJS@ -all:: $(OBJS) +OBJS= rnd_confoun.$(OBJEXT) localaddr.$(OBJEXT) ustime.$(OBJEXT) $(LIBOBJS) +SRCS= rnd_confoun.c localaddr.c ustime.c +all:: all-$(WHAT) -OBJS= rnd_confoun.o localaddr.o ustime.o $(LIBOBJS) +all-unix:: $(OBJS) -SRCS= rnd_confoun.c localaddr.c ustime.c +all-windows: rnd_confoun.obj localaddr.c: ../../krb5/os/localaddr.c -$(LN) $(srcdir)/../../krb5/os/localaddr.c $@ diff --git a/src/lib/crypto/os/rnd_confoun.c b/src/lib/crypto/os/rnd_confoun.c index 02e2c9d5d..bed3b17ee 100644 --- a/src/lib/crypto/os/rnd_confoun.c +++ b/src/lib/crypto/os/rnd_confoun.c @@ -60,7 +60,7 @@ You need a random number generator! /* * Generate a random confounder */ -krb5_error_code +krb5_error_code INTERFACE krb5_random_confounder(size, fillin) int size; krb5_pointer fillin; diff --git a/src/lib/crypto/raw_des.c b/src/lib/crypto/raw_des.c index 9f710df96..e1a956f77 100644 --- a/src/lib/crypto/raw_des.c +++ b/src/lib/crypto/raw_des.c @@ -24,11 +24,11 @@ #include "k5-int.h" #include "des_int.h" -static krb5_error_code mit_raw_des_encrypt_func +krb5_error_code INTERFACE mit_raw_des_encrypt_func PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t, krb5_encrypt_block *, krb5_pointer )); -static krb5_error_code mit_raw_des_decrypt_func +krb5_error_code INTERFACE mit_raw_des_decrypt_func PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t, krb5_encrypt_block *, krb5_pointer )); @@ -55,7 +55,7 @@ krb5_cs_table_entry krb5_raw_des_cst_entry = { 0 }; -static krb5_error_code +krb5_error_code INTERFACE mit_raw_des_decrypt_func(in, out, size, key, ivec) krb5_const_pointer in; krb5_pointer out; @@ -63,7 +63,7 @@ mit_raw_des_decrypt_func(in, out, size, key, ivec) krb5_encrypt_block * key; krb5_pointer ivec; { - return (mit_des_cbc_encrypt (in, + return (mit_des_cbc_encrypt ((const mit_des_cblock *) in, out, size, (struct mit_des_ks_struct *)key->priv, @@ -71,7 +71,7 @@ mit_raw_des_decrypt_func(in, out, size, key, ivec) MIT_DES_DECRYPT)); } -static krb5_error_code +krb5_error_code INTERFACE mit_raw_des_encrypt_func(in, out, size, key, ivec) krb5_const_pointer in; krb5_pointer out; -- 2.26.2