summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/md4
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/md4')
-rw-r--r--src/lib/libcrypto/md4/Makefile.ssl9
-rw-r--r--src/lib/libcrypto/md4/md4.c4
-rw-r--r--src/lib/libcrypto/md4/md4_dgst.c36
-rw-r--r--src/lib/libcrypto/md4/md4_one.c3
-rw-r--r--src/lib/libcrypto/md4/md4test.c4
5 files changed, 17 insertions, 39 deletions
diff --git a/src/lib/libcrypto/md4/Makefile.ssl b/src/lib/libcrypto/md4/Makefile.ssl
index 1de72571d8..7d2e8d8d3b 100644
--- a/src/lib/libcrypto/md4/Makefile.ssl
+++ b/src/lib/libcrypto/md4/Makefile.ssl
@@ -69,7 +69,7 @@ lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff 69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70 70
71depend: 71depend:
72 $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) 72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
73 73
74dclean: 74dclean:
75 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 75 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
@@ -84,5 +84,8 @@ md4_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md4.h
84md4_dgst.o: ../../include/openssl/opensslconf.h 84md4_dgst.o: ../../include/openssl/opensslconf.h
85md4_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md4_dgst.c 85md4_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md4_dgst.c
86md4_dgst.o: md4_locl.h 86md4_dgst.o: md4_locl.h
87md4_one.o: ../../include/openssl/e_os2.h ../../include/openssl/md4.h 87md4_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88md4_one.o: ../../include/openssl/opensslconf.h md4_one.c 88md4_one.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
89md4_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
90md4_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
91md4_one.o: md4_one.c
diff --git a/src/lib/libcrypto/md4/md4.c b/src/lib/libcrypto/md4/md4.c
index e4b0aac011..141415ad4d 100644
--- a/src/lib/libcrypto/md4/md4.c
+++ b/src/lib/libcrypto/md4/md4.c
@@ -64,7 +64,7 @@
64 64
65void do_fp(FILE *f); 65void do_fp(FILE *f);
66void pt(unsigned char *md); 66void pt(unsigned char *md);
67#ifndef _OSD_POSIX 67#if !defined(_OSD_POSIX) && !defined(__DJGPP__)
68int read(int, void *, unsigned int); 68int read(int, void *, unsigned int);
69#endif 69#endif
70 70
@@ -108,7 +108,7 @@ void do_fp(FILE *f)
108 MD4_Init(&c); 108 MD4_Init(&c);
109 for (;;) 109 for (;;)
110 { 110 {
111 i=read(fd,buf,BUFSIZE); 111 i=read(fd,buf,sizeof buf);
112 if (i <= 0) break; 112 if (i <= 0) break;
113 MD4_Update(&c,buf,(unsigned long)i); 113 MD4_Update(&c,buf,(unsigned long)i);
114 } 114 }
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c
index 6446f5f5e7..7afb7185b6 100644
--- a/src/lib/libcrypto/md4/md4_dgst.c
+++ b/src/lib/libcrypto/md4/md4_dgst.c
@@ -86,21 +86,7 @@ int MD4_Init(MD4_CTX *c)
86void md4_block_host_order (MD4_CTX *c, const void *data, int num) 86void md4_block_host_order (MD4_CTX *c, const void *data, int num)
87 { 87 {
88 const MD4_LONG *X=data; 88 const MD4_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 MD4_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;
@@ -176,25 +162,11 @@ void md4_block_host_order (MD4_CTX *c, const void *data, int num)
176void md4_block_data_order (MD4_CTX *c, const void *data_, int num) 162void md4_block_data_order (MD4_CTX *c, const void *data_, int num)
177 { 163 {
178 const unsigned char *data=data_; 164 const unsigned char *data=data_;
179 register unsigned long A,B,C,D,l; 165 register unsigned MD32_REG_T A,B,C,D,l;
180 /*
181 * In case you wonder why A-D are declared as long and not
182 * as MD4_LONG. Doing so results in slight performance
183 * boost on LP64 architectures. The catch is we don't
184 * really care if 32 MSBs of a 64-bit register get polluted
185 * with eventual overflows as we *save* only 32 LSBs in
186 * *either* case. Now declaring 'em long excuses the compiler
187 * from keeping 32 MSBs zeroed resulting in 13% performance
188 * improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
189 * Well, to be honest it should say that this *prevents*
190 * performance degradation.
191 *
192 * <appro@fy.chalmers.se>
193 */
194#ifndef MD32_XARRAY 166#ifndef MD32_XARRAY
195 /* See comment in crypto/sha/sha_locl.h for details. */ 167 /* See comment in crypto/sha/sha_locl.h for details. */
196 unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, 168 unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
197 XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; 169 XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
198# define X(i) XX##i 170# define X(i) XX##i
199#else 171#else
200 MD4_LONG XX[MD4_LBLOCK]; 172 MD4_LONG XX[MD4_LBLOCK];
diff --git a/src/lib/libcrypto/md4/md4_one.c b/src/lib/libcrypto/md4/md4_one.c
index 87a995d38d..00565507e4 100644
--- a/src/lib/libcrypto/md4/md4_one.c
+++ b/src/lib/libcrypto/md4/md4_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/md4.h> 61#include <openssl/md4.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 *MD4(const unsigned char *d, unsigned long n, unsigned char *md)
89 } 90 }
90#endif 91#endif
91 MD4_Final(md,&c); 92 MD4_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/md4/md4test.c b/src/lib/libcrypto/md4/md4test.c
index e0fdc42282..21a77d96f7 100644
--- a/src/lib/libcrypto/md4/md4test.c
+++ b/src/lib/libcrypto/md4/md4test.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_MD4 65#ifdef OPENSSL_NO_MD4
64int main(int argc, char *argv[]) 66int 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