From eb40b9c537a019dfc119c6593f5b11363c175dc1 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Tue, 26 Feb 1991 13:33:45 +0000 Subject: [PATCH] updated RFC code git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1783 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/krb5/rsa-md4.h | 159 ++++++++++--------------------------- 1 file changed, 42 insertions(+), 117 deletions(-) diff --git a/src/include/krb5/rsa-md4.h b/src/include/krb5/rsa-md4.h index 2aab8f2a3..ed38f8cbb 100644 --- a/src/include/krb5/rsa-md4.h +++ b/src/include/krb5/rsa-md4.h @@ -1,128 +1,53 @@ /* - * $Source$ - * $Author$ - * $Id$ - * - * Copyright 1990,1991 by the Massachusetts Institute of Technology. - * All Rights Reserved. - * - * For copying and distribution information, please see the file - * . - * - * Definitions for the MD4 checksum. + ********************************************************************** + ** md4.h -- Header file for implementation of MD4 ** + ** RSA Data Security, Inc. MD4 Message Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** + ********************************************************************** */ /* - * md4.h from RFC1186 - * - * $Log$ - * Revision 5.4 1991/02/13 15:58:08 jtkohl - * change lengths to include the count - * - * Revision 5.3 91/01/03 16:54:49 jtkohl - * add encrypted version entries - * - * Revision 5.2 90/11/20 10:23:54 jtkohl - * don't need types defined here, see - * - * Revision 5.1 90/11/08 11:30:49 jtkohl - * add STDC function prototypes - * add declaration of MDreverse - * add Kerberos V5 additions. - * - * Revision 5.0 90/11/07 14:12:21 jtkohl - * Initial code from RFC - * + ********************************************************************** + ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** + ** ** + ** License to copy and use this software is granted provided that ** + ** it is identified as the "RSA Data Security, Inc. MD4 Message ** + ** Digest Algorithm" in all material mentioning or referencing this ** + ** software or this function. ** + ** ** + ** License is also granted to make and use derivative works ** + ** provided that such works are identified as "derived from the RSA ** + ** Data Security, Inc. MD4 Message Digest Algorithm" in all ** + ** material mentioning or referencing the derived work. ** + ** ** + ** RSA Data Security, Inc. makes no representations concerning ** + ** either the merchantability of this software or the suitability ** + ** of this software for any particular purpose. It is provided "as ** + ** is" without express or implied warranty of any kind. ** + ** ** + ** These notices must be retained in any copies of any part of this ** + ** documentation and/or software. ** + ********************************************************************** */ -#include +/* typedef a 32 bit type */ +typedef unsigned long int UINT4; -#ifndef KRB5_RSA_MD4__ -#define KRB5_RSA_MD4__ - -/* 4 words of buffer, plus 8 bytes of count */ -#define RSA_MD4_CKSUM_LENGTH (4*sizeof(krb5_int32)+8) -#define RSA_MD4_DES_CKSUM_LENGTH (4*sizeof(krb5_int32)+8) - -extern krb5_checksum_entry - rsa_md4_cksumtable_entry, - rsa_md4_des_cksumtable_entry; - -/* -** ******************************************************************** -** md4.h -- Header file for implementation of ** -** MD4 Message Digest Algorithm ** -** Updated: 2/13/90 by Ronald L. Rivest ** -** (C) 1990 RSA Data Security, Inc. ** -** ******************************************************************** -*/ - -#ifdef BITS32 -/* MDstruct is the data structure for a message digest computation. -*/ +/* Data structure for MD4 (Message Digest) computation */ typedef struct { - unsigned int buffer[4]; /* Holds 4-word result of MD computation */ - unsigned char count[8]; /* Number of bits processed so far */ - unsigned int done; /* Nonzero means MD computation finished */ -} MDstruct, *MDptr; -#else - error: you gotta fix this implementation to deal with non-32 bit words; -#endif + UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ + UINT4 buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ + unsigned char digest[16]; /* actual digest after MD4Final call */ +} MD4_CTX; -/* MDbegin(MD) -** Input: MD -- an MDptr -** Initialize the MDstruct prepatory to doing a message digest -** computation. -*/ -#ifdef __STDC__ -extern void MDbegin(MDptr); -#else -extern void MDbegin(); -#endif - -/* MDupdate(MD,X,count) -** Input: MD -- an MDptr -** X -- a pointer to an array of unsigned characters. -** count -- the number of bits of X to use (an unsigned int). -** Updates MD using the first "count" bits of X. -** The array pointed to by X is not modified. -** If count is not a multiple of 8, MDupdate uses high bits of -** last byte. -** This is the basic input routine for a user. -** The routine terminates the MD computation when count < 512, so -** every MD computation should end with one call to MDupdate with a -** count less than 512. Zero is OK for a count. -*/ -#ifdef __STDC__ -extern void MDupdate(MDptr, unsigned char *, unsigned int); -#else -extern void MDupdate(); -#endif - -/* MDprint(MD) -** Input: MD -- an MDptr -** Prints message digest buffer MD as 32 hexadecimal digits. -** Order is from low-order byte of buffer[0] to high-order byte -** of buffer[3]. -** Each byte is printed with high-order hexadecimal digit first. -*/ -#ifdef __STDC__ -extern void MDprint(MDptr); -#else -extern void MDprint(); -#endif - -/* MDreverse(X) -** Reverse the byte-ordering of every int in X. -** Assumes X is an array of 16 ints. -*/ -#ifdef __STDC__ -extern void MDreverse(unsigned int *); -#else -extern void MDreverse(); -#endif +void MD4Init (); +void MD4Update (); +void MD4Final (); /* -** End of md4.h -*/ -#endif /* KRB5_RSA_MD4__ */ + ********************************************************************** + ** End of md4.h ** + ******************************* (cut) ******************************** + */ -- 2.26.2