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
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
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
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
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
# 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*) \
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} ;; \
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} ;; \
-${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}
-${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}
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 \
$(NTMAKE)
$(CD) ..\..
-des: rxgen
- @echo ***** $@
- $(DOCD) $(SRC)\des
- $(CD) $(SRC)\des
- $(NTMAKE)
- $(CD) ..\..
-
hcrypto: roken
@echo ***** $@
$(DOCD) $(SRC)\crypto\hcrypto
$(NTMAKE)
$(CD) ..\..\..
-roken: des
+roken: rxgen
@echo ***** $@
$(DOCD) $(SRC)\roken
$(CD) $(SRC)\roken
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 \
LIBJAFS_LIBS =\
${TOP_LIBDIR}/libjuafs.a \
${TOP_LIBDIR}/libafsutil.a \
- ${TOP_LIBDIR}/libdes.a \
-lresolv \
-lpthread
$(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 = \
$(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
$(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$@ $**
#define KRB_DEFS
/* Need some defs from des.h */
-#include <des.h>
+#include <hcrypto/des.h>
/* General definitions */
#define KSUCCESS 0
$(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
$(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 \
<Directory Id="dirInclude" Name="Include">
<Component Id="cmp_SDK_Include" Guid="2229E5F7-1D23-4088-AF85-917CCDB2634D">
<File Id="filebasic_H" Name="basic.h" LongName="basic.h" DiskId="1" src="$(var.IncDir)basic.h" />
- <File Id="filecrypt_H" Name="crypt.h" LongName="crypt.h" DiskId="1" src="$(var.IncDir)crypt.h" />
<File Id="filedbrpc_H" Name="dbrpc.h" LongName="dbrpc.h" DiskId="1" src="$(var.IncDir)dbrpc.h" />
- <File Id="filedes_H" Name="des.h" LongName="des.h" DiskId="1" src="$(var.IncDir)des.h" />
- <File Id="filedes_conf_H" Name="des_conf.h" LongName="des_conf.h" DiskId="1" src="$(var.IncDir)des_conf.h" />
- <File Id="filedes_odd_H" Name="des_odd.h" LongName="des_odd.h" DiskId="1" src="$(var.IncDir)des_odd.h" />
<File Id="filedirent_H" Name="dirent.h" LongName="dirent.h" DiskId="1" src="$(var.IncDir)dirent.h" />
<File Id="filelargeint_H" Name="largeint.h" LongName="largeint.h" DiskId="1" src="$(var.IncDir)largeint.h" />
<File Id="filelock_H" Name="lock.h" LongName="lock.h" DiskId="1" src="$(var.IncDir)lock.h" />
<File Id="filelwp_H" Name="lwp.h" LongName="lwp.h" DiskId="1" src="$(var.IncDir)lwp.h" />
<File Id="filemain_H" Name="main.h" LongName="main.h" DiskId="1" src="$(var.IncDir)main.h" />
- <File Id="filemit_cpyright_H" Name="MIT-CP~1.h" LongName="mit-cpyright.h" DiskId="1" src="$(var.IncDir)mit-cpyright.h" />
<File Id="fileosi_H" Name="osi.h" LongName="osi.h" DiskId="1" src="$(var.IncDir)osi.h" />
<File Id="fileosibasel_H" Name="osibasel.h" LongName="osibasel.h" DiskId="1" src="$(var.IncDir)osibasel.h" />
<File Id="fileosidb_H" Name="osidb.h" LongName="osidb.h" DiskId="1" src="$(var.IncDir)osidb.h" />
<Component Id="cmp_SDK_Include_rx" Guid="2E215D10-C080-42A3-B692-AFF94C7A1A2B">
<File Id="fileasn1_err_H" Name="asn1_err.h" LongName="asn1_err.h" DiskId="1" src="$(var.IncDir)rx\asn1_err.h" />
<File Id="filefcrypt_H" Name="fcrypt.h" LongName="fcrypt.h" DiskId="1" src="$(var.IncDir)rx\fcrypt.h" />
- <File Id="filehash_H" Name="hash.h" LongName="hash.h" DiskId="1" src="$(var.IncDir)rx\hash.h" />
- <File Id="filemd4_H" Name="md4.h" LongName="md4.h" DiskId="1" src="$(var.IncDir)rx\md4.h" />
- <File Id="filemd5_H" Name="md5.h" LongName="md5.h" DiskId="1" src="$(var.IncDir)rx\md5.h" />
<File Id="filerx_H" Name="rx.h" LongName="rx.h" DiskId="1" src="$(var.IncDir)rx\rx.h" />
<File Id="filerxkad_H" Name="rxkad.h" LongName="rxkad.h" DiskId="1" src="$(var.IncDir)rx\rxkad.h" />
<File Id="filerxkad_prototypes_H" Name="RXKAD_~1.h" LongName="rxkad_prototypes.h" DiskId="1" src="$(var.IncDir)rx\rxkad_prototypes.h" />
<Directory Id="dirLib" Name="lib">
<Component Win64="$(var.Win64)" Id="cmp_SDK_Lib" Guid="$(var.cmp_SDK_Lib_guid)">
<File Id="fileafsauthent_LIB" Name="AFSAUT~1.lib" LongName="afsauthent.lib" DiskId="1" src="$(var.LibDir)afsauthent.lib" />
- <File Id="fileafsdes_LIB" Name="afsdes.lib" LongName="afsdes.lib" DiskId="1" src="$(var.LibDir)afsdes.lib" />
<File Id="fileafskfw_LIB" Name="afskfw.lib" LongName="afskfw.lib" DiskId="1" src="$(var.LibDir)afskfw.lib" />
<File Id="fileafslogon_LIB" Name="afslogon.lib" LongName="afslogon.lib" DiskId="1" src="$(var.LibDir)afslogon.lib" />
<File Id="fileafslwp_LIB" Name="afslwp.lib" LongName="afslwp.lib" DiskId="1" src="$(var.LibDir)afslwp.lib" />
#
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@
${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
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 \
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)
#include <roken.h>
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#endif
+
#include <afs/stds.h>
#include <afs/pthread_glock.h>
#include <sys/types.h>
#endif
#include <string.h>
#include <stdio.h>
-#include <des.h>
-#include <des_prototypes.h>
+
+#define HC_DEPRECATED
+#include <hcrypto/des.h>
+
#include <rx/rxkad.h>
#include <rx/rx.h>
+
#include "cellconfig.h"
#include "keys.h"
#include "ktc.h"
}
/* 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);
}
${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 \
${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
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}
bosserver: $(OBJS) $(LIBS)
$(AFS_LDRULE) $(OBJS) ${TOP_LIBDIR}/libaudit.a \
- $(LIBS) $(LIB_roken) ${XLIBS}
+ $(LIBS) $(LIB_roken) $(LIB_crypt) ${XLIBS}
#
# Install targets
$(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 \
$(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)
$(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 \
$(DESTDIR)\lib\afs\afsprocmgmt.lib \
$(DESTDIR)\lib\afs\afspioctl.lib \
$(DESTDIR)\lib\libafsconf.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib
#include <afs/com_err.h>
#include <ubik.h>
#include <afs/ktime.h>
-#include <des.h>
-#include <des_prototypes.h>
+#include <hcrypto/ui.h>
#include <afs/kautils.h>
#include <afs/volser.h>
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);
#include <afs/stds.h>
#include <afs/afsutil.h>
-#include <rx/rxkad.h>
#include <afs/keys.h>
#include <afs/cellconfig.h>
#include <afs/kautils.h>
-#include <des.h>
-#include <des_prototypes.h>
+#include <hcrypto/ui.h>
+#include <hcrypto/des.h>
int
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);
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];
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);
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);
#include <afs/cellconfig.h>
#include <afs/keys.h>
#include <sys/stat.h>
-#include <des.h>
#include <dirent.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
${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
$(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 \
$(DESTDIR)\lib\afs\afspioctl.lib \
$(DESTDIR)\lib\afs\afsreg.lib \
$(DESTDIR)\lib\libafsconf.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib
${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 \
${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
$(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 \
$(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)
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <string.h>
-#include <des.h>
#include <afs/cellconfig.h>
#include <errno.h>
#include "budb.h"
#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
-#include <des.h>
#include <afs/cellconfig.h>
#include <afs/auth.h>
#include <errno.h>
${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
$(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 \
$(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
! 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
! 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
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
+++ /dev/null
-# 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
+++ /dev/null
-#
-# Copyright 1987 by the Massachusetts Institute of Technology.
-#
-# For copying and distribution information,
-# please see the file <mit-cpyright.h>.
-#
-# 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
+++ /dev/null
-#
-# Copyright 1987 by the Massachusetts Institute of Technology.
-#
-# For copying and distribution information,
-# please see the file <mit-cpyright.h>.
-#
-# 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:
-
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-#ifndef KERNEL
-#include <stdio.h>
-#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;
- }
-}
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#ifndef KERNEL
-#include <stdio.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#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];
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: IBM AIX 2.2.1 (RT/PC)
- */
-
-#include <mit-cpyright.h>
-
-/* 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
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Alpha
- */
-
-#include <mit-cpyright.h>
-
-#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
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Alpha
- */
-
-#include <mit-cpyright.h>
-
-#define ALPHA
-
-/* 'course this is a joke, but I am not going to rewrite this mess */
-#define BITS32
-
-#define BIG
-#define LSBFIRST
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define LSBFIRST
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Linux on Intel
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define LSBFIRST
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Alpha
- */
-
-#include <mit-cpyright.h>
-
-#define ALPHA
-
-/* 'course this is a joke, but I am not going to rewrite this mess */
-#define BITS32
-
-#define BIG
-#define LSBFIRST
-#define BSDUNIX
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: IBM 032 (RT/PC)
- */
-
-#include <mit-cpyright.h>
-
-#define BSDUNIX
-#define IBMWS
-#define IBMWSASM
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-#define BITS32
-#define BIG
-#define BSDUNIX
-#define LSBFIRST
-/*#define MUSTALIGN*/
+++ /dev/null
-#define BITS32
-#define BIG
-#define BSDUNIX
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: VAX
- */
-
-#include <mit-cpyright.h>
-
-#define VAX
-#define BITS32
-#define BIG
-#define LSBFIRST
-#define BSDUNIX
-
-#ifndef __STDC__
-#ifndef NOASM
-#define VAXASM
-#endif /* no assembly */
-#endif /* standard C */
+++ /dev/null
-#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 */
+++ /dev/null
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define BSDUNIX
-#define MUSTALIGN
+++ /dev/null
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define BSDUNIX
-#define MUSTALIGN
+++ /dev/null
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define BSDUNIX
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Linux on Intel
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define LSBFIRST
+++ /dev/null
-#define NOASM
-#define BITS32
-#define BIG
-#define BSDUNIX
-#define LSBFIRST
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define LSBFIRST
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: IBM 370
- */
-
-#include <mit-cpyright.h>
-
-/* What else? */
-#define BIG
-#define NONASCII
-#define SHORTNAMES
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: MIPS
- */
-
-#include <mit-cpyright.h>
-
-#define MIPS
-#define BITS32
-#define BIG
-#define LSBFIRST
-#define BSDUNIX
-#define MUSTALIGN
+++ /dev/null
-/*
-** Institutional File System Project
-** University of Michigan
-**
-*/
-#define BITS32
-#define BIG
-#define BSDUNIX
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: IBM PC 8086
- */
-
-#include <mit-cpyright.h>
-
-#define IBMPC
-#define BITS16
-#define CROSSMSDOS
-#define LSBFIRST
+++ /dev/null
-#define BITS32
-#define BIG
-#undef BSDUNIX
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Linux on Intel
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: SGI
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Linux on Intel
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Machine-type definitions: Linux on Intel
- */
-
-#include <mit-cpyright.h>
-
-#define BITS32
-#define BIG
-#define MSBFIRST
-#define MUSTALIGN
+++ /dev/null
-/*
- * 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
- * <mit-copyright.h>.
- *
- * Machine-type definitions: IBM PC windows NT
- */
-
-#include <mit-cpyright.h>
-
-#define LSBFIRST 1
-#define BITS32 1
-#define MOASM 1
-#define BIG 1
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * 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_ */
+++ /dev/null
-#define BITS32
-#define BIG
-#define BSDUNIX
-#define MSBFIRST
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * Declaration of debugging flag.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-int des_debug = 0;
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#ifndef KERNEL
-#include <stdio.h>
-#include <string.h>
-#endif
-#ifdef AFS_PTHREAD_ENV
-#include <pthread.h>
-#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;
-}
+++ /dev/null
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 */
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * 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 <afs/param.h>
-#include <mit-cpyright.h>
-
-/* 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
+++ /dev/null
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 */
+++ /dev/null
-#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
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include "des.h"
-#ifdef BSDUNIX
-#include <sys/file.h>
-#endif
-#include <stdio.h>
-
-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 */
-}
+++ /dev/null
-/*
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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);
-}
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include "des_internal.h"
-#include <stdio.h>
-
-#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);
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please seethe file <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#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 */
+++ /dev/null
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Part of the MIT Project Athena Kerberos encryption system,
- * originally written 8/85 by Steve Miller.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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");
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please see the file <mit-cpyright.h>.
- *
- * This file contains a generation routine for source code
- * implementing the final permutation of the DES.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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 */
-}
+++ /dev/null
-/*
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * This routine generates source code implementing the initial
- * permutation of the DES.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#include <stdlib.h>
-#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);
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#include <errno.h>
-#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");
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see
- * the file <mit-cpyright.h>.
- *
- * This routine generates an odd-parity table for use in key generation.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-
-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");
-}
+++ /dev/null
-/*
- * Copyright 1985, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please
- * see the file <mit-cpyright.h>.
- *
- * This routine generates the P permutation code for the DES.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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 */
-}
+++ /dev/null
-/*
- * Copyright 1985, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please
- * see the file <mit-cpyright.h>.
- *
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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");
-}
+++ /dev/null
-/*
- * Copyright 1985, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please
- * see the file <mit-cpyright.h>.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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");
-}
+++ /dev/null
-/*
- * Copyright 1985, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please
- * see the file <mit-cpyright.h>.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include <stdio.h>
-#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");
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please seethe file <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#ifndef KERNEL
-#include <stdio.h>
-#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
-}
+++ /dev/null
-/* All rights reserved. */
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#ifndef KERNEL
-#include <stdio.h>
-#endif
-#include "des.h"
-#include "des_internal.h"
-#include "des_prototypes.h"
-
-#ifdef AFS_PTHREAD_ENV
-#include <pthread.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#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 <assert.h>
-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 <winsock2.h>
-#include <process.h>
-#include <afs/afsutil.h>
-#else
-#include <sys/time.h>
-#include <unistd.h>
-#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 <assert.h>
-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;
-}
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <stdio.h>
-#include <string.h>
-#endif
-#include <afsconfig.h>
-#include <afs/param.h>
-#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;
- }
-}
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-#include <afs/stds.h>
-
-
-#include "mit-cpyright.h"
-
-/* System include files */
-#ifndef KERNEL
-#include <stdio.h>
-#endif
-#include <errno.h>
-
-/* 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;
-}
+++ /dev/null
-/*
- *
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * This routine prints the supplied string to standard
- * output as a prompt, and reads a password string without
- * echoing.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#include "des.h"
-#include "conf.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-#ifdef BSDUNIX
-#ifdef AFS_SUN5_ENV
-#define BSD_COMP
-#endif
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <setjmp.h>
-#endif
-
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef AFS_HPUX_ENV
-#include <bsdtty.h>
-#include <sys/ttold.h>
-#include <termios.h>
-static int intrupt;
-#endif
-
-#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#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 <termio.h>
-#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
+++ /dev/null
-
-/* 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
-};
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988, 1989 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#ifndef KERNEL
-#include <stdio.h>
-#endif
-
-#include "des.h"
-#include "des_internal.h"
-#include "des_prototypes.h"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#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));
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * 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
+++ /dev/null
-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}
-
+++ /dev/null
-# 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:
-
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * exit status: 0 ==> success
- * -1 ==> error
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include <mit-cpyright.h>
-#include <stdio.h>
-#include <errno.h>
-#include <des.h>
-
-#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
- }
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * exit returns 0 ==> success
- * -1 ==> error
- */
-
-#include <mit-cpyright.h>
-#include <stdio.h>
-#include <errno.h>
-#include <des.h>
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-
-#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);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * Program to test the correctness of the DES library
- * implementation.
- *
- * exit returns 0 ==> success
- * -1 ==> error
- */
-
-#include <mit-cpyright.h>
-#include <stdio.h>
-#include <errno.h>
-#include <des.h>
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-
-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);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-cpyright.h>.
- *
- * Miscellaneous debug printing utilities
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-
-#include "mit-cpyright.h"
-#ifndef KERNEL
-#include <stdio.h>
-#endif
-#include <sys/types.h>
-#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
+++ /dev/null
-/*
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-
-#ifndef KERNEL
-#include <stdio.h>
-#endif
-
-#include "des.h"
-#include "des_internal.h"
-#include "des_prototypes.h"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#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;
-}
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} \
$(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}
${TOP_LIBDIR}/util.a \
${TOP_LIBDIR}/libkauth.a \
${TOP_LIBDIR}/libprot.a \
- ${TOP_LIBDIR}/libdes.a \
${XLIBS}
all: translate_et
${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
${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
${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
${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
$(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
$(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
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
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
$(OUT)\kauth.cs.obj \
$(OUT)\kaaux.obj \
$(OUT)\client.obj \
+ $(OUT)\crypt.obj \
$(OUT)\authclient.obj \
$(OUT)\katoken.obj \
$(OUT)\kautils.obj \
$(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
#include <afs/cmd.h>
#include <afs/com_err.h>
#include <afs/afsutil.h>
-#include <des.h>
-#include <des_prototypes.h>
-
+#include <hcrypto/des.h>
+#include <hcrypto/ui.h>
#include "kauth.h"
#include "kauth_internal.h"
#include "kautils.h"
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);
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)
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 */ );
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)
#endif
#include <string.h>
#include <stdio.h>
-#include <des.h>
-#include <des_prototypes.h>
#include <rx/rxkad.h>
#include <afs/cellconfig.h>
#include <ubik.h>
#include <afs/auth.h>
#include <afs/afsutil.h>
+#include <hcrypto/des.h>
+
#include "kauth.h"
#include "kautils.h"
#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. */
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;
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;
}
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;
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:
ka_BBS oanswer;
char *strings;
int len;
- des_key_schedule schedule;
+ DES_key_schedule schedule;
int version;
afs_int32 pwexpires;
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;
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 *)×
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:
#include <afs/cellconfig.h>
#include <afs/auth.h>
#include <afs/afsutil.h>
-#include <des.h>
-#include <des_prototypes.h>
+#include <hcrypto/des.h>
+#include <hcrypto/ui.h>
+
#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
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;
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
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;
* 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.
*
* SUCH DAMAGE.
*/
+
#include <afsconfig.h>
#include <afs/param.h>
+/* 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 <windows.h>
-#endif
#include <stdlib.h>
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
/*
* UNIX password, and DES, encryption.
#include <afs/param.h>
-#include <des.h>
+#include <hcrypto/des.h>
#include <afs/com_err.h>
#include <afs/auth.h>
#include <rx/rxkad.h>
}
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);
}
#include <roken.h>
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#endif
+
#include <afs/stds.h>
#include <errno.h>
#include "kauth.h"
#include <sys/file.h>
#endif
#include <stdio.h>
+
+#define HC_DEPRECATED
+#include <hcrypto/des.h>
+
#include <lock.h>
#include <ubik.h>
#include <lwp.h>
-#include <des.h>
-#include <des_prototypes.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <afs/cellconfig.h>
#include <afs/auth.h>
#include <afs/com_err.h>
+
#include "kautils.h"
#include "kaserver.h"
#include "kalog.h"
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);
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,
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)))
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) {
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;
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);
}
/* 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 */
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) {
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))
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;
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 */
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;
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);
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];
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;
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);
}
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;
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);
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;
#ifndef AFS_SRC_KAUTH_INTERNAL_H
#define AFS_SRC_KAUTH_INTERNAL_H
+#include <hcrypto/des.h>
+
/* admin_tools.c */
extern afs_int32 ka_AdminInteractive(int cmd_argc, char *cmd_argv[]);
/* 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 *
#include <ctype.h>
#include <rx/xdr.h>
#include <rx/rx.h>
-#include <des.h>
-#include <des_prototypes.h>
+#include <hcrypto/des.h>
#include "kauth.h"
#include "kautils.h"
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;
}
#ifndef __KAUTILS__
#define __KAUTILS__
-#include <des.h>
#include <afs/auth.h>
#ifndef KAMAJORVERSION
#endif
#include <string.h>
#include <signal.h>
-#include <des.h>
-#include <des_prototypes.h>
#include <afs/com_err.h>
#include <afs/auth.h>
#include <afs/cellconfig.h>
#include <afs/cmd.h>
+#include <hcrypto/des.h>
+#include <hcrypto/ui.h>
#include "kauth.h"
#include "kautils.h"
#include "kkids.h"
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;
}
}
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. */
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)
#include <roken.h>
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#endif
+
#include <afs/stds.h>
#include <sys/types.h>
#include <errno.h>
#include <string.h>
#include <afs/afsutil.h>
#include <time.h>
+
+#define HC_DEPRECATED
+#include <hcrypto/des.h>
+
#include <afs/com_err.h>
#include <lwp.h>
-#include <des.h>
-#include <des_prototypes.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <afs/auth.h>
#include <ubik.h>
+
#include "kauth.h"
#include "kautils.h"
#include "kauth_internal.h"
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;
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) {
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;
}
/* 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;
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;
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);
{
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
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;
}
* Include file with authentication protocol information.
*/
-#include <mit-cpyright.h>
-
- /* #include <krb_conf.h> *//* removed 890221 */
-
#ifndef PROT_DEFS
#define PROT_DEFS
+++ /dev/null
-/*
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * This routine prints the supplied string to standard
- * output as a prompt, and reads a password string without
- * echoing.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <mit-cpyright.h>
-
-#include <stdio.h>
-#include <des.h>
-#include <des_prototypes.h>
-#ifdef BSDUNIX
-#include <strings.h>
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <setjmp.h>
-#else
-#include <string.h>
-#endif
-#if defined(AFS_AIX_ENV)
-#include <signal.h>
-#endif
-#if defined(AFS_SGI_ENV)
-#include <signal.h>
-#endif
-#include <string.h>
-
-#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 <termio.h>
-#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
#include <time.h>
#include <ubik.h>
#include <afs/cmd.h>
-#include <des.h>
-#include <des_prototypes.h>
+#include <hcrypto/des.h>
#include <rx/rxkad.h>
#include <afs/com_err.h>
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;
EXELIBS = \
$(DESTDIR)\afslwp.lib \
- $(DESTDIR)\lib\afsdes.lib \
$(DESTDIR)\lib\afsrxkad.lib \
$(DESTDIR)\afs\afsauth.lib \
$(DESTDIR)\afs\afscmd.lib \
#include <afs/sys_prototypes.h>
#endif
-#include <des.h>
-#include <des_prototypes.h>
#include <rx/rx.h>
#include <rx/rx_globals.h>
#include <rx/rxkad.h> /* max ticket lifetime */
+#include <hcrypto/des.h>
+#include <hcrypto/ui.h>
+
#include "kauth.h"
#include "kautils.h"
#include <afs/ktc.h>
-
afs_int32
GetTickets(char *name, char *instance, char *realm,
struct ktc_encryptionKey * key, Date lifetime,
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 {
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);
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)
#include <afs/krb_prot.h>
#include <rx/rxkad.h>
#include <crypt.h>
-#include <des.h>
+#include <hcrypto/des.h>
int krb_add_host(struct sockaddr_in *server_list_p);
static void krb_set_port(long port);
/* 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");
#include <string.h>
#include <time.h>
-#include <des.h>
#include "krb.h"
#include <sys/types.h>
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];
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;
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 */
keybytes[i] = (unsigned char)(temp << 1);
}
}
- des_fixup_key_parity((unsigned char *)key);
+ DES_fixup_key_parity((DES_cblock *)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];
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);
}
${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
$(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 \
afscp: afscp.o $(AFSCPOBJS) $(AFSCPLIBS)
$(AFS_LDRULE) afscp.o $(AFSCPOBJS) $(AFSCPLIBS) \
- $(LIB_roken) ${MT_LIBS} $(XLIBS)
+ $(LIB_roken) $(LIB_crypt) ${MT_LIBS} $(XLIBS)
#######################################################################
install:
kautils.o \
kalocalcell.o \
kaerrors.o \
- user.o \
- read_passwd.o
+ user.o
UBIKOBJS = \
uinit.o \
$(OUT)\kauth.cs.obj \
$(OUT)\kaaux.obj \
$(OUT)\client.obj \
+ $(OUT)\crypt.obj \
$(OUT)\authclient.obj \
$(OUT)\kautils.obj \
$(OUT)\kalocalcell.obj \
$(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 \
$(DESTDIR)\lib\afslwp.lib \
$(DESTDIR)\lib\lanahelper.lib \
$(DESTDIR)\lib\libafsconf.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib
$(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS)
RXKAD = ${srcdir}/../rxkad
RXSTAT = ${srcdir}/../rxstat
FSINT = ${srcdir}/../fsint
-DES = ${srcdir}/../des
COMERR = ${srcdir}/../comerr
UTIL = ${srcdir}/../util
SYS = ${srcdir}/../sys
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}
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
RX = ..\rx
RXSTAT = ..\rxstat
RXKAD = ..\rxkad
-DES = ..\des
UTIL = ..\util
FSINT = ..\fsint
COMERR = ..\comerr
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
$(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
$(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)
!ENDIF
$(DESTDIR)\lib\afs\afsutil.lib \
$(DESTDIR)\lib\afs\afsreg.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib
$(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
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
AFS =../afs
RX =../rx
AFSINT=../afsint
-DES =../des
LIB =../lib
NS_INCL =SRC/../afsweb/netscape_includes
${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 $?
$(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)
$(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 \
${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)
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
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
#
%{_includedir}/ubik.h
%{_includedir}/ubik_int.h
%{_libdir}/afs
-%{_libdir}/libdes.a
%{_libdir}/liblwp.a
%{_libdir}/librx.a
%{_libdir}/librxkad.a
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
${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 \
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; \
${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 \
$(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 \
$(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" ))
$(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 \
$(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)
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);
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
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}
$(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
$(OUT)\bg-fcrypt.obj \
$(OUT)\ticket5.obj \
$(OUT)\crc.obj \
- $(OUT)\md4.obj \
- $(OUT)\md5.obj \
$(OUT)\crypt_conn.obj
$(LIBOBJS):
#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
-#include <des.h>
#include "lifetimes.h"
static u_long table[256];
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#include <string.h>
-
-#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 <bind/bitypes.h> 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__ */
+++ /dev/null
-/*
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <afs/stds.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#endif
-#include <string.h>
-#include <rx/xdr.h>
-#include <rx/rx.h>
-#include <rx/rxkad.h>
-#include <des.h>
-#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 <touch@isi.edu>
- */
-
-#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
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_BITYPES_H
-#include <sys/bitypes.h>
-#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);
+++ /dev/null
-/*
- * 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 <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <afs/stds.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#endif
-#include <string.h>
-#include <rx/rx.h>
-#include <rx/rxkad.h>
-#include <des.h>
-#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 <touch@isi.edu>
- */
-
-#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
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_BITYPES_H
-#include <sys/bitypes.h>
-#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] */
#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 <des.h>
-#endif
+#include <hcrypto/des.h>
/* crypt_conn.c */
extern afs_int32 rxkad_DecryptPacket(const struct rx_connection *conn,
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 *
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
#include <string.h>
#include <rx/rx.h>
#include <rx/xdr.h>
-#include <des.h>
#include <afs/afsutil.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
${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
#include <roken.h>
#include <stdio.h>
-
#include <afs/stds.h>
#include <sys/types.h>
#ifdef AFS_NT40_ENV
#include <netinet/in.h>
#endif
#include <string.h>
-#include <des.h>
-#include <des_prototypes.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include "lifetimes.h"
* application uses both rxkad and openssl.
*/
union Key_schedule_safe {
- Key_schedule schedule;
+ DES_key_schedule schedule;
struct {
union {
char cblock[8];
((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,
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;
}
#include <string.h>
#include <rx/xdr.h>
#include <rx/rx.h>
+#include <hcrypto/md4.h>
+#include <hcrypto/md5.h>
#include "lifetimes.h"
#include "rxkad.h"
#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
* 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;
{
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
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);
${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 \
${TOP_LIBDIR}/libaudit.a \
${TOP_LIBDIR}/libcom_err.a \
${TOP_LIBDIR}/liblwp.a \
+ ${TOP_LIBDIR}/libafshcrypto_lwp.a \
${TOP_LIBDIR}/util.a
all: scout
# 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)
kautils.o \
kalocalcell.o \
kaerrors.o \
- user.o \
- read_passwd.o
+ user.o
UBIKOBJS = \
uinit.o \
${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}
RXKAD = $(srcdir)/../rxkad
RXSTAT = $(srcdir)/../rxstat
FSINT = $(srcdir)/../fsint
-DES = $(srcdir)/../des
COMERR = $(srcdir)/../comerr
UTIL = $(srcdir)/../util
SYS = ${srcdir}/../sys
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}
${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 $@
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
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
{
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;
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
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.
${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 \
$(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
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
!ELSE
$(DESTDIR)\lib\afspthread.lib \
!ENDIF
- $(DESTDIR)\lib\afsdes.lib \
$(DESTDIR)\lib\libafsconf.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib
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}
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
${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
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
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} \
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}
${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 \
${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 \
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
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
$(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}
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
${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
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}
$(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)
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
$(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 \
$(DESTDIR)\lib\afs\afsprocmgmt.lib \
$(DESTDIR)\lib\libafsconf.lib \
$(DESTDIR)\lib\afs\afspioctl.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib
############################################################################
${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 \
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
${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 \
#endif
#include <afs/errors.h>
#include <afs/sys_prototypes.h>
-#include <des_prototypes.h>
#include <rx/rx_prototypes.h>
-#include "../rxkad/md5.h"
+#include <hcrypto/md5.h>
+
#ifdef O_LARGEFILE
#define afs_stat stat64
#define afs_fstat fstat64
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
${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 \
$(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 \
$(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)
${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
$(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 \
$(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)
${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 \
${TOP_LIBDIR}/libcom_err.a \
${TOP_LIBDIR}/libkauth.a \
${TOP_LIBDIR}/libusd.a \
+ ${TOP_LIBDIR}/libafshcrypto_lwp.a \
${TOP_LIBDIR}/util.a
VOLDUMP_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 \
$(DESTDIR)\lib\afs\afseventlog.lib \
$(DESTDIR)\lib\libafsconf.lib \
$(DESTDIR)\lib\afs\afspioctl.lib \
+ $(DESTDIR)\lib\afshcrypto.lib \
$(DESTDIR)\lib\afsroken.lib