From de8f24ea083384bb66b32ec105dc4743c5663cdf Mon Sep 17 00:00:00 2001 From: beck <> Date: Wed, 29 Sep 1999 04:37:45 +0000 Subject: OpenSSL 0.9.4 merge --- src/lib/libcrypto/md2/Makefile.ssl | 40 ++++++++------ src/lib/libcrypto/md2/md2.c | 20 ++----- src/lib/libcrypto/md2/md2.h | 91 +++++++++++++++++++++++++++++++ src/lib/libcrypto/md2/md2.org | 106 ------------------------------------- src/lib/libcrypto/md2/md2_dgst.c | 28 +++------- src/lib/libcrypto/md2/md2_one.c | 23 ++++++-- src/lib/libcrypto/md2/md2test.c | 27 ++++++---- 7 files changed, 161 insertions(+), 174 deletions(-) create mode 100644 src/lib/libcrypto/md2/md2.h delete mode 100644 src/lib/libcrypto/md2/md2.org (limited to 'src/lib/libcrypto/md2') diff --git a/src/lib/libcrypto/md2/Makefile.ssl b/src/lib/libcrypto/md2/Makefile.ssl index d8e7200c83..67ce450788 100644 --- a/src/lib/libcrypto/md2/Makefile.ssl +++ b/src/lib/libcrypto/md2/Makefile.ssl @@ -7,9 +7,11 @@ TOP= ../.. CC= cc INCLUDES= CFLAG=-g +INSTALL_PREFIX= +OPENSSLDIR= /usr/local/ssl INSTALLTOP=/usr/local/ssl MAKE= make -f Makefile.ssl -MAKEDEPEND= makedepend -f Makefile.ssl +MAKEDEPEND= $(TOP)/util/domd $(TOP) MAKEFILE= Makefile.ssl AR= ar r @@ -20,7 +22,7 @@ TEST=md2test.c APPS= LIB=$(TOP)/libcrypto.a -LIBSRC=md2_dgst.c md5_one.c +LIBSRC=md2_dgst.c md2_one.c LIBOBJ=md2_dgst.o md2_one.o SRC= $(LIBSRC) @@ -37,24 +39,23 @@ all: lib lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) - sh $(TOP)/util/ranlib.sh $(LIB) + $(RANLIB) $(LIB) @touch lib files: - perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO links: - /bin/rm -f Makefile - $(TOP)/util/point.sh Makefile.ssl Makefile ; - $(TOP)/util/mklink.sh ../../include $(EXHEADER) - $(TOP)/util/mklink.sh ../../test $(TEST) - $(TOP)/util/mklink.sh ../../apps $(APPS) + @$(TOP)/util/point.sh Makefile.ssl Makefile + @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) + @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) + @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) install: @for i in $(EXHEADER) ; \ do \ - (cp $$i $(INSTALLTOP)/include/$$i; \ - chmod 644 $(INSTALLTOP)/include/$$i ); \ + (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ + chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ done; tags: @@ -66,15 +67,22 @@ lint: lint -DLINT $(INCLUDES) $(SRC)>fluff depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new mv -f Makefile.new $(MAKEFILE) clean: - /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -errors: + rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff # DO NOT DELETE THIS LINE -- make depend depends on it. + +md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h +md2_dgst.o: ../../include/openssl/opensslv.h +md2_one.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h +md2_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +md2_one.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h +md2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/stack.h +md2_one.o: ../cryptlib.h diff --git a/src/lib/libcrypto/md2/md2.c b/src/lib/libcrypto/md2/md2.c index 7f3ab64a43..f4d6f62264 100644 --- a/src/lib/libcrypto/md2/md2.c +++ b/src/lib/libcrypto/md2/md2.c @@ -58,25 +58,15 @@ #include #include -#include "md2.h" +#include #define BUFSIZE 1024*16 -#ifndef NOPROTO void do_fp(FILE *f); void pt(unsigned char *md); int read(int, void *, unsigned int); void exit(int); -#else -void do_fp(); -void pt(); -int read(); -void exit(); -#endif - -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int i,err=0; FILE *IN; @@ -105,8 +95,7 @@ char *argv[]; return(err); } -void do_fp(f) -FILE *f; +void do_fp(FILE *f) { MD2_CTX c; unsigned char md[MD2_DIGEST_LENGTH]; @@ -125,8 +114,7 @@ FILE *f; pt(md); } -void pt(md) -unsigned char *md; +void pt(unsigned char *md) { int i; diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h new file mode 100644 index 0000000000..0d3592506c --- /dev/null +++ b/src/lib/libcrypto/md2/md2.h @@ -0,0 +1,91 @@ +/* crypto/md/md2.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD2_H +#define HEADER_MD2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef NO_MD2 +#error MD2 is disabled. +#endif + +#define MD2_DIGEST_LENGTH 16 +#define MD2_BLOCK 16 +#include /* MD2_INT */ + +typedef struct MD2state_st + { + int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; + } MD2_CTX; + +const char *MD2_options(void); +void MD2_Init(MD2_CTX *c); +void MD2_Update(MD2_CTX *c, register unsigned char *data, unsigned long len); +void MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(unsigned char *d, unsigned long n,unsigned char *md); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/libcrypto/md2/md2.org b/src/lib/libcrypto/md2/md2.org deleted file mode 100644 index 9f39933790..0000000000 --- a/src/lib/libcrypto/md2/md2.org +++ /dev/null @@ -1,106 +0,0 @@ -/* crypto/md/md2.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify md2.org since md2.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - - -#ifndef HEADER_MD2_H -#define HEADER_MD2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define MD2_DIGEST_LENGTH 16 -#define MD2_BLOCK 16 - -#define MD2_INT unsigned int - -typedef struct MD2state_st - { - int num; - unsigned char data[MD2_BLOCK]; - MD2_INT cksm[MD2_BLOCK]; - MD2_INT state[MD2_BLOCK]; - } MD2_CTX; - -#ifndef NOPROTO -char *MD2_options(void); -void MD2_Init(MD2_CTX *c); -void MD2_Update(MD2_CTX *c, register unsigned char *data, unsigned long len); -void MD2_Final(unsigned char *md, MD2_CTX *c); -unsigned char *MD2(unsigned char *d, unsigned long n,unsigned char *md); -#else -char *MD2_options(); -void MD2_Init(); -void MD2_Update(); -void MD2_Final(); -unsigned char *MD2(); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c index 5cbd36f3fe..c7d8d6aef5 100644 --- a/src/lib/libcrypto/md2/md2_dgst.c +++ b/src/lib/libcrypto/md2/md2_dgst.c @@ -59,21 +59,17 @@ #include #include #include -#include "md2.h" +#include +#include -char *MD2_version="MD2 part of SSLeay 0.9.0b 29-Jun-1998"; +const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; /* Implemented from RFC1319 The MD2 Message-Digest Algorithm */ #define UCHAR unsigned char -#ifndef NOPROTO static void md2_block(MD2_CTX *c, unsigned char *d); -#else -static void md2_block(); -#endif - /* The magic S table - I have converted it to hex since it is * basicaly just a random byte string. */ static MD2_INT S[256]={ @@ -111,7 +107,7 @@ static MD2_INT S[256]={ 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14, }; -char *MD2_options() +const char *MD2_options(void) { if (sizeof(MD2_INT) == 1) return("md2(char)"); @@ -119,8 +115,7 @@ char *MD2_options() return("md2(int)"); } -void MD2_Init(c) -MD2_CTX *c; +void MD2_Init(MD2_CTX *c) { c->num=0; memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT)); @@ -128,10 +123,7 @@ MD2_CTX *c; memset(c->data,0,MD2_BLOCK); } -void MD2_Update(c, data, len) -MD2_CTX *c; -register unsigned char *data; -unsigned long len; +void MD2_Update(MD2_CTX *c, register unsigned char *data, unsigned long len) { register UCHAR *p; @@ -169,9 +161,7 @@ unsigned long len; c->num=(int)len; } -static void md2_block(c, d) -MD2_CTX *c; -unsigned char *d; +static void md2_block(MD2_CTX *c, unsigned char *d) { register MD2_INT t,*sp1,*sp2; register int i,j; @@ -207,9 +197,7 @@ unsigned char *d; memset(state,0,48*sizeof(MD2_INT)); } -void MD2_Final(md, c) -unsigned char *md; -MD2_CTX *c; +void MD2_Final(unsigned char *md, MD2_CTX *c) { int i,v; register UCHAR *cp; diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c index 513bf62fdb..7157299d95 100644 --- a/src/lib/libcrypto/md2/md2_one.c +++ b/src/lib/libcrypto/md2/md2_one.c @@ -58,22 +58,35 @@ #include #include "cryptlib.h" -#include "md2.h" +#include /* This is a separate file so that #defines in cryptlib.h can * map my MD functions to different names */ -unsigned char *MD2(d, n, md) -unsigned char *d; -unsigned long n; -unsigned char *md; +unsigned char *MD2(unsigned char *d, unsigned long n, unsigned char *md) { MD2_CTX c; static unsigned char m[MD2_DIGEST_LENGTH]; if (md == NULL) md=m; MD2_Init(&c); +#ifndef CHARSET_EBCDIC MD2_Update(&c,d,n); +#else + { + char temp[1024]; + unsigned long chunk; + + while (n > 0) + { + chunk = (n > sizeof(temp)) ? sizeof(temp) : n; + ebcdic2ascii(temp, d, chunk); + MD2_Update(&c,temp,chunk); + n -= chunk; + d += chunk; + } + } +#endif MD2_Final(md,&c); memset(&c,0,sizeof(c)); /* Security consideration */ return(md); diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c index 55924d44cd..461d124957 100644 --- a/src/lib/libcrypto/md2/md2test.c +++ b/src/lib/libcrypto/md2/md2test.c @@ -59,7 +59,19 @@ #include #include #include -#include "md2.h" + +#ifdef NO_MD2 +int main(int argc, char *argv[]) +{ + printf("No MD2 support\n"); + return(0); +} +#else +#include + +#ifdef CHARSET_EBCDIC +#include +#endif char *test[]={ "", @@ -82,15 +94,8 @@ char *ret[]={ "d5976f79d83d3a0dc9806c3c66f3efd8", }; -#ifndef NOPROTO static char *pt(unsigned char *md); -#else -static char *pt(); -#endif - -int main(argc,argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int i,err=0; char **P,**R; @@ -118,8 +123,7 @@ char *argv[]; return(0); } -static char *pt(md) -unsigned char *md; +static char *pt(unsigned char *md) { int i; static char buf[80]; @@ -128,3 +132,4 @@ unsigned char *md; sprintf(&(buf[i*2]),"%02x",md[i]); return(buf); } +#endif -- cgit v1.2.3-55-g6feb