34 Commits
v0.16 ... v0.21

Author SHA1 Message Date
Martijn van Brummelen
9c63eef565 Version 0.21 2016-08-24 15:21:30 +02:00
Martijn van Brummelen
db9e7ef1aa Merge pull request #22 from nbassler/master
Fix ETA not updating properly and bad total throughput display
2016-08-24 15:58:56 +02:00
Niels Bassler
7039f381af Fix total throughtput display, which showed cummulative throughput, and not current througput. Fix also ETA, which would never decrease. 2016-08-21 19:48:54 +02:00
Martijn van Brummelen
c6fa743f15 Update README/Version 2016-08-04 09:27:48 +02:00
Martijn van Brummelen
61e8e4663f Merge branch 'vuntz-panel-headers' 2016-08-04 09:14:52 +02:00
Martijn van Brummelen
ea198137de Merge branch 'panel-headers' of https://github.com/vuntz/nwipe into vuntz-panel-headers 2016-08-04 09:14:37 +02:00
Martijn van Brummelen
263d5d161f bump version to 0.19 2016-08-04 07:37:37 +02:00
Martijn van Brummelen
15c444e2eb Build on Fedora 2016-08-03 22:36:20 +02:00
Martijn van Brummelen
1e1eadbc0a version 19 2016-08-03 22:24:58 +02:00
martijn van brummelen
d01b00b4f8 Update Release 0.18 2016-07-27 09:33:17 +02:00
martijn van brummelen
3c0c8408f6 remove test file 2016-07-27 09:00:39 +02:00
martijn van brummelen
a619de6134 test 2016-07-27 08:52:42 +02:00
Martijn van Brummelen
3176688f3e Merge pull request #13 from charles-dyfis-net/issues/12
Add libintl, libuuid dependencies to allow parted static link (#12)
2016-07-27 08:07:03 +02:00
Martijn van Brummelen
b03f063e89 Merge pull request #6 from vuntz/kill-warnings
Remove more compiler warnings
2016-07-27 08:05:51 +02:00
Martijn van Brummelen
f9fd45f129 Merge pull request #9 from dmshaw/master
Add "--nosignals" option to nwipe
Automake needs the dist_ prefix to include man pages in 'make dist'
2016-07-27 08:04:50 +02:00
Martijn van Brummelen
d10dca3bed Merge pull request #14 from charles-dyfis-net/issues/11
Move from loff_t to off64_t for musl libc support (#11)
2016-07-27 08:03:26 +02:00
Martijn van Brummelen
8fa0d8c1f4 Merge pull request #18 from TheSqrtMinus1/master
fixed grammar
2016-07-27 08:01:01 +02:00
gabe
47ff866968 fixed grammar 2016-03-15 10:48:13 -04:00
Charles Duffy
edfabad8a1 Add libintl, libuuid dependencies to allow parted static link (#12)
libparted requires libuuid; both require libintl. Static builds currently fail
with link errors due to these missing dependencies.
2015-10-17 15:18:16 -05:00
Charles Duffy
2f44978db4 Move from loff_t to off64_t for musl libc support (#11)
Using musl libc, the loff_t type is unavailable. This is only exported by the
kernel when building with GNU_SOURCE, so there's an argument to be made that
it's desired behavior; see http://www.openwall.com/lists/musl/2013/01/23/6 for
discussion on this point.
2015-10-17 15:15:54 -05:00
David Shaw
fbe6e9d150 Automake needs the dist_ prefix to include man pages in 'make dist' 2015-06-04 14:46:58 -04:00
David Shaw
3ba8d3814b Add "--nosignals" option to tell nwipe to ignore signals during a
wipe.  Intended for use inside scripts where we don't want users to be
able to kill a wipe partway through.
2015-06-04 14:36:36 -04:00
Martijn
8a9a718221 remove test file 2014-10-19 21:49:22 +02:00
Martijn
a86f366147 Missed if statement 2014-10-19 21:15:22 +02:00
Martijn
e1627b3dc5 Patch nwipe.c to fix Debian bug #755473 (thanks Mark Feenstra). 2014-10-19 14:38:15 +02:00
Martijn
167e4787b7 Change start key to S instead of F10. 2014-10-19 14:23:36 +02:00
Martijn
5a63140baf Update version to 0.17 2014-10-19 14:19:44 +02:00
Martijn
35009577ca Remove control reaches end of non-void function" warnings(Thanks Vincent Untz). 2014-10-19 14:04:36 +02:00
Martijn
2b65e93207 Remove unused variables (thanks Vincent Untz). 2014-10-19 13:56:44 +02:00
Martijn
69dda249c2 add test 2014-10-19 13:51:02 +02:00
Vincent Untz
124ec1e4a9 Do not use variable before we set it 2014-09-09 19:11:19 +02:00
Vincent Untz
57c14286db Ensure variable is initialized 2014-09-09 19:10:51 +02:00
Vincent Untz
ae5d2355cb Remove unused variables 2014-09-09 19:10:44 +02:00
Vincent Untz
51d33b9f61 Fix build when panel header is not in /usr/include
When there's no pkg-config file for the panel library, the build breaks
if the header is not in /usr/include.

At least in openSUSE, we have /usr/include/ncurses.h and
/usr/include/ncurses/panel.h.
2014-09-09 18:19:05 +02:00
17 changed files with 159 additions and 59 deletions

31
README
View File

@@ -10,14 +10,41 @@ make install
The ncurses, pthreads and parted libraries are required for compiling.
For any problems, please use the Github page:
https://github.com/abeverley/nwipe
https://github.com/martijnvanbrummelen/nwipe
Andy Beverley
Martijn van Brummelen
RELEASE NOTES
=============
v0.21
- Fix ETA not updating properly and bad total throughput display. Thanks (Niels Bassler).
v0.20
- Fix build when panel header is not in /usr/include (Thanks Vincent Untz).
v0.19
- Fix building on Fedora(Unknown off64_t) bug #19.
- Use PRNG instead of zero's bug #7. Thanks xambroz.
v0.18
=====
- Fixed grammar.
- Move from loff_t to off64_t for musl libc support.
- Add "--nosignals" option.
- Automake needs the dist_ prefix to include man pages in 'make dist'.
- Remove more compiler warnings.
- Add libintl, libuuid dependencies to allow parted static link
v0.17
=====
- Remove control reaches end of non-void function" warnings(Thanks Vincent
Untz).
- Remove unused variables (thanks Vincent Untz).
- Change start key to 'S' instead of F10 (closes debian bug #755474).
- Fix problem with unusable device (Closes debian bug #755473).
v0.16
=====
- Fix problems building with clang compiler (thanks Martijn van Brummelen)

View File

@@ -1,6 +1,6 @@
nwipe is a command that will securely erase disks using a variety of
recognised methods. It is a fork of the dwipe command used by
Darik's Boot and Nuke (dban). nwipe is included with partedmagic if
Darik's Boot and Nuke (dban). nwipe is included with partedmagic if you
want a quick and easy bootable CD version. nwipe was created out of
a need to run the DBAN dwipe command outside of DBAN, in order to
allow its use with any host distribution, thus giving better hardware

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT(nwipe, 0.16, andy@andybev.com)
AM_INIT_AUTOMAKE(nwipe, 0.16)
AC_INIT(nwipe, 0.21, git@brumit.nl)
AM_INIT_AUTOMAKE(nwipe, 0.21)
AC_OUTPUT(Makefile src/Makefile man/Makefile)
AC_CONFIG_SRCDIR([src/nwipe.c])
AC_CONFIG_HEADERS([config.h])
@@ -21,7 +21,14 @@ PKG_CHECK_MODULES(
CFLAGS="${CFLAGS} ${PANEL_CFLAGS}"
LIBS="${LIBS} ${PANEL_LIBS}"
],
[AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])])]
[AC_CHECK_LIB([panel], [main], [
LIBS="-lpanel $LIBS"
AC_CHECK_HEADERS(panel.h,, [
AC_CHECK_HEADERS(ncurses/panel.h, [
AC_DEFINE([PANEL_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
], [AC_MSG_ERROR([ncurses panel headers not found])])
])
], [AC_MSG_ERROR([ncurses panel library not found])])]
)
PKG_CHECK_MODULES(
@@ -42,7 +49,9 @@ PKG_CHECK_MODULES(
)]
)
AC_CHECK_LIB([parted], [ped_device_probe_all], ,[AC_MSG_ERROR([parted development library not found])])
AC_CHECK_LIB([intl], [libintl_dgettext]) # needed to statically link libparted, but not given in its pkgconfig file
AC_CHECK_LIB([uuid], [uuid_generate]) # needed to statically link libparted, but not given in its pkgconfig file
PKG_CHECK_MODULES([PARTED], [libparted])
AC_CHECK_LIB([pthread], [main], ,[AC_MSG_ERROR([pthread development library not found])])
# Checks for header files.

View File

@@ -1 +1 @@
man_MANS = nwipe.1
dist_man_MANS = nwipe.1

View File

@@ -1,4 +1,4 @@
.TH NWIPE "1" "March 2014" "nwipe version 0.16" "User Commands"
.TH NWIPE "1" "October 2014" "nwipe version 0.17" "User Commands"
.SH NAME
nwipe \- securely erase disks
.SH SYNOPSIS
@@ -40,6 +40,9 @@ Open devices in sync mode
\fB\-\-nowait\fR
Do not wait for a key before exiting (default is to wait).
.TP
\fB\-\-nosignals\fR
Do not allow signals to interrupt a wipe (default is to allow).
.TP
\fB\-\-nogui\fR
Do not show the GUI interface. Can only be used with the autonuke option.
Nowait option is automatically invoked with the nogui option.

View File

@@ -7,3 +7,5 @@ AM_LDFLAGS =
# the previous manual Makefile
bin_PROGRAMS = nwipe
nwipe_SOURCES = context.h isaac_rand.c logging.h options.h prng.h nwipe.c gui.c isaac_rand.h method.h pass.c device.c gui.h isaac_standard.h mt19937ar-cok.c nwipe.h mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c version.h
nwipe_CFLAGS = $(PARTED_CFLAGS)
nwipe_LDADD = $(PARTED_LIBS)

View File

@@ -82,7 +82,7 @@ typedef struct nwipe_context_t_
int device_minor; /* The minor device number. */
int device_part; /* The device partition or slice number. */
char* device_name; /* The device file name. */
loff_t device_size; /* The device size in bytes. */
off64_t device_size; /* The device size in bytes. */
struct stat device_stat; /* The device file state from fstat(). */
nwipe_device_t device_type; /* Indicates an IDE, SCSI, or Compaq SMART device. */
int device_target; /* The device target. */

View File

@@ -123,7 +123,7 @@ const char* options_title = " Options ";
const char* stats_title = " Statistics ";
/* Footer labels. */
const char* nwipe_buttons1 = "Ctrl-C=Quit F10=Start M=Method P=PRNG V=Verify R=Rounds B=Blanking-pass Space=Select";
const char* nwipe_buttons1 = "Ctrl-C=Quit S=Start M=Method P=PRNG V=Verify R=Rounds B=Blanking-pass Space=Select";
const char* nwipe_buttons2 = " J=Up K=Down Space=Select";
const char* nwipe_buttons3 = " B=Blank screen, ctrl-c=Quit";
@@ -750,7 +750,7 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
} /* keystroke switch */
} while( keystroke != KEY_F(10) && keystroke != ERR );
} while( keystroke != 'S' && keystroke != ERR );
/* Clear the main window. */
werase( main_window );
@@ -2017,6 +2017,7 @@ void *nwipe_gui_status( void *ptr )
wrefresh( footer_window );
nwipe_misc_thread_data->gui_thread = 0;
return NULL;
} /* nwipe_gui_status */
int compute_stats(void *ptr)
@@ -2035,6 +2036,9 @@ int compute_stats(void *ptr)
int i;
time_t nwipe_time_now = time( NULL );
nwipe_misc_thread_data->throughput = 0;
nwipe_misc_thread_data->maxeta = 0;
/* Enumerate all contexts to compute statistics. */
for( i = 0 ; i < count ; i++ )

View File

@@ -111,6 +111,7 @@ void *nwipe_zero( void *ptr )
/* Finished. Set the thread ID to 0 so that the GUI knows */
c->thread = 0;
return NULL;
} /* nwipe_zero */
@@ -173,6 +174,7 @@ void *nwipe_dod522022m( void *ptr )
/* Finished. Set the thread ID to 0 so that the GUI knows */
c->thread = 0;
return NULL;
} /* nwipe_dod522022m */
@@ -229,6 +231,7 @@ void *nwipe_dodshort( void *ptr )
/* Finished. Set the thread ID to 0 so that the GUI knows */
c->thread = 0;
return NULL;
} /* nwipe_dodshort */
@@ -355,6 +358,7 @@ void *nwipe_gutmann( void *ptr )
/* Finished. Set the thread ID to 0 so that the GUI knows */
c->thread = 0;
return NULL;
} /* nwipe_gutmann */
@@ -506,6 +510,7 @@ void *nwipe_ops2( void *ptr )
/* Finished. Set the thread ID to 0 so that the GUI knows */
c->thread = 0;
return NULL;
} /* nwipe_ops2 */
@@ -534,6 +539,7 @@ void *nwipe_random( void *ptr )
/* Finished. Set the thread ID to 0 so that the GUI knows */
c->thread = 0;
return NULL;
} /* nwipe_random */

View File

@@ -48,18 +48,9 @@ int main( int argc, char** argv )
int nwipe_enumerated; /* The number of contexts that have been enumerated. */
int nwipe_error = 0; /* An error counter. */
int nwipe_selected = 0; /* The number of contexts that have been selected. */
int nwipe_shmid; /* A shared memory handle for the context array. */
int nwipe_wait = 0; /* The number of child processes that have returned. */
pthread_t nwipe_gui_thread; /* The thread ID of the GUI thread. */
pthread_t nwipe_sigint_thread; /* The thread ID of the sigint handler. */
/* The list of device filenames. */
char** nwipe_names = NULL;
/* Used to write-out the result file. */
char nwipe_result_file [FILENAME_MAX];
FILE* nwipe_result_fp;
/* The entropy source file handle. */
int nwipe_entropy;
@@ -78,9 +69,6 @@ int main( int argc, char** argv )
/* Initialised and populated in device scan. */
nwipe_context_t **c1 = 0;
/* The array of pointers to contexts that will actually be wiped. */
nwipe_context_t **c2 = (nwipe_context_t **)malloc(nwipe_enumerated * sizeof(nwipe_context_t *));
/* Parse command line options. */
nwipe_optind = nwipe_options_parse( argc, argv );
@@ -105,13 +93,21 @@ int main( int argc, char** argv )
else
{
argv += nwipe_optind;
argv += nwipe_optind;
argc -= nwipe_optind;
nwipe_enumerated = nwipe_device_get( &c1, argv, argc );
if ( nwipe_enumerated == 0 )
{
exit(1);
}
}
/* The array of pointers to contexts that will actually be wiped. */
nwipe_context_t **c2 = (nwipe_context_t **)malloc(nwipe_enumerated * sizeof(nwipe_context_t *));
/* Open the entropy source. */
nwipe_entropy = open( NWIPE_KNOB_ENTROPY, O_RDONLY );
@@ -151,12 +147,14 @@ int main( int argc, char** argv )
nwipe_misc_thread_data.gui_thread = &nwipe_gui_thread;
nwipe_thread_data_ptr.nwipe_misc_thread_data = &nwipe_misc_thread_data;
pthread_attr_t pthread_attr;
pthread_attr_init(&pthread_attr);
pthread_attr_setdetachstate(&pthread_attr, PTHREAD_CREATE_DETACHED);
pthread_create( &nwipe_sigint_thread, &pthread_attr, signal_hand, &nwipe_thread_data_ptr);
if( !nwipe_options.nosignals )
{
pthread_attr_t pthread_attr;
pthread_attr_init(&pthread_attr);
pthread_attr_setdetachstate(&pthread_attr, PTHREAD_CREATE_DETACHED);
pthread_create( &nwipe_sigint_thread, &pthread_attr, signal_hand, &nwipe_thread_data_ptr);
}
/* A context struct for each device has already been created. */
/* Now set specific nwipe options */
@@ -358,7 +356,7 @@ int main( int argc, char** argv )
}
if( c2[i]->device_size == (loff_t)-1 )
if( c2[i]->device_size == (off64_t)-1 )
{
/* We cannot determine the size of this device. */
nwipe_perror( errno, __FUNCTION__, "lseek" );
@@ -371,7 +369,7 @@ int main( int argc, char** argv )
/* Reset the file pointer. */
r = lseek( c2[i]->device_fd, 0, SEEK_SET );
if( r == (loff_t)-1 )
if( r == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to reset the '%s' file offset.", c2[i]->device_name );
@@ -527,7 +525,7 @@ void *signal_hand(void *ptr)
if ( c[i]->thread )
{
char *status;
char *status = "";
switch( c[i]->pass_type )
{
case NWIPE_PASS_FINAL_BLANK:

View File

@@ -31,6 +31,11 @@
#define _FILE_OFFSET_BITS 64
#endif
/* workaround for Fedora */
#ifndef off64_t
# define off64_t off_t
#endif
/* Busybox headers. */
#ifdef BB_VER
#include "busybox.h"
@@ -65,12 +70,15 @@ extern int log_current_element;
extern int log_elements_allocated;
extern pthread_mutex_t mutex1;
/* Ncurses headers. Assume panel.h is in same place.*/
/* Ncurses headers. */
#ifdef NCURSES_IN_SUBDIR
#include <ncurses/ncurses.h>
#include <ncurses/panel.h>
#else
#include <ncurses.h>
#endif
#ifdef PANEL_IN_SUBDIR
#include <ncurses/panel.h>
#else
#include <panel.h>
#endif

View File

@@ -81,6 +81,9 @@ int nwipe_options_parse( int argc, char** argv )
/* Whether to exit after wiping or wait for a keypress. */
{ "nowait", no_argument, 0, 0 },
/* Whether to allow signals to interrupt a wipe. */
{ "nosignals", no_argument, 0, 0 },
/* Whether to exit after wiping or wait for a keypress. */
{ "nogui", no_argument, 0, 0 },
@@ -114,6 +117,7 @@ int nwipe_options_parse( int argc, char** argv )
nwipe_options.rounds = 1;
nwipe_options.noblank = 0;
nwipe_options.nowait = 0;
nwipe_options.nosignals= 0;
nwipe_options.nogui = 0;
nwipe_options.sync = 0;
nwipe_options.verify = NWIPE_VERIFY_LAST;
@@ -151,6 +155,12 @@ int nwipe_options_parse( int argc, char** argv )
break;
}
if( strcmp( nwipe_options_long[i].name, "nosignals" ) == 0 )
{
nwipe_options.nosignals = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "nogui" ) == 0 )
{
nwipe_options.nogui = 1;
@@ -332,6 +342,11 @@ void nwipe_options_log( void )
nwipe_log( NWIPE_LOG_NOTICE, " do not wait for a key before exiting" );
}
if( nwipe_options.nosignals )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not allow signals to interrupt a wipe" );
}
if( nwipe_options.nogui )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not show GUI interface" );
@@ -394,6 +409,7 @@ display_help()
puts(" -r, --rounds=NUM Number of times to wipe the device using the selected method (default: 1)" );
puts(" --noblank Do not blank disk after wipe (default is to complete a final blank pass)" );
puts(" --nowait Do not wait for a key before exiting (default is to wait)" );
puts(" --nosignals Do not allow signals to interrupt a wipe (default is to allow)" );
puts(" --nogui Do not show the GUI interface. Automatically invokes the nowait option" );
puts(" Must be used with --autonuke option. Send SIGUSR1 to log current stats");
puts("");

View File

@@ -49,6 +49,7 @@ typedef struct /* nwipe_options_t */
int autonuke; /* Do not prompt the user for confirmation when set. */
int noblank; /* Do not perform a final blanking pass. */
int nowait; /* Do not wait for a final key before exiting. */
int nosignals; /* Do not allow signals to interrupt a wipe. */
int nogui ; /* Do not show the GUI. */
char* banner; /* The product banner shown on the top line of the screen. */
// nwipe_method_t method; /* A function pointer to the wipe method that will be used. */

View File

@@ -46,7 +46,7 @@ int nwipe_random_verify( nwipe_context_t* c )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The input buffer. */
char* b;
@@ -98,7 +98,7 @@ int nwipe_random_verify( nwipe_context_t* c )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -177,7 +177,7 @@ int nwipe_random_verify( nwipe_context_t* c )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial read.", c->device_name );
@@ -225,7 +225,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The output buffer. */
char* b;
@@ -267,7 +267,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -328,7 +328,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial write.", c->device_name );
@@ -388,7 +388,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The input buffer. */
char* b;
@@ -470,7 +470,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -534,7 +534,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial read.", c->device_name );
@@ -587,7 +587,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The output buffer. */
char* b;
@@ -638,7 +638,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -697,7 +697,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial write.", c->device_name );

View File

@@ -25,6 +25,7 @@
#include "mt19937ar-cok.h"
#include "isaac_rand.h"
nwipe_prng_t nwipe_twister =
{
"Mersenne Twister (mt19937ar-cok)",
@@ -40,6 +41,25 @@ nwipe_prng_t nwipe_isaac =
};
/* Print given number of bytes from unsigned integer number to a byte stream buffer starting with low-endian*/
int nwipe_u32tobuffer(u8 *buffer, u32 rand, int len)
{
int i;
u8 c; //single char
if (len > sizeof(u32))
{
nwipe_log( NWIPE_LOG_FATAL, "Tried to print longer number than the value passed." );
len = sizeof(u32);
}
for (i=0 ; i < len; i++)
{
c=rand & 0xFFUL;
rand = rand >> 8;
buffer[i]=c;
}
return 0;
}
int nwipe_twister_init( NWIPE_PRNG_INIT_SIGNATURE )
{
@@ -54,21 +74,23 @@ int nwipe_twister_init( NWIPE_PRNG_INIT_SIGNATURE )
int nwipe_twister_read( NWIPE_PRNG_READ_SIGNATURE )
{
u32 i=0;
u32 ii;
u32 words = count / sizeof( u32 );
u32 remain = count % sizeof( u32 );
u32 words = count / SIZE_OF_TWISTER ; // the values of twister_genrand_int32 is strictly 4 bytes
u32 remain = count % SIZE_OF_TWISTER ; // the values of twister_genrand_int32 is strictly 4 bytes
/* Twister returns 4-bytes per call, so cast the buffer into words. */
/* Twister returns 4-bytes per call, so progress by 4 bytes. */
for( ii = 0; ii < words; ++ii )
{
((u32*)buffer)[ii] = twister_genrand_int32( (twister_state_t*)*state );
nwipe_u32tobuffer((u8*)(buffer+i), twister_genrand_int32( (twister_state_t*)*state ), SIZE_OF_TWISTER) ;
i = i + SIZE_OF_TWISTER;
}
/* Fill the buffer tail if the count is not evenly divided by the size of u32. */
for( ii = 1; ii <= remain; ++ii )
/* If there is some remainder copy only relevant number of bytes to not
* overflow the buffer. */
if ( remain > 0 )
{
/* Notice how three bytes are discarded by doing this. */
((u8*)buffer)[count-ii] = twister_genrand_int32( (twister_state_t*)*state );
nwipe_u32tobuffer((u8*)(buffer+i), twister_genrand_int32( (twister_state_t*)*state ), remain) ;
}
return 0;

View File

@@ -51,6 +51,10 @@ int nwipe_twister_read( NWIPE_PRNG_READ_SIGNATURE );
int nwipe_isaac_init( NWIPE_PRNG_INIT_SIGNATURE );
int nwipe_isaac_read( NWIPE_PRNG_READ_SIGNATURE );
/* Size of the twister is not derived from the architecture, but it is strictly 4 bytes */
#define SIZE_OF_TWISTER 4
#endif /* PRNG_H_ */
/* eof */

View File

@@ -4,11 +4,11 @@
* used by configure to dynamically assign those values
* to documentation files.
*/
const char *version_string = "0.16";
const char *version_string = "0.21";
const char *program_name = "nwipe";
const char *author_name = "Andy Beverley";
const char *email_address = "andy@andybev.com";
const char *years = "2012";
const char *author_name = "Martijn van Brummelen";
const char *email_address = "git@brumit.nl";
const char *years = "2016";
const char *copyright = "Copyright Darik Horn <dajhorn-dban@vanadac.com>\n\
Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>\n\
This is free software; see the source for copying conditions.\n\