Commit 2ed0c4b5 authored by Niels Möller's avatar Niels Möller

Hacked configure scripts, makefiles and crypto_types.h.

Rev: src/symmetric/Makefile.in:1.2
Rev: src/symmetric/cast.c:1.2
Rev: src/symmetric/configure.in:1.2
Rev: src/symmetric/desCode.h:1.2
Rev: src/symmetric/desKerb.c:1.2
Rev: src/symmetric/desQuick.c:1.2
Rev: src/symmetric/desUtil.c:1.2
Rev: src/symmetric/desdata.c:1.2
Rev: src/symmetric/idea.c:1.2
Rev: src/symmetric/include/cast.h:1.2
Rev: src/symmetric/include/crypto_types.h:1.2
Rev: src/symmetric/include/des.h:1.2
Rev: src/symmetric/include/idea.h:1.2
Rev: src/symmetric/include/md5.h:1.2
Rev: src/symmetric/include/rc4.h:1.2
Rev: src/symmetric/include/sha.h:1.2
Rev: src/symmetric/md5.c:1.2
Rev: src/symmetric/rc4.c:1.2
Rev: src/symmetric/sha.c:1.2
parent 94cb1bf0
...@@ -9,15 +9,10 @@ AR=ar ...@@ -9,15 +9,10 @@ AR=ar
# Reset VPATH # Reset VPATH
SRCDIR=@srcdir@ SRCDIR=@srcdir@
VPATH=$(SRCDIR):$(SRCDIR)/../include VPATH=$(SRCDIR):$(EXTRA_VPATH)
CRYPTO_INCLUDES=$(SRCDIR)/../include
# Additional C preprocessor flags
PREFLAGS=$(EXTRA_CPP_FLAGS) -I$(CRYPTO_INCLUDES) -I. -I$(SRCDIR) $(DEFINES)
# The flags to generate a shared library # The flags to generate a shared library
CFLAGS=$(PREFLAGS) $(OTHERFLAGS) $(EXTRA_CFLAGS) CPPFLAGS=$(PREFLAGS) $(DEFS) $(EXTRA_CPPFLAGS)
LDFLAGS=@LDFLAGS@ LDFLAGS=@LDFLAGS@
default: algorithms.a default: algorithms.a
...@@ -57,8 +52,8 @@ desTest: desCore.a desTest.o ...@@ -57,8 +52,8 @@ desTest: desCore.a desTest.o
# test all performance enhancement flags # test all performance enhancement flags
sure: sure:
make clean ; make desTest 'CPPFLAGS=-Di386 -Umc68000 -Usparc' make clean ; make desTest 'CPPFLAGS=-Di386 -Umc68000 -Usparc'
make clean ; make desTest 'CPPFLAGS=-Dvax -Umc68000 -Usparc' make clean ; make desTest 'CPPFLAGS=-Dvax -Umc68000 -Usparc'
make clean ; make desTest 'CPPFLAGS=-Dmc68000 -Usparc' make clean ; make desTest 'CPPFLAGS=-Dmc68000 -Usparc'
make clean ; make desTest 'CPPFLAGS=-Dsparc -Umc68000' make clean ; make desTest 'CPPFLAGS=-Dsparc -Umc68000'
make clean ; make desTest make clean ; make desTest
...@@ -141,19 +136,41 @@ desQuickCore.c: ...@@ -141,19 +136,41 @@ desQuickCore.c:
### End of rules for desCore ### End of rules for desCore
# BEGIN NATIONAL SECURITY SRCS = sha.c md5.c idea.c rc4.c cast.c $(SC) $(GC)
MASS_DESTRUCTION_OBJS = idea.o rc4.o cast.o $(O) OBJS = $(SRCS:.c=.o)
# END NATIONAL SECURITY
OBJS = $(MASS_DESTRUCTION_OBJS) sha.o md5.o
algorithms.a: $(OBJS) algorithms.a: $(OBJS)
rm -f algorithms.a rm -f algorithms.a
$(AR) cru algorithms.a $(OBJS) $(AR) cru algorithms.a $(OBJS)
$(RANLIB) algorithms.a $(RANLIB) algorithms.a
Makefile: $(SRCDIR)/Makefile.in config.status #### Remaking the Makefile and configure scripts. ####
CONFIG_FILES=Makefile CONFIG_HEADERS="" ./config.status
@echo "Run make again" #${srcdir}/configure: configure.in aclocal.m4
@exit 1 ${srcdir}/configure: configure.in
cd ${srcdir} && autoconf
# autoheader might not change config.h.in, so touch a stamp file.
${srcdir}/config.h.in: stamp-h.in
#${srcdir}/stamp-h.in: configure.in aclocal.m4 acconfig.h \
# config.h.top config.h.bot
${srcdir}/stamp-h.in: configure.in
cd ${srcdir} && autoheader
echo timestamp > ${srcdir}/stamp-h.in
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
%.d: %.c
$(SHELL) -ec '$(CC) -MM -MG $(CPPFLAGS) $(DEFS) $< \
| sed '\''s/\($*\)\.o:/\1\.o $@ : /g'\'' > $@'
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <cast.h> #include <cast.h>
#define u8 unsigned INT8 #define u8 UINT8
#define u32 unsigned INT32 #define u32 UINT32
#include "cast_sboxes.h" #include "cast_sboxes.h"
......
dnl Process this file with autoconf to produce a configure script.
# $Id$ # $Id$
AC_INIT(sha.c) AC_INIT(sha.c)
AC_PROG_MAKE_SET
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
AC_PROG_RANLIB AC_PROG_RANLIB
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST AC_C_CONST
dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_OUTPUT(Makefile) AC_OUTPUT(Makefile)
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "RCSID.h" #include "RCSID.h"
RCSID2(desCode_hRcs, "$Id$"); RCSID2(desCode_hRcs, "$Id$");
extern unsigned INT32 des_keymap[], des_bigmap[]; extern UINT32 des_keymap[], des_bigmap[];
/* optional customization: /* optional customization:
* the idea here is to alter the code so it will still run correctly * the idea here is to alter the code so it will still run correctly
...@@ -51,15 +51,15 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -51,15 +51,15 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
* a macro definition that the users of the function doesn't * a macro definition that the users of the function doesn't
* know about. - Niels */ * know about. - Niels */
#if 0 /* didn't feel like deleting */ #if 0 /* didn't feel like deleting */
#define SREGFREE ; s = (unsigned INT8 *) D #define SREGFREE ; s = (UINT8 *) D
#define DEST s #define DEST s
#define D m0 #define D m0
#define BYTE unsigned INT32 #define BYTE UINT32
#else #else
#define SREGFREE #define SREGFREE
#define DEST d #define DEST d
#define D d #define D d
#define BYTE unsigned INT8 #define BYTE UINT8
#endif #endif
/* handle constants in the optimal way for 386 & vax */ /* handle constants in the optimal way for 386 & vax */
...@@ -132,8 +132,8 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -132,8 +132,8 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
#define LS2(z) k1 & z #define LS2(z) k1 & z
#define LS3(z) k2 & z #define LS3(z) k2 & z
#define REGQUICK \ #define REGQUICK \
register unsigned INT32 k0, k1; \ register UINT32 k0, k1; \
register unsigned INT32 *m0, *m1, *m2, *m3; register UINT32 *m0, *m1, *m2, *m3;
#define SETQUICK \ #define SETQUICK \
; k0 = 0XFCFC \ ; k0 = 0XFCFC \
; k1 = 16 \ ; k1 = 16 \
...@@ -143,8 +143,8 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -143,8 +143,8 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
; m2 = m1 + 64 \ ; m2 = m1 + 64 \
; m3 = m2 + 64 ; m3 = m2 + 64
#define REGSMALL \ #define REGSMALL \
register unsigned INT32 k0, k1, k2; \ register UINT32 k0, k1, k2; \
register unsigned INT32 *m0, *m1, *m2, *m3; register UINT32 *m0, *m1, *m2, *m3;
#define SETSMALL \ #define SETSMALL \
; k0 = 0X01000100L \ ; k0 = 0X01000100L \
; k1 = 0X0FC \ ; k1 = 0X0FC \
...@@ -189,8 +189,8 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -189,8 +189,8 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
#define LS2(z) 0XFC & z #define LS2(z) 0XFC & z
#define LS3(z) 0XFC & z #define LS3(z) 0XFC & z
#define REGQUICK \ #define REGQUICK \
register unsigned INT32 k0; \ register UINT32 k0; \
register unsigned INT32 *m0, *m1, *m2, *m3; register UINT32 *m0, *m1, *m2, *m3;
#define SETQUICK \ #define SETQUICK \
; k0 = 0XFCFC \ ; k0 = 0XFCFC \
; m0 = des_bigmap \ ; m0 = des_bigmap \
...@@ -198,7 +198,7 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -198,7 +198,7 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
; m2 = m1 + 64 \ ; m2 = m1 + 64 \
; m3 = m2 + 64 ; m3 = m2 + 64
#define REGSMALL \ #define REGSMALL \
register unsigned INT32 *m0, *m1, *m2, *m3, *m4, *m5, *m6, *m7; register UINT32 *m0, *m1, *m2, *m3, *m4, *m5, *m6, *m7;
#define SETSMALL \ #define SETSMALL \
; m0 = des_keymap \ ; m0 = des_keymap \
; m1 = m0 + 64 \ ; m1 = m0 + 64 \
...@@ -214,7 +214,7 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -214,7 +214,7 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
/* some basic stuff */ /* some basic stuff */
/* generate addresses from a base and an index */ /* generate addresses from a base and an index */
#define ADD(b,x) (unsigned INT32 *) ((unsigned INT8 *)b + (x)) #define ADD(b,x) (UINT32 *) ((UINT8 *)b + (x))
/* low level rotate operations */ /* low level rotate operations */
#define NOP(d,c,o) #define NOP(d,c,o)
...@@ -344,10 +344,10 @@ extern unsigned INT32 des_keymap[], des_bigmap[]; ...@@ -344,10 +344,10 @@ extern unsigned INT32 des_keymap[], des_bigmap[];
\ \
void \ void \
NAME(REGISTER BYTE *D, \ NAME(REGISTER BYTE *D, \
REGISTER unsigned INT32 *r, \ REGISTER UINT32 *r, \
REGISTER unsigned INT8 *s) \ REGISTER UINT8 *s) \
{ \ { \
register unsigned INT32 x, y, z; \ register UINT32 x, y, z; \
\ \
/* declare temps & load data */ \ /* declare temps & load data */ \
TEMP(LOAD); \ TEMP(LOAD); \
...@@ -380,10 +380,10 @@ NAME(REGISTER BYTE *D, \ ...@@ -380,10 +380,10 @@ NAME(REGISTER BYTE *D, \
\ \
void \ void \
NAME(REGISTER BYTE *D, \ NAME(REGISTER BYTE *D, \
REGISTER unsigned INT32 *r, \ REGISTER UINT32 *r, \
REGISTER unsigned INT8 *s) \ REGISTER UINT8 *s) \
{ \ { \
register unsigned INT32 x, y, z; \ register UINT32 x, y, z; \
\ \
/* declare temps & load data */ \ /* declare temps & load data */ \
TEMP(LOAD); \ TEMP(LOAD); \
......
...@@ -16,7 +16,7 @@ DesFunc *DesCryptFuncs[2] = { DesSmallFipsDecrypt, DesSmallFipsEncrypt }; ...@@ -16,7 +16,7 @@ DesFunc *DesCryptFuncs[2] = { DesSmallFipsDecrypt, DesSmallFipsEncrypt };
/* kerberos-compatible key schedule function */ /* kerberos-compatible key schedule function */
int int
des_key_sched(unsigned INT8 *k, unsigned INT32 *s) des_key_sched(UINT8 *k, UINT32 *s)
{ {
return DesMethod(s, k); return DesMethod(s, k);
} }
...@@ -24,7 +24,7 @@ des_key_sched(unsigned INT8 *k, unsigned INT32 *s) ...@@ -24,7 +24,7 @@ des_key_sched(unsigned INT8 *k, unsigned INT32 *s)
/* kerberos-compatible des coding function */ /* kerberos-compatible des coding function */
int int
des_ecb_encrypt(unsigned INT8 *s, unsigned INT8 *d, unsigned INT32 *r, int e) des_ecb_encrypt(UINT8 *s, UINT8 *d, UINT32 *r, int e)
{ {
(*DesCryptFuncs[e])(d, r, s); (*DesCryptFuncs[e])(d, r, s);
return 0; return 0;
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
#include "RCSID.h" #include "RCSID.h"
RCSID2(desQuick_cRcs, "$Id$"); RCSID2(desQuick_cRcs, "$Id$");
extern unsigned INT32 des_keymap[]; extern UINT32 des_keymap[];
/* static information */ /* static information */
static int depth = 0; /* keep track of the request depth */ static int depth = 0; /* keep track of the request depth */
unsigned INT32 des_bigmap[0x4000]; /* big lookup table */ UINT32 des_bigmap[0x4000]; /* big lookup table */
/* fill in the 64k table used by the `quick' option */ /* fill in the 64k table used by the `quick' option */
...@@ -25,7 +25,7 @@ void ...@@ -25,7 +25,7 @@ void
DesQuickInit(void) DesQuickInit(void)
{ {
int s1, s3, x; int s1, s3, x;
unsigned INT32 * t0, * t1, * t2, * t3; UINT32 * t0, * t1, * t2, * t3;
if ( depth++ ) if ( depth++ )
return; return;
......
...@@ -11,11 +11,11 @@ RCSID2(desUtil_cRcs, "$Id$"); ...@@ -11,11 +11,11 @@ RCSID2(desUtil_cRcs, "$Id$");
/* various tables */ /* various tables */
unsigned INT32 des_keymap[] = { UINT32 des_keymap[] = {
#include "keymap.h" #include "keymap.h"
}; };
static unsigned INT8 rotors[] = { static UINT8 rotors[] = {
#include "rotors.h" #include "rotors.h"
}; };
static char parity[] = { static char parity[] = {
...@@ -28,9 +28,9 @@ RCSID2(ego, "\n\nFast DES Library Copyright (c) 1991 Dana L. How\n\n"); ...@@ -28,9 +28,9 @@ RCSID2(ego, "\n\nFast DES Library Copyright (c) 1991 Dana L. How\n\n");
/* set up the method list from the key */ /* set up the method list from the key */
int int
DesMethod(unsigned INT32 *method, unsigned INT8 *k) DesMethod(UINT32 *method, UINT8 *k)
{ {
register unsigned INT32 n, w; register UINT32 n, w;
register char * b0, * b1; register char * b0, * b1;
char bits0[56], bits1[56]; char bits0[56], bits1[56];
......
...@@ -60,7 +60,7 @@ int printf(const char *, ...); ...@@ -60,7 +60,7 @@ int printf(const char *, ...);
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
unsigned INT32 d, i, j, k, l, m, n, s; UINT32 d, i, j, k, l, m, n, s;
char b[256], ksr[56]; char b[256], ksr[56];
switch ( argv[1][0] ) { switch ( argv[1][0] ) {
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
* compiler doesn't schedule branches. * compiler doesn't schedule branches.
*/ */
#ifdef SMALL_CACHE #ifdef SMALL_CACHE
const static unsigned INT16 const static UINT16
mul(unsigned INT16 a, unsigned INT16 b) mul(UINT16 a, UINT16 b)
{ {
register unsigned INT32 p; register UINT32 p;
p = (unsigned INT32)a * b; p = (UINT32)a * b;
if (p) if (p)
{ {
b = low16(p); b = low16(p);
...@@ -70,11 +70,11 @@ mul(unsigned INT16 a, unsigned INT16 b) ...@@ -70,11 +70,11 @@ mul(unsigned INT16 a, unsigned INT16 b)
* algorithm. It is unrolled twice to avoid swapping the registers each * algorithm. It is unrolled twice to avoid swapping the registers each
* iteration, and some subtracts of t have been changed to adds. * iteration, and some subtracts of t have been changed to adds.
*/ */
static const unsigned INT16 static const UINT16
inv(unsigned INT16 x) inv(UINT16 x)
{ {
unsigned INT16 t0, t1; UINT16 t0, t1;
unsigned INT16 q, y; UINT16 q, y;
if (x <= 1) if (x <= 1)
return x; /* 0 and 1 are self-inverse */ return x; /* 0 and 1 are self-inverse */
...@@ -102,8 +102,8 @@ inv(unsigned INT16 x) ...@@ -102,8 +102,8 @@ inv(unsigned INT16 x)
* Expand a 128-bit user key to a working encryption key ctx * Expand a 128-bit user key to a working encryption key ctx
*/ */
void void
idea_expand(unsigned INT16 *ctx, idea_expand(UINT16 *ctx,
const unsigned INT8 *userkey) const UINT8 *userkey)
{ {
int i,j; int i,j;
...@@ -125,13 +125,13 @@ idea_expand(unsigned INT16 *ctx, ...@@ -125,13 +125,13 @@ idea_expand(unsigned INT16 *ctx,
* inverted into an internal buffer, and then copied to the output. * inverted into an internal buffer, and then copied to the output.
*/ */
void void
idea_invert(unsigned INT16 *d, idea_invert(UINT16 *d,
const unsigned INT16 *e) const UINT16 *e)
{ {
int i; int i;
unsigned INT16 t1, t2, t3; UINT16 t1, t2, t3;
unsigned INT16 temp[IDEA_KEYLEN]; UINT16 temp[IDEA_KEYLEN];
unsigned INT16 *p = temp + IDEA_KEYLEN; UINT16 *p = temp + IDEA_KEYLEN;
t1 = inv(*e++); t1 = inv(*e++);
t2 = -*e++; t2 = -*e++;
...@@ -182,13 +182,13 @@ idea_invert(unsigned INT16 *d, ...@@ -182,13 +182,13 @@ idea_invert(unsigned INT16 *d,
#else /* !SMALL_CACHE */ #else /* !SMALL_CACHE */
#ifdef AVOID_JUMPS #ifdef AVOID_JUMPS
#define MUL(x,y) (x = low16(x-1), t16 = low16((y)-1), \ #define MUL(x,y) (x = low16(x-1), t16 = low16((y)-1), \
t32 = (unsigned INT32)x*t16 + x + t16 + 1, x = low16(t32), \ t32 = (UINT32)x*t16 + x + t16 + 1, x = low16(t32), \
t16 = t32>>16, x = (x-t16) + (x<t16) ) t16 = t32>>16, x = (x-t16) + (x<t16) )
#else /* !AVOID_JUMPS (default) */ #else /* !AVOID_JUMPS (default) */
#define MUL(x,y) \ #define MUL(x,y) \
((t16 = (y)) ? \ ((t16 = (y)) ? \
(x=low16(x)) ? \ (x=low16(x)) ? \
t32 = (unsigned INT32)x*t16, \ t32 = (UINT32)x*t16, \
x = low16(t32), \ x = low16(t32), \
t16 = t32>>16, \ t16 = t32>>16, \
x = (x-t16)+(x<t16) \ x = (x-t16)+(x<t16) \
...@@ -213,11 +213,11 @@ idea_invert(unsigned INT16 *d, ...@@ -213,11 +213,11 @@ idea_invert(unsigned INT16 *d,
/* IDEA encryption/decryption algorithm */ /* IDEA encryption/decryption algorithm */
/* Note that in and out can be the same buffer */ /* Note that in and out can be the same buffer */
void void
idea_crypt(const unsigned INT16 *key, idea_crypt(const UINT16 *key,
unsigned INT8 *dest, UINT8 *dest,
const unsigned INT8 *src) const UINT8 *src)
{ {
register unsigned INT16 x1, x2, x3, x4, s2, s3; register UINT16 x1, x2, x3, x4, s2, s3;
/* Setup */ /* Setup */
...@@ -227,8 +227,8 @@ idea_crypt(const unsigned INT16 *key, ...@@ -227,8 +227,8 @@ idea_crypt(const unsigned INT16 *key,
/* Encrypt */ /* Encrypt */
{ {
#ifndef SMALL_CACHE #ifndef SMALL_CACHE
register unsigned INT16 t16; /* Temporaries needed by MUL macro */ register UINT16 t16; /* Temporaries needed by MUL macro */
register unsigned INT32 t32; register UINT32 t32;
#endif #endif
int r = IDEA_ROUNDS; int r = IDEA_ROUNDS;
do do
......
...@@ -21,16 +21,16 @@ ...@@ -21,16 +21,16 @@
#include "crypto_types.h" #include "crypto_types.h"
struct cast_key { struct cast_key {
unsigned INT32 xkey[32]; /* Key, after expansion */ UINT32 xkey[32]; /* Key, after expansion */
unsigned rounds; /* Number of rounds to use, 12 or 16 */ unsigned rounds; /* Number of rounds to use, 12 or 16 */
}; };
void cast_setkey(struct cast_key *key, unsigned INT8 *rawkey, void cast_setkey(struct cast_key *key, UINT8 *rawkey,
unsigned keybytes); unsigned keybytes);
void cast_encrypt(struct cast_key *key, unsigned INT8 *inblock, void cast_encrypt(struct cast_key *key, UINT8 *inblock,
unsigned INT8 *outblock); UINT8 *outblock);
void cast_decrypt(struct cast_key *key, unsigned INT8 *inblock, void cast_decrypt(struct cast_key *key, UINT8 *inblock,
unsigned INT8* outblock); UINT8* outblock);
#endif /* ifndef _CAST_H_INCLUDED */ #endif /* ifndef _CAST_H_INCLUDED */
/* $Id$ /* $Id$
* *
* Defines the types INT32 and INT8 */ * Defines the types UINT32, UINT16 and UINT8 */
#ifndef CRYPTO_TYPES_H_INCLUDED #ifndef CRYPTO_TYPES_H_INCLUDED
#define CRYPTO_TYPES_H_INCLUDED #define CRYPTO_TYPES_H_INCLUDED
...@@ -8,10 +8,17 @@ ...@@ -8,10 +8,17 @@
#ifdef PIKE #ifdef PIKE
#include "pike_types.h" #include "pike_types.h"
#include "global.h" #include "global.h"
#else /* !PIKE */ #define UINT32 unsigned INT32
#define INT32 long #define UINT16 unsigned INT16
#define INT16 short #define UINT8 unsigned INT8
#define INT8 char #else /* !PIKE */
#ifdef LSH
#include "lsh_types.h"
#else /* !LSH */
#define UINT32 unsigned long
#define UINT16 unsigned short
#define UINT8 unsigned char
#endif
#endif #endif
#endif /* CRYPTO_TYPES_H_INCLUDED */ #endif /* CRYPTO_TYPES_H_INCLUDED */
...@@ -18,11 +18,11 @@ RCSID2(desCore_hRcs, "$Id$"); ...@@ -18,11 +18,11 @@ RCSID2(desCore_hRcs, "$Id$");
#define DES_BLOCKSIZE 8 #define DES_BLOCKSIZE 8
#define DES_EXPANDED_KEYLEN 32 #define DES_EXPANDED_KEYLEN 32
typedef unsigned INT8 DesData[DES_BLOCKSIZE]; typedef UINT8 DesData[DES_BLOCKSIZE];
typedef unsigned INT32 DesKeys[DES_EXPANDED_KEYLEN]; typedef UINT32 DesKeys[DES_EXPANDED_KEYLEN];
typedef void DesFunc(unsigned INT8 *d, unsigned INT32 *r, unsigned INT8 *s); typedef void DesFunc(UINT8 *d, UINT32 *r, UINT8 *s);
extern int DesMethod(unsigned INT32 *method, unsigned INT8 *k); extern int DesMethod(UINT32 *method, UINT8 *k);
extern void DesQuickInit(void); extern void DesQuickInit(void);
extern void DesQuickDone(void); extern void DesQuickDone(void);
extern DesFunc DesQuickCoreEncrypt; extern DesFunc DesQuickCoreEncrypt;
...@@ -35,7 +35,7 @@ extern DesFunc DesSmallCoreDecrypt; ...@@ -35,7 +35,7 @@ extern DesFunc DesSmallCoreDecrypt;
extern DesFunc DesSmallFipsDecrypt; extern DesFunc DesSmallFipsDecrypt;
extern DesFunc *DesCryptFuncs[2]; extern DesFunc *DesCryptFuncs[2];
extern int des_key_sched(unsigned INT8 *k, unsigned INT32 *s); extern int des_key_sched(UINT8 *k, UINT32 *s);
extern int des_ecb_encrypt(unsigned INT8 *s, unsigned INT8 *d, unsigned INT32 *r, int e); extern int des_ecb_encrypt(UINT8 *s, UINT8 *d, UINT32 *r, int e);
#endif /* DES_H_INCLUDED */ #endif /* DES_H_INCLUDED */
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
#include "crypto_types.h" #include "crypto_types.h"
void idea_expand(unsigned INT16 *ctx, void idea_expand(UINT16 *ctx,
const unsigned INT8 *key); const UINT8 *key);
void idea_invert(unsigned INT16 *d, void idea_invert(UINT16 *d,
const unsigned INT16 *e); const UINT16 *e);
void idea_crypt(const unsigned INT16 *ctx, void idea_crypt(const UINT16 *ctx,
unsigned INT8 *dest, UINT8 *dest,
const unsigned INT8 *src); const UINT8 *src);
#endif /* IDEA_H_INCLUDED */ #endif /* IDEA_H_INCLUDED */
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
#define MD5_DIGESTLEN 4 #define MD5_DIGESTLEN 4
struct md5_ctx { struct md5_ctx {
unsigned INT32 digest[MD5_DIGESTLEN]; /* Digest */ UINT32 digest[MD5_DIGESTLEN]; /* Digest */
unsigned INT32 count_l, count_h; /* Block count */ UINT32 count_l, count_h; /* Block count */
unsigned INT8 block[MD5_DATASIZE]; /* One block buffer */ UINT8 block[MD5_DATASIZE]; /* One block buffer */
int index; /* index into buffer */ int index; /* index into buffer */
}; };
void md5_init(struct md5_ctx *ctx); void md5_init(struct md5_ctx *ctx);
void md5_update(struct md5_ctx *ctx, unsigned INT8 *buffer, unsigned INT32 len); void md5_update(struct md5_ctx *ctx, UINT8 *buffer, UINT32 len);
void md5_final(struct md5_ctx *ctx); void md5_final(struct md5_ctx *ctx);
void md5_digest(struct md5_ctx *ctx, INT8 *s); void md5_digest(struct md5_ctx *ctx, UINT8 *s);
void md5_copy(struct md5_ctx *dest, struct md5_ctx *src); void md5_copy(struct md5_ctx *dest, struct md5_ctx *src);
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
#include "crypto_types.h" #include "crypto_types.h"
struct rc4_ctx {