X-Git-Url: http://git.jankratochvil.net/?p=tac_plus.git;a=blobdiff_plain;f=md4.c;h=5ac377dcf470dd4651e623c76784b57ac2f95e47;hp=d99c84c80fe0e2ad59a8de9810f4e5a37fc3a99c;hb=413c510553a773cd16e2b538e4a208b4c4d9f775;hpb=a296ccf128acec69a7db2312ebcc231cd18e5944 diff --git a/md4.c b/md4.c index d99c84c..5ac377d 100644 --- a/md4.c +++ b/md4.c @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 1995-1998 by Cisco systems, Inc. Permission to use, copy, modify, and distribute this software for @@ -43,19 +43,27 @@ */ +#include "tac_plus.h" + +#ifdef MSCHAP + #include + #include "md4.h" /* #include "master.h" #include */ + typedef unsigned char *POINTER; typedef unsigned short int UINT2; typedef unsigned long int UINT4; -#define PROTO_LIST(list) () -#define const +static void MD4Transform TAC_ARGS((UINT4 state[4], const unsigned char block[64])); +static void Encode TAC_ARGS((unsigned char *output, UINT4 *input, unsigned int len)); +static void Decode TAC_ARGS((UINT4 *output, const unsigned char *input, unsigned int len)); + /* Constants for MD4Transform routine. */ @@ -72,12 +80,6 @@ typedef unsigned long int UINT4; #define S33 11 #define S34 15 -static void MD4Transform PROTO_LIST ((UINT4 [4], const unsigned char [64])); -static void Encode PROTO_LIST - ((unsigned char *, UINT4 *, unsigned int)); -static void Decode PROTO_LIST - ((UINT4 *, const unsigned char *, unsigned int)); - static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -111,6 +113,9 @@ static unsigned char PADDING[64] = { /* MD4 initialization. Begins an MD4 operation, writing a new context. */ + +void MD4Init TAC_ARGS((MD4_CTX *context)); + void MD4Init (context) MD4_CTX *context; /* context */ { @@ -128,6 +133,9 @@ MD4_CTX *context; /* context */ operation, processing another message block, and updating the context. */ + +void MD4Update TAC_ARGS((MD4_CTX *context, const unsigned char *input, unsigned int inputLen)); + void MD4Update (context, input, inputLen) MD4_CTX *context; /* context */ const unsigned char *input; /* input block */ @@ -168,6 +176,9 @@ unsigned int inputLen; /* length of input block */ /* MD4 finalization. Ends an MD4 message-digest operation, writing the the message digest and zeroizing the context. */ + +void MD4Final TAC_ARGS((unsigned char digest[16], MD4_CTX *context)); + void MD4Final (digest, context) unsigned char digest[16]; /* message digest */ MD4_CTX *context; /* context */ @@ -196,6 +207,9 @@ MD4_CTX *context; /* context */ /* MD4 basic transformation. Transforms state based on block. */ + +static void MD4Transform TAC_ARGS((UINT4 state[4], const unsigned char block[64])); + static void MD4Transform (state, block) UINT4 state[4]; const unsigned char block[64]; @@ -271,6 +285,9 @@ const unsigned char block[64]; /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ + +static void Encode TAC_ARGS((unsigned char *output, UINT4 *input, unsigned int len)); + static void Encode (output, input, len) unsigned char *output; UINT4 *input; @@ -289,8 +306,10 @@ unsigned int len; /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ -static void Decode (output, input, len) +static void Decode TAC_ARGS((UINT4 *output, const unsigned char *input, unsigned int len)); + +static void Decode (output, input, len) UINT4 *output; const unsigned char *input; unsigned int len; @@ -301,3 +320,9 @@ unsigned int len; output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } + +#else /* MSCHAP */ + +TAC_SOURCEFILE_EMPTY + +#endif /* MSCHAP */