diff options
Diffstat (limited to 'src/lib/libcrypto/md5')
-rw-r--r-- | src/lib/libcrypto/md5/Makefile.ssl | 31 | ||||
-rw-r--r-- | src/lib/libcrypto/md5/md5.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/md5/md5.h | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/md5/md5_dgst.c | 36 | ||||
-rw-r--r-- | src/lib/libcrypto/md5/md5_locl.h | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/md5/md5_one.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/md5/md5test.c | 4 |
7 files changed, 25 insertions, 57 deletions
diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl index 5f1bbfb8ff..b11ab476d6 100644 --- a/src/lib/libcrypto/md5/Makefile.ssl +++ b/src/lib/libcrypto/md5/Makefile.ssl | |||
@@ -21,14 +21,6 @@ MD5_ASM_OBJ= | |||
21 | 21 | ||
22 | CFLAGS= $(INCLUDES) $(CFLAG) | 22 | CFLAGS= $(INCLUDES) $(CFLAG) |
23 | 23 | ||
24 | # We let the C compiler driver to take care of .s files. This is done in | ||
25 | # order to be excused from maintaining a separate set of architecture | ||
26 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | ||
27 | # gcc, then the driver will automatically translate it to -xarch=v8plus | ||
28 | # and pass it down to assembler. | ||
29 | AS=$(CC) -c | ||
30 | ASFLAGS=$(CFLAGS) | ||
31 | |||
32 | GENERAL=Makefile | 24 | GENERAL=Makefile |
33 | TEST=md5test.c | 25 | TEST=md5test.c |
34 | APPS= | 26 | APPS= |
@@ -55,14 +47,8 @@ lib: $(LIBOBJ) | |||
55 | @touch lib | 47 | @touch lib |
56 | 48 | ||
57 | # elf | 49 | # elf |
58 | asm/mx86-elf.o: asm/mx86unix.cpp | 50 | asm/mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl |
59 | $(CPP) -DELF -x c asm/mx86unix.cpp | as -o asm/mx86-elf.o | 51 | (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > mx86-elf.s) |
60 | |||
61 | # solaris | ||
62 | asm/mx86-sol.o: asm/mx86unix.cpp | ||
63 | $(CC) -E -DSOL asm/mx86unix.cpp | sed 's/^#.*//' > asm/mx86-sol.s | ||
64 | as -o asm/mx86-sol.o asm/mx86-sol.s | ||
65 | rm -f asm/mx86-sol.s | ||
66 | 52 | ||
67 | # a.out | 53 | # a.out |
68 | asm/mx86-out.o: asm/mx86unix.cpp | 54 | asm/mx86-out.o: asm/mx86unix.cpp |
@@ -118,18 +104,23 @@ lint: | |||
118 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 104 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
119 | 105 | ||
120 | depend: | 106 | depend: |
121 | $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) | 107 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
122 | 108 | ||
123 | dclean: | 109 | dclean: |
124 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | 110 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new |
125 | mv -f Makefile.new $(MAKEFILE) | 111 | mv -f Makefile.new $(MAKEFILE) |
126 | 112 | ||
127 | clean: | 113 | clean: |
128 | rm -f asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | 114 | rm -f asm/mx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff |
129 | 115 | ||
130 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 116 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
131 | 117 | ||
132 | md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h | 118 | md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h |
119 | md5_dgst.o: ../../include/openssl/opensslconf.h | ||
133 | md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c | 120 | md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c |
134 | md5_dgst.o: md5_locl.h | 121 | md5_dgst.o: md5_locl.h |
135 | md5_one.o: ../../include/openssl/md5.h md5_one.c | 122 | md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
123 | md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h | ||
124 | md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
125 | md5_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
126 | md5_one.o: md5_one.c | ||
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c index 7ed0024ae1..563733abc5 100644 --- a/src/lib/libcrypto/md5/md5.c +++ b/src/lib/libcrypto/md5/md5.c | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | void do_fp(FILE *f); | 65 | void do_fp(FILE *f); |
66 | void pt(unsigned char *md); | 66 | void pt(unsigned char *md); |
67 | #ifndef _OSD_POSIX | 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) |
68 | int read(int, void *, unsigned int); | 68 | int read(int, void *, unsigned int); |
69 | #endif | 69 | #endif |
70 | 70 | ||
diff --git a/src/lib/libcrypto/md5/md5.h b/src/lib/libcrypto/md5/md5.h index 52cb753e6a..a252e02115 100644 --- a/src/lib/libcrypto/md5/md5.h +++ b/src/lib/libcrypto/md5/md5.h | |||
@@ -59,6 +59,8 @@ | |||
59 | #ifndef HEADER_MD5_H | 59 | #ifndef HEADER_MD5_H |
60 | #define HEADER_MD5_H | 60 | #define HEADER_MD5_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> | ||
63 | |||
62 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
63 | extern "C" { | 65 | extern "C" { |
64 | #endif | 66 | #endif |
@@ -76,7 +78,7 @@ extern "C" { | |||
76 | 78 | ||
77 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 79 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) |
78 | #define MD5_LONG unsigned long | 80 | #define MD5_LONG unsigned long |
79 | #elif defined(OENSSL_SYS_CRAY) || defined(__ILP64__) | 81 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
80 | #define MD5_LONG unsigned long | 82 | #define MD5_LONG unsigned long |
81 | #define MD5_LONG_LOG2 3 | 83 | #define MD5_LONG_LOG2 3 |
82 | /* | 84 | /* |
diff --git a/src/lib/libcrypto/md5/md5_dgst.c b/src/lib/libcrypto/md5/md5_dgst.c index c38a3f021e..9c7abc3697 100644 --- a/src/lib/libcrypto/md5/md5_dgst.c +++ b/src/lib/libcrypto/md5/md5_dgst.c | |||
@@ -86,21 +86,7 @@ int MD5_Init(MD5_CTX *c) | |||
86 | void md5_block_host_order (MD5_CTX *c, const void *data, int num) | 86 | void md5_block_host_order (MD5_CTX *c, const void *data, int num) |
87 | { | 87 | { |
88 | const MD5_LONG *X=data; | 88 | const MD5_LONG *X=data; |
89 | register unsigned long A,B,C,D; | 89 | register unsigned MD32_REG_T A,B,C,D; |
90 | /* | ||
91 | * In case you wonder why A-D are declared as long and not | ||
92 | * as MD5_LONG. Doing so results in slight performance | ||
93 | * boost on LP64 architectures. The catch is we don't | ||
94 | * really care if 32 MSBs of a 64-bit register get polluted | ||
95 | * with eventual overflows as we *save* only 32 LSBs in | ||
96 | * *either* case. Now declaring 'em long excuses the compiler | ||
97 | * from keeping 32 MSBs zeroed resulting in 13% performance | ||
98 | * improvement under SPARC Solaris7/64 and 5% under AlphaLinux. | ||
99 | * Well, to be honest it should say that this *prevents* | ||
100 | * performance degradation. | ||
101 | * | ||
102 | * <appro@fy.chalmers.se> | ||
103 | */ | ||
104 | 90 | ||
105 | A=c->A; | 91 | A=c->A; |
106 | B=c->B; | 92 | B=c->B; |
@@ -193,25 +179,11 @@ void md5_block_host_order (MD5_CTX *c, const void *data, int num) | |||
193 | void md5_block_data_order (MD5_CTX *c, const void *data_, int num) | 179 | void md5_block_data_order (MD5_CTX *c, const void *data_, int num) |
194 | { | 180 | { |
195 | const unsigned char *data=data_; | 181 | const unsigned char *data=data_; |
196 | register unsigned long A,B,C,D,l; | 182 | register unsigned MD32_REG_T A,B,C,D,l; |
197 | /* | ||
198 | * In case you wonder why A-D are declared as long and not | ||
199 | * as MD5_LONG. Doing so results in slight performance | ||
200 | * boost on LP64 architectures. The catch is we don't | ||
201 | * really care if 32 MSBs of a 64-bit register get polluted | ||
202 | * with eventual overflows as we *save* only 32 LSBs in | ||
203 | * *either* case. Now declaring 'em long excuses the compiler | ||
204 | * from keeping 32 MSBs zeroed resulting in 13% performance | ||
205 | * improvement under SPARC Solaris7/64 and 5% under AlphaLinux. | ||
206 | * Well, to be honest it should say that this *prevents* | ||
207 | * performance degradation. | ||
208 | * | ||
209 | * <appro@fy.chalmers.se> | ||
210 | */ | ||
211 | #ifndef MD32_XARRAY | 183 | #ifndef MD32_XARRAY |
212 | /* See comment in crypto/sha/sha_locl.h for details. */ | 184 | /* See comment in crypto/sha/sha_locl.h for details. */ |
213 | unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, | 185 | unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, |
214 | XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; | 186 | XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; |
215 | # define X(i) XX##i | 187 | # define X(i) XX##i |
216 | #else | 188 | #else |
217 | MD5_LONG XX[MD5_LBLOCK]; | 189 | MD5_LONG XX[MD5_LBLOCK]; |
diff --git a/src/lib/libcrypto/md5/md5_locl.h b/src/lib/libcrypto/md5/md5_locl.h index 34c5257306..9e360da732 100644 --- a/src/lib/libcrypto/md5/md5_locl.h +++ b/src/lib/libcrypto/md5/md5_locl.h | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/opensslconf.h> | 61 | #include <openssl/e_os2.h> |
62 | #include <openssl/md5.h> | 62 | #include <openssl/md5.h> |
63 | 63 | ||
64 | #ifndef MD5_LONG_LOG2 | 64 | #ifndef MD5_LONG_LOG2 |
diff --git a/src/lib/libcrypto/md5/md5_one.c b/src/lib/libcrypto/md5/md5_one.c index b89dec850d..c5dd2d81db 100644 --- a/src/lib/libcrypto/md5/md5_one.c +++ b/src/lib/libcrypto/md5/md5_one.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/md5.h> | 61 | #include <openssl/md5.h> |
62 | #include <openssl/crypto.h> | ||
62 | 63 | ||
63 | #ifdef CHARSET_EBCDIC | 64 | #ifdef CHARSET_EBCDIC |
64 | #include <openssl/ebcdic.h> | 65 | #include <openssl/ebcdic.h> |
@@ -89,7 +90,7 @@ unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md) | |||
89 | } | 90 | } |
90 | #endif | 91 | #endif |
91 | MD5_Final(md,&c); | 92 | MD5_Final(md,&c); |
92 | memset(&c,0,sizeof(c)); /* security consideration */ | 93 | OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ |
93 | return(md); | 94 | return(md); |
94 | } | 95 | } |
95 | 96 | ||
diff --git a/src/lib/libcrypto/md5/md5test.c b/src/lib/libcrypto/md5/md5test.c index 862b89658a..bfd62629ed 100644 --- a/src/lib/libcrypto/md5/md5test.c +++ b/src/lib/libcrypto/md5/md5test.c | |||
@@ -60,6 +60,8 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | 62 | ||
63 | #include "../e_os.h" | ||
64 | |||
63 | #ifdef OPENSSL_NO_MD5 | 65 | #ifdef OPENSSL_NO_MD5 |
64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
65 | { | 67 | { |
@@ -118,7 +120,7 @@ int main(int argc, char *argv[]) | |||
118 | R++; | 120 | R++; |
119 | P++; | 121 | P++; |
120 | } | 122 | } |
121 | exit(err); | 123 | EXIT(err); |
122 | return(0); | 124 | return(0); |
123 | } | 125 | } |
124 | 126 | ||