From b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 Mon Sep 17 00:00:00 2001 From: beck <> Date: Wed, 15 May 2002 02:29:21 +0000 Subject: OpenSSL 0.9.7 stable 2002 05 08 merge --- src/lib/libcrypto/md2/Makefile.ssl | 16 ++++++++-------- src/lib/libcrypto/md2/md2.h | 8 ++++---- src/lib/libcrypto/md2/md2_dgst.c | 13 ++++++++----- src/lib/libcrypto/md2/md2test.c | 9 ++++++--- 4 files changed, 26 insertions(+), 20 deletions(-) (limited to 'src/lib/libcrypto/md2') diff --git a/src/lib/libcrypto/md2/Makefile.ssl b/src/lib/libcrypto/md2/Makefile.ssl index 269628d739..05a77ae4a5 100644 --- a/src/lib/libcrypto/md2/Makefile.ssl +++ b/src/lib/libcrypto/md2/Makefile.ssl @@ -2,7 +2,7 @@ # SSLeay/crypto/md/Makefile # -DIR= md +DIR= md2 TOP= ../.. CC= cc INCLUDES= @@ -11,7 +11,8 @@ INSTALL_PREFIX= OPENSSLDIR= /usr/local/ssl INSTALLTOP=/usr/local/ssl MAKE= make -f Makefile.ssl -MAKEDEPEND= $(TOP)/util/domd $(TOP) +MAKEDEPPROG= makedepend +MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) MAKEFILE= Makefile.ssl AR= ar r @@ -39,8 +40,7 @@ all: lib lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) - @echo You may get an error following this line. Please ignore. - - $(RANLIB) $(LIB) + $(RANLIB) $(LIB) || echo Never mind. @touch lib files: @@ -80,11 +80,11 @@ clean: # 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_dgst.o: ../../include/openssl/opensslv.h md2_dgst.c +md2_one.o: ../../e_os.h ../../include/openssl/bio.h +md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h md2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -md2_one.o: ../../include/openssl/symhacks.h ../cryptlib.h +md2_one.o: ../../include/openssl/symhacks.h ../cryptlib.h md2_one.c diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h index a00bd162b3..ad9241455c 100644 --- a/src/lib/libcrypto/md2/md2.h +++ b/src/lib/libcrypto/md2/md2.h @@ -59,7 +59,7 @@ #ifndef HEADER_MD2_H #define HEADER_MD2_H -#ifdef NO_MD2 +#ifdef OPENSSL_NO_MD2 #error MD2 is disabled. #endif @@ -80,9 +80,9 @@ typedef struct MD2state_st } MD2_CTX; const char *MD2_options(void); -void MD2_Init(MD2_CTX *c); -void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); -void MD2_Final(unsigned char *md, MD2_CTX *c); +int MD2_Init(MD2_CTX *c); +int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); +int MD2_Final(unsigned char *md, MD2_CTX *c); unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md); #ifdef __cplusplus } diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c index 608baefa8f..e25dd00e02 100644 --- a/src/lib/libcrypto/md2/md2_dgst.c +++ b/src/lib/libcrypto/md2/md2_dgst.c @@ -115,19 +115,20 @@ const char *MD2_options(void) return("md2(int)"); } -void MD2_Init(MD2_CTX *c) +int MD2_Init(MD2_CTX *c) { c->num=0; memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT)); memset(c->cksm,0,MD2_BLOCK*sizeof(MD2_INT)); memset(c->data,0,MD2_BLOCK); + return 1; } -void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) +int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) { register UCHAR *p; - if (len == 0) return; + if (len == 0) return 1; p=c->data; if (c->num != 0) @@ -146,7 +147,7 @@ void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) memcpy(&(p[c->num]),data,(int)len); /* data+=len; */ c->num+=(int)len; - return; + return 1; } } /* we now can process the input data in blocks of MD2_BLOCK @@ -159,6 +160,7 @@ void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) } memcpy(p,data,(int)len); c->num=(int)len; + return 1; } static void md2_block(MD2_CTX *c, const unsigned char *d) @@ -197,7 +199,7 @@ static void md2_block(MD2_CTX *c, const unsigned char *d) memset(state,0,48*sizeof(MD2_INT)); } -void MD2_Final(unsigned char *md, MD2_CTX *c) +int MD2_Final(unsigned char *md, MD2_CTX *c) { int i,v; register UCHAR *cp; @@ -219,5 +221,6 @@ void MD2_Final(unsigned char *md, MD2_CTX *c) for (i=0; i<16; i++) md[i]=(UCHAR)(p1[i]&0xff); memset((char *)&c,0,sizeof(c)); + return 1; } diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c index e3f4fb4c34..7d3664faf5 100644 --- a/src/lib/libcrypto/md2/md2test.c +++ b/src/lib/libcrypto/md2/md2test.c @@ -59,15 +59,16 @@ #include #include #include +#include -#ifdef NO_MD2 +#ifdef OPENSSL_NO_MD2 int main(int argc, char *argv[]) { printf("No MD2 support\n"); return(0); } #else -#include +#include #ifdef CHARSET_EBCDIC #include @@ -100,13 +101,15 @@ int main(int argc, char *argv[]) int i,err=0; char **P,**R; char *p; + unsigned char md[MD2_DIGEST_LENGTH]; P=test; R=ret; i=1; while (*P != NULL) { - p=pt(MD2((unsigned char *)*P,(unsigned long)strlen(*P),NULL)); + EVP_Digest((unsigned char *)*P,(unsigned long)strlen(*P),md,NULL,EVP_md2(), NULL); + p=pt(md); if (strcmp(p,*R) != 0) { printf("error calculating MD2 on '%s'\n",*P); -- cgit v1.2.3-55-g6feb