diff options
author | djm <> | 2008-09-06 12:15:54 +0000 |
---|---|---|
committer | djm <> | 2008-09-06 12:15:54 +0000 |
commit | f1625f274acf5dcd5601f6cb5e29e233b2a441a3 (patch) | |
tree | 44899ddfbef8f24aacbea50086c041c1b150f6d6 /src/lib/libcrypto/md2 | |
parent | 4f828b924f54507141fb95ebe49dfcd261945e85 (diff) | |
download | openbsd-f1625f274acf5dcd5601f6cb5e29e233b2a441a3.tar.gz openbsd-f1625f274acf5dcd5601f6cb5e29e233b2a441a3.tar.bz2 openbsd-f1625f274acf5dcd5601f6cb5e29e233b2a441a3.zip |
import of OpenSSL 0.9.8h
Diffstat (limited to 'src/lib/libcrypto/md2')
-rw-r--r-- | src/lib/libcrypto/md2/Makefile | 22 | ||||
-rw-r--r-- | src/lib/libcrypto/md2/md2.h | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/md2/md2_dgst.c | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/md2/md2_one.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/md2/md2test.c | 6 |
5 files changed, 25 insertions, 29 deletions
diff --git a/src/lib/libcrypto/md2/Makefile b/src/lib/libcrypto/md2/Makefile index 9d0351bb2f..17f878aeb7 100644 --- a/src/lib/libcrypto/md2/Makefile +++ b/src/lib/libcrypto/md2/Makefile | |||
@@ -7,11 +7,6 @@ TOP= ../.. | |||
7 | CC= cc | 7 | CC= cc |
8 | INCLUDES= | 8 | INCLUDES= |
9 | CFLAG=-g | 9 | CFLAG=-g |
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKEDEPPROG= makedepend | ||
14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
15 | MAKEFILE= Makefile | 10 | MAKEFILE= Makefile |
16 | AR= ar r | 11 | AR= ar r |
17 | 12 | ||
@@ -51,6 +46,7 @@ links: | |||
51 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) |
52 | 47 | ||
53 | install: | 48 | install: |
49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
54 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ |
55 | do \ | 51 | do \ |
56 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ |
@@ -66,6 +62,7 @@ lint: | |||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
67 | 63 | ||
68 | depend: | 64 | depend: |
65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
70 | 67 | ||
71 | dclean: | 68 | dclean: |
@@ -77,17 +74,16 @@ clean: | |||
77 | 74 | ||
78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
79 | 76 | ||
80 | md2_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | 77 | md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
81 | md2_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
82 | md2_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
83 | md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h | 78 | md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h |
84 | md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | 79 | md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
85 | md2_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 80 | md2_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
86 | md2_dgst.o: md2_dgst.c | 81 | md2_dgst.o: ../../include/openssl/symhacks.h md2_dgst.c |
87 | md2_one.o: ../../e_os.h ../../include/openssl/bio.h | 82 | md2_one.o: ../../e_os.h ../../include/openssl/bio.h |
88 | md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 83 | md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
89 | md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 84 | md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
90 | md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | 85 | md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h |
91 | md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 86 | md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
92 | md2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 87 | md2_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
93 | md2_one.o: ../../include/openssl/symhacks.h ../cryptlib.h md2_one.c | 88 | md2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
89 | md2_one.o: ../cryptlib.h md2_one.c | ||
diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h index d0ef9da08e..a46120e7d4 100644 --- a/src/lib/libcrypto/md2/md2.h +++ b/src/lib/libcrypto/md2/md2.h | |||
@@ -59,13 +59,14 @@ | |||
59 | #ifndef HEADER_MD2_H | 59 | #ifndef HEADER_MD2_H |
60 | #define HEADER_MD2_H | 60 | #define HEADER_MD2_H |
61 | 61 | ||
62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */ | ||
62 | #ifdef OPENSSL_NO_MD2 | 63 | #ifdef OPENSSL_NO_MD2 |
63 | #error MD2 is disabled. | 64 | #error MD2 is disabled. |
64 | #endif | 65 | #endif |
66 | #include <stddef.h> | ||
65 | 67 | ||
66 | #define MD2_DIGEST_LENGTH 16 | 68 | #define MD2_DIGEST_LENGTH 16 |
67 | #define MD2_BLOCK 16 | 69 | #define MD2_BLOCK 16 |
68 | #include <openssl/opensslconf.h> /* MD2_INT */ | ||
69 | 70 | ||
70 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
71 | extern "C" { | 72 | extern "C" { |
@@ -73,20 +74,17 @@ extern "C" { | |||
73 | 74 | ||
74 | typedef struct MD2state_st | 75 | typedef struct MD2state_st |
75 | { | 76 | { |
76 | int num; | 77 | unsigned int num; |
77 | unsigned char data[MD2_BLOCK]; | 78 | unsigned char data[MD2_BLOCK]; |
78 | MD2_INT cksm[MD2_BLOCK]; | 79 | MD2_INT cksm[MD2_BLOCK]; |
79 | MD2_INT state[MD2_BLOCK]; | 80 | MD2_INT state[MD2_BLOCK]; |
80 | } MD2_CTX; | 81 | } MD2_CTX; |
81 | 82 | ||
82 | const char *MD2_options(void); | 83 | const char *MD2_options(void); |
83 | #ifdef OPENSSL_FIPS | ||
84 | int private_MD2_Init(MD2_CTX *c); | ||
85 | #endif | ||
86 | int MD2_Init(MD2_CTX *c); | 84 | int MD2_Init(MD2_CTX *c); |
87 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); | 85 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); |
88 | int MD2_Final(unsigned char *md, MD2_CTX *c); | 86 | int MD2_Final(unsigned char *md, MD2_CTX *c); |
89 | unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md); | 87 | unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md); |
90 | #ifdef __cplusplus | 88 | #ifdef __cplusplus |
91 | } | 89 | } |
92 | #endif | 90 | #endif |
diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c index 8124acd687..6f68b25c6a 100644 --- a/src/lib/libcrypto/md2/md2_dgst.c +++ b/src/lib/libcrypto/md2/md2_dgst.c | |||
@@ -62,10 +62,8 @@ | |||
62 | #include <openssl/md2.h> | 62 | #include <openssl/md2.h> |
63 | #include <openssl/opensslv.h> | 63 | #include <openssl/opensslv.h> |
64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
65 | #include <openssl/fips.h> | ||
66 | #include <openssl/err.h> | ||
67 | 65 | ||
68 | const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT; | 66 | const char MD2_version[]="MD2" OPENSSL_VERSION_PTEXT; |
69 | 67 | ||
70 | /* Implemented from RFC1319 The MD2 Message-Digest Algorithm | 68 | /* Implemented from RFC1319 The MD2 Message-Digest Algorithm |
71 | */ | 69 | */ |
@@ -118,7 +116,7 @@ const char *MD2_options(void) | |||
118 | return("md2(int)"); | 116 | return("md2(int)"); |
119 | } | 117 | } |
120 | 118 | ||
121 | FIPS_NON_FIPS_MD_Init(MD2) | 119 | int MD2_Init(MD2_CTX *c) |
122 | { | 120 | { |
123 | c->num=0; | 121 | c->num=0; |
124 | memset(c->state,0,sizeof c->state); | 122 | memset(c->state,0,sizeof c->state); |
@@ -127,7 +125,7 @@ FIPS_NON_FIPS_MD_Init(MD2) | |||
127 | return 1; | 125 | return 1; |
128 | } | 126 | } |
129 | 127 | ||
130 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) | 128 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len) |
131 | { | 129 | { |
132 | register UCHAR *p; | 130 | register UCHAR *p; |
133 | 131 | ||
@@ -147,7 +145,7 @@ int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) | |||
147 | } | 145 | } |
148 | else | 146 | else |
149 | { | 147 | { |
150 | memcpy(&(p[c->num]),data,(int)len); | 148 | memcpy(&(p[c->num]),data,len); |
151 | /* data+=len; */ | 149 | /* data+=len; */ |
152 | c->num+=(int)len; | 150 | c->num+=(int)len; |
153 | return 1; | 151 | return 1; |
@@ -161,7 +159,7 @@ int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) | |||
161 | data+=MD2_BLOCK; | 159 | data+=MD2_BLOCK; |
162 | len-=MD2_BLOCK; | 160 | len-=MD2_BLOCK; |
163 | } | 161 | } |
164 | memcpy(p,data,(int)len); | 162 | memcpy(p,data,len); |
165 | c->num=(int)len; | 163 | c->num=(int)len; |
166 | return 1; | 164 | return 1; |
167 | } | 165 | } |
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c index 8c36ba5779..f7fef5cc0a 100644 --- a/src/lib/libcrypto/md2/md2_one.c +++ b/src/lib/libcrypto/md2/md2_one.c | |||
@@ -63,7 +63,7 @@ | |||
63 | /* This is a separate file so that #defines in cryptlib.h can | 63 | /* This is a separate file so that #defines in cryptlib.h can |
64 | * map my MD functions to different names */ | 64 | * map my MD functions to different names */ |
65 | 65 | ||
66 | unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md) | 66 | unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md) |
67 | { | 67 | { |
68 | MD2_CTX c; | 68 | MD2_CTX c; |
69 | static unsigned char m[MD2_DIGEST_LENGTH]; | 69 | static unsigned char m[MD2_DIGEST_LENGTH]; |
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c index 9c1e28b6ce..db5f5bc6d2 100644 --- a/src/lib/libcrypto/md2/md2test.c +++ b/src/lib/libcrypto/md2/md2test.c | |||
@@ -110,7 +110,7 @@ int main(int argc, char *argv[]) | |||
110 | i=1; | 110 | i=1; |
111 | while (*P != NULL) | 111 | while (*P != NULL) |
112 | { | 112 | { |
113 | EVP_Digest((unsigned char *)*P,(unsigned long)strlen(*P),md,NULL,EVP_md2(), NULL); | 113 | EVP_Digest((unsigned char *)*P,strlen(*P),md,NULL,EVP_md2(), NULL); |
114 | p=pt(md); | 114 | p=pt(md); |
115 | if (strcmp(p,*R) != 0) | 115 | if (strcmp(p,*R) != 0) |
116 | { | 116 | { |
@@ -124,7 +124,11 @@ int main(int argc, char *argv[]) | |||
124 | R++; | 124 | R++; |
125 | P++; | 125 | P++; |
126 | } | 126 | } |
127 | #ifdef OPENSSL_SYS_NETWARE | ||
128 | if (err) printf("ERROR: %d\n", err); | ||
129 | #endif | ||
127 | EXIT(err); | 130 | EXIT(err); |
131 | return err; | ||
128 | } | 132 | } |
129 | 133 | ||
130 | static char *pt(unsigned char *md) | 134 | static char *pt(unsigned char *md) |