diff options
Diffstat (limited to 'crypto/openssl/crypto/md2')
-rw-r--r-- | crypto/openssl/crypto/md2/Makefile.ssl | 19 | ||||
-rw-r--r-- | crypto/openssl/crypto/md2/md2.h | 8 | ||||
-rw-r--r-- | crypto/openssl/crypto/md2/md2_dgst.c | 22 | ||||
-rw-r--r-- | crypto/openssl/crypto/md2/md2_one.c | 2 | ||||
-rw-r--r-- | crypto/openssl/crypto/md2/md2test.c | 13 |
5 files changed, 38 insertions, 26 deletions
diff --git a/crypto/openssl/crypto/md2/Makefile.ssl b/crypto/openssl/crypto/md2/Makefile.ssl index cda8385..e5b3265 100644 --- a/crypto/openssl/crypto/md2/Makefile.ssl +++ b/crypto/openssl/crypto/md2/Makefile.ssl @@ -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: @@ -68,7 +68,7 @@ lint: lint -DLINT $(INCLUDES) $(SRC)>fluff depend: - $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) + $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) dclean: $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new @@ -79,12 +79,15 @@ clean: # DO NOT DELETE THIS LINE -- make depend depends on it. +md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 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 ../../include/openssl/safestack.h +md2_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +md2_dgst.o: 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/crypto/openssl/crypto/md2/md2.h b/crypto/openssl/crypto/md2/md2.h index a00bd16..ad92414 100644 --- a/crypto/openssl/crypto/md2/md2.h +++ b/crypto/openssl/crypto/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/crypto/openssl/crypto/md2/md2_dgst.c b/crypto/openssl/crypto/md2/md2_dgst.c index 608baef..ecb64f0 100644 --- a/crypto/openssl/crypto/md2/md2_dgst.c +++ b/crypto/openssl/crypto/md2/md2_dgst.c @@ -61,6 +61,7 @@ #include <string.h> #include <openssl/md2.h> #include <openssl/opensslv.h> +#include <openssl/crypto.h> const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; @@ -115,19 +116,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); + memset(c->state,0,sizeof c->state); + memset(c->cksm,0,sizeof c->cksm); + memset(c->data,0,sizeof c->data); + 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 +148,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 +161,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) @@ -194,10 +197,10 @@ static void md2_block(MD2_CTX *c, const unsigned char *d) t=(t+i)&0xff; } memcpy(sp1,state,16*sizeof(MD2_INT)); - memset(state,0,48*sizeof(MD2_INT)); + OPENSSL_cleanse(state,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 +222,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/crypto/openssl/crypto/md2/md2_one.c b/crypto/openssl/crypto/md2/md2_one.c index b12c37c..835160e 100644 --- a/crypto/openssl/crypto/md2/md2_one.c +++ b/crypto/openssl/crypto/md2/md2_one.c @@ -88,6 +88,6 @@ unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md) } #endif MD2_Final(md,&c); - memset(&c,0,sizeof(c)); /* Security consideration */ + OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */ return(md); } diff --git a/crypto/openssl/crypto/md2/md2test.c b/crypto/openssl/crypto/md2/md2test.c index e3f4fb4..d2f6dce 100644 --- a/crypto/openssl/crypto/md2/md2test.c +++ b/crypto/openssl/crypto/md2/md2test.c @@ -59,15 +59,18 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <openssl/md2.h> + +#include "../e_os.h" -#ifdef NO_MD2 +#ifdef OPENSSL_NO_MD2 int main(int argc, char *argv[]) { printf("No MD2 support\n"); return(0); } #else -#include <openssl/md2.h> +#include <openssl/evp.h> #ifdef CHARSET_EBCDIC #include <openssl/ebcdic.h> @@ -100,13 +103,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); @@ -119,7 +124,7 @@ int main(int argc, char *argv[]) R++; P++; } - exit(err); + EXIT(err); return(0); } |