All BSDs are not I386s.
Also include a patch that make sure that data are alligned on alpha. All
bsd's will fix it up in kernel when used, but you'll get a huge performace
penalty
Use afs_int32 in the des programs to make sure they work and make them
build again.
#if defined(sgi)
#include "conf-sgi.h"
#else
-#if defined(__alpha) && !defined(AFS_ALPHA_LINUX20_ENV)
+#ifdef AFS_OSF_ENV
+#if defined(__alpha)
#include "conf-bsd-alpha.h"
#else
+#error unknown osf
+#endif
+#else
#if defined(AFS_X86_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) || defined(AFS_DJGPP_ENV)
#ifdef AFS_PARISC_LINUX20_ENV
#include "conf-parisc-linux.h"
--- /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
+
srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config
+CFLAGS=-g -I. -I${srcdir} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS}
+
# Test programs
PROGS = \
key_test \
testit \
verify
-INCDIRS= -I${TOP_OBJDIR}/src/config -I${DESTDIR}/include -I..
-LIBS=-L.. -ldes
-CFLAGS = ${INCDIRS} ${XCFLAGS}
+LDFLAGS = ${XLDFLAGS}
+
+LIBS=\
+ ${TOP_LIBDIR}/libdes.a \
all test: $(PROGS)
@echo No kernel source here.
testit: testit.o
- ${CC} ${CFLAGS} testit.o ${LIBS} -o testit
+ ${CC} ${CFLAGS} testit.o ${LIBS} ${LDFLAGS} -o testit
verify: verify.o ../libdes.a
- ${CC} ${CFLAGS} verify.o ${LIBS} -o verify
+ ${CC} ${CFLAGS} verify.o ${LIBS} ${LDFLAGS} -o verify
key_test: key_test.o ../libdes.a
- ${CC} ${CFLAGS} key_test.o ${LIBS} -o key_test
+ ${CC} ${CFLAGS} key_test.o ${LIBS} ${LDFLAGS} -o key_test
int pid;
extern int des_debug;
-unsigned long dummy[2];
+afs_int32 dummy[2];
unsigned char dum_c[8] = { 0x80,1,1,1,1,1,1,1 };
des_key_schedule KS;
des_cblock kk;
int i;
progname=argv[0]; /* salt away invoking program */
- /* Assume a long is four bytes */
- if (sizeof(long) != 4) {
- fprintf(stderr,"\nERROR, size of long is %d",sizeof(long));
- exit(-1);
- }
-
while (--argc > 0 && (*++argv)[0] == '-')
for (i=1; argv[0][i] != '\0'; i++) {
switch (argv[0][i]) {
#endif
des_key_sched(dummy,KS);
#ifdef BSDUNIX
- fprintf(stderr,"\nKS= %x",* (long *)KS);
+ fprintf(stderr,"\nKS= %x",* (afs_int32 *)KS);
#endif
#ifdef CROSSMSDOS
- fprintf(stderr,"\nKS= %X",* (long *)KS);
+ fprintf(stderr,"\nKS= %X",* (afs_int32 *)KS);
#endif
dummy[0] = 0x01010101;
dummy[1] = 0x01010101;
#endif
des_key_sched(dummy,KS);
#ifdef BSDUNIX
- fprintf(stderr,"\nKS= %x", *(long *)KS);
+ fprintf(stderr,"\nKS= %x", *(afs_int32 *)KS);
#endif
#ifdef CROSSMSDOS
- fprintf(stderr,"\nKS= %X", *(long *)KS);
+ fprintf(stderr,"\nKS= %X", *(afs_int32 *)KS);
#endif
dummy[0] = 0x80808080;
#endif
des_key_sched(dummy,KS);
#ifdef BSDUNIX
- fprintf(stderr,"\nKS[0]= %x",* (long * ) KS);
+ fprintf(stderr,"\nKS[0]= %x",* (afs_int32 * ) KS);
#endif
#ifdef CROSSMSDOS
- fprintf(stderr,"\nKS[0]= %X",* (long * ) KS);
+ fprintf(stderr,"\nKS[0]= %X",* (afs_int32 * ) KS);
#endif
printf("\nstring to key 'a'");
#endif
des_key_sched(dummy,KS);
#ifdef BSDUNIX
- fprintf(stderr,"\nKS= %x",* (long *) KS);
+ fprintf(stderr,"\nKS= %x",* (afs_int32 *) KS);
#endif
#ifdef CROSSMSDOS
- fprintf(stderr,"\nKS= %X",* (long *) KS);
+ fprintf(stderr,"\nKS= %X",* (afs_int32 *) KS);
#endif
printf("\nstring to key 'c'");
#endif
des_key_sched(dummy,KS);
#ifdef BSDUNIX
- fprintf(stderr,"\nKS= %x", * (long * ) KS);
+ fprintf(stderr,"\nKS= %x", * (afs_int32 * ) KS);
#endif
#ifdef CROSSMSDOS
- fprintf(stderr,"\nKS= %X", * (long * ) KS);
+ fprintf(stderr,"\nKS= %X", * (afs_int32 * ) KS);
#endif
}
progname=argv[0]; /* salt away invoking program */
- /* Assume a long is four bytes */
- if (sizeof(long) != 4) {
- fprintf(stdout,"\nERROR, size of long is %d",sizeof(long));
- exit(-1);
- }
-
while (--argc > 0 && (*++argv)[0] == '-')
for (i=1; argv[0][i] != '\0'; i++) {
switch (argv[0][i]) {
char *argv[];
{
/* Local Declarations */
- long in_length;
+ afs_int32 in_length;
progname=argv[0]; /* salt away invoking program */
- /* Assume a long is four bytes */
- if (sizeof(long) != 4) {
- printf("\nERROR, size of long is %d",sizeof(long));
- exit(-1);
- }
-
while (--argc > 0 && (*++argv)[0] == '-')
for (i=1; argv[0][i] != '\0'; i++) {
switch (argv[0][i]) {
printf("ACTUAL CBC\n\tclear \"%s\"\n",input);
in_length = strlen(input);
- des_cbc_encrypt(input,cipher_text,(long) in_length,KS,ivec,1);
+ 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");
}
printf("\n");
}
- des_cbc_encrypt(cipher_text,clear_text,(long) in_length,KS,ivec,0);
+ 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("\tchecksum\t58 d2 e7 7e 86 06 27 33, ");
printf("or some part thereof\n");
input = clear_text2;
- des_cbc_cksum(input,cipher_text,(long) strlen(input),KS,ivec,1);
+ 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++)