mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 13:42:14 +00:00
Merge pull request #648 from Knogle/bruce-7
Implement Bruce Schneier 7-Pass wiping method
This commit is contained in:
24
src/gui.c
24
src/gui.c
@@ -2305,7 +2305,7 @@ void nwipe_gui_method( void )
|
||||
extern int terminate_signal;
|
||||
|
||||
/* The number of implemented methods. */
|
||||
const int count = 10;
|
||||
const int count = 11;
|
||||
|
||||
/* The first tabstop. */
|
||||
const int tab1 = 2;
|
||||
@@ -2367,6 +2367,10 @@ void nwipe_gui_method( void )
|
||||
{
|
||||
focus = 9;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_bruce7 )
|
||||
{
|
||||
focus = 10;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
@@ -2389,6 +2393,7 @@ void nwipe_gui_method( void )
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_verify_zero ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_verify_one ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_is5enh ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_bruce7 ) );
|
||||
mvwprintw( main_window, yy++, tab1, " " );
|
||||
|
||||
/* Print the cursor. */
|
||||
@@ -2524,6 +2529,19 @@ void nwipe_gui_method( void )
|
||||
mvwprintw( main_window, 10, tab2, "device to verify the PRNG stream was " );
|
||||
mvwprintw( main_window, 11, tab2, "successfully written. " );
|
||||
break;
|
||||
case 10:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: very high (7 passes)" );
|
||||
|
||||
mvwprintw( main_window, 4, tab2, "Bruce Schneier 7-Pass Wiping Method: " );
|
||||
mvwprintw( main_window, 5, tab2, "A secure erasure technique developed by the " );
|
||||
mvwprintw( main_window, 6, tab2, "renowned cryptographer Bruce Schneier. " );
|
||||
mvwprintw( main_window, 7, tab2, " " );
|
||||
mvwprintw( main_window, 8, tab2, "This method first overwrites the device with " );
|
||||
mvwprintw( main_window, 9, tab2, "ones (0xFF), followed by zeroes (0x00). Then, " );
|
||||
mvwprintw( main_window, 10, tab2, "it performs five additional passes of PRNG- " );
|
||||
mvwprintw( main_window, 11, tab2, "generated random data to maximize security. " );
|
||||
break;
|
||||
|
||||
} /* switch */
|
||||
|
||||
@@ -2619,6 +2637,10 @@ void nwipe_gui_method( void )
|
||||
case 9:
|
||||
nwipe_options.method = &nwipe_is5enh;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
nwipe_options.method = &nwipe_bruce7;
|
||||
break;
|
||||
}
|
||||
|
||||
} /* nwipe_gui_method */
|
||||
|
||||
49
src/method.c
49
src/method.c
@@ -68,6 +68,7 @@ const char* nwipe_one_label = "Fill With Ones";
|
||||
const char* nwipe_verify_zero_label = "Verify Zeros (0x00)";
|
||||
const char* nwipe_verify_one_label = "Verify Ones (0xFF)";
|
||||
const char* nwipe_is5enh_label = "HMG IS5 Enhanced";
|
||||
const char* nwipe_bruce7_label = "Bruce Schneier 7-Pass";
|
||||
|
||||
const char* nwipe_unknown_label = "Unknown Method (FIXME)";
|
||||
|
||||
@@ -118,6 +119,10 @@ const char* nwipe_method_label( void* method )
|
||||
{
|
||||
return nwipe_is5enh_label;
|
||||
}
|
||||
if( method == &nwipe_bruce7 )
|
||||
{
|
||||
return nwipe_bruce7_label;
|
||||
}
|
||||
|
||||
/* else */
|
||||
return nwipe_unknown_label;
|
||||
@@ -750,6 +755,50 @@ void* nwipe_random( void* ptr )
|
||||
return NULL;
|
||||
} /* nwipe_random */
|
||||
|
||||
void* nwipe_bruce7( void* ptr )
|
||||
{
|
||||
/**
|
||||
* Bruce Schneier 7-Pass wiping method.
|
||||
*
|
||||
* Pass 1: Overwrite the drive with all ones (0xFF).
|
||||
* Pass 2: Overwrite the drive with all zeroes (0x00).
|
||||
* Pass 3-7: Overwrite the drive with five passes of random data.
|
||||
*/
|
||||
|
||||
nwipe_context_t* c = (nwipe_context_t*) ptr;
|
||||
|
||||
/* Get current time at the start of the wipe */
|
||||
time( &c->start_time );
|
||||
|
||||
/* Set wipe in progress flag for GUI */
|
||||
c->wipe_status = 1;
|
||||
|
||||
/* Setup for Bruce Schneier 7-Pass method */
|
||||
char onefill[1] = { '\xFF' };
|
||||
char zerofill[1] = { '\x00' };
|
||||
nwipe_pattern_t patterns[] = {
|
||||
{ 1, &onefill[0] }, // Pass 1: Overwrite with ones
|
||||
{ 1, &zerofill[0] }, // Pass 2: Overwrite with zeroes
|
||||
{ -1, "" }, // Pass 3: Random data
|
||||
{ -1, "" }, // Pass 4: Random data
|
||||
{ -1, "" }, // Pass 5: Random data
|
||||
{ -1, "" }, // Pass 6: Random data
|
||||
{ -1, "" }, // Pass 7: Random data
|
||||
{ 0, NULL } // Terminate pattern array
|
||||
};
|
||||
|
||||
/* Run the Bruce Schneier 7-Pass method */
|
||||
c->result = nwipe_runmethod( c, patterns );
|
||||
|
||||
/* Finished. Set the wipe_status flag so that the GUI knows */
|
||||
c->wipe_status = 0;
|
||||
|
||||
/* Get current time at the end of the wipe */
|
||||
time( &c->end_time );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -54,6 +54,7 @@ void* nwipe_zero( void* ptr );
|
||||
void* nwipe_one( void* ptr );
|
||||
void* nwipe_verify_zero( void* ptr );
|
||||
void* nwipe_verify_one( void* ptr );
|
||||
void* nwipe_bruce7( void* ptr );
|
||||
|
||||
void calculate_round_size( nwipe_context_t* );
|
||||
|
||||
|
||||
@@ -386,6 +386,11 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
nwipe_options.method = &nwipe_is5enh;
|
||||
break;
|
||||
}
|
||||
if( strcmp( optarg, "bruce7" ) == 0 )
|
||||
{
|
||||
nwipe_options.method = &nwipe_bruce7;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Else we do not know this wipe method. */
|
||||
fprintf( stderr, "Error: Unknown wipe method '%s'.\n", optarg );
|
||||
@@ -710,7 +715,8 @@ void display_help()
|
||||
puts( " one - Overwrite with ones (0xFF)" );
|
||||
puts( " verify_zero - Verifies disk is zero filled" );
|
||||
puts( " verify_one - Verifies disk is 0xFF filled" );
|
||||
puts( " is5enh - HMG IS5 enhanced\n" );
|
||||
puts( " is5enh - HMG IS5 enhanced\n" );
|
||||
puts( " bruce7 - Schneier Bruce 7-pass mixed pattern\n" );
|
||||
puts( " -l, --logfile=FILE Filename to log to. Default is STDOUT\n" );
|
||||
puts( " -P, --PDFreportpath=PATH Path to write PDF reports to. Default is \".\"" );
|
||||
puts( " If set to \"noPDF\" no PDF reports are written.\n" );
|
||||
|
||||
Reference in New Issue
Block a user