summaryrefslogtreecommitdiff
path: root/compiler/utils/md5.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-05-28 12:52:58 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-05-28 12:52:58 +0000
commit526c3af1dc98987b6949f4df73c0debccf9875bd (patch)
treee9dd06d73e2f4281cec06d1f46ae63f1063799e6 /compiler/utils/md5.h
parent842e9d6628a27cf1f420d53f6a5901935dc50c54 (diff)
downloadhaskell-526c3af1dc98987b6949f4df73c0debccf9875bd.tar.gz
Use MD5 checksums for recompilation checking (fixes #1372, #1959)
This is a much more robust way to do recompilation checking. The idea is to create a fingerprint of the ABI of an interface, and track dependencies by recording the fingerprints of ABIs that a module depends on. If any of those ABIs have changed, then we need to recompile. In bug #1372 we weren't recording dependencies on package modules, this patch fixes that by recording fingerprints of package modules that we depend on. Within a package there is still fine-grained recompilation avoidance as before. We currently use MD5 for fingerprints, being a good compromise between efficiency and security. We're not worried about attackers, but we are worried about accidental collisions. All the MD5 sums do make interface files a bit bigger, but compile times on the whole are about the same as before. Recompilation avoidance should be a bit more accurate than in 6.8.2 due to fixing #1959, especially when using -O.
Diffstat (limited to 'compiler/utils/md5.h')
-rw-r--r--compiler/utils/md5.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/utils/md5.h b/compiler/utils/md5.h
new file mode 100644
index 0000000000..8d375df268
--- /dev/null
+++ b/compiler/utils/md5.h
@@ -0,0 +1,24 @@
+/* MD5 message digest */
+#ifndef _MD5_H
+#define _MD5_H
+
+#include "HsFFI.h"
+
+typedef HsWord32 word32;
+typedef HsWord8 byte;
+
+struct MD5Context {
+ word32 buf[4];
+ word32 bytes[2];
+ word32 in[16];
+};
+
+void MD5Init(struct MD5Context *context);
+void MD5Update(struct MD5Context *context, byte const *buf, int len);
+void MD5Final(byte digest[16], struct MD5Context *context);
+void MD5Transform(word32 buf[4], word32 const in[16]);
+
+#endif /* _MD5_H */
+
+
+