summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/mdc2
diff options
context:
space:
mode:
authorsimon <simon@FreeBSD.org>2006-07-29 19:10:21 +0000
committersimon <simon@FreeBSD.org>2006-07-29 19:10:21 +0000
commitfb3c70eda88d3175627edc6a3316b4508b3d29c5 (patch)
tree213a0c4d5ba3869f66ecf970819532048fed4a9d /crypto/openssl/crypto/mdc2
parent3c8d7d9993705e30bc69e55cd19d8a298e582292 (diff)
downloadFreeBSD-src-fb3c70eda88d3175627edc6a3316b4508b3d29c5.zip
FreeBSD-src-fb3c70eda88d3175627edc6a3316b4508b3d29c5.tar.gz
Vendor import of OpenSSL 0.9.8b
Diffstat (limited to 'crypto/openssl/crypto/mdc2')
-rw-r--r--crypto/openssl/crypto/mdc2/Makefile27
-rw-r--r--crypto/openssl/crypto/mdc2/mdc2.h6
-rw-r--r--crypto/openssl/crypto/mdc2/mdc2_one.c5
-rw-r--r--crypto/openssl/crypto/mdc2/mdc2dgst.c21
-rw-r--r--crypto/openssl/crypto/mdc2/mdc2test.c3
5 files changed, 32 insertions, 30 deletions
diff --git a/crypto/openssl/crypto/mdc2/Makefile b/crypto/openssl/crypto/mdc2/Makefile
index 7b70164..1d064f1 100644
--- a/crypto/openssl/crypto/mdc2/Makefile
+++ b/crypto/openssl/crypto/mdc2/Makefile
@@ -1,5 +1,5 @@
#
-# SSLeay/crypto/mdc2/Makefile
+# OpenSSL/crypto/mdc2/Makefile
#
DIR= mdc2
@@ -7,11 +7,6 @@ TOP= ../..
CC= cc
INCLUDES=
CFLAG=-g
-INSTALL_PREFIX=
-OPENSSLDIR= /usr/local/ssl
-INSTALLTOP=/usr/local/ssl
-MAKEDEPPROG= makedepend
-MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
MAKEFILE= Makefile
AR= ar r
@@ -51,7 +46,8 @@ links:
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
install:
- @for i in $(EXHEADER) ; \
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
do \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
@@ -66,6 +62,7 @@ lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
+ @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
dclean:
@@ -83,14 +80,14 @@ mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
mdc2_one.o: ../../include/openssl/opensslconf.h
-mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
-mdc2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-mdc2_one.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-mdc2_one.o: ../cryptlib.h mdc2_one.c
-mdc2dgst.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-mdc2dgst.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
-mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h
-mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
+mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+mdc2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+mdc2_one.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+mdc2_one.o: ../../include/openssl/ui_compat.h ../cryptlib.h mdc2_one.c
+mdc2dgst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
+mdc2dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/mdc2.h
+mdc2dgst.o: ../../include/openssl/opensslconf.h
+mdc2dgst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
mdc2dgst.o: mdc2dgst.c
diff --git a/crypto/openssl/crypto/mdc2/mdc2.h b/crypto/openssl/crypto/mdc2/mdc2.h
index 793a8a0..72778a5 100644
--- a/crypto/openssl/crypto/mdc2/mdc2.h
+++ b/crypto/openssl/crypto/mdc2/mdc2.h
@@ -74,7 +74,7 @@ extern "C" {
typedef struct mdc2_ctx_st
{
- int num;
+ unsigned int num;
unsigned char data[MDC2_BLOCK];
DES_cblock h,hh;
int pad_type; /* either 1 or 2, default 1 */
@@ -82,9 +82,9 @@ typedef struct mdc2_ctx_st
int MDC2_Init(MDC2_CTX *c);
-int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
+int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);
int MDC2_Final(unsigned char *md, MDC2_CTX *c);
-unsigned char *MDC2(const unsigned char *d, unsigned long n,
+unsigned char *MDC2(const unsigned char *d, size_t n,
unsigned char *md);
#ifdef __cplusplus
diff --git a/crypto/openssl/crypto/mdc2/mdc2_one.c b/crypto/openssl/crypto/mdc2/mdc2_one.c
index 37f06c8..72647f6 100644
--- a/crypto/openssl/crypto/mdc2/mdc2_one.c
+++ b/crypto/openssl/crypto/mdc2/mdc2_one.c
@@ -60,13 +60,14 @@
#include "cryptlib.h"
#include <openssl/mdc2.h>
-unsigned char *MDC2(const unsigned char *d, unsigned long n, unsigned char *md)
+unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md)
{
MDC2_CTX c;
static unsigned char m[MDC2_DIGEST_LENGTH];
if (md == NULL) md=m;
- MDC2_Init(&c);
+ if (!MDC2_Init(&c))
+ return NULL;
MDC2_Update(&c,d,n);
MDC2_Final(md,&c);
OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
diff --git a/crypto/openssl/crypto/mdc2/mdc2dgst.c b/crypto/openssl/crypto/mdc2/mdc2dgst.c
index 32daa9b..4aa406e 100644
--- a/crypto/openssl/crypto/mdc2/mdc2dgst.c
+++ b/crypto/openssl/crypto/mdc2/mdc2dgst.c
@@ -74,7 +74,7 @@
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
-static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len);
+static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len);
int MDC2_Init(MDC2_CTX *c)
{
c->num=0;
@@ -84,9 +84,9 @@ int MDC2_Init(MDC2_CTX *c)
return 1;
}
-int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
+int MDC2_Update(MDC2_CTX *c, const unsigned char *in, size_t len)
{
- int i,j;
+ size_t i,j;
i=c->num;
if (i != 0)
@@ -94,7 +94,7 @@ int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
if (i+len < MDC2_BLOCK)
{
/* partial block */
- memcpy(&(c->data[i]),in,(int)len);
+ memcpy(&(c->data[i]),in,len);
c->num+=(int)len;
return 1;
}
@@ -109,25 +109,25 @@ int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
mdc2_body(c,&(c->data[0]),MDC2_BLOCK);
}
}
- i=(int)(len&(unsigned long)~(MDC2_BLOCK-1));
+ i=len&~((size_t)MDC2_BLOCK-1);
if (i > 0) mdc2_body(c,in,i);
- j=(int)len-i;
+ j=len-i;
if (j > 0)
{
memcpy(&(c->data[0]),&(in[i]),j);
- c->num=j;
+ c->num=(int)j;
}
return 1;
}
-static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len)
+static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len)
{
register DES_LONG tin0,tin1;
register DES_LONG ttin0,ttin1;
DES_LONG d[2],dd[2];
DES_key_schedule k;
unsigned char *p;
- unsigned int i;
+ size_t i;
for (i=0; i<len; i+=8)
{
@@ -160,7 +160,8 @@ static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len)
int MDC2_Final(unsigned char *md, MDC2_CTX *c)
{
- int i,j;
+ unsigned int i;
+ int j;
i=c->num;
j=c->pad_type;
diff --git a/crypto/openssl/crypto/mdc2/mdc2test.c b/crypto/openssl/crypto/mdc2/mdc2test.c
index c9abe99..017b31a 100644
--- a/crypto/openssl/crypto/mdc2/mdc2test.c
+++ b/crypto/openssl/crypto/mdc2/mdc2test.c
@@ -140,6 +140,9 @@ int main(int argc, char *argv[])
printf("pad2 - ok\n");
EVP_MD_CTX_cleanup(&c);
+#ifdef OPENSSL_SYS_NETWARE
+ if (ret) printf("ERROR: %d\n", ret);
+#endif
EXIT(ret);
return(ret);
}
OpenPOWER on IntegriCloud