diff --git a/Makefile.in b/Makefile.in index 20e83240e8..87b0ec2d34 100644 --- a/Makefile.in +++ b/Makefile.in @@ -109,7 +109,7 @@ packages: dest echo Not building packages for ${SYS_NAME} ;; \ esac -${TOP_INCDIR}/afs ${TOP_INCDIR}/rx ${TOP_INCDIR}/des ${TOP_INCDIR}/hcrypto ${TOP_LIBDIR} ${TOP_JLIBDIR}: +${TOP_INCDIR}/afs ${TOP_INCDIR}/rx ${TOP_INCDIR}/hcrypto ${TOP_LIBDIR} ${TOP_JLIBDIR}: mkdir -p $@ install_dirs: force @@ -135,7 +135,7 @@ dest_dirs: force mkdir -p ${DEST}/root.server/etc mkdir -p ${DEST}/root.server/usr/afs/bin -prelude: ${TOP_INCDIR}/afs ${TOP_INCDIR}/rx ${TOP_INCDIR}/des ${TOP_INCDIR}/hcrypto ${TOP_LIBDIR} +prelude: ${TOP_INCDIR}/afs ${TOP_INCDIR}/rx ${TOP_INCDIR}/hcrypto ${TOP_LIBDIR} project: cmd comerr @@ -148,7 +148,7 @@ config: prelude procmgmt: config +${COMPILE_PART1} procmgmt ${COMPILE_PART2} -util: $(DIR_roken) procmgmt des lwp_depinstall rx_depinstall +util: $(DIR_roken) procmgmt hcrypto lwp_depinstall rx_depinstall +${COMPILE_PART1} util ${COMPILE_PART2} audit: util rx rxkad fsint @@ -204,16 +204,13 @@ export_build: fsint afs: config export comerr afs_depinstall +${COMPILE_PART1} afs ${COMPILE_PART2} -des: config - +${COMPILE_PART1} des ${COMPILE_PART2} - -sys: cmd comerr afs des rx rxstat fsint auth sys_depinstall +sys: cmd comerr afs hcrypto rx rxstat fsint auth sys_depinstall +${COMPILE_PART1} sys ${COMPILE_PART2} -rxkad: cmd comerr des rx rxkad_depinstall +rxkad: cmd comerr hcrypto rx rxkad_depinstall +${COMPILE_PART1} rxkad ${COMPILE_PART2} -auth: cmd comerr des lwp rx rxkad audit sys_depinstall auth_depinstall +auth: cmd comerr hcrypto lwp rx rxkad audit sys_depinstall auth_depinstall +${COMPILE_PART1} auth ${COMPILE_PART2} ubik: cmd comerr auth ubik_depinstall sys @@ -357,7 +354,7 @@ fsprobe: cmd comerr util fsint volser scout: cmd comerr gtx fsprobe +${COMPILE_PART1} scout ${COMPILE_PART2} -uss: des kauth cmd comerr rx vlserver vol volser +uss: hcrypto kauth cmd comerr rx vlserver vol volser +${COMPILE_PART1} uss ${COMPILE_PART2} bozo: cmd comerr audit auth kauth volser @@ -491,17 +488,13 @@ libafs_tree: export lwp_depinstall rx_depinstall vlserver_depinstall tvlserver_d # libuafs build targets # -UKERNELDIR= \ - des \ - afsweb - libuafs_setup: config export src/config/config src/libuafs/MakefileProto.${MKAFS_OSTYPE} src/libuafs/Makefile ${SYS_NAME} libuafs: libuafs_setup vlserver_depinstall tvlserver_depinstall rx_depinstall fsint_depinstall \ auth_depinstall dir_depinstall libacl_depinstall rxkad_depinstall \ ubik_depinstall afs_depinstall kauth_depinstall ptserver_depinstall \ - rxstat_depinstall lwp_depinstall sys_depinstall des cmd + rxstat_depinstall lwp_depinstall sys_depinstall cmd hcrypto +set -x; \ case ${SYS_NAME} in \ hp_ux102* | *_obsd* | sun*_4* | *_nbsd*| hp_ux11i | hp_ux112* | ia64_hpux112*) \ @@ -569,7 +562,7 @@ afsmonitor: cmd comerr gtx xstat tests: rxtests ubiktests rpctestlib # pthread based user space RX library -libafsrpc: rx rxkad rxstat fsint des +libafsrpc: rx rxkad rxstat fsint hcrypto +case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*[of]bsd*|*nbsd[234]*) \ ${COMPILE_PART1} libafsrpc ${COMPILE_PART2} ;; \ @@ -594,7 +587,7 @@ libafsauthent: ubik auth kauth libafsrpc esac # pthread based user space RX library -shlibafsrpc: rx rxstat fsint rxkad des +shlibafsrpc: rx rxstat fsint rxkad hcrypto +case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*_darwin_1*|*nbsd*|*obsd*|*fbsd*) \ ${COMPILE_PART1} shlibafsrpc ${COMPILE_PART2} ;; \ @@ -709,7 +702,6 @@ clean2: -${COMPILE_PART1} fsint ${COMPILE_CLEAN} -${COMPILE_PART1} export ${COMPILE_CLEAN} -${COMPILE_PART1} afs ${COMPILE_CLEAN} - -${COMPILE_PART1} des ${COMPILE_CLEAN} -${COMPILE_PART1} sys ${COMPILE_CLEAN} -${COMPILE_PART1} rxkad ${COMPILE_CLEAN} -${COMPILE_PART1} auth ${COMPILE_CLEAN} @@ -784,7 +776,7 @@ clean2: -${COMPILE_PART1} crypto/hcrypto ${COMPILE_CLEAN} -${COMPILE_PART1} roken ${COMPILE_CLEAN} -(cd src/libafs; /bin/rm -rf afs afsint config rx) - -(cd src/libuafs; /bin/rm -rf afs afsint config rx des) + -(cd src/libuafs; /bin/rm -rf afs afsint config rx) -/bin/rm -rf ${TOP_INCDIR} ${TOP_LIBDIR} ${TOP_JLIBDIR} -/bin/rm -rf libafs_tree ${SYS_NAME} @@ -827,8 +819,6 @@ distclean: clean src/config/shlib-build \ src/config/shlib-install \ src/crypto/hcrypto/Makefile \ - src/des/Makefile \ - src/des/test/Makefile \ src/dir/Makefile \ src/dir/test/Makefile \ src/dviced/Makefile \ diff --git a/NTMakefile b/NTMakefile index 97e687d54c..fe8dd6c8d0 100644 --- a/NTMakefile +++ b/NTMakefile @@ -166,13 +166,6 @@ rxgen: lwp $(NTMAKE) $(CD) ..\.. -des: rxgen - @echo ***** $@ - $(DOCD) $(SRC)\des - $(CD) $(SRC)\des - $(NTMAKE) - $(CD) ..\.. - hcrypto: roken @echo ***** $@ $(DOCD) $(SRC)\crypto\hcrypto @@ -180,7 +173,7 @@ hcrypto: roken $(NTMAKE) $(CD) ..\..\.. -roken: des +roken: rxgen @echo ***** $@ $(DOCD) $(SRC)\roken $(CD) $(SRC)\roken diff --git a/configure.ac b/configure.ac index ddc14c1227..a97fd5d87b 100644 --- a/configure.ac +++ b/configure.ac @@ -139,8 +139,6 @@ src/config/Makefile.version-NOCML \ src/config/shlib-build \ src/config/shlib-install \ src/crypto/hcrypto/Makefile \ -src/des/Makefile \ -src/des/test/Makefile \ src/dir/Makefile \ src/dir/test/Makefile \ src/dviced/Makefile \ diff --git a/src/JAVA/libjafs/Makefile.in b/src/JAVA/libjafs/Makefile.in index 843fe8d2a0..d67637ebaa 100644 --- a/src/JAVA/libjafs/Makefile.in +++ b/src/JAVA/libjafs/Makefile.in @@ -155,7 +155,6 @@ CLIENTADMINLIB = ${TOP_LIBDIR}/libclientadmin.a LIBJAFS_LIBS =\ ${TOP_LIBDIR}/libjuafs.a \ ${TOP_LIBDIR}/libafsutil.a \ - ${TOP_LIBDIR}/libdes.a \ -lresolv \ -lpthread diff --git a/src/WINNT/afsd/NTMakefile b/src/WINNT/afsd/NTMakefile index 20b4ad5c68..e24ffdad05 100644 --- a/src/WINNT/afsd/NTMakefile +++ b/src/WINNT/afsd/NTMakefile @@ -359,11 +359,11 @@ EXELIBS = \ $(DESTDIR)\lib\afs\afsvldb.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\libosi.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib EXELIBS2 = \ @@ -375,15 +375,17 @@ EXELIBS2 = \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\libosi.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib EXELIBS3 = \ $(DESTDIR)\lib\afs\afscmd.lib \ - $(DESTDIR)\lib\afsrxkad.lib + $(DESTDIR)\lib\afsrxkad.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ + $(DESTDIR)\lib\afsroken.lib # klog.exe @@ -517,8 +519,9 @@ KPASSWD_LIBS =\ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\afsrpc.lib \ $(DESTDIR)\lib\afs\afscmd.lib \ - $(DESTDIR)\lib\afsdes.lib \ - $(DESTDIR)\lib\afs\mtafsutil.lib + $(DESTDIR)\lib\afs\mtafsutil.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ + $(DESTDIR)\lib\afsroken.lib $(OUT)\kpasswd.obj: $(KAUTH)/kpasswd.c $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** diff --git a/src/WINNT/afsd/krb.h b/src/WINNT/afsd/krb.h index 39b4cf0faa..0065a94217 100644 --- a/src/WINNT/afsd/krb.h +++ b/src/WINNT/afsd/krb.h @@ -25,7 +25,7 @@ #define KRB_DEFS /* Need some defs from des.h */ -#include +#include /* General definitions */ #define KSUCCESS 0 diff --git a/src/WINNT/afssvrmgr/NTMakefile b/src/WINNT/afssvrmgr/NTMakefile index 6c8372776f..1925d0ea38 100644 --- a/src/WINNT/afssvrmgr/NTMakefile +++ b/src/WINNT/afssvrmgr/NTMakefile @@ -97,7 +97,6 @@ EXELIBS = \ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afskfw.lib \ $(DESTDIR)\lib\afs\AfsClass.lib \ $(DESTDIR)\lib\afs\TaAfsAppLib.lib diff --git a/src/WINNT/client_creds/NTMakefile b/src/WINNT/client_creds/NTMakefile index 65de6356f8..8a6e9d386f 100644 --- a/src/WINNT/client_creds/NTMakefile +++ b/src/WINNT/client_creds/NTMakefile @@ -64,7 +64,6 @@ EXELIBS = \ $(DESTDIR)\lib\afs\TaAfsAppLib.lib \ $(DESTDIR)\lib\lanahelper.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ diff --git a/src/WINNT/install/wix/files.wxi b/src/WINNT/install/wix/files.wxi index 9cc1291e84..6ca0100523 100644 --- a/src/WINNT/install/wix/files.wxi +++ b/src/WINNT/install/wix/files.wxi @@ -1403,17 +1403,12 @@ - - - - - @@ -1571,9 +1566,6 @@ - - - @@ -1651,7 +1643,6 @@ - diff --git a/src/afsd/Makefile.in b/src/afsd/Makefile.in index 1d22402848..aec07b7276 100644 --- a/src/afsd/Makefile.in +++ b/src/afsd/Makefile.in @@ -25,7 +25,7 @@ all: afsd vsys @ENABLE_FUSE_CLIENT@ # AFSLIBS=${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/util.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a -UAFSLIBS=${TOP_LIBDIR}/libuafs.a ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/libafsutil.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libafsutil.a +UAFSLIBS=${TOP_LIBDIR}/libuafs.a ${TOP_LIBDIR}/libafsutil.a ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libafsutil.a FUSE_LIBS=@FUSE_LIBS@ diff --git a/src/aklog/Makefile.in b/src/aklog/Makefile.in index 2ed130c31a..6876a09aa6 100644 --- a/src/aklog/Makefile.in +++ b/src/aklog/Makefile.in @@ -17,7 +17,7 @@ AFSLIBS = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/libubik.a ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libafsutil.a SRCS= aklog.c krb_util.c linked_list.c diff --git a/src/auth/Makefile.in b/src/auth/Makefile.in index d3b936036c..77c2141890 100644 --- a/src/auth/Makefile.in +++ b/src/auth/Makefile.in @@ -20,9 +20,12 @@ KOBJS= cellconfig.o ktc.krb.o userok.o writeconfig.o authcon.o \ acfg_errors.o ktc_errors.o token.xdr.o token.o LIBS=libauth.a \ - ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libdes.a \ - ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a + ${TOP_LIBDIR}/librxkad.a \ + ${TOP_LIBDIR}/librx.a \ + ${TOP_LIBDIR}/libsys.a \ + ${TOP_LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/util.a + INCLS=cellconfig.h auth.h keys.h KSRCS=auth.h UKSRCS=${KSRCS} cellconfig.h acfg_errors.c keys.h cellconfig.c \ diff --git a/src/auth/NTMakefile b/src/auth/NTMakefile index df3d8f3ec2..46efcbe86c 100644 --- a/src/auth/NTMakefile +++ b/src/auth/NTMakefile @@ -87,13 +87,13 @@ EXELIBDIR = $(DESTDIR)\lib EXELIBS =\ $(EXELIBDIR)\afs\afsauth.lib \ $(EXELIBDIR)\afsrxkad.lib \ - $(EXELIBDIR)\afsdes.lib \ $(EXELIBDIR)\afsrx.lib \ $(EXELIBDIR)\afslwp.lib \ $(EXELIBDIR)\afs\afsutil.lib \ $(EXELIBDIR)\afs\afseventlog.lib \ $(EXELIBDIR)\afs\afsreg.lib \ $(EXELIBDIR)\libafsconf.lib \ + $(EXELIBDIR)\afshcrypto.lib \ $(EXELIBDIR)\afsroken.lib $(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS) diff --git a/src/auth/authcon.c b/src/auth/authcon.c index 60722e6ade..e1ee955247 100644 --- a/src/auth/authcon.c +++ b/src/auth/authcon.c @@ -12,6 +12,10 @@ #include +#ifdef IGNORE_SOME_GCC_WARNINGS +# pragma GCC diagnostic warning "-Wdeprecated-declarations" +#endif + #include #include #include @@ -25,10 +29,13 @@ #endif #include #include -#include -#include + +#define HC_DEPRECATED +#include + #include #include + #include "cellconfig.h" #include "keys.h" #include "ktc.h" @@ -90,8 +97,8 @@ GenericAuth(struct afsconf_dir *adir, } /* next create random session key, using key for seed to good random */ - des_init_random_number_generator(ktc_to_cblock(&key)); - code = des_random_key(ktc_to_cblock(&session)); + DES_init_random_number_generator((DES_cblock *) &key); + code = DES_new_random_key((DES_cblock *) &session); if (code) { return QuickAuth(astr, aindex); } diff --git a/src/bozo/Makefile.in b/src/bozo/Makefile.in index 942d10ea09..8c7ad11845 100644 --- a/src/bozo/Makefile.in +++ b/src/bozo/Makefile.in @@ -25,7 +25,7 @@ INCLS=bnode.h \ ${TOP_INCDIR}/afs/ktime.h # EH 12/18/90 - have to search librx.a twice on Ultrix 4.0 -LIBS=${TOP_LIBDIR}/librx.a \ +LIBS= ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libkauth.a \ @@ -34,13 +34,13 @@ LIBS=${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxstat.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/util.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libprocmgmt.a + ${TOP_LIBDIR}/libprocmgmt.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ OBJS=bosserver.o bnode.o ezbnodeops.o fsbnodeops.o bosint.ss.o bosint.xdr.o \ bosoprocs.o cronbnodeops.o @@ -97,12 +97,12 @@ bosoprocs.o: bosoprocs.c ${INCLS} bos.o: bos.c ${INCLS} AFS_component_version_number.o bos: bos.o $(LIBS) libbos.a - $(AFS_LDRULE) bos.o libbos.a $(LIBS) $(LIB_roken) ${XLIBS} + $(AFS_LDRULE) bos.o libbos.a $(LIBS) $(LIB_roken) $(LIB_crypt) ${XLIBS} bos_util.o: bos_util.c ${INCLS} AFS_component_version_number.o ${TOP_INCDIR}/afs/bnode.h bos_util: bos_util.o $(LIBS) - $(AFS_LDRULE) bos_util.o $(LIBS) $(LIB_roken) ${XLIBS} + $(AFS_LDRULE) bos_util.o $(LIBS) $(LIB_roken) $(LIB_crypt) ${XLIBS} ezbnodeops.o: ezbnodeops.c ${INCLS} @@ -115,7 +115,7 @@ libbos.a: bosint.xdr.o bosint.cs.o boserr.o AFS_component_version_number.o bosserver: $(OBJS) $(LIBS) $(AFS_LDRULE) $(OBJS) ${TOP_LIBDIR}/libaudit.a \ - $(LIBS) $(LIB_roken) ${XLIBS} + $(LIBS) $(LIB_roken) $(LIB_crypt) ${XLIBS} # # Install targets diff --git a/src/bozo/NTMakefile b/src/bozo/NTMakefile index 61b67640b0..01df04cea0 100644 --- a/src/bozo/NTMakefile +++ b/src/bozo/NTMakefile @@ -57,7 +57,6 @@ BOSSERVER_EXELIBS =\ $(DESTDIR)\lib\afs\afsauth.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\afsrxstat.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afs\afscom_err.lib \ @@ -69,6 +68,7 @@ BOSSERVER_EXELIBS =\ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS) @@ -97,7 +97,6 @@ BOS_EXELIBS =\ $(DESTDIR)\lib\afs\afsvldb.lib \ $(DESTDIR)\lib\afs\afsauth.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afs\afscom_err.lib \ @@ -107,6 +106,7 @@ BOS_EXELIBS =\ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 527ac75c6a..7545b2d97e 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -45,8 +45,7 @@ #include #include #include -#include -#include +#include #include #include @@ -816,12 +815,12 @@ AddKey(struct cmd_syndesc *as, void *arock) strcpy(buf, as->parms[1].items->data); else { /* prompt for key */ - code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0); + code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0); if (code || strlen(buf) == 0) { fprintf(stderr, "Bad key: \n"); exit(1); } - code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0); + code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0); if (code || strlen(ver) == 0) { fprintf(stderr, "Bad key: \n"); exit(1); diff --git a/src/bozo/bos_util.c b/src/bozo/bos_util.c index 5847ab0086..e3795e5368 100644 --- a/src/bozo/bos_util.c +++ b/src/bozo/bos_util.c @@ -31,12 +31,11 @@ #include #include -#include #include #include #include -#include -#include +#include +#include int main(int argc, char **argv) @@ -76,12 +75,12 @@ main(int argc, char **argv) memset(&tkey, 0, sizeof(struct ktc_encryptionKey)); /* prompt for key */ - code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0); + code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0); if (code || strlen(buf) == 0) { printf("Bad key: \n"); exit(1); } - code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0); + code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0); if (code || strlen(ver) == 0) { printf("Bad key: \n"); exit(1); @@ -97,7 +96,7 @@ main(int argc, char **argv) exit(1); } } else if (strcmp(argv[1], "adddes") == 0) { - struct ktc_encryptionKey tkey; + DES_cblock tkey; int kvno; afs_int32 code; char buf[BUFSIZ], ver[BUFSIZ]; @@ -110,12 +109,12 @@ main(int argc, char **argv) memset(&tkey, 0, sizeof(struct ktc_encryptionKey)); /* prompt for key */ - code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0); + code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0); if (code || strlen(buf) == 0) { printf("Bad key: \n"); exit(1); } - code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0); + code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0); if (code || strlen(ver) == 0) { printf("Bad key: \n"); exit(1); @@ -124,8 +123,8 @@ main(int argc, char **argv) printf("\nInput key mismatch\n"); exit(1); } - des_string_to_key(buf, ktc_to_cblockptr(&tkey)); - code = afsconf_AddKey(tdir, kvno, ktc_to_charptr(&tkey), 0); + DES_string_to_key(buf, &tkey); + code = afsconf_AddKey(tdir, kvno, (char *) &tkey, 0); if (code) { printf("bos_util: failed to set key, code %d.\n", code); exit(1); diff --git a/src/bozo/bosoprocs.c b/src/bozo/bosoprocs.c index f8763187ec..c21d37dbe8 100644 --- a/src/bozo/bosoprocs.c +++ b/src/bozo/bosoprocs.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #ifdef HAVE_STDINT_H diff --git a/src/bucoord/Makefile.in b/src/bucoord/Makefile.in index 192b0b18bf..029335dc2d 100644 --- a/src/bucoord/Makefile.in +++ b/src/bucoord/Makefile.in @@ -19,10 +19,12 @@ LIBS=${TOP_LIBDIR}/libbudb.a ${TOP_LIBDIR}/libbubasics.a \ ${TOP_LIBDIR}/libvldb.a ${TOP_LIBDIR}/vlib.a \ ${TOP_LIBDIR}/libkauth.a ${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libdes.a \ + ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \ - ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ + ${TOP_LIBDIR}/util.a all: ${TOP_LIBDIR}/libbxdb.a ${TOP_INCDIR}/afs/bucoord_prototypes.h ${TOP_INCDIR}/afs/bc.h backup diff --git a/src/bucoord/NTMakefile b/src/bucoord/NTMakefile index c9919cb900..4c6a76c4ab 100644 --- a/src/bucoord/NTMakefile +++ b/src/bucoord/NTMakefile @@ -81,7 +81,6 @@ EXELIBS =\ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afs\afsauth.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\afs\afscmd.lib \ @@ -92,6 +91,7 @@ EXELIBS =\ $(DESTDIR)\lib\afs\afspioctl.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib diff --git a/src/budb/Makefile.in b/src/budb/Makefile.in index d094905126..d0fd89c532 100644 --- a/src/budb/Makefile.in +++ b/src/budb/Makefile.in @@ -19,7 +19,6 @@ INCLS=\ ${TOP_INCDIR}/lock.h \ ${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/lwp.h \ - ${TOP_INCDIR}/des.h \ ${TOP_INCDIR}/rx/rx.h \ ${TOP_INCDIR}/rx/xdr.h \ ${TOP_INCDIR}/rx/rxkad.h \ @@ -38,12 +37,12 @@ LIBS=${TOP_LIBDIR}/libbubasics.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a COMMON_OBJS = database.o db_alloc.o db_dump.o db_hash.o struct_ops.o ol_verify.o diff --git a/src/budb/NTMakefile b/src/budb/NTMakefile index 7b103b621e..2299d2b564 100644 --- a/src/budb/NTMakefile +++ b/src/budb/NTMakefile @@ -68,7 +68,6 @@ EXELIBS =\ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\afs\afscom_err.lib \ $(DESTDIR)\lib\afs\afsaudit.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\afs\afskauth.lib \ $(DESTDIR)\lib\afs\afsauth.lib \ @@ -80,6 +79,7 @@ EXELIBS =\ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(EXEFILE): $(EXEOBJS) $(EXELIBS) diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index cf828ae26e..17db2bd1c9 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include "budb.h" diff --git a/src/budb/procs.c b/src/budb/procs.c index 1d654356de..75b14a8236 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/src/butc/Makefile.in b/src/butc/Makefile.in index 627af86504..574f3a8187 100644 --- a/src/butc/Makefile.in +++ b/src/butc/Makefile.in @@ -40,12 +40,12 @@ LIBS=${TOP_LIBDIR}/libbudb.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/libusd.a \ ${TOP_LIBDIR}/util.a \ ${TOP_LIBDIR}/libprocmgmt.a diff --git a/src/butc/NTMakefile b/src/butc/NTMakefile index 6f65a81390..8a4c9d3555 100644 --- a/src/butc/NTMakefile +++ b/src/butc/NTMakefile @@ -42,7 +42,6 @@ EXELIBS =\ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afs\afsauth.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\afs\afscmd.lib \ @@ -54,6 +53,7 @@ EXELIBS =\ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(EXERES): butc.rc AFS_component_version_number.h diff --git a/src/config/NTMakefile b/src/config/NTMakefile index 0cd76ba49e..58e2b1a98b 100644 --- a/src/config/NTMakefile +++ b/src/config/NTMakefile @@ -88,12 +88,6 @@ idirs: doclink ! IF (!EXIST($(OJT)\crypto\hcrypto)) $(MKDIR) $(OJT)\crypto\hcrypto ! ENDIF -! IF (!EXIST($(OJT)\des)) - $(MKDIR) $(OJT)\des -! ENDIF -! IF (!EXIST($(OJT)\des\test)) - $(MKDIR) $(OJT)\des\test -! ENDIF ! IF (!EXIST($(OJT)\dir)) $(MKDIR) $(OJT)\dir ! ENDIF @@ -424,9 +418,6 @@ idirs: doclink ! IF (!EXIST($(DESTDIR)\include\afs)) $(MKDIR) $(DESTDIR)\include\afs ! ENDIF -! IF (!EXIST($(DESTDIR)\include\des)) - $(MKDIR) $(DESTDIR)\include\des -! ENDIF ! IF (!EXIST($(DESTDIR)\include\hcrypto)) $(MKDIR) $(DESTDIR)\include\hcrypto ! ENDIF diff --git a/src/crypto/hcrypto/afshcrypto.def b/src/crypto/hcrypto/afshcrypto.def index ed4c921f8d..00df6ba6e4 100644 --- a/src/crypto/hcrypto/afshcrypto.def +++ b/src/crypto/hcrypto/afshcrypto.def @@ -15,3 +15,5 @@ EXPORTS hc_MD5_Init @14 hc_MD5_Update @15 hc_UI_UTIL_read_pw_string @16 + hc_DES_is_weak_key @17 + hc_DES_check_key_parity @18 diff --git a/src/des/.gitignore b/src/des/.gitignore deleted file mode 100644 index 95d09abb33..0000000000 --- a/src/des/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# After changing this file, please run -# git ls-files -i --exclude-standard -# to check that you haven't inadvertently ignored any tracked files. - -/fp.c -/ip.c -/key_perm.h -/make_fp -/make_ip -/make_keyperm -/make_odd -/make_p -/make_p_table -/make_s_table -/odd.h -/p.c -/p_table.h -/s_table.h -/s.c diff --git a/src/des/Makefile.in b/src/des/Makefile.in deleted file mode 100644 index 0d1aa8263a..0000000000 --- a/src/des/Makefile.in +++ /dev/null @@ -1,235 +0,0 @@ -# -# Copyright 1987 by the Massachusetts Institute of Technology. -# -# For copying and distribution information, -# please see the file . -# -# Makefile for BSD DES library -# -# First define machine type, compiler, and object file suffix -# Could be for VAX or PC-DOS -# -# Some of these files are cross compiled on the vax for the pc8086, -# using the MIT LCS cross-compilation environment -# Others are always executed on the vax(host). -# -# A machine, e.g. Vax, pc8086, IBM experimental workstation, is -# described in terms of defines for its word length -# (BITS32 or BITS16), byte ordering (LSBFIRST or MSBFIRST) and -# operating system (BSDUNIX or CROSSMSDOS). -# -# Make sure these are properly defined for any new machine types. -# target machine for run-time code (may cross-compile), -# override as needed - -srcdir=@srcdir@ -include @TOP_OBJDIR@/src/config/Makefile.config -include @TOP_OBJDIR@/src/config/Makefile.lwp - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ - -OBJS = \ - des.o \ - cbc_encrypt.o \ - pcbc_encrypt.o \ - cksum.o \ - new_rnd_key.o \ - key_sched.o \ - debug_decl.o \ - quad_cksum.o \ - key_parity.o \ - weak_key.o \ - read_pssword.o \ - strng_to_key.o \ - misc.o \ - crypt.o \ - util.o - -all: \ - ${TOP_LIBDIR}/libdes.a \ - ${TOP_INCDIR}/des.h \ - ${TOP_INCDIR}/des_prototypes.h \ - ${TOP_INCDIR}/des_conf.h \ - ${TOP_INCDIR}/mit-cpyright.h \ - ${TOP_INCDIR}/des_odd.h - -buildtools: \ - make_p \ - make_keyperm \ - make_s_table \ - make_p_table \ - make_ip \ - make_fp \ - make_odd \ - ${TOP_INCDIR}/des.h \ - ${TOP_INCDIR}/mit-cpyright.h \ - -generated: \ - p.c \ - key_perm.h \ - s_table.h \ - p_table.h \ - ip.c \ - fp.c \ - odd.h - -${TOP_LIBDIR}/libdes.a: libdes.a - ${INSTALL_DATA} $? $@ - -${TOP_INCDIR}/des.h: des.h - ${INSTALL_DATA} $? $@ - -${TOP_INCDIR}/des_prototypes.h: des_prototypes.h - ${INSTALL_DATA} $? $@ - -${TOP_INCDIR}/des_conf.h: des_conf.h - ${INSTALL_DATA} $? $@ - -${TOP_INCDIR}/mit-cpyright.h: mit-cpyright.h - ${INSTALL_DATA} $? $@ - -${TOP_INCDIR}/des_odd.h: odd.h - ${INSTALL_DATA} $? $@ - -# -# Build rules -# -libdes.a: ${OBJS} AFS_component_version_number.o - $(RM) -f libdes.a - $(AR) crv libdes.a ${OBJS} AFS_component_version_number.o - $(RANLIB) libdes.a - -make_ip: make_ip.o misc.o main.o - $(AFS_LDRULE) make_ip.o misc.o main.o - -make_fp: make_fp.o misc.o main.o - $(AFS_LDRULE) make_fp.o misc.o main.o - -make_odd: make_odd.o misc.o main.o - $(AFS_LDRULE) make_odd.o misc.o main.o - -make_s_table: make_s_table.o misc.o main.o - $(AFS_LDRULE) make_s_table.o misc.o main.o - -make_p_table: make_p_table.o misc.o main.o - $(AFS_LDRULE) make_p_table.o misc.o main.o - -make_keyperm: make_keyperm.o misc.o main.o - $(AFS_LDRULE) make_keyperm.o misc.o main.o - -make_e: make_e.o misc.o main.o - $(AFS_LDRULE) make_e.o misc.o main.o - -make_p: make_p.o misc.o main.o - $(AFS_LDRULE) make_p.o misc.o main.o - -make_s: make_s.o misc.o main.o - $(AFS_LDRULE) make_s.o misc.o main.o - -crypt.o: ${srcdir}/crypt.c - case ${SYS_NAME} in \ - rs_aix*)\ - ${CCOBJ} -c ${COMMON_INCL} -o crypt.o ${srcdir}/crypt.c ;;\ - *)\ - $(AFS_CCRULE) ${srcdir}/crypt.c ;;\ - esac -# -# Table/code generation targets -# -odd.h: make_odd - ./make_odd odd.h - -s_table.h: make_s_table - ./make_s_table s_table.h - -p_table.h: make_p_table - ./make_p_table p_table.h - -key_perm.h: make_keyperm - ./make_keyperm key_perm.h - -ip.c: make_ip - ./make_ip ip.c - -p.c: make_p - ./make_p p.c - -s.c: make_s - ./make_s s.c - -fp.c: make_fp - ./make_fp fp.c - -# -# Dependency rules -# -INCLS=des.h des_prototypes.h mit-cpyright.h des_conf.h des_internal.h conf.h - -make_keyperm.o: make_keyperm.c ${INCLS} -make_ip.o: make_ip.c tables.h ${INCLS} -make_fp.o: make_fp.c tables.h ${INCLS} -make_p.o: make_p.c tables.h ${INCLS} -make_s.o: make_s.c s_table.h ${INCLS} -make_s_table.o: make_s_table.c tables.h ${INCLS} -make_p_table.o: make_p_table.c tables.h ${INCLS} -make_odd.o: make_odd.c ${INCLS} -misc.o: misc.c AFS_component_version_number.c ${INCLS} -main.o: main.c AFS_component_version_number.c ${INCLS} -key_sched.o: key_sched.c key_perm.h odd.h ${INCLS} -key_test.o: key_test.c ${INCLS} -testit.o: testit.c ${INCLS} -des.o: s_table.h p_table.h ip.c p.c fp.c ${INCLS} -cbc_encrypt.o: cbc_encrypt.c ${INCLS} -verify.o: verify.c ${INCLS} -read_pssword.o: read_pssword.c ${INCLS} -pcbc_encrypt.o: pcbc_encrypt.c ${INCLS} -cksum.o: cksum.c ${INCLS} -quad_cksum.o: quad_cksum.c ${INCLS} -key_parity.o: key_parity.c odd.h ${INCLS} -weak_key.o: weak_key.c ${INCLS} -new_rnd_key.o: new_rnd_key.c ${INCLS} -util.o: util.c ${INCLS} -strng_to_key.o: strng_to_key.c ${INCLS} -debug_decl.o: debug_decl.c ${INCLS} -make_e.o: make_e.c ${INCLS} - -# -# Install targets -# -install: libdes.a des.h des_prototypes.h des_conf.h mit-cpyright.h odd.h - ${INSTALL} -d ${DESTDIR}${libdir} - ${INSTALL} -d ${DESTDIR}${includedir} - ${INSTALL_DATA} libdes.a ${DESTDIR}${libdir}/libdes.a - ${INSTALL_DATA} ${srcdir}/des.h ${DESTDIR}${includedir}/des.h - ${INSTALL_DATA} ${srcdir}/des_prototypes.h ${DESTDIR}${includedir}/des_prototypes.h - ${INSTALL_DATA} ${srcdir}/des_conf.h ${DESTDIR}${includedir}/des_conf.h - ${INSTALL_DATA} ${srcdir}/mit-cpyright.h ${DESTDIR}${includedir}/mit-cpyright.h - ${INSTALL_DATA} odd.h ${DESTDIR}${includedir}/des_odd.h - -dest: libdes.a des.h des_prototypes.h des_conf.h mit-cpyright.h odd.h - ${INSTALL} -d ${DEST}/lib - ${INSTALL} -d ${DEST}/include - ${INSTALL_DATA} libdes.a ${DEST}/lib/libdes.a - ${INSTALL_DATA} ${srcdir}/des.h ${DEST}/include/des.h - ${INSTALL_DATA} ${srcdir}/des_prototypes.h ${DEST}/include/des_prototypes.h - ${INSTALL_DATA} ${srcdir}/des_conf.h ${DEST}/include/des_conf.h - ${INSTALL_DATA} ${srcdir}/mit-cpyright.h ${DEST}/include/mit-cpyright.h - ${INSTALL_DATA} odd.h ${DEST}/include/des_odd.h - -# -# Misc. targets -# -test: libdes.a - cd test; $(MAKE) - -clean: - $(RM) -f *.a *.s *.o *.b core *~ *.com *.ld - $(RM) -f make_fp make_ip make_keyperm make_odd make_p \ - make_p_table make_s_table key_perm.h p_table.h \ - s_table.h odd.h p.c s.c fp.c ip.c AFS_component_version_number.c - cd test; $(MAKE) clean - -include ../config/Makefile.version diff --git a/src/des/NTMakefile b/src/des/NTMakefile deleted file mode 100644 index 93cba99282..0000000000 --- a/src/des/NTMakefile +++ /dev/null @@ -1,184 +0,0 @@ -# -# Copyright 1987 by the Massachusetts Institute of Technology. -# -# For copying and distribution information, -# please see the file . -# -# Makefile for BSD DES library -# -# First define machine type, compiler, and object file suffix -# Could be for VAX or PC-DOS -# -# Some of these files are cross compiled on the vax for the pc8086, -# using the MIT LCS cross-compilation environment -# Others are always executed on the vax(host). -# -# A machine, e.g. Vax, pc8086, IBM experimental workstation, is -# described in terms of defines for its word length -# (BITS32 or BITS16), byte ordering (LSBFIRST or MSBFIRST) and -# operating system (BSDUNIX or CROSSMSDOS). -# -# Make sure these are properly defined for any new machine types. -# target machine for run-time code (may cross-compile), -# override as needed -# - -RELDIR=des -!INCLUDE ..\config\NTMakefile.$(SYS_NAME) -!INCLUDE ..\config\NTMakefile.version - -INCFILEDIR = $(DESTDIR)\include - -INCFILES =\ - $(INCFILEDIR)\des.h \ - $(INCFILEDIR)\des_conf.h \ - $(INCFILEDIR)\des_prototypes.h \ - $(INCFILEDIR)\mit-cpyright.h \ - $(INCFILEDIR)\des_odd.h \ - $(INCFILEDIR)\crypt.h - -$(INCFILEDIR)\des_odd.h: odd.h - $(COPY) odd.h $@ - -# Library component lists. - -LIBOBJS = \ - $(OUT)\des.obj \ - $(OUT)\cbc_encrypt.obj \ - $(OUT)\pcbc_encrypt.obj \ - $(OUT)\cksum.obj \ - $(OUT)\new_rnd_key.obj \ - $(OUT)\key_sched.obj \ - $(OUT)\debug_decl.obj \ - $(OUT)\quad_cksum.obj \ - $(OUT)\key_parity.obj \ - $(OUT)\weak_key.obj \ - $(OUT)\read_pssword.obj \ - $(OUT)\strng_to_key.obj \ - $(OUT)\misc.obj \ - $(OUT)\util.obj \ - $(OUT)\crypt.obj - -$(LIBOBJS): $$(@B).c - $(C2OBJ) $** - -LIBFILE = $(DESTDIR)\lib\afsdes.lib - -$(LIBFILE): $(LIBOBJS) - $(LIBARCH) - -##################### -# Generator Files ### -##################### - -GENERATED_FILES = \ - $(VERSFILE).c \ - key_perm.h \ - p_table.h \ - s_table.h \ - odd.h \ - p.c \ - s.c \ - fp.c \ - ip.c - -# Make generated files. -MAKETARG = $** $@ - -key_perm.h: $(OUT)\make_keyperm.exe - $(MAKETARG) - -p_table.h: $(OUT)\make_p_table.exe - $(MAKETARG) - -s_table.h: $(OUT)\make_s_table.exe - $(MAKETARG) - -odd.h: $(OUT)\make_odd.exe - $(MAKETARG) - -p.c: $(OUT)\make_p.exe - $(MAKETARG) - -s.c: $(OUT)\make_s.exe - $(MAKETARG) - -fp.c: $(OUT)\make_fp.exe - $(MAKETARG) - -ip.c: $(OUT)\make_ip.exe - $(MAKETARG) - -# Make generators. -$(OUT)\main.obj: main.c - $(C2OBJ) $** - -$(OUT)\make_keyperm.exe: $(OUT)\make_keyperm.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_p_table.exe: $(OUT)\make_p_table.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_s_table.exe: $(OUT)\make_s_table.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_odd.exe: $(OUT)\make_odd.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_p.exe: $(OUT)\make_p.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_s.exe: $(OUT)\make_s.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_fp.exe: $(OUT)\make_fp.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -$(OUT)\make_ip.exe: $(OUT)\make_ip.obj $(OUT)\misc.obj $(OUT)\main.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -GENOBJS = $(OUT)\make_keyperm.obj \ - $(OUT)\make_p_table.obj \ - $(OUT)\make_s_table.obj \ - $(OUT)\make_odd.obj \ - $(OUT)\make_p.obj \ - $(OUT)\make_s.obj \ - $(OUT)\make_fp.obj \ - $(OUT)\make_ip.obj - -$(GENOBJS): $$(@B).c - $(C2OBJ) $** - -install: $(GENERATED_FILES) $(LIBFILE) $(INCFILES) - -install9x: install - -clean:: - $(DEL) $(LIBFILE) $(GENERATED_FILES) - -mkdir: - diff --git a/src/des/READ_ME b/src/des/READ_ME deleted file mode 100644 index 0228da44c2..0000000000 --- a/src/des/READ_ME +++ /dev/null @@ -1,21 +0,0 @@ -This directory contains the sources for the DES encryption library and -test programs. - -Two precautions-- - -1) under US law, DES software and hardware may not be - exported without license from the US Dept of Commerce. - -2) The only way to get a significant speedup of the algorithm is to - use considerably more space, traded against time. Dont play - with the code -- there is a high probability you will either - make it slower, or wrong, or both. This implementation was - optimized for the UVAX 2. Other architectures could benefit from - some "asm" tweaking. - -3) If you do play with the code, make sure that the test program - "verify" still yields the expected answers. Otherwise, your - ciphertext will not decrypt under a standard implementation, such - as on the VLSI chips that have been certified. - - Project Athena Steve Miller 3/86 diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h deleted file mode 100644 index 3469e2bccb..0000000000 --- a/src/des/andrew-conf.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Andrew configuration. - */ - -#ifdef vax -#include "conf-bsdvax.h" -#else -#if mips && !defined(sgi) -#include "conf-mips.h" -#else -#if defined(sun) && !defined(AFS_X86_ENV) -#include "conf-bsd-sun.h" -#else -#ifdef AFS_AIX_ENV -#include "conf-aix-ibm.h" -#else -#ifdef mac2 -#include "conf-bsd-mac.h" -#else -#ifdef AFS_HPUX_ENV -#ifdef hp9000s300 -#include "conf-hp9000s300.h" -#else -#include "conf-hp9000s700.h" -#endif -#else -#ifdef NeXT -#include "conf-next.h" -#else -#if defined(sgi) -#include "conf-sgi.h" -#else -#ifdef AFS_OSF_ENV -#if defined(__alpha) -#include "conf-bsd-alpha.h" -#else -#error unknown osf -#endif -#else -#if defined(AFS_X86_ENV) && !defined(AFS_DARWIN_ENV) -#include "conf-bsd-ncr.h" -#else -#ifdef AFS_NT40_ENV -#include "conf-winnt.h" -#else - -#ifdef AFS_XBSD_ENV -#ifdef AFS_X86_XBSD_ENV -#include "conf-i386-obsd.h" -#elif defined(AFS_ALPHA_ENV) -#include "conf-alpha-bsd.h" -#else -#error unknown bsd -#endif -#else /* AFS_XBSD_ENV */ - -#if defined(AFS_LINUX20_ENV) -#ifdef AFS_PARISC_LINUX20_ENV -#include "conf-parisc-linux.h" -#else -#ifdef AFS_PPC_LINUX20_ENV -#include "conf-ppc-linux.h" -#else -#ifdef AFS_SPARC_LINUX20_ENV -#include "conf-sparc-linux.h" -#else -#ifdef AFS_SPARC64_LINUX20_ENV -#include "conf-sparc64-linux.h" -#else -#ifdef AFS_S390_LINUX20_ENV -#include "conf-s390-linux.h" -#else -#ifdef AFS_ALPHA_LINUX20_ENV -#include "conf-alpha-linux.h" -#else -#ifdef AFS_IA64_LINUX20_ENV -#include "conf-ia64-linux.h" -#else -#ifdef AFS_AMD64_LINUX20_ENV -#include "conf-amd64-linux.h" -#else -#ifdef AFS_PPC64_LINUX20_ENV -#include "conf-ppc64-linux.h" -#else -#ifdef AFS_ARM_LINUX20_ENV -#include "conf-arm-linux.h" -#else -#include "conf-i386-linux.h" -#endif /* AFS_ARM_LINUX20_ENV */ -#endif /* AFS_PPC64_LINUX20_ENV */ -#endif /* AFS_AMD64_LINUX20_ENV */ -#endif /* AFS_IA64_LINUX20_ENV */ -#endif /* AFS_ALPHA_LINUX20_ENV */ -#endif /* AFS_S390_LINUX20_ENV */ -#endif /* AFS_SPARC64_LINUX20_ENV */ -#endif /* AFS_SPARC_LINUX20_ENV */ -#endif /* AFS_PPC_LINUX20_ENV */ -#endif /* AFS_PARISC_LINUX24_ENV */ -#else -#if defined(AFS_DARWIN_ENV) -#include "conf-darwin.h" -#else -Sorry, - you lose. - Figure out what the machine looks like and fix this file to include it. -#endif -#endif /* AFS_LINUX20_ENV */ -#endif /* AFS_NT40_ENV */ -#endif /* AFS_XBSD_ENV */ -#endif /* NCR || X86 */ -#endif /* __alpha */ -#endif /* SGI */ -#endif /* NeXT */ -#endif /* HP/UX */ -#endif /* mac */ -#endif /* aix */ -#endif /* sun */ -#endif /* mips */ -#endif /* not vax */ diff --git a/src/des/cbc_encrypt.c b/src/des/cbc_encrypt.c deleted file mode 100644 index 1f0d11a585..0000000000 --- a/src/des/cbc_encrypt.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * These routines perform encryption and decryption using the DES - * private key algorithm, or else a subset of it -- fewer inner loops. - * (AUTH_DES_ITER defaults to 16, may be less.) - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * These routines form the library interface to the DES facilities. - * - * Originally written 8/85 by Steve Miller, MIT Project Athena. - */ - -#include "mit-cpyright.h" -#include -#include - -#ifndef KERNEL -#include -#endif - -#include "des.h" -#include "des_prototypes.h" - - - -#define XPRT_CBC_ENCRYPT - -/* - * This routine performs DES cipher-block-chaining operation, either - * encrypting from cleartext to ciphertext, if encrypt != 0 or - * decrypting from ciphertext to cleartext, if encrypt == 0. - * - * The key schedule is passed as an arg, as well as the cleartext or - * ciphertext. The cleartext and ciphertext should be in host order. - * - * NOTE-- the output is ALWAYS an multiple of 8 bytes long. If not - * enough space was provided, your program will get trashed. - * - * For encryption, the cleartext string is null padded, at the end, to - * an integral multiple of eight bytes. - * - * For decryption, the ciphertext will be used in integral multiples - * of 8 bytes, but only the first "length" bytes returned into the - * cleartext. - */ -/* - des_cblock *in; * >= length bytes of input text * - des_cblock *out; * >= length bytes of output text * - afs_int32 length; * in bytes * - int encrypt; * 0 ==> decrypt, else encrypt * - des_key_schedule key; * precomputed key schedule * - des_cblock *iv; * 8 bytes of ivec * -*/ -afs_int32 -des_cbc_encrypt(void * in, void * out, afs_int32 length, - des_key_schedule key, des_cblock * iv, int encrypt) -{ - afs_uint32 *input = (afs_uint32 *) in; - afs_uint32 *output = (afs_uint32 *) out; - afs_uint32 *ivec = (afs_uint32 *) iv; - - afs_uint32 i, j; - afs_uint32 t_input[2]; - afs_uint32 t_output[2]; - unsigned char *t_in_p = (unsigned char *)t_input; - afs_uint32 xor_0, xor_1; - - if (encrypt) { -#ifdef MUSTALIGN - if ((afs_int32) ivec & 3) { - memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); - memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); - } else -#endif - { - t_output[0] = *ivec++; - t_output[1] = *ivec; - } - - for (i = 0; length > 0; i++, length -= 8) { - /* get input */ -#ifdef MUSTALIGN - if ((afs_int32) input & 3) { - memcpy((char *)&t_input[0], (char *)input++, - sizeof(t_input[0])); - memcpy((char *)&t_input[1], (char *)input++, - sizeof(t_input[1])); - } else -#endif - { - t_input[0] = *input++; - t_input[1] = *input++; - } - - /* zero pad */ - if (length < 8) - for (j = length; j <= 7; j++) - *(t_in_p + j) = 0; - -#ifdef DEBUG - if (des_debug) - des_debug_print("clear", length, t_input[0], t_input[1]); -#endif - /* do the xor for cbc into the temp */ - t_input[0] ^= t_output[0]; - t_input[1] ^= t_output[1]; - /* encrypt */ - (void)des_ecb_encrypt(t_input, t_output, key, encrypt); - /* copy temp output and save it for cbc */ -#ifdef MUSTALIGN - if ((afs_int32) output & 3) { - memcpy((char *)output++, (char *)&t_output[0], - sizeof(t_output[0])); - memcpy((char *)output++, (char *)&t_output[1], - sizeof(t_output[1])); - } else -#endif - { - *output++ = t_output[0]; - *output++ = t_output[1]; - } - -#ifdef DEBUG - if (des_debug) { - des_debug_print("xor'ed", i, t_input[0], t_input[1]); - des_debug_print("cipher", i, t_output[0], t_output[1]); - } -#endif - } - return 0; - } - - else { - /* decrypt */ -#ifdef MUSTALIGN - if ((afs_int32) ivec & 3) { - memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); - memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); - } else -#endif - { - xor_0 = *ivec++; - xor_1 = *ivec; - } - - for (i = 0; length > 0; i++, length -= 8) { - /* get input */ -#ifdef MUSTALIGN - if ((afs_int32) input & 3) { - memcpy((char *)&t_input[0], (char *)input++, - sizeof(t_input[0])); - memcpy((char *)&t_input[1], (char *)input++, - sizeof(t_input[0])); - } else -#endif - { - t_input[0] = *input++; - t_input[1] = *input++; - } - - /* no padding for decrypt */ -#ifdef DEBUG - if (des_debug) - des_debug_print("cipher", i, t_input[0], t_input[1]); -#else -#ifdef lint - i = i; -#endif -#endif - /* encrypt */ - (void)des_ecb_encrypt(t_input, t_output, key, encrypt); -#ifdef DEBUG - if (des_debug) - des_debug_print("out pre xor", i, t_output[0], t_output[1]); -#endif - /* do the xor for cbc into the output */ - t_output[0] ^= xor_0; - t_output[1] ^= xor_1; - /* copy temp output */ -#ifdef MUSTALIGN - if ((afs_int32) output & 3) { - memcpy((char *)output++, (char *)&t_output[0], - sizeof(t_output[0])); - memcpy((char *)output++, (char *)&t_output[1], - sizeof(t_output[1])); - } else -#endif - { - *output++ = t_output[0]; - *output++ = t_output[1]; - } - - /* save xor value for next round */ - xor_0 = t_input[0]; - xor_1 = t_input[1]; -#ifdef DEBUG - if (des_debug) - des_debug_print("clear", i, t_output[0], t_output[1]); -#endif - } - return 0; - } -} diff --git a/src/des/cksum.c b/src/des/cksum.c deleted file mode 100644 index 00a5a89ccc..0000000000 --- a/src/des/cksum.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * These routines perform encryption and decryption using the DES - * private key algorithm, or else a subset of it-- fewer inner loops. - * (AUTH_DES_ITER defaults to 16, may be less.) - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * These routines form the library interface to the DES facilities. - * - * spm 8/85 MIT project athena - */ - -#include -#include - - -#include "mit-cpyright.h" -#ifndef KERNEL -#include -#endif -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#define XPRT_CKSUM - -/* - * This routine performs DES cipher-block-chaining checksum operation, - * a.k.a. Message Authentication Code. It ALWAYS encrypts from input - * to a single 64 bit output MAC checksum. - * - * The key schedule is passed as an arg, as well as the cleartext or - * ciphertext. The cleartext and ciphertext should be in host order. - * - * NOTE-- the output is ALWAYS 8 bytes long. If not enough space was - * provided, your program will get trashed. - * - * The input is null padded, at the end (highest addr), to an integral - * multiple of eight bytes. - */ -/* - des_cblock *in; * >= length bytes of inputtext * - des_cblock *out; * >= length bytes of outputtext * - afs_int32 length; * in bytes * - des_key_schedule key; * precomputed key schedule * - des_cblock *iv; * 8 bytes of ivec * -*/ - -afs_uint32 -des_cbc_cksum(des_cblock * in, des_cblock * out, afs_int32 length, - des_key_schedule key, des_cblock * iv) -{ - afs_uint32 *input = (afs_uint32 *) in; - afs_uint32 *output = (afs_uint32 *) out; - afs_uint32 *ivec = (afs_uint32 *) iv; - - afs_uint32 i, j; - afs_uint32 t_input[2]; - afs_uint32 t_output[8]; - unsigned char *t_in_p = (unsigned char *)t_input; - -#ifdef MUSTALIGN - if (afs_pointer_to_int(ivec) & 3) { - memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); - memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); - } else -#endif - { - t_output[0] = *ivec++; - t_output[1] = *ivec; - } - - for (i = 0; length > 0; i++, length -= 8) { - /* get input */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(input) & 3) { - memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); - memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); - } else -#endif - { - t_input[0] = *input++; - t_input[1] = *input++; - } - - /* zero pad */ - if (length < 8) - for (j = length; j <= 7; j++) - *(t_in_p + j) = 0; - -#ifdef DEBUG - if (des_debug) - des_debug_print("clear", length, t_input[0], t_input[1]); -#endif - /* do the xor for cbc into the temp */ - t_input[0] ^= t_output[0]; - t_input[1] ^= t_output[1]; - /* encrypt */ - (void)des_ecb_encrypt(t_input, t_output, key, 1); -#ifdef DEBUG - if (des_debug) { - des_debug_print("xor'ed", i, t_input[0], t_input[1]); - des_debug_print("cipher", i, t_output[0], t_output[1]); - } -#else -#ifdef lint - i = i; -#endif -#endif - } - /* copy temp output and save it for checksum */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(output) & 3) { - memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); - memcpy((char *)output, (char *)&t_output[1], sizeof(t_output[1])); - } else -#endif - { - *output++ = t_output[0]; - *output = t_output[1]; - } - - return (afs_uint32) t_output[1]; -} diff --git a/src/des/conf-aix-ibm.h b/src/des/conf-aix-ibm.h deleted file mode 100644 index 3f53d7d783..0000000000 --- a/src/des/conf-aix-ibm.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: IBM AIX 2.2.1 (RT/PC) - */ - -#include - -/* WARNING: This is currently identical to conf-bsd-ibm032.h and should probably change for AIX!! */ -#define BSDUNIX /* This screwes us up in read_pssword */ -#define IBMWS -#define IBMWSASM -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-alpha-bsd.h b/src/des/conf-alpha-bsd.h deleted file mode 100644 index d40cdefd4d..0000000000 --- a/src/des/conf-alpha-bsd.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Alpha - */ - -#include - -#define ALPHA - -/* 'course this is a joke, but I am not going to rewrite this mess */ -#define BITS32 - -#define BIG -#define LSBFIRST -#define BSDUNIX -#define MUSTALIGN diff --git a/src/des/conf-alpha-linux.h b/src/des/conf-alpha-linux.h deleted file mode 100644 index 5246e0d4d4..0000000000 --- a/src/des/conf-alpha-linux.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Alpha - */ - -#include - -#define ALPHA - -/* 'course this is a joke, but I am not going to rewrite this mess */ -#define BITS32 - -#define BIG -#define LSBFIRST diff --git a/src/des/conf-amd64-linux.h b/src/des/conf-amd64-linux.h deleted file mode 100644 index 8118f4cf12..0000000000 --- a/src/des/conf-amd64-linux.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - */ - -#include - -#define BITS32 -#define BIG -#define LSBFIRST diff --git a/src/des/conf-arm-linux.h b/src/des/conf-arm-linux.h deleted file mode 100644 index 66f80b611f..0000000000 --- a/src/des/conf-arm-linux.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Linux on Intel - */ - -#include - -#define BITS32 -#define BIG -#define LSBFIRST diff --git a/src/des/conf-bsd-alpha.h b/src/des/conf-bsd-alpha.h deleted file mode 100644 index 635cd83e5f..0000000000 --- a/src/des/conf-bsd-alpha.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Alpha - */ - -#include - -#define ALPHA - -/* 'course this is a joke, but I am not going to rewrite this mess */ -#define BITS32 - -#define BIG -#define LSBFIRST -#define BSDUNIX diff --git a/src/des/conf-bsd-i32.h b/src/des/conf-bsd-i32.h deleted file mode 100644 index d8f4462464..0000000000 --- a/src/des/conf-bsd-i32.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: IBM 032 (RT/PC) - */ - -#include - -#define BSDUNIX -#define IBMWS -#define IBMWSASM -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-bsd-ncr.h b/src/des/conf-bsd-ncr.h deleted file mode 100644 index 59b93ffeb7..0000000000 --- a/src/des/conf-bsd-ncr.h +++ /dev/null @@ -1,5 +0,0 @@ -#define BITS32 -#define BIG -#define BSDUNIX -#define LSBFIRST -/*#define MUSTALIGN*/ diff --git a/src/des/conf-bsd-sun.h b/src/des/conf-bsd-sun.h deleted file mode 100644 index 973542e179..0000000000 --- a/src/des/conf-bsd-sun.h +++ /dev/null @@ -1,5 +0,0 @@ -#define BITS32 -#define BIG -#define BSDUNIX -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-bsdvax.h b/src/des/conf-bsdvax.h deleted file mode 100644 index 16d10fd9be..0000000000 --- a/src/des/conf-bsdvax.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: VAX - */ - -#include - -#define VAX -#define BITS32 -#define BIG -#define LSBFIRST -#define BSDUNIX - -#ifndef __STDC__ -#ifndef NOASM -#define VAXASM -#endif /* no assembly */ -#endif /* standard C */ diff --git a/src/des/conf-darwin.h b/src/des/conf-darwin.h deleted file mode 100644 index bad6006af5..0000000000 --- a/src/des/conf-darwin.h +++ /dev/null @@ -1,16 +0,0 @@ -#define BITS32 -#define BIG -#undef BSDUNIX -#if defined(__ppc__) || defined(__ppc64__) -#define MSBFIRST -#elif defined(__i386__) || defined(__amd64__) || defined(__arm__) -#define LSBFIRST -#else -#error "MSBFIRST or LSBFIRST undefined" -#endif -#define MUSTALIGN -#if !defined(KERNEL) && defined(AFS_DARWIN80_ENV) -extern int _darwin_swap_long_bytes_bit_number(afs_uint32 x); -extern char *_darwin_whichstr[]; -extern int _darwin_which; -#endif /* !KERNEL && AFS_DARWIN80_ENV */ diff --git a/src/des/conf-hp9000s300.h b/src/des/conf-hp9000s300.h deleted file mode 100644 index 7a03bacab4..0000000000 --- a/src/des/conf-hp9000s300.h +++ /dev/null @@ -1,5 +0,0 @@ -#define BITS32 -#define BIG -#define MSBFIRST -#define BSDUNIX -#define MUSTALIGN diff --git a/src/des/conf-hp9000s700.h b/src/des/conf-hp9000s700.h deleted file mode 100644 index 7a03bacab4..0000000000 --- a/src/des/conf-hp9000s700.h +++ /dev/null @@ -1,5 +0,0 @@ -#define BITS32 -#define BIG -#define MSBFIRST -#define BSDUNIX -#define MUSTALIGN diff --git a/src/des/conf-hp9000s800.h b/src/des/conf-hp9000s800.h deleted file mode 100644 index 4f0d7a19d7..0000000000 --- a/src/des/conf-hp9000s800.h +++ /dev/null @@ -1,4 +0,0 @@ -#define BITS32 -#define BIG -#define MSBFIRST -#define BSDUNIX diff --git a/src/des/conf-i386-linux.h b/src/des/conf-i386-linux.h deleted file mode 100644 index 66f80b611f..0000000000 --- a/src/des/conf-i386-linux.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Linux on Intel - */ - -#include - -#define BITS32 -#define BIG -#define LSBFIRST diff --git a/src/des/conf-i386-obsd.h b/src/des/conf-i386-obsd.h deleted file mode 100644 index 1fc9f96ae6..0000000000 --- a/src/des/conf-i386-obsd.h +++ /dev/null @@ -1,5 +0,0 @@ -#define NOASM -#define BITS32 -#define BIG -#define BSDUNIX -#define LSBFIRST diff --git a/src/des/conf-ia64-linux.h b/src/des/conf-ia64-linux.h deleted file mode 100644 index 8118f4cf12..0000000000 --- a/src/des/conf-ia64-linux.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - */ - -#include - -#define BITS32 -#define BIG -#define LSBFIRST diff --git a/src/des/conf-ibm370.h b/src/des/conf-ibm370.h deleted file mode 100644 index 270a339b7e..0000000000 --- a/src/des/conf-ibm370.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: IBM 370 - */ - -#include - -/* What else? */ -#define BIG -#define NONASCII -#define SHORTNAMES diff --git a/src/des/conf-mips.h b/src/des/conf-mips.h deleted file mode 100644 index a95d06565b..0000000000 --- a/src/des/conf-mips.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: MIPS - */ - -#include - -#define MIPS -#define BITS32 -#define BIG -#define LSBFIRST -#define BSDUNIX -#define MUSTALIGN diff --git a/src/des/conf-next.h b/src/des/conf-next.h deleted file mode 100644 index 042a9482fb..0000000000 --- a/src/des/conf-next.h +++ /dev/null @@ -1,10 +0,0 @@ -/* -** Institutional File System Project -** University of Michigan -** -*/ -#define BITS32 -#define BIG -#define BSDUNIX -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-parisc-linux.h b/src/des/conf-parisc-linux.h deleted file mode 100644 index 3d29372929..0000000000 --- a/src/des/conf-parisc-linux.h +++ /dev/null @@ -1,4 +0,0 @@ -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-pc.h b/src/des/conf-pc.h deleted file mode 100644 index d78cca0ae4..0000000000 --- a/src/des/conf-pc.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: IBM PC 8086 - */ - -#include - -#define IBMPC -#define BITS16 -#define CROSSMSDOS -#define LSBFIRST diff --git a/src/des/conf-ppc-darwin.h b/src/des/conf-ppc-darwin.h deleted file mode 100644 index 9121d2b1b6..0000000000 --- a/src/des/conf-ppc-darwin.h +++ /dev/null @@ -1,5 +0,0 @@ -#define BITS32 -#define BIG -#undef BSDUNIX -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-ppc-linux.h b/src/des/conf-ppc-linux.h deleted file mode 100644 index 3d29372929..0000000000 --- a/src/des/conf-ppc-linux.h +++ /dev/null @@ -1,4 +0,0 @@ -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-ppc64-linux.h b/src/des/conf-ppc64-linux.h deleted file mode 100644 index 3d29372929..0000000000 --- a/src/des/conf-ppc64-linux.h +++ /dev/null @@ -1,4 +0,0 @@ -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-s390-linux.h b/src/des/conf-s390-linux.h deleted file mode 100644 index 90a74d7b5e..0000000000 --- a/src/des/conf-s390-linux.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Linux on Intel - */ - -#include - -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-sgi.h b/src/des/conf-sgi.h deleted file mode 100644 index 255c9de4d6..0000000000 --- a/src/des/conf-sgi.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: SGI - */ - -#include - -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-sparc-linux.h b/src/des/conf-sparc-linux.h deleted file mode 100644 index 90a74d7b5e..0000000000 --- a/src/des/conf-sparc-linux.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Linux on Intel - */ - -#include - -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-sparc64-linux.h b/src/des/conf-sparc64-linux.h deleted file mode 100644 index 90a74d7b5e..0000000000 --- a/src/des/conf-sparc64-linux.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: Linux on Intel - */ - -#include - -#define BITS32 -#define BIG -#define MSBFIRST -#define MUSTALIGN diff --git a/src/des/conf-winnt.h b/src/des/conf-winnt.h deleted file mode 100644 index d94edd6b38..0000000000 --- a/src/des/conf-winnt.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Machine-type definitions: IBM PC windows NT - */ - -#include - -#define LSBFIRST 1 -#define BITS32 1 -#define MOASM 1 -#define BIG 1 diff --git a/src/des/conf.h b/src/des/conf.h deleted file mode 100644 index 48191cca3f..0000000000 --- a/src/des/conf.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Configuration info for operating system, hardware description, - * language implementation, C library, etc. - * - * This file should be included in (almost) every file in the Kerberos - * sources, and probably should *not* be needed outside of those - * sources. (How do we deal with /usr/include/des.h and - * /usr/include/krb.h?) - */ - -#ifndef _CONF_H_ - -#include "mit-cpyright.h" - -#include "andrew-conf.h" - -#ifdef SHORTNAMES -#include "names.h" -#endif - -/* - * Language implementation-specific definitions - */ - -/* special cases */ -#ifdef __HIGHC__ -/* broken implementation of ANSI C */ -#undef __STDC__ -#endif - -#ifndef __STDC__ -#define const -#define volatile -#define signed -typedef char *pointer; /* pointer to generic data */ -#define PROTOTYPE(p) () -#else -typedef void *pointer; -#define PROTOTYPE(p) p -#endif - -/* Does your compiler understand "void"? */ -#ifdef notdef -#define void int -#endif - -/* - * A few checks to see that necessary definitions are included. - */ - -/* byte order */ - -#ifndef MSBFIRST -#ifndef LSBFIRST -/* #error byte order not defined */ -Error:byte order not defined. -#endif -#endif -/* machine size */ -#ifndef BITS16 -#ifndef BITS32 -Error:how big is this machine anyways ? -#endif -#endif -/* end of checks */ -#endif /* _CONF_H_ */ diff --git a/src/des/config-bsd-mac.h b/src/des/config-bsd-mac.h deleted file mode 100644 index e20e98971c..0000000000 --- a/src/des/config-bsd-mac.h +++ /dev/null @@ -1,4 +0,0 @@ -#define BITS32 -#define BIG -#define BSDUNIX -#define MSBFIRST diff --git a/src/des/debug_decl.c b/src/des/debug_decl.c deleted file mode 100644 index 4b37a6108c..0000000000 --- a/src/des/debug_decl.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Declaration of debugging flag. - */ - -#include -#include - - -#include "mit-cpyright.h" -int des_debug = 0; diff --git a/src/des/des.c b/src/des/des.c deleted file mode 100644 index 813ef47985..0000000000 --- a/src/des/des.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * These routines perform encryption and decryption using the DES - * private key algorithm, or else a subset of it-- fewer inner loops. - * (AUTH_DES_ITER defaults to 16, may be less.) - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * The key schedule is passed as an arg, as well as the cleartext or - * ciphertext. - * - * All registers labeled imply Vax using the Ultrix or 4.2bsd - * compiler. - * - * - * NOTE: bit and byte numbering: - * DES algorithm is defined in terms of bits of L - * followed by bits of R. - - * bit 0 ==> lsb of L - * bit 63 ==> msb of R - * - * Always work in register pairs, FROM L1,R1 TO L2,R2 to make - * bookkeeping easier. - * - * originally written by Steve Miller, MIT Project Athena - */ -#include "mit-cpyright.h" - -#include -#include - - -#ifndef KERNEL -#include -#include -#endif -#ifdef AFS_PTHREAD_ENV -#include -#endif /* AFS_PTHREAD_ENV */ -#include "des.h" -#include "des_internal.h" -#include "s_table.h" -#ifdef BIG -#include "p_table.h" -#endif - -#include "des_prototypes.h" - -#define XPRT_DES - -#ifdef DEBUG -#define DBG_PRINT(s) if (des_debug & 2) \ - des_debug_print(s,i,L1&0xffff,(L1>>16)&0xffff, \ - R1&0xffff,(R1>>16)&0xffff) -#else -#define DBG_PRINT(s) -#endif - -/* encrypt == 0 ==> decrypt, else encrypt */ - -afs_int32 -des_ecb_encrypt(void * clear, void * cipher, - des_key_schedule schedule, int encrypt) -{ - /* better pass 8 bytes, length not checked here */ - - afs_uint32 R1 = 0; - afs_uint32 L1 = 0; /* R1 = r10, L1 = r9 */ - afs_uint32 R2 = 0, L2 = 0; /* R2 = r8, L2 = r7 */ - afs_int32 i; - /* one more registers left on VAX, see below P_temp_p */ -#ifdef BITS16 - sbox_in_16_a S_in_16_a; - sbox_in_16_b S_in_16_b; - sbox_in_16_c S_in_16_c; - unsigned int *S_in_a_16_p = (unsigned int *)&S_in_16_a; - unsigned int *S_in_b_16_p = (unsigned int *)&S_in_16_b; - unsigned int *S_in_c_16_p = (unsigned int *)&S_in_16_c; -#endif -#ifndef BITS32 -#ifndef BITS16 -#error dunno how to do this machine type, you lose; -#endif -#endif - volatile afs_uint32 P_temp; - volatile unsigned char *P_temp_p = (unsigned char *)&P_temp; -#ifdef BITS16 - sbox_out S_out; - afs_uint32 *S_out_p = (afs_uint32 *) & S_out; -#endif - afs_uint32 R_save, L_save; -#ifdef DEBUG - afs_uint32 dbg_tmp[2]; -#endif - /* - * Use L1,R1 and L2,R2 as two sets of "64-bit" registers always - * work from L1,R1 input to L2,R2 output; initialize the cleartext - * into registers. - */ -#ifdef MUSTALIGN -#ifdef DEBUG - /* - * If the alignment is wrong, the programmer really screwed up -- - * we aren't even getting the right data type. His problem. Keep - * this code for debugging. - */ - /* Make sure schedule is ok */ - if ((afs_int32) schedule & 3) { - fprintf(stderr, "des.c schedule arg pointer not aligned\n"); - abort(); - } -#endif - if (afs_pointer_to_int(clear) & 3) { - memcpy((char *)(&L_save), (char *)clear, sizeof(L_save)); - clear=((afs_uint32*)clear)+1; - memcpy((char *)(&R_save), (char *)clear, sizeof(R_save)); - L1 = L_save; - R1 = R_save; - } else -#endif - { - if (clear) { - L1 = *((afs_uint32 *)clear); - clear=((afs_uint32*)clear)+1; - } else - L1 = 0; - if (clear) - R1 = *((afs_uint32 *)clear); - else - R1 = 0; - } - -#ifdef DEBUG - if (des_debug & 2) { - printf("All values printed from low byte (bit 0)"); - printf(" --> high byte (bit 63)\n"); - i = 0; - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - printf("iter = %2d before IP\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - } - - DBG_PRINT("before IP"); -#endif - -/* IP_start:*/ - - /* all the Initial Permutation code is in the include file */ -#include "ip.c" - /* reset input to L1,R1 */ - L1 = L2; - R1 = R2; - - /* iterate through the inner loop */ - for (i = 0; i <= (AUTH_DES_ITER - 1); i++) { - -#ifdef DEBUG - if (des_debug & 2) { - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - printf("iter = %2d start loop\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - DBG_PRINT("start loop"); - } -#endif - - R_save = R1; - L_save = L1; - -/* E_start:*/ - /* apply the E permutation from R1 to L2, R2 */ -#ifndef VAXASM -#ifdef SLOW_E -#include "e.c" -#else /* Bill's fast E */ - L2 = (R1 << 1); - if (R1 & (1 << 31)) - L2 |= 1 << 0; - L2 &= 077; - L2 |= (R1 << 3) & 07700; - L2 |= (R1 << 5) & 0770000; - L2 |= (R1 << 7) & 077000000; - L2 |= (R1 << 9) & 07700000000; - L2 |= (R1 << 11) & 030000000000; - - /* now from right to right */ - - R2 = ((R1 >> 17) & 0176000); - if (R1 & (1 << 0)) - R2 |= 1 << 15; - - R2 |= ((R1 >> 21) & 017); - R2 |= ((R1 >> 19) & 01760); -#endif /* SLOW_E */ -#else /* VAXASM */ - /* E operations */ - /* right to left */ - asm(" rotl $1,r10,r7"); - L2 &= 077; - L2 |= (R1 << 3) & 07700; - L2 |= (R1 << 5) & 0770000; - L2 |= (R1 << 7) & 077000000; - L2 |= (R1 << 9) & 07700000000; - L2 |= (R1 << 11) & 030000000000; - - asm(" rotl $-17,r10,r8"); - R2 &= 0176000; - asm(" rotl $-21,r10,r0"); - asm(" bicl2 $-16,r0"); - asm(" bisl2 r0,r8"); - asm(" rotl $-19,r10,r0"); - asm(" bicl2 $-1009,r0"); - asm(" bisl2 r0,r8"); - -#endif - - /* reset input to L1,R1 */ - L1 = L2; - R1 = R2; - -#ifdef DEBUG - if (des_debug & 2) { - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - DBG_PRINT("after e"); - printf("iter = %2d after e\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - } -#endif - -/* XOR_start:*/ - /* - * XOR with the key schedule, "schedule" - * - * If this is an encryption operation, use schedule[i], - * otherwise use schedule [AUTH_DES_ITER-i-1] - * - * First XOR left half. - */ - if (encrypt) { - L1 ^= *(((afs_uint32 *) & schedule[i]) + 0); - /* now right half */ - R1 ^= *(((afs_uint32 *) & schedule[i]) + 1); - } else { - L1 ^= *(((afs_uint32 *) & schedule[AUTH_DES_ITER - i - 1]) + 0); - /* now right half */ - R1 ^= *(((afs_uint32 *) & schedule[AUTH_DES_ITER - i - 1]) + 1); - } - - /* dont have to reset input to L1, R1 */ - -#ifdef DEBUG - if (des_debug & 2) { - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - DBG_PRINT("after xor"); - printf("iter = %2d after xor\n\t\tL1 R1 =", i); - des_cblock_print_file(dbg_tmp, stdout); - } -#endif - -/* S_start:*/ - /* apply the S selection from L1, R1 to R2 */ - -#ifdef notdef -#include "s.c" -#endif - - /* S operations , cant use registers for bit field stuff */ - /* from S_in to S_out */ - -#ifdef BITS16 - *S_in_a_16_p = L1 & 0xffff; - *S_in_b_16_p = (L1 >> 16) & 0xffff; - *S_in_c_16_p = R1 & 0xffff; - (*(afs_uint32 *) & S_out) = (unsigned)S_adj[0][S_in_16_a.b0]; - S_out.b1 = (unsigned)S_adj[1][S_in_16_a.b1]; - /* b2 spans two words */ - S_out.b2 = (unsigned) - S_adj[2][(unsigned)S_in_16_a.b2 + - (((unsigned)S_in_16_b.b2) << 4)]; - S_out.b3 = (unsigned)S_adj[3][S_in_16_b.b3]; - S_out.b4 = (unsigned)S_adj[4][S_in_16_b.b4]; - /* b5 spans both parts */ - S_out.b5 = (unsigned) - S_adj[5][(unsigned)S_in_16_b.b5 + - (((unsigned)S_in_16_c.b5) << 2)]; - S_out.b6 = (unsigned)S_adj[6][S_in_16_c.b6]; - S_out.b7 = (unsigned)S_adj[7][S_in_16_c.b7]; - R1 = *S_out_p; -#else - /* is a 32 bit sys */ -#ifndef VAXASM - R2 = (unsigned)S_adj[0][L1 & 077]; - L2 = (unsigned)S_adj[1][(L1 >> 6) & 077]; - R2 |= (L2 << 4); - L2 = (unsigned)S_adj[2][(L1 >> 12) & 077]; - R2 |= (L2 << 8); - L2 = (unsigned)S_adj[3][(L1 >> 18) & 077]; - R2 |= (L2 << 12); - L2 = (unsigned)S_adj[4][(L1 >> 24) & 077]; - R2 |= (L2 << 16); - /* b5 spans both parts */ - L2 = (unsigned) - S_adj[5][(unsigned)((L1 >> 30) & 03) + ((R1 & 017) << 2)]; - R2 |= (L2 << 20); - L2 = (unsigned)S_adj[6][(R1 >> 4) & 077]; - R2 |= (L2 << 24); - L2 = (unsigned)S_adj[7][(R1 >> 10) & 077]; - R1 = R2 | (L2 << 28); - /* reset input to L1, R1 */ -#else /* vaxasm */ - /* - * this is the c code produced above, with - * extzv replaced by rotl - */ - asm("bicl3 $-64,r9,r0"); - asm("movzbl _S_adj[r0],r8"); - asm("rotl $-6,r9,r0"); - asm("bicl2 $-64,r0"); - asm("movzbl _S_adj+64[r0],r7"); - asm("ashl $4,r7,r0"); - asm("bisl2 r0,r8"); - asm("rotl $-12,r9,r0"); - asm("bicl2 $-64,r0"); - asm("movzbl _S_adj+128[r0],r7"); - asm("ashl $8,r7,r0"); - asm("bisl2 r0,r8"); - asm("rotl $-18,r9,r0"); - asm("bicl2 $-64,r0"); - asm("movzbl _S_adj+192[r0],r7"); - asm("ashl $12,r7,r0"); - asm("bisl2 r0,r8"); - asm("rotl $-24,r9,r0"); - asm("bicl2 $-64,r0"); - asm("movzbl _S_adj+256[r0],r7"); - asm("ashl $16,r7,r0"); - asm("bisl2 r0,r8"); - asm("rotl $-30,r9,r0"); - asm("bicl2 $-4,r0"); - asm("bicl3 $-16,r10,r1"); - asm("ashl $2,r1,r1"); - asm("addl2 r1,r0"); - asm("movzbl _S_adj+320[r0],r7"); - asm("ashl $20,r7,r0"); - asm("bisl2 r0,r8"); - asm("rotl $-4,r10,r0"); - asm("bicl2 $-64,r0"); - asm("movzbl _S_adj+384[r0],r7"); - asm("ashl $24,r7,r0"); - asm("bisl2 r0,r8"); - asm("rotl $-10,r10,r0"); - asm("bicl2 $-64,r0"); - asm("movzbl _S_adj+448[r0],r7"); - asm("ashl $28,r7,r0"); - asm("bisl2 r8,r0"); - asm("movl r0,r10"); - -#endif /* vaxasm */ -#endif - -#ifdef DEBUG - if (des_debug & 2) { - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - DBG_PRINT("after s"); - printf("iter = %2d after s\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - } -#endif - -/* P_start:*/ - /* and then the p permutation from R1 into R2 */ -#include "p.c" - /* reset the input to L1, R1 */ - R1 = R2; - -#ifdef DEBUG - if (des_debug & 2) { - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - DBG_PRINT("after p"); - printf("iter = %2d after p\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - } -#endif - - /* R1 is the output value from the f() */ - /* move R[iter] to L[iter+1] */ -/* XOR_2_start:*/ - L1 = R_save; - /* xor with left */ - R1 = L_save ^ R1; - /* reset the input */ - } - - /* flip left and right before final permutation */ - L2 = R1; /* flip */ - R2 = L1; - /* reset the input */ - L1 = L2; - R1 = R2; - -#ifdef DEBUG - if (des_debug & 2) { - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - DBG_PRINT("before FP"); - printf("iter = %2d before FP\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - } -#endif - -/*FP_start:*/ - /* do the final permutation from L1R1 to L2R2 */ - /* all the fp code is in the include file */ -#include "fp.c" - - /* copy the output to the ciphertext string; - * can be same as cleartext - */ - -#ifdef MUSTALIGN - if (afs_pointer_to_int(cipher) & 3) { - L_save = L2; /* cant bcopy a reg */ - R_save = R2; - memcpy((char *)cipher, (char *)&L_save, sizeof(L_save)); - cipher=((afs_uint32*)cipher)+1; - memcpy((char *)cipher, (char *)&R_save, sizeof(R_save)); - } else -#endif - { - *((afs_uint32*)cipher)= L2; - cipher = ((afs_int32 *)cipher)+1; - *((afs_uint32 *)cipher) = R2; - } - -#ifdef DEBUG - if (des_debug & 2) { - L1 = L2; - R1 = R2; - dbg_tmp[0] = L1; - dbg_tmp[1] = R1; - DBG_PRINT("done"); - printf("iter = %2d done\n\t\tL1 R1 = ", i); - des_cblock_print_file(dbg_tmp, stdout); - } -#endif - - /* that's it, no errors can be returned */ - return 0; -} diff --git a/src/des/des.h b/src/des/des.h deleted file mode 100644 index 747caadebd..0000000000 --- a/src/des/des.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 1987, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Include file for the Data Encryption Standard library. - */ - -/* only do the whole thing once */ -#ifndef DES_DEFS -#define DES_DEFS - -#include "mit-cpyright.h" - -typedef unsigned char des_cblock[8]; /* crypto-block size */ -/* Key schedule */ -typedef struct des_ks_struct { - union { - afs_uint32 i[2]; - des_cblock _; - } _; -} des_key_schedule[16]; - -#define DES_KEY_SZ (sizeof(des_cblock)) -#define DES_ENCRYPT 1 -#define DES_DECRYPT 0 - -#ifndef NCOMPAT -#define C_Block des_cblock -#define Key_schedule des_key_schedule -#ifndef ENCRYPT -#define ENCRYPT DES_ENCRYPT -#define DECRYPT DES_DECRYPT -#endif -#define KEY_SZ DES_KEY_SZ -#define string_to_key des_string_to_key -#define read_pw_string des_read_pw_string -#define random_key des_random_key -#define pcbc_encrypt des_pcbc_encrypt -#ifdef AFS_DUX40_ENV -/* This is done to avoid name space collision with dtlogin and SIA. */ -#define des_key_sched afs_des_key_sched -#endif -#define key_sched des_key_sched -#define cbc_encrypt des_cbc_encrypt -#define ecb_encrypt des_ecb_encrypt -#define cbc_cksum des_cbc_cksum -#define C_Block_print des_cblock_print -#define quad_cksum des_quad_cksum -typedef struct des_ks_struct bit_64; -#endif - -#define des_cblock_print(x) des_cblock_print_file(x, stdout) - -#endif /* DES_DEFS */ diff --git a/src/des/des_conf.h b/src/des/des_conf.h deleted file mode 100644 index e23746b150..0000000000 --- a/src/des/des_conf.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * This file contains configuration information for the DES library - * which is machine specific; currently, this file contains - * configuration information for the vax, the "ibm032" (RT), and - * the "PC8086" (IBM PC). - * - * Note: cross-compiled targets must appear BEFORE their corresponding - * cross-compiler host. Otherwise, both will be defined when running - * the native compiler on the programs that construct cross-compiled - * sources. - */ - -#include -#include - -/* Machine-type and OS-type based configuration */ - -#ifdef PC8086 -#define IBMPC -#define BITS16 -/* #define BIG */ -#define CROSSMSDOS -#define LSBFIRST - -#else - -#ifdef vax -#define VAX -#ifndef __STDC__ /* not Berkeley PCC */ -#ifndef __GNU__ /* ditto */ -#ifndef NOASM /* are we doing C-only? */ -#define VAXASM -#endif /* NOASM */ -#endif /* __GNU__ */ -#endif /* __STDC__ */ -#define BITS32 -#define BIG -#define BSDUNIX -#define LSBFIRST - -#else - -#ifdef sun -#define BITS32 -#define BIG -#define BSDUNIX -#define MSBFIRST - -#else - -#ifdef AFS_AIX_ENV -#define IBMWS -#define IBMWSASM -#define BITS32 -#define BIG -#define BSDUNIX /*Does it mean the default us S5? NO */ -#define MSBFIRST -#define MUSTALIGN -#else -#ifdef multimax -#define BITS32 -#define BIG -#define BSDUNIX -#define LSBFIRST -#else - -Sorry, - you lose. - Figure out what the machine looks like and fix this file to include it. -#endif /* multimax */ -#endif /* AFS_AIX_ENV */ -#endif /* sun */ -#endif /* vax */ -#endif /* pc8086 */ -/* Language configuration -- are we ANSI or are we Berkeley? */ -#ifndef __STDC__ -#define const -#endif diff --git a/src/des/des_internal.h b/src/des/des_internal.h deleted file mode 100644 index 4295a411b1..0000000000 --- a/src/des/des_internal.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 1987, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Private include file for the Data Encryption Standard library. - */ - -/* only do the whole thing once */ -#ifndef DES_INTERNAL_DEFS -#define DES_INTERNAL_DEFS - -#include "conf.h" - -/* - * number of iterations of the inner - * loop of the DES algorithm. The - * standard is 16, but in case that is - * too slow, we might do less. Of - * course, less also means less - * security. - */ -#define AUTH_DES_ITER 16 - -#ifdef BITS32 -/* these are for 32 bit machines */ - -typedef struct { - unsigned b0:6; - unsigned b1:6; - unsigned b2:6; - unsigned b3:6; - unsigned b4:6; - unsigned b5:2; -} sbox_in_a; - -typedef struct { - unsigned b5:4; - unsigned b6:6; - unsigned b7:6; -} sbox_in_b; - -typedef struct { - unsigned b0:4; - unsigned b1:4; - unsigned b2:4; - unsigned b3:4; - unsigned b4:4; - unsigned b5:4; - unsigned b6:4; - unsigned b7:4; -} sbox_out; - -#else /* BITS32 */ -/* for sixteen bit machines */ - -typedef struct { - unsigned b0:6; - unsigned b1:6; - unsigned b2:4; -} sbox_in_16_a; - -typedef struct { - unsigned b2:2; - unsigned b3:6; - unsigned b4:6; - unsigned b5:2; -} sbox_in_16_b; - -typedef struct { - unsigned b5:4; - unsigned b6:6; - unsigned b7:6; -} sbox_in_16_c; - -typedef struct { - unsigned b0:4; - unsigned b1:4; - unsigned b2:4; - unsigned b3:4; - unsigned b4:4; - unsigned b5:4; - unsigned b6:4; - unsigned b7:4; -} sbox_out; -#endif /* BITS32 */ - - -#endif /* DES_INTERNAL_DEFS */ diff --git a/src/des/des_prototypes.h b/src/des/des_prototypes.h deleted file mode 100644 index 9c5e62cc47..0000000000 --- a/src/des/des_prototypes.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef DES_PROTOTYPES_H -#define DES_PROTOTYPES_H - -/* misc.c */ -extern afs_uint32 long_swap_bits(afs_uint32 x); -extern afs_uint32 swap_six_bits_to_ansi(afs_uint32 old); -extern afs_uint32 swap_four_bits_to_ansi(afs_uint32 old); -extern afs_uint32 swap_bit_pos_1(afs_uint32 x); -extern afs_uint32 swap_bit_pos_0(afs_uint32 x); -extern afs_uint32 swap_bit_pos_0_to_ansi(afs_uint32 x); -extern afs_uint32 rev_swap_bit_pos_0(afs_uint32 x); -extern afs_uint32 swap_byte_bits(afs_uint32 x); -extern int swap_long_bytes_bit_number(afs_uint32 x); -#if !defined(KERNEL) -extern void test_set(FILE * stream, const char *src, int testbit, - const char *dest, int setbit); -#endif -extern int des_debug; - -static_inline unsigned char * -cblockptr_to_cblock(des_cblock *key) { - return (unsigned char *)key; -} - -static_inline unsigned char * -charptr_to_cblock(char *key) { - return (unsigned char *)key; -} - -static_inline des_cblock * -charptr_to_cblockptr(char *key) { - return (unsigned char (*)[])key; -} - -/* cbc_encrypt.c */ -extern afs_int32 des_cbc_encrypt(void * in, void * out, - afs_int32 length, - des_key_schedule key, des_cblock * iv, - int encrypt); - -/* pcbc_encrypt.c */ -extern afs_int32 des_pcbc_encrypt(void * in, void * out, - afs_int32 length, - des_key_schedule key, des_cblock * iv, - int encrypt); - -/* des.c */ -extern afs_int32 des_ecb_encrypt(void * clear, void * cipher, - des_key_schedule schedule, - int encrypt); - -/* util.c */ -#if !defined(KERNEL) -extern int des_cblock_print_file(des_cblock * x, FILE * fp); -#endif - -/* make_*.c */ -#if !defined(KERNEL) -extern void gen(FILE * stream); -#endif - -/* weak_key.c */ -extern int des_is_weak_key(des_cblock key); - -/* key_parity.c */ -extern void des_fixup_key_parity(des_cblock key); -extern int des_check_key_parity(des_cblock key); - -/* cksum.c */ -extern afs_uint32 des_cbc_cksum(des_cblock * in, des_cblock * out, - afs_int32 length, - des_key_schedule key, des_cblock * iv); - -/* quad_cksum.c */ -extern afs_uint32 des_quad_cksum(unsigned char *in, afs_uint32 * out, - afs_int32 length, int out_count, - des_cblock * c_seed); - -/* key_sched.c */ -extern int afs_des_key_sched(des_cblock k, - des_key_schedule schedule); -extern int des_key_sched(des_cblock k, des_key_schedule schedule); - - -/* strng_to_key.c */ -extern void des_string_to_key(char *str, des_cblock * key); - -/* new_rnd_key.c */ -extern int des_random_key(des_cblock key); -extern void des_init_random_number_generator(des_cblock key); -extern void des_set_random_generator_seed(des_cblock key); - -/* read_pssword.c */ -extern int des_read_password(des_cblock * k, char *prompt, int verify); -extern int des_read_pw_string(char *, int, char *, int); - -#endif diff --git a/src/des/enc.c b/src/des/enc.c deleted file mode 100644 index 72687b11f6..0000000000 --- a/src/des/enc.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - */ - -#include -#include - - -#include "mit-cpyright.h" -#include "des.h" -#ifdef BSDUNIX -#include -#endif -#include - -Key_schedule KEYSCHED; -C_Block key = { 0, 1, 2, 3, 4, 5, 6, 7 }; -C_Block sum; -char inbuf[512 + 8]; /* leave room for cksum and len */ -char oubuf[512 + 8]; -int debug; -int ind; -int oud; -afs_int32 orig_size; - -#include "AFS_component_version_number.c" - -main(argc, argv) - int argc; - char *argv[]; -{ - int encrypt; - afs_int32 length; - int *p; - afs_int32 ivec[2]; - if (argc != 4) { - fprintf(stderr, "%s: Usage: %s infile outfile mode.\n", argv[0], - argv[0]); - exit(1); - } - if (!strcmp(argv[3], "e")) - encrypt = 1; - else if (!strcmp(argv[3], "d")) - encrypt = 0; - else { - fprintf(stderr, "%s: Mode must be e (encrypt) or d (decrypt).\n", - argv[0]); - exit(1); - } - if ((ind = open(argv[1], O_RDONLY, 0666)) < 0) { - fprintf(stderr, "%s: Cannot open %s for input.\n", argv[0], argv[1]); - exit(1); - } - if (!strcmp(argv[2], "-")) - oud = dup(1); - else if ((oud = open(argv[2], O_CREAT | O_WRONLY, 0666)) < 0) { - fprintf(stderr, "%s: Cannot open %s for output.\n", argv[0], argv[2]); - exit(1); - } -#ifdef notdef - (void)freopen("/dev/tty", "r", stdin); - (void)freopen("/dev/tty", "w", stdout); -#endif - read_password(key, "\n\07\07Enter Key> ", 1); - if (key_sched(key, KEYSCHED) < 0) { - fprintf(stderr, "%s: Key parity error\n", argv[0]); - exit(1); - } - ivec[0] = 0; - ivec[1] = 0; - memcpy(sum, key, sizeof(C_Block)); - for (;;) { - if ((length = read(ind, inbuf, 512)) < 0) { - fprintf(stderr, "%s: Error reading from input.\n", argv[0]); - exit(1); - } else if (length == 0) { - fprintf(stderr, "\n"); - break; - } - if (encrypt) { -#ifdef notdef - sum = quad_cksum(inbuf, NULL, length, 1, sum); -#endif - quad_cksum(inbuf, sum, length, 1, sum); - orig_size += length; - fprintf(stderr, "\nlength = %d tot length = %d quad_sum = %X %X", - length, orig_size, *(afs_uint32 *) sum, - *((afs_uint32 *) sum + 1)); - fflush(stderr); - } - pcbc_encrypt(inbuf, oubuf, (afs_int32) length, KEYSCHED, ivec, - encrypt); - if (!encrypt) { -#ifdef notdef - sum = quad_cksum(oubuf, NULL, length, 1, sum); -#endif - quad_cksum(oubuf, sum, length, 1, sum); - orig_size += length; - fprintf(stderr, "\nlength = %d tot length = %d quad_sum = %X ", - length, orig_size, *(afs_uint32 *) sum, - *((afs_uint32 *) sum + 1)); - } - length = (length + 7) & ~07; - write(oud, oubuf, length); - if (!encrypt) - p = (int *)&oubuf[length - 8]; - else - p = (int *)&inbuf[length - 8]; - ivec[0] = *p++; - ivec[1] = *p; - } - - fprintf(stderr, "\ntot length = %d quad_sum = %X\n", orig_size, sum); - /* if encrypting, now put the original length and checksum in */ -} diff --git a/src/des/key_parity.c b/src/des/key_parity.c deleted file mode 100644 index fbfb383877..0000000000 --- a/src/des/key_parity.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 1989 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * These routines check and fix parity of encryption keys for the DES - * algorithm. - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * These routines form the library interface to the DES facilities. - * - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#include "odd.h" /* Load compile-time generated odd_parity table */ - -/* - * des_fixup_key_parity: Forces odd parity per byte; parity is bits - * 8,16,...64 in des order, implies 0, 8, 16, ... - * vax order. - */ -void -des_fixup_key_parity(des_cblock key) -{ - int i; - - for (i = 0; i < sizeof(des_cblock); i++) - key[i] = odd_parity[key[i]]; - - return; -} - -/* - * des_check_key_parity: returns true iff key has the correct des parity. - * See des_fix_key_parity for the definition of - * correct des parity. - */ -int -des_check_key_parity(des_cblock key) -{ - int i; - - for (i = 0; i < sizeof(des_cblock); i++) - if (key[i] != odd_parity[key[i]]) - return (0); - - return (1); -} diff --git a/src/des/key_sched.c b/src/des/key_sched.c deleted file mode 100644 index d856914814..0000000000 --- a/src/des/key_sched.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * This routine computes the DES key schedule given a key. The - * permutations and shifts have been done at compile time, resulting - * in a direct one-step mapping from the input key to the key - * schedule. - * - * Also checks parity and weak keys. - * - * Watch out for the subscripts -- most effectively start at 1 instead - * of at zero. Maybe some bugs in that area. - * - * DON'T change the data types for arrays and such, or it will either - * break or run slower. This was optimized for Uvax2. - * - * In case the user wants to cache the computed key schedule, it is - * passed as an arg. Also implies that caller has explicit control - * over zeroing both the key schedule and the key. - * - * All registers labeled imply Vax using the Ultrix or 4.2bsd compiler. - * - * Originally written 6/85 by Steve Miller, MIT Project Athena. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include "des_internal.h" -#include - -#include "des.h" -#include "key_perm.h" -#include "des_prototypes.h" - -typedef char key[64]; - -/* the following are really void but cc86 doesnt allow it */ -static int make_key_sched(key Key, des_key_schedule Schedule); - -#ifdef AFS_DUX40_ENV -#pragma weak des_key_sched = afs_des_key_sched -int -afs_des_key_sched(des_cblock k, des_key_schedule schedule) -#else -int -des_key_sched(des_cblock k, des_key_schedule schedule) -#endif -{ - /* better pass 8 bytes, length not checked here */ - - int i, j, n; /* i = r10, j = r9, n = r8 */ - unsigned int temp; /* r7 */ - char *p_char; /* r6 */ - key k_char; - i = 8; - n = 0; - p_char = k_char; - -#ifdef lint - n = n; /* fool it in case of VAXASM */ -#endif -#ifdef DEBUG - if (des_debug) - fprintf(stderr, "\n\ninput key, left to right = "); -#endif - - if (!des_check_key_parity(k)) /* bad parity --> return -1 */ - return (-1); - - do { - /* get next input key byte */ -#ifdef DEBUG - if (des_debug) - fprintf(stderr, "%02x ", *k & 0xff); -#endif - temp = (unsigned int)((unsigned char)*k++); - j = 8; - - do { -#ifndef VAXASM - *p_char++ = (int)temp & 01; - temp = temp >> 1; -#else - asm("bicb3 $-2,r7,(r8)+[r6]"); - asm("rotl $-1,r7,r7"); -#endif - } while (--j > 0); - } while (--i > 0); - -#ifdef DEBUG - if (des_debug) { - p_char = k_char; - fprintf(stderr, "\nKey bits, from zero to 63"); - for (i = 0; i <= 7; i++) { - fprintf(stderr, "\n\t"); - for (j = 0; j <= 7; j++) - fprintf(stderr, "%d ", *p_char++); - } - } -#else -#ifdef lint - p_char = p_char; -#endif -#endif - - /* check against weak keys */ - k -= sizeof(des_cblock); - - if (des_is_weak_key(k)) - return (-2); - - make_key_sched(k_char, schedule); - - /* if key was good, return 0 */ - return 0; -} - -static int -make_key_sched(key Key, des_key_schedule Schedule) -{ - /* - * The key has been converted to an array to make this run faster; - * on a microvax 2, this routine takes about 3.5ms. The code and - * size of the arrays has been played with to get it as fast as - * possible. - * - * Don't change the order of the declarations below without - * checking the assembler code to make sure that things are still - * where it expects them. - */ - - /* r10, unroll by AUTH_DES_ITER */ - int iter = AUTH_DES_ITER; - afs_uint32 *k; /* r9 */ - int *kp; /* r8 */ - afs_uint32 temp; /* r7 */ - - kp = (int *)key_perm; - k = (afs_uint32 *) Schedule; - - do { - /* - * create the Key schedule - * - * put into lsb first order (lsb is bit 0) - */ - - /* - * On the uvax2, this C code below is as fast as straight - * assembler, so just use C code below. - */ - temp = 0; -#ifdef LSBFIRST -#define BIT(x) x -#else -#ifdef notdef -#define BIT(x) rev_swap_bit_pos_0(x) -#else -#define BIT(x) x -#endif -#endif - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(0)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(1)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(2)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(3)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(4)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(5)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(6)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(7)); - - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(8)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(9)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(10)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(11)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(12)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(13)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(14)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(15)); - - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(16)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(17)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(18)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(19)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(20)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(21)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(22)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(23)); - - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(24)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(25)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(26)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(27)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(28)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(29)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(30)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(31)); - - *k++ = temp; - temp = 0; - - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(0)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(1)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(2)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(3)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(4)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(5)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(6)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(7)); - - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(8)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(9)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(10)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(11)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(12)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(13)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(14)); - if ((unsigned)Key[(int)*kp++]) - temp |= (1 << BIT(15)); - - *k++ = temp; - - } while (--iter > 0); - -#ifdef DEBUG - if (des_debug) { - int i; - char *n; - int q; - fprintf(stderr, "\nKey Schedule, left to right"); - for (i = 0; i < AUTH_DES_ITER; i++) { - n = (char *)&Schedule[i]; - fprintf(stderr, "\n"); - for (q = 0; q <= 7; q++) - fprintf(stderr, "%02x ", *n++ & 0xff); - } - fprintf(stderr, "\n"); - } -#endif - - return (0); -} diff --git a/src/des/main.c b/src/des/main.c deleted file mode 100644 index 132c4c64e1..0000000000 --- a/src/des/main.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, - * please seethe file . - * - * This file contains most of the routines needed by the various - * make_foo programs, to account for bit- and byte-ordering on - * different machine types. It also contains other routines useful in - * generating the intermediate source files. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -char const *whoami; - -#ifndef DONT_INCL_MAIN - -#include "AFS_component_version_number.c" - -int -main(int argc, char *argv[]) -{ - char *filename; - char *arg; - FILE *stream; - - whoami = argv[0]; - filename = (char *)NULL; - - while (argc--, *++argv) { - arg = *argv; - if (*arg == '-') { - if (!strcmp(arg, "-d") && !strcmp(arg, "-debug")) - des_debug++; - else { - fprintf(stderr, "%s: unknown control argument %s\n", whoami, - arg); - goto usage; - } - } else if (filename) { - fprintf(stderr, "%s: multiple file names provided: %s, %s\n", - whoami, filename, arg); - goto usage; - } else - filename = arg; - } - - if (!filename) { - fprintf(stderr, "%s: no file name provided\n", whoami); - goto usage; - } - - stream = fopen(filename, "w"); - if (!stream) { - perror(filename); - usage: - fprintf(stderr, "usage: %s [-debug] filename\n", whoami); - exit(1); - } - - fputs("/* This file is automatically generated. Do not edit it. */\n", - stream); - - /* This routine will generate the contents of the file. */ - gen(stream); - if (fclose(stream) == EOF) { - perror(filename); - exit(1); - } - exit(0); -} -#endif /* DONT_INCL_MAIN */ diff --git a/src/des/make_e.c b/src/des/make_e.c deleted file mode 100644 index 01c91e1c73..0000000000 --- a/src/des/make_e.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 1987, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Part of the MIT Project Athena Kerberos encryption system, - * originally written 8/85 by Steve Miller. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "tables.h" - -#include "AFS_component_version_number.c" - -main() -{ - int i; - - /* clear the output */ - fprintf(stdout, "\n\tL2 = 0; R2 = 0;"); - - /* only take bits from R1, put into either L2 or R2 */ - /* first setup E */ - fprintf(stdout, "\n/* E operations */\n/* right to left */\n"); - /* first list mapping from left to left */ - - for (i = 0; i <= 31; i++) - if (E[i] < 32) - fprintf(stdout, "\n\tif (R1 & (1<<%d)) L2 |= 1<<%d;", E[i], i); - - fprintf(stdout, "\n\n/* now from right to right */\n"); - /* list mapping from left to right */ - for (i = 32; i <= 47; i++) - if (E[i] < 32) - fprintf(stdout, "\n\tif (R1 & (1<<%d)) R2 |= 1<<%d;", E[i], - i - 32); - - fprintf(stdout, "\n"); -} diff --git a/src/des/make_fp.c b/src/des/make_fp.c deleted file mode 100644 index b91ed8746d..0000000000 --- a/src/des/make_fp.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, - * please see the file . - * - * This file contains a generation routine for source code - * implementing the final permutation of the DES. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#define WANT_FP_TABLE -#include "tables.h" - -void -gen(FILE * stream) -{ - int i; -#ifdef AFS_DARWIN80_ENV - int j; - -#define swap_long_bytes_bit_number _darwin_swap_long_bytes_bit_number -#endif /* AFS_DARWIN80_ENV */ - - /* clear the output */ - fprintf(stream, " L2 = 0; R2 = 0;\n"); - - /* - * NOTE: As part of the final permutation, we also have to adjust - * for host bit order via "swap_bit_pos_0()". Since L2,R2 are - * the output from this, we adjust the bit positions written into - * L2,R2. - */ - -#define SWAP(i,j) \ - swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi((unsigned)i)-j) - -#ifdef AFS_DARWIN80_ENV - for(j = 0;; j++) { - fprintf(stream, "%s", _darwin_whichstr[j]); - if (j == 2) - break; -#endif /* AFS_DARWIN80_ENV */ - /* first setup FP */ - fprintf(stream, "/* FP operations */\n/* first left to left */\n"); - - /* first list mapping from left to left */ - for (i = 0; i <= 31; i++) - if (FP[i] < 32) - test_set(stream, "L1", FP[i], "L2", SWAP(i, 0)); - - /* now mapping from right to left */ - fprintf(stream, "\n\n/* now from right to left */\n"); - for (i = 0; i <= 31; i++) - if (FP[i] >= 32) - test_set(stream, "R1", FP[i] - 32, "L2", SWAP(i, 0)); - - fprintf(stream, "\n/* now from left to right */\n"); - - /* list mapping from left to right */ - for (i = 32; i <= 63; i++) - if (FP[i] < 32) - test_set(stream, "L1", FP[i], "R2", SWAP(i, 32)); - - /* now mapping from right to right */ - fprintf(stream, "\n/* last from right to right */\n"); - for (i = 32; i <= 63; i++) - if (FP[i] >= 32) - test_set(stream, "R1", FP[i] - 32, "R2", SWAP(i, 32)); -#ifdef AFS_DARWIN80_ENV - _darwin_which = !_darwin_which; - } -#endif /* AFS_DARWIN80_ENV */ -} diff --git a/src/des/make_ip.c b/src/des/make_ip.c deleted file mode 100644 index c92365536e..0000000000 --- a/src/des/make_ip.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1987, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * This routine generates source code implementing the initial - * permutation of the DES. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include -#include "des.h" -#include "des_internal.h" - -#define WANT_IP_TABLE -#include "tables.h" - -#include "des_prototypes.h" - -#define SWAP(x) swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi(x)) - -void -gen(FILE * stream) -{ - int i; -#ifdef AFS_DARWIN80_ENV - int j; - -#define swap_long_bytes_bit_number _darwin_swap_long_bytes_bit_number -#endif /* AFS_DARWIN80_ENV */ - - /* clear the output */ - fprintf(stream, " L2 = 0; R2 = 0;\n"); - -#ifdef AFS_DARWIN80_ENV - for(j = 0;; j++) { - fprintf(stream, "%s", _darwin_whichstr[j]); - if (j == 2) - break; -#endif /* AFS_DARWIN80_ENV */ - /* first setup IP */ - fprintf(stream, "/* IP operations */\n/* first left to left */\n"); - - /* first list mapping from left to left */ - for (i = 0; i <= 31; i++) - if (IP[i] < 32) - test_set(stream, "L1", SWAP(IP[i]), "L2", i); - - /* now mapping from right to left */ - fprintf(stream, "\n/* now from right to left */\n"); - for (i = 0; i <= 31; i++) - if (IP[i] >= 32) - test_set(stream, "R1", SWAP(IP[i] - 32), "L2", i); - - fprintf(stream, "\n/* now from left to right */\n"); - /* list mapping from left to right */ - for (i = 32; i <= 63; i++) - if (IP[i] < 32) - test_set(stream, "L1", SWAP(IP[i]), "R2", i - 32); - - /* now mapping from right to right */ - fprintf(stream, "\n/* last from right to right */\n"); - for (i = 32; i <= 63; i++) - if (IP[i] >= 32) - test_set(stream, "R1", SWAP(IP[i] - 32), "R2", i - 32); -#ifdef AFS_DARWIN80_ENV - _darwin_which = !_darwin_which; - } -#endif /* AFS_DARWIN80_ENV */ - exit(0); -} diff --git a/src/des/make_keyperm.c b/src/des/make_keyperm.c deleted file mode 100644 index 1e4f35ba3a..0000000000 --- a/src/des/make_keyperm.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * This routine calculates an effective Key schedule set of - * permutations for des. Beginning with the pre-defined key schedule - * algorithm, it reduces it to a set of 16 permutations upon the - * initial key. Only needs to execute once to produce a header file. - * Note that we subtract one from the values ouput to fix up for C - * subscripts starting at 0. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -char *progname; - -static int key_position[64 + 1]; -static int C[28 + 1]; -static int D[28 + 1]; -static int C_temp, D_temp; - -/* - * CONVENTIONS for numbering the bits - * bit 0 ==> lsb - * L starts at bit 0 - * R starts at bit 64 - * - * BEWARE-- some stuff starts at 0, some at 1; perhaps some bugs still? - */ - -/* - * Sequence of shifts used for the key schedule. - */ -static int const shift[16 + 1] = { 0, - 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, -}; - -static int const pc_1[56 + 1] = { 0, - - 57, 49, 41, 33, 25, 17, 9, - 1, 58, 50, 42, 34, 26, 18, - 10, 2, 59, 51, 43, 35, 27, - 19, 11, 3, 60, 52, 44, 36, - - 63, 55, 47, 39, 31, 23, 15, - 7, 62, 54, 46, 38, 30, 22, - 14, 6, 61, 53, 45, 37, 29, - 21, 13, 5, 28, 20, 12, 4, -}; - - -/* - * Permuted-choice 2, to pick out the bits from - * the CD array that generate the key schedule. - */ -static int const pc_2[48 + 1] = { 0, - - 14, 17, 11, 24, 1, 5, - 3, 28, 15, 6, 21, 10, - 23, 19, 12, 4, 26, 8, - 16, 7, 27, 20, 13, 2, - - 41, 52, 31, 37, 47, 55, - 30, 40, 51, 45, 33, 48, - 44, 49, 39, 56, 34, 53, - 46, 42, 50, 36, 29, 32, -}; - -static int ks_perm[16 + 1][48 + 1]; - -int des_debug; - -void -gen(FILE * stream) -{ - /* Local Declarations */ - int i, j, iter; - - /* - * initialize the key_position array s.t. key_position[i] = i; - * that is, each element is equal to its starting position. - * - * Also adjust for the bit order within bytes. - */ - - for (i = 0; i < 65; i++) - key_position[i] = swap_bit_pos_1(i); - - fprintf(stream, "static int const key_perm[16][48] = {\n"); - - /* - * apply pc_1 to initial key_position to create C[0] and D[0] - * Start at pc_1[1], not pc_1[0] - */ - for (i = 1; i <= 28; i++) { - C[i] = key_position[pc_1[i]]; - D[i] = key_position[pc_1[i + 28]]; - } - - /* - * major loop over the 16 iterations - * start at iter = 1, not zero. - */ - for (iter = 1; iter <= 16; iter++) { - if (des_debug) { - /* for debugging */ - printf("/* DEBUG-- start iteration = %d shifts = %d", iter, - shift[iter]); - printf("\nC array"); - for (i = 1; i <= 4; i++) { - printf("\n"); - for (j = 1; j <= 7; j++) - printf("%d, ", C[(i - 1) * 7 + j]); - } - printf("\n\nD array"); - for (i = 1; i <= 4; i++) { - printf("\n"); - for (j = 1; j <= 7; j++) - printf("%d, ", D[(i - 1) * 7 + j]); - } - printf("\n */"); - fflush(stdout); - } - - /* apply the appropriate left shifts */ - for (i = 1; i <= shift[iter]; i++) { - C_temp = C[1]; - D_temp = D[1]; - for (j = 1; j <= 27; j++) { - C[j] = C[j + 1]; - D[j] = D[j + 1]; - } - C[j] = C_temp; - D[j] = D_temp; - } - - - if (des_debug) { - /* for debugging */ - printf("/* DEBUG:\n"); - printf(" * after shifts, iteration = %d shifts = %d", iter, - shift[iter]); - printf("\nC array"); - for (i = 1; i <= 4; i++) { - printf("\n"); - for (j = 1; j <= 7; j++) - printf("%d, ", C[(i - 1) * 7 + j]); - } - printf("\n\nD array"); - for (i = 1; i <= 4; i++) { - printf("\n"); - for (j = 1; j <= 7; j++) - printf("%d, ", D[(i - 1) * 7 + j]); - } - printf("\n */"); - fflush(stdout); - } - - /* - * apply pc_2 - * Start at pc_2[1], not pc_2[0] - * - * Start stuffing ks_perm[1][1], not ks_perm[0][0] - * - * Adjust ks_perm for bit order if needed. - */ - for (i = 1; i <= 48; i++) { - if (pc_2[i] <= 28) - ks_perm[iter][(i)] = C[pc_2[i]]; - else - ks_perm[iter][(i)] = D[pc_2[i] - 28]; - } - - /* now output the resulting key permutation */ - fprintf(stream, "\n /* ks permutation iteration = %2d */", iter); - for (i = 1; i <= 6; i++) { - if (i == 1) - fprintf(stream, "\n {"); - fprintf(stream, "\n "); - for (j = 1; j <= 8; j++) { - /* - * IMPORTANT -- subtract one from value to adjust to a - * zero-based subscript for key - */ - fprintf(stream, "%d", ks_perm[iter][(i - 1) * 8 + j] - 1); - /* omit last comma */ - if ((j != 8) || (i != 6)) { - fprintf(stream, ", "); - } - } - } - if (iter != 16) { - fprintf(stream, "\n }, "); - } else { - fprintf(stream, "\n }"); - } - } - fprintf(stream, "\n};\n"); -} diff --git a/src/des/make_odd.c b/src/des/make_odd.c deleted file mode 100644 index 10ebe99bbe..0000000000 --- a/src/des/make_odd.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see - * the file . - * - * This routine generates an odd-parity table for use in key generation. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include - -void -gen(FILE *stream) -{ - /* - * map a byte into its equivalent with odd parity, where odd - * parity is in the least significant bit - */ - int i, j, k, odd; - - fprintf(stream, "static unsigned char const odd_parity[256] = {\n"); - - for (i = 0; i < 256; i++) { - odd = 0; - /* shift out the lsb parity bit */ - k = i >> 1; - /* then count the other bits */ - for (j = 0; j < 7; j++) { - odd ^= (k & 1); - k = k >> 1; - } - k = i & ~1; - if (!odd) - k |= 1; - fprintf(stream, "%3d", k); - if (i < 255) - fprintf(stream, ", "); - if (i % 8 == 0) - fprintf(stream, "\n"); - } - fprintf(stream, "};\n"); -} diff --git a/src/des/make_p.c b/src/des/make_p.c deleted file mode 100644 index 9dc954570a..0000000000 --- a/src/des/make_p.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 1985, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please - * see the file . - * - * This routine generates the P permutation code for the DES. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "des.h" -#include "des_internal.h" -#include "tables.h" -#include "des_prototypes.h" - -void -gen(FILE * stream) -{ - /* P permutes 32 bit input R1 into 32 bit output R2 */ - - /* clear the output */ - fprintf(stream, " L2 = 0;\n"); -#ifndef BIG - fprintf(stream, " R2 = 0;\n"); - fprintf(stream, "/* P operations */\n/* from right to right */\n"); - /* first list mapping from left to left */ - for (i = 0; i <= 31; i++) - if (P[i] < 32) - fprintf(stream, " if (R1 & (1<<%d)) R2 |= 1<<%d;\n", P[i], i); -#else /* BIG */ - /* flip p into p_temp */ - fprintf(stream, " P_temp = R1;\n"); - fprintf(stream, " P_temp_p = (unsigned char *) &P_temp;\n"); - -#ifdef AFS_DARWIN80_ENV - fprintf(stream, "#if defined(__i386__) || defined(__amd64__) || defined(__arm__)\n"); - fprintf(stream, " R2 = P_prime[0][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[1][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[2][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[3][*P_temp_p];\n"); - fprintf(stream, "#elif defined(__ppc__) || defined(__ppc64__)\n"); - fprintf(stream, " R2 = P_prime[3][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[2][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[1][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[0][*P_temp_p];\n"); - fprintf(stream, "#else\n#error Unsupported architecture\n#endif\n"); -#else /* !AFS_DARWIN80_ENV */ -#ifdef LSBFIRST - fprintf(stream, " R2 = P_prime[0][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[1][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[2][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[3][*P_temp_p];\n"); -#else /* MSBFIRST */ - fprintf(stream, " R2 = P_prime[3][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[2][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[1][*P_temp_p++];\n"); - fprintf(stream, " R2 |= P_prime[0][*P_temp_p];\n"); -#endif /* MSBFIRST */ -#endif /* !AFS_DARWIN80_ENV */ -#endif /* BIG */ -} diff --git a/src/des/make_p_table.c b/src/des/make_p_table.c deleted file mode 100644 index 9e57092834..0000000000 --- a/src/des/make_p_table.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 1985, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please - * see the file . - * - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#define WANT_P_TABLE -#include "tables.h" - -static unsigned char P_temp[32]; -static afs_uint32 P_prime[4][256]; - -void -gen(FILE * stream) -{ - int i, j, k, m; - /* P permutes 32 bit input R1 into 32 bit output R2 */ - -#ifdef BIG - /* flip p into p_temp */ - for (i = 0; i < 32; i++) - P_temp[(int)P[rev_swap_bit_pos_0(i)]] = rev_swap_bit_pos_0(i); - - /* - * now for each byte of input, figure out all possible combinations - */ - for (i = 0; i < 4; i++) { /* each input byte */ - for (j = 0; j < 256; j++) { /* each possible byte value */ - /* flip bit order */ - k = j; - /* swap_byte_bits(j); */ - for (m = 0; m < 8; m++) { /* each bit */ - if (k & (1 << m)) { - /* set output values */ - P_prime[i][j] |= 1 << P_temp[(i * 8) + m]; - } - } - } - } - - fprintf(stream, "\n\tstatic afs_uint32 const P_prime[4][256] = {\n\t"); - for (i = 0; i < 4; i++) { - fprintf(stream, "\n{ "); - for (j = 0; j < 64; j++) { - fprintf(stream, "\n"); - for (k = 0; k < 4; k++) { - fprintf(stream, "0x%08lX", - (unsigned long)P_prime[i][j * 4 + k]); - if ((j == 63) && (k == 3)) - fprintf(stream, "}"); - if ((i == 3) && (j == 63) && (k == 3)) - fprintf(stream, "\n};"); - else - fprintf(stream, ", "); - } - } - } - -#endif - fprintf(stream, "\n"); -} diff --git a/src/des/make_s.c b/src/des/make_s.c deleted file mode 100644 index 00aa31ffc8..0000000000 --- a/src/des/make_s.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 1985, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please - * see the file . - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "des_internal.h" -#include "s_table.h" - -void -gen(stream) - FILE *stream; -{ - /* clear the output */ - fprintf(stream, "\n\tL2 = 0; R2 = 0;"); - -#ifdef notdef - /* P permutes 32 bit input R1 into 32 bit output R2 */ - - fprintf(stream, "\n/* P operations */\n/* first left to left */\n"); - /* first list mapping from left to left */ - for (i = 0; i <= 31; i++) - if (S[i] < 32) - fprintf(stream, "\n\tif (R1 & (1<<%d)) R2 |= 1<<%d;", S[i], i); -#endif - fprintf(stream, "\n"); -} diff --git a/src/des/make_s_table.c b/src/des/make_s_table.c deleted file mode 100644 index e06d5ea000..0000000000 --- a/src/des/make_s_table.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 1985, 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please - * see the file . - */ - -#include -#include - - -#include "mit-cpyright.h" -#include -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#define WANT_S_TABLE -#include "tables.h" - -char temp[8][64]; -int des_debug; - -void -gen(FILE * stream) -{ - afs_uint32 i, j, k, l, m, n; - - /* rearrange the S table entries, and adjust for host bit order */ - - fprintf(stream, "static unsigned char const S_adj[8][64] = {"); - fprintf(stream, " /* adjusted */\n"); - - for (i = 0; i <= 7; i++) { - for (j = 0; j <= 63; j++) { - /* - * figure out which one to put in the new S[i][j] - * - * start by assuming the value of the input bits is "j" in - * host order, then figure out what it means in standard - * form. - */ - k = swap_six_bits_to_ansi(j); - /* figure out the index for k */ - l = (((k >> 5) & 01) << 5) - + ((k & 01) << 4) + ((k >> 1) & 0xf); - m = S[i][l]; - /* restore in host order */ - n = swap_four_bits_to_ansi(m); - if (des_debug) - fprintf(stderr, - "i = %ld, j = %ld, k = %ld, l = %ld, m = %ld, n = %ld\n", - (long)i, (long)j, (long)k, (long)l, (long)m, (long)n); - temp[i][j] = n; - } - } - - for (i = 0; i <= 7; i++) { - fprintf(stream, "\n{ "); - k = 0; - for (j = 0; j <= 3; j++) { - fprintf(stream, "\n"); - for (m = 0; m <= 15; m++) { - fprintf(stream, "%2d", temp[i][k]); - if (k == 63) { - fprintf(stream, "\n}"); - } - if ((k++ != 63) || (i != 7)) { - fprintf(stream, ", "); - } - } - } - } - - fprintf(stream, "\n};\n"); -} diff --git a/src/des/misc.c b/src/des/misc.c deleted file mode 100644 index 2ceffe76ff..0000000000 --- a/src/des/misc.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, - * please seethe file . - * - * This file contains most of the routines needed by the various - * make_foo programs, to account for bit- and byte-ordering on - * different machine types. It also contains other routines useful in - * generating the intermediate source files. - */ - -#include -#include - - -#include "mit-cpyright.h" -#ifndef KERNEL -#include -#endif -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -int des_debug; - -/* - * The DES algorithm is defined in terms of MSBFIRST, so sometimes, - * e.g. VAXes, we need to fix it up. ANSI order means the DES - * MSBFIRST order. - */ - -#if 0 /* These don't seem to get used anywhere.... */ -void -swap_bits(char *array) -{ -#ifdef MSBFIRST - /* just return */ - return; -#else /* LSBFIRST */ - int old, new, i, j; - - /* for an eight byte block-- */ - /* flips the bit order within each byte from 0 lsb to 0 msb */ - for (i = 0; i <= 7; i++) { - old = *array; - new = 0; - for (j = 0; j <= 7; j++) { - new |= old & 01; /* copy a bit */ - if (j < 7) { - /* rotate in opposite directions */ - old = old >> 1; - new = new << 1; - } - } - *array++ = new; - } -#endif /* MSBFIRST */ -} - -afs_uint32 -long_swap_bits(afs_uint32 x) -{ -#ifdef MSBFIRST - return x; -#else - char *array = (char *)&x; - int old, new, i, j; - - /* flips the bit order within each byte from 0 lsb to 0 msb */ - for (i = 0; i <= (sizeof(afs_int32) - 1); i++) { - old = *array; - new = 0; - for (j = 0; j <= 7; j++) { - if (old & 01) - new = new | 01; - if (j < 7) { - old = old >> 1; - new = new << 1; - } - } - *array++ = new; - } - return x; -#endif /* LSBFIRST */ -} -#endif /* 0 */ - -afs_uint32 -swap_six_bits_to_ansi(afs_uint32 old) -{ - afs_uint32 new, j; - - /* flips the bit order within each byte from 0 lsb to 0 msb */ - new = 0; - for (j = 0; j <= 5; j++) { - new |= old & 01; /* copy a bit */ - if (j < 5) { - /* rotate in opposite directions */ - old = old >> 1; - new = new << 1; - } - } - return new; -} - -afs_uint32 -swap_four_bits_to_ansi(afs_uint32 old) -{ - afs_uint32 new, j; - - /* flips the bit order within each byte from 0 lsb to 0 msb */ - new = 0; - for (j = 0; j <= 3; j++) { - new |= (old & 01); /* copy a bit */ - if (j < 3) { - old = old >> 1; - new = new << 1; - } - } - return new; -} - -afs_uint32 -swap_bit_pos_1(afs_uint32 x) -{ - /* - * This corrects for the bit ordering of the algorithm, e.g. - * bit 0 ==> msb, bit 7 lsb. - * - * given the number of a bit position, >=1, flips the bit order - * each byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12 - */ - int y, z; - - /* always do it, only used by des_make_key_perm.c so far */ - y = (x - 1) / 8; - z = (x - 1) % 8; - - x = (8 - z) + (y * 8); - - return x; -} - -afs_uint32 -swap_bit_pos_0(afs_uint32 x) -{ - /* zero based version */ - - /* - * This corrects for the bit ordering of the algorithm, e.g. - * bit 0 ==> msb, bit 7 lsb. - */ - -#ifdef MSBFIRST - return x; -#else /* LSBFIRST */ - int y, z; - - /* - * given the number of a bit position, >=0, flips the bit order - * each byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12 - */ - y = x / 8; - z = x % 8; - - x = (7 - z) + (y * 8); - - return x; -#endif /* LSBFIRST */ -} - -afs_uint32 -swap_bit_pos_0_to_ansi(afs_uint32 x) -{ - /* zero based version */ - - /* - * This corrects for the bit ordering of the algorithm, e.g. - * bit 0 ==> msb, bit 7 lsb. - */ - - int y, z; - /* - * given the number of a bit position, >=0, flips the bit order each - * byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12 - */ - y = x / 8; - z = x % 8; - - x = (7 - z) + (y * 8); - - return x; -} - -afs_uint32 -rev_swap_bit_pos_0(afs_uint32 x) -{ - /* zero based version */ - - /* - * This corrects for the bit ordering of the algorithm, e.g. - * bit 0 ==> msb, bit 7 lsb. - * - * Role of LSB and MSB flipped from the swap_bit_pos_0() - */ - -#ifdef LSBFIRST - return x; -#else /* MSBFIRST */ - - int y, z; - - /* - * given the number of a bit position, >=0, flips the bit order each - * byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12 - */ - y = x / 8; - z = x % 8; - - x = (7 - z) + (y * 8); - - return x; -#endif /* MSBFIRST */ -} - -afs_uint32 -swap_byte_bits(afs_uint32 x) -{ -#ifdef MSBFIRST - return x; -#else /* LSBFIRST */ - - char *array = (char *)&x; - afs_uint32 old, new, j; - - /* flips the bit order within each byte from 0 lsb to 0 msb */ - old = *array; - new = 0; - for (j = 0; j <= 7; j++) { - new |= (old & 01); /* copy a bit */ - if (j < 7) { - old = old >> 1; - new = new << 1; - } - } - return new; -#endif /* LSBFIRST */ -} - -int -swap_long_bytes_bit_number(afs_uint32 x) -{ - /* - * given a bit number (0-31) from a vax, swap the byte part of the - * bit number to change the byte ordering to mSBFIRST type - */ -#ifdef LSBFIRST - return x; -#else /* MSBFIRST */ - afs_uint32 y, z; - - y = x / 8; /* initial byte component */ - z = x % 8; /* bit within byte */ - - x = (3 - y) * 8 + z; - return x; -#endif /* MSBFIRST */ -} - -#if !defined(KERNEL) && defined(AFS_DARWIN80_ENV) -char *_darwin_whichstr[] = { - "#if defined(__ppc__) || defined(__ppc64__)\n", - "#elif defined(__i386__) || defined(__amd64__) || defined(__arm__)\n", - "#else\n#error architecture unsupported\n#endif\n" -}; -int _darwin_which = 1; - -int -_darwin_swap_long_bytes_bit_number(afs_uint32 x) -{ - /* - * given a bit number (0-31) from a vax, swap the byte part of the - * bit number to change the byte ordering to mSBFIRST type - */ - - afs_uint32 y, z; - - if (!_darwin_which) - return x; - - y = x / 8; /* initial byte component */ - z = x % 8; /* bit within byte */ - - x = (3 - y) * 8 + z; - return x; -} -#endif /* !KERNEL && AFS_DARWIN80_ENV */ - -void -test_set(FILE * stream, const char *src, int testbit, const char *dest, - int setbit) -{ -#ifdef DES_SHIFT_SHIFT - if (testbit == setbit) - fprintf(stream, " %s |= %s & (1<<%2d);\n", dest, src, testbit); - else - fprintf(stream, " %s |= (%s & (1<<%2d)) %s %2d;\n", dest, src, - testbit, (testbit < setbit) ? "<<" : ">>", - abs(testbit - setbit)); -#else - fprintf(stream, " if (%s & (1<<%2d)) %s |= 1<<%2d;\n", src, testbit, - dest, setbit); -#endif -} diff --git a/src/des/mit-cpyright.h b/src/des/mit-cpyright.h deleted file mode 100644 index cffdfc8d2a..0000000000 --- a/src/des/mit-cpyright.h +++ /dev/null @@ -1 +0,0 @@ -/* All rights reserved. */ diff --git a/src/des/new_rnd_key.c b/src/des/new_rnd_key.c deleted file mode 100644 index d91a255eb0..0000000000 --- a/src/des/new_rnd_key.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * New pseudo-random key generator, using DES encryption to make the - * pseudo-random cycle as hard to break as DES. - * - * Written by Mark Lillibridge, MIT Project Athena - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - */ - -#include "mit-cpyright.h" - -#include -#include - - -#ifndef KERNEL -#include -#endif -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#ifdef AFS_PTHREAD_ENV -#include -#endif -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - -static afs_int32 des_set_sequence_number(des_cblock new_sequence_number); -static afs_int32 des_generate_random_block(des_cblock block); - -#define XPRT_NEW_RND_KEY - -static int is_inited = 0; -#ifdef AFS_PTHREAD_ENV -/* - * This mutex protects the following global variables: - * is_inited - */ - -#include -pthread_mutex_t des_init_mutex -#ifdef PTHREAD_MUTEX_INITIALIZER -= PTHREAD_MUTEX_INITIALIZER -#endif -; -#define LOCK_INIT assert(pthread_mutex_lock(&des_init_mutex)==0) -#define UNLOCK_INIT assert(pthread_mutex_unlock(&des_init_mutex)==0) -#else -#define LOCK_INIT -#define UNLOCK_INIT -#endif -/* - * des_random_key: create a random des key - * - * You should call des_set_random_number_generater_seed at least - * once before this routine is called. If you haven't, I'll try - * to add a little randomness to the start point anyway. Yes, - * it recurses. Deal with it. - * - * Notes: the returned key has correct parity and is guarenteed not - * to be a weak des key. Des_generate_random_block is used to - * provide the random bits. - */ -int -des_random_key(des_cblock key) -{ - LOCK_INIT; - if (!is_inited) { - des_init_random_number_generator(key); - } - UNLOCK_INIT; - do { - des_generate_random_block(key); - des_fixup_key_parity(key); - } while (des_is_weak_key(key)); - - return (0); -} - -/* - * des_init_random_number_generator: - * - * This routine takes a secret key possibly shared by a number - * of servers and uses it to generate a random number stream that is - * not shared by any of the other servers. It does this by using the current - * process id, host id, and the current time to the nearest second. The - * resulting stream seed is not useful information for cracking the secret - * key. Moreover, this routine keeps no copy of the secret key. - * This routine is used for example, by the kerberos server(s) with the - * key in question being the kerberos master key. - * - * Note: this routine calls des_set_random_generator_seed. - */ -#if !defined(BSDUNIX) && !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) -you lose ... (aka, you get to implement an analog of this for your system ...) -#else - -#ifdef AFS_NT40_ENV -#include -#include -#include -#else -#include -#include -#endif - -void -des_init_random_number_generator(des_cblock key) -{ - struct { /* This must be 64 bits exactly */ - afs_int32 process_id; - afs_int32 host_id; - } seed; - struct timeval time; /* this must also be 64 bits exactly */ - des_cblock new_key; - - is_inited = 1; - /* - * use a host id and process id in generating the seed to ensure - * that different servers have different streams: - */ -#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) - seed.host_id = gethostid(); -#endif - seed.process_id = getpid(); - - /* - * Generate a tempory value that depends on the key, host_id, and - * process_id such that it gives no useful information about the key: - */ - des_set_random_generator_seed(key); - des_set_sequence_number((unsigned char *)&seed); - des_random_key(new_key); - - /* - * use it to select a random stream: - */ - des_set_random_generator_seed(new_key); - - /* - * use a time stamp to ensure that a server started later does not reuse - * an old stream: - */ - gettimeofday(&time, NULL); - des_set_sequence_number((unsigned char *)&time); - - /* - * use the time stamp finally to select the final seed using the - * current random number stream: - */ - des_random_key(new_key); - des_set_random_generator_seed(new_key); -} - -#endif /* ifdef BSDUNIX */ - -/* - * This module implements a random number generator faculty such that the next - * number in any random number stream is very hard to predict without knowing - * the seed for that stream even given the preceeding random numbers. - */ - -/* - * The secret des key schedule for the current stream of random numbers: - */ -static union { - afs_int32 align; - des_key_schedule d; -} random_sequence_key; - -/* - * The sequence # in the current stream of random numbers: - */ -static unsigned char sequence_number[8]; - -#ifdef AFS_PTHREAD_ENV -/* - * This mutex protects the following global variables: - * random_sequence_key - * sequence_number - */ - -#include -pthread_mutex_t des_random_mutex -#ifdef PTHREAD_MUTEX_INITIALIZER -= PTHREAD_MUTEX_INITIALIZER -#endif -; -#define LOCK_RANDOM assert(pthread_mutex_lock(&des_random_mutex)==0) -#define UNLOCK_RANDOM assert(pthread_mutex_unlock(&des_random_mutex)==0) -#else -#define LOCK_RANDOM -#define UNLOCK_RANDOM -#endif - -/* - * des_set_random_generator_seed: this routine is used to select a random - * number stream. The stream that results is - * totally determined by the passed in key. - * (I.e., calling this routine again with the - * same key allows repeating a sequence of - * random numbers) - * - * Requires: key is a valid des key. I.e., has correct parity and is not a - * weak des key. - */ -void -des_set_random_generator_seed(des_cblock key) -{ - int i; - - /* select the new stream: (note errors are not possible here...) */ - LOCK_RANDOM; - des_key_sched(key, random_sequence_key.d); - - /* "seek" to the start of the stream: */ - for (i = 0; i < 8; i++) - sequence_number[i] = 0; - UNLOCK_RANDOM; -} - -/* - * des_set_sequence_number: this routine is used to set the sequence number - * of the current random number stream. This routine - * may be used to "seek" within the current random - * number stream. - * - * Note that des_set_random_generator_seed resets the sequence number to 0. - */ -static afs_int32 -des_set_sequence_number(des_cblock new_sequence_number) -{ - LOCK_RANDOM; - memcpy((char *)sequence_number, (char *)new_sequence_number, - sizeof(sequence_number)); - UNLOCK_RANDOM; - return 0; -} - -/* - * des_generate_random_block: routine to return the next random number - * from the current random number stream. - * The returned number is 64 bits long. - * - * Requires: des_set_random_generator_seed must have been called at least once - * before this routine is called. - */ -static afs_int32 -des_generate_random_block(des_cblock block) -{ - int i; - - /* - * Encrypt the sequence number to get the new random block: - */ - LOCK_RANDOM; - des_ecb_encrypt(sequence_number, block, random_sequence_key.d, 1); - - /* - * Increment the sequence number as an 8 byte unsigned number with wrap: - * (using LSB here) - */ - for (i = 0; i < 8; i++) { - sequence_number[i] = (sequence_number[i] + 1) & 0xff; - if (sequence_number[i]) - break; - } - UNLOCK_RANDOM; - return 0; -} diff --git a/src/des/pcbc_encrypt.c b/src/des/pcbc_encrypt.c deleted file mode 100644 index 563dd7de86..0000000000 --- a/src/des/pcbc_encrypt.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * These routines perform encryption and decryption using the DES - * private key algorithm, or else a subset of it-- fewer inner loops. - * ( AUTH_DES_ITER defaults to 16, may be less) - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * The key schedule is passed as an arg, as well as the cleartext or - * ciphertext. The cleartext and ciphertext should be in host order. - * - * These routines form the library interface to the des facilities. - * - * spm 8/85 MIT project athena - */ - -#include "mit-cpyright.h" -#ifndef KERNEL -#include -#include -#endif -#include -#include -#include "des.h" -#include "des_prototypes.h" - - -#include "des_internal.h" - -#define XPRT_PCBC_ENCRYPT - -/* - * pcbc_encrypt is an "error propagation chaining" encrypt operation - * for DES, similar to CBC, but that, on encryption, "xor"s the - * plaintext of block N with the ciphertext resulting from block N, - * then "xor"s that result with the plaintext of block N+1 prior to - * encrypting block N+1. (decryption the appropriate inverse. This - * "pcbc" mode propagates a single bit error anywhere in either the - * cleartext or ciphertext chain all the way through to the end. In - * contrast, CBC mode limits a single bit error in the ciphertext to - * affect only the current (8byte) block and the subsequent block. - * - * performs pcbc error-propagation chaining operation by xor-ing block - * N+1 with both the plaintext (block N) and the ciphertext from block - * N. Either encrypts from cleartext to ciphertext, if encrypt != 0 - * or decrypts from ciphertext to cleartext, if encrypt == 0 - * - * NOTE-- the output is ALWAYS an multiple of 8 bytes long. If not - * enough space was provided, your program will get trashed. - * - * For encryption, the cleartext string is null padded, at the end, to - * an integral multiple of eight bytes. - * - * For decryption, the ciphertext will be used in integral multiples - * of 8 bytes, but only the first "length" bytes returned into the - * cleartext. - * - * This is NOT a standard mode of operation. - * - */ -/* - des_cblock *in; * >= length bytes of input text * - des_cblock *out; * >= length bytes of output text * - afs_int32 length; * in bytes * - int encrypt; * 0 ==> decrypt, else encrypt * - des_key_schedule key; * precomputed key schedule * - des_cblock *iv; * 8 bytes of ivec * -*/ -afs_int32 -des_pcbc_encrypt(void * in, void * out, afs_int32 length, - des_key_schedule key, des_cblock * iv, int encrypt) -{ - afs_uint32 *input = (afs_uint32 *) in; - afs_uint32 *output = (afs_uint32 *) out; - afs_uint32 *ivec = (afs_uint32 *) iv; - - afs_uint32 i, j; - afs_uint32 t_input[2]; - afs_uint32 t_output[2]; - unsigned char *t_in_p = (unsigned char *)t_input; - afs_uint32 xor_0, xor_1; - - if (encrypt) { -#ifdef MUSTALIGN - if (afs_pointer_to_int(ivec) & 3) { - memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); - memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); - } else -#endif - { - xor_0 = *ivec++; - xor_1 = *ivec; - } - - for (i = 0; length > 0; i++, length -= 8) { - /* get input */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(input) & 3) { - memcpy((char *)&t_input[0], (char *)input, - sizeof(t_input[0])); - memcpy((char *)&t_input[1], (char *)(input + 1), - sizeof(t_input[1])); - } else -#endif - { - t_input[0] = *input; - t_input[1] = *(input + 1); - } - - /* zero pad */ - if (length < 8) { - for (j = length; j <= 7; j++) - *(t_in_p + j) = 0; - } -#ifdef DEBUG - if (des_debug) - des_debug_print("clear", length, t_input[0], t_input[1]); -#endif - /* do the xor for cbc into the temp */ - t_input[0] ^= xor_0; - t_input[1] ^= xor_1; - /* encrypt */ - (void)des_ecb_encrypt(t_input, t_output, key, encrypt); - - /* - * We want to XOR with both the plaintext and ciphertext - * of the previous block, before we write the output, in - * case both input and output are the same space. - */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(input) & 3) { - memcpy((char *)&xor_0, (char *)input++, sizeof(xor_0)); - xor_0 ^= t_output[0]; - memcpy((char *)&xor_1, (char *)input++, sizeof(xor_1)); - xor_1 ^= t_output[1]; - } else -#endif - { - xor_0 = *input++ ^ t_output[0]; - xor_1 = *input++ ^ t_output[1]; - } - - - /* copy temp output and save it for cbc */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(output) & 3) { - memcpy((char *)output++, (char *)&t_output[0], - sizeof(t_output[0])); - memcpy((char *)output++, (char *)&t_output[1], - sizeof(t_output[1])); - } else -#endif - { - *output++ = t_output[0]; - *output++ = t_output[1]; - } - -#ifdef DEBUG - if (des_debug) { - des_debug_print("xor'ed", i, t_input[0], t_input[1]); - des_debug_print("cipher", i, t_output[0], t_output[1]); - } -#endif - } - t_output[0] = 0; - t_output[1] = 0; - xor_0 = 0; - xor_1 = 0; - return 0; - } - - else { - /* decrypt */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(ivec) & 3) { - memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); - memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); - } else -#endif - { - xor_0 = *ivec++; - xor_1 = *ivec; - } - - for (i = 0; length > 0; i++, length -= 8) { - /* get input */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(input) & 3) { - memcpy((char *)&t_input[0], (char *)input++, - sizeof(t_input[0])); - memcpy((char *)&t_input[1], (char *)input++, - sizeof(t_input[1])); - } else -#endif - { - t_input[0] = *input++; - t_input[1] = *input++; - } - - /* no padding for decrypt */ -#ifdef DEBUG - if (des_debug) - des_debug_print("cipher", i, t_input[0], t_input[1]); -#else -#ifdef lint - i = i; -#endif -#endif - /* encrypt */ - (void)des_ecb_encrypt(t_input, t_output, key, encrypt); -#ifdef DEBUG - if (des_debug) - des_debug_print("out pre xor", i, t_output[0], t_output[1]); -#endif - /* do the xor for cbc into the output */ - t_output[0] ^= xor_0; - t_output[1] ^= xor_1; - /* copy temp output */ -#ifdef MUSTALIGN - if (afs_pointer_to_int(output) & 3) { - memcpy((char *)output++, (char *)&t_output[0], - sizeof(t_output[0])); - memcpy((char *)output++, (char *)&t_output[1], - sizeof(t_output[1])); - } else -#endif - { - *output++ = t_output[0]; - *output++ = t_output[1]; - } - - /* save xor value for next round */ - xor_0 = t_output[0] ^ t_input[0]; - xor_1 = t_output[1] ^ t_input[1]; - -#ifdef DEBUG - if (des_debug) - des_debug_print("clear", i, t_output[0], t_output[1]); -#endif - } - return 0; - } -} diff --git a/src/des/quad_cksum.c b/src/des/quad_cksum.c deleted file mode 100644 index 8f6fe1cd4b..0000000000 --- a/src/des/quad_cksum.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Quadratic Congruential Manipulation Dectection Code - * - * ref: "Message Authentication" - * R.R. Jueneman, S. M. Matyas, C.H. Meyer - * IEEE Communications Magazine, - * Sept 1985 Vol 23 No 9 p 29-40 - * - * This routine, part of the Athena DES library built for the Kerberos - * authentication system, calculates a manipulation detection code for - * a message. It is a much faster alternative to the DES-checksum - * method. No guarantees are offered for its security. Refer to the - * paper noted above for more information - * - * Implementation for 4.2bsd - * by S.P. Miller Project Athena/MIT - */ - -/* - * Algorithm (per paper): - * define: - * message to be composed of n m-bit blocks X1,...,Xn - * optional secret seed S in block X1 - * MDC in block Xn+1 - * prime modulus N - * accumulator Z - * initial (secret) value of accumulator C - * N, C, and S are known at both ends - * C and , optionally, S, are hidden from the end users - * then - * (read array references as subscripts over time) - * Z[0] = c; - * for i = 1...n - * Z[i] = (Z[i+1] + X[i])**2 modulo N - * X[n+1] = Z[n] = MDC - * - * Then pick - * N = 2**31 -1 - * m = 16 - * iterate 4 times over plaintext, also use Zn - * from iteration j as seed for iteration j+1, - * total MDC is then a 128 bit array of the four - * Zn; - * - * return the last Zn and optionally, all - * four as output args. - * - * Modifications: - * To inhibit brute force searches of the seed space, this - * implementation is modified to have - * Z = 64 bit accumulator - * C = 64 bit C seed - * N = 2**63 - 1 - * S = S seed is not implemented here - * arithmetic is not quite real double integer precision, since we - * cant get at the carry or high order results from multiply, - * but nontheless is 64 bit arithmetic. - */ - -#include -#include -#include - - -#include "mit-cpyright.h" - -/* System include files */ -#ifndef KERNEL -#include -#endif -#include - -/* Application include files */ -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -/* Definitions for byte swapping */ - -#ifdef LSBFIRST -#define vaxtohl(x) (*((afs_uint32 *)(x))) -#define vaxtohs(x) (*((unsigned short *)(x))) -#else -#define vaxtohl(x) four_bytes_vax_to_nets((char *)(x)) -#define vaxtohs(x) two_bytes_vax_to_nets((char *)(x)) -#endif - -/*** Routines ***************************************************** */ - -#ifdef MSBFIRST - -static unsigned short -two_bytes_vax_to_nets(char *p) -{ - union { - char pieces[2]; - unsigned short result; - } short_conv; - - short_conv.pieces[0] = p[1]; - short_conv.pieces[1] = p[0]; - return (short_conv.result); -} - -static afs_uint32 -four_bytes_vax_to_nets(char *p) -{ - union { - char pieces[4]; - afs_uint32 result; - } long_conv; - - long_conv.pieces[0] = p[3]; - long_conv.pieces[1] = p[2]; - long_conv.pieces[2] = p[1]; - long_conv.pieces[3] = p[0]; - return (long_conv.result); -} - -#endif - -/* - des_cblock *c_seed; * secret seed, 8 bytes * - unsigned char *in; * input block * - afs_uint32 *out; * optional longer output * - int out_count; * number of iterations * - afs_int32 length; * original length in bytes * -*/ - -afs_uint32 -des_quad_cksum(unsigned char *in, afs_uint32 * out, afs_int32 length, - int out_count, des_cblock * c_seed) -{ - - /* - * this routine both returns the low order of the final (last in - * time) 32bits of the checksum, and if "out" is not a null - * pointer, a longer version, up to entire 32 bytes of the - * checksum is written unto the address pointed to. - */ - - afs_uint32 z; - afs_uint32 z2; - afs_uint32 x; - afs_uint32 x2; - unsigned char *p; - afs_int32 len; - int i; - - /* use all 8 bytes of seed */ - - z = vaxtohl(c_seed); - z2 = vaxtohl((char *)c_seed + 4); - if (out == NULL) - out_count = 1; /* default */ - - /* This is repeated n times!! */ - for (i = 1; i <= 4 && i <= out_count; i++) { - len = length; - p = in; - while (len) { - if (len > 1) { - x = (z + vaxtohs(p)); - p += 2; - len -= 2; - } else { - x = (z + *(char *)p++); - len = 0; - } - x2 = z2; - z = ((x * x) + (x2 * x2)) % 0x7fffffff; - z2 = (x * (x2 + 83653421)) % 0x7fffffff; /* modulo */ - if (des_debug & 8) - printf("%ld %ld\n", afs_printable_int32_ld(z), - afs_printable_int32_ld(z2)); - } - - if (out != NULL) { - *out++ = z; - *out++ = z2; - } - } - /* return final z value as 32 bit version of checksum */ - return z; -} diff --git a/src/des/read_pssword.c b/src/des/read_pssword.c deleted file mode 100644 index 670a2d8848..0000000000 --- a/src/des/read_pssword.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * This routine prints the supplied string to standard - * output as a prompt, and reads a password string without - * echoing. - */ - -#include -#include - - -#include "mit-cpyright.h" -#include "des.h" -#include "conf.h" - -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - -#ifdef BSDUNIX -#ifdef AFS_SUN5_ENV -#define BSD_COMP -#endif -#include -#include -#include -#endif - -#ifdef HAVE_SIGNAL_H -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef AFS_HPUX_ENV -#include -#include -#include -static int intrupt; -#endif - -#ifdef HAVE_TERMIOS_H -#include -#endif - -#ifdef HAVE_WINDOWS_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -static int intrupt; -#if defined(AFS_SGI_ENV) || defined (AFS_AIX_ENV) || defined(AFS_XBSD_ENV) /*|| defined (AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) */ -#undef BSDUNIX -#endif - -#ifdef BSDUNIX -static jmp_buf env; -#endif - -#ifdef BSDUNIX -#define POSIX -#ifdef POSIX -typedef void sigtype; -#else -typedef int sigtype; -#endif -static sigtype sig_restore(); -static push_signals(), pop_signals(); -#endif - -#include "des_prototypes.h" - -/*** Routines ****************************************************** */ -int -des_read_password(des_cblock * k, char *prompt, int verify) -{ - int ok; - char key_string[BUFSIZ]; - -#ifdef BSDUNIX - if (setjmp(env)) { - ok = -1; - goto lose; - } -#endif - - ok = des_read_pw_string(key_string, BUFSIZ, prompt, verify); - if (ok == 0) - des_string_to_key(key_string, k); - -#ifdef BSDUNIX - lose: -#endif - memset(key_string, 0, sizeof(key_string)); - return ok; -} - -#if defined (AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) -static void catch(int); -#endif - -#if !defined(BSDUNIX) && (defined(AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)) -#include -#endif - -/* - * This version just returns the string, doesn't map to key. - * - * Returns 0 on success, non-zero on failure. - */ -int -des_read_pw_string(char *s, int maxa, char *prompt, int verify) -{ - int ok = 0, cnt1 = 0; - char *ptr; -#if defined(AFS_HPUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - int fno; - struct sigaction newsig, oldsig; - struct termios save_ttyb, ttyb; -#endif -#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - FILE *fi; -#endif -#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV) - struct termios ttyb; - struct sigaction osa, sa; -#endif -#ifdef BSDUNIX - jmp_buf old_env; - unsigned long flags; - struct sgttyb tty_state, echo_off_tty_state; - FILE *fi; -#else -#if defined (AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) - struct termio ttyb; - FILE *fi; - char savel, flags; - void (*sig) (int); -#endif -#endif -#ifdef AFS_NT40_ENV - HANDLE hConStdin; - DWORD oldConMode, newConMode; - BOOL resetConMode = FALSE; -#endif - char key_string[BUFSIZ]; - - if (maxa > BUFSIZ) { - return -1; - } -#if defined(AFS_HPUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - if ((fi = fopen("/dev/tty", "r")) == NULL) - return -1; - setbuf(fi, (char *)NULL); /* We don't want any buffering for our i/o. */ - /* - * Install signal handler for SIGINT so that we can restore - * the tty settings after we change them. The handler merely - * increments the variable "intrupt" to tell us that an - * interrupt signal was received. - */ - newsig.sa_handler = catch; - sigemptyset(&newsig.sa_mask); - newsig.sa_flags = 0; - sigaction(SIGINT, &newsig, &oldsig); - intrupt = 0; - - /* - * Get the terminal characters (save for later restoration) and - * reset them so that echo is off - */ - fno = fileno(fi); - tcgetattr(fno, &ttyb); - save_ttyb = ttyb; - ttyb.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - tcsetattr(fno, TCSAFLUSH, &ttyb); -#else -#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV) - if ((fi = fopen("/dev/tty", "r")) == NULL) { - return (-1); - } else - setbuf(fi, (char *)NULL); - sa.sa_handler = catch; - sa.sa_mask = 0; - sa.sa_flags = SA_INTERRUPT; - (void)sigaction(SIGINT, &sa, &osa); - intrupt = 0; - (void)ioctl(fileno(fi), TCGETS, &ttyb); - flags = ttyb.c_lflag; - ttyb.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - (void)ioctl(fileno(fi), TCSETSF, &ttyb); -#else -#ifdef BSDUNIX - /* XXX assume jmp_buf is typedef'ed to an array */ - memcpy((char *)env, (char *)old_env, sizeof(env)); - if (setjmp(env)) - goto lose; - /* save terminal state */ - if (ioctl(0, TIOCGETP, (char *)&tty_state) == -1) - return -1; - push_signals(); - /* Turn off echo */ - memcpy(&echo_off_tty_state, &tty_state, sizeof(tty_state)); - echo_off_tty_state.sg_flags &= ~ECHO; - if (ioctl(0, TIOCSETP, (char *)&echo_off_tty_state) == -1) - return -1; -#else -#if defined (AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) - if ((fi = fopen("/dev/tty", "r+")) == NULL) - return (-1); - else - setbuf(fi, (char *)NULL); - sig = signal(SIGINT, catch); - intrupt = 0; - (void)ioctl(fileno(fi), TCGETA, &ttyb); - savel = ttyb.c_line; - ttyb.c_line = 0; - flags = ttyb.c_lflag; - ttyb.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - (void)ioctl(fileno(fi), TCSETAF, &ttyb); -#else -#ifdef AFS_NT40_ENV - /* turn off console input echoing */ - if ((hConStdin = GetStdHandle(STD_INPUT_HANDLE)) != INVALID_HANDLE_VALUE) { - if (GetConsoleMode(hConStdin, &oldConMode)) { - newConMode = (oldConMode & ~(ENABLE_ECHO_INPUT)); - if (SetConsoleMode(hConStdin, newConMode)) { - resetConMode = TRUE; - } - } - } -#endif -#endif -#endif -#endif -#endif - while (!ok) { - (void)printf("%s", prompt); - (void)fflush(stdout); -#ifdef CROSSMSDOS - h19line(s, sizeof(s), 0); - if (!strlen(s)) - continue; -#else - if (!fgets(s, maxa, stdin)) { - clearerr(stdin); - printf("\n"); - if (cnt1++ > 1) { - /* - * Otherwise hitting ctrl-d will always leave us inside this loop forever! - */ - break; - } - continue; - } - if ((ptr = strchr(s, '\n'))) - *ptr = '\0'; -#endif - if (verify) { - printf("\nVerifying, please re-enter %s", prompt); - (void)fflush(stdout); -#ifdef CROSSMSDOS - h19line(key_string, sizeof(key_string), 0); - if (!strlen(key_string)) - continue; -#else - if (!fgets(key_string, sizeof(key_string), stdin)) { - clearerr(stdin); - continue; - } - if ((ptr = strchr(key_string, '\n'))) - *ptr = '\0'; -#endif - if (strcmp(s, key_string)) { - printf("\n\07\07Mismatch - try again\n"); - (void)fflush(stdout); - continue; - } - } - ok = 1; - } - -#ifdef BSDUNIX - lose: -#endif - if (!ok) - memset(s, 0, maxa); - printf("\n"); -#if defined(AFS_HPUX_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) - /* - * Restore the terminal to its previous characteristics. - * Restore the old signal handler for SIGINT. - */ - tcsetattr(fno, TCSANOW, &save_ttyb); - sigaction(SIGINT, &oldsig, NULL); - if (fi != stdin) - fclose(fi); - - /* - * If we got a SIGINT while we were doing things, send the SIGINT - * to ourselves so that the calling program receives it (since we - * were intercepting it for a period of time.) - */ - if (intrupt) - kill(getpid(), SIGINT); -#else -#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV) - ttyb.c_lflag = flags; - (void)ioctl(fileno(fi), TCSETSW, &ttyb); - (void)sigaction(SIGINT, &osa, (struct sigaction *)NULL); - if (fi != stdin) - (void)fclose(fi); -#else -#ifdef BSDUNIX - if (ioctl(0, TIOCSETP, (char *)&tty_state)) - ok = 0; - pop_signals(); - memcpy((char *)old_env, (char *)env, sizeof(env)); -#else -#if defined (AFS_AIX_ENV) /*|| defined (AFS_HPUX_ENV)*/ || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) - ttyb.c_lflag = flags; - ttyb.c_line = savel; - (void)ioctl(fileno(fi), TCSETAW, &ttyb); - (void)signal(SIGINT, sig); - if (fi != stdin) - (void)fclose(fi); - if (intrupt) - (void)kill(getpid(), SIGINT); -#else -#ifdef AFS_NT40_ENV - /* restore console to original mode settings */ - if (resetConMode) { - (void)SetConsoleMode(hConStdin, oldConMode); - } -#endif -#endif -#endif -#endif -#endif - if (verify) - memset(key_string, 0, sizeof(key_string)); - s[maxa - 1] = 0; /* force termination */ - return !ok; /* return nonzero if not okay */ -} - -#ifdef BSDUNIX -/* - * this can be static since we should never have more than - * one set saved.... - */ -#ifdef mips -void static (*old_sigfunc[NSIG]) (); -#else -static sigtype(*old_sigfunc[NSIG]) (); -#endif - -static -push_signals() -{ - int i; - for (i = 0; i < NSIG; i++) - old_sigfunc[i] = signal(i, sig_restore); -} - -static -pop_signals() -{ - int i; - for (i = 0; i < NSIG; i++) - (void)signal(i, old_sigfunc[i]); -} - -static sigtype -sig_restore() -{ - longjmp(env, 1); -} -#endif - - -#if defined (AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) -static void -catch(int junk) -{ - ++intrupt; -} -#endif diff --git a/src/des/s_table.h.ibm b/src/des/s_table.h.ibm deleted file mode 100644 index 54ba04b8ed..0000000000 --- a/src/des/s_table.h.ibm +++ /dev/null @@ -1,47 +0,0 @@ - -/* des_s_tables.h - * derived from des_make_s_tables.c - */ -static unsigned char S_adj[8][64] = /* adjusted */ -{ - -14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, - 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, - 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, -15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, - -15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, - 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, - 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, - 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, - -10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, - 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, -13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, -11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, - - 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, - 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, -10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, -15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, - - 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, - 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, - 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, -15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, - -12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, - 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, - 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, - 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, - - 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, - 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, - 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, -10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, - -13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, -10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, - 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, - 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 -}; diff --git a/src/des/strng_to_key.c b/src/des/strng_to_key.c deleted file mode 100644 index 61507494b1..0000000000 --- a/src/des/strng_to_key.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988, 1989 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * These routines perform encryption and decryption using the DES - * private key algorithm, or else a subset of it-- fewer inner loops. - * (AUTH_DES_ITER defaults to 16, may be less.) - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * The key schedule is passed as an arg, as well as the cleartext or - * ciphertext. The cleartext and ciphertext should be in host order. - * - * These routines form the library interface to the DES facilities. - * - * spm 8/85 MIT project athena - */ - -#include "mit-cpyright.h" -#include -#include - - -#ifndef KERNEL -#include -#endif - -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - -/* - * convert an arbitrary length string to a DES key - */ -void -des_string_to_key(char *str, des_cblock * key) -{ - char *in_str; - unsigned temp, i, j; - afs_int32 length; - unsigned char *k_p; - int forward; - char *p_char; - char k_char[64]; - des_key_schedule key_sked; - - in_str = str; - forward = 1; - p_char = k_char; - length = strlen(str); - - /* init key array for bits */ - memset(k_char, 0, sizeof(k_char)); - -#ifdef DEBUG - if (des_debug) - fprintf(stdout, - "\n\ninput str length = %d string = %s\nstring = 0x ", - length, str); -#endif - - /* get next 8 bytes, strip parity, xor */ - for (i = 1; i <= length; i++) { - /* get next input key byte */ - temp = (unsigned int)*str++; -#ifdef DEBUG - if (des_debug) - fprintf(stdout, "%02x ", temp & 0xff); -#endif - /* loop through bits within byte, ignore parity */ - for (j = 0; j <= 6; j++) { - if (forward) - *p_char++ ^= (int)temp & 01; - else - *--p_char ^= (int)temp & 01; - temp = temp >> 1; - } while (--j > 0); - - /* check and flip direction */ - if ((i % 8) == 0) - forward = !forward; - } - - /* now stuff into the key des_cblock, and force odd parity */ - p_char = k_char; - k_p = (unsigned char *)key; - - for (i = 0; i <= 7; i++) { - temp = 0; - for (j = 0; j <= 6; j++) - temp |= *p_char++ << (1 + j); - *k_p++ = (unsigned char)temp; - } - - /* fix key parity */ - des_fixup_key_parity(cblockptr_to_cblock(key)); - - /* Now one-way encrypt it with the folded key */ - des_key_sched(cblockptr_to_cblock(key), key_sked); - des_cbc_cksum(charptr_to_cblockptr(in_str), key, length, key_sked, key); - /* erase key_sked */ - memset(key_sked, 0, sizeof(key_sked)); - - /* now fix up key parity again */ - des_fixup_key_parity(cblockptr_to_cblock(key)); - - if (des_debug) - fprintf(stdout, "\nResulting string_to_key = 0x%x 0x%x\n", - *((afs_uint32 *) key), *((afs_uint32 *) key + 1)); -} diff --git a/src/des/tables.h b/src/des/tables.h deleted file mode 100644 index 692a1b48ce..0000000000 --- a/src/des/tables.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * part of the Athena Kerberos encryption system - * - * spm 8/85 - */ - -/* - * Initial permutation, adjust to zero based subscript - */ -#ifdef WANT_IP_TABLE -static char IP[] = { - 58 - 1, 50 - 1, 42 - 1, 34 - 1, 26 - 1, 18 - 1, 10 - 1, 2 - 1, - 60 - 1, 52 - 1, 44 - 1, 36 - 1, 28 - 1, 20 - 1, 12 - 1, 4 - 1, - 62 - 1, 54 - 1, 46 - 1, 38 - 1, 30 - 1, 22 - 1, 14 - 1, 6 - 1, - 64 - 1, 56 - 1, 48 - 1, 40 - 1, 32 - 1, 24 - 1, 16 - 1, 8 - 1, - 57 - 1, 49 - 1, 41 - 1, 33 - 1, 25 - 1, 17 - 1, 9 - 1, 1 - 1, - 59 - 1, 51 - 1, 43 - 1, 35 - 1, 27 - 1, 19 - 1, 11 - 1, 3 - 1, - 61 - 1, 53 - 1, 45 - 1, 37 - 1, 29 - 1, 21 - 1, 13 - 1, 5 - 1, - 63 - 1, 55 - 1, 47 - 1, 39 - 1, 31 - 1, 23 - 1, 15 - 1, 7 - 1, -}; -#endif - -/* - * Final permutation, FP = IP^(-1) adjust to zero based subscript - */ -#ifdef WANT_FP_TABLE -static char FP[] = { - 40 - 1, 8 - 1, 48 - 1, 16 - 1, 56 - 1, 24 - 1, 64 - 1, 32 - 1, - 39 - 1, 7 - 1, 47 - 1, 15 - 1, 55 - 1, 23 - 1, 63 - 1, 31 - 1, - 38 - 1, 6 - 1, 46 - 1, 14 - 1, 54 - 1, 22 - 1, 62 - 1, 30 - 1, - 37 - 1, 5 - 1, 45 - 1, 13 - 1, 53 - 1, 21 - 1, 61 - 1, 29 - 1, - 36 - 1, 4 - 1, 44 - 1, 12 - 1, 52 - 1, 20 - 1, 60 - 1, 28 - 1, - 35 - 1, 3 - 1, 43 - 1, 11 - 1, 51 - 1, 19 - 1, 59 - 1, 27 - 1, - 34 - 1, 2 - 1, 42 - 1, 10 - 1, 50 - 1, 18 - 1, 58 - 1, 26 - 1, - 33 - 1, 1 - 1, 41 - 1, 9 - 1, 49 - 1, 17 - 1, 57 - 1, 25 - 1, -}; -#endif - -/* the E selection function, adjusted to zero based subscripts */ -#ifdef WANT_E_TABLE -static char E[] = { - 32 - 1, 1 - 1, 2 - 1, 3 - 1, 4 - 1, 5 - 1, - 4 - 1, 5 - 1, 6 - 1, 7 - 1, 8 - 1, 9 - 1, - 8 - 1, 9 - 1, 10 - 1, 11 - 1, 12 - 1, 13 - 1, - 12 - 1, 13 - 1, 14 - 1, 15 - 1, 16 - 1, 17 - 1, - 16 - 1, 17 - 1, 18 - 1, 19 - 1, 20 - 1, 21 - 1, - 20 - 1, 21 - 1, 22 - 1, 23 - 1, 24 - 1, 25 - 1, - 24 - 1, 25 - 1, 26 - 1, 27 - 1, 28 - 1, 29 - 1, - 28 - 1, 29 - 1, 30 - 1, 31 - 1, 32 - 1, 1 - 1, -}; -#endif - -/* the P permutation, adjusted to zero based subscripts */ -#ifdef WANT_P_TABLE -static char P[] = { - 16 - 1, 7 - 1, 20 - 1, 21 - 1, - 29 - 1, 12 - 1, 28 - 1, 17 - 1, - 1 - 1, 15 - 1, 23 - 1, 26 - 1, - 5 - 1, 18 - 1, 31 - 1, 10 - 1, - 2 - 1, 8 - 1, 24 - 1, 14 - 1, - 32 - 1, 27 - 1, 3 - 1, 9 - 1, - 19 - 1, 13 - 1, 30 - 1, 6 - 1, - 22 - 1, 11 - 1, 4 - 1, 25 - 1, -}; -#endif - -/* S tables, original form */ -#ifdef WANT_S_TABLE -static char S[8][64] = { - {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, - 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, - 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, - 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,}, - - {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, - 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, - 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, - 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,}, - - {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, - 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, - 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,}, - - {7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, - 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, - 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, - 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,}, - - {2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, - 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, - 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, - 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,}, - - {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, - 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, - 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, - 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,}, - - {4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, - 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, - 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, - 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,}, - - {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, - 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, - 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, - 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11} -}; -#endif diff --git a/src/des/test/Makefile.in b/src/des/test/Makefile.in deleted file mode 100644 index c99bcc2e7d..0000000000 --- a/src/des/test/Makefile.in +++ /dev/null @@ -1,32 +0,0 @@ -srcdir=@srcdir@ -include @TOP_OBJDIR@/src/config/Makefile.config -include @TOP_OBJDIR@/src/config/Makefile.lwp - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ - -# Test programs -PROGS = \ - key_test \ - testit \ - verify - -LIBS=\ - ${TOP_LIBDIR}/libdes.a \ - -all test: $(PROGS) - -clean: - $(RM) -f *.o *.a testit verify key_test core - -install: - -testit: testit.o - $(AFS_LDRULE) testit.o ${LIBS} -verify: verify.o ../libdes.a - $(AFS_LDRULE) verify.o ${LIBS} -key_test: key_test.o ../libdes.a - $(AFS_LDRULE) key_test.o ${LIBS} - diff --git a/src/des/test/NTMakefile b/src/des/test/NTMakefile deleted file mode 100644 index 9c07e726fa..0000000000 --- a/src/des/test/NTMakefile +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2000, International Business Machines Corporation and others. -# All Rights Reserved. -# -# This software has been released under the terms of the IBM Public -# License. For details, see the LICENSE file in the top-level source -# directory or online at http://www.openafs.org/dl/license10.html - -RELDIR=des\test -!include ..\..\config\NTMakefile.$(SYS_NAME) - -$(OUT)\testit.exe: $(OUT)\testit.obj $(DESTDIR)\lib\afsdes.lib $(DESTDIR)\lib\afs\afsutil.lib - $(EXECONLINK) - -$(OUT)\verify.exe: $(OUT)\verify.obj $(DESTDIR)\lib\afsdes.lib $(DESTDIR)\lib\afs\afsutil.lib - $(EXECONLINK) - -$(OUT)\key_test.exe: $(OUT)\key_test.obj $(DESTDIR)\lib\afsdes.lib $(DESTDIR)\lib\afs\afsutil.lib - $(EXECONLINK) - -$(OUT)\tests: $(OUT)\testit.exe $(OUT)\verify.exe $(OUT)\key_test.exe - -mkdir: - diff --git a/src/des/test/key_test.c b/src/des/test/key_test.c deleted file mode 100644 index 0ba5efb719..0000000000 --- a/src/des/test/key_test.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * exit status: 0 ==> success - * -1 ==> error - */ - -#include -#include - - -#include -#include -#include -#include - -#define MIN_ARGC 0 /* min # args, not incl flags */ -#define MAX_ARGC 99 /* max # args, not incl flags */ - -extern char *errmsg(); -extern int des_key_sched(); -char *progname; -int sflag; -int vflag; -int kflag; -int mflag; -int pid; -extern int des_debug; - -afs_int32 dummy[2]; -unsigned char dum_c[8] = { 0x80, 1, 1, 1, 1, 1, 1, 1 }; -des_key_schedule KS; -des_cblock kk; - -main(argc, argv) - int argc; - char *argv[]; -{ - /* Local Declarations */ - - int i; - progname = argv[0]; /* salt away invoking program */ - - while (--argc > 0 && (*++argv)[0] == '-') - for (i = 1; argv[0][i] != '\0'; i++) { - switch (argv[0][i]) { - - /* debug flag */ - case 'd': - des_debug = 1; - continue; - - /* keys flag */ - case 'k': - kflag = 1; - continue; - - /* test ANSI msb only key */ - case 'm': - mflag = 1; - continue; - - default: - printf("%s: illegal flag \"%c\" ", progname, argv[0][i]); - exit(1); - } - }; - - if (argc < MIN_ARGC || argc > MAX_ARGC) { - printf("Usage: xxx [-xxx] xxx xxx\n"); - exit(1); - } - - /* argv[0] now points to first non-option arg, if any */ - - - if (des_debug) { - if (mflag) { - fprintf(stderr, "\nChecking a key 0x 80 01 01 01 01 01 01 01 "); - fprintf(stderr, "\nKey = "); - des_key_sched(dum_c, KS); - des_cblock_print(dum_c); - return; - } - - if (kflag) { - printf("\nCHecking a weak key..."); - dummy[0] = 0x01fe01fe; - dummy[1] = 0x01fe01fe; - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - - dummy[0] = 0x01010101; - dummy[1] = 0x01010101; -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKS= %x", *(afs_int32 *) KS); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKS= %X", *(afs_int32 *) KS); -#endif - dummy[0] = 0x01010101; - dummy[1] = 0x01010101; -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKS= %x", *(afs_int32 *) KS); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKS= %X", *(afs_int32 *) KS); -#endif - - dummy[0] = 0x80808080; - dummy[1] = 0x80808080; -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKS[0]= %x", *(afs_int32 *) KS); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKS[0]= %X", *(afs_int32 *) KS); -#endif - - printf("\nstring to key 'a'"); - des_string_to_key("a", dummy); -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKS= %x", *(afs_int32 *) KS); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKS= %X", *(afs_int32 *) KS); -#endif - - printf("\nstring to key 'c'"); - des_string_to_key("c", dummy); -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKS= %x", *(afs_int32 *) KS); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKS= %X", *(afs_int32 *) KS); -#endif - } - - printf("\nstring to key 'e'"); - des_string_to_key("e", dummy); -#ifdef BSDUNIX - fprintf(stderr, "\nKey[0] = %x Key[1] = %x", dummy[0], dummy[1]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKey[0] = %X Key[1] = %X", dummy[0], dummy[1]); -#endif - des_key_sched(dummy, KS); -#ifdef BSDUNIX - fprintf(stderr, "\nKS= %x", KS[0]); -#endif -#ifdef CROSSMSDOS - fprintf(stderr, "\nKS= %X", KS[0]); -#endif - - printf("\ndes_string_to_key '%s'", argv[0]); - des_string_to_key(argv[0], dummy); -#ifdef notdef - des_string_to_key(argv[0], dummy); - - for (i = 0; i < 1; i++) - des_key_sched(dummy, KS); - } else { - for (i = 0; i < 1000; i++) { - des_string_to_key(argv[0], kk); - des_key_sched(kk, KS); - } -#endif - } -} diff --git a/src/des/test/testit.c b/src/des/test/testit.c deleted file mode 100644 index 3579cba346..0000000000 --- a/src/des/test/testit.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * exit returns 0 ==> success - * -1 ==> error - */ - -#include -#include -#include -#include -#include -#include - - - -#define MIN_ARGC 0 /* min # args, not incl flags */ -#define MAX_ARGC 2 /* max # args, not incl flags */ - -/* MIN_ARGC == MAX_ARGC ==> required # args */ - -extern char *errmsg(); -extern void des_string_to_key(); -extern int des_key_sched(); -extern int des_ecb_encrypt(); -extern int des_cbc_encrypt(); -extern int des_pcbc_encrypt(); - -char *progname; -int sflag; -int vflag; -int tflag; -int nflag = 1000; -int cflag; -int des_debug; -des_key_schedule KS; -unsigned char cipher_text[64]; -unsigned char clear_text[64] = "Now is the time for all "; -unsigned char clear_text2[64] = "7654321 Now is the time for "; -unsigned char clear_text3[64] = { 2, 0, 0, 0, 1, 0, 0, 0 }; -unsigned char *input; - -/* 0x0123456789abcdef */ -des_cblock default_key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; -des_cblock s_key; -des_cblock default_ivec = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef }; -unsigned char *ivec; -des_cblock zero_key = { 1 }; -int i, j; - -main(argc, argv) - int argc; - char *argv[]; -{ - /* Local Declarations */ - - long in_length; - - progname = argv[0]; /* salt away invoking program */ - - while (--argc > 0 && (*++argv)[0] == '-') - for (i = 1; argv[0][i] != '\0'; i++) { - switch (argv[0][i]) { - - /* debug flag */ - case 'd': - des_debug = 1; - continue; - - /* verbose flag */ - case 'v': - vflag = 1; - continue; - - /* cbc flag */ - case 'c': - cflag = 1; - continue; - - /* string to key only flag */ - case 's': - sflag = 1; - continue; - - /* test flag - use known key and cleartext */ - case 't': - tflag = 1; - continue; - - /* iteration count */ - case 'n': - sscanf(&argv[0][i + 1], "%d", &nflag); - argv[0][i + 1] = '\0'; /* force it to stop */ - break; - - default: - printf("%s: illegal flag \"%c\" ", progname, argv[0][i]); - exit(1); - } - }; - - if (argc < MIN_ARGC || argc > MAX_ARGC) { - printf("Usage: xxx [-xxx] xxx xxx\n"); - exit(1); - } - - /* argv[0] now points to first non-option arg, if any */ - - if (tflag) { - /* use known input and key */ - des_key_sched(default_key, KS); - input = clear_text; - ivec = (unsigned char *)default_ivec; - } else { - /*des_string_to_key(argv[0],s_key); */ - des_string_to_key("test", s_key); - if (vflag) { - input = (unsigned char *)s_key; - fprintf(stdout, "\nstring = %s, key = ", argv[0]); - for (i = 0; i <= 7; i++) - fprintf(stdout, "%02x ", *input++); - } - des_string_to_key("test", s_key); - if (vflag) { - input = (unsigned char *)s_key; - fprintf(stdout, "\nstring = %s, key = ", argv[0]); - for (i = 0; i <= 7; i++) - fprintf(stdout, "%02x ", *input++); - } - des_key_sched(s_key, KS); - input = (unsigned char *)argv[1]; - ivec = (unsigned char *)argv[2]; - } - - - if (cflag) { - fprintf(stdout, "\nclear %s\n", input); - in_length = strlen(input); - des_cbc_encrypt(input, cipher_text, (long)in_length, KS, ivec, 1); - fprintf(stdout, "\n\nencrypted ciphertext = (low to high bytes)"); - for (i = 0; i <= 7; i++) { - fprintf(stdout, "\n"); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02x ", cipher_text[i * 8 + j]); - } - des_cbc_encrypt(cipher_text, clear_text, (long)in_length, KS, ivec, - 0); - fprintf(stdout, "\n\ndecrypted clear_text = %s", clear_text); - - fprintf(stdout, "\nclear %s\n", input); - input = clear_text2; - des_cbc_cksum(input, cipher_text, (long)strlen(input), KS, ivec, 1); - fprintf(stdout, "\n\nencrypted cksum = (low to high bytes)\n"); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02x ", cipher_text[j]); - - /* test out random number generator */ - for (i = 0; i <= 7; i++) { - des_random_key(cipher_text); - des_key_sched(cipher_text, KS); - fprintf(stdout, "\n\nrandom key = (low to high bytes)\n"); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02x ", cipher_text[j]); - } - } else { - if (vflag) - fprintf(stdout, "\nclear %s\n", input); - do_encrypt(input, cipher_text); - do_decrypt(clear_text, cipher_text); - } -} - -flip(array) - char *array; -{ - int old, new, i, j; - /* flips the bit order within each byte from 0 lsb to 0 msb */ - for (i = 0; i <= 7; i++) { - old = *array; - new = 0; - for (j = 0; j <= 7; j++) { - if (old & 01) - new = new | 01; - if (j < 7) { - old = old >> 1; - new = new << 1; - } - } - *array = new; - array++; - } -} - -do_encrypt(in, out) - char *in; - char *out; -{ - for (i = 1; i <= nflag; i++) { - des_ecb_encrypt(in, out, KS, 1); - if (vflag) { - fprintf(stdout, "\nclear %s\n", in); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02 X ", in[j] & 0xff); - fprintf(stdout, "\tcipher "); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02X ", out[j] & 0xff); - } - } -} - -do_decrypt(in, out) - char *out; - char *in; - /* try to invert it */ -{ - for (i = 1; i <= nflag; i++) { - des_ecb_encrypt(out, in, KS, 0); - if (vflag) { - fprintf(stdout, "\nclear %s\n", in); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02X ", in[j] & 0xff); - fprintf(stdout, "\tcipher "); - for (j = 0; j <= 7; j++) - fprintf(stdout, "%02X ", out[j] & 0xff); - } - } -} diff --git a/src/des/test/verify.c b/src/des/test/verify.c deleted file mode 100644 index 1212341e49..0000000000 --- a/src/des/test/verify.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Program to test the correctness of the DES library - * implementation. - * - * exit returns 0 ==> success - * -1 ==> error - */ - -#include -#include -#include -#include -#include -#include - - - -extern char *errmsg(); -extern void des_string_to_key(); -extern int des_key_sched(); -extern int des_ecb_encrypt(); -extern int des_cbc_encrypt(); - -char *progname; -int nflag = 2; -int vflag; -int mflag; -int zflag; -int pid; -int des_debug; -des_key_schedule KS; -unsigned char cipher_text[64]; -unsigned char clear_text[64] = "Now is the time for all "; -unsigned char clear_text2[64] = "7654321 Now is the time for "; -unsigned char clear_text3[64] = { 2, 0, 0, 0, 1, 0, 0, 0 }; -unsigned char output[64]; -unsigned char zero_text[8] = { 0x0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned char msb_text[8] = { 0x0, 0, 0, 0, 0, 0, 0, 0x40 }; /* to ANSI MSB */ -unsigned char *input; - -/* 0x0123456789abcdef */ -unsigned char default_key[8] = { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef -}; -unsigned char key2[8] = { 0x08, 0x19, 0x2a, 0x3b, 0x4c, 0x5d, 0x6e, 0x7f }; -unsigned char key3[8] = { 0x80, 1, 1, 1, 1, 1, 1, 1 }; -des_cblock s_key; -unsigned char default_ivec[8] = { - 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef -}; -unsigned char *ivec; -unsigned char zero_key[8] = { 1, 1, 1, 1, 1, 1, 1, 1 }; /* just parity bits */ -int i, j; - -/* - * Can also add : - * plaintext = 0, key = 0, cipher = 0x8ca64de9c1b123a7 (or is it a 1?) - */ - -main(argc, argv) - int argc; - char *argv[]; -{ - /* Local Declarations */ - afs_int32 in_length; - - progname = argv[0]; /* salt away invoking program */ - - while (--argc > 0 && (*++argv)[0] == '-') - for (i = 1; argv[0][i] != '\0'; i++) { - switch (argv[0][i]) { - - /* debug flag */ - case 'd': - des_debug = 3; - continue; - - case 'z': - zflag = 1; - continue; - - case 'm': - mflag = 1; - continue; - - default: - printf("%s: illegal flag \"%c\" ", progname, argv[0][i]); - exit(1); - } - }; - - if (argc) { - fprintf(stderr, "Usage: %s [-dmz]\n", progname); - exit(1); - } - - /* use known input and key */ - - /* ECB zero text zero key */ - if (zflag) { - input = zero_text; - des_key_sched(zero_key, KS); - printf("plaintext = key = 0, cipher = 0x8ca64de9c1b123a7\n"); - do_encrypt(input, cipher_text); - printf("\tcipher = (low to high bytes)\n\t\t"); - for (j = 0; j <= 7; j++) - printf("%02x ", cipher_text[j]); - printf("\n"); - do_decrypt(output, cipher_text); - return; - } - - if (mflag) { - input = msb_text; - des_key_sched(key3, KS); - printf("plaintext = 0x00 00 00 00 00 00 00 40, "); - printf("key = 0, cipher = 0x??\n"); - do_encrypt(input, cipher_text); - printf("\tcipher = (low to high bytes)\n\t\t"); - for (j = 0; j <= 7; j++) { - printf("%02x ", cipher_text[j]); - } - printf("\n"); - do_decrypt(output, cipher_text); - return; - } - - /* ECB mode Davies and Price */ - { - input = zero_text; - des_key_sched(key2, KS); - printf("Examples per FIPS publication 81, keys ivs and cipher\n"); - printf("in hex. These are the correct answers, see below for\n"); - printf("the actual answers.\n\n"); - printf("Examples per Davies and Price.\n\n"); - printf("EXAMPLE ECB\tkey = 08192a3b4c5d6e7f\n"); - printf("\tclear = 0\n"); - printf("\tcipher = 25 dd ac 3e 96 17 64 67\n"); - printf("ACTUAL ECB\n"); - printf("\tclear \"%s\"\n", input); - do_encrypt(input, cipher_text); - printf("\tcipher = (low to high bytes)\n\t\t"); - for (j = 0; j <= 7; j++) - printf("%02x ", cipher_text[j]); - printf("\n\n"); - do_decrypt(output, cipher_text); - } - - /* ECB mode */ - { - des_key_sched(default_key, KS); - input = clear_text; - ivec = default_ivec; - printf("EXAMPLE ECB\tkey = 0123456789abcdef\n"); - printf("\tclear = \"Now is the time for all \"\n"); - printf("\tcipher = 3f a4 0e 8a 98 4d 48 15 ...\n"); - printf("ACTUAL ECB\n\tclear \"%s\"", input); - do_encrypt(input, cipher_text); - printf("\n\tcipher = (low to high bytes)\n\t\t"); - for (j = 0; j <= 7; j++) { - printf("%02x ", cipher_text[j]); - } - printf("\n\n"); - do_decrypt(output, cipher_text); - } - - /* CBC mode */ - printf("EXAMPLE CBC\tkey = 0123456789abcdef"); - printf("\tiv = 1234567890abcdef\n"); - printf("\tclear = \"Now is the time for all \"\n"); - printf("\tcipher =\te5 c7 cd de 87 2b f2 7c\n"); - printf("\t\t\t43 e9 34 00 8c 38 9c 0f\n"); - printf("\t\t\t68 37 88 49 9a 7c 05 f6\n"); - - printf("ACTUAL CBC\n\tclear \"%s\"\n", input); - in_length = strlen(input); - des_cbc_encrypt(input, cipher_text, (afs_int32) in_length, KS, ivec, 1); - printf("\tciphertext = (low to high bytes)\n"); - for (i = 0; i <= 7; i++) { - printf("\t\t"); - for (j = 0; j <= 7; j++) { - printf("%02x ", cipher_text[i * 8 + j]); - } - printf("\n"); - } - des_cbc_encrypt(cipher_text, clear_text, (afs_int32) in_length, KS, ivec, - 0); - printf("\tdecrypted clear_text = \"%s\"\n", clear_text); - - printf("EXAMPLE CBC checksum"); - printf("\tkey = 0123456789abcdef\tiv = 1234567890abcdef\n"); - printf("\tclear =\t\t\"7654321 Now is the time for \"\n"); - printf("\tchecksum\t58 d2 e7 7e 86 06 27 33, "); - printf("or some part thereof\n"); - input = clear_text2; - des_cbc_cksum(input, cipher_text, (afs_int32) strlen(input), KS, ivec, 1); - printf("ACTUAL CBC checksum\n"); - printf("\t\tencrypted cksum = (low to high bytes)\n\t\t"); - for (j = 0; j <= 7; j++) - printf("%02x ", cipher_text[j]); - printf("\n\n"); -} - -flip(array) - char *array; -{ - int old, new, i, j; - /* flips the bit order within each byte from 0 lsb to 0 msb */ - for (i = 0; i <= 7; i++) { - old = *array; - new = 0; - for (j = 0; j <= 7; j++) { - if (old & 01) - new = new | 01; - if (j < 7) { - old = old >> 1; - new = new << 1; - } - } - *array = new; - array++; - } -} - -do_encrypt(in, out) - char *in; - char *out; -{ - for (i = 1; i <= nflag; i++) { - des_ecb_encrypt(in, out, KS, 1); - if (des_debug) { - printf("\nclear %s\n", in); - for (j = 0; j <= 7; j++) - printf("%02 X ", in[j] & 0xff); - printf("\tcipher "); - for (j = 0; j <= 7; j++) - printf("%02X ", out[j] & 0xff); - } - } -} - -do_decrypt(in, out) - char *out; - char *in; - /* try to invert it */ -{ - for (i = 1; i <= nflag; i++) { - des_ecb_encrypt(out, in, KS, 0); - if (des_debug) { - printf("clear %s\n", in); - for (j = 0; j <= 7; j++) - printf("%02X ", in[j] & 0xff); - printf("\tcipher "); - for (j = 0; j <= 7; j++) - printf("%02X ", out[j] & 0xff); - } - } -} diff --git a/src/des/util.c b/src/des/util.c deleted file mode 100644 index 77763253ed..0000000000 --- a/src/des/util.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 1988 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Miscellaneous debug printing utilities - */ - -#include -#include - - -#include "mit-cpyright.h" -#ifndef KERNEL -#include -#endif -#include -#include "des.h" -#include "des_prototypes.h" - -int -des_cblock_print_file(des_cblock * x, FILE * fp) -{ - unsigned char *y = (unsigned char *)x; - int i = 0; - fprintf(fp, " 0x { "); - - while (i++ < 8) { - fprintf(fp, "%x", *y++); - if (i < 8) - fprintf(fp, ", "); - } - fprintf(fp, " }"); - - return (0); -} - -#ifdef DEBUG -int -des_debug_print(char *area, int x, char *arg1, char *arg2) -{ - ; -} -#endif diff --git a/src/des/weak_key.c b/src/des/weak_key.c deleted file mode 100644 index c539679963..0000000000 --- a/src/des/weak_key.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 1989 by the Massachusetts Institute of Technology. - * - * For copying and distribution information, please see the file - * . - * - * Under U.S. law, this software may not be exported outside the US - * without license from the U.S. Commerce department. - * - * These routines form the library interface to the DES facilities. - * - * Originally written 8/85 by Steve Miller, MIT Project Athena. - */ - -#include -#include - - -#ifndef KERNEL -#include -#endif - -#include "des.h" -#include "des_internal.h" -#include "des_prototypes.h" - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - -/* - * The following are the weak DES keys: - */ -static const des_cblock weak[16] = { - /* weak keys */ - {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}, - {0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e}, - {0xe0, 0xe0, 0xe0, 0xe0, 0xf1, 0xf1, 0xf1, 0xf1}, - - /* semi-weak */ - {0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe}, - {0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01}, - - {0x1f, 0xe0, 0x1f, 0xe0, 0x0e, 0xf1, 0x0e, 0xf1}, - {0xe0, 0x1f, 0xe0, 0x1f, 0xf1, 0x0e, 0xf1, 0x0e}, - - {0x01, 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1}, - {0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1, 0x01}, - - {0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe}, - {0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e}, - - {0x01, 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e}, - {0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e, 0x01}, - - {0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1, 0xfe}, - {0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1} -}; - -/* - * des_is_weak_key: returns true iff key is a [semi-]weak des key. - * - * Requires: key has correct odd parity. - */ -int -des_is_weak_key(des_cblock key) -{ - int i; - const des_cblock *weak_p = weak; - - for (i = 0; i < (sizeof(weak) / sizeof(des_cblock)); i++) { - if (!memcmp((char *)weak_p++, (char *)key, sizeof(des_cblock))) - return 1; - } - - return 0; -} diff --git a/src/dviced/Makefile.in b/src/dviced/Makefile.in index a013ddc97e..a9d09b31d6 100644 --- a/src/dviced/Makefile.in +++ b/src/dviced/Makefile.in @@ -214,7 +214,7 @@ state_analyzer.o: ${TVICED}/state_analyzer.c dafileserver: ${objects} ${LIBS} $(AFS_LDRULE) ${objects} \ - ${LIBS} $(LIB_roken) ${MT_LIBS} ${XLIBS} + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} state_analyzer: ${SDBGOBJS} $(AFS_LDRULE) ${SDBGOBJS} \ diff --git a/src/dvolser/Makefile.in b/src/dvolser/Makefile.in index 7d63001df3..bb068ed01d 100644 --- a/src/dvolser/Makefile.in +++ b/src/dvolser/Makefile.in @@ -205,7 +205,8 @@ namei_ops.o: ${VOL}/namei_ops.c $(AFS_CCRULE) $(VOL)/namei_ops.c davolserver: ${objects} ${LIBS} - $(AFS_LDRULE) ${objects} ${LIBS} $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) ${objects} ${LIBS} $(LIB_hcrypto) $(LIB_roken) \ + ${MT_LIBS} ${XLIBS} install: davolserver ${INSTALL} -d ${DESTDIR}${afssrvlibexecdir} diff --git a/src/finale/Makefile.in b/src/finale/Makefile.in index c90bd61369..b6fc9f2b92 100644 --- a/src/finale/Makefile.in +++ b/src/finale/Makefile.in @@ -43,7 +43,6 @@ LIBS=${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/util.a \ ${TOP_LIBDIR}/libkauth.a \ ${TOP_LIBDIR}/libprot.a \ - ${TOP_LIBDIR}/libdes.a \ ${XLIBS} all: translate_et diff --git a/src/fsprobe/Makefile.in b/src/fsprobe/Makefile.in index e99d64fa51..7520167848 100644 --- a/src/fsprobe/Makefile.in +++ b/src/fsprobe/Makefile.in @@ -22,13 +22,14 @@ LIBS=${TOP_LIBDIR}/libvolser.a ${TOP_LIBDIR}/vlib.a ${TOP_LIBDIR}/libacl.a \ ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libvldb.a \ ${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libdes.a \ + ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libkauth.a \ ${TOP_LIBDIR}/libaudit.a \ ${TOP_LIBDIR}/libafsint.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libsys.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a all: ${TOP_INCDIR}/afs/fsprobe.h ${TOP_LIBDIR}/libfsprobe.a fsprobe_test diff --git a/src/gtx/Makefile.in b/src/gtx/Makefile.in index 2c2e92d054..e220c70555 100644 --- a/src/gtx/Makefile.in +++ b/src/gtx/Makefile.in @@ -40,7 +40,6 @@ LIBS=\ ${TOP_LIBDIR}/libkauth.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/util.a diff --git a/src/kauth/Makefile.in b/src/kauth/Makefile.in index 21d11f5135..59b2b8464c 100644 --- a/src/kauth/Makefile.in +++ b/src/kauth/Makefile.in @@ -32,11 +32,11 @@ LIBS=${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/libafsutil.a \ - $(DBM) + $(DBM) \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a UKSRCS=authclient.c user.c kautils.h kaserver.h kaaux.c katoken.c \ kalocalcell.c client.c kaerrors.c @@ -49,10 +49,10 @@ KLIBS=${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libcom_err.a \ - ${TOP_LIBDIR}/libafsutil.a + ${TOP_LIBDIR}/libafsutil.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a OBJS=kauth.xdr.o kauth.cs.o kaaux.o client.o authclient.o katoken.o kautils.o kalocalcell.o kaerrors.o user.o krb_tf.o KOBJS=kauth.xdr.o kauth.cs.o kaaux.o client.o authclient.o katoken.o kautils.o kalocalcell.o kaerrors.o user.krb.o krb_tf.o @@ -94,7 +94,8 @@ kaserver: kautils.o kalocalcell.o kadatabase.o kaprocs.o kalog.o kauth.ss.o kaut $(AFS_LDRULE) kaserver.o kautils.o kalocalcell.o kadatabase.o \ krb_udp.o kaprocs.o kalog.o kauth.ss.o kauth.xdr.o kaaux.o \ kaauxdb.o \ - $(LIBS) $(LIB_roken) ${XLIBS} ${TOP_LIBDIR}/libaudit.a + $(LIBS) $(LIB_roken) $(LIB_crypt) ${XLIBS} \ + ${TOP_LIBDIR}/libaudit.a kaserver.o: kaserver.c ${INCLS} AFS_component_version_number.o @@ -159,8 +160,6 @@ libkauth.krb.a: $(KOBJS) AFS_component_version_number.o $(AR) crv $@ $(KOBJS) AFS_component_version_number.o $(RANLIB) $@ -read_passwd.o: read_passwd.c - katoken.o: katoken.c ${INCLS} client.o: client.c ${INCLS} AFS_component_version_number.o @@ -176,22 +175,22 @@ krb_tf.o: krb_tf.c ${INCLS} kas: kauth.h kautils.h admin_tools.o libkauth.a $(LIBS) kas.o kkids.o $(AFS_LDRULE) kas.o admin_tools.o kkids.o libkauth.a \ - ${LIBS} $(LIB_roken) ${XLIBS} + ${LIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} klog: AFS_component_version_number.o kauth.h kautils.h libkauth.a $(LIBS) \ klog.o $(AFS_LDRULE) klog.o libkauth.a \ - ${LIBS} $(LIB_roken) ${XLIBS} + ${LIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} klog.o: klog.c kauth.h kautils.h AFS_component_version_number.o klog.krb: kauth.h kautils.h libkauth.krb.a $(KLIBS) klog.o $(AFS_LDRULE) klog.o libkauth.krb.a \ - ${KLIBS} $(LIB_roken) ${XLIBS} + ${KLIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} knfs: kauth.h kautils.h libkauth.a $(LIBS) knfs.o $(AFS_LDRULE) knfs.o libkauth.a \ - ${LIBS} $(LIB_roken) ${XLIBS} + ${LIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} knfs.o: knfs.c AFS_component_version_number.o @@ -200,17 +199,17 @@ klogin.o: klogin.c ${INCLS} AFS_component_version_number.o klogin: libkauth.a $(LIBS) klogin.o $(AFS_LDRULE) klogin.o libkauth.a \ - ${LIBS} $(LIB_roken) ${XLIBS} + ${LIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} klogin.krb: libkauth.a $(KLIBS) klogin.o $(AFS_LDRULE) klogin.o libkauth.krb.a \ - ${KLIBS} $(LIB_roken) ${XLIBS} + ${KLIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} kpasswd.o: kauth.h kautils.h ${INCLS} kpasswd.c AFS_component_version_number.o kpasswd: kauth.h kautils.h libkauth.a $(LIBS) kpasswd.o kkids.o $(AFS_LDRULE) kpasswd.o kkids.o libkauth.a \ - ${LIBS} $(LIB_roken) ${XLIBS} + ${LIBS} $(LIB_roken) $(LIB_crypt) ${XLIBS} kpwvalid.o: kpwvalid.c AFS_component_version_number.o diff --git a/src/kauth/NTMakefile b/src/kauth/NTMakefile index f70998da1c..7a6c556cee 100644 --- a/src/kauth/NTMakefile +++ b/src/kauth/NTMakefile @@ -33,6 +33,7 @@ KAUTH_LIBOBJS =\ $(OUT)\kauth.cs.obj \ $(OUT)\kaaux.obj \ $(OUT)\client.obj \ + $(OUT)\crypt.obj \ $(OUT)\authclient.obj \ $(OUT)\katoken.obj \ $(OUT)\kautils.obj \ @@ -86,13 +87,13 @@ AFSLIBS = \ $(AFSLIBDIR)\afsaudit.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\afslwp.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrxstat.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib TOKENLIB = $(DESTDIR)\lib\afs\afspioctl.lib diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index 29b0ac27a6..7e953f68ec 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -39,9 +39,8 @@ #include #include #include -#include -#include - +#include +#include #include "kauth.h" #include "kauth_internal.h" #include "kautils.h" @@ -766,7 +765,7 @@ StringToKey(struct cmd_syndesc *as, void *arock) ka_PrintBytes((char *)&key, sizeof(key)); printf("'.\n"); - des_string_to_key(as->parms[0].items->data, ktc_to_cblockptr(&key)); + DES_string_to_key(as->parms[0].items->data, ktc_to_cblockptr(&key)); printf("Converting %s with the DES string to key yields key='", as->parms[0].items->data); @@ -1412,7 +1411,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock) sprintf(msg, "Administrator's (%s) Password: ", name); else sprintf(msg, "Password for %s: ", name); - code = read_pw_string(passwd, sizeof(passwd), msg, 0); + code = UI_UTIL_read_pw_string(passwd, sizeof(passwd), msg, 0); if (code) code = KAREADPW; else if (strlen(passwd) == 0) @@ -1427,7 +1426,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock) ka_GetAdminToken(name, instance, cell, &key, KA_SIXHOURS, &token, 0 /* !new */ ); if (code == KABADREQUEST) { - des_string_to_key(passwd, ktc_to_cblockptr(&key)); + DES_string_to_key(passwd, ktc_to_cblockptr(&key)); code = ka_GetAdminToken(name, instance, cell, &key, KA_SIXHOURS, &token, 0 /* !new */ ); @@ -1518,7 +1517,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock) strcpy(msg, p + 1); strcat(msg, ": "); - code = read_pw_string(password, sizeof(password), msg, 1); + code = UI_UTIL_read_pw_string(password, sizeof(password), msg, 1); if (code) code = KAREADPW; else if (strlen(password) == 0) diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index e4c0677595..22a96309a2 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -35,13 +35,13 @@ #endif #include #include -#include -#include #include #include #include #include #include +#include + #include "kauth.h" #include "kautils.h" @@ -58,7 +58,7 @@ static int debug = 0; #ifdef ENCRYPTIONBLOCKSIZE #undef ENCRYPTIONBLOCKSIZE #endif -#define ENCRYPTIONBLOCKSIZE (sizeof(des_cblock)) +#define ENCRYPTIONBLOCKSIZE (sizeof(DES_cblock)) /* Copy the specified list of servers into a specially know cell named "explicit". The cell can then be used to debug experimental servers. */ @@ -503,7 +503,7 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con struct ktc_token * token, afs_int32 * pwexpires) { /* days until it expires */ afs_int32 code; - des_key_schedule schedule; + DES_key_schedule schedule; Date request_time; struct ka_gettgtRequest request; struct ka_gettgtAnswer answer_old; @@ -515,7 +515,7 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con int version; LOCK_GLOBAL_MUTEX; - if ((code = des_key_sched(ktc_to_cblock(key), schedule))) { + if ((code = DES_key_sched(ktc_to_cblock(key), &schedule))) { UNLOCK_GLOBAL_MUTEX; return KABADKEY; } @@ -536,8 +536,8 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con memcpy(request.label, req_label, sizeof(request.label)); arequest.SeqLen = sizeof(request); arequest.SeqBody = (char *)&request; - des_pcbc_encrypt(arequest.SeqBody, arequest.SeqBody, arequest.SeqLen, - schedule, ktc_to_cblockptr(key), ENCRYPT); + DES_pcbc_encrypt(arequest.SeqBody, arequest.SeqBody, arequest.SeqLen, + &schedule, ktc_to_cblockptr(key), ENCRYPT); oanswer.MaxSeqLen = sizeof(answer); oanswer.SeqLen = 0; @@ -572,8 +572,8 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con return code; return KAUBIKCALL; } - des_pcbc_encrypt(oanswer.SeqBody, oanswer.SeqBody, oanswer.SeqLen, - schedule, ktc_to_cblockptr(key), DECRYPT); + DES_pcbc_encrypt(oanswer.SeqBody, oanswer.SeqBody, oanswer.SeqLen, + &schedule, ktc_to_cblockptr(key), DECRYPT); switch (version) { case 1: @@ -641,7 +641,7 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st ka_BBS oanswer; char *strings; int len; - des_key_schedule schedule; + DES_key_schedule schedule; int version; afs_int32 pwexpires; @@ -649,7 +649,7 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st aticket.SeqLen = auth_token->ticketLen; aticket.SeqBody = auth_token->ticket; - code = des_key_sched(ktc_to_cblock(&auth_token->sessionKey), schedule); + code = DES_key_sched(ktc_to_cblock(&auth_token->sessionKey), &schedule); if (code) { UNLOCK_GLOBAL_MUTEX; return KABADKEY; @@ -657,7 +657,8 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st times.start = htonl(start); times.end = htonl(end); - des_ecb_encrypt(×, ×, schedule, ENCRYPT); + DES_ecb_encrypt((DES_cblock *)×, (DES_cblock *)×, &schedule, + ENCRYPT); atimes.SeqLen = sizeof(times); atimes.SeqBody = (char *)× @@ -690,8 +691,9 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st return KAUBIKCALL; } - des_pcbc_encrypt(oanswer.SeqBody, oanswer.SeqBody, oanswer.SeqLen, - schedule, ktc_to_cblockptr(&auth_token->sessionKey), DECRYPT); + DES_pcbc_encrypt(oanswer.SeqBody, oanswer.SeqBody, oanswer.SeqLen, + &schedule, ktc_to_cblockptr(&auth_token->sessionKey), + DECRYPT); switch (version) { case 1: diff --git a/src/kauth/client.c b/src/kauth/client.c index c0dd382e7f..9a98905935 100644 --- a/src/kauth/client.c +++ b/src/kauth/client.c @@ -29,12 +29,12 @@ #include #include #include -#include -#include +#include +#include + #include "kauth.h" #include "kautils.h" - /* This defines the Andrew string_to_key function. It accepts a password string as input and converts it via a one-way encryption algorithm to a DES encryption key. It is compatible with the original Andrew authentication @@ -79,16 +79,16 @@ Andrew_StringToKey(char *str, char *cell, /* cell for password */ keybytes[i] = (unsigned char)(temp << 1); } } - des_fixup_key_parity(ktc_to_cblock(key)); + DES_set_odd_parity(ktc_to_cblock(key)); } static void StringToKey(char *str, char *cell, /* cell for password */ struct ktc_encryptionKey *key) { - des_key_schedule schedule; - unsigned char temp_key[8]; - char ivec[8]; + DES_key_schedule schedule; + DES_cblock temp_key; + DES_cblock ivec; char password[BUFSIZ]; int passlen; @@ -98,18 +98,19 @@ StringToKey(char *str, char *cell, /* cell for password */ if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password); - memcpy(ivec, "kerberos", 8); - memcpy(temp_key, "kerberos", 8); - des_fixup_key_parity(temp_key); - des_key_sched(temp_key, schedule); - des_cbc_cksum(charptr_to_cblockptr(password), charptr_to_cblockptr(ivec), passlen, schedule, charptr_to_cblockptr(ivec)); + memcpy(&ivec, "kerberos", 8); + memcpy(&temp_key, "kerberos", 8); + DES_set_odd_parity(&temp_key); + DES_key_sched(&temp_key, &schedule); + DES_cbc_cksum((DES_cblock *) password, &ivec, passlen, &schedule, &ivec); - memcpy(temp_key, ivec, 8); - des_fixup_key_parity(temp_key); - des_key_sched(temp_key, schedule); - des_cbc_cksum(charptr_to_cblockptr(password), ktc_to_cblockptr(key), passlen, schedule, charptr_to_cblockptr(ivec)); + memcpy(&temp_key, &ivec, 8); + DES_set_odd_parity(&temp_key); + DES_key_sched(&temp_key, &schedule); + DES_cbc_cksum((DES_cblock *)password, ktc_to_cblock(key), passlen, + &schedule, &ivec); - des_fixup_key_parity(ktc_to_cblock(key)); + DES_set_odd_parity(ktc_to_cblock(key)); } void @@ -150,7 +151,7 @@ ka_ReadPassword(char *prompt, int verify, char *cell, LOCK_GLOBAL_MUTEX; memset(key, 0, sizeof(struct ktc_encryptionKey)); - code = read_pw_string(password, sizeof(password), prompt, verify); + code = UI_UTIL_read_pw_string(password, sizeof(password), prompt, verify); if (code) { UNLOCK_GLOBAL_MUTEX; return KAREADPW; diff --git a/src/des/crypt.c b/src/kauth/crypt.c similarity index 98% rename from src/des/crypt.c rename to src/kauth/crypt.c index 45938b510c..dcee3bea96 100644 --- a/src/des/crypt.c +++ b/src/kauth/crypt.c @@ -13,11 +13,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -34,21 +30,18 @@ * SUCH DAMAGE. */ + #include #include +/* This crypt() implementation is only used by the Andrew string_to_key + * function on Windows. All Unix platforms use their own crypt() + * implementation + */ -#ifdef AFS_NT40_ENV #include -#endif #include -#ifdef HAVE_STRING_H #include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif /* * UNIX password, and DES, encryption. diff --git a/src/des/crypt.h b/src/kauth/crypt.h similarity index 100% rename from src/des/crypt.h rename to src/kauth/crypt.h diff --git a/src/kauth/decode_ticket.c b/src/kauth/decode_ticket.c index 15082e5794..55b47bc24b 100644 --- a/src/kauth/decode_ticket.c +++ b/src/kauth/decode_ticket.c @@ -11,7 +11,7 @@ #include -#include +#include #include #include #include @@ -42,7 +42,7 @@ main(int argc, char *argv[]) } if (ka_ReadBytes(argv[1], key, sizeof(key)) != 8) printf("Key must be 8 bytes long\n"); - if (!des_check_key_parity(key) || des_is_weak_key(key)) { + if (!DES_check_key_parity(charptr_to_cblock(key)) || DES_is_weak_key(charptr_to_cblock(key))) { afs_com_err(whoami, KABADKEY, "server's key for decoding ticket is bad"); exit(1); } diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index 2e37095438..365994f94c 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -12,6 +12,10 @@ #include +#ifdef IGNORE_SOME_GCC_WARNINGS +# pragma GCC diagnostic warning "-Wdeprecated-declarations" +#endif + #include #include #include "kauth.h" @@ -24,11 +28,13 @@ #include #endif #include + +#define HC_DEPRECATED +#include + #include #include #include -#include -#include #include #include #include @@ -41,6 +47,7 @@ #include #include #include + #include "kautils.h" #include "kaserver.h" #include "kalog.h" @@ -150,12 +157,12 @@ get_time(Date *timeP, if (to) { /* check if auto cpw is disabled */ if (!(ntohl(tentry.flags) & KAFNOCPW)) { memcpy(&key, &random_value[0], sizeof(key)); - des_fixup_key_parity(ktc_to_cblock(&key)); + DES_set_odd_parity(ktc_to_cblock(&key)); code = set_password(tt, KA_ADMIN_NAME, KA_ADMIN_INST, &key, 0, 0); if (code == 0) { - des_init_random_number_generator(ktc_to_cblock(&key)); + DES_init_random_number_generator(ktc_to_cblock(&key)); ka_ConvertBytes(buf, sizeof(buf), (char *)&key, sizeof(key)); es_Report("New Admin key is %s\n", buf); @@ -174,7 +181,7 @@ get_time(Date *timeP, if (to) { /* check if auto cpw is disabled */ if (!(ntohl(tentry.flags) & KAFNOCPW)) { memcpy(&key, &random_value[2], sizeof(key)); - des_fixup_key_parity(ktc_to_cblock(&key)); + DES_set_odd_parity(ktc_to_cblock(&key)); code = set_password(tt, KA_TGS_NAME, lrealm, &key, 0, 0); if (code == 0) { ka_ConvertBytes(buf, sizeof(buf), (char *)&key, @@ -221,14 +228,14 @@ initialize_database(struct ubik_trans *tt) int code; gettimeofday((struct timeval *)&key, 0); /* this is just a cheap seed key */ - des_fixup_key_parity(ktc_to_cblock(&key)); - des_init_random_number_generator(ktc_to_cblock(&key)); - if ((code = des_random_key(ktc_to_cblock(&key))) + DES_set_odd_parity(ktc_to_cblock(&key)); + DES_init_random_number_generator(ktc_to_cblock(&key)); + if ((code = DES_new_random_key(ktc_to_cblock(&key))) || (code = create_user(tt, KA_ADMIN_NAME, KA_ADMIN_INST, &key, 0, KAFNORMAL | KAFNOSEAL | KAFNOTGS))) return code; - if ((code = des_random_key(ktc_to_cblock(&key))) + if ((code = DES_new_random_key(ktc_to_cblock(&key))) || (code = create_user(tt, KA_TGS_NAME, lrealm, &key, 0, KAFNORMAL | KAFNOSEAL | KAFNOTGS))) @@ -292,7 +299,7 @@ init_kaprocs(const char *lclpath, int initFlags) code); return code; } - des_init_random_number_generator(ktc_to_cblock(&key)); + DES_init_random_number_generator(ktc_to_cblock(&key)); code = ubik_EndTrans(tt); if (code) { @@ -630,7 +637,8 @@ kamCreateUser(struct rx_call *call, char *aname, char *ainstance, afs_int32 caller; /* Disk offset of caller's entry */ COUNT_REQ(CreateUser); - if (!des_check_key_parity(EncryptionKey_to_cblock(&ainitpw)) || des_is_weak_key(EncryptionKey_to_cblock(&ainitpw))) + if (!DES_check_key_parity(EncryptionKey_to_cblock(&ainitpw)) || + DES_is_weak_key(EncryptionKey_to_cblock(&ainitpw))) return KABADKEY; if (!name_instance_legal(aname, ainstance)) return KABADNAME; @@ -678,7 +686,7 @@ ChangePassWord(struct rx_call *call, char *aname, char *ainstance, char *answer; /* where answer is to be put */ int answer_len; /* length of answer packet */ afs_int32 kvno; /* requested key version number */ - des_key_schedule user_schedule; /* key schedule for user's key */ + DES_key_schedule user_schedule; /* key schedule for user's key */ Date request_time; /* time request originated */ COUNT_REQ(ChangePassword); @@ -703,10 +711,10 @@ ChangePassWord(struct rx_call *call, char *aname, char *ainstance, } /* decrypt request w/ user password */ - if ((code = des_key_sched(ktc_to_cblock(&tentry.key), user_schedule))) + if ((code = DES_key_sched(ktc_to_cblock(&tentry.key), &user_schedule))) es_Report("In KAChangePassword: key_sched returned %d\n", code); - des_pcbc_encrypt(arequest->SeqBody, &request, - min(arequest->SeqLen, sizeof(request)), user_schedule, + DES_pcbc_encrypt(arequest->SeqBody, &request, + min(arequest->SeqLen, sizeof(request)), &user_schedule, ktc_to_cblockptr(&tentry.key), DECRYPT); /* validate the request */ @@ -738,8 +746,8 @@ ChangePassWord(struct rx_call *call, char *aname, char *ainstance, answer += sizeof(Date); memcpy(answer, KA_CPW_ANS_LABEL, KA_LABELSIZE); - des_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, answer_len, - user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT); + DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, answer_len, + &user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT); code = set_password(tt, aname, ainstance, &request.newpw, kvno, 0); if (code) { @@ -890,7 +898,8 @@ kamSetPassword(struct rx_call *call, char *aname, char *ainstance, COUNT_REQ(SetPassword); if (akvno > MAXKAKVNO) return KABADARGUMENT; - if (!des_check_key_parity(EncryptionKey_to_cblock(&apassword)) || des_is_weak_key(EncryptionKey_to_cblock(&apassword))) + if (!DES_check_key_parity(EncryptionKey_to_cblock(&apassword)) || + DES_is_weak_key(EncryptionKey_to_cblock(&apassword))) return KABADKEY; if (!name_instance_legal(aname, ainstance)) @@ -1062,7 +1071,7 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance, int answer_len; /* length of answer packet */ Date answer_time; /* 1+ request time in network order */ afs_int32 temp; /* for htonl conversions */ - des_key_schedule user_schedule; /* key schedule for user's key */ + DES_key_schedule user_schedule; /* key schedule for user's key */ afs_int32 tgskvno; /* key version of service key */ struct ktc_encryptionKey tgskey; /* service key for encrypting ticket */ Date now; @@ -1101,10 +1110,10 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance, save_principal(authPrincipal, aname, ainstance, 0); /* decrypt request w/ user password */ - if ((code = des_key_sched(ktc_to_cblock(&tentry.key), user_schedule))) + if ((code = DES_key_sched(ktc_to_cblock(&tentry.key), &user_schedule))) es_Report("In KAAuthenticate: key_sched returned %d\n", code); - des_pcbc_encrypt(arequest->SeqBody, &request, - min(arequest->SeqLen, sizeof(request)), user_schedule, + DES_pcbc_encrypt(arequest->SeqBody, &request, + min(arequest->SeqLen, sizeof(request)), &user_schedule, ktc_to_cblockptr(&tentry.key), DECRYPT); request.time = ntohl(request.time); /* reorder date */ @@ -1167,7 +1176,7 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance, tgskvno = ntohl(server.key_version); memcpy(&tgskey, &server.key, sizeof(tgskey)); - code = des_random_key(ktc_to_cblock(&sessionKey)); + code = DES_new_random_key(ktc_to_cblock(&sessionKey)); if (code) { code = KANOKEYS; goto abort; @@ -1244,8 +1253,8 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance, code = KAINTERNALERROR; goto abort; } - des_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen, - user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT); + DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen, + &user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT); code = ubik_EndTrans(tt); KALOG(aname, ainstance, sname, sinst, NULL, call->conn->peer->host, LOG_AUTHENTICATE); @@ -1740,7 +1749,7 @@ GetTicket(int version, int import, export; struct ubik_trans *tt; struct ktc_encryptionKey tgskey; - des_key_schedule schedule; + DES_key_schedule schedule; afs_int32 to; char name[MAXKTCNAMELEN]; char instance[MAXKTCNAMELEN]; @@ -1801,7 +1810,7 @@ GetTicket(int version, code = KANOAUTH; goto abort; } - code = des_key_sched(ktc_to_cblock(&authSessionKey), schedule); + code = DES_key_sched(ktc_to_cblock(&authSessionKey), &schedule); if (code) { code = KANOAUTH; goto abort; @@ -1819,7 +1828,7 @@ GetTicket(int version, goto abort; } - des_ecb_encrypt(atimes->SeqBody, ×, schedule, DECRYPT); + DES_ecb_encrypt((DES_cblock *)atimes->SeqBody, (DES_cblock *)×, &schedule, DECRYPT); times.start = ntohl(times.start); times.end = ntohl(times.end); code = tkt_CheckTimes(times.start, times.end, now); @@ -1856,7 +1865,7 @@ GetTicket(int version, } save_principal(tgsServerPrincipal, sname, sinstance, 0); - code = des_random_key(ktc_to_cblock(&sessionKey)); + code = DES_new_random_key(ktc_to_cblock(&sessionKey)); if (code) { code = KANOKEYS; goto abort; @@ -1929,8 +1938,8 @@ GetTicket(int version, code = KAINTERNALERROR; goto abort; } - des_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen, - schedule, ktc_to_cblockptr(&authSessionKey), ENCRYPT); + DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen, + &schedule, ktc_to_cblockptr(&authSessionKey), ENCRYPT); code = ubik_EndTrans(tt); KALOG(name, instance, sname, sinstance, (import ? authDomain : NULL), call->conn->peer->host, LOG_GETTICKET); @@ -2145,7 +2154,7 @@ kamGetRandomKey(struct rx_call *call, EncryptionKey *key) AFS_UNUSED COUNT_REQ(GetRandomKey); if ((code = AwaitInitialization())) return code; - code = des_random_key(EncryptionKey_to_cblock(key)); + code = DES_new_random_key(EncryptionKey_to_cblock(key)); if (code) return KANOKEYS; return 0; diff --git a/src/kauth/kauth_internal.h b/src/kauth/kauth_internal.h index 02c91e9738..ae25452316 100644 --- a/src/kauth/kauth_internal.h +++ b/src/kauth/kauth_internal.h @@ -9,6 +9,8 @@ #ifndef AFS_SRC_KAUTH_INTERNAL_H #define AFS_SRC_KAUTH_INTERNAL_H +#include + /* admin_tools.c */ extern afs_int32 ka_AdminInteractive(int cmd_argc, char *cmd_argv[]); @@ -54,9 +56,9 @@ extern afs_int32 krb_write_ticket_file(char *realm); /* krb_udp.c */ extern afs_int32 init_krb_udp(void); -static_inline unsigned char * +static_inline DES_cblock * EncryptionKey_to_cblock(EncryptionKey *key) { - return (unsigned char *)key; + return (DES_cblock *)key; } static_inline struct ktc_encryptionKey * diff --git a/src/kauth/kautils.c b/src/kauth/kautils.c index 5eaedbc005..8dd6242a13 100644 --- a/src/kauth/kautils.c +++ b/src/kauth/kautils.c @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include "kauth.h" #include "kautils.h" @@ -143,18 +142,18 @@ umin(afs_uint32 a, afs_uint32 b) afs_int32 ka_KeyCheckSum(char *key, afs_uint32 * cksumP) { - des_key_schedule s; - unsigned char block[8]; + DES_key_schedule s; + DES_cblock block; afs_uint32 cksum; afs_int32 code; *cksumP = 0; memset(block, 0, 8); - code = des_key_sched(charptr_to_cblock(key), s); + code = DES_key_sched(charptr_to_cblock(key), &s); if (code) return KABADKEY; - des_ecb_encrypt(block, block, s, ENCRYPT); - memcpy(&cksum, block, sizeof(afs_int32)); + DES_ecb_encrypt(&block, &block, &s, ENCRYPT); + memcpy(&cksum, &block, sizeof(afs_int32)); *cksumP = ntohl(cksum); return 0; } diff --git a/src/kauth/kautils.p.h b/src/kauth/kautils.p.h index dec459e6b9..3b7eaa4948 100644 --- a/src/kauth/kautils.p.h +++ b/src/kauth/kautils.p.h @@ -19,7 +19,6 @@ #ifndef __KAUTILS__ #define __KAUTILS__ -#include #include #ifndef KAMAJORVERSION diff --git a/src/kauth/kpasswd.c b/src/kauth/kpasswd.c index aa52aec63f..220b460596 100644 --- a/src/kauth/kpasswd.c +++ b/src/kauth/kpasswd.c @@ -30,12 +30,12 @@ #endif #include #include -#include -#include #include #include #include #include +#include +#include #include "kauth.h" #include "kautils.h" #include "kkids.h" @@ -158,7 +158,7 @@ static afs_int32 read_pass(char *passwd, int len, char *prompt, int verify) { afs_int32 code; - code = read_pw_string(passwd, len, prompt, verify); + code = UI_UTIL_read_pw_string(passwd, len, prompt, verify); if (code == -1) { getpipepass(passwd, len); return 0; @@ -406,7 +406,7 @@ CommandProc(struct cmd_syndesc *as, void *arock) } } ka_StringToKey(passwd, realm, &key); - des_string_to_key(passwd, ktc_to_cblockptr(&mitkey)); + DES_string_to_key(passwd, ktc_to_cblockptr(&mitkey)); give_to_child(passwd); /* Get new password if it wasn't provided. */ @@ -452,7 +452,7 @@ CommandProc(struct cmd_syndesc *as, void *arock) npasswd[8] = 0; /* in case the password was exactly 8 chars long */ #endif ka_StringToKey(npasswd, realm, &newkey); - des_string_to_key(npasswd, ktc_to_cblockptr(&newmitkey)); + DES_string_to_key(npasswd, ktc_to_cblockptr(&newmitkey)); memset(npasswd, 0, sizeof(npasswd)); if (lexplicit) diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index e66af2120b..5685b1b647 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -17,6 +17,10 @@ #include +#ifdef IGNORE_SOME_GCC_WARNINGS +# pragma GCC diagnostic warning "-Wdeprecated-declarations" +#endif + #include #include #include @@ -32,16 +36,19 @@ #include #include #include + +#define HC_DEPRECATED +#include + #include #include -#include -#include #include #include #include #include #include + #include "kauth.h" #include "kautils.h" #include "kauth_internal.h" @@ -131,7 +138,7 @@ create_cipher(char *cipher, int *cipherLen, int slen; unsigned char life = time_to_life(start, end); int len; - des_key_schedule schedule; + DES_key_schedule schedule; afs_int32 code; answer = cipher; @@ -164,9 +171,9 @@ create_cipher(char *cipher, int *cipherLen, printf("\n"); } - if ((code = des_key_sched(ktc_to_cblock(key), schedule))) + if ((code = DES_key_sched(ktc_to_cblock(key), &schedule))) printf("In KAAuthenticate: key_sched returned %d\n", code); - des_pcbc_encrypt(cipher, cipher, len, schedule, ktc_to_cblockptr(key), ENCRYPT); + DES_pcbc_encrypt(cipher, cipher, len, &schedule, ktc_to_cblockptr(key), ENCRYPT); *cipherLen = round_up_to_ebs(len); if (krb_udp_debug) { @@ -218,13 +225,13 @@ check_auth(struct packet *pkt, char *auth, int authLen, char *cell) { char *packet; - des_key_schedule schedule; + DES_key_schedule schedule; afs_int32 cksum; afs_int32 time_sec; int byteOrder = pkt->byteOrder; - des_key_sched(ktc_to_cblock(key), schedule); - des_pcbc_encrypt(auth, auth, authLen, schedule, ktc_to_cblockptr(key), DECRYPT); + DES_key_sched(ktc_to_cblock(key), &schedule); + DES_pcbc_encrypt(auth, auth, authLen, &schedule, ktc_to_cblockptr(key), DECRYPT); packet = auth; if (strcmp(packet, name) != 0) return KABADTICKET; @@ -324,7 +331,7 @@ UDP_Authenticate(int ksoc, struct sockaddr_in *client, char *name, } /* make the ticket */ - code = des_random_key(ktc_to_cblock(&sessionKey)); + code = DES_new_random_key(ktc_to_cblock(&sessionKey)); if (code) { code = KERB_ERR_NULL_KEY; /* was KANOKEYS */ goto abort; @@ -537,7 +544,7 @@ UDP_GetTicket(int ksoc, struct packet *pkt, afs_int32 kvno, if (ntohl(server.flags) & KAFNOSEAL) return KABADSERVER; - code = des_random_key(ktc_to_cblock(&sessionKey)); + code = DES_new_random_key(ktc_to_cblock(&sessionKey)); if (code) { code = KERB_ERR_NULL_KEY; /* was KANOKEYS */ goto fail; @@ -1035,7 +1042,7 @@ FindBlock(at, aname, ainstance, tentry) strcpy(tentry->userID.name, aname); strcpy(tentry->userID.instance, ainstance); tentry->key_version = htonl(17); - des_string_to_key("toa", &tentry->key); + DES_string_to_key("toa", &tentry->key); tentry->flags = htonl(KAFNORMAL); tentry->user_expiration = htonl(NEVERDATE); tentry->max_ticket_lifetime = htonl(MAXKTCTICKETLIFETIME); @@ -1052,7 +1059,7 @@ ka_LookupKey(tt, name, inst, kvno, key) { printf("Calling ka_LookupKey with '%s'.'%s'\n", name, inst); *kvno = 23; - des_string_to_key("applexx", key); + DES_string_to_key("applexx", key); } static afs_int32 @@ -1065,7 +1072,7 @@ kvno_tgs_key(authDomain, kvno, tgskey) printf("Called with wrong %s as authDomain\n", authDomain); if (kvno != 23) printf("kvno_tgs_key: being called with wrong kvno: %d\n", kvno); - des_string_to_key("applexx", tgskey); + DES_string_to_key("applexx", tgskey); return 0; } diff --git a/src/kauth/prot.h b/src/kauth/prot.h index b62e049c74..a2b7281510 100644 --- a/src/kauth/prot.h +++ b/src/kauth/prot.h @@ -9,10 +9,6 @@ * Include file with authentication protocol information. */ -#include - - /* #include *//* removed 890221 */ - #ifndef PROT_DEFS #define PROT_DEFS diff --git a/src/kauth/read_passwd.c b/src/kauth/read_passwd.c deleted file mode 100644 index b30101b464..0000000000 --- a/src/kauth/read_passwd.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. - * - * For copying and distribution information, please see the file - * . - * - * This routine prints the supplied string to standard - * output as a prompt, and reads a password string without - * echoing. - */ - -#include -#include - -#include - -#include -#include -#include -#ifdef BSDUNIX -#include -#include -#include -#include -#else -#include -#endif -#if defined(AFS_AIX_ENV) -#include -#endif -#if defined(AFS_SGI_ENV) -#include -#endif -#include - -#if defined (AFS_AIX_ENV) || defined(AFS_SGI_ENV) -/* Just temp till we figure out the aix stuff */ -#undef BSDUNIX -static int intrupt; -#endif - -#ifdef BSDUNIX -static jmp_buf env; -#endif - -#ifdef BSDUNIX -static void sig_restore(); -static push_signals(), pop_signals(); -int read_pw_string(); -#endif - -/*** Routines ****************************************************** */ -int -des_read_password(C_Block *k, char *prompt, int verify) -{ - int ok; - char key_string[BUFSIZ]; - -#ifdef BSDUNIX - if (setjmp(env)) { - ok = -1; - goto lose; - } -#endif - - ok = read_pw_string(key_string, BUFSIZ, prompt, verify); - if (ok == 0) - string_to_key(key_string, k); -#ifdef BSDUNIX - lose: -#endif - memset(key_string, 0, sizeof(key_string)); - return ok; -} - -/* good_gets is like gets except that it take a max string length and won't - write past the end of its input buffer. It returns a variety of negative - numbers in case of errors and zero if there was no characters read (a blank - line for instance). Otherwise it returns the length of the string read in. - */ - -static int -good_gets(char *s, int max) -{ - int l; /* length of string read */ - if (!fgets(s, max, stdin)) { - if (feof(stdin)) - return EOF; /* EOF on input, nothing read */ - else - return -2; /* I don't think this can happen */ - } - l = strlen(s); - if (l && (s[l - 1] == '\n')) - s[--l] = 0; - return l; -} - -/* - * This version just returns the string, doesn't map to key. - * - * Returns 0 on success, non-zero on failure. - */ - -#if !defined(BSDUNIX) && (defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV)) -#include -#endif - -int -read_pw_string(char *s, int max, char *prompt, int verify) -{ - int ok = 0; - -#ifdef BSDUNIX - jmp_buf old_env; - struct sgttyb tty_state; -#else -#if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) - struct termio ttyb; - FILE *fi; - char savel, flags; - int (*sig) (), catch(); - extern void setbuf(); - extern int kill(), fclose(); -#endif -#endif - char key_string[BUFSIZ]; - - if (max > BUFSIZ) { - return -1; - } -#ifdef BSDUNIX - memcpy(old_env, env, sizeof(env)); - if (setjmp(env)) - goto lose; - - /* save terminal state */ - if (ioctl(0, TIOCGETP, &tty_state) == -1) - return -1; - - push_signals(); - /* Turn off echo */ - tty_state.sg_flags &= ~ECHO; - if (ioctl(0, TIOCSETP, &tty_state) == -1) { - pop_signals(); - return -1; - } -#else -#if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) - if ((fi = fopen("/dev/tty", "r+")) == NULL) - return (-1); - else - setbuf(fi, (char *)NULL); - sig = signal(SIGINT, catch); - intrupt = 0; - (void)ioctl(fileno(fi), TCGETA, &ttyb); - savel = ttyb.c_line; - ttyb.c_line = 0; - flags = ttyb.c_lflag; - ttyb.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - (void)ioctl(fileno(fi), TCSETAF, &ttyb); -#endif -#endif - - while (!ok) { - printf("%s", prompt); - fflush(stdout); -#ifdef CROSSMSDOS - h19line(s, sizeof(s), 0); - if (!strlen(s)) - continue; -#else - if (good_gets(s, max) <= 0) { - if (feof(stdin)) - break; /* just give up */ - else - continue; /* try again: blank line */ - } -#endif - if (verify) { - printf("\nVerifying, please re-enter %s", prompt); - fflush(stdout); -#ifdef CROSSMSDOS - h19line(key_string, sizeof(key_string), 0); - if (!strlen(key_string)) - continue; -#else - if (good_gets(key_string, sizeof(key_string)) <= 0) - continue; -#endif - if (strcmp(s, key_string)) { - printf("\n\07\07Mismatch - try again\n"); - fflush(stdout); - continue; - } - } - ok = 1; - } - -#ifdef BSDUNIX - lose: -#endif - if (!ok) - memset(s, 0, max); -#ifdef BSDUNIX - /* turn echo back on */ - tty_state.sg_flags |= ECHO; - if (ioctl(0, TIOCSETP, &tty_state)) - ok = 0; - pop_signals(); - memcpy(env, old_env, sizeof(env)); -#else -#if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) - ttyb.c_lflag = flags; - ttyb.c_line = savel; - (void)ioctl(fileno(fi), TCSETAW, &ttyb); - (void)signal(SIGINT, sig); - if (fi != stdin) - (void)fclose(fi); - if (intrupt) - (void)kill(getpid(), SIGINT); -#endif -#endif - if (verify) - memset(key_string, 0, sizeof(key_string)); - s[max - 1] = 0; /* force termination */ - return !ok; /* return nonzero if not okay */ -} - -#ifdef BSDUNIX -/* - * this can be static since we should never have more than - * one set saved.... - */ -static int (*old_sigfunc[NSIG]) (int); - -static -push_signals(void) -{ - int i; - for (i = 0; i < NSIG; i++) - old_sigfunc[i] = signal(i, sig_restore); -} - -static -pop_signals(void) -{ - int i; - for (i = 0; i < NSIG; i++) - signal(i, old_sigfunc[i]); -} - -static void -sig_restore(int sig, int code, struct sigcontext *scp) -{ - longjmp(env, 1); -} -#endif - -#if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) -static int -catch(void) -{ - ++intrupt; -} -#endif diff --git a/src/kauth/rebuild.c b/src/kauth/rebuild.c index 28af5ff300..eed9d7455f 100644 --- a/src/kauth/rebuild.c +++ b/src/kauth/rebuild.c @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include #include @@ -471,8 +470,8 @@ WorkerBee(struct cmd_syndesc *as, void *arock) printf("Entry %d has zero length name\n", i); continue; } - if (!des_check_key_parity(ktc_to_cblock(&entry.key)) - || des_is_weak_key(ktc_to_cblock(&entry.key))) { + if (!DES_check_key_parity(ktc_to_cblock(&entry.key)) + || DES_is_weak_key(ktc_to_cblock(&entry.key))) { fprintf(stderr, "Entry %d, %s, has bad key\n", i, EntryName(&entry)); continue; diff --git a/src/kauth/test/NTMakefile b/src/kauth/test/NTMakefile index b9a45bf463..0fe5c66b37 100644 --- a/src/kauth/test/NTMakefile +++ b/src/kauth/test/NTMakefile @@ -11,7 +11,6 @@ RELDIR=kauth\test EXELIBS = \ $(DESTDIR)\afslwp.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\afs\afsauth.lib \ $(DESTDIR)\afs\afscmd.lib \ diff --git a/src/kauth/user.c b/src/kauth/user.c index e9b32e6c86..28220528e8 100644 --- a/src/kauth/user.c +++ b/src/kauth/user.c @@ -37,16 +37,16 @@ #include #endif -#include -#include #include #include #include /* max ticket lifetime */ +#include +#include + #include "kauth.h" #include "kautils.h" #include - afs_int32 GetTickets(char *name, char *instance, char *realm, struct ktc_encryptionKey * key, Date lifetime, @@ -187,7 +187,7 @@ ka_UserAuthenticateGeneral(afs_int32 flags, char *name, char *instance, if (flags & KA_USERAUTH_ONLY_VERIFY) { code = ka_VerifyUserToken(name, instance, realm, &key); if (code == KABADREQUEST) { - des_string_to_key(password, ktc_to_cblockptr(&key)); + DES_string_to_key(password, ktc_to_cblockptr(&key)); code = ka_VerifyUserToken(name, instance, realm, &key); } } else { @@ -212,7 +212,7 @@ ka_UserAuthenticateGeneral(afs_int32 flags, char *name, char *instance, GetTickets(name, instance, realm, &key, lifetime, password_expires, dosetpag); if (code == KABADREQUEST) { - des_string_to_key(password, ktc_to_cblockptr(&key)); + DES_string_to_key(password, ktc_to_cblockptr(&key)); code = GetTickets(name, instance, realm, &key, lifetime, password_expires, dosetpag); @@ -264,7 +264,7 @@ ka_UserReadPassword(char *prompt, char *password, int plen, char **reasonP) code = ka_Init(0); if (code) return code; - code = read_pw_string(password, plen, prompt, 0); + code = UI_UTIL_read_pw_string(password, plen, prompt, 0); if (code) code = KAREADPW; else if (strlen(password) == 0) diff --git a/src/kauth/user_nt.c b/src/kauth/user_nt.c index 6f5a3fcf11..e471474bc4 100644 --- a/src/kauth/user_nt.c +++ b/src/kauth/user_nt.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include int krb_add_host(struct sockaddr_in *server_list_p); static void krb_set_port(long port); @@ -124,7 +124,7 @@ ka_UserAuthenticateGeneral2(afs_int32 flags, char *name, char *instance, /* encrypt password, both ways */ ka_StringToKey(password, upperRealm, &key1); - des_string_to_key(password, &key2); + DES_string_to_key(password, &key2); /* set port number */ sp = getservbyname("kerberos", "udp"); @@ -207,7 +207,6 @@ static int krbONE = 1; #include #include -#include #include "krb.h" #include @@ -299,7 +298,7 @@ static check_response(KTEXT rpkt, KTEXT cip, char *service, char *instance, char *realm, struct ktc_encryptionKey *key) { - Key_schedule key_s; + DES_key_schedule key_s; char *ptr; char s_service[SNAME_SZ]; char s_instance[INST_SZ]; @@ -314,9 +313,9 @@ check_response(KTEXT rpkt, KTEXT cip, char *service, char *instance, memcpy((char *)(cip->dat), (char *)pkt_cipher(rpkt), cip->length); /* decrypt ticket */ - key_sched((char *)key, key_s); - pcbc_encrypt((C_Block *) cip->dat, (C_Block *) cip->dat, - (long)cip->length, key_s, (des_cblock *) key, 0); + DES_key_sched((DES_cblock *)key, &key_s); + DES_pcbc_encrypt((DES_cblock *) cip->dat, (DES_cblock *) cip->dat, + (long)cip->length, &key_s, (DES_cblock *) key, 0); /* Skip session key */ ptr = (char *)cip->dat + 8; @@ -428,7 +427,7 @@ krb_get_in_tkt_ext(user, instance, realm, service, sinstance, life, key1, KTEXT cip = &cip_st; /* Returned Ciphertext */ KTEXT_ST tkt_st; KTEXT tkt = &tkt_st; /* Current ticket */ - C_Block ses; /* Session key for tkt */ + DES_cblock ses; /* Session key for tkt */ int kvno; /* Kvno for session key */ unsigned char *v = pkt->dat; /* Prot vers no */ unsigned char *t = (pkt->dat + 1); /* Prot msg type */ @@ -937,7 +936,7 @@ Andrew_StringToKey(str, cell, key) keybytes[i] = (unsigned char)(temp << 1); } } - des_fixup_key_parity((unsigned char *)key); + DES_fixup_key_parity((DES_cblock *)key); } @@ -947,7 +946,7 @@ StringToKey(str, cell, key) char *cell; /* cell for password */ struct ktc_encryptionKey *key; { - des_key_schedule schedule; + DES_key_schedule schedule; char temp_key[8]; char ivec[8]; char password[BUFSIZ]; @@ -961,14 +960,14 @@ StringToKey(str, cell, key) memcpy(ivec, "kerberos", 8); memcpy(temp_key, "kerberos", 8); - des_fixup_key_parity(temp_key); - des_key_sched(temp_key, schedule); - des_cbc_cksum(password, ivec, passlen, schedule, ivec); + DES_fixup_key_parity(temp_key); + DES_key_sched(temp_key, &schedule); + DES_cbc_cksum(password, ivec, passlen, &schedule, ivec); memcpy(temp_key, ivec, 8); - des_fixup_key_parity(temp_key); - des_key_sched(temp_key, schedule); - des_cbc_cksum(password, (char *)key, passlen, schedule, ivec); + DES_fixup_key_parity(temp_key); + DES_key_sched(temp_key, &schedule); + DES_cbc_cksum(password, (DES_cblock *)key, passlen, &schedule, ivec); - des_fixup_key_parity((char *)key); + DES_fixup_key_parity((DES_cblock *)key); } diff --git a/src/libadmin/samples/Makefile.in b/src/libadmin/samples/Makefile.in index f1fd8697b3..d336219ecd 100644 --- a/src/libadmin/samples/Makefile.in +++ b/src/libadmin/samples/Makefile.in @@ -44,72 +44,94 @@ SAMPLELIBS =\ ${TOP_LIBDIR}/libbosadmin.a \ ${TOP_LIBDIR}/libafsauthent.a \ ${TOP_LIBDIR}/libafsrpc.a \ - $(TOP_LIBDIR)/libafsutil.a + $(TOP_LIBDIR)/libafsutil.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a all test tests: $(SAMPLEPROGS) cm_client_config: cm_client_config.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) cm_list_cells: cm_list_cells.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) cm_local_cell: cm_local_cell.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) cm_server_prefs: cm_server_prefs.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxdebug_basic_stats: rxdebug_basic_stats.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxdebug_conns: rxdebug_conns.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxdebug_peers: rxdebug_peers.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxdebug_rx_stats: rxdebug_rx_stats.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxdebug_supported_stats: rxdebug_supported_stats.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxdebug_version: rxdebug_version.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_clear_peer: rxstat_clear_peer.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_clear_process: rxstat_clear_process.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_disable_peer: rxstat_disable_peer.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_disable_process: rxstat_disable_process.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_enable_peer: rxstat_enable_peer.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_enable_process: rxstat_enable_process.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_get_peer: rxstat_get_peer.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_get_process: rxstat_get_process.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_get_version: rxstat_get_version.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_query_peer: rxstat_query_peer.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) rxstat_query_process: rxstat_query_process.o $(SAMPLELIBS) - $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(MT_LIBS) $(XLIBS) + $(AFS_LDRULE) $@.o $(SAMPLELIBS) $(LIB_roken) $(LIB_crypt) \ + $(MT_LIBS) $(XLIBS) # # Errors diff --git a/src/libadmin/test/Makefile.in b/src/libadmin/test/Makefile.in index e5d193ed1b..0d05bb12dc 100644 --- a/src/libadmin/test/Makefile.in +++ b/src/libadmin/test/Makefile.in @@ -27,7 +27,8 @@ AFSCPLIBS =\ $(TOP_LIBDIR)/libafsauthent.a \ $(TOP_LIBDIR)/libafsrpc.a \ $(TOP_LIBDIR)/libcmd.a \ - $(TOP_LIBDIR)/libafsutil.a + $(TOP_LIBDIR)/libafsutil.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a AFSCPOBJS =\ bos.o \ @@ -43,7 +44,7 @@ CFLAGS_client.o = @CFLAGS_NOERROR@ afscp: afscp.o $(AFSCPOBJS) $(AFSCPLIBS) $(AFS_LDRULE) afscp.o $(AFSCPOBJS) $(AFSCPLIBS) \ - $(LIB_roken) ${MT_LIBS} $(XLIBS) + $(LIB_roken) $(LIB_crypt) ${MT_LIBS} $(XLIBS) ####################################################################### install: diff --git a/src/libafsauthent/Makefile.in b/src/libafsauthent/Makefile.in index 7a048a9478..31320641a5 100644 --- a/src/libafsauthent/Makefile.in +++ b/src/libafsauthent/Makefile.in @@ -48,8 +48,7 @@ KAUTHOBJS = \ kautils.o \ kalocalcell.o \ kaerrors.o \ - user.o \ - read_passwd.o + user.o UBIKOBJS = \ uinit.o \ diff --git a/src/libafsauthent/NTMakefile b/src/libafsauthent/NTMakefile index 36359c2481..acc39c327c 100644 --- a/src/libafsauthent/NTMakefile +++ b/src/libafsauthent/NTMakefile @@ -50,6 +50,7 @@ KAUTHOBJS = \ $(OUT)\kauth.cs.obj \ $(OUT)\kaaux.obj \ $(OUT)\client.obj \ + $(OUT)\crypt.obj \ $(OUT)\authclient.obj \ $(OUT)\kautils.obj \ $(OUT)\kalocalcell.obj \ @@ -138,7 +139,6 @@ DLLLIBS =\ $(DESTDIR)\lib\afspthread.lib \ !ENDIF $(DESTDIR)\lib\afsrpc.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\afs\afseventlog.lib \ @@ -146,6 +146,7 @@ DLLLIBS =\ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\lanahelper.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS) diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index 1e1a1088d1..8158d9cf7f 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -27,7 +27,6 @@ RX = ${srcdir}/../rx RXKAD = ${srcdir}/../rxkad RXSTAT = ${srcdir}/../rxstat FSINT = ${srcdir}/../fsint -DES = ${srcdir}/../des COMERR = ${srcdir}/../comerr UTIL = ${srcdir}/../util SYS = ${srcdir}/../sys @@ -98,41 +97,20 @@ RXKADOBJS =\ ticket.o \ ticket5.o \ crc.o \ - md4.o \ - md5.o \ fcrypt.o \ crypt_conn.o -DESOBJS =\ - des.o \ - cbc_encrypt.o \ - pcbc_encrypt.o \ - cksum.o \ - new_rnd_key.o \ - key_sched.o \ - debug_decl.o \ - quad_cksum.o \ - key_parity.o \ - weak_key.o \ - strng_to_key.o \ - misc.o \ - util.o - -CRYPT_OBJ = crypt.o - LWPOBJS = \ fasttime.o \ lock.o LIBOBJS = \ ${RXOBJS} \ - ${DESOBJS} \ ${XDROBJS} \ ${RXKADOBJS} \ ${COMERROBJS} \ ${UTILOBJS} \ ${SYSOBJS} \ - ${CRYPT_OBJ} \ ${RXSTATOBJS} \ ${LWPOBJS} \ ${FSINTOBJS} @@ -275,84 +253,6 @@ xdr_update.o: ${RX}/xdr_update.c xdr_afsuuid.o: ${RX}/xdr_afsuuid.c $(AFS_CCRULE) $(RX)/xdr_afsuuid.c -# Note that the special case statement for compiling des.c is present -# simply to work around a compiler bug on HP-UX 11.0. The symptom of -# the problem is that linking the pthread fileserver fails with messages -# such as -# -# pxdb internal warning: cu[84]: SLT_SRCFILE[411] out of synch -# Please contact your HP Support representative -# pxdb internal warning: cu[84]: SLT_SRCFILE[442] out of synch -# pxdb internal warning: cu[84]: SLT_SRCFILE[450] out of synch -# pxdb internal warning: cu[84]: SLT_SRCFILE[529] out of synch -# pxdb internal warning: cu[84]: SLT_SRCFILE[544] out of synch -# ... -# pxdb32: internal error. File won't be debuggable (still a valid executable) -# *** Error exit code 10 -# -# The problematic version of pxdb is: -# -# $ what /opt/langtools/bin/pxdb32 -# /opt/langtools/bin/pxdb32: -# HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision$ -# -# The problem occurs when -g and -O are both used when compiling des.c. -# The simplest way to work around the problem is to leave out either -g or -O. -# Since des.c is relatively stable I've chosen to eliminate -g rather -# than take any hit in performance. - -des.o: ${DES}/des.c - set -x; \ - case ${SYS_NAME} in \ - hp_ux11*) \ - set X `echo ${AFS_CCRULE} -I../des ${DES}/des.c | sed s/-g//`; shift; \ - "$$@" \ - ;; \ - *) \ - ${AFS_CCRULE} -I../des ${DES}/des.c \ - ;; \ - esac - -crypt.o: ${DES}/crypt.c - $(AFS_CCRULE) $(DES)/crypt.c - -cbc_encrypt.o: ${DES}/cbc_encrypt.c - $(AFS_CCRULE) $(DES)/cbc_encrypt.c - -pcbc_encrypt.o: ${DES}/pcbc_encrypt.c - $(AFS_CCRULE) $(DES)/pcbc_encrypt.c - -cksum.o: ${DES}/cksum.c - $(AFS_CCRULE) $(DES)/cksum.c - -new_rnd_key.o: ${DES}/new_rnd_key.c - $(AFS_CCRULE) $(DES)/new_rnd_key.c - -key_sched.o: ${DES}/key_sched.c - $(AFS_CCRULE) -I../des $(DES)/key_sched.c - -debug_decl.o: ${DES}/debug_decl.c - $(AFS_CCRULE) $(DES)/debug_decl.c - -quad_cksum.o: ${DES}/quad_cksum.c - $(AFS_CCRULE) $(DES)/quad_cksum.c - -key_parity.o: ${DES}/key_parity.c - $(AFS_CCRULE) -I../des $(DES)/key_parity.c - -weak_key.o: ${DES}/weak_key.c - $(AFS_CCRULE) $(DES)/weak_key.c - -strng_to_key.o: ${DES}/strng_to_key.c - $(AFS_CCRULE) $(DES)/strng_to_key.c - -misc.o: ${DES}/misc.c - $(AFS_CCRULE) $(DES)/misc.c - -util.o: ${DES}/util.c - $(AFS_CCRULE) $(DES)/util.c - - error_msg.o: ${COMERR}/error_msg.c $(AFS_CCRULE) $(COMERR)/error_msg.c diff --git a/src/libafsrpc/NTMakefile b/src/libafsrpc/NTMakefile index 4fbf958136..74f2657f93 100644 --- a/src/libafsrpc/NTMakefile +++ b/src/libafsrpc/NTMakefile @@ -13,7 +13,6 @@ AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DNOGDI -DWIN32_LEAN_AND_MEAN -DAFS_P RX = ..\rx RXSTAT = ..\rxstat RXKAD = ..\rxkad -DES = ..\des UTIL = ..\util FSINT = ..\fsint COMERR = ..\comerr @@ -43,16 +42,10 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_user.obj $(OUT)\rx_pthread.obj \ RXSTATBJS = $(OUT)\rxstat.obj $(OUT)\rxstat.ss.obj $(OUT)\rxstat.xdr.obj $(OUT)\rxstat.cs.obj LIBRXKAD_OBJS = $(OUT)\rxkad_client.obj $(OUT)\rxkad_server.obj $(OUT)\rxkad_common.obj $(OUT)\ticket.obj \ - $(OUT)\ticket5.obj $(OUT)\crc.obj $(OUT)\md4.obj $(OUT)\md5.obj $(OUT)\AFS_component_version_number.obj + $(OUT)\ticket5.obj $(OUT)\crc.obj $(OUT)\AFS_component_version_number.obj LIBRXKAD_REGOBJS = $(OUT)\bg-fcrypt.obj -DESOBJS_INT = $(OUT)\des.obj $(OUT)\cbc_encrypt.obj $(OUT)\pcbc_encrypt.obj $(OUT)\cksum.obj $(OUT)\new_rnd_key.obj \ - $(OUT)\key_sched.obj $(OUT)\debug_decl.obj $(OUT)\quad_cksum.obj $(OUT)\key_parity.obj \ - $(OUT)\weak_key.obj $(OUT)\strng_to_key.obj $(OUT)\util.obj - -DESOBJS = $(DESOBJS_INT) $(OUT)\misc.obj - UTILOBJS = $(OUT)\casestrcpy.obj $(OUT)\winsock_nt.obj COMERRBJS = $(OUT)\error_msg.obj $(OUT)\et_name.obj $(OUT)\com_err.obj @@ -63,7 +56,7 @@ FSINTBJS = $(OUT)\afsint.cs.obj $(OUT)\afsint.xdr.obj $(OUT)\afscbint.cs.obj $(O $(OUT)\afsaux.obj DLLOBJS = $(MULTIOBJS) $(RXOBJS) $(XDROBJS) $(RXSTATBJS) $(LIBRXKAD_OBJS) \ - $(DESOBJS) $(LIBRXKAD_REGOBJS) $(UTILBJS) $(COMERRBJS) \ + $(LIBRXKAD_REGOBJS) $(UTILBJS) $(COMERRBJS) \ $(FSINTBJS) $(LWPOBJS) $(OUT)\afsrpc.res $(MULTIOBJS) $(RXOBJS) $(XDROBJS):$(RX)\$$(@B).c @@ -75,12 +68,6 @@ $(RXSTATBJS):$(RXSTAT)\$$(@B).c $(LIBRXKAD_REGOBJS) $(LIBRXKAD_OBJS):$(RXKAD)\$$(@B).c $(C2OBJ) $** -I$(RXKAD) -$(DESOBJS_INT):$(DES)\$$(@B).c - $(C2OBJ) $** -I$(DES) - -$(OUT)\misc.obj:$(DES)\misc.c - $(C2OBJ) $** -DDONT_INCL_MAIN -I$(DES) - $(COMERRBJS):$(COMERR)\$$(@B).c $(C2OBJ) $** -I$(COMERR) @@ -104,6 +91,7 @@ DLLLIBS =\ !ENDIF $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(LIBFILE): $(DLLOBJS) $(DLLLIBS) @@ -117,31 +105,10 @@ $(LIBFILE): $(DLLOBJS) $(DLLLIBS) # Definitions for generating versioninfo resources $(OUT)\afsrpc.res: AFS_component_version_number.h -install: -! IF (EXIST(..\..\src\des\NTMakefile)) - $(NTMAKE) $(LIBFILE) -! else - $(NTMAKE) libstub -! endif +install: $(LIBFILE) install9x: install -!IF (EXIST(..\..\src\des\NTMakefile)) -!ELSE IF (EXIST(..\..\DESLIB)) -DESPAR = ..\..\DESLIB\dest -!ELSE IF (EXIST(..\..\..\DESLIB)) -DESPAR = ..\..\..\DESLIB\dest -!ELSE -!ERROR Must create DESLIB link in the same directory as PARENT link. -!ENDIF - -libstub: - $(COPY) $(DESPAR)\lib\afsrpc.dll \ - $(DESTDIR)\lib\afsrpc.dll - $(COPY) $(DESPAR)\lib\afsrpc.lib \ - $(DESTDIR)\lib\afsrpc.lib - $(COPY) $(DESPAR)\lib\afsrpc.exp \ - $(DESTDIR)\lib\afsrpc.exp clean:: $(DEL) $(DESTDIR)\lib\afsrpc.dll $(DESTDIR)\lib\afsrpc.lib $(DESTDIR)\lib\afsrpc.exp diff --git a/src/libafsrpc/afsrpc.def b/src/libafsrpc/afsrpc.def index 048fb1e2c7..0fc8b243f8 100755 --- a/src/libafsrpc/afsrpc.def +++ b/src/libafsrpc/afsrpc.def @@ -1,11 +1,4 @@ EXPORTS - des_check_key_parity @2 - des_fixup_key_parity @5 - des_init_random_number_generator @6 - des_is_weak_key @7 - des_key_sched @8 - des_random_key @9 - des_string_to_key @10 ktohl @11 life_to_time @12 rx_DestroyConnection @13 diff --git a/src/libuafs/Makefile.common.in b/src/libuafs/Makefile.common.in index 3e48f58745..e91128c842 100644 --- a/src/libuafs/Makefile.common.in +++ b/src/libuafs/Makefile.common.in @@ -16,7 +16,6 @@ WEBOBJ=../AFSWEB AFS =../afs RX =../rx AFSINT=../afsint -DES =../des LIB =../lib NS_INCL =SRC/../afsweb/netscape_includes @@ -75,12 +74,13 @@ webinstall: all \ ${TOP_LIBDIR}/$(LIBAFSWEB) \ ${TOP_LIBDIR}/$(LIBAFSWEBKRB) -linktest: UAFS/$(LIBUAFS) ${TOP_OBJDIR}/lib/libdes.a - $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) $(LDFLAGS_roken) -o linktest \ +linktest: UAFS/$(LIBUAFS) + $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) \ + $(LDFLAGS_roken) $(LDFLAGS_hcrypto) -o linktest \ ${srcdir}/linktest.c $(COMMON_INCLUDE) -DUKERNEL \ UAFS/$(LIBUAFS) ${TOP_LIBDIR}/libcmd.a \ - ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/libafsutil.a \ - $(LIB_roken) $(TEST_LIBS) $(XLIBS) + ${TOP_LIBDIR}/libafsutil.a \ + $(LIB_hcrypto) $(LIB_roken) $(TEST_LIBS) $(XLIBS) CRULE1= $(CC) $(COMMON_INCLUDE) $(OPTF) -DKERNEL $(LIBJUAFS_FLAGS) $(CFLAGS) -c $? CRULE2= $(CC) $(COMMON_INCLUDE) $(OPTF) $(WEBOPTS) -DKERNEL $(LIBJUAFS_FLAGS) $(CFLAGS) -c $? @@ -1522,8 +1522,8 @@ $(JUAFS)/xdr_len.o: $(TOP_SRC_RX)/xdr_len.c $(CRULE1) clean: - -$(RM) -rf UAFS* JUAFS* AFSWEB* nsapi des afs afsint config rx - -$(RM) -f h net netinet rpc ufs machine inet nfs sys des linktest $(AFS_OS_CLEAN) + -$(RM) -rf UAFS* JUAFS* AFSWEB* nsapi afs afsint config rx + -$(RM) -f h net netinet rpc ufs machine inet nfs sys linktest $(AFS_OS_CLEAN) install: UAFS/$(LIBUAFS) JUAFS/$(LIBJUAFS) @@ -1536,7 +1536,7 @@ dest: $(TOP_INCDIR)/afs/param.h $(TOP_INCDIR)/afs/stds.h \ $(TOP_INCDIR)/afs/afs_stats.h \ $(TOP_SRCDIR)/afs/sysincludes.h \ $(TOP_SRCDIR)/afs/UKERNEL/afs_usrops.h \ - ${TOP_OBJDIR}/lib/libdes.a UAFS/$(LIBUAFS) JUAFS/$(LIBJUAFS) + UAFS/$(LIBUAFS) JUAFS/$(LIBJUAFS) ${INSTALL} -d ${DEST}/root.perf/include/afs ${INSTALL} -d ${DEST}/root.perf/lib ${INSTALL_DATA} $(TOP_INCDIR)/afs/param.h \ @@ -1551,8 +1551,6 @@ dest: $(TOP_INCDIR)/afs/param.h $(TOP_INCDIR)/afs/stds.h \ ${DEST}/root.perf/include/afs/sysincludes.h ${INSTALL_DATA} $(TOP_SRCDIR)/afs/UKERNEL/afs_usrops.h \ ${DEST}/root.perf/include/afs/afs_usrops.h - ${INSTALL_DATA} ${TOP_OBJDIR}/lib/libdes.a \ - ${DEST}/root.perf/lib/libdes.a ${INSTALL_DATA} UAFS/$(LIBUAFS) ${DEST}/root.perf/lib/$(LIBUAFS) ${INSTALL_DATA} JUAFS/$(LIBJUAFS) ${DEST}/root.perf/lib/$(LIBJUAFS) diff --git a/src/libuafs/MakefileProto.LINUX.in b/src/libuafs/MakefileProto.LINUX.in index fe14f9ae1a..37d896e19a 100644 --- a/src/libuafs/MakefileProto.LINUX.in +++ b/src/libuafs/MakefileProto.LINUX.in @@ -33,7 +33,7 @@ OPTF=-O TEST_CFLAGS=-pthread -D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_LINUX22_ENV TEST_LDFLAGS= -TEST_LIBS=-lpthread +TEST_LIBS=-lpthread @LIB_crypt@ LIBUAFS = libuafs.a LIBJUAFS = libjuafs.a diff --git a/src/log/Makefile.in b/src/log/Makefile.in index 30c93fd1be..e3fd6bd68d 100644 --- a/src/log/Makefile.in +++ b/src/log/Makefile.in @@ -22,17 +22,17 @@ ${TOP_INCDIR}/afs/cellconfig.h LIBRARIES=${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a KLIBRARIES=${TOP_LIBDIR}/libauth.krb.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a # diff --git a/src/packaging/RedHat/openafs.spec.in b/src/packaging/RedHat/openafs.spec.in index 6db1b8b61c..e20ff50b27 100644 --- a/src/packaging/RedHat/openafs.spec.in +++ b/src/packaging/RedHat/openafs.spec.in @@ -1582,7 +1582,6 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||: %{_includedir}/ubik.h %{_includedir}/ubik_int.h %{_libdir}/afs -%{_libdir}/libdes.a %{_libdir}/liblwp.a %{_libdir}/librx.a %{_libdir}/librxkad.a diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in index 82e62a47ef..b2a6a68f1e 100644 --- a/src/pam/Makefile.in +++ b/src/pam/Makefile.in @@ -15,7 +15,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LIBS = ${TOP_LIBDIR}/libafsauthent_pic.a ${TOP_LIBDIR}/libafsrpc_pic.a \ ${PAM_LIBS} @LIB_AFSDB@ ${MT_LIBS} KLIBS = ktc_krb.o ${TOP_LIBDIR}/libafsauthent_pic.a \ - ${TOP_LIBDIR}/libafsrpc_pic.a ${PAM_LIBS} @LIB_AFSDB@ ${MT_LIBS} + ${TOP_LIBDIR}/libafsrpc_pic.a \ + ${PAM_LIBS} @LIB_AFSDB@ ${MT_LIBS} SHOBJS = afs_account.o afs_session.o afs_password.o \ afs_pam_msg.o afs_message.o AFS_component_version_number.o OBJS = $(SHOBJS) test_pam.o @@ -61,7 +62,9 @@ pam_afs.so.1: $(SHOBJS) afs_setcred.o afs_auth.o afs_util.o \ ${TOP_LIBDIR}/libafsrpc_pic.a \ pam_afs.map ../config/shlib-build -d $(srcdir) -f pam_afs.so.1 -l pam_afs -- \ - afs_setcred.o afs_auth.o afs_util.o ${SHOBJS} ${LIBS} + afs_setcred.o afs_auth.o afs_util.o ${SHOBJS} \ + ${LIBS} $(LDFLAGS_hcrypto) $(LDFLAGS_roken) \ + $(LIB_hcrypto) $(LIB_roken) pam_afs.krb.so.1: $(SHOBJS) afs_setcred_krb.o afs_auth_krb.o afs_util_krb.o \ ktc_krb.o ${TOP_LIBDIR}/libafsauthent_pic.a \ @@ -69,7 +72,8 @@ pam_afs.krb.so.1: $(SHOBJS) afs_setcred_krb.o afs_auth_krb.o afs_util_krb.o \ pam_afs.map ../config/shlib-build -d $(srcdir) -f pam_afs.krb.so.1 -l pam_afs -- \ afs_setcred_krb.o afs_auth_krb.o afs_util_krb.o \ - ${SHOBJS} ${KLIBS} + ${SHOBJS} ${KLIBS} $(LDFLAGS_hcrypto) $(LDFLAGS_roken) \ + $(LIB_hcrypto) $(LIB_roken) test_pam: test_pam.o set -x; \ diff --git a/src/ptserver/Makefile.in b/src/ptserver/Makefile.in index d5ecfc69cc..c646edaa77 100644 --- a/src/ptserver/Makefile.in +++ b/src/ptserver/Makefile.in @@ -32,17 +32,17 @@ LINCLS=${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/afs/cellconfig.h \ ptclient.h ptuser.h ptint.h pterror.h -LIBS=${TOP_LIBDIR}/libubik.a \ +LIBS= ${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/librxstat.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libafsutil.a + ${TOP_LIBDIR}/libafsutil.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a all: ptserver pts pt_util db_verify ${TOP_LIBDIR}/libprot.a \ diff --git a/src/ptserver/NTMakefile b/src/ptserver/NTMakefile index b4f1c29f3e..cb3ac5f6e0 100644 --- a/src/ptserver/NTMakefile +++ b/src/ptserver/NTMakefile @@ -63,7 +63,6 @@ PTSERVER_EXELIBS =\ $(DESTDIR)\lib\afsrxstat.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afs\afscom_err.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsaudit.lib \ @@ -71,6 +70,7 @@ PTSERVER_EXELIBS =\ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib !IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" )) @@ -114,7 +114,6 @@ PTS_EXELIBS =\ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afs\afscom_err.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsprot.lib \ @@ -123,6 +122,7 @@ PTS_EXELIBS =\ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) diff --git a/src/rx/rx.c b/src/rx/rx.c index 858e691866..d045d8b140 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -196,8 +196,6 @@ rxi_InitPthread(void) MUTEX_INIT(&epoch_mutex, "epoch", MUTEX_DEFAULT, 0); MUTEX_INIT(&rx_init_mutex, "init", MUTEX_DEFAULT, 0); MUTEX_INIT(&rx_event_mutex, "event", MUTEX_DEFAULT, 0); - MUTEX_INIT(&des_init_mutex, "des", MUTEX_DEFAULT, 0); - MUTEX_INIT(&des_random_mutex, "random", MUTEX_DEFAULT, 0); MUTEX_INIT(&osi_malloc_mutex, "malloc", MUTEX_DEFAULT, 0); MUTEX_INIT(&event_handler_mutex, "event handler", MUTEX_DEFAULT, 0); MUTEX_INIT(&rxi_connCacheMutex, "conn cache", MUTEX_DEFAULT, 0); diff --git a/src/rxkad/Makefile.in b/src/rxkad/Makefile.in index 8194022bdb..c3f47f28e9 100644 --- a/src/rxkad/Makefile.in +++ b/src/rxkad/Makefile.in @@ -18,18 +18,16 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INCLS=${TOP_INCDIR}/rx/rx.h ${TOP_INCDIR}/rx/xdr.h \ ${TOP_INCDIR}/rx/fcrypt.h \ - rxkad.h rxkad_prototypes.h fcrypt.h v5gen.h \ - hash.h md4.h md5.h + rxkad.h rxkad_prototypes.h fcrypt.h v5gen.h OBJS=rxkad_client.o rxkad_server.o rxkad_common.o rxkad_errs.o \ - fcrypt.o crypt_conn.o ticket.o ticket5.o crc.o \ - md4.o md5.o + fcrypt.o crypt_conn.o ticket.o ticket5.o crc.o fc_test_OBJS=fc_test.o fc_test_LIBS=\ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libafsutil.a @@ -87,10 +85,6 @@ ticket5.o: ticket5.c v5gen.c v5der.c v5gen-rewrite.h ${INCLS} crc.o: crc.c ${INCLS} -md4.o: md4.c ${INCLS} - -md5.o: md5.c ${INCLS} - fcrypt.o: fcrypt.c fcrypt.h sboxes.h rxkad.h rxkad_prototypes.h crypt_conn.o: crypt_conn.c fcrypt.h private_data.h ${INCLS} diff --git a/src/rxkad/NTMakefile b/src/rxkad/NTMakefile index faba33aa26..587b437911 100644 --- a/src/rxkad/NTMakefile +++ b/src/rxkad/NTMakefile @@ -15,9 +15,6 @@ INCFILES =\ $(INCFILEDIR)\rxkad_prototypes.h \ $(INCFILEDIR)\asn1_err.h \ $(INCFILEDIR)\v5gen.h \ - $(INCFILEDIR)\hash.h\ - $(INCFILEDIR)\md4.h \ - $(INCFILEDIR)\md5.h \ $(INCFILEDIR)\rxkad.h # build afsrxkad.lib @@ -31,8 +28,6 @@ LIBOBJS =\ $(OUT)\bg-fcrypt.obj \ $(OUT)\ticket5.obj \ $(OUT)\crc.obj \ - $(OUT)\md4.obj \ - $(OUT)\md5.obj \ $(OUT)\crypt_conn.obj $(LIBOBJS): diff --git a/src/rxkad/crc.c b/src/rxkad/crc.c index 2387a18120..cadaf749bf 100644 --- a/src/rxkad/crc.c +++ b/src/rxkad/crc.c @@ -49,7 +49,6 @@ #include #include #include -#include #include "lifetimes.h" static u_long table[256]; diff --git a/src/rxkad/hash.h b/src/rxkad/hash.h deleted file mode 100644 index 695d61e309..0000000000 --- a/src/rxkad/hash.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1999 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of KTH nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/* $Id$ */ - -/* stuff in common between md4, md5, and sha1 */ - -#ifndef __hash_h__ -#define __hash_h__ - -#include -#include - -#ifndef min -#define min(a,b) (((a)>(b))?(b):(a)) -#endif - -/* Vector Crays doesn't have a good 32-bit type, or more precisely, - int32_t as defined by isn't 32 bits, and we don't - want to depend in being able to redefine this type. To cope with - this we have to clamp the result in some places to [0,2^32); no - need to do this on other machines. Did I say this was a mess? - */ - -#ifdef _CRAY -#define CRAYFIX(X) ((X) & 0xffffffff) -#else -#define CRAYFIX(X) (X) -#endif - -#if !defined(inline) && !defined(__GNUC__) -#define inline -#endif - -static inline afs_uint32 -cshift(afs_uint32 x, unsigned int n) -{ - x = CRAYFIX(x); - return CRAYFIX((x << n) | (x >> (32 - n))); -} - -#endif /* __hash_h__ */ diff --git a/src/rxkad/md4.c b/src/rxkad/md4.c deleted file mode 100644 index f7546fc1d9..0000000000 --- a/src/rxkad/md4.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include - -#include - -#include -#include -#ifdef AFS_NT40_ENV -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include "lifetimes.h" -#include "md4.h" -#include "hash.h" - -#define A m->counter[0] -#define B m->counter[1] -#define C m->counter[2] -#define D m->counter[3] -#define X data - -void -MD4_Init(struct md4 *m) -{ - m->sz[0] = 0; - m->sz[1] = 0; - D = 0x10325476; - C = 0x98badcfe; - B = 0xefcdab89; - A = 0x67452301; -} - -#define F(x,y,z) CRAYFIX((x & y) | (~x & z)) -#define G(x,y,z) ((x & y) | (x & z) | (y & z)) -#define H(x,y,z) (x ^ y ^ z) - -#define DOIT(a,b,c,d,k,s,i,OP) \ -a = cshift(a + OP(b,c,d) + X[k] + i, s) - -#define DO1(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,F) -#define DO2(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,G) -#define DO3(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,H) - -static inline void -calc(struct md4 *m, afs_uint32 * data) -{ - afs_uint32 AA, BB, CC, DD; - - AA = A; - BB = B; - CC = C; - DD = D; - - /* Round 1 */ - - DO1(A, B, C, D, 0, 3, 0); - DO1(D, A, B, C, 1, 7, 0); - DO1(C, D, A, B, 2, 11, 0); - DO1(B, C, D, A, 3, 19, 0); - - DO1(A, B, C, D, 4, 3, 0); - DO1(D, A, B, C, 5, 7, 0); - DO1(C, D, A, B, 6, 11, 0); - DO1(B, C, D, A, 7, 19, 0); - - DO1(A, B, C, D, 8, 3, 0); - DO1(D, A, B, C, 9, 7, 0); - DO1(C, D, A, B, 10, 11, 0); - DO1(B, C, D, A, 11, 19, 0); - - DO1(A, B, C, D, 12, 3, 0); - DO1(D, A, B, C, 13, 7, 0); - DO1(C, D, A, B, 14, 11, 0); - DO1(B, C, D, A, 15, 19, 0); - - /* Round 2 */ - - DO2(A, B, C, D, 0, 3, 0x5A827999); - DO2(D, A, B, C, 4, 5, 0x5A827999); - DO2(C, D, A, B, 8, 9, 0x5A827999); - DO2(B, C, D, A, 12, 13, 0x5A827999); - - DO2(A, B, C, D, 1, 3, 0x5A827999); - DO2(D, A, B, C, 5, 5, 0x5A827999); - DO2(C, D, A, B, 9, 9, 0x5A827999); - DO2(B, C, D, A, 13, 13, 0x5A827999); - - DO2(A, B, C, D, 2, 3, 0x5A827999); - DO2(D, A, B, C, 6, 5, 0x5A827999); - DO2(C, D, A, B, 10, 9, 0x5A827999); - DO2(B, C, D, A, 14, 13, 0x5A827999); - - DO2(A, B, C, D, 3, 3, 0x5A827999); - DO2(D, A, B, C, 7, 5, 0x5A827999); - DO2(C, D, A, B, 11, 9, 0x5A827999); - DO2(B, C, D, A, 15, 13, 0x5A827999); - - /* Round 3 */ - - DO3(A, B, C, D, 0, 3, 0x6ED9EBA1); - DO3(D, A, B, C, 8, 9, 0x6ED9EBA1); - DO3(C, D, A, B, 4, 11, 0x6ED9EBA1); - DO3(B, C, D, A, 12, 15, 0x6ED9EBA1); - - DO3(A, B, C, D, 2, 3, 0x6ED9EBA1); - DO3(D, A, B, C, 10, 9, 0x6ED9EBA1); - DO3(C, D, A, B, 6, 11, 0x6ED9EBA1); - DO3(B, C, D, A, 14, 15, 0x6ED9EBA1); - - DO3(A, B, C, D, 1, 3, 0x6ED9EBA1); - DO3(D, A, B, C, 9, 9, 0x6ED9EBA1); - DO3(C, D, A, B, 5, 11, 0x6ED9EBA1); - DO3(B, C, D, A, 13, 15, 0x6ED9EBA1); - - DO3(A, B, C, D, 3, 3, 0x6ED9EBA1); - DO3(D, A, B, C, 11, 9, 0x6ED9EBA1); - DO3(C, D, A, B, 7, 11, 0x6ED9EBA1); - DO3(B, C, D, A, 15, 15, 0x6ED9EBA1); - - A += AA; - B += BB; - C += CC; - D += DD; -} - -/* - * From `Performance analysis of MD5' by Joseph D. Touch - */ - -#if defined(WORDS_BIGENDIAN) -static inline afs_uint32 -swap_afs_uint32(afs_uint32 t) -{ - afs_uint32 temp1, temp2; - - temp1 = cshift(t, 16); - temp2 = temp1 >> 8; - temp1 &= 0x00ff00ff; - temp2 &= 0x00ff00ff; - temp1 <<= 8; - return temp1 | temp2; -} -#endif - -struct x32 { - unsigned int a:32; - unsigned int b:32; -}; - -void -MD4_Update(struct md4 *m, const void *v, size_t len) -{ - const unsigned char *p = v; - size_t old_sz = m->sz[0]; - size_t offset; - - m->sz[0] += len * 8; - if (m->sz[0] < old_sz) - ++m->sz[1]; - offset = (old_sz / 8) % 64; - while (len > 0) { - size_t l = min(len, 64 - offset); - memcpy(m->save + offset, p, l); - offset += l; - p += l; - len -= l; - if (offset == 64) { -#if defined(WORDS_BIGENDIAN) - int i; - afs_uint32 current[16]; - struct x32 *u = (struct x32 *)m->save; - for (i = 0; i < 8; i++) { - current[2 * i + 0] = swap_afs_uint32(u[i].a); - current[2 * i + 1] = swap_afs_uint32(u[i].b); - } - calc(m, current); -#else - calc(m, (afs_uint32 *) m->save); -#endif - offset = 0; - } - } -} - -void -MD4_Final(void *res, struct md4 *m) -{ - static unsigned char zeros[72]; - unsigned offset = (m->sz[0] / 8) % 64; - unsigned int dstart = (120 - offset - 1) % 64 + 1; - - *zeros = 0x80; - memset(zeros + 1, 0, sizeof(zeros) - 1); - zeros[dstart + 0] = (m->sz[0] >> 0) & 0xff; - zeros[dstart + 1] = (m->sz[0] >> 8) & 0xff; - zeros[dstart + 2] = (m->sz[0] >> 16) & 0xff; - zeros[dstart + 3] = (m->sz[0] >> 24) & 0xff; - zeros[dstart + 4] = (m->sz[1] >> 0) & 0xff; - zeros[dstart + 5] = (m->sz[1] >> 8) & 0xff; - zeros[dstart + 6] = (m->sz[1] >> 16) & 0xff; - zeros[dstart + 7] = (m->sz[1] >> 24) & 0xff; - MD4_Update(m, zeros, dstart + 8); - { - int i; - unsigned char *r = (unsigned char *)res; - - for (i = 0; i < 4; ++i) { - r[4 * i] = m->counter[i] & 0xFF; - r[4 * i + 1] = (m->counter[i] >> 8) & 0xFF; - r[4 * i + 2] = (m->counter[i] >> 16) & 0xFF; - r[4 * i + 3] = (m->counter[i] >> 24) & 0xFF; - } - } -#if 0 - { - int i; - afs_uint32 *r = (afs_uint32 *) res; - - for (i = 0; i < 4; ++i) - r[i] = swap_afs_uint32(m->counter[i]); - } -#endif -} diff --git a/src/rxkad/md4.h b/src/rxkad/md4.h deleted file mode 100644 index ec2ca633d1..0000000000 --- a/src/rxkad/md4.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id$ */ - -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_BITYPES_H -#include -#endif - -struct md4 { - unsigned int sz[2]; - afs_uint32 counter[4]; - unsigned char save[64]; -}; - -typedef struct md4 MD4_CTX; - -void MD4_Init(struct md4 *m); -void MD4_Update(struct md4 *m, const void *p, size_t len); -void MD4_Final(void *res, struct md4 *m); diff --git a/src/rxkad/md5.c b/src/rxkad/md5.c deleted file mode 100644 index dea93d6d27..0000000000 --- a/src/rxkad/md5.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include - -#include - -#include -#include -#ifdef AFS_NT40_ENV -#include -#else -#include -#endif -#include -#include -#include -#include -#include "lifetimes.h" - -#include "md5.h" -#include "hash.h" - -#define A m->counter[0] -#define B m->counter[1] -#define C m->counter[2] -#define D m->counter[3] -#define X data - -void -MD5_Init(struct md5 *m) -{ - m->sz[0] = 0; - m->sz[1] = 0; - D = 0x10325476; - C = 0x98badcfe; - B = 0xefcdab89; - A = 0x67452301; -} - -#define F(x,y,z) CRAYFIX((x & y) | (~x & z)) -#define G(x,y,z) CRAYFIX((x & z) | (y & ~z)) -#define H(x,y,z) (x ^ y ^ z) -#define I(x,y,z) CRAYFIX(y ^ (x | ~z)) - -#define DOIT(a,b,c,d,k,s,i,OP) \ -a = b + cshift(a + OP(b,c,d) + X[k] + (i), s) - -#define DO1(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,F) -#define DO2(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,G) -#define DO3(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,H) -#define DO4(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,I) - -static inline void -calc(struct md5 *m, afs_uint32 * data) -{ - afs_uint32 AA, BB, CC, DD; - - AA = A; - BB = B; - CC = C; - DD = D; - - /* Round 1 */ - - DO1(A, B, C, D, 0, 7, 0xd76aa478); - DO1(D, A, B, C, 1, 12, 0xe8c7b756); - DO1(C, D, A, B, 2, 17, 0x242070db); - DO1(B, C, D, A, 3, 22, 0xc1bdceee); - - DO1(A, B, C, D, 4, 7, 0xf57c0faf); - DO1(D, A, B, C, 5, 12, 0x4787c62a); - DO1(C, D, A, B, 6, 17, 0xa8304613); - DO1(B, C, D, A, 7, 22, 0xfd469501); - - DO1(A, B, C, D, 8, 7, 0x698098d8); - DO1(D, A, B, C, 9, 12, 0x8b44f7af); - DO1(C, D, A, B, 10, 17, 0xffff5bb1); - DO1(B, C, D, A, 11, 22, 0x895cd7be); - - DO1(A, B, C, D, 12, 7, 0x6b901122); - DO1(D, A, B, C, 13, 12, 0xfd987193); - DO1(C, D, A, B, 14, 17, 0xa679438e); - DO1(B, C, D, A, 15, 22, 0x49b40821); - - /* Round 2 */ - - DO2(A, B, C, D, 1, 5, 0xf61e2562); - DO2(D, A, B, C, 6, 9, 0xc040b340); - DO2(C, D, A, B, 11, 14, 0x265e5a51); - DO2(B, C, D, A, 0, 20, 0xe9b6c7aa); - - DO2(A, B, C, D, 5, 5, 0xd62f105d); - DO2(D, A, B, C, 10, 9, 0x2441453); - DO2(C, D, A, B, 15, 14, 0xd8a1e681); - DO2(B, C, D, A, 4, 20, 0xe7d3fbc8); - - DO2(A, B, C, D, 9, 5, 0x21e1cde6); - DO2(D, A, B, C, 14, 9, 0xc33707d6); - DO2(C, D, A, B, 3, 14, 0xf4d50d87); - DO2(B, C, D, A, 8, 20, 0x455a14ed); - - DO2(A, B, C, D, 13, 5, 0xa9e3e905); - DO2(D, A, B, C, 2, 9, 0xfcefa3f8); - DO2(C, D, A, B, 7, 14, 0x676f02d9); - DO2(B, C, D, A, 12, 20, 0x8d2a4c8a); - - /* Round 3 */ - - DO3(A, B, C, D, 5, 4, 0xfffa3942); - DO3(D, A, B, C, 8, 11, 0x8771f681); - DO3(C, D, A, B, 11, 16, 0x6d9d6122); - DO3(B, C, D, A, 14, 23, 0xfde5380c); - - DO3(A, B, C, D, 1, 4, 0xa4beea44); - DO3(D, A, B, C, 4, 11, 0x4bdecfa9); - DO3(C, D, A, B, 7, 16, 0xf6bb4b60); - DO3(B, C, D, A, 10, 23, 0xbebfbc70); - - DO3(A, B, C, D, 13, 4, 0x289b7ec6); - DO3(D, A, B, C, 0, 11, 0xeaa127fa); - DO3(C, D, A, B, 3, 16, 0xd4ef3085); - DO3(B, C, D, A, 6, 23, 0x4881d05); - - DO3(A, B, C, D, 9, 4, 0xd9d4d039); - DO3(D, A, B, C, 12, 11, 0xe6db99e5); - DO3(C, D, A, B, 15, 16, 0x1fa27cf8); - DO3(B, C, D, A, 2, 23, 0xc4ac5665); - - /* Round 4 */ - - DO4(A, B, C, D, 0, 6, 0xf4292244); - DO4(D, A, B, C, 7, 10, 0x432aff97); - DO4(C, D, A, B, 14, 15, 0xab9423a7); - DO4(B, C, D, A, 5, 21, 0xfc93a039); - - DO4(A, B, C, D, 12, 6, 0x655b59c3); - DO4(D, A, B, C, 3, 10, 0x8f0ccc92); - DO4(C, D, A, B, 10, 15, 0xffeff47d); - DO4(B, C, D, A, 1, 21, 0x85845dd1); - - DO4(A, B, C, D, 8, 6, 0x6fa87e4f); - DO4(D, A, B, C, 15, 10, 0xfe2ce6e0); - DO4(C, D, A, B, 6, 15, 0xa3014314); - DO4(B, C, D, A, 13, 21, 0x4e0811a1); - - DO4(A, B, C, D, 4, 6, 0xf7537e82); - DO4(D, A, B, C, 11, 10, 0xbd3af235); - DO4(C, D, A, B, 2, 15, 0x2ad7d2bb); - DO4(B, C, D, A, 9, 21, 0xeb86d391); - - A += AA; - B += BB; - C += CC; - D += DD; -} - -/* - * From `Performance analysis of MD5' by Joseph D. Touch - */ - -#if defined(WORDS_BIGENDIAN) -static inline afs_uint32 -swap_afs_uint32(afs_uint32 t) -{ - afs_uint32 temp1, temp2; - - temp1 = cshift(t, 16); - temp2 = temp1 >> 8; - temp1 &= 0x00ff00ff; - temp2 &= 0x00ff00ff; - temp1 <<= 8; - return temp1 | temp2; -} -#endif - -struct x32 { - unsigned int a:32; - unsigned int b:32; -}; - -void -MD5_Update(struct md5 *m, const void *v, size_t len) -{ - const unsigned char *p = v; - size_t old_sz = m->sz[0]; - size_t offset; - - m->sz[0] += len * 8; - if (m->sz[0] < old_sz) - ++m->sz[1]; - offset = (old_sz / 8) % 64; - while (len > 0) { - size_t l = min(len, 64 - offset); - memcpy(m->save + offset, p, l); - offset += l; - p += l; - len -= l; - if (offset == 64) { -#if defined(WORDS_BIGENDIAN) - int i; - afs_uint32 current[16]; - struct x32 *u = (struct x32 *)m->save; - for (i = 0; i < 8; i++) { - current[2 * i + 0] = swap_afs_uint32(u[i].a); - current[2 * i + 1] = swap_afs_uint32(u[i].b); - } - calc(m, current); -#else - calc(m, (afs_uint32 *) m->save); -#endif - offset = 0; - } - } -} - -void -MD5_Final(void *res, struct md5 *m) -{ - static unsigned char zeros[72]; - unsigned offset = (m->sz[0] / 8) % 64; - unsigned int dstart = (120 - offset - 1) % 64 + 1; - - *zeros = 0x80; - memset(zeros + 1, 0, sizeof(zeros) - 1); - zeros[dstart + 0] = (m->sz[0] >> 0) & 0xff; - zeros[dstart + 1] = (m->sz[0] >> 8) & 0xff; - zeros[dstart + 2] = (m->sz[0] >> 16) & 0xff; - zeros[dstart + 3] = (m->sz[0] >> 24) & 0xff; - zeros[dstart + 4] = (m->sz[1] >> 0) & 0xff; - zeros[dstart + 5] = (m->sz[1] >> 8) & 0xff; - zeros[dstart + 6] = (m->sz[1] >> 16) & 0xff; - zeros[dstart + 7] = (m->sz[1] >> 24) & 0xff; - MD5_Update(m, zeros, dstart + 8); - { - int i; - unsigned char *r = (unsigned char *)res; - - for (i = 0; i < 4; ++i) { - r[4 * i] = m->counter[i] & 0xFF; - r[4 * i + 1] = (m->counter[i] >> 8) & 0xFF; - r[4 * i + 2] = (m->counter[i] >> 16) & 0xFF; - r[4 * i + 3] = (m->counter[i] >> 24) & 0xFF; - } - } -#if 0 - { - int i; - afs_uint32 *r = (afs_uint32 *) res; - - for (i = 0; i < 4; ++i) - r[i] = swap_afs_uint32(m->counter[i]); - } -#endif -} diff --git a/src/rxkad/md5.h b/src/rxkad/md5.h deleted file mode 100644 index cfaea8464c..0000000000 --- a/src/rxkad/md5.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id$ */ - -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_BITYPES_H -#include -#endif - -struct md5 { - unsigned int sz[2]; - afs_uint32 counter[4]; - unsigned char save[64]; -}; - -typedef struct md5 MD5_CTX; - -void MD5_Init(struct md5 *m); -void MD5_Update(struct md5 *m, const void *p, size_t len); -void MD5_Final(void *res, struct md5 *m); /* afs_uint32 res[4] */ diff --git a/src/rxkad/rxkad_prototypes.h b/src/rxkad/rxkad_prototypes.h index 1bd30a1bba..71da356eec 100644 --- a/src/rxkad/rxkad_prototypes.h +++ b/src/rxkad/rxkad_prototypes.h @@ -14,10 +14,7 @@ #include "fcrypt.h" #include "rx/rx.h" -/* Don't include des.h where it can cause conflict with krb4 headers */ -#if !defined(NO_DES_H_INCLUDE) -#include -#endif +#include /* crypt_conn.c */ extern afs_int32 rxkad_DecryptPacket(const struct rx_connection *conn, @@ -161,10 +158,9 @@ extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len, afs_int32 * host, afs_uint32 * start, afs_uint32 * end, afs_int32 disableDotCheck); -#if !defined(NO_DES_H_INCLUDE) -static_inline unsigned char * +static_inline DES_cblock * ktc_to_cblock(struct ktc_encryptionKey *key) { - return (unsigned char *)key; + return (DES_cblock *)key; } static_inline char * @@ -172,11 +168,27 @@ ktc_to_charptr(struct ktc_encryptionKey *key) { return (char *)key; } -static_inline des_cblock * + +static_inline DES_cblock * ktc_to_cblockptr(struct ktc_encryptionKey *key) { - return (des_cblock *)key; + return (DES_cblock *)key; +} + +#if 0 +static_inline unsigned char * +cblockptr_to_cblock(DES_cblock *key) { + return (unsigned char *)key; } #endif +static_inline DES_cblock * +charptr_to_cblock(char *key) { + return (DES_cblock *)key; +} + +static_inline DES_cblock * +charptr_to_cblockptr(char *key) { + return (DES_cblock *)key; +} #endif diff --git a/src/rxkad/rxkad_server.c b/src/rxkad/rxkad_server.c index 6d3463656d..91c74dc63a 100644 --- a/src/rxkad/rxkad_server.c +++ b/src/rxkad/rxkad_server.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #ifdef HAVE_STDINT_H # include diff --git a/src/rxkad/test/Makefile.in b/src/rxkad/test/Makefile.in index 97ce973623..e3fdd3d30c 100644 --- a/src/rxkad/test/Makefile.in +++ b/src/rxkad/test/Makefile.in @@ -25,7 +25,7 @@ LIBS=${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/util.a diff --git a/src/rxkad/ticket.c b/src/rxkad/ticket.c index 1c5d9e5735..774a7f2d34 100644 --- a/src/rxkad/ticket.c +++ b/src/rxkad/ticket.c @@ -13,7 +13,6 @@ #include #include - #include #include #ifdef AFS_NT40_ENV @@ -22,8 +21,6 @@ #include #endif #include -#include -#include #include #include #include "lifetimes.h" @@ -35,7 +32,7 @@ * application uses both rxkad and openssl. */ union Key_schedule_safe { - Key_schedule schedule; + DES_key_schedule schedule; struct { union { char cblock[8]; @@ -117,11 +114,11 @@ tkt_DecodeTicket(char *asecret, afs_int32 ticketLen, ((ticketLen) % 8 != 0)) /* enc. part must be (0 mod 8) bytes */ return RXKADBADTICKET; - if (key_sched(ktc_to_cblock(key), schedule.schedule)) + if (DES_key_sched(ktc_to_cblock(key), &schedule.schedule)) return RXKADBADKEY; ticket = clear_ticket; - pcbc_encrypt(asecret, ticket, ticketLen, schedule.schedule, ktc_to_cblockptr(key), DECRYPT); + DES_pcbc_encrypt(asecret, ticket, ticketLen, &schedule.schedule, ktc_to_cblockptr(key), DECRYPT); code = decode_athena_ticket(ticket, ticketLen, name, inst, cell, host, @@ -215,11 +212,12 @@ tkt_MakeTicket(char *ticket, int *ticketLen, struct ktc_encryptionKey *key, return -1; /* encrypt ticket */ - if ((code = key_sched(ktc_to_cblock(key), schedule.schedule))) { + if ((code = DES_key_sched(ktc_to_cblock(key), &schedule.schedule))) { printf("In tkt_MakeTicket: key_sched returned %d\n", code); return RXKADBADKEY; } - pcbc_encrypt(ticket, ticket, *ticketLen, schedule.schedule, ktc_to_cblockptr(key), ENCRYPT); + DES_pcbc_encrypt(ticket, ticket, *ticketLen, &schedule.schedule, + ktc_to_cblockptr(key), ENCRYPT); return 0; } diff --git a/src/rxkad/ticket5.c b/src/rxkad/ticket5.c index aee11f1def..f7bf5ddeb6 100644 --- a/src/rxkad/ticket5.c +++ b/src/rxkad/ticket5.c @@ -73,6 +73,8 @@ #include #include #include +#include +#include #include "lifetimes.h" #include "rxkad.h" @@ -81,8 +83,6 @@ #include "der.h" #include "v5der.c" #include "v5gen.c" -#include "md4.h" -#include "md5.h" /* * Principal conversion Taken from src/lib/krb5/krb/conv_princ from MIT Kerberos. If you @@ -90,12 +90,6 @@ * bug with MIT by sending mail to krb5-bugs@mit.edu. */ -extern afs_int32 des_cbc_encrypt(void * in, void * out, - afs_int32 length, - des_key_schedule key, des_cblock *iv, - int encrypt); -extern int des_key_sched(des_cblock k, des_key_schedule schedule); - struct krb_convert { char *v4_str; char *v5_str; @@ -432,15 +426,15 @@ krb5_des_decrypt(struct ktc_encryptionKey *key, int etype, void *in, { int (*cksum_func) (void *, size_t, void *, size_t, struct ktc_encryptionKey *); - des_cblock ivec; - des_key_schedule s; + DES_cblock ivec; + DES_key_schedule s; char cksum[24]; size_t cksumsz; int ret = 1; /* failure */ cksum_func = NULL; - des_key_sched(ktc_to_cblock(key), (struct des_ks_struct *)&s); + DES_key_sched(ktc_to_cblock(key), &s); #define CONFOUNDERSZ 8 @@ -464,7 +458,7 @@ krb5_des_decrypt(struct ktc_encryptionKey *key, int etype, void *in, abort(); } - des_cbc_encrypt(in, out, insz, s, &ivec, 0); + DES_cbc_encrypt(in, out, insz, &s, &ivec, 0); memcpy(cksum, (char *)out + CONFOUNDERSZ, cksumsz); memset((char *)out + CONFOUNDERSZ, 0, cksumsz); diff --git a/src/scout/Makefile.in b/src/scout/Makefile.in index 6a3d7a108f..c5955f91b9 100644 --- a/src/scout/Makefile.in +++ b/src/scout/Makefile.in @@ -34,9 +34,9 @@ LIBS=${TOP_LIBDIR}/libgtx.a \ ${TOP_LIBDIR}/libkauth.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcmd.a \ - ${TOP_LIBDIR}/vlib.a ${TOP_LIBDIR}/libacl.a \ + ${TOP_LIBDIR}/vlib.a \ + ${TOP_LIBDIR}/libacl.a \ ${TOP_LIBDIR}/libvldb.a \ ${TOP_LIBDIR}/libafsint.a \ ${TOP_LIBDIR}/libsys.a \ @@ -45,6 +45,7 @@ LIBS=${TOP_LIBDIR}/libgtx.a \ ${TOP_LIBDIR}/libaudit.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a all: scout diff --git a/src/sgistuff/Makefile.in b/src/sgistuff/Makefile.in index 09a03d1e3b..d5fd951226 100644 --- a/src/sgistuff/Makefile.in +++ b/src/sgistuff/Makefile.in @@ -22,14 +22,32 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ # machine then that will be used .. # LIBDIR=${TOP_LIBDIR}/ -AFSLIBS=${TOP_LIBDIR}/libkauth.a ${TOP_LIBDIR}/libprot.a ${LIBDIR}/libubik.a \ - ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a ${LIBDIR}/librx.a ${LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a -KAFSLIBS=${TOP_LIBDIR}/libkauth.krb.a ${TOP_LIBDIR}/libprot.a ${LIBDIR}/libubik.a \ - ${TOP_LIBDIR}/libauth.krb.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a ${LIBDIR}/librx.a ${LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a +AFSLIBS=${TOP_LIBDIR}/libkauth.a \ + ${TOP_LIBDIR}/libprot.a \ + ${LIBDIR}/libubik.a \ + ${TOP_LIBDIR}/libauth.a \ + ${TOP_LIBDIR}/librxkad.a \ + ${TOP_LIBDIR}/libsys.a \ + ${LIBDIR}/librx.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ + ${LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/util.a + +KAFSLIBS=${TOP_LIBDIR}/libkauth.krb.a \ + ${TOP_LIBDIR}/libprot.a \ + ${LIBDIR}/libubik.a \ + ${TOP_LIBDIR}/libauth.krb.a \ + ${TOP_LIBDIR}/librxkad.a \ + ${TOP_LIBDIR}/libsys.a \ + ${LIBDIR}/librx.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ + ${LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/util.a + AUTHFILES=ta-rauth.o rcmd.o herror.o AUTHLIBS=afsauthlib.so afskauthlib.so TARGETS=$(AUTHLIBS) diff --git a/src/shlibafsauthent/Makefile.in b/src/shlibafsauthent/Makefile.in index 3edd7c8ca2..2b07380752 100644 --- a/src/shlibafsauthent/Makefile.in +++ b/src/shlibafsauthent/Makefile.in @@ -55,8 +55,7 @@ KAUTHOBJS = \ kautils.o \ kalocalcell.o \ kaerrors.o \ - user.o \ - read_passwd.o + user.o UBIKOBJS = \ uinit.o \ @@ -133,9 +132,9 @@ dest: ${LIBAFSAUTHENT} libafsauthent_pic.a ${LIBAFSAUTHENT}: ${LIBOBJS} libafsauthent.map ../config/shlib-build -d $(srcdir) -l libafsauthent \ -M ${LIBAFSAUTHENTMAJOR} -m ${LIBAFSAUTHENTMINOR} -- \ - -L${TOP_LIBDIR} $(LDFLAGS_roken) \ + -L${TOP_LIBDIR} $(LDFLAGS_roken) $(LDFLAGS_hcrypto) \ $(LIBOBJS) \ - -lafsrpc $(LIB_roken) $(LIB_crypt) $(LIB_AFSDB) \ + -lafsrpc $(LIB_hcrypto) $(LIB_roken) $(LIB_crypt) $(LIB_AFSDB) \ ${MT_LIBS} libafsauthent_pic.a: ${LIBOBJS} diff --git a/src/shlibafsrpc/Makefile.in b/src/shlibafsrpc/Makefile.in index 5f67a1d01e..619ef4a6c7 100644 --- a/src/shlibafsrpc/Makefile.in +++ b/src/shlibafsrpc/Makefile.in @@ -31,7 +31,6 @@ RX = $(srcdir)/../rx RXKAD = $(srcdir)/../rxkad RXSTAT = $(srcdir)/../rxstat FSINT = $(srcdir)/../fsint -DES = $(srcdir)/../des COMERR = $(srcdir)/../comerr UTIL = $(srcdir)/../util SYS = ${srcdir}/../sys @@ -102,40 +101,19 @@ RXKADOBJS =\ ticket.o \ ticket5.o \ crc.o \ - md4.o \ - md5.o \ fcrypt.o \ crypt_conn.o -DESOBJS =\ - des.o \ - cbc_encrypt.o \ - pcbc_encrypt.o \ - cksum.o \ - new_rnd_key.o \ - key_sched.o \ - debug_decl.o \ - quad_cksum.o \ - key_parity.o \ - weak_key.o \ - strng_to_key.o \ - misc.o \ - util.o - -CRYPT_OBJ = crypt.o - LWPOBJS = \ fasttime.o LIBOBJS = \ ${RXOBJS} \ - ${DESOBJS} \ ${XDROBJS} \ ${RXKADOBJS} \ ${COMERROBJS} \ ${UTILOBJS} \ ${SYSOBJS} \ - ${CRYPT_OBJ} \ ${RXSTATOBJS} \ ${LWPOBJS} \ ${FSINTOBJS} @@ -164,7 +142,8 @@ dest: ${LIBAFSRPC} libafsrpc_pic.a ${LIBAFSRPC}: ${LIBOBJS} libafsrpc.map ../config/shlib-build -d $(srcdir) -l libafsrpc \ -M ${LIBAFSRPCMAJOR} -m ${LIBAFSRPCMINOR} -- \ - $(LDFLAGS_roken) ${LIBOBJS} ${MT_LIBS} $(LIB_roken) + $(LDFLAGS_roken) $(LDFLAGS_hcrypto) \ + ${LIBOBJS} $(LIB_hcrypto) $(LIB_roken) $(MT_LIBS) libafsrpc_pic.a: ${LIBOBJS} $(RM) -f $@ @@ -238,12 +217,6 @@ ticket5.o: ${RXKAD}/ticket5.c crc.o: ${RXKAD}/crc.c $(AFS_CCRULE) -I../rxkad $(RXKAD)/crc.c -md4.o: ${RXKAD}/md4.c - $(AFS_CCRULE) -I../rxkad $(RXKAD)/md4.c - -md5.o: ${RXKAD}/md5.c - $(AFS_CCRULE) -I../rxkad $(RXKAD)/md5.c - fcrypt.o: ${RXKAD}/fcrypt.c $(AFS_CCRULE) -I../rxkad $(RXKAD)/fcrypt.c @@ -292,84 +265,6 @@ xdr_update.o: ${RX}/xdr_update.c xdr_afsuuid.o: ${RX}/xdr_afsuuid.c $(AFS_CCRULE) $(RX)/xdr_afsuuid.c -# Note that the special case statement for compiling des.c is present -# simply to work around a compiler bug on HP-UX 11.0. The symptom of -# the problem is that linking the pthread fileserver fails with messages -# such as -# -# pxdb internal warning: cu[84]: SLT_SRCFILE[411] out of synch -# Please contact your HP Support representative -# pxdb internal warning: cu[84]: SLT_SRCFILE[442] out of synch -# pxdb internal warning: cu[84]: SLT_SRCFILE[450] out of synch -# pxdb internal warning: cu[84]: SLT_SRCFILE[529] out of synch -# pxdb internal warning: cu[84]: SLT_SRCFILE[544] out of synch -# ... -# pxdb32: internal error. File won't be debuggable (still a valid executable) -# *** Error exit code 10 -# -# The problematic version of pxdb is: -# -# $ what /opt/langtools/bin/pxdb32 -# /opt/langtools/bin/pxdb32: -# HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision$ -# -# The problem occurs when -g and -O are both used when compiling des.c. -# The simplest way to work around the problem is to leave out either -g or -O. -# Since des.c is relatively stable I've chosen to eliminate -g rather -# than take any hit in performance. - -des.o: ${DES}/des.c - set -x; \ - case ${SYS_NAME} in \ - hp_ux11*) \ - set X `echo ${AFS_CCRULE} ${DES}/des.c | sed s/-g//`; shift; \ - "$$@" -I../des \ - ;; \ - *) \ - ${AFS_CCRULE} -I../des ${DES}/des.c \ - ;; \ - esac - - -crypt.o: ${DES}/crypt.c - $(AFS_CCRULE) $(DES)/crypt.c - -cbc_encrypt.o: ${DES}/cbc_encrypt.c - $(AFS_CCRULE) $(DES)/cbc_encrypt.c - -pcbc_encrypt.o: ${DES}/pcbc_encrypt.c - $(AFS_CCRULE) $(DES)/pcbc_encrypt.c - -cksum.o: ${DES}/cksum.c - $(AFS_CCRULE) $(DES)/cksum.c - -new_rnd_key.o: ${DES}/new_rnd_key.c - $(AFS_CCRULE) $(DES)/new_rnd_key.c - -key_sched.o: ${DES}/key_sched.c - $(AFS_CCRULE) -I../des $(DES)/key_sched.c - -debug_decl.o: ${DES}/debug_decl.c - $(AFS_CCRULE) $(DES)/debug_decl.c - -quad_cksum.o: ${DES}/quad_cksum.c - $(AFS_CCRULE) $(DES)/quad_cksum.c - -key_parity.o: ${DES}/key_parity.c - $(AFS_CCRULE) -I../des $(DES)/key_parity.c - -weak_key.o: ${DES}/weak_key.c - $(AFS_CCRULE) $(DES)/weak_key.c - -strng_to_key.o: ${DES}/strng_to_key.c - $(AFS_CCRULE) $(DES)/strng_to_key.c - -misc.o: ${DES}/misc.c - $(AFS_CCRULE) $(DES)/misc.c - -util.o: ${DES}/util.c - $(AFS_CCRULE) $(DES)/util.c - error_msg.o: ${COMERR}/error_msg.c $(AFS_CCRULE) $(COMERR)/error_msg.c diff --git a/src/shlibafsrpc/libafsrpc.map b/src/shlibafsrpc/libafsrpc.map index 0a3d9fe1c6..ac4af97f93 100755 --- a/src/shlibafsrpc/libafsrpc.map +++ b/src/shlibafsrpc/libafsrpc.map @@ -7,16 +7,6 @@ { global: - des_check_key_parity; - des_fixup_key_parity; - des_init_random_number_generator; - des_is_weak_key; - des_key_sched; - des_random_key; - des_string_to_key; - des_cbc_cksum; - des_ecb_encrypt; - des_pcbc_encrypt; ktohl; life_to_time; osi_AssertFailU; diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index 958d5f7a14..ec1aefd9df 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -17,7 +17,13 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ SFLAGS=-I${TOP_INCDIR} -LIBS=libsys.a ${TOP_LIBDIR}/librx.a libsys.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a ${XLIBS} +LIBS=libsys.a \ + ${TOP_LIBDIR}/librx.a \ + libsys.a \ + ${TOP_LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/util.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ + ${XLIBS} OBJECTS= afssyscalls.o setpag.o pioctl.o glue.o \ AFS_component_version_number.o @@ -158,9 +164,9 @@ CFLAGS_pagsh.krb.o = -DAFS_KERBEROS_ENV pagsh.krb.o: pagsh.c $(AFS_CCRULE) $(srcdir)/pagsh.c -pagsh.krb: libsys.a pagsh.krb.o ${TOP_LIBDIR}/libauth.krb.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libdes.a +pagsh.krb: libsys.a pagsh.krb.o ${TOP_LIBDIR}/libauth.krb.a ${TOP_LIBDIR}/librxkad.a $(AFS_LDRULE) pagsh.krb.o ${TOP_LIBDIR}/libauth.krb.a \ - ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libdes.a ${LIBS} $(LIB_roken) + ${TOP_LIBDIR}/librxkad.a ${LIBS} $(LIB_roken) # # Test programs. diff --git a/src/tbudb/Makefile.in b/src/tbudb/Makefile.in index cc1ea811dd..003f3789fe 100644 --- a/src/tbudb/Makefile.in +++ b/src/tbudb/Makefile.in @@ -30,7 +30,6 @@ INCLS=\ ${TOP_INCDIR}/lock.h \ ${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/lwp.h \ - ${TOP_INCDIR}/des.h \ ${TOP_INCDIR}/rx/rx.h \ ${TOP_INCDIR}/rx/xdr.h \ ${TOP_INCDIR}/rx/rxkad.h \ @@ -153,7 +152,8 @@ server.o: ${BUDB}/server.c budb_errs.h ${INCLS} $(AFS_CCRULE) $(BUDB)/server.c budb_server: $(SERVER_OBJS) ${LIBS} - $(AFS_LDRULE) $(SERVER_OBJS) ${LIBS} ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) $(SERVER_OBJS) ${LIBS} \ + $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} budb.cs.c: ${BUDB}/budb.rg ${RXGEN} -u -C -o $@ ${srcdir}/${BUDB}/budb.rg diff --git a/src/tbutc/Makefile.in b/src/tbutc/Makefile.in index 5c5db2bb27..94fff9329c 100644 --- a/src/tbutc/Makefile.in +++ b/src/tbutc/Makefile.in @@ -72,7 +72,7 @@ all: butc butc: ${BUTCOBJS} ${BUTCLIBS} $(AFS_LDRULE) ${BUTCOBJS} ${BUTCLIBS} \ - $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} libbutm.a: ${BUTMOBJS} AFS_component_version_number.o -$(RM) -f libbutm.a diff --git a/src/tbutc/NTMakefile b/src/tbutc/NTMakefile index 560eff22e1..5f71aac471 100644 --- a/src/tbutc/NTMakefile +++ b/src/tbutc/NTMakefile @@ -83,8 +83,8 @@ BUTCLIBS=$(DESTDIR)\lib\afs\afsbudb.lib \ !ELSE $(DESTDIR)\lib\afspthread.lib \ !ENDIF - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\libafsconf.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib diff --git a/src/tptserver/Makefile.in b/src/tptserver/Makefile.in index 623315c3ea..0871a6558d 100644 --- a/src/tptserver/Makefile.in +++ b/src/tptserver/Makefile.in @@ -150,7 +150,8 @@ display.o: ${PTSERVER}/display.c ${INCLS} ptserver: ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o $(LIBS) ${TOP_LIBDIR}/libaudit.a map.o $(AFS_LDRULE) ptserver.o ptutils.o ptprocs.o \ - ptint.ss.o ptint.xdr.o utils.o map.o $(LIBS) ${MT_LIBS} \ + ptint.ss.o ptint.xdr.o utils.o map.o \ + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} \ ${XLIBS} ${TOP_LIBDIR}/libaudit.a db_verify.o: ${PTSERVER}/db_verify.c ${INCLS} @@ -158,12 +159,12 @@ db_verify.o: ${PTSERVER}/db_verify.c ${INCLS} db_verify: db_verify.o pterror.o display.o $(LIBS) $(AFS_LDRULE) db_verify.o display.o pterror.o \ - $(LIBS) ${MT_LIBS} ${XLIBS} + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} ptclient: ptclient.o display.o ptuser.o pterror.o ptint.cs.o ptint.xdr.o \ AFS_component_version_number.o $(LIBS) $(AFS_LDRULE) ptclient.o display.o $(PTOBJS) \ - $(LIBS) ${MT_LIBS} ${XLIBS} + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} ptclient.o: ${PTSERVER}/ptclient.c ${INCLS} $(AFS_CCRULE) $(PTSERVER)/ptclient.c @@ -176,34 +177,37 @@ pterror.h pterror.c: ${PTSERVER}/pterror.et ${COMPILE_ET} -p ${srcdir}/${PTSERVER} pterror pts: pts.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS) ${INCLS} - $(AFS_LDRULE) pts.o ${TOP_LIBDIR}/libcmd.a \ - $(PTOBJS) ${LIBS} ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) pts.o ${TOP_LIBDIR}/libcmd.a $(PTOBJS) \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} pts.o: ${PTSERVER}/pts.c $(AFS_CCRULE) $(PTSERVER)/pts.c readgroup: readgroup.o $(PTOBJS) $(LIBS) - $(AFS_LDRULE) readgroup.o $(PTOBJS) ${LIBS} ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) readgroup.o $(PTOBJS) \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} readgroup.o: ${PTSERVER}/readgroup.c ${INCLS} $(AFS_CCRULE) $(PTSERVER)/readgroup.c readpwd: readpwd.o $(PTOBJS) $(LIBS) - $(AFS_LDRULE) readpwd.o $(PTOBJS) ${LIBS} ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) readpwd.o $(PTOBJS) \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} readpwd.o: ${PTSERVER}/readpwd.c ${INCLS} $(AFS_CCRULE) $(PTSERVER)/readpwd.c testpt: testpt.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS) - $(AFS_LDRULE) testpt.o -lm ${TOP_LIBDIR}/libcmd.a \ - $(PTOBJS) $(LIBS) ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) testpt.o -lm ${TOP_LIBDIR}/libcmd.a $(PTOBJS) \ + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} testpt.o: ${PTSERVER}/testpt.c ${INCLS} $(AFS_CCRULE) $(PTSERVER)/testpt.c pt_util: pt_util.o ptutils.o ubik.o utils.o map.o $(PTOBJS) $(LIBS) $(AFS_LDRULE) pt_util.o ptutils.o ubik.o utils.o map.o $(PTOBJS) \ - ${TOP_LIBDIR}/libcmd.a $(LIBS) ${MT_LIBS} ${XLIBS} + ${TOP_LIBDIR}/libcmd.a \ + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} pt_util.o: ${PTSERVER}/pt_util.c $(AFS_CCRULE) $(PTSERVER)/pt_util.c diff --git a/src/tsalvaged/Makefile.in b/src/tsalvaged/Makefile.in index d145231c12..c1f6f36204 100644 --- a/src/tsalvaged/Makefile.in +++ b/src/tsalvaged/Makefile.in @@ -50,14 +50,18 @@ FSSDEBUG_OBJS = fssync-debug.o physio.o common.o ${UTILOBJS} ${VLIBOBJS} ${DIROB SSSDEBUG_OBJS = salvsync-debug.o physio.o common.o ${UTILOBJS} ${VLIBOBJS} ${DIROBJS} ${LWPOBJS} -LIBS=${TOP_LIBDIR}/libafsauthent.a \ +LIBS= ${TOP_LIBDIR}/libafsauthent.a \ ${TOP_LIBDIR}/libafsrpc.a \ ${TOP_LIBDIR}/util.a \ ${TOP_LIBDIR}/libcmd.a -SLIBS=${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libdir.a \ - ${TOP_LIBDIR}/libvlib.a ${TOP_LIBDIR}/librx.a \ - ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libacl.a \ +SLIBS= ${TOP_LIBDIR}/libcmd.a \ + ${TOP_LIBDIR}/libdir.a \ + ${TOP_LIBDIR}/libvlib.a \ + ${TOP_LIBDIR}/librx.a \ + ${TOP_LIBDIR}/liblwp.a \ + ${TOP_LIBDIR}/libsys.a \ + ${TOP_LIBDIR}/libacl.a \ ${TOP_LIBDIR}/util.a all: salvageserver dafssync-debug salvsync-debug dasalvager @@ -177,7 +181,7 @@ namei_ops.o: ${VOL}/namei_ops.c salvageserver: ${OBJECTS} ${LIBS} $(AFS_LDRULE) ${OBJECTS} ${LIBS} \ - $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(LIB_roken) $(LIB_hcrypto) $(LIB_crypt) ${MT_LIBS} ${XLIBS} dasalvager: ${SOBJECTS} ${SLIBS} $(AFS_LDRULE) ${SOBJECTS} ${SLIBS} \ @@ -185,11 +189,11 @@ dasalvager: ${SOBJECTS} ${SLIBS} dafssync-debug: ${FSSDEBUG_OBJS} ${LIBS} $(AFS_LDRULE) ${FSSDEBUG_OBJS} ${LIBS} \ - $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(LIB_roken) $(LIB_hcrypto) $(LIB_crypt) ${MT_LIBS} ${XLIBS} salvsync-debug: ${SSSDEBUG_OBJS} ${LIBS} $(AFS_LDRULE) ${SSSDEBUG_OBJS} ${LIBS} \ - $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(LIB_roken) $(LIB_hcrypto) $(LIB_crypt) ${MT_LIBS} ${XLIBS} install: salvageserver dafssync-debug salvsync-debug dasalvager ${INSTALL} -d ${DESTDIR}${afssrvlibexecdir} diff --git a/src/tsm41/Makefile.in b/src/tsm41/Makefile.in index 7b157c6f77..45dd6e48cf 100644 --- a/src/tsm41/Makefile.in +++ b/src/tsm41/Makefile.in @@ -22,7 +22,7 @@ AFSLIBS = \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcmd.a \ @@ -37,7 +37,7 @@ KAFSLIBS = \ ${TOP_LIBDIR}/libauth.krb.a \ ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcmd.a \ diff --git a/src/tubik/Makefile.in b/src/tubik/Makefile.in index d5f6996d20..e98f24244d 100644 --- a/src/tubik/Makefile.in +++ b/src/tubik/Makefile.in @@ -100,14 +100,15 @@ pthread_glock.o: ${UTIL}/pthread_glock.c utst_server: utst_server.o utst_int.ss.o utst_int.xdr.o libubik_pthread.a ${RXOBJS} ${UTILOBJS} $(AFS_LDRULE) utst_server.o utst_int.ss.o utst_int.xdr.o \ - libubik_pthread.a $(LIBS) + libubik_pthread.a $(LIBS) $(LIB_hcrypto) $(LIB_roken) utst_client: utst_client.o utst_int.cs.o utst_int.xdr.o libubik_pthread.a ${RXOBJS} ${UTILOBJS} $(AFS_LDRULE) utst_client.o utst_int.cs.o utst_int.xdr.o \ - libubik_pthread.a $(LIBS) + libubik_pthread.a $(LIBS) $(LIB_hcrypto) $(LIB_roken) udebug: udebug.o libubik_pthread.a ${RXOBJS} ${UTILOBJS} - $(AFS_LDRULE) udebug.o libubik_pthread.a $(LIBS) + $(AFS_LDRULE) udebug.o libubik_pthread.a \ + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ubik_int.cs.c: ${UBIK}/ubik_int.xg ${RXGEN} -A -x -C -o $@ ${UBIK}/ubik_int.xg diff --git a/src/tviced/Makefile.in b/src/tviced/Makefile.in index 1067f31dfa..1b07f8fc94 100644 --- a/src/tviced/Makefile.in +++ b/src/tviced/Makefile.in @@ -52,7 +52,9 @@ RXOBJS = rx_pthread.o objects= ${VICEDOBJS} ${VLSERVEROBJS} ${LWPOBJS} ${LIBACLOBJS} \ ${UTILOBJS} ${DIROBJS} ${VOLOBJS} ${FSINTOBJS} ${RXOBJS} -LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/util.a +LIBS=${TOP_LIBDIR}/libafsauthent.a \ + ${TOP_LIBDIR}/libafsrpc.a \ + ${TOP_LIBDIR}/util.a all: fileserver @@ -206,7 +208,8 @@ afsint.xdr.o: ../fsint/afsint.xdr.c $(AFS_CCRULE) ../fsint/afsint.xdr.c fileserver: ${objects} ${LIBS} - $(AFS_LDRULE) ${objects} ${LIBS} $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) ${objects} \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} install: fileserver ${INSTALL} -d ${DESTDIR}${afssrvlibexecdir} diff --git a/src/tvlserver/Makefile.in b/src/tvlserver/Makefile.in index e7f5f24344..362cd38d96 100644 --- a/src/tvlserver/Makefile.in +++ b/src/tvlserver/Makefile.in @@ -108,26 +108,29 @@ get_krbrlm.o: ${UTIL}/get_krbrlm.c vldb_check: vldb_check.o ${LIBS} AFS_component_version_number.o $(AFS_LDRULE) vldb_check.o AFS_component_version_number.o \ - ${LIBS} ${MT_LIBS} ${XLIBS} + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} vldb_check.o: ${VLSERVER}/vldb_check.c $(AFS_CCRULE) $(VLSERVER)/vldb_check.c cnvldb: cnvldb.o ${LIBS} - $(AFS_LDRULE) cnvldb.o ${LIBS} ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) cnvldb.o \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} cnvldb.o: ${VLSERVER}/cnvldb.c $(AFS_CCRULE) $(VLSERVER)/cnvldb.c sascnvldb: sascnvldb.o ${LIBS} - $(AFS_LDRULE) sascnvldb.o ${LIBS} ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) sascnvldb.o \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} sascnvldb.o: ${VLSERVER}/sascnvldb.c $(AFS_CCRULE) $(VLSERVER)/sascnvldb.c vlserver: vlserver.o vlutils.o vlprocs.o vldbint.ss.o vldbint.xdr.o $(LIBS) $(AFS_LDRULE) vlserver.o vlutils.o vlprocs.o vldbint.ss.o \ - vldbint.xdr.o $(LIBS) ${MT_LIBS} ${XLIBS} \ + vldbint.xdr.o \ + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} \ ${TOP_LIBDIR}/libaudit.a vlserver.o: ${VLSERVER}/vlserver.c ${INCLS} AFS_component_version_number.o @@ -166,9 +169,9 @@ Kvldbint.xdr.c: ${VLSERVER}/vldbint.xg ${RXGEN} -A -x -k -c -o $@ ${srcdir}/${VLSERVER}/vldbint.xg vlclient: vlclient.o $(OBJS) $(LIBS) ${INCLS} - $(AFS_LDRULE) vlclient.o $(OBJS) $(LIBS) ${MT_LIBS} ${XLIBS} \ - ${TOP_LIBDIR}/libcmd.a - + $(AFS_LDRULE) vlclient.o $(OBJS) ${TOP_LIBDIR}/libcmd.a \ + $(LIBS) $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} + vlclient.o: ${VLSERVER}/vlclient.c $(AFS_CCRULE) $(VLSERVER)/vlclient.c diff --git a/src/tvolser/Makefile.in b/src/tvolser/Makefile.in index bf5fecfb43..4cb1d03682 100644 --- a/src/tvolser/Makefile.in +++ b/src/tvolser/Makefile.in @@ -217,10 +217,11 @@ vos.o: ${VOLSER}/vos.c vos: vos.o ${VOSOBJS} ${VLSERVEROBJS} ${LIBS} ${TOP_LIBDIR}/libubik_pthread.a $(AFS_LDRULE) vos.o ${VOSOBJS} ${VLSERVEROBJS} ${LIBS} \ ${TOP_LIBDIR}/libubik_pthread.a \ - $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} volserver: ${objects} ${LIBS} - $(AFS_LDRULE) ${objects} ${LIBS} $(LIB_roken) ${MT_LIBS} ${XLIBS} + $(AFS_LDRULE) ${objects} \ + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} install: volserver ${INSTALL} -d ${DESTDIR}${afssrvlibexecdir} diff --git a/src/tvolser/NTMakefile b/src/tvolser/NTMakefile index 28f0b53635..cd9906e32f 100644 --- a/src/tvolser/NTMakefile +++ b/src/tvolser/NTMakefile @@ -94,6 +94,7 @@ VOLSERVER_EXELIBS = \ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\afs\mtafsutil.lib \ $(DESTDIR)\lib\afspthread.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(VOLSERVER_EXEFILE): $(VOLSERVER_EXEOBJS) $(VOLSERVER_EXELIBS) diff --git a/src/update/Makefile.in b/src/update/Makefile.in index 75d746d2e4..eb2cd94b70 100644 --- a/src/update/Makefile.in +++ b/src/update/Makefile.in @@ -16,12 +16,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LIBS=${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a all: upserver upclient diff --git a/src/update/NTMakefile b/src/update/NTMakefile index 9cd5b625a8..a1529ed772 100644 --- a/src/update/NTMakefile +++ b/src/update/NTMakefile @@ -16,7 +16,6 @@ LIBS = \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\afslwp.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afs\afseventlog.lib \ @@ -24,6 +23,7 @@ LIBS = \ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib ############################################################################ diff --git a/src/uss/Makefile.in b/src/uss/Makefile.in index 44ffaa4c2c..f21253187d 100644 --- a/src/uss/Makefile.in +++ b/src/uss/Makefile.in @@ -27,13 +27,13 @@ LIBS=${TOP_LIBDIR}/libvolser.a \ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/librxkad.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libcmd.a \ - ${TOP_LIBDIR}/libcom_err.a\ - ${TOP_LIBDIR}/util.a + ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/util.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a OBJS = uss_procs.o \ uss_common.o \ @@ -45,8 +45,8 @@ OBJS = uss_procs.o \ lex.yy.o \ y.tab.o -uss: uss.o ${OBJS} - $(AFS_LDRULE) uss.o ${OBJS} ${LIBS} $(LIB_roken) $(XLIBS) +uss: uss.o ${OBJS} $(LIBS) + $(AFS_LDRULE) uss.o ${OBJS} ${LIBS} $(LIB_roken) $(LIB_crypt) $(XLIBS) uss.o: uss.c AFS_component_version_number.c diff --git a/src/venus/Makefile.in b/src/venus/Makefile.in index d1acc8e0a9..dc05814bb8 100644 --- a/src/venus/Makefile.in +++ b/src/venus/Makefile.in @@ -27,11 +27,11 @@ FSLIBS=${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libkauth.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ ${TOP_LIBDIR}/liblwp.a \ ${TOP_LIBDIR}/libaudit.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ $(TOP_LIBDIR)/libafsutil.a CMLIBS=${TOP_LIBDIR}/libsys.a \ diff --git a/src/venus/afsio.c b/src/venus/afsio.c index 22ff32df64..f0690c60a0 100644 --- a/src/venus/afsio.c +++ b/src/venus/afsio.c @@ -101,9 +101,9 @@ #endif #include #include -#include #include -#include "../rxkad/md5.h" +#include + #ifdef O_LARGEFILE #define afs_stat stat64 #define afs_fstat fstat64 diff --git a/src/venus/test/Makefile.in b/src/venus/test/Makefile.in index 9856511d6c..ce3f151860 100644 --- a/src/venus/test/Makefile.in +++ b/src/venus/test/Makefile.in @@ -17,7 +17,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INCDIRS= -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -I.. LDIRS= -L${TOP_LIBDIR} -L.. -LIBS= -lsys -lubik -lvldb -lauth -lrxkad -ldes -lcom_err -lcmd -lrx -llwp -lafsutil +LIBS= -lsys -lubik -lvldb -lauth -lrxkad -lafshcrypto_lwp \ + -lcom_err -lcmd -lrx -llwp -lafsutil all test: fulltest owntest idtest getinitparams diff --git a/src/viced/Makefile.in b/src/viced/Makefile.in index 1020ede783..2172704731 100644 --- a/src/viced/Makefile.in +++ b/src/viced/Makefile.in @@ -32,10 +32,10 @@ LIBS=${TOP_LIBDIR}/libacl.a \ ${TOP_LIBDIR}/librxstat.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libafsutil.a + ${TOP_LIBDIR}/libafsutil.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ headers=${TOP_INCDIR}/lwp.h \ ${TOP_INCDIR}/afs/acl.h \ diff --git a/src/viced/NTMakefile b/src/viced/NTMakefile index 7664159f8e..78f16a47ae 100644 --- a/src/viced/NTMakefile +++ b/src/viced/NTMakefile @@ -51,7 +51,6 @@ EXELIBS = \ $(DESTDIR)\lib/afs/afscom_err.lib \ $(DESTDIR)\lib\afsubik.lib \ $(DESTDIR)\lib\afsrxkad.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afs\afsint.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ @@ -60,6 +59,7 @@ EXELIBS = \ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(EXEFILE): $(EXEOBJS) $(EXERES) $(EXELIBS) diff --git a/src/vlserver/Makefile.in b/src/vlserver/Makefile.in index 5628243a70..bd47feca7d 100644 --- a/src/vlserver/Makefile.in +++ b/src/vlserver/Makefile.in @@ -31,11 +31,11 @@ LIBS=\ ${TOP_LIBDIR}/librxstat.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/libsys.a \ - ${TOP_LIBDIR}/libafsutil.a + ${TOP_LIBDIR}/libafsutil.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a OBJS=vldbint.xdr.o vldbint.cs.o vl_errors.o diff --git a/src/vlserver/NTMakefile b/src/vlserver/NTMakefile index f3d92fba7c..70e7687d4e 100644 --- a/src/vlserver/NTMakefile +++ b/src/vlserver/NTMakefile @@ -81,7 +81,6 @@ VLSERVER_EXECLIBS = \ $(DESTDIR)\lib\afsrxstat.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afs\afscom_err.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afsaudit.lib \ @@ -90,6 +89,7 @@ VLSERVER_EXECLIBS = \ $(DESTDIR)\lib\afs\afsprocmgmt.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS) diff --git a/src/volser/Makefile.in b/src/volser/Makefile.in index f4b8124dd6..a52501acfe 100644 --- a/src/volser/Makefile.in +++ b/src/volser/Makefile.in @@ -36,7 +36,6 @@ LIBS=\ ${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/libcmd.a \ ${TOP_LIBDIR}/librxkad.a \ - ${TOP_LIBDIR}/libdes.a \ ${TOP_LIBDIR}/librxstat.a \ ${TOP_LIBDIR}/librx.a \ ${TOP_LIBDIR}/liblwp.a \ @@ -44,6 +43,7 @@ LIBS=\ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/libkauth.a \ ${TOP_LIBDIR}/libusd.a \ + ${TOP_LIBDIR}/libafshcrypto_lwp.a \ ${TOP_LIBDIR}/util.a VOLDUMP_LIBS = \ diff --git a/src/volser/NTMakefile b/src/volser/NTMakefile index d1b613b73b..7c42e0807a 100644 --- a/src/volser/NTMakefile +++ b/src/volser/NTMakefile @@ -66,7 +66,6 @@ EXEC_LIBS = \ $(DESTDIR)\lib\afs\afsusd.lib \ $(DESTDIR)\lib\afsrxkad.lib \ $(DESTDIR)\lib\afsrxstat.lib \ - $(DESTDIR)\lib\afsdes.lib \ $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\afs\afsacl.lib \ @@ -74,6 +73,7 @@ EXEC_LIBS = \ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afspioctl.lib \ + $(DESTDIR)\lib\afshcrypto.lib \ $(DESTDIR)\lib\afsroken.lib