home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume41
/
mdigest
/
part03
< prev
next >
Wrap
Internet Message Format
|
1994-03-24
|
49KB
From: M.Gream@uts.edu.au (Matthew Gream)
Newsgroups: comp.sources.misc
Subject: v41i139: mdigest - message digest library, Part03/03
Date: 28 Feb 1994 18:26:19 -0000
Sender: aem@aber.ac.uk
Approved: aem@aber.ac.uk
Message-ID: <2ktd0b$107@uk-usenet.uk.sun.com>
X-Md4-Signature: 0909afb00f2d22cd68dad338323acceb
Submitted-by: M.Gream@uts.edu.au (Matthew Gream)
Posting-number: Volume 41, Issue 139
Archive-name: mdigest/part03
Environment: C
#! /bin/sh
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents: CHECKSUMS Makefile haval-if.c haval.h license.txt md4-if.c
# md4.h md5-if.c md5.h mdigest.h shs-if.c shs.h utility.c
# Wrapped by alecm@uk-usenet on Thu Feb 24 09:36:44 1994
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 3 (of 3)."'
if test -f 'CHECKSUMS' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'CHECKSUMS'\"
else
echo shar: Extracting \"'CHECKSUMS'\" \(4908 characters\)
sed "s/^X//" >'CHECKSUMS' <<'END_OF_FILE'
XEXPORT : 97 bytes
X md4 : 3ac4f1f5f90b8b1f50416125729f1baa
X shs : e4c0e82642034a2e1fb1ea8052ca72fd4243165d
X md5 : 151cbda69cfd23e6120ee4f65fb7dd8d
X haval : be77c00fc6ba285d78d2e2c4918f7358
XMakefile : 598 bytes
X md4 : b7189b9e9dd45996a6eb64e1ff56d487
X shs : b08571682e27ba4a502ad7d556a75af0fd35ceb4
X md5 : d9f729f47f134cad9da76e5757e9fedb
X haval : 5d0f1e5c45462d4e6573e8d917a20813
XREADME : 10157 bytes
X md4 : e3c49ed13ddd7e06c60c54a6b4787366
X shs : 06c1c80b4e18a7512b36eb2c30faf24a7b5eaf48
X md5 : 06dc11c849fadf75b9a279f5fe6582f5
X haval : e3b2445af1096d6d41abfb444d23a917
Xhaval-if.c : 3024 bytes
X md4 : 53cab1c8835daeb44d157e889cae8542
X shs : 6ae9ce9504342fec2298004b77cd1d71210a5d2d
X md5 : 77aea8bc4f32f6e87826957713ee3ec8
X haval : 7722a0f85bff94f7838b33632d30f728
Xhaval.c : 26139 bytes
X md4 : e317891d8b9480b9a1446f779ea6ba7a
X shs : 3051aec69d62d2d912e961d765bc3b2834d0a172
X md5 : 8eed73ca3a388848aad8d713ec37a101
X haval : 411dbdbde75d51143333789f7724cce4
Xhaval.h : 2980 bytes
X md4 : f3b035277bd40d67791c140029f5fca6
X shs : da13bca519d71a25c666f11461c43c5d896dac5a
X md5 : 153c94e7dcbab4660a6ccb916ede4781
X haval : 28b33bf339aefa4543d441c7e217fcb9
Xlicense.txt : 3733 bytes
X md4 : 741462d6ce28e1cd0b9c32a9173fb4e4
X shs : 3de46d78eabeac4c1f87149a5b0085ef2ec11024
X md5 : 33386c167d8f012b437e70c3c0f98a94
X haval : c38ae05ca51511935ae867442f0f8ee7
Xmd4-if.c : 2963 bytes
X md4 : eb51bbba579f6156b33917a5fc812e31
X shs : 53799be5b79bda841fde3bc20582e00fd80b8b1a
X md5 : 0825b96ab0428ccd00d2f976a7b152da
X haval : 6067cc0ea94e504e457da42007d58b72
Xmd4.c : 8249 bytes
X md4 : dcd9c022b19bd3046b8460a2c243491b
X shs : ac634f340ceb8bb3f1323002af85411cc7cb9811
X md5 : 1587b45eb7339f13dec1a5b4ea923746
X haval : 8e05626384ec85374ec7c84849659ff8
Xmd4.h : 1885 bytes
X md4 : 44ac5f61de4ff311b28f2cfcc4dbab99
X shs : dafdf2f0db16aafc1448cc85c72e17ccac95bb23
X md5 : 86cc0bcbd18a73f1b4123437b9769f0f
X haval : 58b4bc1b974069f1030759926b705dfa
Xmd5-if.c : 2964 bytes
X md4 : c06567cc83c254b77e86bd3d7a32fd40
X shs : 92925a403ca84a11654ced4074fee2188a32e458
X md5 : be9119aee609c6375046a3df1d75492e
X haval : e37ca5c533d46dcc7eec78dc2f16f233
Xmd5.c : 9847 bytes
X md4 : d84c616028ea36c08c26441c922ee4e0
X shs : 28c779bf5821d147e4cb43bfd1b52dfed138decd
X md5 : 394d19028b0774e842372ce6cfb971ea
X haval : 330dbb5ff4efc6c92492b1067ba52943
Xmd5.h : 1885 bytes
X md4 : 759872f325c96abce82e408e7f7153f8
X shs : f9978e289707aa2b8fe7d9ef3e5a3227a7db3018
X md5 : d7fa2167486edc450e7a1c73ae1eaada
X haval : 038ecea7854a1d024a55441633b240aa
Xmdigest.c : 10961 bytes
X md4 : 36d674aea8350948bfe1bb8051efd4ff
X shs : 3ed687237403187b77f25e4102fdf4b70cff8862
X md5 : fc43047ad2b642f845acecfdc88975bb
X haval : 4967a23bda802f8acf739dfa2c2bc6cb
Xmdigest.h : 8184 bytes
X md4 : bcde76cbc21787d133f3f255bf07344e
X shs : 6bdb9a733ada0e07d871193992462962c69b9750
X md5 : ffb96e9124d0e69741bd6475d566a51d
X haval : 8326ad6425ab95d13a13836251e70e97
Xmfile.c : 8644 bytes
X md4 : e6000a5b552dda4103679b1fede5690d
X shs : 20cfcd4c1efe86702891d60c2926fce32a5e8e18
X md5 : 8d4ace4e886820e123fd779e9253f66b
X haval : d43cb7cf0172a494d3f7a58e15511464
Xmtest.c : 11052 bytes
X md4 : 972ce79b66abf9b4d762318f9bfb40ce
X shs : c43195c45cb0f79c5cf95d3c6615d94e06e803df
X md5 : 0f7a7e2c5671f000b1d4e6d2b9ecf2b5
X haval : 5db33ece31d35e3526b294f67e5434b1
Xshs-if.c : 3568 bytes
X md4 : ca050edf795ef0a5d6db2f4df6ac2ccd
X shs : 5d05654a1bb62ec8308b815c454fe2e6ac8d8014
X md5 : f817be75acb95e6f06b013cf47f44761
X haval : c11cd17aad8024745957cb55f487f9f0
Xshs-old.c : 8625 bytes
X md4 : d7371df64f71187475ab94ee45a24c1f
X shs : e5c6a9d78f4d137a3cdfada467fa7fe28c6e1c55
X md5 : e69390167a9e3351a8126334a27eaf68
X haval : aabebccdd08e2b7d9e67cf1a069f9648
Xshs-old.h : 1237 bytes
X md4 : b5622e691981b7f2ea5b1fe8aa9c0ef5
X shs : 3004e0f2462db45d5fd2a4b5ff5520644a16f27a
X md5 : 2edf211dd753cedb1c0c9824eaab716d
X haval : 4a59a814c90a8180ce86c0c01a493f9b
Xshs.c : 12355 bytes
X md4 : 51b876be3c89e403877e589a2c1eb4fe
X shs : 86906cc236a78cb35f225b578a44c25ea91b3f57
X md5 : a90364e8128b70875ef5f199528c1025
X haval : 02dcaf11d501af82dbd93163853928a8
Xshs.h : 1619 bytes
X md4 : 7f5331a02c3fe9923901218e198dd691
X shs : 7a4182de7198c93466ed46f56afa229f2cd26e44
X md5 : 4a1d9b2cd015186d0848a52fbda0ed32
X haval : b2ebd0355313ceb85842491f82c2c4ee
Xutility.c : 3574 bytes
X md4 : 9eea7d930f09212c6353de51c5b031c0
X shs : bb100d514f8658b5451109a9b80f6d4a87608d4d
X md5 : 37d0e42deb7a9bccd13ebb3ab8707610
X haval : 5ef3fc0c3940395122754acab320875a
END_OF_FILE
if test 4908 -ne `wc -c <'CHECKSUMS'`; then
echo shar: \"'CHECKSUMS'\" unpacked with wrong size!
fi
# end of 'CHECKSUMS'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(598 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X
XCC = cc
XAR = ar
XRANLIB = ranlib
X
XCFLAGS = -I. -O4 #-Wall
XLDFLAGS = $(CFLAGS) -s
XARFLAGS = rc
X
XLIB = mdigest.a
XLIB_OBJS= mdigest.o utility.o \
X md4.o md4-if.o \
X md5.o md5-if.o \
X shs.o shs-if.o \
X haval.o haval-if.o
X
X# ---
X
Xall: $(LIB) mfile mtest
X
X# ---
X
X$(LIB): $(LIB_OBJS)
X rm -f $(LIB)
X $(AR) $(ARFLAGS) $(LIB) $(LIB_OBJS)
X $(RANLIB) $(LIB)
X
Xmfile: $(LIB) mfile.o
X $(CC) $(LDFLAGS) -o mfile mfile.o $(LIB)
X
Xmtest: $(LIB) mtest.o
X $(CC) $(LDFLAGS) -o mtest mtest.o $(LIB)
X
X# ---
X
Xclean:
X rm -f $(LIB_OBJS) mfile.o mtest.o a.out core
X
Xclobber: clean
X rm -f $(LIB) mfile mtest
X
END_OF_FILE
if test 598 -ne `wc -c <'Makefile'`; then
echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'haval-if.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'haval-if.c'\"
else
echo shar: Extracting \"'haval-if.c'\" \(3024 characters\)
sed "s/^X//" >'haval-if.c' <<'END_OF_FILE'
X
X/* -------------------------------------------------------------------- */
X/* */
X/* Secure Asyncronous Communications Subsystem (SACS) */
X/* (C) 1994 Matthew Gream <M.Gream@uts.edu.au> */
X/* */
X/* You have been given a limited license to use and distribute this */
X/* library. You should have received this license with the original */
X/* release package of this library, named "license.txt" and entitled */
X/* "SACS SOFTWARE LICENSE". In the event that you have not read or */
X/* understood this license, regardless of reason, you may do nothing */
X/* with this library other than read it for self-awareness. */
X/* */
X/* -------------------------------------------------------------------- */
X
X/* $Id: haval-if.c%v 0.90 1994/02/22 20:37:24 matt Exp $
X */
X
X/*
X * File: haval-if.c
X * Description: interface to haval message digest
X */
X
X#include <mdigest.h>
X#include "haval.h"
X
X
X/* -------------------------------------------------------------------- */
X/* function : HAVAL_CREATE */
X/* description : individually setup a haval context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XHAVAL_CREATE (ctx)
X md_ctx* ctx; /* context to setup */
X{
X if (ctx->priv == NULL)
X ((haval_state*)ctx->priv) = (haval_state*)mem_get (sizeof(haval_state), MEMOPT_CLEAR);
X
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : HAVAL_DESTROY */
X/* description : shutdown a previously allocated context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XHAVAL_DESTROY (ctx)
X md_ctx* ctx; /* context to deallocate */
X{
X if (ctx->priv != NULL)
X mem_free (ctx->priv);
X
X ctx->priv = NULL;
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : HAVAL_REGISTER */
X/* description : register and setup haval info structure */
X/* -------------------------------------------------------------------- */
XGLOBAL err_code
XHAVAL_REGISTER (m)
X md_info* m; /* info structure to fill out */
X{
X m->block_sz = 128;
X m->hash_sz = FPTLEN >> 3;
X
X m->create = HAVAL_CREATE;
X m->destroy = HAVAL_DESTROY;
X m->deregister = NULL;
X
X m->init = haval_start;
X m->update = haval_hash;
X m->final = haval_end;
X
X return (err_ok);
X}
X
X/* -------------------------------------------------------------------- */
X
END_OF_FILE
if test 3024 -ne `wc -c <'haval-if.c'`; then
echo shar: \"'haval-if.c'\" unpacked with wrong size!
fi
# end of 'haval-if.c'
fi
if test -f 'haval.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'haval.h'\"
else
echo shar: Extracting \"'haval.h'\" \(2980 characters\)
sed "s/^X//" >'haval.h' <<'END_OF_FILE'
X
X/* -- derived from original havalapp.h and haval.h
X * -- mgream: endian definitions not needed, they are computed run time
X * -- mgream: changed prototypes from ansi (for compat)
X *
X * havalapp.h: specifies the following three constants needed to
X * compile the HAVAL hashing library:
X * LITTLE_ENDIAN, PASS and FPTLEN
X *
X * Descriptions:
X *
X * LITTLE_ENDIAN define this only if your machine is little-endian
X * (such as 80X86 family).
X *
X * Note:
X * 1. In general, HAVAL is faster on a little endian
X * machine than on a big endian one.
X *
X * 2. The test program "havaltest.c" provides an option
X * for testing the endianity of your machine.
X *
X * 3. The speed of HAVAL is even more remarkable on a
X * machine that has a large number of internal registers.
X *
X * PASS define the number of passes (3, 4, or 5)
X * FPTLEN define the length of a fingerprint (128, 160, 192, 224 or 256)
X */
X
X/*#define LITTLE_ENDIAN*/
X
X#ifndef PASS
X#define PASS 3 /* 3, 4, or 5 */
X#endif
X
X#ifndef FPTLEN
X#define FPTLEN 128 /* 128, 160, 192, 224 or 256 */
X#endif
X
X/*
X * haval.h: specifies the interface to the HAVAL (V.1) hashing library.
X *
X * HAVAL is a one-way hashing algorithm with the following
X * collision-resistant property:
X * It is computationally infeasible to find two or more
X * messages that are hashed into the same fingerprint.
X *
X * Reference:
X * Y. Zheng, J. Pieprzyk and J. Seberry:
X * ``HAVAL --- a one-way hashing algorithm with variable
X * length of output'', Advances in Cryptology --- AUSCRYPT'92,
X * Lecture Notes in Computer Science, Springer-Verlag, 1993.
X *
X * This library provides routines to hash
X * - a string,
X * - a file,
X * - input from the standard input device,
X * - a 32-word block, and
X * - a string of specified length.
X *
X * Author: Yuliang Zheng
X * Department of Computer Science
X * University of Wollongong
X * Wollongong, NSW 2522, Australia
X * Email: yuliang@cs.uow.edu.au
X * Voice: +61 42 21 4331 (office)
X *
X * Date: June 1993
X *
X * Copyright (C) 1993 by C^3SR. All rights reserved.
X * This program may not be sold or used as inducement to
X * buy a product without the written permission of C^3SR.
X */
X
Xtypedef unsigned long int haval_word; /* a HAVAL word = 32 bits */
X
Xtypedef struct {
X haval_word count[2]; /* number of bits in a message */
X haval_word fingerprint[8]; /* current state of fingerprint */
X haval_word block[32]; /* buffer for a 32-word block */
X unsigned char remainder[32*4]; /* unhashed chars (No.<128) */
X} haval_state;
X
Xvoid haval_start ();
Xvoid haval_hash ();
Xvoid haval_end ();
X
END_OF_FILE
if test 2980 -ne `wc -c <'haval.h'`; then
echo shar: \"'haval.h'\" unpacked with wrong size!
fi
# end of 'haval.h'
fi
if test -f 'license.txt' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'license.txt'\"
else
echo shar: Extracting \"'license.txt'\" \(3733 characters\)
sed "s/^X//" >'license.txt' <<'END_OF_FILE'
X
XSACS LIBRARY SOFTWARE LICENSE
X
X
XMatthew Gream
XM.Gream@uts.edu.au
X+61-2-821-2043
XMarch 1994
X
X
X-- BEGIN LICENCE --
X
XUnless specifically authorized in writing by the author of this
Xlibrary, you are given a limited license to use and distributed
Xthis library and software incorporating elements of this library
Xin accordance with the following conditions:
X
X 1. WARRANTIES AND SUITABILITY TO TASK
X
X This library comes with no warranties at all, either expressed
X or implied. This includes such warranties as merchantability
X or fitness for a particular purpose. There is no guarantee
X whatsoever that this library will perform as per expected and
X described operation.
X
X 2. COST RECOVERY
X
X Except to recover reasonable costs for media and distribution
X purposes, monies or payment in any form whatsoever for this
X library or creations incorporating any element of this library
X may not be made.
X
X 3. MODIFICATION AND/OR DISTRIBUTION
X
X You many not modify and/or distribute modified copies of this
X library or provide mechanisms for creating modified versions
X of this library without prior consent of the author. You may,
X however, for the purposes of integration and development of
X software using elements of this library make minimal and
X reasonable changes to ensure this library will compile on an
X otherwise incompatible operating system. These modifications
X must not change the functionality of the library and must
X interoperate with existing unmodified versions of this
X library.
X
X 4. COPYRIGHT AND CREATION NOTICES
X
X Any software incorporating or using elements of this library
X must ensure that notice is placed in such software or
X accompanying documentation so as to give credit to the
X authorship, copyright ownership and current version of this
X library.
X
X 5. NOTIFICATION OF USE
X
X Reasonable attempts must be made to notify the author of this
X library of the existence and generation of any software that
X incorporates elements of this library. Further, reasonable
X attempts must be made to provide the author with a copy of
X such software.
X
X
X-- END LICENSE --
X
X
XA rough english-speak translation of the above is as such (this
Xdoes not constitute part of the license, but merely attempts to
Xexplain it):
X
X Unless I specifically say so, all the following holds. Which
X means I may of course relax any or all of the following
X restrictions or modify them on request.
X
X This library is free, and you are allowed to use it for free
X providing you or someone isn't going to make any money out of
X it. Shareware or commercial use maybe considered upon
X application to the author. At the same time, this library is
X centrally controlled in terms of modifications and future
X revisions. This means that only I as the author can release
X new versions of any form, though you are welcome to submit
X patches or improvements to me. This means you are not allowed
X to distribute modified copies of this library or software to
X generate modified copies of this library.
X
X I do this to prevent splinters in the source tree, and to
X maintain compatibility. I do allow the distribution of patches
X that fix existing bugs or incompatibilities with particular
X operating systems, provided the patches don't change the way
X the library operates and don't stop it interoperating with
X unmodified versions of the library.
X
X I also ask that you make best efforts to send me, or notify me
X about how to retrieve a copy of any software which uses this
X library. The reason I ask this is that feedback of this sort
X is important in determining modifications and future
X directions of the library. By the same token, I welcome any
X _constructive_ criticisms, comments and suggestions.
X
X
X
END_OF_FILE
if test 3733 -ne `wc -c <'license.txt'`; then
echo shar: \"'license.txt'\" unpacked with wrong size!
fi
# end of 'license.txt'
fi
if test -f 'md4-if.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md4-if.c'\"
else
echo shar: Extracting \"'md4-if.c'\" \(2963 characters\)
sed "s/^X//" >'md4-if.c' <<'END_OF_FILE'
X
X/* -------------------------------------------------------------------- */
X/* */
X/* Secure Asyncronous Communications Subsystem (SACS) */
X/* (C) 1994 Matthew Gream <M.Gream@uts.edu.au> */
X/* */
X/* You have been given a limited license to use and distribute this */
X/* library. You should have received this license with the original */
X/* release package of this library, named "license.txt" and entitled */
X/* "SACS SOFTWARE LICENSE". In the event that you have not read or */
X/* understood this license, regardless of reason, you may do nothing */
X/* with this library other than read it for self-awareness. */
X/* */
X/* -------------------------------------------------------------------- */
X
X/* $Id: md4-if.c%v 0.90 1994/02/22 20:37:24 matt Exp $
X */
X
X/*
X * File: md4-if.c
X * Description: interface to md4
X */
X
X#include <mdigest.h>
X#include "md4.h"
X
X
X/* -------------------------------------------------------------------- */
X/* function : MD4_CREATE */
X/* description : individually setup a md4 context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XMD4_CREATE (ctx)
X md_ctx* ctx; /* context to setup */
X{
X if (ctx->priv == NULL)
X ((MD4_CTX*)ctx->priv) = (MD4_CTX*)mem_get (sizeof(MD4_CTX), MEMOPT_CLEAR);
X
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : MD4_DESTROY */
X/* description : shutdown a previously allocated context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XMD4_DESTROY (ctx)
X md_ctx* ctx; /* context to deallocate */
X{
X if (ctx->priv != NULL)
X mem_free (ctx->priv);
X
X ctx->priv = NULL;
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : MD4_REGISTER */
X/* description : register and setup md4 info structure */
X/* -------------------------------------------------------------------- */
XGLOBAL err_code
XMD4_REGISTER (m)
X md_info* m; /* info structure to fill out */
X{
X m->block_sz = 64;
X m->hash_sz = 16;
X
X m->create = MD4_CREATE;
X m->destroy = MD4_DESTROY;
X m->deregister = NULL;
X
X m->init = MD4Init;
X m->update = MD4Update;
X m->final = MD4Final;
X
X return (err_ok);
X}
X
X/* -------------------------------------------------------------------- */
X
END_OF_FILE
if test 2963 -ne `wc -c <'md4-if.c'`; then
echo shar: \"'md4-if.c'\" unpacked with wrong size!
fi
# end of 'md4-if.c'
fi
if test -f 'md4.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md4.h'\"
else
echo shar: Extracting \"'md4.h'\" \(1885 characters\)
sed "s/^X//" >'md4.h' <<'END_OF_FILE'
X
X/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
X rights reserved.
X
X License to copy and use this software is granted provided that it
X is identified as the "RSA Data Security, Inc. MD4 Message-Digest
X Algorithm" in all material mentioning or referencing this software
X or this function.
X
X License is also granted to make and use derivative works provided
X that such works are identified as "derived from the RSA Data
X Security, Inc. MD4 Message-Digest Algorithm" in all material
X mentioning or referencing the derived work.
X
X RSA Data Security, Inc. makes no representations concerning either
X the merchantability of this software or the suitability of this
X software for any particular purpose. It is provided "as is"
X without express or implied warranty of any kind.
X
X These notices must be retained in any copies of any part of this
X documentation and/or software.
X */
X
X#ifndef PROTOTYPES
X#define PROTOTYPES 0
X#endif
X
X/* POINTER defines a generic pointer type */
Xtypedef unsigned char *POINTER;
X
X/* UINT2 defines a two byte word */
Xtypedef unsigned short int UINT2;
X
X/* UINT4 defines a four byte word */
Xtypedef unsigned long int UINT4;
X
X/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
X If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
X returns an empty list.
X */
X
X#if PROTOTYPES
X#define PROTO_LIST(list) list
X#else
X#define PROTO_LIST(list) ()
X#endif
X
X/* MD4 context. */
Xtypedef struct {
X UINT4 state[4]; /* state (ABCD) */
X UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
X unsigned char buffer[64]; /* input buffer */
X} MD4_CTX;
X
Xvoid MD4Init PROTO_LIST ((MD4_CTX *));
Xvoid MD4Update PROTO_LIST ((MD4_CTX *, unsigned char *, unsigned int));
Xvoid MD4Final PROTO_LIST ((MD4_CTX*, unsigned char [16]));
X
END_OF_FILE
if test 1885 -ne `wc -c <'md4.h'`; then
echo shar: \"'md4.h'\" unpacked with wrong size!
fi
# end of 'md4.h'
fi
if test -f 'md5-if.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md5-if.c'\"
else
echo shar: Extracting \"'md5-if.c'\" \(2964 characters\)
sed "s/^X//" >'md5-if.c' <<'END_OF_FILE'
X
X/* -------------------------------------------------------------------- */
X/* */
X/* Secure Asyncronous Communications Subsystem (SACS) */
X/* (C) 1994 Matthew Gream <M.Gream@uts.edu.au> */
X/* */
X/* You have been given a limited license to use and distribute this */
X/* library. You should have received this license with the original */
X/* release package of this library, named "license.txt" and entitled */
X/* "SACS SOFTWARE LICENSE". In the event that you have not read or */
X/* understood this license, regardless of reason, you may do nothing */
X/* with this library other than read it for self-awareness. */
X/* */
X/* -------------------------------------------------------------------- */
X
X/* $Id: md5-if.c%v 0.90 1994/02/22 20:37:24 matt Exp $
X */
X
X/*
X * File: md5-if.c
X * Description: interface to md5
X */
X
X#include <mdigest.h>
X#include "md5.h"
X
X
X/* -------------------------------------------------------------------- */
X/* function : MD5_CREATE */
X/* description : individually setup a md5 context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XMD5_CREATE (ctx)
X md_ctx* ctx; /* context to setup */
X{
X if (ctx->priv == NULL)
X ((MD5_CTX*)ctx->priv) = (MD5_CTX*)mem_get (sizeof(MD5_CTX), MEMOPT_CLEAR);
X
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : MD5_DESTROY */
X/* description : shutdown a previously allocated context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XMD5_DESTROY (ctx)
X md_ctx* ctx; /* context to deallocate */
X{
X if (ctx->priv != NULL)
X mem_free (ctx->priv);
X
X ctx->priv = NULL;
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : MD5_REGISTER */
X/* description : register and setup md5 info structure */
X/* -------------------------------------------------------------------- */
XGLOBAL err_code
XMD5_REGISTER (m)
X md_info* m; /* info structure to fill out */
X{
X m->block_sz = 64;
X m->hash_sz = 16;
X
X m->create = MD5_CREATE;
X m->destroy = MD5_DESTROY;
X m->deregister = NULL;
X
X m->init = MD5Init;
X m->update = MD5Update;
X m->final = MD5Final;
X
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X
END_OF_FILE
if test 2964 -ne `wc -c <'md5-if.c'`; then
echo shar: \"'md5-if.c'\" unpacked with wrong size!
fi
# end of 'md5-if.c'
fi
if test -f 'md5.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md5.h'\"
else
echo shar: Extracting \"'md5.h'\" \(1885 characters\)
sed "s/^X//" >'md5.h' <<'END_OF_FILE'
X
X/* derived from: MD5.H - header file for MD5C.C
X */
X
X/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
Xrights reserved.
X
XLicense to copy and use this software is granted provided that it
Xis identified as the "RSA Data Security, Inc. MD5 Message-Digest
XAlgorithm" in all material mentioning or referencing this software
Xor this function.
X
XLicense is also granted to make and use derivative works provided
Xthat such works are identified as "derived from the RSA Data
XSecurity, Inc. MD5 Message-Digest Algorithm" in all material
Xmentioning or referencing the derived work.
X
XRSA Data Security, Inc. makes no representations concerning either
Xthe merchantability of this software or the suitability of this
Xsoftware for any particular purpose. It is provided "as is"
Xwithout express or implied warranty of any kind.
XThese notices must be retained in any copies of any part of this
Xdocumentation and/or software.
X */
X
X#ifndef PROTOTYPES
X#define PROTOTYPES 0
X#endif
X
X/* POINTER defines a generic pointer type */
Xtypedef unsigned char *POINTER;
X
X/* UINT2 defines a two byte word */
Xtypedef unsigned short int UINT2;
X
X/* UINT4 defines a four byte word */
Xtypedef unsigned long int UINT4;
X
X/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
XIf using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
X returns an empty list.
X */
X#if PROTOTYPES
X#define PROTO_LIST(list) list
X#else
X#define PROTO_LIST(list) ()
X#endif
X
X/* MD5 context. */
Xtypedef struct {
X UINT4 state[4]; /* state (ABCD) */
X UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
X unsigned char buffer[64]; /* input buffer */
X} MD5_CTX;
X
Xvoid MD5Init PROTO_LIST ((MD5_CTX *));
Xvoid MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int));
Xvoid MD5Final PROTO_LIST ((MD5_CTX*, unsigned char [16]));
X
END_OF_FILE
if test 1885 -ne `wc -c <'md5.h'`; then
echo shar: \"'md5.h'\" unpacked with wrong size!
fi
# end of 'md5.h'
fi
if test -f 'mdigest.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'mdigest.h'\"
else
echo shar: Extracting \"'mdigest.h'\" \(8184 characters\)
sed "s/^X//" >'mdigest.h' <<'END_OF_FILE'
X
X/* -------------------------------------------------------------------- */
X/* */
X/* Secure Asyncronous Communications Subsystem (SACS) */
X/* (C) 1994 Matthew Gream <M.Gream@uts.edu.au> */
X/* */
X/* You have been given a limited license to use and distribute this */
X/* library. You should have received this license with the original */
X/* release package of this library, named "license.txt" and entitled */
X/* "SACS SOFTWARE LICENSE". In the event that you have not read or */
X/* understood this license, regardless of reason, you may do nothing */
X/* with this library other than read it for self-awareness. */
X/* */
X/* -------------------------------------------------------------------- */
X
X/* $Id: mdigest.h%v 0.90 1994/02/22 20:37:24 matt Exp $
X */
X
X/*
X * File: mdigest.h
X * Description: Message digest header file
X */
X
X#ifndef _MDIGEST_H_
X#define _MDIGEST_H_
X
X/* -------------------------------------------------------------------- */
X/* header files */
X/* -------------------------------------------------------------------- */
X
X#include <stdio.h>
X#include <strings.h>
X#include <stdlib.h>
X#include <unistd.h>
X
X/* -------------------------------------------------------------------- */
X/* usual low level type castings */
X/* -------------------------------------------------------------------- */
X
Xtypedef unsigned char word8; /* defined as per bit size */
Xtypedef unsigned short word16;
Xtypedef unsigned long word32;
X
Xtypedef int word; /* ''generic'' integer */
X
Xtypedef unsigned char* opaque; /* arbitrary data segments */
Xtypedef char* string; /* character strings */
X
Xtypedef void (*handler)(); /* void function handler */
X
X/* -------------------------------------------------------------------- */
X/* nearly all functions return error codes as defined below */
X/* -------------------------------------------------------------------- */
X
Xtypedef enum
X {
X err_ok = 0, /* no error occured */
X err_no_memory = 1, /* memory allocation failed */
X err_invalid_params = 2, /* invalid parameters passed */
X err_file_not_found = 3, /* can't find a requested filename */
X err_cant_open_file = 4, /* can't open a requested filename */
X err_invalid_alg = 5, /* unknown algorithm from somewhere */
X err_already_exist = 6, /* something already exists */
X err_no_space = 7, /* internal table/etc is full */
X err_not_found = 8, /* something was not found */
X err_no_more = 9, /* no more is available */
X err_not_init = 10, /* not initialised */
X err_unknown = 255, /* unknown error */
X } err_code;
X
Xtypedef err_code (*function)(); /* general function handler */
X
X
X/* -------------------------------------------------------------------- */
X/* macros for general purpose use */
X/* -------------------------------------------------------------------- */
X
X#ifndef min
X# define min(a, b) ( ((a) <= (b)) ? (a) : (b) )
X# define max(a, b) ( ((a) >= (b)) ? (a) : (b) )
X#endif
X
X#ifndef TRUE
X# define TRUE (1)
X# define FALSE (0)
X#endif
X
X#define BIT_POS(x) (1L<<(x)) /* specific bit position */
X#define ident_sz (16) /* identifer sizes in the system */
X
X#define GLOBAL /* functions for rest of the world */
X#define STATIC static /* local to specific file */
X#define reg register /* quick defn for register vars */
X
X
X/* -------------------------------------------------------------------- */
X/* simple bitstring class and operators */
X/* -------------------------------------------------------------------- */
X
Xtypedef word32 bitstring;
X
X#define bit_max (sizeof(bitstring)<<3)
X#define bit_set(s, b) ((s) |= (1L<<(b))
X#define bit_clr(s, b) ((s) &= ~(1L<<(b))
X#define bit_zero(s) (s) = ((bitstring)0L)
X#define bit_inv(s) (s) ^= ((bitstring)0xffffffff)
X#define bit_chk(s, b) ((((s) &= ~(1L<<(b))) == 0) ? FALSE : TRUE)
X
X#define bit_pos(b) (1L<<(b))
X#define bit_empty (0L)
X
X
X/* -------------------------------------------------------------------- */
X/* debug facilities */
X/* -------------------------------------------------------------------- */
X
X#define DEBUG_FUNCTION_ENTER(f)
X
X
X/* -------------------------------------------------------------------- */
X/* memory.c requirements */
X/* -------------------------------------------------------------------- */
X
X#define MEMOPT_NONE bit_empty /* no options */
X#define MEMOPT_CLEAR bit_pos(0) /* clear segment before use */
X
X
X/* -------------------------------------------------------------------- */
X/* max number of registerable hash functions */
X/* -------------------------------------------------------------------- */
X
X#define md_max_reg (8)
X
X
X/* -------------------------------------------------------------------- */
X/* at registration, each algorithm provides function handlers and other */
X/* information */
X/* -------------------------------------------------------------------- */
X
Xtypedef struct
X {
X char ident[ident_sz+1]; /* id string */
X
X word block_sz; /* input block size in bytes */
X word hash_sz; /* output has size in bytes */
X
X function create; /* creation handler */
X function destroy; /* destruction */
X function deregister; /* deregistration */
X
X handler init; /* init for start of hash */
X handler update; /* update for hash */
X handler final; /* final and calc digest */
X
X } md_info;
X
X/* -------------------------------------------------------------------- */
X/* each association with the module uses its own context: */
X/* -------------------------------------------------------------------- */
X
Xtypedef struct
X {
X md_info *info; /* ptr to above info block */
X opaque priv; /* private structure */
X
X } md_ctx;
X
X
X#define md_create(c) (*((c)->info->create))(c) /* not for user */
X#define md_destroy(c) (*((c)->info->destroy))(c) /* not for user */
X
X#define md_init(c) (*((c)->info->init))((c)->priv) /* u */
X#define md_update(c,d,l) (*((c)->info->update))((c)->priv,d,l) /* u */
X#define md_final(c,o) (*((c)->info->final))((c)->priv,o) /* u */
X
X#define md_hash_sz(c) ((c)->info->hash_sz)
X#define md_block_sz(c) ((c)->info->block_sz)
X#define md_id(c) ((c)->info->ident)
X
X
X/* -------------------------------------------------------------------- */
X/* prototypes -- k'n'r */
X
Xopaque mem_get ();
Xvoid mem_free ();
Xstring sacs_err_msg ();
Xmd_info* md_lookup_id ();
Xerr_code md_register ();
Xerr_code md_deregister ();
Xerr_code md_mod_open ();
Xerr_code md_mod_close ();
Xerr_code md_open ();
Xerr_code md_close ();
Xerr_code md_list_init ();
Xerr_code md_list_next ();
X
X/* -------------------------------------------------------------------- */
X#endif /*_MDIGEST_H_*/
X
END_OF_FILE
if test 8184 -ne `wc -c <'mdigest.h'`; then
echo shar: \"'mdigest.h'\" unpacked with wrong size!
fi
# end of 'mdigest.h'
fi
if test -f 'shs-if.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'shs-if.c'\"
else
echo shar: Extracting \"'shs-if.c'\" \(3568 characters\)
sed "s/^X//" >'shs-if.c' <<'END_OF_FILE'
X
X/* -------------------------------------------------------------------- */
X/* */
X/* Secure Asyncronous Communications Subsystem (SACS) */
X/* (C) 1994 Matthew Gream <M.Gream@uts.edu.au> */
X/* */
X/* You have been given a limited license to use and distribute this */
X/* library. You should have received this license with the original */
X/* release package of this library, named "license.txt" and entitled */
X/* "SACS SOFTWARE LICENSE". In the event that you have not read or */
X/* understood this license, regardless of reason, you may do nothing */
X/* with this library other than read it for self-awareness. */
X/* */
X/* -------------------------------------------------------------------- */
X
X/* $Id: shs-if.c%v 0.90 1994/02/22 20:37:24 matt Exp $
X */
X
X/*
X * File: shs-if.c
X * Description: interface to nist shs
X */
X
X#include <mdigest.h>
X#include "shs.h"
X
X
X/* -------------------------------------------------------------------- */
X/* function : SHS_FINAL */
X/* description : perform the final operation, so as to copy in digest */
X/* -------------------------------------------------------------------- */
XSTATIC void
XSHS_FINAL (shsInfo, digest)
X SHS_INFO* shsInfo; /* private shsinfo structure */
X opaque digest; /* where to place digest */
X{
X shsFinal (shsInfo);
X memcpy (digest, shsInfo->digest, SHS_DIGESTSIZE);
X}
X
X/* -------------------------------------------------------------------- */
X/* function : SHS_CREATE */
X/* description : individually setup a SHS context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XSHS_CREATE (ctx)
X md_ctx* ctx; /* context to setup */
X{
X if (ctx->priv == NULL)
X ((SHS_INFO*)ctx->priv) = (SHS_INFO*)mem_get (sizeof(SHS_INFO), MEMOPT_CLEAR);
X
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : SHS_DESTROY */
X/* description : shutdown a previously allocated context */
X/* -------------------------------------------------------------------- */
XSTATIC err_code
XSHS_DESTROY (ctx)
X md_ctx* ctx; /* context to deallocate */
X{
X if (ctx->priv != NULL)
X mem_free (ctx->priv);
X
X ctx->priv = NULL;
X return (err_ok);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : SHS_REGISTER */
X/* description : register and setup SHS info structure */
X/* -------------------------------------------------------------------- */
XGLOBAL err_code
XSHS_REGISTER (m)
X md_info* m; /* info structure to fill out */
X{
X m->block_sz = SHS_BLOCKSIZE;
X m->hash_sz = SHS_DIGESTSIZE;
X
X m->create = SHS_CREATE;
X m->destroy = SHS_DESTROY;
X m->deregister = NULL;
X
X m->init = shsInit;
X m->update = shsUpdate;
X m->final = SHS_FINAL;
X
X return (err_ok);
X}
X
X/* -------------------------------------------------------------------- */
X
END_OF_FILE
if test 3568 -ne `wc -c <'shs-if.c'`; then
echo shar: \"'shs-if.c'\" unpacked with wrong size!
fi
# end of 'shs-if.c'
fi
if test -f 'shs.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'shs.h'\"
else
echo shar: Extracting \"'shs.h'\" \(1619 characters\)
sed "s/^X//" >'shs.h' <<'END_OF_FILE'
X
X/* --------------------------------- SHS.H ------------------------------- */
X
X/* NIST proposed Secure Hash Standard.
X
X Written 2 September 1992, Peter C. Gutmann.
X This implementation placed in the public domain.
X
X Modified 1 June 1993, Colin Plumb.
X These modifications placed in the public domain.
X
X mgream: feb/94, changed from ANSI to KNR args/protos for compat.
X mgream: added runtime endian check
X
X Comments to pgut1@cs.aukuni.ac.nz */
X
X/* Useful defines/typedefs */
X
Xtypedef unsigned char BYTE;
X
X/* Since 64-bit machines are the wave of the future, we may as well
X support them directly. */
X
X#ifdef FORCE32
X
X#undef HAVE64
X
X#else /* !FORCE32 */
X
X#if __alpha /* Or other machines? */
X#define HAVE64 1
Xtypedef unsigned long WORD64;
X#endif
X
X#if __GNUC__
X#define HAVE64 1
Xtypedef unsigned long long WORD64;
X#endif
X
X#endif /* !FORCE32 */
X
X#ifdef HAVE64
Xtypedef unsigned int WORD32;
X#else
Xtypedef unsigned long WORD32;
X#endif
X
X/* The SHS block size and message digest sizes, in bytes */
X
X#define SHS_BLOCKSIZE 64
X#define SHS_DIGESTSIZE 20
X
X/* The structure for storing SHS info
X data[] is placed first in case offsets of 0 are faster
X for some reason; it's the most often accessed field. */
X
Xtypedef struct {
X WORD32 data[ 16 ]; /* SHS data buffer */
X WORD32 digest[ 5 ]; /* Message digest */
X#ifdef HAVE64
X WORD64 count;
X#else
X WORD32 countHi, countLo; /* 64-bit bit count */
X#endif
X} SHS_INFO;
X
X/* Whether the machine is little-endian or not */
X
X/*#define LITTLE_ENDIAN -- obselete (mgream) */
X
X/* shs.c */
Xvoid shsInit();
Xvoid shsTransform();
Xvoid shsUpdate();
Xvoid shsFinal();
X
END_OF_FILE
if test 1619 -ne `wc -c <'shs.h'`; then
echo shar: \"'shs.h'\" unpacked with wrong size!
fi
# end of 'shs.h'
fi
if test -f 'utility.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'utility.c'\"
else
echo shar: Extracting \"'utility.c'\" \(3574 characters\)
sed "s/^X//" >'utility.c' <<'END_OF_FILE'
X
X/* -------------------------------------------------------------------- */
X/* */
X/* Secure Asyncronous Communications Subsystem (SACS) */
X/* (C) 1994 Matthew Gream <M.Gream@uts.edu.au> */
X/* */
X/* You have been given a limited license to use and distribute this */
X/* library. You should have received this license with the original */
X/* release package of this library, named "license.txt" and entitled */
X/* "SACS SOFTWARE LICENSE". In the event that you have not read or */
X/* understood this license, regardless of reason, you may do nothing */
X/* with this library other than read it for self-awareness. */
X/* */
X/* -------------------------------------------------------------------- */
X
X/* $Id: memory.c%v 0.81 1994/02/12 10:08:43 matt Exp $
X */
X
X/*
X * File: utility.c
X * Description: misc utility stuff
X */
X
X#include <mdigest.h>
X
X
X/* -------------------------------------------------------------------- */
X/* function : mem_get */
X/* description : allocate and return 'req_size' bytes of memory, clear */
X/* if MEMOPT_CLEAR flag is present. Failures are hard. */
X/* -------------------------------------------------------------------- */
XGLOBAL opaque
Xmem_get (req_size, req_options)
X word req_size; /* size of memory requested */
X bitstring req_options; /* options for allocated mem */
X{
X opaque seg_addr;
X
X DEBUG_FUNCTION_ENTER("mem_get");
X
X /* ---------------------------------------------------------------- */
X /* code should never request zero size segments -- deal with it by */
X /* returning NULL pointer. */
X /* ---------------------------------------------------------------- */
X
X if (req_size == 0)
X return ((opaque)NULL);
X
X /* ---------------------------------------------------------------- */
X /* if allocation request fails, call error handler and indicate a */
X /* fatal error with appropriate error code */
X /* ---------------------------------------------------------------- */
X
X seg_addr = (opaque)malloc (req_size);
X if (seg_addr == NULL)
X {
X /*sacs_hard_error (err_no_memory);*/
X fprintf (stderr, "malloc failed.\n");
X exit (1);
X /* not reached */
X }
X
X /* ---------------------------------------------------------------- */
X /* clear segment if we were specifically asked to do so */
X /* ---------------------------------------------------------------- */
X
X if (bit_chk (req_options, MEMOPT_CLEAR) == TRUE)
X memset (seg_addr, '\0', req_size);
X
X return (seg_addr);
X}
X
X
X/* -------------------------------------------------------------------- */
X/* function : mem_free */
X/* description : release memory segment previously allocated */
X/* -------------------------------------------------------------------- */
XGLOBAL void
Xmem_free (seg_addr)
X opaque seg_addr; /* address of mem segment */
X{
X DEBUG_FUNCTION_ENTER("mem_free");
X
X if (seg_addr != NULL)
X free (seg_addr);
X}
X
X/* -------------------------------------------------------------------- */
X
END_OF_FILE
if test 3574 -ne `wc -c <'utility.c'`; then
echo shar: \"'utility.c'\" unpacked with wrong size!
fi
# end of 'utility.c'
fi
echo shar: End of archive 3 \(of 3\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 3 archives.
rm -f ark[1-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...