mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-22 15:02:12 +00:00
Compare commits
78 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
154490e56f | ||
|
|
753e758b0a | ||
|
|
7d58587eb0 | ||
|
|
996c6cbf02 | ||
|
|
7eba0aeb1b | ||
|
|
a379329fca | ||
|
|
9196e7748b | ||
|
|
f7730b9fea | ||
|
|
bcb34f7a83 | ||
|
|
a8dbbd46ec | ||
|
|
7a3f2f573f | ||
|
|
8336653926 | ||
|
|
e629d9b2d1 | ||
|
|
70c5383d97 | ||
|
|
708c4e02c8 | ||
|
|
8fcb314ed4 | ||
|
|
6497b43518 | ||
|
|
e6e6ed1e30 | ||
|
|
c821f3176b | ||
|
|
9db8ad854e | ||
|
|
6ce785c2f2 | ||
|
|
cb08dda2de | ||
|
|
2fb882084d | ||
|
|
64caac4b16 | ||
|
|
47e523cf34 | ||
|
|
cf3ae6a0f6 | ||
|
|
a88eeb9383 | ||
|
|
a84894f317 | ||
|
|
5c3eed8813 | ||
|
|
4b1c7007ff | ||
|
|
970d74f0d5 | ||
|
|
c815235f7b | ||
|
|
dcfa13a8db | ||
|
|
a1560de8b5 | ||
|
|
18386f225e | ||
|
|
1f3b36f141 | ||
|
|
962e1053dd | ||
|
|
93ea5f85d0 | ||
|
|
76a7be696c | ||
|
|
630d107558 | ||
|
|
5adc34b9e3 | ||
|
|
5bc61f2bdd | ||
|
|
b55b020a83 | ||
|
|
b34c99b81b | ||
|
|
63d20dc4be | ||
|
|
2111206fa3 | ||
|
|
5263a23cd6 | ||
|
|
a6b60bfd15 | ||
|
|
d8d627dce3 | ||
|
|
95d0b3f382 | ||
|
|
055d2e8b0c | ||
|
|
9f0674b3b9 | ||
|
|
5f332a407d | ||
|
|
543a880064 | ||
|
|
62c604bc0e | ||
|
|
2bc62a7217 | ||
|
|
7f5bc5aa34 | ||
|
|
7fa5c98023 | ||
|
|
4e159a902c | ||
|
|
3090b0682f | ||
|
|
d2dff52407 | ||
|
|
58a5184c88 | ||
|
|
6dcaaa6920 | ||
|
|
8e9e2ae90f | ||
|
|
02e356e0ec | ||
|
|
12063ad954 | ||
|
|
66d239c980 | ||
|
|
462777d92b | ||
|
|
69c9d7d6c5 | ||
|
|
fffee8bb34 | ||
|
|
b8a536a02f | ||
|
|
0c542660ff | ||
|
|
412917ab17 | ||
|
|
f5501ccc45 | ||
|
|
d819330583 | ||
|
|
2061346ace | ||
|
|
69fed30dde | ||
|
|
7cc1a68a89 |
@@ -1,11 +1,11 @@
|
||||
name: ci_ubuntu_16.04
|
||||
name: ci_ubuntu_18.04
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-16.04
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,6 +1,34 @@
|
||||
RELEASE NOTES
|
||||
=============
|
||||
|
||||
v0.32
|
||||
-----------------------
|
||||
- Add ones (0xFF) wipe to the methods. Renamed Zero Fill to Fill with Zeros and the new ones wipe, is called Fill with Ones.
|
||||
- Add ones verication to the methods. Renamed Verify Blank to Verify Zeros (0x00) and the new verification is called Verify Ones (0xFF).
|
||||
- Move method information from below the list of methods to the right of the method list. This allows better use of the screen space by allowing more methods to be added to the list, especially relevant to nwipe running as a standalone application on small distros such as shredos 2020 in frame buffer mode.
|
||||
- Removed the old DBAN syslinux.cfg configuration hints as not relevant to nwipe. See nwipe --help or man nwipe for command line options.
|
||||
- Add fdatasync errors to the error summary table.
|
||||
- During a wipe, you can now toggle between dark screen, blank screen and default blue screen by repeatedly pressing the b key. Dark screen, which is grey text on black background has been introduced to prevent TFT/LCD image persistence on monitors that are sensitive to that issue.
|
||||
|
||||
v0.31
|
||||
-----------------------
|
||||
- Blanking disabled in GUI for OPS2 (mandatory requirement of standard). [#326](https://github.com/martijnvanbrummelen/nwipe/pull/326)
|
||||
- Total bytes written/read for ALL passes or verifications are now logged. [#326](https://github.com/martijnvanbrummelen/nwipe/pull/326)
|
||||
- Final blanking being enabled is no longer required for verification passes. GUI Fix. [#326](https://github.com/martijnvanbrummelen/nwipe/pull/326)
|
||||
- Add a summary table to the log that shows totals for pass & verification errors. [#325](https://github.com/martijnvanbrummelen/nwipe/pull/325)
|
||||
- Fix the missing 'Verifying' message on final blanking. [#324](https://github.com/martijnvanbrummelen/nwipe/pull/324)
|
||||
- Fix prng selection always using mersenne irrespective of whatever prng the user selected. [#323](https://github.com/martijnvanbrummelen/nwipe/pull/323)
|
||||
- Fix a non functional Isaac prng. (May have never worked even in DBAN/dwipe 2.3.0). [#322](https://github.com/martijnvanbrummelen/nwipe/pull/322)
|
||||
- Log whether the prng produces a stream, if not log failure message. [#321](https://github.com/martijnvanbrummelen/nwipe/pull/321)
|
||||
- Log the specific prng that is initialised. [#320](https://github.com/martijnvanbrummelen/nwipe/pull/320)
|
||||
- Log selection details to the log. [#319](https://github.com/martijnvanbrummelen/nwipe/pull/319)
|
||||
- Improve log messaging. [#317](https://github.com/martijnvanbrummelen/nwipe/pull/317)
|
||||
- Fix auto shutdown option for some distros. [#315](https://github.com/martijnvanbrummelen/nwipe/pull/315)
|
||||
- Fix build for musl. [#301](https://github.com/martijnvanbrummelen/nwipe/pull/301)
|
||||
- Fixes to summary table & fix final status message. [311](https://github.com/martijnvanbrummelen/nwipe/pull/311/commits/12063ad9549860cd625cb91d047bd304217a9ebf)
|
||||
- Updates to --help options [#309](https://github.com/martijnvanbrummelen/nwipe/pull/309/commits/69c9d7d6c5a091c58b3e747078d0022ccdd95a99)
|
||||
- Updates to manpage. [#300](https://github.com/martijnvanbrummelen/nwipe/commit/7cc1a68a89236c4b501dde9149be82c208defccd)
|
||||
|
||||
v0.30
|
||||
-----------------------
|
||||
- Add auto power off option on completion of wipe ( --autopoweroff ) (Thanks PartialVolume)
|
||||
|
||||
26
README.md
26
README.md
@@ -9,13 +9,15 @@ disks simultaneously. Nwipe can be found in many Linux distro repositories and t
|
||||
|
||||
The user can select from a variety of recognised secure erase methods which include:
|
||||
|
||||
* Zero Fill - Fills the device with zeros, one round only.
|
||||
* Fill With Zeros - Fills the device with zeros (0x00), one round only.
|
||||
* Fill With Ones - Fills the device with ones (0xFF), one round only.
|
||||
* RCMP TSSIT OPS-II - Royal Candian Mounted Police Technical Security Standard, OPS-II
|
||||
* DoD Short - The American Department of Defense 5220.22-M short 3 pass wipe (passes 1, 2 & 7).
|
||||
* DoD 5220.22M - The American Department of Defense 5220.22-M full 7 pass wipe.
|
||||
* Gutmann Wipe - Peter Gutmann's method (Secure Deletion of Data from Magnetic and Solid-State Memory).
|
||||
* PRNG Stream - Fills the device with a stream from the PRNG.
|
||||
* Verify only - This method only reads the device and checks that it is all zero.
|
||||
* Verify Zeros - This method only reads the device and checks that it is filled with zeros (0x00).
|
||||
* Verify Ones - This method only reads the device and checks that it is filled with ones (0xFF).
|
||||
* HMG IS5 enhanced - Secure Sanitisation of Protectively Marked Information or Sensitive Information
|
||||
|
||||
It also includes the following pseudo random number generators:
|
||||
@@ -23,8 +25,8 @@ It also includes the following pseudo random number generators:
|
||||
* ISAAC
|
||||
|
||||
It is a fork of the dwipe command used by
|
||||
Darik's Boot and Nuke (dban). nwipe is included with [partedmagic](https://partedmagic.com), [SystemRescueCD](http://www.system-rescue-cd) and
|
||||
[ShredOS](https://github.com/nadenislamarre/shredos)/[ShredOS 2020](https://github.com/PartialVolume/shredos.2020.02) if you want a quick and easy, bootable CD or USB version. If you want a bootable version of the very latest nwipe master that you can write to a USB stick, see [quick and easy bootable version of nwipe master](https://github.com/martijnvanbrummelen/nwipe#quick--easy-usb-bootable-version-of-nwipe-master-for-x86_64-systems)
|
||||
Darik's Boot and Nuke (dban). nwipe is included with [partedmagic](https://partedmagic.com), [SystemRescueCD](https://www.system-rescue.org), [gparted live](https://sourceforge.net/projects/gparted/files/gparted-live-testing/1.2.0-2/) and
|
||||
[ShredOS 2020](https://github.com/PartialVolume/shredos.2020.02) ShredOS 2020 was developed in particular to showcase nwipe as a fast to boot standalone method similar to DBAN Available in the following architectures x86_64 and i686 (32 bit), with the following formats .iso for CD-R/DVD-R and .img for USB flash drive version and in both legacy bios and UEFI boot. If you want a bootable version of the very latest nwipe master that you can write to a USB flash memory or CD/DVD, see [quick and easy bootable version of nwipe master](https://github.com/martijnvanbrummelen/nwipe#quick--easy-usb-bootable-version-of-nwipe-master-for-x86_64-systems)
|
||||
|
||||
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
|
||||
@@ -104,6 +106,7 @@ First create all the autoconf files:
|
||||
Then compile & install using the following standard commands:
|
||||
```
|
||||
./configure
|
||||
make format (only required if submitting pull requests)
|
||||
make
|
||||
make install
|
||||
```
|
||||
@@ -125,6 +128,7 @@ This can be done using the following compile commands:
|
||||
|
||||
```
|
||||
./configure --prefix=/usr CFLAGS='-O0 -g -Wall -Wextra'
|
||||
make format (necessary if submitting pull requests)
|
||||
make
|
||||
make install
|
||||
```
|
||||
@@ -164,7 +168,7 @@ cd ~/nwipe_master/nwipe/src
|
||||
Note the ./, that means only look in the current directory for nwipe. if you forgot to type ./ the computer would run the older repository version of nwipe.
|
||||
|
||||
Once you have copied the script below into a file called buildnwipe, you need to give the file execute permissions `chmod +x buildnwipe` before you can run it. [Download script](
|
||||
https://drive.google.com/file/d/1-kKgvCvKYYuSH_UUBKrLwsI0Xf7fckGg/view?usp=sharing)
|
||||
https://drive.google.com/file/d/1BsQDlMqtEycAgfk9FpG1sxv3jFz5dzNO/view?usp=sharing)
|
||||
```
|
||||
#!/bin/bash
|
||||
cd "$HOME"
|
||||
@@ -184,6 +188,18 @@ sudo ./nwipe
|
||||
## Quick & Easy, USB bootable version of Nwipe Master for x86_64 systems.
|
||||
If you want to just try out a bootable version of nwipe you can download the ShredOS image that's using the latest version of nwipe master and burn it to a USB stick. Instructions and download can be found [here](https://github.com/PartialVolume/shredos.2020.02/blob/master/README.md#obtaining-and-writing-shredos-to-a-usb-flash-drive-the-easy-way-)
|
||||
|
||||
## Which Linux distro uses the latest Nwipe?
|
||||
See [Repology](https://repology.org/project/nwipe/versions)
|
||||
|
||||
And in addition checkout the following distros that all include nwipe:
|
||||
|
||||
- [ShredOS 2020](https://github.com/PartialVolume/shredos.2020.02) Always has the latest nwipe release.
|
||||
- [partedmagic](https://partedmagic.com)
|
||||
- [SystemRescueCD](https://www.system-rescue.org)
|
||||
- [gparted live](https://sourceforge.net/projects/gparted/files/gparted-live-testing/1.2.0-2/)
|
||||
|
||||
Know of other distros that include nwipe? Then please let us know or issue a PR on this README.md. Thanks.
|
||||
|
||||
## Bugs
|
||||
|
||||
Bugs can be reported on GitHub:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.64])
|
||||
AC_INIT([nwipe], [0.30], [git@brumit.nl])
|
||||
AC_INIT([nwipe], [0.32], [git@brumit.nl])
|
||||
AM_INIT_AUTOMAKE(foreign subdir-objects)
|
||||
AC_OUTPUT(Makefile src/Makefile man/Makefile)
|
||||
AC_CONFIG_SRCDIR([src/nwipe.c])
|
||||
|
||||
24
man/nwipe.1
24
man/nwipe.1
@@ -1,4 +1,4 @@
|
||||
.TH NWIPE "1" "December 2020" "nwipe version 0.30" "User Commands"
|
||||
.TH NWIPE "1" "October 2021" "nwipe version 0.32" "User Commands"
|
||||
.SH NAME
|
||||
nwipe \- securely erase disks
|
||||
.SH SYNOPSIS
|
||||
@@ -38,8 +38,18 @@ those specified devices immediately.
|
||||
Power off system on completion of wipe delayed for for one minute. During
|
||||
this one minute delay you can abort the shutdown by typing sudo shutdown -c
|
||||
.TP
|
||||
\fB\-\-sync\fR
|
||||
Open devices in sync mode
|
||||
\fB\-\-sync\fR=\fINUM\fR
|
||||
Will perform a syn after NUM writes (default: 100000)
|
||||
.IP
|
||||
0 \- fdatasync after the disk is completely written
|
||||
fdatasync errors not detected until completion.
|
||||
0 is not recommended as disk errors may cause nwipe
|
||||
to appear to hang
|
||||
.IP
|
||||
1 \- fdatasync after every write
|
||||
Warning: Lower values will reduce wipe speeds.
|
||||
.IP
|
||||
1000 \- fdatasync after 1000 writes
|
||||
.TP
|
||||
\fB\-\-noblank\fR
|
||||
Do not perform the final blanking pass after the wipe (default is to blank,
|
||||
@@ -88,9 +98,13 @@ ops2 \- RCMP TSSIT OPS\-II
|
||||
.IP
|
||||
random / prng / stream \- PRNG Stream
|
||||
.IP
|
||||
zero / quick \- Overwrite with zeros
|
||||
zero / quick \- Overwrite with zeros 0x00
|
||||
.IP
|
||||
verify \- Verifies disk is zero filled
|
||||
one \- Overwrite with ones 0xFF
|
||||
.IP
|
||||
verify_zero \- Verifies disk is zero filled
|
||||
.IP
|
||||
verify_one \- Verifies disk is 0xFF filled
|
||||
.IP
|
||||
is5enh \- HMG IS5 enhanced
|
||||
.TP
|
||||
|
||||
@@ -129,6 +129,7 @@ typedef struct nwipe_context_t_
|
||||
double duration; // Duration of the wipe in seconds
|
||||
time_t start_time; // Start time of wipe
|
||||
time_t end_time; // End time of wipe
|
||||
u64 fsyncdata_errors; // The number of fsyncdata errors across all passes.
|
||||
/*
|
||||
* Identity contains the raw serial number of the drive
|
||||
* (where applicable), however, for use within nwipe use the
|
||||
|
||||
529
src/gui.c
529
src/gui.c
@@ -123,14 +123,24 @@ const char* options_title = " Options ";
|
||||
const char* stats_title = " Statistics ";
|
||||
|
||||
/* Footer labels. */
|
||||
const char* main_window_footer = "S=Start M=Method P=PRNG V=Verify R=Rounds B=Blanking Space=Select Ctrl-C=Quit";
|
||||
const char* main_window_footer_warning_lower_case_s =
|
||||
" WARNING: To start the wipe press capital S, you pressed lower case s ";
|
||||
const char* main_window_footer = "S=Start m=Method p=PRNG v=Verify r=Rounds b=Blanking Space=Select CTRL+C=Quit";
|
||||
const char* main_window_footer_warning_lower_case_s = " WARNING: To start the wipe press SHIFT+S (uppercase S) ";
|
||||
|
||||
const char* main_window_footer_warning_no_blanking_with_ops2 =
|
||||
" WARNING: Zero blanking is not allowed with ops2 method ";
|
||||
|
||||
const char* main_window_footer_warning_no_blanking_with_verify_only =
|
||||
" WARNING: Zero blanking is not allowed with verify method ";
|
||||
|
||||
const char* main_window_footer_warning_no_drive_selected =
|
||||
" No drives selected, use spacebar to select a drive, then press S to start ";
|
||||
const char* selection_footer = "J=Down K=Up Space=Select Backspace=Cancel Ctrl-C=Quit";
|
||||
const char* end_wipe_footer = "B=Blank screen Ctrl-C=Quit";
|
||||
const char* rounds_footer = "Left=Erase Esc=Cancel Ctrl-C=Quit";
|
||||
|
||||
/* Oddly enough, placing extra quotes around the footer strings fixes corruption to the right
|
||||
* of the footer message when the terminal is resized, a quirk in ncurses? - DO NOT REMOVE THE \" */
|
||||
const char* selection_footer = "J=Down K=Up Space=Select Backspace=Cancel Ctrl+C=Quit";
|
||||
const char* end_wipe_footer = "B=[Toggle between dark\\blank\\blue screen] Ctrl+C=Quit";
|
||||
const char* rounds_footer = "Left=Erase Esc=Cancel Ctrl+C=Quit";
|
||||
|
||||
const char* wipes_finished_footer = "Wipe finished - press enter to exit. Logged to STDOUT";
|
||||
|
||||
/* The number of lines available in the terminal */
|
||||
@@ -145,6 +155,8 @@ int stdscr_lines_previous;
|
||||
/* The size of the terminal columns when previously checked */
|
||||
int stdscr_cols_previous;
|
||||
|
||||
int tft_saver = 0;
|
||||
|
||||
void nwipe_gui_title( WINDOW* w, const char* s )
|
||||
{
|
||||
/**
|
||||
@@ -168,29 +180,19 @@ void nwipe_gui_title( WINDOW* w, const char* s )
|
||||
margin = 0;
|
||||
}
|
||||
|
||||
/* tft_saver = grey text on black mode */
|
||||
if( tft_saver )
|
||||
{
|
||||
wattron( w, A_BOLD );
|
||||
}
|
||||
|
||||
/* Print the title. */
|
||||
mvwprintw( w, 0, margin / 2, "%s", s );
|
||||
|
||||
} /* nwipe_gui_title */
|
||||
|
||||
void nwipe_gui_init( void )
|
||||
void nwipe_init_pairs( void )
|
||||
{
|
||||
/**
|
||||
* Initializes the ncurses gui.
|
||||
*/
|
||||
|
||||
/* Initialize the screen. */
|
||||
initscr();
|
||||
|
||||
/* Disable TTY line buffering. */
|
||||
cbreak();
|
||||
|
||||
/* Disable TTY echo. */
|
||||
noecho();
|
||||
|
||||
/* Enable most special keys. */
|
||||
keypad( stdscr, TRUE );
|
||||
|
||||
if( has_colors() )
|
||||
{
|
||||
/* Initialize color capabilities. */
|
||||
@@ -202,8 +204,16 @@ void nwipe_gui_init( void )
|
||||
init_color( COLOR_CYAN, 128, 128, 128 );
|
||||
}
|
||||
|
||||
/* Set white on blue as the emphasis color. */
|
||||
init_pair( 1, COLOR_WHITE, COLOR_BLUE );
|
||||
/* If we are in tft saver mode set grey text on black background else
|
||||
* Set white on blue as the emphasis color */
|
||||
if( tft_saver )
|
||||
{
|
||||
init_pair( 1, COLOR_BLACK, COLOR_BLACK );
|
||||
}
|
||||
else
|
||||
{
|
||||
init_pair( 1, COLOR_WHITE, COLOR_BLUE );
|
||||
}
|
||||
|
||||
/* Set gray (or cyan) on blue as the normal color. */
|
||||
init_pair( 2, COLOR_CYAN, COLOR_BLUE );
|
||||
@@ -211,8 +221,16 @@ void nwipe_gui_init( void )
|
||||
/* Set red on blue as the hilite color. */
|
||||
init_pair( 3, COLOR_RED, COLOR_BLUE );
|
||||
|
||||
/* Set blue on white as the color for the header and footer windows. */
|
||||
init_pair( 4, COLOR_BLUE, COLOR_WHITE );
|
||||
/* If we are in tft saver mode set grey text on black background else
|
||||
* Set white on blue as the emphasis color */
|
||||
if( tft_saver )
|
||||
{
|
||||
init_pair( 4, COLOR_BLACK, COLOR_BLACK );
|
||||
}
|
||||
else
|
||||
{
|
||||
init_pair( 4, COLOR_BLUE, COLOR_WHITE );
|
||||
}
|
||||
|
||||
/* Set white on green for success messages. */
|
||||
init_pair( 5, COLOR_WHITE, COLOR_GREEN );
|
||||
@@ -235,6 +253,28 @@ void nwipe_gui_init( void )
|
||||
/* Set the background style. */
|
||||
wbkgdset( stdscr, COLOR_PAIR( 1 ) | ' ' );
|
||||
}
|
||||
}
|
||||
|
||||
void nwipe_gui_init( void )
|
||||
{
|
||||
/**
|
||||
* Initializes the ncurses gui.
|
||||
*/
|
||||
|
||||
/* Initialize the screen. */
|
||||
initscr();
|
||||
|
||||
/* Disable TTY line buffering. */
|
||||
cbreak();
|
||||
|
||||
/* Disable TTY echo. */
|
||||
noecho();
|
||||
|
||||
/* Enable most special keys. */
|
||||
keypad( stdscr, TRUE );
|
||||
|
||||
/* Create the text/background color pairs */
|
||||
nwipe_init_pairs();
|
||||
|
||||
/* Clear the screen. */
|
||||
wclear( stdscr );
|
||||
@@ -329,6 +369,16 @@ void nwipe_gui_create_main_window()
|
||||
|
||||
/* Apply the color change. */
|
||||
wattron( main_window, COLOR_PAIR( 1 ) );
|
||||
|
||||
/* In tft saver mode we toggle the intensity bit which gives us grey text */
|
||||
if( tft_saver )
|
||||
{
|
||||
wattron( main_window, A_BOLD );
|
||||
}
|
||||
else
|
||||
{
|
||||
wattroff( main_window, A_BOLD );
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the main window. */
|
||||
@@ -352,6 +402,11 @@ void nwipe_gui_create_header_window()
|
||||
{
|
||||
/* Set the background style of the header window. */
|
||||
wbkgdset( header_window, COLOR_PAIR( 4 ) | ' ' );
|
||||
|
||||
if( tft_saver )
|
||||
{
|
||||
wattron( main_window, A_BOLD );
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the header window. */
|
||||
@@ -414,6 +469,11 @@ void nwipe_gui_create_options_window()
|
||||
|
||||
/* Apply the color change to the options window. */
|
||||
wattron( options_window, COLOR_PAIR( 1 ) );
|
||||
|
||||
if( tft_saver )
|
||||
{
|
||||
wattron( options_window, A_BOLD );
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the options window. */
|
||||
@@ -437,6 +497,11 @@ void nwipe_gui_create_stats_window()
|
||||
|
||||
/* Apply the color change to the stats window. */
|
||||
wattron( stats_window, COLOR_PAIR( 1 ) );
|
||||
|
||||
if( tft_saver )
|
||||
{
|
||||
wattron( stats_window, A_BOLD );
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the new window. */
|
||||
@@ -457,15 +522,15 @@ void nwipe_gui_create_stats_window()
|
||||
|
||||
} /* nwipe_gui_create_stats_window */
|
||||
|
||||
void nwipe_gui_create_all_windows_on_terminal_resize( const char* footer_text )
|
||||
void nwipe_gui_create_all_windows_on_terminal_resize( int force_creation, const char* footer_text )
|
||||
{
|
||||
/* Get the terminal size */
|
||||
getmaxyx( stdscr, stdscr_lines, stdscr_cols );
|
||||
|
||||
/* If the user has resized the terminal then recreate the windows and panels */
|
||||
if( stdscr_cols_previous != stdscr_cols || stdscr_lines_previous != stdscr_lines )
|
||||
if( stdscr_cols_previous != stdscr_cols || stdscr_lines_previous != stdscr_lines || force_creation == 1 )
|
||||
{
|
||||
/* save the revised terminal size so we check whether the user has resized next time */
|
||||
/* Save the revised terminal size so we check whether the user has resized next time */
|
||||
stdscr_lines_previous = stdscr_lines;
|
||||
stdscr_cols_previous = stdscr_cols;
|
||||
|
||||
@@ -541,7 +606,7 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
/* Flag, Valid key hit = 1, anything else = 0 */
|
||||
int validkeyhit;
|
||||
|
||||
/* counts number of drives and partitions that have been selected */
|
||||
/* Counts number of drives and partitions that have been selected */
|
||||
int number_of_selected_contexts = 0;
|
||||
|
||||
/* Control A toggle status -1=indefined, 0=all drives delected, 1=all drives selected */
|
||||
@@ -550,14 +615,14 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
/* Get the terminal size */
|
||||
getmaxyx( stdscr, stdscr_lines, stdscr_cols );
|
||||
|
||||
/* save the terminal size so we check whether the user has resized */
|
||||
/* Save the terminal size so we check whether the user has resized */
|
||||
stdscr_lines_previous = stdscr_lines;
|
||||
stdscr_cols_previous = stdscr_cols;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( main_window_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, main_window_footer );
|
||||
|
||||
/* There is one slot per line. */
|
||||
getmaxyx( main_window, wlines, wcols );
|
||||
@@ -646,7 +711,7 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
waddch( main_window, ' ' );
|
||||
}
|
||||
|
||||
/* In the event of the offset value some how becoming invalid, this if statement will prevent a segfault
|
||||
/* In the event for the offset value somehow becoming invalid, this if statement will prevent a segfault
|
||||
* and the else part will log the out of bounds values for debugging */
|
||||
if( i + offset >= 0 && i + offset < count )
|
||||
{
|
||||
@@ -741,9 +806,9 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
keystroke = getch(); // Get user input.
|
||||
timeout( -1 ); // Switch back to blocking mode.
|
||||
|
||||
/* We don't necessarily use these but for future reference, here are some cntrl + key values
|
||||
* ^W - 23, ^E - 5, ^R - 18, ^T - 20, ^Y - 25, ^U - 21, ^I - 9, ^O - 15, ^P - 16, ^A - 1, ^D - 4
|
||||
* ^F - 6, ^G - 7, ^H - 8, ^K - 11, ^L - 12, ^X - 24, ^V - 22, ^B - 2, ^N - 14
|
||||
/* We don't necessarily use all of these. For future reference these are some CTRL+key values
|
||||
* ^A - 1, ^B - 2, ^D - 4, ^E - 5, ^F - 6, ^G - 7, ^H - 8, ^I - 9, ^K - 11, ^L - 12, ^N - 14,
|
||||
* ^O - 15, ^P - 16, ^R - 18, ^T - 20, ^U - 21, ^V - 22, ^W - 23, ^X - 24, ^Y - 25
|
||||
* Use nwipe_log( NWIPE_LOG_DEBUG, "Key Name: %s - %u", keyname(keystroke),keystroke) to
|
||||
* figure out what code is returned by what ever key combination */
|
||||
|
||||
@@ -967,6 +1032,38 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
|
||||
validkeyhit = 1;
|
||||
|
||||
if( nwipe_options.method == &nwipe_ops2 )
|
||||
{
|
||||
/* Warn the user about that zero blanking with the ops2 method is not allowed */
|
||||
wattron( footer_window, COLOR_PAIR( 10 ) );
|
||||
nwipe_gui_amend_footer_window( main_window_footer_warning_no_blanking_with_ops2 );
|
||||
doupdate();
|
||||
sleep( 3 );
|
||||
wattroff( footer_window, COLOR_PAIR( 10 ) );
|
||||
|
||||
/* After the delay return footer text back to key help */
|
||||
nwipe_gui_amend_footer_window( main_window_footer );
|
||||
doupdate();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( nwipe_options.method == &nwipe_verify_zero || nwipe_options.method == &nwipe_verify_one )
|
||||
{
|
||||
/* Warn the user about that zero blanking with the ops2 method is not allowed */
|
||||
wattron( footer_window, COLOR_PAIR( 10 ) );
|
||||
nwipe_gui_amend_footer_window( main_window_footer_warning_no_blanking_with_verify_only );
|
||||
doupdate();
|
||||
sleep( 3 );
|
||||
wattroff( footer_window, COLOR_PAIR( 10 ) );
|
||||
|
||||
/* After the delay return footer text back to key help */
|
||||
nwipe_gui_amend_footer_window( main_window_footer );
|
||||
doupdate();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Run the noblank dialog. */
|
||||
nwipe_gui_noblank();
|
||||
break;
|
||||
@@ -1145,6 +1242,14 @@ void nwipe_gui_options( void )
|
||||
} /* switch verify */
|
||||
|
||||
mvwprintw( options_window, NWIPE_GUI_OPTIONS_ROUNDS_Y, NWIPE_GUI_OPTIONS_ROUNDS_X, "Rounds: " );
|
||||
|
||||
/* Disable blanking for ops2 and verify methods */
|
||||
if( nwipe_options.method == &nwipe_ops2 || nwipe_options.method == &nwipe_verify_zero
|
||||
|| nwipe_options.method == &nwipe_verify_one )
|
||||
{
|
||||
nwipe_options.noblank = 1;
|
||||
}
|
||||
|
||||
if( nwipe_options.noblank )
|
||||
{
|
||||
wprintw( options_window, "%i (no final blanking pass)", nwipe_options.rounds );
|
||||
@@ -1200,7 +1305,7 @@ void nwipe_gui_rounds( void )
|
||||
/* Erase the main window. */
|
||||
werase( main_window );
|
||||
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( selection_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
|
||||
|
||||
/* Add a border. */
|
||||
box( main_window, 0, 0 );
|
||||
@@ -1216,9 +1321,6 @@ void nwipe_gui_rounds( void )
|
||||
|
||||
if( focus > 0 )
|
||||
{
|
||||
/* Print the syslinux configuration hint. */
|
||||
mvwprintw( main_window, yy++, tab1, "syslinux.cfg: nuke=\"nwipe --rounds %i\"", focus );
|
||||
|
||||
/* Print this line last so that the cursor is in the right place. */
|
||||
mvwprintw( main_window, 2, tab1, "> %i", focus );
|
||||
}
|
||||
@@ -1350,27 +1452,23 @@ void nwipe_gui_prng( void )
|
||||
/* Clear the main window. */
|
||||
werase( main_window );
|
||||
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( selection_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
|
||||
|
||||
/* Initialize the working row. */
|
||||
yy = 2;
|
||||
|
||||
/* Print the options. */
|
||||
mvwprintw( main_window, yy++, tab1, "" );
|
||||
mvwprintw( main_window, yy++, tab1, "" );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_twister.label );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_isaac.label );
|
||||
mvwprintw( main_window, yy++, tab1, "" );
|
||||
|
||||
/* Print the cursor. */
|
||||
mvwaddch( main_window, 4 + focus, tab1, ACS_RARROW );
|
||||
mvwaddch( main_window, 2 + focus, tab1, ACS_RARROW );
|
||||
|
||||
switch( focus )
|
||||
{
|
||||
case 0:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --prng twister\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1399,8 +1497,6 @@ void nwipe_gui_prng( void )
|
||||
|
||||
case 1:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --prng isaac\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1525,7 +1621,7 @@ void nwipe_gui_verify( void )
|
||||
|
||||
do
|
||||
{
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( selection_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
|
||||
|
||||
/* Clear the main window. */
|
||||
werase( main_window );
|
||||
@@ -1546,8 +1642,6 @@ void nwipe_gui_verify( void )
|
||||
{
|
||||
case 0:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --verify off\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1560,8 +1654,6 @@ void nwipe_gui_verify( void )
|
||||
|
||||
case 1:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --verify last\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1574,8 +1666,6 @@ void nwipe_gui_verify( void )
|
||||
|
||||
case 2:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --verify all\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1704,7 +1794,7 @@ void nwipe_gui_noblank( void )
|
||||
|
||||
do
|
||||
{
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( selection_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
|
||||
|
||||
/* Clear the main window. */
|
||||
werase( main_window );
|
||||
@@ -1724,8 +1814,6 @@ void nwipe_gui_noblank( void )
|
||||
{
|
||||
case 0:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1746,8 +1834,6 @@ void nwipe_gui_noblank( void )
|
||||
|
||||
case 1:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --noblank\"" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
@@ -1818,10 +1904,6 @@ void nwipe_gui_noblank( void )
|
||||
{
|
||||
nwipe_options.noblank = focus;
|
||||
}
|
||||
if( nwipe_options.noblank )
|
||||
{
|
||||
nwipe_options.verify = NWIPE_VERIFY_NONE;
|
||||
}
|
||||
return;
|
||||
|
||||
case KEY_BACKSPACE:
|
||||
@@ -1849,7 +1931,7 @@ void nwipe_gui_method( void )
|
||||
extern int terminate_signal;
|
||||
|
||||
/* The number of implemented methods. */
|
||||
const int count = 8;
|
||||
const int count = 10;
|
||||
|
||||
/* The first tabstop. */
|
||||
const int tab1 = 2;
|
||||
@@ -1875,53 +1957,63 @@ void nwipe_gui_method( void )
|
||||
{
|
||||
focus = 0;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_ops2 )
|
||||
if( nwipe_options.method == &nwipe_one )
|
||||
{
|
||||
focus = 1;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_dodshort )
|
||||
if( nwipe_options.method == &nwipe_ops2 )
|
||||
{
|
||||
focus = 2;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_dod522022m )
|
||||
if( nwipe_options.method == &nwipe_dodshort )
|
||||
{
|
||||
focus = 3;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_gutmann )
|
||||
if( nwipe_options.method == &nwipe_dod522022m )
|
||||
{
|
||||
focus = 4;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_random )
|
||||
if( nwipe_options.method == &nwipe_gutmann )
|
||||
{
|
||||
focus = 5;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_verify )
|
||||
if( nwipe_options.method == &nwipe_random )
|
||||
{
|
||||
focus = 6;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_is5enh )
|
||||
if( nwipe_options.method == &nwipe_verify_zero )
|
||||
{
|
||||
focus = 7;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_verify_one )
|
||||
{
|
||||
focus = 8;
|
||||
}
|
||||
if( nwipe_options.method == &nwipe_is5enh )
|
||||
{
|
||||
focus = 9;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
/* Clear the main window. */
|
||||
werase( main_window );
|
||||
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( selection_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
|
||||
|
||||
/* Initialize the working row. */
|
||||
yy = 2;
|
||||
|
||||
/* Print the options. */
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_zero ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_one ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_ops2 ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_dodshort ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_dod522022m ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_gutmann ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_random ) );
|
||||
mvwprintw( main_window, yy++, tab1, " %s", nwipe_method_label( &nwipe_verify ) );
|
||||
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, " " );
|
||||
|
||||
@@ -1932,169 +2024,131 @@ void nwipe_gui_method( void )
|
||||
{
|
||||
case 0:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method zero\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: Low (1 pass)" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: high (1 pass)" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This method fills the device with zeros. Note that the rounds option does " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"not apply to this method. This method always runs one round. " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
" " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"Use this method to blank disks before internal redeployment, or before " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"reinstalling Microsoft Windows to remove the data areas that the format " );
|
||||
mvwprintw(
|
||||
main_window, yy++, tab1, "utility preserves. " );
|
||||
mvwprintw( main_window, 4, tab2, "This method fills the device with zeros. Note " );
|
||||
mvwprintw( main_window, 5, tab2, "that the rounds option does not apply to this " );
|
||||
mvwprintw( main_window, 6, tab2, "method. This method always runs one round. " );
|
||||
mvwprintw( main_window, 7, tab2, " " );
|
||||
mvwprintw( main_window, 8, tab2, "There is no publically available evidence that " );
|
||||
mvwprintw( main_window, 9, tab2, "data can be recovered from a modern traditional " );
|
||||
mvwprintw( main_window, 10, tab2, "hard drive (HDD) that has been zero wiped, " );
|
||||
mvwprintw( main_window, 11, tab2, "however a wipe that includes a prng may be " );
|
||||
mvwprintw( main_window, 12, tab2, "preferable. " );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method ops2\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: Medium (8 passes)" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: high (1 pass)" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"The Royal Canadian Mounted Police Technical Security Standard for " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"Information Technology, Appendix OPS-II: Media Sanitization. " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
" " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This implementation, with regards to paragraph 2 section A of the standard, " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"uses a pattern that is one random byte and that is changed each round. " );
|
||||
mvwprintw( main_window, 4, tab2, "This method fills the device with ones. Note that" );
|
||||
mvwprintw( main_window, 5, tab2, "the rounds option does not apply to this method. " );
|
||||
mvwprintw( main_window, 6, tab2, "This method always runs one round. " );
|
||||
mvwprintw( main_window, 7, tab2, " " );
|
||||
mvwprintw( main_window, 8, tab2, "This method might be used when wiping a solid " );
|
||||
mvwprintw( main_window, 9, tab2, "state drive if an additional level of security is" );
|
||||
mvwprintw( main_window, 10, tab2, "required beyond using the drives internal secure " );
|
||||
mvwprintw( main_window, 11, tab2, "erase features. Alternatively PRNG may be " );
|
||||
mvwprintw( main_window, 12, tab2, "preferable. " );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method dodshort\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: Medium (3 passes)" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: higher (8 passes)" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"The American Department of Defense 5220.22-M short wipe. " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This method is composed of passes 1, 2 & 7 from the standard wipe. " );
|
||||
mvwprintw( main_window, 4, tab2, "The Royal Canadian Mounted Police Technical " );
|
||||
mvwprintw( main_window, 5, tab2, "Security Standard for Information Technology. " );
|
||||
mvwprintw( main_window, 6, tab2, "Appendix OPS-II: Media Sanitization. " );
|
||||
mvwprintw( main_window, 7, tab2, " " );
|
||||
mvwprintw( main_window, 8, tab2, "This implementation, with regards to paragraph 2 " );
|
||||
mvwprintw( main_window, 9, tab2, "section A of the standard, uses a pattern that is" );
|
||||
mvwprintw( main_window, 10, tab2, "one random byte and that is changed each round. " );
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method dod522022m\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: Medium (7 passes)" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: higher (3 passes)" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"The American Department of Defense 5220.22-M standard wipe. " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This implementation uses the same algorithm as the Heidi Eraser product. " );
|
||||
mvwprintw( main_window, 4, tab2, "The US Department of Defense 5220.22-M short wipe" );
|
||||
mvwprintw( main_window, 5, tab2, "This method is composed of passes 1, 2 & 7 from " );
|
||||
mvwprintw( main_window, 6, tab2, "the standard DoD 5220.22-M wipe. " );
|
||||
mvwprintw( main_window, 7, tab2, " " );
|
||||
mvwprintw( main_window, 8, tab2, "Pass 1: A random character " );
|
||||
mvwprintw( main_window, 9, tab2, "Pass 2: The bitwise complement of pass 1. " );
|
||||
mvwprintw( main_window, 10, tab2, "Pass 3: A random number generated data stream " );
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method gutmann\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: High (35 passes)" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: higher (7 passes)" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This is the method described by Peter Gutmann in the paper entitled " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"\"Secure Deletion of Data from Magnetic and Solid-State Memory\". " );
|
||||
mvwprintw( main_window, 3, tab2, "The American Department of Defense 5220.22-M " );
|
||||
mvwprintw( main_window, 4, tab2, "standard wipe. " );
|
||||
mvwprintw( main_window, 5, tab2, " " );
|
||||
mvwprintw( main_window, 6, tab2, "Pass 1: A Random character " );
|
||||
mvwprintw( main_window, 7, tab2, "Pass 2: The bitwise complement of pass 1 " );
|
||||
mvwprintw( main_window, 8, tab2, "Pass 3: A random number generated data stream " );
|
||||
mvwprintw( main_window, 9, tab2, "Pass 4: A Random character " );
|
||||
mvwprintw( main_window, 10, tab2, "Pass 5: A Random character " );
|
||||
mvwprintw( main_window, 11, tab2, "Pass 6: The bitwise complement of pass 5 " );
|
||||
mvwprintw( main_window, 12, tab2, "Pass 7: A random number generated data stream " );
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method random\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: Depends on Rounds" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: Paranoid ! (35 passes) " );
|
||||
mvwprintw( main_window, 3, tab2, "Don't waste your time with this on a modern drive" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This method fills the device with a stream from the PRNG. It is probably the " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"best method to use on modern hard disk drives because encoding schemes vary. " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
" " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This method has a medium security level with 4 rounds, and a high security " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"level with 8 rounds. " );
|
||||
mvwprintw( main_window, 5, tab2, "This is the method described by Peter Gutmann in " );
|
||||
mvwprintw( main_window, 6, tab2, "the paper entitled \"Secure Deletion of Data from" );
|
||||
mvwprintw( main_window, 7, tab2, "Magnetic and Solid-State Memory\", however not " );
|
||||
mvwprintw( main_window, 8, tab2, "relevant in regards to modern hard disk drives. " );
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method verify\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: None" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This method only reads the device and checks that it is all zero. " );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: Depends on Rounds" );
|
||||
|
||||
mvwprintw( main_window, 4, tab2, "This method fills the device with a stream from " );
|
||||
mvwprintw( main_window, 5, tab2, "the PRNG. It is probably the best method to use " );
|
||||
mvwprintw( main_window, 6, tab2, "on modern hard disk drives due to variation in " );
|
||||
mvwprintw( main_window, 7, tab2, "encoding methods. " );
|
||||
mvwprintw( main_window, 8, tab2, " " );
|
||||
mvwprintw( main_window, 9, tab2, "This method has a high security level with 1 " );
|
||||
mvwprintw( main_window, 10, tab2, "round and an increasingly higher security level " );
|
||||
mvwprintw( main_window, 11, tab2, "as rounds are increased." );
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"nwipe --method is5enh\"" );
|
||||
mvwprintw( main_window, 3, tab2, "Security Level: Medium (3 passes)" );
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: Not applicable" );
|
||||
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"HMG IA/IS 5 (Infosec Standard 5): Secure Sanitisation of Protectively Marked " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"Information or Sensitive Information " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
" " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"This method fills the device with 0s, then with 1s, then with a PRNG stream, " );
|
||||
mvwprintw( main_window,
|
||||
yy++,
|
||||
tab1,
|
||||
"then reads the device to verify the PRNG stream was successfully written. " );
|
||||
mvwprintw( main_window, 4, tab2, "This method only reads the device and checks " );
|
||||
mvwprintw( main_window, 5, tab2, "that it is all zero. " );
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: Not applicable" );
|
||||
|
||||
mvwprintw( main_window, 4, tab2, "This method only reads the device and checks " );
|
||||
mvwprintw( main_window, 5, tab2, "that it is all ones (0xFF). " );
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
||||
mvwprintw( main_window, 2, tab2, "Security Level: higher (3 passes)" );
|
||||
|
||||
mvwprintw( main_window, 4, tab2, "HMG IA/IS 5 (Infosec Standard 5): Secure " );
|
||||
mvwprintw( main_window, 5, tab2, "Sanitisation of Protectively Marked Information " );
|
||||
mvwprintw( main_window, 6, tab2, "or Sensitive Information " );
|
||||
mvwprintw( main_window, 7, tab2, " " );
|
||||
mvwprintw( main_window, 8, tab2, "This method fills the device with 0s, then with " );
|
||||
mvwprintw( main_window, 9, tab2, "1s, then with a PRNG stream, then reads the " );
|
||||
mvwprintw( main_window, 10, tab2, "device to verify the PRNG stream was " );
|
||||
mvwprintw( main_window, 11, tab2, "successfully written. " );
|
||||
break;
|
||||
|
||||
} /* switch */
|
||||
@@ -2157,30 +2211,38 @@ void nwipe_gui_method( void )
|
||||
break;
|
||||
|
||||
case 1:
|
||||
nwipe_options.method = &nwipe_ops2;
|
||||
nwipe_options.method = &nwipe_one;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nwipe_options.method = &nwipe_dodshort;
|
||||
nwipe_options.method = &nwipe_ops2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
nwipe_options.method = &nwipe_dod522022m;
|
||||
nwipe_options.method = &nwipe_dodshort;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
nwipe_options.method = &nwipe_gutmann;
|
||||
nwipe_options.method = &nwipe_dod522022m;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
nwipe_options.method = &nwipe_random;
|
||||
nwipe_options.method = &nwipe_gutmann;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
nwipe_options.method = &nwipe_verify;
|
||||
nwipe_options.method = &nwipe_random;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
nwipe_options.method = &nwipe_verify_zero;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
nwipe_options.method = &nwipe_verify_one;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
nwipe_options.method = &nwipe_is5enh;
|
||||
break;
|
||||
}
|
||||
@@ -2378,12 +2440,12 @@ void* nwipe_gui_status( void* ptr )
|
||||
if( nwipe_active != 0 )
|
||||
{
|
||||
/* if resizing the terminal during a wipe a specific footer is required */
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( end_wipe_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, end_wipe_footer );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* and if the wipes have finished a different footer is required */
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( wipes_finished_footer );
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 0, wipes_finished_footer );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2414,6 +2476,10 @@ void* nwipe_gui_status( void* ptr )
|
||||
|
||||
if( keystroke > 0x0a && keystroke < 0x7e && nwipe_gui_blank == 1 )
|
||||
{
|
||||
tft_saver = 0;
|
||||
nwipe_init_pairs();
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 1, end_wipe_footer );
|
||||
|
||||
/* Show screen */
|
||||
nwipe_gui_blank = 0;
|
||||
|
||||
@@ -2428,7 +2494,7 @@ void* nwipe_gui_status( void* ptr )
|
||||
show_panel( options_panel );
|
||||
show_panel( main_panel );
|
||||
|
||||
/* reprint the footer */
|
||||
/* Reprint the footer */
|
||||
nwipe_gui_title( footer_window, end_wipe_footer );
|
||||
|
||||
// Refresh the footer_window ;
|
||||
@@ -2447,17 +2513,31 @@ void* nwipe_gui_status( void* ptr )
|
||||
case 'b':
|
||||
case 'B':
|
||||
|
||||
/* Blank screen. */
|
||||
nwipe_gui_blank = 1;
|
||||
hide_panel( header_panel );
|
||||
hide_panel( footer_panel );
|
||||
hide_panel( stats_panel );
|
||||
hide_panel( options_panel );
|
||||
hide_panel( main_panel );
|
||||
if( nwipe_gui_blank == 0 && tft_saver != 1 )
|
||||
{
|
||||
/* grey text on black background */
|
||||
tft_saver = 1;
|
||||
nwipe_init_pairs();
|
||||
nwipe_gui_create_all_windows_on_terminal_resize( 1, end_wipe_footer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( nwipe_gui_blank == 0 && tft_saver == 1 )
|
||||
{
|
||||
/* Blank screen. */
|
||||
tft_saver = 0;
|
||||
nwipe_gui_blank = 1;
|
||||
hide_panel( header_panel );
|
||||
hide_panel( footer_panel );
|
||||
hide_panel( stats_panel );
|
||||
hide_panel( options_panel );
|
||||
hide_panel( main_panel );
|
||||
}
|
||||
|
||||
/* Set the background style. */
|
||||
wbkgdset( stdscr, COLOR_PAIR( 7 ) );
|
||||
wclear( stdscr );
|
||||
/* Set the background style. */
|
||||
wbkgdset( stdscr, COLOR_PAIR( 7 ) );
|
||||
wclear( stdscr );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -2514,7 +2594,7 @@ void* nwipe_gui_status( void* ptr )
|
||||
|
||||
} /* keystroke */
|
||||
|
||||
/* if wipe has completed and user has specified auto poweroff or nowait then we can skip waiting for the user to
|
||||
/* If wipe has completed and user has specified auto poweroff or nowait then we can skip waiting for the user to
|
||||
* press return */
|
||||
if( !nwipe_active )
|
||||
{
|
||||
@@ -2643,7 +2723,7 @@ void* nwipe_gui_status( void* ptr )
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the wipe thread is no longer active, replace the spinner with a space */
|
||||
/* If the wipe thread is no longer active, replace the spinner with a space */
|
||||
spinner_string[0] = ' ';
|
||||
}
|
||||
spinner_string[1] = 0;
|
||||
@@ -2836,6 +2916,7 @@ int compute_stats( void* ptr )
|
||||
/* Accumulate the error count. */
|
||||
nwipe_misc_thread_data->errors += c[i]->pass_errors;
|
||||
nwipe_misc_thread_data->errors += c[i]->verify_errors;
|
||||
nwipe_misc_thread_data->errors += c[i]->fsyncdata_errors;
|
||||
|
||||
} /* for statistics */
|
||||
|
||||
@@ -2889,7 +2970,7 @@ int spinner( nwipe_context_t** ptr, int device_idx )
|
||||
/* The spinner characters |/-\|/-\ */
|
||||
char sc[9] = "|/-\\|/-\\/";
|
||||
|
||||
/* check sanity of index */
|
||||
/* Check sanity of index */
|
||||
if( c[device_idx]->spinner_idx < 0 || c[device_idx]->spinner_idx > 7 )
|
||||
{
|
||||
return 1;
|
||||
|
||||
@@ -31,6 +31,7 @@ void nwipe_gui_create_footer_window( const char* ); // Create the footer window
|
||||
void nwipe_gui_create_options_window( void ); // Create the options window
|
||||
void nwipe_gui_create_stats_window( void ); // Create the stats window
|
||||
void nwipe_gui_create_all_windows_on_terminal_resize(
|
||||
int force_creation,
|
||||
const char* footer_text ); // If terminal is resized recreate all windows
|
||||
void nwipe_gui_select( int count, nwipe_context_t** c ); // Select devices to wipe.
|
||||
void* nwipe_gui_status( void* ptr ); // Update operation progress.
|
||||
|
||||
@@ -16,7 +16,7 @@ MODIFIED:
|
||||
|
||||
#ifndef RAND
|
||||
#define RAND
|
||||
#define RANDSIZL (8) /* I recommend 8 for crypto, 4 for simulations */
|
||||
#define RANDSIZL (4) /* I recommend 8 for crypto, 4 for simulations */
|
||||
#define RANDSIZ (1<<RANDSIZL)
|
||||
|
||||
/* context of random number generator */
|
||||
|
||||
104
src/logging.c
104
src/logging.c
@@ -601,6 +601,9 @@ int nwipe_log_sysinfo()
|
||||
|
||||
void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
{
|
||||
/* Prints two summary tables, the first is the device pass and verification summary
|
||||
* and the second is the main summary table detaining the drives, status, throughput,
|
||||
* model and serial number */
|
||||
int i;
|
||||
int idx_src;
|
||||
int idx_dest;
|
||||
@@ -646,12 +649,75 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
/* A pointer to the system time struct. */
|
||||
struct tm* p;
|
||||
|
||||
/* Nothing to do, user didn't select any devices */
|
||||
if( nwipe_selected == 0 )
|
||||
/* Nothing to do, user never started a wipe so no summary table required. */
|
||||
if( global_wipe_status == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Print the pass and verifications table */
|
||||
|
||||
/* IMPORTANT: Keep maximum columns (line length) to 80 characters for use with 80x30 terminals, Shredos, ALT-F2 etc
|
||||
* --------------------------------01234567890123456789012345678901234567890123456789012345678901234567890123456789-*/
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP, "" );
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
|
||||
"******************************** Error Summary *********************************" );
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP, "! Device | Pass Errors | Verifications Errors | Fdatasync I\\O Errors" );
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
|
||||
"--------------------------------------------------------------------------------" );
|
||||
|
||||
for( i = 0; i < nwipe_selected; i++ )
|
||||
{
|
||||
if( c[i]->pass_errors != 0 || c[i]->verify_errors != 0 || c[i]->fsyncdata_errors != 0 )
|
||||
{
|
||||
strncpy( exclamation_flag, "!", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( c[i]->wipe_status == 0 )
|
||||
{
|
||||
strncpy( exclamation_flag, " ", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Device name, strip any prefixed /dev/.. leaving up to 6 right justified
|
||||
* characters eg " sda", prefixed with space to 6 characters, note that
|
||||
* we are processing the strings right to left */
|
||||
|
||||
idx_dest = 6;
|
||||
device[idx_dest--] = 0;
|
||||
idx_src = strlen( c[i]->device_name );
|
||||
idx_src--;
|
||||
|
||||
while( idx_dest >= 0 )
|
||||
{
|
||||
/* if the device name contains a / start prefixing spaces */
|
||||
if( c[i]->device_name[idx_src] == '/' )
|
||||
{
|
||||
device[idx_dest--] = ' ';
|
||||
continue;
|
||||
}
|
||||
if( idx_src >= 0 )
|
||||
{
|
||||
device[idx_dest--] = c[i]->device_name[idx_src--];
|
||||
}
|
||||
}
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
|
||||
"%s %s | %10llu | %10llu | %10llu",
|
||||
exclamation_flag,
|
||||
device,
|
||||
c[i]->pass_errors,
|
||||
c[i]->verify_errors,
|
||||
c[i]->fsyncdata_errors );
|
||||
}
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
|
||||
"********************************************************************************" );
|
||||
|
||||
/* Print the main summary table */
|
||||
|
||||
/* initialise */
|
||||
total_throughput = 0;
|
||||
|
||||
@@ -662,7 +728,7 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
* --------------------------------01234567890123456789012345678901234567890123456789012345678901234567890123456789-*/
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP, "" );
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
|
||||
"********************************************************************************" );
|
||||
"********************************* Drive Status *********************************" );
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP, "! Device | Status | Thru-put | HH:MM:SS | Model/Serial Number" );
|
||||
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
|
||||
"--------------------------------------------------------------------------------" );
|
||||
@@ -711,7 +777,7 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
else
|
||||
{
|
||||
|
||||
if( c[i]->pass_errors != 0 )
|
||||
if( c[i]->pass_errors != 0 || c[i]->verify_errors != 0 )
|
||||
{
|
||||
strncpy( exclamation_flag, "!", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
@@ -721,15 +787,7 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( user_abort == 1 )
|
||||
{
|
||||
strncpy( exclamation_flag, "!", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
|
||||
strncpy( status, "UABORTED", 8 );
|
||||
status[8] = 0;
|
||||
}
|
||||
else
|
||||
if( c[i]->wipe_status == 0 )
|
||||
{
|
||||
strncpy( exclamation_flag, " ", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
@@ -737,6 +795,26 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
strncpy( status, " Erased ", 8 );
|
||||
status[8] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( user_abort == 1 )
|
||||
{
|
||||
strncpy( exclamation_flag, "!", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
|
||||
strncpy( status, "UABORTED", 8 );
|
||||
status[8] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If this ever happens, there is a bug ! */
|
||||
strncpy( exclamation_flag, " ", 1 );
|
||||
exclamation_flag[1] = 0;
|
||||
|
||||
strncpy( status, "INSANITY", 8 );
|
||||
status[8] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
472
src/method.c
472
src/method.c
@@ -34,7 +34,7 @@
|
||||
*
|
||||
* WARNING: Never change nwipe_options after calling a method.
|
||||
*
|
||||
* NOTE: The nwipe_runmethod function appends a final pass to all methods.
|
||||
* NOTE: The nwipe_runmethod function appends a user selectable final blanking (zero) pass to all methods.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -63,8 +63,10 @@ const char* nwipe_dodshort_label = "DoD Short";
|
||||
const char* nwipe_gutmann_label = "Gutmann Wipe";
|
||||
const char* nwipe_ops2_label = "RCMP TSSIT OPS-II";
|
||||
const char* nwipe_random_label = "PRNG Stream";
|
||||
const char* nwipe_zero_label = "Zero Fill";
|
||||
const char* nwipe_verify_label = "Verify Blank";
|
||||
const char* nwipe_zero_label = "Fill With Zeros";
|
||||
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_unknown_label = "Unknown Method (FIXME)";
|
||||
@@ -100,9 +102,17 @@ const char* nwipe_method_label( void* method )
|
||||
{
|
||||
return nwipe_zero_label;
|
||||
}
|
||||
if( method == &nwipe_verify )
|
||||
if( method == &nwipe_one )
|
||||
{
|
||||
return nwipe_verify_label;
|
||||
return nwipe_one_label;
|
||||
}
|
||||
if( method == &nwipe_verify_zero )
|
||||
{
|
||||
return nwipe_verify_zero_label;
|
||||
}
|
||||
if( method == &nwipe_verify_one )
|
||||
{
|
||||
return nwipe_verify_one_label;
|
||||
}
|
||||
if( method == &nwipe_is5enh )
|
||||
{
|
||||
@@ -131,9 +141,9 @@ void* nwipe_zero( void* ptr )
|
||||
|
||||
/* setup for a zero-fill. */
|
||||
|
||||
char zerofill[1] = {'\x00'};
|
||||
nwipe_pattern_t patterns[] = {{1, &zerofill[0]}, // pass 1: 0s
|
||||
{0, NULL}};
|
||||
char zerofill[1] = { '\x00' };
|
||||
nwipe_pattern_t patterns[] = { { 1, &zerofill[0] }, // pass 1: 0s
|
||||
{ 0, NULL } };
|
||||
|
||||
/* Run the method. */
|
||||
c->result = nwipe_runmethod( c, patterns );
|
||||
@@ -147,10 +157,43 @@ void* nwipe_zero( void* ptr )
|
||||
return NULL;
|
||||
} /* nwipe_zero */
|
||||
|
||||
void* nwipe_verify( void* ptr )
|
||||
void* nwipe_one( void* ptr )
|
||||
{
|
||||
/**
|
||||
* Fill the device with zeroes.
|
||||
* Fill the device with ones.
|
||||
*/
|
||||
|
||||
nwipe_context_t* c;
|
||||
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 a zero-fill. */
|
||||
|
||||
char onefill[1] = { '\xFF' };
|
||||
nwipe_pattern_t patterns[] = { { 1, &onefill[0] }, // pass 1: 1s
|
||||
{ 0, NULL } };
|
||||
|
||||
/* Run the 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;
|
||||
} /* nwipe_one */
|
||||
|
||||
void* nwipe_verify_zero( void* ptr )
|
||||
{
|
||||
/**
|
||||
* Verify the device is full of zeros.
|
||||
*/
|
||||
|
||||
nwipe_context_t* c;
|
||||
@@ -163,7 +206,37 @@ void* nwipe_verify( void* ptr )
|
||||
c->wipe_status = 1;
|
||||
|
||||
/* Do nothing because nwipe_runmethod appends a zero-fill. */
|
||||
nwipe_pattern_t patterns[] = {{0, NULL}};
|
||||
nwipe_pattern_t patterns[] = { { 0, NULL } };
|
||||
|
||||
/* Run the 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;
|
||||
} /* nwipe_verify zeros */
|
||||
|
||||
void* nwipe_verify_one( void* ptr )
|
||||
{
|
||||
/**
|
||||
* Verify the device is full of ones.
|
||||
*/
|
||||
|
||||
nwipe_context_t* c;
|
||||
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;
|
||||
|
||||
/* Do nothing because nwipe_runmethod appends a zero-fill. */
|
||||
nwipe_pattern_t patterns[] = { { 0, NULL } };
|
||||
|
||||
/* Run the method. */
|
||||
c->result = nwipe_runmethod( c, patterns );
|
||||
@@ -199,14 +272,14 @@ void* nwipe_dod522022m( void* ptr )
|
||||
/* Random characters. (Elements 2 and 6 are unused.) */
|
||||
char dod[7];
|
||||
|
||||
nwipe_pattern_t patterns[] = {{1, &dod[0]}, // Pass 1: A random character.
|
||||
{1, &dod[1]}, // Pass 2: The bitwise complement of pass 1.
|
||||
{-1, ""}, // Pass 3: A random stream.
|
||||
{1, &dod[3]}, // Pass 4: A random character.
|
||||
{1, &dod[4]}, // Pass 5: A random character.
|
||||
{1, &dod[5]}, // Pass 6: The bitwise complement of pass 5.
|
||||
{-1, ""}, // Pass 7: A random stream.
|
||||
{0, NULL}};
|
||||
nwipe_pattern_t patterns[] = { { 1, &dod[0] }, // Pass 1: A random character.
|
||||
{ 1, &dod[1] }, // Pass 2: The bitwise complement of pass 1.
|
||||
{ -1, "" }, // Pass 3: A random stream.
|
||||
{ 1, &dod[3] }, // Pass 4: A random character.
|
||||
{ 1, &dod[4] }, // Pass 5: A random character.
|
||||
{ 1, &dod[5] }, // Pass 6: The bitwise complement of pass 5.
|
||||
{ -1, "" }, // Pass 7: A random stream.
|
||||
{ 0, NULL } };
|
||||
|
||||
/* Load the array with random characters. */
|
||||
r = read( c->entropy_fd, &dod, sizeof( dod ) );
|
||||
@@ -274,10 +347,10 @@ void* nwipe_dodshort( void* ptr )
|
||||
/* Random characters. (Element 3 is unused.) */
|
||||
char dod[3];
|
||||
|
||||
nwipe_pattern_t patterns[] = {{1, &dod[0]}, // Pass 1: A random character.
|
||||
{1, &dod[1]}, // Pass 2: The bitwise complement of pass 1.
|
||||
{-1, ""}, // Pass 3: A random stream.
|
||||
{0, NULL}};
|
||||
nwipe_pattern_t patterns[] = { { 1, &dod[0] }, // Pass 1: A random character.
|
||||
{ 1, &dod[1] }, // Pass 2: The bitwise complement of pass 1.
|
||||
{ -1, "" }, // Pass 3: A random stream.
|
||||
{ 0, NULL } };
|
||||
|
||||
/* Load the array with random characters. */
|
||||
r = read( c->entropy_fd, &dod, sizeof( dod ) );
|
||||
@@ -348,42 +421,42 @@ void* nwipe_gutmann( void* ptr )
|
||||
int n;
|
||||
|
||||
/* Define the Gutmann method. */
|
||||
nwipe_pattern_t book[] = {{-1, ""}, // Random pass.
|
||||
{-1, ""}, // Random pass.
|
||||
{-1, ""}, // Random pass.
|
||||
{-1, ""}, // Random pass.
|
||||
{3, "\x55\x55\x55"}, // Static pass: 0x555555 01010101 01010101 01010101
|
||||
{3, "\xAA\xAA\xAA"}, // Static pass: 0XAAAAAA 10101010 10101010 10101010
|
||||
{3, "\x92\x49\x24"}, // Static pass: 0x924924 10010010 01001001 00100100
|
||||
{3, "\x49\x24\x92"}, // Static pass: 0x492492 01001001 00100100 10010010
|
||||
{3, "\x24\x92\x49"}, // Static pass: 0x249249 00100100 10010010 01001001
|
||||
{3, "\x00\x00\x00"}, // Static pass: 0x000000 00000000 00000000 00000000
|
||||
{3, "\x11\x11\x11"}, // Static pass: 0x111111 00010001 00010001 00010001
|
||||
{3, "\x22\x22\x22"}, // Static pass: 0x222222 00100010 00100010 00100010
|
||||
{3, "\x33\x33\x33"}, // Static pass: 0x333333 00110011 00110011 00110011
|
||||
{3, "\x44\x44\x44"}, // Static pass: 0x444444 01000100 01000100 01000100
|
||||
{3, "\x55\x55\x55"}, // Static pass: 0x555555 01010101 01010101 01010101
|
||||
{3, "\x66\x66\x66"}, // Static pass: 0x666666 01100110 01100110 01100110
|
||||
{3, "\x77\x77\x77"}, // Static pass: 0x777777 01110111 01110111 01110111
|
||||
{3, "\x88\x88\x88"}, // Static pass: 0x888888 10001000 10001000 10001000
|
||||
{3, "\x99\x99\x99"}, // Static pass: 0x999999 10011001 10011001 10011001
|
||||
{3, "\xAA\xAA\xAA"}, // Static pass: 0xAAAAAA 10101010 10101010 10101010
|
||||
{3, "\xBB\xBB\xBB"}, // Static pass: 0xBBBBBB 10111011 10111011 10111011
|
||||
{3, "\xCC\xCC\xCC"}, // Static pass: 0xCCCCCC 11001100 11001100 11001100
|
||||
{3, "\xDD\xDD\xDD"}, // Static pass: 0xDDDDDD 11011101 11011101 11011101
|
||||
{3, "\xEE\xEE\xEE"}, // Static pass: 0xEEEEEE 11101110 11101110 11101110
|
||||
{3, "\xFF\xFF\xFF"}, // Static pass: 0xFFFFFF 11111111 11111111 11111111
|
||||
{3, "\x92\x49\x24"}, // Static pass: 0x924924 10010010 01001001 00100100
|
||||
{3, "\x49\x24\x92"}, // Static pass: 0x492492 01001001 00100100 10010010
|
||||
{3, "\x24\x92\x49"}, // Static pass: 0x249249 00100100 10010010 01001001
|
||||
{3, "\x6D\xB6\xDB"}, // Static pass: 0x6DB6DB 01101101 10110110 11011011
|
||||
{3, "\xB6\xDB\x6D"}, // Static pass: 0xB6DB6D 10110110 11011011 01101101
|
||||
{3, "\xDB\x6D\xB6"}, // Static pass: 0XDB6DB6 11011011 01101101 10110110
|
||||
{-1, ""}, // Random pass.
|
||||
{-1, ""}, // Random pass.
|
||||
{-1, ""}, // Random pass.
|
||||
{-1, ""}, // Random pass.
|
||||
{0, NULL}};
|
||||
nwipe_pattern_t book[] = { { -1, "" }, // Random pass.
|
||||
{ -1, "" }, // Random pass.
|
||||
{ -1, "" }, // Random pass.
|
||||
{ -1, "" }, // Random pass.
|
||||
{ 3, "\x55\x55\x55" }, // Static pass: 0x555555 01010101 01010101 01010101
|
||||
{ 3, "\xAA\xAA\xAA" }, // Static pass: 0XAAAAAA 10101010 10101010 10101010
|
||||
{ 3, "\x92\x49\x24" }, // Static pass: 0x924924 10010010 01001001 00100100
|
||||
{ 3, "\x49\x24\x92" }, // Static pass: 0x492492 01001001 00100100 10010010
|
||||
{ 3, "\x24\x92\x49" }, // Static pass: 0x249249 00100100 10010010 01001001
|
||||
{ 3, "\x00\x00\x00" }, // Static pass: 0x000000 00000000 00000000 00000000
|
||||
{ 3, "\x11\x11\x11" }, // Static pass: 0x111111 00010001 00010001 00010001
|
||||
{ 3, "\x22\x22\x22" }, // Static pass: 0x222222 00100010 00100010 00100010
|
||||
{ 3, "\x33\x33\x33" }, // Static pass: 0x333333 00110011 00110011 00110011
|
||||
{ 3, "\x44\x44\x44" }, // Static pass: 0x444444 01000100 01000100 01000100
|
||||
{ 3, "\x55\x55\x55" }, // Static pass: 0x555555 01010101 01010101 01010101
|
||||
{ 3, "\x66\x66\x66" }, // Static pass: 0x666666 01100110 01100110 01100110
|
||||
{ 3, "\x77\x77\x77" }, // Static pass: 0x777777 01110111 01110111 01110111
|
||||
{ 3, "\x88\x88\x88" }, // Static pass: 0x888888 10001000 10001000 10001000
|
||||
{ 3, "\x99\x99\x99" }, // Static pass: 0x999999 10011001 10011001 10011001
|
||||
{ 3, "\xAA\xAA\xAA" }, // Static pass: 0xAAAAAA 10101010 10101010 10101010
|
||||
{ 3, "\xBB\xBB\xBB" }, // Static pass: 0xBBBBBB 10111011 10111011 10111011
|
||||
{ 3, "\xCC\xCC\xCC" }, // Static pass: 0xCCCCCC 11001100 11001100 11001100
|
||||
{ 3, "\xDD\xDD\xDD" }, // Static pass: 0xDDDDDD 11011101 11011101 11011101
|
||||
{ 3, "\xEE\xEE\xEE" }, // Static pass: 0xEEEEEE 11101110 11101110 11101110
|
||||
{ 3, "\xFF\xFF\xFF" }, // Static pass: 0xFFFFFF 11111111 11111111 11111111
|
||||
{ 3, "\x92\x49\x24" }, // Static pass: 0x924924 10010010 01001001 00100100
|
||||
{ 3, "\x49\x24\x92" }, // Static pass: 0x492492 01001001 00100100 10010010
|
||||
{ 3, "\x24\x92\x49" }, // Static pass: 0x249249 00100100 10010010 01001001
|
||||
{ 3, "\x6D\xB6\xDB" }, // Static pass: 0x6DB6DB 01101101 10110110 11011011
|
||||
{ 3, "\xB6\xDB\x6D" }, // Static pass: 0xB6DB6D 10110110 11011011 01101101
|
||||
{ 3, "\xDB\x6D\xB6" }, // Static pass: 0XDB6DB6 11011011 01101101 10110110
|
||||
{ -1, "" }, // Random pass.
|
||||
{ -1, "" }, // Random pass.
|
||||
{ -1, "" }, // Random pass.
|
||||
{ -1, "" }, // Random pass.
|
||||
{ 0, NULL } };
|
||||
|
||||
/* Put the book array into this array in random order. */
|
||||
nwipe_pattern_t patterns[36];
|
||||
@@ -439,8 +512,6 @@ void* nwipe_gutmann( void* ptr )
|
||||
|
||||
/* Mark this element as having been used. */
|
||||
book[j].length = 0;
|
||||
|
||||
nwipe_log( NWIPE_LOG_DEBUG, "nwipe_gutmann: Set patterns[%i] = book[%i].", i, j );
|
||||
}
|
||||
|
||||
/* Ensure that the array is terminated. */
|
||||
@@ -636,11 +707,11 @@ void* nwipe_is5enh( void* ptr )
|
||||
|
||||
c->wipe_status = 1;
|
||||
|
||||
char is5enh[3] = {'\x00', '\xFF', '\x00'};
|
||||
nwipe_pattern_t patterns[] = {{1, &is5enh[0]}, // Pass 1: 0s
|
||||
{1, &is5enh[1]}, // Pass 2: 1s
|
||||
{-1, &is5enh[2]}, // Pass 3: random bytes with verification
|
||||
{0, NULL}};
|
||||
char is5enh[3] = { '\x00', '\xFF', '\x00' };
|
||||
nwipe_pattern_t patterns[] = { { 1, &is5enh[0] }, // Pass 1: 0s
|
||||
{ 1, &is5enh[1] }, // Pass 2: 1s
|
||||
{ -1, &is5enh[2] }, // Pass 3: random bytes with verification
|
||||
{ 0, NULL } };
|
||||
c->result = nwipe_runmethod( c, patterns );
|
||||
|
||||
c->wipe_status = 0;
|
||||
@@ -668,7 +739,7 @@ void* nwipe_random( void* ptr )
|
||||
c->wipe_status = 1;
|
||||
|
||||
/* Define the random method. */
|
||||
nwipe_pattern_t patterns[] = {{-1, ""}, {0, NULL}};
|
||||
nwipe_pattern_t patterns[] = { { -1, "" }, { 0, NULL } };
|
||||
|
||||
/* Run the method. */
|
||||
c->result = nwipe_runmethod( c, patterns );
|
||||
@@ -701,7 +772,10 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
i = 0;
|
||||
|
||||
/* The zero-fill pattern for the final pass of most methods. */
|
||||
nwipe_pattern_t pattern_zero = {1, "\x00"};
|
||||
nwipe_pattern_t pattern_zero = { 1, "\x00" };
|
||||
|
||||
/* The one-fill pattern for verification of the ones fill */
|
||||
nwipe_pattern_t pattern_one = { 1, "\xFF" };
|
||||
|
||||
/* Create the PRNG state buffer. */
|
||||
c->prng_seed.length = NWIPE_KNOB_PRNG_STATE_LENGTH;
|
||||
@@ -727,25 +801,13 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
/* Set the number of bytes that will be written across all passes in one round. */
|
||||
c->pass_size = c->pass_count * c->device_size;
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
/* We must read back all passes, so double the byte count. */
|
||||
c->pass_size *= 2;
|
||||
}
|
||||
|
||||
/* Tell the parent the number of rounds that will be run. */
|
||||
c->round_count = nwipe_options.rounds;
|
||||
|
||||
/* Set the initial number of bytes that will be written across all rounds. */
|
||||
c->round_size = c->pass_size;
|
||||
|
||||
/* For the selected method, calculate the correct round_size value (for correct percentage calculation) */
|
||||
calculate_round_size( c );
|
||||
|
||||
c->result = c->round_size;
|
||||
|
||||
/* If only verifing then the round size is the device size */
|
||||
if( nwipe_options.method == &nwipe_verify )
|
||||
if( nwipe_options.method == &nwipe_verify_zero || nwipe_options.method == &nwipe_verify_one )
|
||||
{
|
||||
c->round_size = c->device_size;
|
||||
}
|
||||
@@ -830,6 +892,8 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
r = nwipe_static_verify( c, &patterns[i] );
|
||||
c->pass_type = NWIPE_PASS_NONE;
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes read from %s", c->pass_done, c->device_name );
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
{
|
||||
@@ -902,6 +966,8 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
r = nwipe_random_verify( c );
|
||||
c->pass_type = NWIPE_PASS_NONE;
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes read from %s", c->pass_done, c->device_name );
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
{
|
||||
@@ -976,6 +1042,8 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
/* The final ops2 pass. */
|
||||
r = nwipe_random_pass( c );
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes written to %s", c->pass_done, c->device_name );
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
{
|
||||
@@ -984,27 +1052,27 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST || nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verifying the final random pattern on %s is empty.", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verifying final random pattern FRP on %s", c->device_name );
|
||||
|
||||
/* Verify the final zero pass. */
|
||||
r = nwipe_random_verify( c );
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes read from %s", c->pass_done, c->device_name );
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verified the final random pattern on '%s' is empty.", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Verified FRP on '%s' matches", c->device_name );
|
||||
}
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Wrote final random pattern to '%s'.", c->device_name );
|
||||
|
||||
} /* final ops2 */
|
||||
|
||||
else if( nwipe_options.method == &nwipe_verify )
|
||||
else if( nwipe_options.method == &nwipe_verify_zero )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verifying that %s is empty", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verifying that %s is zeroed", c->device_name );
|
||||
|
||||
/* Verify the final zero pass. */
|
||||
c->pass_type = NWIPE_PASS_VERIFY;
|
||||
@@ -1018,11 +1086,36 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
}
|
||||
if( c->verify_errors == 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Verified that %s is empty.", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Verified that %s is Zeroed.", c->device_name );
|
||||
}
|
||||
else
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_ERROR, "[FAILURE] %s IS NOT empty.", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_ERROR, "[FAILURE] %s has not been Zeroed .", c->device_name );
|
||||
}
|
||||
|
||||
} /* verify */
|
||||
|
||||
else if( nwipe_options.method == &nwipe_verify_one )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verifying that %s is Ones (0xFF)", c->device_name );
|
||||
|
||||
/* Verify the final ones pass. */
|
||||
c->pass_type = NWIPE_PASS_VERIFY;
|
||||
r = nwipe_static_verify( c, &pattern_one );
|
||||
c->pass_type = NWIPE_PASS_NONE;
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
if( c->verify_errors == 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Verified that %s is full of ones (0xFF).", c->device_name );
|
||||
}
|
||||
else
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_ERROR, "[FAILURE] %s is not full of ones (0xFF).", c->device_name );
|
||||
}
|
||||
|
||||
} /* verify */
|
||||
@@ -1037,6 +1130,9 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
/* The final zero pass. */
|
||||
r = nwipe_static_pass( c, &pattern_zero );
|
||||
|
||||
/* Log number of bytes written to disk */
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes written to %s", c->pass_done, c->device_name );
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
{
|
||||
@@ -1048,7 +1144,12 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Verifying that %s is empty.", c->device_name );
|
||||
|
||||
/* Verify the final zero pass. */
|
||||
c->pass_type = NWIPE_PASS_VERIFY;
|
||||
r = nwipe_static_verify( c, &pattern_zero );
|
||||
c->pass_type = NWIPE_PASS_NONE;
|
||||
|
||||
/* Log number of bytes read from disk */
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes read from %s", c->pass_done, c->device_name );
|
||||
|
||||
/* Check for a fatal error. */
|
||||
if( r < 0 )
|
||||
@@ -1066,7 +1167,14 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
}
|
||||
}
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Blanked device %s", c->device_name );
|
||||
if( c->verify_errors == 0 && c->pass_errors == 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Blanked device %s", c->device_name );
|
||||
}
|
||||
else
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "[FAILURE] %s may not be blanked", c->device_name );
|
||||
}
|
||||
|
||||
} /* final blank */
|
||||
|
||||
@@ -1104,24 +1212,23 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
|
||||
void calculate_round_size( nwipe_context_t* c )
|
||||
{
|
||||
/* This is where the round size is adjusted. round_size is used in the running percentage completion
|
||||
/* This is where the round size is calculated. round_size is used in the running percentage completion
|
||||
* calculation. round size is calculated based on pass_size, pass_count, number of rounds, blanking
|
||||
* on/off and verification on/off
|
||||
* on/off and verification All/Last/None
|
||||
*
|
||||
* To hopefully make this adjustment more understandable, I have presented each calculation
|
||||
* under each method. This should make it easier to add a new method here without breaking the
|
||||
* calculations for other methods.
|
||||
* To hopefully make this calculation more understandable, I have separated the calculations that apply to
|
||||
* all methods and processed first then created a switch statement that contains method specific changes if any
|
||||
*/
|
||||
|
||||
/* Don't change the order of these values as the case statements use their index in the array */
|
||||
void* array_methods[] = {&nwipe_zero,
|
||||
&nwipe_ops2,
|
||||
&nwipe_dodshort,
|
||||
&nwipe_dod522022m,
|
||||
&nwipe_gutmann,
|
||||
&nwipe_random,
|
||||
&nwipe_is5enh,
|
||||
NULL};
|
||||
void* array_methods[] = { &nwipe_zero,
|
||||
&nwipe_ops2,
|
||||
&nwipe_dodshort,
|
||||
&nwipe_dod522022m,
|
||||
&nwipe_gutmann,
|
||||
&nwipe_random,
|
||||
&nwipe_is5enh,
|
||||
NULL };
|
||||
int i;
|
||||
|
||||
/* This while loop allows us to effectively create a const so we can use a case statement rather than if statements.
|
||||
@@ -1141,118 +1248,110 @@ void calculate_round_size( nwipe_context_t* c )
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Multiple the round_size by the number of rounds (times) the user wants to wipe the drive with this method.
|
||||
*/
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
/* We must read back all passes, so double the byte count. */
|
||||
c->pass_size *= 2;
|
||||
}
|
||||
|
||||
/* Tell the parent the number of rounds that will be run. */
|
||||
c->round_count = nwipe_options.rounds;
|
||||
|
||||
/* Set the initial number of bytes that will be written across all rounds.
|
||||
c->pass_size includes write AND verification passes if 'verify_all' is selected
|
||||
but does not include the final blanking pass or the verify_last option */
|
||||
c->round_size = c->pass_size;
|
||||
|
||||
/* Multiple the round_size by the number of rounds (times) the user wants to wipe the drive with this method. */
|
||||
c->round_size *= c->round_count;
|
||||
|
||||
/* For each method create the correct round_size value */
|
||||
/* Now increase size based on whether blanking is enabled and verification */
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
/* Blanking enabled so increase round size */
|
||||
c->round_size += c->device_size;
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST || nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Blanking not enabled, check for 'Verify_last', increase round size if enabled. */
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Additional method specific round_size adjustments go in this switch statement */
|
||||
|
||||
switch( selected_method )
|
||||
{
|
||||
case 0:
|
||||
/* NWIPE_ZERO
|
||||
/* NWIPE_ZERO - No additional calculation required
|
||||
* ---------- */
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* NWIPE_OPS2
|
||||
* ---------- */
|
||||
|
||||
/* Required for the 9th and final random pass */
|
||||
/* Required for mandatory 9th and final random pass */
|
||||
c->round_size += c->device_size;
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
/* Required for selectable 9th and final random verification */
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL || nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
|
||||
/* As no final zero blanking pass is permitted by this standard reduce round size if it's seelected */
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
/* Reduce for blanking pass */
|
||||
c->round_size -= c->device_size;
|
||||
|
||||
/* Reduce for blanking pass verification */
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL || nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size -= c->device_size;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
/* If blanking off & verification on reduce round size */
|
||||
c->round_size -= c->device_size;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* DoD Short
|
||||
/* DoD Short - No additional calculation required
|
||||
* --------- */
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* DOD 522022m
|
||||
/* DOD 522022m - No additional calculation required
|
||||
* ----------- */
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
/* GutMann
|
||||
/* GutMann - No additional calculation required
|
||||
* ------- */
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
/* PRNG (random)
|
||||
/* PRNG (random) - No additional calculation required
|
||||
* ------------- */
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
@@ -1260,25 +1359,20 @@ void calculate_round_size( nwipe_context_t* c )
|
||||
* ------------ */
|
||||
|
||||
/* This method ALWAYS verifies the 3rd pass so increase by device size,
|
||||
* and does not need to be increased by device size for VERIFY_ALL*/
|
||||
* but NOT if VERIFY_ALL has been selected, but first .. */
|
||||
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST )
|
||||
/* Reduce as Verify_Last already included previously if blanking was off */
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_LAST && nwipe_options.noblank == 1 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
c->round_size -= c->device_size;
|
||||
}
|
||||
if( nwipe_options.verify == NWIPE_VERIFY_ALL )
|
||||
|
||||
/* Adjusts for verify on every third pass multiplied by number of rounds */
|
||||
if( nwipe_options.verify != NWIPE_VERIFY_ALL )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Adjusts for verify on every third pass multiplied by number of rounds */
|
||||
c->round_size += ( c->device_size * c->round_count );
|
||||
}
|
||||
if( nwipe_options.noblank == 0 )
|
||||
{
|
||||
c->round_size += c->device_size;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@ void* nwipe_ops2( void* ptr );
|
||||
void* nwipe_is5enh( void* ptr );
|
||||
void* nwipe_random( void* ptr );
|
||||
void* nwipe_zero( void* ptr );
|
||||
void* nwipe_verify( void* ptr );
|
||||
void* nwipe_one( void* ptr );
|
||||
void* nwipe_verify_zero( void* ptr );
|
||||
void* nwipe_verify_one( void* ptr );
|
||||
|
||||
void calculate_round_size( nwipe_context_t* );
|
||||
|
||||
|
||||
61
src/nwipe.c
61
src/nwipe.c
@@ -32,7 +32,6 @@
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
#include <bits/sigthread.h>
|
||||
|
||||
#include "nwipe.h"
|
||||
#include "context.h"
|
||||
@@ -53,6 +52,7 @@
|
||||
|
||||
int terminate_signal;
|
||||
int user_abort;
|
||||
int global_wipe_status;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
@@ -88,6 +88,13 @@ int main( int argc, char** argv )
|
||||
/* nwipes return status value, set prior to exit at the end of nwipe, as no other exit points allowed */
|
||||
int return_status = 0;
|
||||
|
||||
/* Initialise, flag indicating whether a wipe has actually started or not 0=no, 1=yes */
|
||||
global_wipe_status = 0;
|
||||
|
||||
/* Initialise flags that indicates whether a fatal or non fatal error occured on ANY drive */
|
||||
int fatal_errors_flag = 0;
|
||||
int non_fatal_errors_flag = 0;
|
||||
|
||||
/* Two arrays are used, containing pointers to the the typedef for each disk */
|
||||
/* The first array (c1) points to all devices, the second points to only */
|
||||
/* the disks selected for wiping. */
|
||||
@@ -216,12 +223,6 @@ int main( int argc, char** argv )
|
||||
/* The user must manually select devices. */
|
||||
c1[i]->select = NWIPE_SELECT_FALSE;
|
||||
}
|
||||
|
||||
/* Set the PRNG implementation. */
|
||||
c1[i]->prng = nwipe_options.prng;
|
||||
c1[i]->prng_seed.length = 0;
|
||||
c1[i]->prng_seed.s = 0;
|
||||
c1[i]->prng_state = 0;
|
||||
}
|
||||
|
||||
/* Check for initialization errors. */
|
||||
@@ -257,9 +258,15 @@ int main( int argc, char** argv )
|
||||
}
|
||||
}
|
||||
|
||||
/* Count the number of selected contexts. */
|
||||
for( i = 0; i < nwipe_enumerated; i++ )
|
||||
{
|
||||
/* Set the PRNG implementation, which must always come after the function nwipe_gui_select ! */
|
||||
c1[i]->prng = nwipe_options.prng;
|
||||
c1[i]->prng_seed.length = 0;
|
||||
c1[i]->prng_seed.s = 0;
|
||||
c1[i]->prng_state = 0;
|
||||
|
||||
/* Count the number of selected contexts. */
|
||||
if( c1[i]->select == NWIPE_SELECT_TRUE )
|
||||
{
|
||||
nwipe_selected += 1;
|
||||
@@ -282,6 +289,12 @@ int main( int argc, char** argv )
|
||||
/* TODO: free c1 and c2 memory. */
|
||||
if( user_abort == 0 )
|
||||
{
|
||||
/* Log the wipe options that have been selected immediately prior to the start of the wipe */
|
||||
nwipe_options_log();
|
||||
|
||||
/* The wipe has been initiated */
|
||||
global_wipe_status = 1;
|
||||
|
||||
for( i = 0; i < nwipe_selected; i++ )
|
||||
{
|
||||
/* A result buffer for the BLKGETSIZE64 ioctl. */
|
||||
@@ -583,6 +596,7 @@ int main( int argc, char** argv )
|
||||
if( c2[i]->result > 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_FATAL, "Nwipe exited with non fatal errors on device = %s\n", c2[i]->device_name );
|
||||
non_fatal_errors_flag = 1;
|
||||
return_status = 1;
|
||||
}
|
||||
}
|
||||
@@ -593,6 +607,7 @@ int main( int argc, char** argv )
|
||||
if( c2[i]->result < 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_ERROR, "Nwipe exited with fatal errors on device = %s\n", c2[i]->device_name );
|
||||
fatal_errors_flag = 1;
|
||||
return_status = -1;
|
||||
}
|
||||
}
|
||||
@@ -601,9 +616,33 @@ int main( int argc, char** argv )
|
||||
/* Generate and send the drive status summary to the log */
|
||||
nwipe_log_summary( c2, nwipe_selected );
|
||||
|
||||
if( return_status == 0 )
|
||||
/* Print a one line status message for the user */
|
||||
if( return_status == 0 || return_status == 1 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_INFO, "Nwipe successfully exited." );
|
||||
if( user_abort == 1 )
|
||||
{
|
||||
if( global_wipe_status == 1 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_INFO,
|
||||
"Nwipe was aborted by the user. Check the summary table for the drive status." );
|
||||
}
|
||||
else
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_INFO, "Nwipe was aborted by the user prior to the wipe starting." );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fatal_errors_flag == 1 || non_fatal_errors_flag == 1 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_INFO,
|
||||
"Nwipe exited with errors, check the log & summary table for individual drive status." );
|
||||
}
|
||||
else
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_INFO, "Nwipe successfully completed. See summary table for details." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup();
|
||||
@@ -778,7 +817,7 @@ int cleanup()
|
||||
}
|
||||
void check_for_autopoweroff( void )
|
||||
{
|
||||
char cmd[] = "shutdown -P +1 \"System going down in one minute\"";
|
||||
char cmd[] = "shutdown -Ph +1 \"System going down in one minute\"";
|
||||
FILE* fp;
|
||||
int r; // A result buffer.
|
||||
|
||||
|
||||
@@ -73,6 +73,9 @@ void* signal_hand( void* );
|
||||
/* System errors. */
|
||||
extern int errno;
|
||||
|
||||
/* 0=wipe not yet started, 1=wipe has been started by the user */
|
||||
extern int global_wipe_status;
|
||||
|
||||
/* Global array to hold log values to print when logging to STDOUT */
|
||||
/* char **log_lines;
|
||||
int log_current_element = 0;
|
||||
|
||||
100
src/options.c
100
src/options.c
@@ -58,58 +58,58 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
/* The list of acceptable long options. */
|
||||
static struct option nwipe_options_long[] = {
|
||||
/* Set when the user wants to wipe without a confirmation prompt. */
|
||||
{"autonuke", no_argument, 0, 0},
|
||||
{ "autonuke", no_argument, 0, 0 },
|
||||
|
||||
/* Set when the user wants to have the system powerdown on completion of wipe. */
|
||||
{"autopoweroff", no_argument, 0, 0},
|
||||
{ "autopoweroff", no_argument, 0, 0 },
|
||||
|
||||
/* A GNU standard option. Corresponds to the 'h' short option. */
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
|
||||
/* The wipe method. Corresponds to the 'm' short option. */
|
||||
{"method", required_argument, 0, 'm'},
|
||||
{ "method", required_argument, 0, 'm' },
|
||||
|
||||
/* Log file. Corresponds to the 'l' short option. */
|
||||
{"logfile", required_argument, 0, 'l'},
|
||||
{ "logfile", required_argument, 0, 'l' },
|
||||
|
||||
/* Exclude devices, comma separated list */
|
||||
{"exclude", required_argument, 0, 'e'},
|
||||
{ "exclude", required_argument, 0, 'e' },
|
||||
|
||||
/* The Pseudo Random Number Generator. */
|
||||
{"prng", required_argument, 0, 'p'},
|
||||
{ "prng", required_argument, 0, 'p' },
|
||||
|
||||
/* The number of times to run the method. */
|
||||
{"rounds", required_argument, 0, 'r'},
|
||||
{ "rounds", required_argument, 0, 'r' },
|
||||
|
||||
/* Whether to blank the disk after wiping. */
|
||||
{"noblank", no_argument, 0, 0},
|
||||
{ "noblank", no_argument, 0, 0 },
|
||||
|
||||
/* Whether to ignore all USB devices. */
|
||||
{"nousb", no_argument, 0, 0},
|
||||
{ "nousb", no_argument, 0, 0 },
|
||||
|
||||
/* Whether to exit after wiping or wait for a keypress. */
|
||||
{"nowait", no_argument, 0, 0},
|
||||
{ "nowait", no_argument, 0, 0 },
|
||||
|
||||
/* Whether to allow signals to interrupt a wipe. */
|
||||
{"nosignals", no_argument, 0, 0},
|
||||
{ "nosignals", no_argument, 0, 0 },
|
||||
|
||||
/* Whether to exit after wiping or wait for a keypress. */
|
||||
{"nogui", no_argument, 0, 0},
|
||||
{ "nogui", no_argument, 0, 0 },
|
||||
|
||||
/* A flag to indicate whether the devices whould be opened in sync mode. */
|
||||
{"sync", required_argument, 0, 0},
|
||||
{ "sync", required_argument, 0, 0 },
|
||||
|
||||
/* Verify that wipe patterns are being written to the device. */
|
||||
{"verify", required_argument, 0, 0},
|
||||
{ "verify", required_argument, 0, 0 },
|
||||
|
||||
/* Display program version. */
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{ "verbose", no_argument, 0, 'v' },
|
||||
|
||||
/* Display program version. */
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{ "version", no_argument, 0, 'V' },
|
||||
|
||||
/* Requisite padding for getopt(). */
|
||||
{0, 0, 0, 0}};
|
||||
{ 0, 0, 0, 0 } };
|
||||
|
||||
/* Set default options. */
|
||||
nwipe_options.autonuke = 0;
|
||||
@@ -276,9 +276,21 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
break;
|
||||
}
|
||||
|
||||
if( strcmp( optarg, "verify" ) == 0 )
|
||||
if( strcmp( optarg, "one" ) == 0 )
|
||||
{
|
||||
nwipe_options.method = &nwipe_verify;
|
||||
nwipe_options.method = &nwipe_one;
|
||||
break;
|
||||
}
|
||||
|
||||
if( strcmp( optarg, "verify_zero" ) == 0 )
|
||||
{
|
||||
nwipe_options.method = &nwipe_verify_zero;
|
||||
break;
|
||||
}
|
||||
|
||||
if( strcmp( optarg, "verify_one" ) == 0 )
|
||||
{
|
||||
nwipe_options.method = &nwipe_verify_one;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -399,6 +411,9 @@ int nwipe_options_parse( int argc, char** argv )
|
||||
|
||||
void nwipe_options_log( void )
|
||||
{
|
||||
extern nwipe_prng_t nwipe_twister;
|
||||
extern nwipe_prng_t nwipe_isaac;
|
||||
|
||||
/**
|
||||
* Prints a manifest of options to the log.
|
||||
*/
|
||||
@@ -444,6 +459,23 @@ void nwipe_options_log( void )
|
||||
}
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " banner = %s", banner );
|
||||
|
||||
if( nwipe_options.prng == &nwipe_twister )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " prng = Mersenne Twister" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( nwipe_options.prng == &nwipe_isaac )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " prng = Isaac" );
|
||||
}
|
||||
else
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " prng = Undefined" );
|
||||
}
|
||||
}
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " method = %s", nwipe_method_label( nwipe_options.method ) );
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " rounds = %i", nwipe_options.rounds );
|
||||
nwipe_log( NWIPE_LOG_NOTICE, " sync = %i", nwipe_options.sync );
|
||||
@@ -489,13 +521,13 @@ void display_help()
|
||||
puts( " for one minute. During this one minute delay you can" );
|
||||
puts( " abort the shutdown by typing sudo shutdown -c\n" );
|
||||
printf( " --sync=NUM Will perform a sync after NUM writes (default: %d)\n", DEFAULT_SYNC_RATE );
|
||||
puts( " 0 - fdatasync after the disk is completely written" );
|
||||
puts( " fdatasync errors not detected until completion." );
|
||||
puts( " 0 is not recommended as disk errors may cause nwipe" );
|
||||
puts( " to appear to hang" );
|
||||
puts( " 1 - fdatasync after every write" );
|
||||
puts( " Warning: Lower values will reduce wipe speeds." );
|
||||
puts( " 1000000 - fdatasync after 1000000 writes etc.)\n" );
|
||||
puts( " 0 - fdatasync after the disk is completely written" );
|
||||
puts( " fdatasync errors not detected until completion." );
|
||||
puts( " 0 is not recommended as disk errors may cause" );
|
||||
puts( " nwipe to appear to hang" );
|
||||
puts( " 1 - fdatasync after every write" );
|
||||
puts( " Warning: Lower values will reduce wipe speeds." );
|
||||
puts( " 1000 - fdatasync after 1000 writes etc.\n" );
|
||||
puts( " --verify=TYPE Whether to perform verification of erasure" );
|
||||
puts( " (default: last)" );
|
||||
puts( " off - Do not verify" );
|
||||
@@ -509,21 +541,23 @@ void display_help()
|
||||
puts( " ops2 - RCMP TSSIT OPS-II" );
|
||||
puts( " random / prng / stream - PRNG Stream" );
|
||||
puts( " zero / quick - Overwrite with zeros" );
|
||||
puts( " verify - Verifies disk is zero filled\n" );
|
||||
puts( " one - Overwrite with ones (0xFF)" );
|
||||
puts( " verify_zero - Verifies disk is zero filled\n" );
|
||||
puts( " verify_one - Verifies disk is 0xFF filled\n" );
|
||||
puts( " -l, --logfile=FILE Filename to log to. Default is STDOUT\n" );
|
||||
puts( " -p, --prng=METHOD PRNG option (mersenne|twister|isaac)\n" );
|
||||
puts( " -r, --rounds=NUM Number of times to wipe the device using the selected" );
|
||||
puts( " method (default: 1)\n" );
|
||||
puts( " --noblank Do not blank disk after wipe" );
|
||||
puts( " --noblank Do NOT blank disk after wipe" );
|
||||
puts( " (default is to complete a final blank pass)\n" );
|
||||
puts( " --nowait Do not wait for a key before exiting" );
|
||||
puts( " --nowait Do NOT wait for a key before exiting" );
|
||||
puts( " (default is to wait)\n" );
|
||||
puts( " --nosignals Do not allow signals to interrupt a wipe" );
|
||||
puts( " --nosignals Do NOT allow signals to interrupt a wipe" );
|
||||
puts( " (default is to allow)\n" );
|
||||
puts( " --nogui Do not show the GUI interface. Automatically invokes" );
|
||||
puts( " --nogui Do NOT show the GUI interface. Automatically invokes" );
|
||||
puts( " the nowait option. Must be used with the --autonuke" );
|
||||
puts( " option. Send SIGUSR1 to log current stats\n" );
|
||||
puts( " --nousb Do show or wipe any USB devices whether in GUI" );
|
||||
puts( " --nousb Do NOT show or wipe any USB devices whether in GUI" );
|
||||
puts( " mode, --nogui or --autonuke modes.\n" );
|
||||
puts( " -e, --exclude=DEVICES Up to ten comma separated devices to be excluded" );
|
||||
puts( " --exclude=/dev/sdc" );
|
||||
|
||||
34
src/pass.c
34
src/pass.c
@@ -130,6 +130,7 @@ int nwipe_random_verify( nwipe_context_t* c )
|
||||
/* FIXME: Is there a better way to handle this? */
|
||||
nwipe_perror( errno, __FUNCTION__, "fdatasync" );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name );
|
||||
c->fsyncdata_errors++;
|
||||
}
|
||||
|
||||
/* Reseed the PRNG. */
|
||||
@@ -248,6 +249,9 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
/* Counter to track when to do a fdatasync. */
|
||||
int i = 0;
|
||||
|
||||
/* general index counter */
|
||||
int idx;
|
||||
|
||||
if( c->prng_seed.s == NULL )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_SANITY, "__FUNCTION__: Null seed pointer." );
|
||||
@@ -260,8 +264,9 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Create the output buffer. */
|
||||
b = malloc( c->device_stat.st_blksize );
|
||||
/* Create the initialised output buffer. Initialised because we don't want memory leaks
|
||||
* to disk in the event of some future undetected bug in a prng or it's implementation ) */
|
||||
b = calloc( c->device_stat.st_blksize, sizeof( char ) );
|
||||
|
||||
/* Check the memory allocation. */
|
||||
if( !b )
|
||||
@@ -317,6 +322,26 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
/* Fill the output buffer with the random pattern. */
|
||||
c->prng->read( &c->prng_state, b, blocksize );
|
||||
|
||||
/* For the first block only, check the prng actually wrote something to the buffer */
|
||||
if( z == c->device_size )
|
||||
{
|
||||
idx = c->device_stat.st_blksize;
|
||||
while( idx > 0 )
|
||||
{
|
||||
if( b[idx] != 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "prng stream is active" );
|
||||
break;
|
||||
}
|
||||
idx--;
|
||||
}
|
||||
if( idx == 0 )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_FATAL, "ERROR, prng wrote nothing to the buffer" );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write the next block out to the device. */
|
||||
r = write( c->device_fd, b, blocksize );
|
||||
|
||||
@@ -382,6 +407,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
nwipe_perror( errno, __FUNCTION__, "fdatasync" );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Wrote %llu bytes on '%s'.", c->pass_done, c->device_name );
|
||||
c->fsyncdata_errors++;
|
||||
free( b );
|
||||
return -1;
|
||||
}
|
||||
@@ -411,6 +437,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
|
||||
/* FIXME: Is there a better way to handle this? */
|
||||
nwipe_perror( errno, __FUNCTION__, "fdatasync" );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name );
|
||||
c->fsyncdata_errors++;
|
||||
}
|
||||
|
||||
/* We're done. */
|
||||
@@ -505,6 +532,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
/* FIXME: Is there a better way to handle this? */
|
||||
nwipe_perror( errno, __FUNCTION__, "fdatasync" );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name );
|
||||
c->fsyncdata_errors++;
|
||||
}
|
||||
|
||||
/* Reset the file pointer. */
|
||||
@@ -799,6 +827,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
nwipe_perror( errno, __FUNCTION__, "fdatasync" );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Wrote %llu bytes on '%s'.", c->pass_done, c->device_name );
|
||||
c->fsyncdata_errors++;
|
||||
free( b );
|
||||
return -1;
|
||||
}
|
||||
@@ -825,6 +854,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
|
||||
/* FIXME: Is there a better way to handle this? */
|
||||
nwipe_perror( errno, __FUNCTION__, "fdatasync" );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "Buffer flush failure on '%s'.", c->device_name );
|
||||
c->fsyncdata_errors++;
|
||||
}
|
||||
|
||||
/* Release the output buffer. */
|
||||
|
||||
45
src/prng.c
45
src/prng.c
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
@@ -25,9 +25,9 @@
|
||||
#include "mt19937ar-cok/mt19937ar-cok.h"
|
||||
#include "isaac_rand/isaac_rand.h"
|
||||
|
||||
nwipe_prng_t nwipe_twister = {"Mersenne Twister (mt19937ar-cok)", nwipe_twister_init, nwipe_twister_read};
|
||||
nwipe_prng_t nwipe_twister = { "Mersenne Twister (mt19937ar-cok)", nwipe_twister_init, nwipe_twister_read };
|
||||
|
||||
nwipe_prng_t nwipe_isaac = {"ISAAC (rand.c 20010626)", nwipe_isaac_init, nwipe_isaac_read};
|
||||
nwipe_prng_t nwipe_isaac = { "ISAAC (rand.c 20010626)", nwipe_isaac_init, nwipe_isaac_read };
|
||||
|
||||
int nwipe_u32tobuffer( u8* buffer, u32 rand, int len )
|
||||
{
|
||||
@@ -53,6 +53,8 @@ int nwipe_u32tobuffer( u8* buffer, u32 rand, int len )
|
||||
|
||||
int nwipe_twister_init( NWIPE_PRNG_INIT_SIGNATURE )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Initialising Mersenne Twister prng" );
|
||||
|
||||
if( *state == NULL )
|
||||
{
|
||||
/* This is the first time that we have been called. */
|
||||
@@ -91,6 +93,8 @@ int nwipe_isaac_init( NWIPE_PRNG_INIT_SIGNATURE )
|
||||
int count;
|
||||
randctx* isaac_state = *state;
|
||||
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Initialising Isaac prng" );
|
||||
|
||||
if( *state == NULL )
|
||||
{
|
||||
/* This is the first time that we have been called. */
|
||||
@@ -136,18 +140,31 @@ int nwipe_isaac_init( NWIPE_PRNG_INIT_SIGNATURE )
|
||||
|
||||
int nwipe_isaac_read( NWIPE_PRNG_READ_SIGNATURE )
|
||||
{
|
||||
/* The purpose of this function is unclear, as it does not do anything except immediately return !
|
||||
* Because the variables in the macro NWIPE_PRNG_READ_SIGNATURE were then unused this throws
|
||||
* up a handful of compiler warnings, related to variables being unused. To stop the compiler warnings
|
||||
* I've simply put in a (void) var so that compiler sees the variable are supposed to be unused.
|
||||
*
|
||||
* As this code works, I thought it best not to remove this function, just in case it serves
|
||||
* some purpose or is there for future use.
|
||||
*/
|
||||
u32 i = 0;
|
||||
u32 ii;
|
||||
u32 words = count / SIZE_OF_ISAAC; // the values of isaac is strictly 4 bytes
|
||||
u32 remain = count % SIZE_OF_ISAAC; // the values of isaac is strictly 4 bytes
|
||||
|
||||
(void) state;
|
||||
(void) buffer;
|
||||
(void) count;
|
||||
randctx* isaac_state = *state;
|
||||
|
||||
/* Isaac returns 4-bytes per call, so progress by 4 bytes. */
|
||||
for( ii = 0; ii < words; ++ii )
|
||||
{
|
||||
/* get the next 32bit random number */
|
||||
isaac( isaac_state );
|
||||
|
||||
nwipe_u32tobuffer( (u8*) ( buffer + i ), isaac_state->randrsl[0], SIZE_OF_ISAAC );
|
||||
i = i + SIZE_OF_ISAAC;
|
||||
}
|
||||
|
||||
/* If there is some remainder copy only relevant number of bytes to not overflow the buffer. */
|
||||
if( remain > 0 )
|
||||
{
|
||||
/* get the next 32bit random number */
|
||||
isaac( isaac_state );
|
||||
|
||||
nwipe_u32tobuffer( (u8*) ( buffer + i ), isaac_state->randrsl[0], SIZE_OF_ISAAC );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -54,4 +54,7 @@ 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
|
||||
|
||||
/* Size of the isaac is not derived from the architecture, but it is strictly 4 bytes */
|
||||
#define SIZE_OF_ISAAC 4
|
||||
|
||||
#endif /* PRNG_H_ */
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
* used by configure to dynamically assign those values
|
||||
* to documentation files.
|
||||
*/
|
||||
const char* version_string = "0.30";
|
||||
const char* version_string = "0.32";
|
||||
const char* program_name = "nwipe";
|
||||
const char* author_name = "Martijn van Brummelen";
|
||||
const char* email_address = "git@brumit.nl";
|
||||
const char* years = "2020";
|
||||
const char* years = "2021";
|
||||
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\
|
||||
There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\
|
||||
FOR A PARTICULAR PURPOSE.\n";
|
||||
const char* banner = "nwipe 0.30";
|
||||
const char* banner = "nwipe 0.32";
|
||||
|
||||
Reference in New Issue
Block a user