[Forensics-changes] [SCM] debian-forensics/wipe branch, debian, updated. debian/0.21-9-3-gb5f673f

Christophe Monniez christophe.monniez at fccu.be
Thu Dec 23 13:28:45 UTC 2010


The following commit has been merged in the debian branch:
commit 1ed9e04e516c2808a60d96288859368f3cd0ca0a
Author: Christophe Monniez <christophe.monniez at fccu.be>
Date:   Thu Dec 23 14:26:37 2010 +0100

    Merging upstream version 0.22.

diff --git a/CHANGES b/CHANGES
index 2cb579d..44500ce 100644
--- a/CHANGES
+++ b/CHANGES
@@ -104,3 +104,8 @@ Sat Jun 12 19:21:01 CEST 2004
 Wed Sep 20 17:32:02 CEST 2006
         version 0.21 - Included Debian patch for severe bug that affected the
                        computation of the size of large partitions.
+
+Sun Nov 07 09:30:10 EST 2010
+        version 0.22 - Include patch by Karako Miklos to skip a number of patches.
+                       Also did a clean up of headers (remove obsolete addresses
+                       and CVS tags).
diff --git a/Makefile b/Makefile
index bdddf21..17d9758 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-# Makefile for wipe, version 0.21, by Berke Durak
-# $Id: Makefile,v 1.2 2004/06/12 17:49:47 berke Exp $
-# echo berke1ouvaton2org|tr 12 @.
+# Makefile for wipe by Berke Durak
+# 
+# echo berke1lambda-diode2com|tr 12 @.
 #
 # define HAVE_OSYNC if an O_SYNC bit can be specified for the open () call
 # (see open(2))
@@ -42,7 +42,7 @@
 #
 
 CC_LINUX=gcc
-CCO_LINUX=-Wall -DHAVE_DEV_URANDOM -DHAVE_OSYNC -DHAVE_STRCASECMP -DHAVE_RANDOM -DWEAK_RC6 -DSYNC_WAITS_FOR_SYNC -DFIND_DEVICE_SIZE_BY_BLKGETSIZE -DSIXTYFOUR -D__USE_LARGEFILE -D__USE_FILE_OFFSET64
+CCO_LINUX=-Wall -DHAVE_DEV_URANDOM -DHAVE_OSYNC -DHAVE_STRCASECMP -DHAVE_RANDOM -DWEAK_RC6 -DSYNC_WAITS_FOR_SYNC -DFIND_DEVICE_SIZE_BY_BLKGETSIZE -DSIXTYFOUR -D__USE_LARGEFILE -D_FILE_OFFSET_BITS=64
 # default should be to turn off debugging and to turn on optimization.
 #CCO_LINUX+=-O9 -pipe -fomit-frame-pointer -finline-functions -funroll-loops -fstrength-reduce
 CCO_LINUX+=$(CFLAGS)
@@ -153,9 +153,16 @@ generic	:
 wipe	:	$(OBJECTS)
 		$(CC) $(CCO) $(OBJECTS) -o wipe
 
-wipe.o	:	wipe.c random.h misc.h
+wipe.o	:	wipe.c random.h misc.h version.h
 		$(CC) $(CCO) $(CCOC) wipe.c -o wipe.o
 
+version.h: always
+		if which git >/dev/null 2>&1 ; then \
+			git rev-list --max-count=1 HEAD | sed -e 's/^/#define WIPE_GIT "/' -e 's/$$/"/' >version.h ; \
+	  else \
+			echo '#define WIPE_GIT "(unknown, compiled without git)"' >version.h ; \
+	  fi
+
 random.o	:	random.c misc.h md5.h
 		$(CC) $(CCO) $(CCOC) random.c -o random.o
 
@@ -165,7 +172,6 @@ rc6.o	:	rc6.c rc6.h
 arcfour.o	:	arcfour.c arcfour.h
 		$(CC) $(CCO) $(CCOC) arcfour.c -o arcfour.o
 
-
 md5.o	:	md5.c md5.h
 		$(CC) $(CCO) $(CCOC) md5.c -o md5.o
 
@@ -176,7 +182,9 @@ wipe.tr-asc.1	:	wipe.tr.1
 			./trtur <wipe.tr.1 >wipe.tr-asc.1
 
 clean	:	
-		rm -f wipe $(OBJECTS) wipe.tr-asc.1 *~ DEADJOE core
+		rm -f wipe $(OBJECTS) wipe.tr-asc.1 version.h
 
 install:
 	install -m755 -o root -g root wipe $(DESTDIR)/usr/bin
+
+.PHONY: always clean install
diff --git a/README b/README
index 314f333..a5fa167 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-wipe 0.21 by Berke Durak Wed Sep 20 17:32:02 CEST 2006
+wipe 0.23 by Berke Durak Sun Nov 07 2009
 
 WHAT IS WIPE ?
 
@@ -24,7 +24,7 @@ CHANGES
 
 See the file CHANGES for a short history of wipe. You can get the latest
 version of wipe at these addresses:
-	http://abaababa.ouvaton.org/wipe/
+  http://lambda-diode.com/software/wipe/
 
 COPYING
 
@@ -36,21 +36,21 @@ Wiping is a tricky affair. "wipe" tries to do everything that a portable
 user-level program can do to securely erase the given files. However,
 there are several limitations:
 
-	1.Since file meta information such as file name, size,
-	  creation/modification/access dates as well as directory
- 	  structures are filesystem-specific, and as file systems
+  1.Since file meta information such as file name, size,
+    creation/modification/access dates as well as directory
+    structures are filesystem-specific, and as file systems
           tend to have extremely various architectures, there is
-	  no hope in seeing a uniform interface for accessing
-	  low-level filesystem data. Therefore a portable program
-	  must be filesystem-independent. It must thus use
-	  standard file operations in a way that will make most
-	  file systems effectively overwrite the desired portions
-	  of the magnetic media.
-
-	2.Since IDE and SCSI hard disks are driven by their own
-	  logic, nothing guarantees that the required data is
-	  written out effectively at the required place, i.e.
-	  over the old data.
+    no hope in seeing a uniform interface for accessing
+    low-level filesystem data. Therefore a portable program
+    must be filesystem-independent. It must thus use
+    standard file operations in a way that will make most
+    file systems effectively overwrite the desired portions
+    of the magnetic media.
+
+  2.Since IDE and SCSI hard disks are driven by their own
+    logic, nothing guarantees that the required data is
+    written out effectively at the required place, i.e.
+    over the old data.
 
         3.The successfull erasure of off-track data is a function of
           drive temperature, usage history, drive mechanics and
@@ -94,18 +94,18 @@ For maximum safety, use an encrypted file system.
 Use wipe to clean whole partitions. For example, if I had guilty
 stuff on /dev/hda3, assuming that /dev/hda3 is less than, say 70% full,
 I would first mount /dev/hda3 on /mount, then do
-	wipe -cfrsF /mount/
+  wipe -cfrsF /mount/
 to wipe the contents of the data files using 34 passes, then
-	wipe -kqZ -Q 1 /dev/hda3
+  wipe -kqZ -Q 1 /dev/hda3
 to erase file meta-information. However if /dev/hda3 is more
 than 70% full, it might be quicker to erase the whole hard disk
 using 34 passes:
-	wipe -kZ /dev/hda3
+  wipe -kZ /dev/hda3
 If you don't have to hide that you have guilty stuff but just want
 to be sure that someone else won't get at the CONTENTS of that guilty
 stuff, or in other words if you don't care about wiping file names,
 sizes etc. but just want to wipe out file contents, simply do
-	wipe -cfrZF /mount/.
+  wipe -cfrZF /mount/.
 
 And, last but not least, think of TEMPEST monitoring. I don't know
 how feasible it is to remotely eavesdrop your computer's internal
@@ -134,12 +134,14 @@ Many thanks to the following people who sent in bug reports, compilation tips,
 and even whole patches ! In alphabetical order, hoping to not forget anyone,
 they are:
 
-	Alexey Marinichev
-	Chris L. Mason
-	Jason Axley
-	Michael S. Rhee
-	Paul H. Hargrove
-	Thomas Schoepf
+  Alexey Marinichev
+  Chris L. Mason
+  Jason Axley
+  Erik Vogan, 64-bit offset fix
+  Michael S. Rhee
+  Paul H. Hargrove
+  Peter Miller, for contributing an ETA patch
+  Thomas Schoepf
 
 INSTALLATION
 
@@ -170,5 +172,5 @@ as a PRNG.
 
 AUTHOR
 
-I can be reached at <berke at ouvaton.org>.  Send bug reports, ideas for
+I can be reached at <berke at lambda-diode.com>.  Send bug reports, ideas for
 improvement, compilation problems and other comments to this address.
diff --git a/arcfour.c b/arcfour.c
index 2491100..01902f7 100644
--- a/arcfour.c
+++ b/arcfour.c
@@ -1,9 +1,6 @@
 /* wipe
- * $Id: arcfour.c,v 1.1.1.1 2002/11/25 23:59:49 berke Exp $
+ * 
  * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
- *
- * URL for wipe: http://abaababa.ouvaton.org/wipe/
  *
  * Arcfour implementation, beta.
  *
diff --git a/arcfour.h b/arcfour.h
index bdc9f42..6ba8522 100644
--- a/arcfour.h
+++ b/arcfour.h
@@ -1,9 +1,6 @@
 /* wipe
- * $Id: arcfour.h,v 1.1.1.1 2002/11/25 23:59:49 berke Exp $
- * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
  *
- * URL for wipe: http://abaababa.ouvaton.org/wipe/
+ * by Berke Durak
  *
  * Arcfour implementation, beta.
  *
diff --git a/misc.c b/misc.c
index 686382d..dcf72fd 100644
--- a/misc.c
+++ b/misc.c
@@ -1,9 +1,6 @@
 /* wipe
- * $Id: misc.c,v 1.1.1.1 2002/11/25 23:59:49 berke Exp $
- * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
  *
- * URL for wipe: http://abaababa.ouvaton.org/wipe/
+ * by Berke Durak
  *
  * General-purpose miscellaneous routines: debugging, etc.
  *
diff --git a/misc.h b/misc.h
index 047e2f7..64cb452 100644
--- a/misc.h
+++ b/misc.h
@@ -1,9 +1,6 @@
 /* wipe
- * $Id: misc.h,v 1.1.1.1 2002/11/25 23:59:49 berke Exp $
+ * 
  * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
- *
- * URL for wipe: http://abaababa.ouvaton.org/wipe/
  *
  * General-purpose miscellaneous routines: debugging, etc.
  *
diff --git a/random.c b/random.c
index 64ab1b5..bb5bda9 100644
--- a/random.c
+++ b/random.c
@@ -1,7 +1,6 @@
 /* wipe
- * $Id: random.c,v 1.1.1.1 2002/11/25 23:59:49 berke Exp $
+ * 
  * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
  *
  * Cryptographically-strong (as well as weak) random data generation
  *
diff --git a/random.h b/random.h
index cf09b73..e7160d9 100644
--- a/random.h
+++ b/random.h
@@ -1,7 +1,6 @@
 /* wipe
- * $Id: random.h,v 1.1.1.1 2002/11/25 23:59:49 berke Exp $
+ * 
  * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
  *
  * Header file for cryptographically-strong (as well as weak)
  * random data generation routines
diff --git a/wipe.1 b/wipe.1
index 65822fd..fd0670b 100644
--- a/wipe.1
+++ b/wipe.1
@@ -1,4 +1,4 @@
-.TH WIPE 1 "Wed Sep 20 17:32:02 CEST 2006" "Linu" "User Commands"
+.TH WIPE 1 "Sun Nov  7 09:41:23 EST 2010" "Linux" "User Commands"
 .SH NAME
 wipe \- securely erase files from magnetic media
 .SH SYNOPSIS
@@ -8,10 +8,10 @@ wipe [options] path1 path2 ... pathn
 
 .SH "CURRENT\-VERSION"
 This manual page describes version
-.B 0.21
+.B 0.22
 of
 .B wipe
-, released September 2006.
+, released November 2010.
 
 
 .SH DESCRIPTION
diff --git a/wipe.c b/wipe.c
index 892952b..4a85762 100644
--- a/wipe.c
+++ b/wipe.c
@@ -1,9 +1,20 @@
 /* wipe
- * $Id: wipe.c,v 1.2 2004/06/12 17:49:47 berke Exp $
+ *
  * by Berke Durak
- * Author may be contacted at 'echo berke1ouvaton2org|tr 12 @.'
  *
- * URL for wipe: http://abaababa.ouvaton.org/wipe/
+ * With many thanks to the following contributors:
+ *     Jason Axley
+ *     Alexey Marinichev
+ *     Chris L. Mason
+ *     Karako Miklos
+ *     Jim Paris
+ *     Thomas Schoepf
+ *
+ * Author may be contacted at 'echo berke1lambda-diode|com 12 @.'
+ *
+ * URL for wipe:   http://lambda-diode.com/software/wipe
+ * Git repository: http://github.com/berke/wipe
+ *                 git clone https://github.com/berke/wipe.git
  *
  * Securely erase files from magnetic media
  * Based on data from article "Secure Deletion of Data from Magnetic
@@ -13,8 +24,8 @@
 
 /*** defines */
 
-#define WIPE_VERSION "0.21"
-#define WIPE_DATE "2006-09-20"
+#define WIPE_VERSION "0.22"
+#define WIPE_DATE "2010-11-07"
 #define WIPE_CVS "$Id: wipe.c,v 1.2 2004/06/12 17:49:47 berke Exp $"
 
 /* exit codes */
@@ -77,9 +88,9 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 
-
 #include "random.h"
 #include "misc.h"
+#include "version.h"
 
 /* includes ***/
 
@@ -141,6 +152,7 @@ int o_recurse = 0;
 int o_dereference_symlinks = 0;
 int o_quick = 0;
 int o_quick_passes = QUICKPASSES;
+int o_quick_passes_set = 0;
 int o_verbose = 0;
 int o_silent = 0;
 char *o_devrandom = DEVRANDOM;
@@ -158,6 +170,7 @@ int o_lg2_buffer_size = BUFLG2;
 int o_buffer_size = 1<<BUFLG2;
 int o_wipe_length_set = 0;
 int o_wipe_exact_size = 0;
+int o_skip_passes = 0;
 
 /* End of Options ***/
 
@@ -227,7 +240,7 @@ inline static void fill_random_from_table (char *b,
 
 inline static void fill_random (char *b, int n)
 {
-    rand_Fill (b, n);
+    rand_Fill ((u8 *) b, n);
 }
 
 /* fill_random ***/
@@ -560,6 +573,105 @@ static int wipe_filename_and_remove (char *fn)
 
 /* wipe_filename_and_remove ***/
 
+#include <sys/time.h>
+
+static double
+get_time_of_day(void)
+{
+    struct timeval tv;
+    gettimeofday(&tv, 0);
+    return (tv.tv_usec * 1e-6 + tv.tv_sec);
+}
+
+static double eta_start_time;
+
+static void
+eta_begin()
+{
+    eta_start_time = get_time_of_day();
+}
+
+static void
+eta_progress(char *buf, size_t bufsiz, double frac)
+{
+    double now;
+    double elapsed;
+    double total;
+    double seconds_per_year;
+    double remaining;
+    long lsec;
+    int sec;
+    long lmin;
+    int min;
+    long lhours;
+    int hours;
+    long ldays;
+    int days;
+    int weeks;
+    
+    now = get_time_of_day();
+    elapsed = now - eta_start_time;
+
+    buf[0] = '\0';
+    if (elapsed < 5 && frac < 0.1)
+        return;
+
+    total = elapsed / frac;
+    seconds_per_year = 365.25 * 24 * 60 * 60;
+    remaining = total - elapsed;
+    if (remaining > seconds_per_year)
+    {
+        snprintf(buf, bufsiz, "  ETA %g years", remaining / seconds_per_year);
+        return;
+    }
+    lsec = remaining;
+    sec = lsec % 60;
+    lmin = lsec / 60;
+    min = lmin % 60;
+    lhours = lmin / 60;
+    hours = lhours % 24;
+    ldays = lhours / 24;
+    days = ldays % 7;
+    weeks = ldays / 7;
+    if (weeks > 0)
+    {
+        snprintf(buf, bufsiz, "  ETA %dw %dd", weeks, days);
+        return;
+    }
+    if (days > 0)
+    {
+        snprintf(buf, bufsiz, "  ETA %dd %dh", days, hours);
+        return;
+    }
+    if (hours > 0)
+    {
+        snprintf(buf, bufsiz, "  ETA %dh%02dm", hours, min);
+        return;
+    }
+    snprintf(buf, bufsiz, "  ETA %dm%02ds", min, sec);
+}
+
+
+static void
+pad(char *buf, size_t bufsiz)
+{
+    size_t len;
+    
+    len = strlen(buf);
+    while (len + 1 < bufsiz)
+        buf[len++] = ' ';
+    buf[len] = '\0';
+}
+
+
+static void
+backspace(char *dst, const char *src)
+{
+    while (*src++)
+        *dst++ = '\b';
+    *dst = '\0';
+}
+
 /*** dothejob -- nonrecursive wiping of a single file or device */
 
 /* determine parameters of region to be wiped
@@ -807,8 +919,13 @@ static int dothejob (char *fn)
         debugf ("buffers_to_wipe = %d, o_buffer_size = %d, wi.n_passes = %d",
                 buffers_to_wipe, o_buffer_size, wi.n_passes);
 
+	if (o_skip_passes > 0) {
+	    printf ("\rSkip first %d pass(es)\n", o_skip_passes);
+	}
+
         /* do the passes */
-        for (i = 0; i<wi.n_passes; i++) {
+        eta_begin();
+        for (i = o_skip_passes; i<wi.n_passes; i++) {
             ssize_t wr;
 
             if (!o_silent) {
@@ -831,8 +948,20 @@ static int dothejob (char *fn)
                 if (!o_silent) {
                     t = time (0);
                     if ((bpi && (t-lt)) || ((t-lt>2) && j<(buffers_to_wipe>>1))) {
-                        fprintf (stderr,
-                                "[%8ld / %8ld]\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", (long) j, (long) buffers_to_wipe);
+                        char buf1[30];
+                        char buf1_bs[sizeof (buf1)];
+                        char buf2[18];
+                        char buf2_bs[sizeof(buf2)];
+                        snprintf(buf1, sizeof(buf1),
+                                "[%8ld / %8ld]", (long) j, (long)buffers_to_wipe);
+                        backspace(buf1_bs, buf1);
+                        eta_progress(buf2, sizeof(buf2),
+                            ((double)i + ((double)j / buffers_to_wipe)) / wi.n_passes);
+                        if (buf2[0])
+                            pad(buf2, sizeof(buf2));
+                        backspace(buf2_bs, buf2);
+                        fprintf(stderr, "%s%s%s%s", buf1, buf2, buf2_bs,
+                            buf1_bs);
                         fflush (stderr);
                         lt = t;
                         bpi = 1;
@@ -1087,13 +1216,12 @@ void banner ()
 {
     fprintf (stderr, "This is wipe version " WIPE_VERSION ".\n"
             "\n"
-            "Author: Berke Durak.\n"
-            "Author's e-mail address: echo berke1ouvaton2org|tr 12 @.\n"
-            "Web site: http://abaababa.ouvaton.org/wipe/\n"
-            "\n"
-            "Release date: " WIPE_DATE "\n"
-            "Compiled: " __DATE__ "\n"
-            "CVS stuff: " WIPE_CVS "\n"
+            "Author:                  Berke Durak.\n"
+            "Author's e-mail address: echo berke1lambda-diode2com|tr 12 @.\n"
+            "Web site:                http://lambda-diode.com/software/wipe/\n"
+            "Release date:            " WIPE_DATE "\n"
+            "Compiled:                " __DATE__ "\n"
+            "Git version:             " WIPE_GIT "\n"
             "\n"
             "Based on data from \"Secure Deletion of Data from Magnetic and Solid-State\n"
             "Memory\" by Peter Gutmann <pgut001 at cs.auckland.ac.nz>.\n");
@@ -1101,7 +1229,7 @@ void banner ()
 
 /* banner ***/
 
-#define OPTSTR "DfhvrqspciR:S:M:kFZl:o:b:Q:T:P:e"
+#define OPTSTR "X:DfhvrqspciR:S:M:kFZl:o:b:Q:T:P:e"
 
 /*** reject and usage */
 
@@ -1160,7 +1288,8 @@ void usage (void)
         "\t\t-T <tries> Set maximum number of tries for free\n"
         "\t\t\tfilename search; default is 10\n"
         "\t\t-v Show version information\n"
-        "\t\t-Z Do not attempt to wipe file size\n",
+        "\t\t-Z Do not attempt to wipe file size\n"
+        "\t\t-X <number> Skip this number of passes (useful for continuing a wiping operation)\n",
     progname
         );
 
@@ -1239,6 +1368,11 @@ int main (int argc, char **argv)
         if (c<0) break;
 
         switch (c) {
+	    case 'X': o_skip_passes = atoi(optarg);
+	        if (o_skip_passes <= 0) {
+                    reject ("number of skipped passes must be strictly positive");
+                }
+                break;
             case 'c': o_dochmod = 1; break;
             case 'D': o_dereference_symlinks = 1; break;
             case 'e': o_wipe_exact_size = 1; break;
@@ -1283,8 +1417,7 @@ int main (int argc, char **argv)
                                   }
                                   break;
             case 'Q':   o_quick_passes = atoi (optarg);
-                        if (o_quick_passes <= 0)
-                            reject ("number of quick passes must be strictly positive");
+                        o_quick_passes_set = 1;
                         break;
             case 'S':
                         if (optarg[1]) 
@@ -1327,6 +1460,10 @@ int main (int argc, char **argv)
         }
     }
 
+    if (o_quick_passes_set && !o_quick) {
+        reject ("option -Q useless without -q");
+    }
+
     if (optind >= argc) reject ("wrong number of arguments");
 
     if (o_recurse && o_dereference_symlinks) reject ("options -D and -r are mutually exclusive");

-- 
debian-forensics/wipe



More information about the forensics-changes mailing list