From 21569be70d91aad3fb26d3eaf6366c9f9210a18f Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 12 Apr 2011 18:58:30 +0200 Subject: [PATCH] Uses by default the OpenSSL crypto MD5 implementation. --- HISTORY | 1 + TODO | 16 ++++++++++------ configure.ac | 10 ++++++++-- snapraid.1 | 7 +++---- snapraid.c | 10 +++++++++- snapraid.d | 7 +++---- snapraid.txt | 7 +++---- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/HISTORY b/HISTORY index 28347ab8..15ab9801 100644 --- a/HISTORY +++ b/HISTORY @@ -4,6 +4,7 @@ SnapRAID HISTORY 0.4 2011/4 ========== * Added hidden 'dry' command mainly for speed measurement. +* As default, uses the OpenSSL crypto MD5 implementation. 0.3 2011/4 ========== diff --git a/TODO b/TODO index 897c7cb1..33f8344a 100644 --- a/TODO +++ b/TODO @@ -9,14 +9,18 @@ This is a list of possible TODO for SnapRAID. The order is not relevant. * Reduce memory occupation removing the flag field in the block structure. -* Add RAID6 redundancy support. -There is the very good raid6 library from H. Peter Anvin (hpa) in the Linux Kernel ready to use: -See: +* Add RAID6 redundancy support. There is the very good raid6 library from +H. Peter Anvin (hpa) in the Linux Kernel ready to use. See: http://kernel.org/pub/linux/kernel/people/hpa/raid6.pdf http://lxr.linux.no/#linux+v2.6.38/lib/raid6 -* Go multithread to speed up the MD5 computation. We can do it when syncing and checking. +* Go multithread to speed up the MD5 computation. We can do it when syncing and +checking. -* Use the O_NOATIME flag if run as 'root'. -Anyway a better solution is to mount the disk with the "noatime" and "nodiratime" options. +* Evaluate the new MurmorHash3 to use instead MD5. It should be faster, but +unsure of it's reliability. In fact, in MurmorHash2 was found a serious issue +that suggests to wait some time before using it. + +* Use the O_NOATIME flag if run as 'root'. Anyway a better solution is to +mount the disk with the "noatime" and "nodiratime" options. diff --git a/configure.ac b/configure.ac index 375f62ca..10089f98 100644 --- a/configure.ac +++ b/configure.ac @@ -53,8 +53,14 @@ AC_ARG_WITH([crypto], [AS_HELP_STRING([--with-crypto], [enable the use of the MD5 fast implementation of the OpenSSL crypto library])], [], - [with_crypto=no]) -AS_IF([test "x$with_crypto" != xno], [AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_FAILURE([--with-crypto was given, but test for OpenSSL crypto library failed])])]) + [with_crypto=check]) +AS_IF([test "x$with_crypto" != xno], [ + AC_CHECK_LIB([crypto], [MD5], [], + [if test "x$with_crypto" != xcheck; then + AC_MSG_FAILURE([--with-crypto was given, but test for OpenSSL crypto library failed]) + fi + ]) +]) dnl Checks for test environment AS_CASE([$host], diff --git a/snapraid.1 b/snapraid.1 index 7d3c4219..0b706133 100644 --- a/snapraid.1 +++ b/snapraid.1 @@ -299,10 +299,9 @@ Prints more information in the processing. .TP .B \(hyT, \(hy\(hyspeed\(hytest Executes a speed test of the MD5 implementation used. -As default, SnapRAID uses a C implementation, but if -configured with the \(hy\(hywith\(hycrypto option it uses the -MD5 implementation of the OpenSSL crypto library usually -faster as written in highly optimized assembler. +If available, SnapRAID uses the fast MD5 implementation +from the OpenSSL crypto library. Otherwise it uses a +slower C implementation. .TP .B \(hyh, \(hy\(hyhelp Prints a short help screen. diff --git a/snapraid.c b/snapraid.c index e7c3e01e..025eaf6f 100644 --- a/snapraid.c +++ b/snapraid.c @@ -94,7 +94,15 @@ void speed(void) unsigned blocksize = 256 * 1024; void* block = malloc_nofail(blocksize); - printf(PACKAGE " v" VERSION " by Andrea Mazzoleni, " PACKAGE_URL "\n"); +#if HAVE_LIBCRYPTO + printf("Using OpenSSL libcrypto MD5\n"); +#else + printf("Using portable MD5\n"); +#endif +#ifdef __GNUC__ + printf("Compiled with gcc " __VERSION__ "\n"); +#endif + printf("Hashing speed test...\n"); gettimeofday(&start, 0); diff --git a/snapraid.d b/snapraid.d index b61bd61a..3b166d7b 100644 --- a/snapraid.d +++ b/snapraid.d @@ -212,10 +212,9 @@ Options -T, --speed-test Executes a speed test of the MD5 implementation used. - As default, SnapRAID uses a C implementation, but if - configured with the --with-crypto option it uses the - MD5 implementation of the OpenSSL crypto library usually - faster as written in highly optimized assembler. + If available, SnapRAID uses the fast MD5 implementation + from the OpenSSL crypto library. Otherwise it uses a + slower C implementation. -h, --help Prints a short help screen. diff --git a/snapraid.txt b/snapraid.txt index a38c2e13..903f3254 100644 --- a/snapraid.txt +++ b/snapraid.txt @@ -231,10 +231,9 @@ SnapRAID provides three simple commands that allow to: -T, --speed-test Executes a speed test of the MD5 implementation used. - As default, SnapRAID uses a C implementation, but if - configured with the --with-crypto option it uses the - MD5 implementation of the OpenSSL crypto library usually - faster as written in highly optimized assembler. + If available, SnapRAID uses the fast MD5 implementation + from the OpenSSL crypto library. Otherwise it uses a + slower C implementation. -h, --help Prints a short help screen.