Hi,

        OpenSSL seems not to have many dependencies, is it possible to build it
before util-linux? I've made an attempt to link mcookie and mkfs.cramfs
against libcrypto and it seems to be working. Well, it's more a hack as
I don't fully understand util-linux's build system, but anyway, check it
out.
        
        If this is OK for us, what other packages should use shared digest
algorythms?

# EOF
diff -Naur util-linux-2.12r/disk-utils/Makefile 
util-linux-2.12r.new/disk-utils/Makefile
--- util-linux-2.12r/disk-utils/Makefile        2004-12-21 18:14:16.000000000 
+0100
+++ util-linux-2.12r.new/disk-utils/Makefile    2006-09-17 14:59:33.000000000 
+0200
@@ -46,7 +46,7 @@
        $(CC) $(LDFLAGS) -o fsck.cramfs fsck.cramfs.o -lz
 
 mkfs.cramfs: mkfs.cramfs.o $(LIB)/md5.o
-       $(CC) $(LDFLAGS) -o mkfs.cramfs mkfs.cramfs.o $(LIB)/md5.o -lz
+       $(CC) $(LDFLAGS) -o mkfs.cramfs mkfs.cramfs.o $(LIB)/md5.o -lz -lcrypto
 
 mkfs.cramfs.o: $(LIB)/md5.h
 
diff -Naur util-linux-2.12r/lib/md5.c util-linux-2.12r.new/lib/md5.c
--- util-linux-2.12r/lib/md5.c  2004-03-05 02:55:49.000000000 +0100
+++ util-linux-2.12r.new/lib/md5.c      2006-09-17 15:10:40.000000000 +0200
@@ -14,9 +14,11 @@
  * needed on buffers full of bytes, and then call MD5Final, which
  * will fill a supplied 16-byte array with the digest.
  */
-#include <string.h>            /* for memcpy() */
 
 #include "md5.h"
+#if 0
+
+#include <string.h>            /* for memcpy() */
 
 #ifndef HIGHFIRST
 #define byteReverse(buf, len)  /* Nothing */
@@ -251,4 +253,5 @@
 }
 
 #endif
-
+#endif
+// EOF
diff -Naur util-linux-2.12r/lib/md5.h util-linux-2.12r.new/lib/md5.h
--- util-linux-2.12r/lib/md5.h  2004-03-05 02:56:18.000000000 +0100
+++ util-linux-2.12r.new/lib/md5.h      2006-09-17 15:30:25.000000000 +0200
@@ -2,6 +2,16 @@
 #define MD5_H
 
 #include "../defines.h"
+
+#include <sys/types.h>
+#include <openssl/md5.h>
+
+#define MD5Init(context)               MD5_Init((context))
+#define        MD5Update(context, buf, len)    MD5_Update((context), (buf), 
(len))
+#define        MD5Final(digest, context)       MD5_Final((digest), (context))
+
+#if 0
+
 #ifdef HAVE_stdint_h
 #include <stdint.h>
 #else
@@ -26,3 +36,4 @@
 typedef struct MD5Context MD5_CTX;
 
 #endif /* !MD5_H */
+#endif
diff -Naur util-linux-2.12r/misc-utils/Makefile 
util-linux-2.12r.new/misc-utils/Makefile
--- util-linux-2.12r/misc-utils/Makefile        2004-12-05 20:09:12.000000000 
+0100
+++ util-linux-2.12r.new/misc-utils/Makefile    2006-09-17 15:14:42.000000000 
+0200
@@ -93,6 +93,7 @@
 kill: kill.o procs.o
 logger: logger.o
 mcookie: mcookie.o $(LIB)/md5.o
+       $(CC) $(LDFLAGS) $^ -o $@ -lcrypto
 mcookie.o: mcookie.c $(LIB)/md5.h
 reset: reset.sh
 script: script.o
diff -Naur util-linux-2.12r/misc-utils/mcookie.c 
util-linux-2.12r.new/misc-utils/mcookie.c
--- util-linux-2.12r/misc-utils/mcookie.c       2002-03-09 00:00:52.000000000 
+0100
+++ util-linux-2.12r.new/misc-utils/mcookie.c   2006-09-17 15:19:17.000000000 
+0200
@@ -52,7 +52,7 @@
 
 /* The basic function to hash a file */
 static off_t
-hash_file(struct MD5Context *ctx, int fd)
+hash_file(MD5_CTX *ctx, int fd)
 {
    off_t count = 0;
    ssize_t r;
@@ -71,7 +71,7 @@
 int main( int argc, char **argv )
 {
    int               i;
-   struct MD5Context ctx;
+   MD5_CTX           ctx;
    unsigned char     digest[16];
    unsigned char     buf[BUFFERSIZE];
    int               fd;
-- 
http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to