317 Commits
v0.15 ... v0.28

Author SHA1 Message Date
PartialVolume
50079a15f9 Merge pull request #211 from PartialVolume/Release_0.28
Release 0.28
2020-03-11 16:48:48 +00:00
PartialVolume
cc82687cf3 Release 0.28 2020-03-11 16:44:13 +00:00
PartialVolume
82a867b569 Merge pull request #210 from martijnvanbrummelen/PartialVolume-fix_individual_throughput
Update CHANGELOG.md
2020-03-11 14:06:21 +00:00
PartialVolume
fee849b35e Update CHANGELOG.md 2020-03-11 14:03:16 +00:00
PartialVolume
09d9fc88fb Merge pull request #209 from PartialVolume/fix_individual_device_throughput
Fix individual device throughput.
2020-03-11 13:58:24 +00:00
PartialVolume
6570197de0 Fix individual device throughput.
On completion of a device wipe, the throughput was continuing
to be calculated for a completed wipe which resulted in the
throughput for that particular device to gradually drop over time
to zero if other drives were still

This has now been corrected. Throughput calculation for a given
device is stopped when the particular device has completed its wipe.
2020-03-11 13:55:44 +00:00
PartialVolume
4eef3e6ab0 Merge pull request #208 from martijnvanbrummelen/PartialVolume-update-CHANGELOG.md
Update CHANGELOG.md
2020-03-11 10:05:27 +00:00
PartialVolume
c4969e36f1 Update CHANGELOG.md
Add hyperlinks to 0.28 changes.
2020-03-11 10:04:01 +00:00
PartialVolume
c75c393e49 Merge pull request #207 from martijnvanbrummelen/PartialVolume-update-CHANGELOG.md
Update CHANGELOG.md
2020-03-10 21:16:33 +00:00
PartialVolume
53e5f4ca3a Update CHANGELOG.md 2020-03-10 21:15:30 +00:00
PartialVolume
72505f00cc Merge pull request #206 from martijnvanbrummelen/PartialVolume-Screen-responsivness-during-wipe
Update CHANGELOG.md
2020-03-10 20:36:22 +00:00
PartialVolume
f4947eb317 Update CHANGELOG.md 2020-03-10 20:34:48 +00:00
PartialVolume
5775498803 Merge pull request #205 from PartialVolume/slow_main_window_refresh_during_wipe_after_terminal_resize
Slow main window refresh during wipe after terminal resize
2020-03-10 20:29:28 +00:00
PartialVolume
85059c73c4 Format code 2020-03-10 20:25:52 +00:00
PartialVolume
cd420a079d Fix 1 second delay on screen update when terminal is resized.
During a wipe there is a approximately 1 second delay between
resizing the window and the screen fully updating. This has been
corrected so screen updates and as a consequence key response is
faster. This makes the GUI interface feel smoother and more responsive.
2020-03-10 20:21:00 +00:00
PartialVolume
e2ec6a560f Merge pull request #204 from PartialVolume/fix_overflow_warning
Fix overflow warning
2020-03-10 15:30:24 +00:00
PartialVolume
87199a1940 Clang formatting. 2020-03-10 15:23:18 +00:00
PartialVolume
88cae05301 Fix overflow warning message.
Use sizeof to determine suitable string size for the dmidecode cmd buffer
2020-03-10 15:18:25 +00:00
Martijn van Brummelen
14d285fb63 Update nwipe.1
Section should be 1 not 4
2020-03-10 10:12:33 +01:00
PartialVolume
69e27abf2b Merge pull request #201 from martijnvanbrummelen/PartialVolume-update-CHANGELOG.md
Update CHANGELOG.md
2020-03-09 14:39:29 +00:00
PartialVolume
32862d6af7 Update CHANGELOG.md 2020-03-09 14:36:18 +00:00
PartialVolume
fb00aa0243 Merge pull request #200 from PartialVolume/fix_flicker
Fix flicker
2020-03-09 14:26:51 +00:00
PartialVolume
e779265b01 Update pre-release title banner -1, update format 2020-03-09 14:20:42 +00:00
PartialVolume
aad29f14c2 This fixes screen flicker seen in the following situations:
These apply in full screen mode ONLY: i.e ALT-F2, Shredos etc.
1. When selecting a drive using up/down arrow keys
2. During a wipe the screen flashes at one second intervals.

These apply in a terminal window such as konsole, tmux etc.
1. When resizing the terminal there was a flicker.

All these problems have been fixed.

Most of the causes of the flicker was an excessive use of wrefresh() which calls
the wnoutrefresh() and doupdate() functions. This can cause flickering when a
number of calls to wrefresh happen at the same time. It is more appropriate to
replace the wrefresh() with wnoutrefresh(), then at an appropriate time call
doupate() just once. The result is that before doupdate() would have been
called multiple times and now it's called once when required.

fixes #115
2020-03-09 14:16:21 +00:00
PartialVolume
fe06f88ae2 Update CHANGELOG.md 2020-03-08 02:25:33 +00:00
PartialVolume
b3adbb3a17 Update CHANGELOG.md 2020-03-08 01:58:26 +00:00
PartialVolume
ce61974eba Merge pull request #199 from PartialVolume/fix_exit_on_terminal_resize_after_wipe_complete
Fix window/panel resizing & display when terminal resized by user
2020-03-08 01:51:07 +00:00
PartialVolume
95ab80cc68 Fix window/panel resizing & display when terminal resized by user
Also fixes an issue where program exits when terminal resized but
only after all the wipes have finished. You can now resize the
terminal, before, during and after the wipes have completed and
the windows are now all correctly updated and sized.

Updated version to 0.28-pre-release

Removed unnecessary zero of gui thread pointer.

Created six new functions in gui.c in order to fix the above problem
and reduce existing duplicated code.
2020-03-08 01:42:47 +00:00
PartialVolume
0077fcbc12 Update CHANGELOG.md 2020-03-07 01:31:18 +00:00
PartialVolume
98f4466d89 Update CHANGELOG.md 2020-03-06 14:41:21 +00:00
PartialVolume
203f6a06f5 Update CHANGELOG.md
Proposed changes in code for release in 0.28 due Summer 2020
2020-03-06 14:14:00 +00:00
PartialVolume
0eeab11af6 Merge pull request #198 from PartialVolume/master
Release 0.27
2020-03-03 20:54:49 +00:00
PartialVolume
97e5591fd5 Release 0.27 2020-03-03 20:38:47 +00:00
PartialVolume
5f1aafed2f Merge pull request #194 from louib/using_git_exit_code
Using git-diff --exit-code for diff details.
2020-02-08 17:22:33 +00:00
louib
6822c463eb Using git-diff --exit-code for diff details. 2020-02-08 12:07:19 -05:00
PartialVolume
6d797b742c Update CHANGELOG.md 2020-01-21 23:29:01 +00:00
PartialVolume
5c60dce0c5 Update CHANGELOG.md 2020-01-21 23:25:33 +00:00
PartialVolume
49b35aef8a Merge pull request #192 from louib/normalize_workflow_names
Normalizing workflow names.
2020-01-13 09:49:05 +00:00
louib
a3a056ce75 Normalizing workflow names. 2020-01-13 01:22:36 -05:00
PartialVolume
ead9a78453 Merge pull request #189 from louib/format_doc
code formatting developer doc.
2020-01-12 21:37:12 +00:00
PartialVolume
bebae43b3b Merge pull request #190 from louib/fix_device_label_printing
Prefixing device fields with `_device`.
2020-01-12 21:36:56 +00:00
louib
49aa14a490 Prefixing device fields with _device.
Also added a `device_label` field to centralize
the creation of the device label. This fixes the
labels for devices without a serial number, and
makes sure we have the same label format everywhere.
2020-01-12 14:24:32 -05:00
louib
3aca56eded code formatting developer doc. 2020-01-12 13:02:36 -05:00
PartialVolume
b26bb839ef Merge pull request #188 from PartialVolume/fix_is5_percentage
Fix percentage calculation for IS5 only
2020-01-12 10:25:32 +00:00
PartialVolume
0a53ec9c42 Fix percentage calculation for IS5 only 2020-01-12 10:20:17 +00:00
PartialVolume
df07393f9d Merge pull request #187 from louib/project_layout
Creating subdirs for third-party modules.
2020-01-11 00:40:17 +00:00
louib
af0fdadc88 Creating subdirs for third-party modules.
Since these modules are considered third-party (at
least for now) and we also don't want to apply
formatting to them.

Also removed the `AUTOMAKE_OPTIONS` from `Makefile.am` since
it would appear the `AM_INIT_AUTOMAKE` is actually defining
the automake options.
2020-01-10 18:08:07 -05:00
PartialVolume
8384142f58 Merge pull request #186 from louib/formatting_pass_9
Formatting gui module.
2020-01-09 23:28:59 +00:00
louib
4071e5f66a Formatting gui module. 2020-01-07 20:05:16 -05:00
PartialVolume
3089a78f72 Merge pull request #185 from louib/formatting_pass_8
Formatting pass 8
2020-01-07 09:25:36 +00:00
louib
6b7186f7ed Formatting logging module. 2020-01-06 20:40:26 -05:00
louib
6ca41a899f Enabling formatting. 2020-01-06 20:25:36 -05:00
PartialVolume
35bcc518b5 Merge pull request #184 from louib/formatting_pass_7
Formatting prng module.
2020-01-06 11:01:07 +00:00
louib
7af9c90e3a Formatting prng module. 2020-01-05 20:45:26 -05:00
PartialVolume
b53a4b58db Merge pull request #183 from louib/formatting_pass_6
Formatting pass module.
2020-01-06 00:53:42 +00:00
louib
851735c1f0 Formatting pass module. 2020-01-05 19:11:24 -05:00
PartialVolume
79dee9cb79 Merge pull request #180 from louib/formatting_pass_5
Formatting device module.
2020-01-05 23:40:51 +00:00
PartialVolume
756db3e0e1 Merge pull request #182 from PartialVolume/fix_zero_fill
Fix zero fill so it works with rounds and is consistent with other methods in terms of pattern creation.
2020-01-05 23:20:33 +00:00
PartialVolume
0037c46860 Check & correct style
clang-format -i -style=file src/method.c
2020-01-05 23:12:41 +00:00
PartialVolume
7d416911d2 Fix zero fill so it works with rounds
Also so that verify and blanking are consistant with other methods.
Fixes percentage calculation for rounds greater than one for the zero fill method.
2020-01-05 23:08:36 +00:00
louib
a5a3f3b9a3 Formatting device module. 2020-01-05 16:29:27 -05:00
PartialVolume
1be4e99a29 Merge pull request #179 from PartialVolume/fix_percentage_calculation_for_rounds_greater_than_one
Fix percentage calculation for rounds greater than one
2020-01-05 21:24:12 +00:00
PartialVolume
d39427ae86 clang-format -i -style=file src/method.c
Check & correct style.
2020-01-05 21:21:05 +00:00
PartialVolume
0b6ce3182d Fix percentage calculation when rounds > 1
Update comment.
2020-01-05 21:10:50 +00:00
PartialVolume
5f01b660bd Merge pull request #177 from louib/formatting_pass_4
Formatting context.h
2020-01-05 19:26:32 +00:00
PartialVolume
10f2678c10 Merge branch 'master' into formatting_pass_4 2020-01-05 19:23:50 +00:00
PartialVolume
3c4a536eeb Merge pull request #171 from louib/formatting_pass_3
formatting method and version module.
2020-01-05 19:17:53 +00:00
louib
bc8cfeb478 formatting method and version module. 2020-01-05 13:10:26 -05:00
PartialVolume
cb4d411b05 Merge pull request #178 from PartialVolume/fix_percentage_for_zero_fill
Fix percentage complete calculation for all methods
2020-01-05 03:33:33 +00:00
PartialVolume
3bcc544610 Fix percentage complete calculation.
Also fixes OPSII method.
Place round_size calculation in the function calculate_round_size()
2020-01-05 03:28:28 +00:00
louib
92c7d99714 Formatting context.h 2020-01-04 12:38:41 -05:00
PartialVolume
c952939dff Merge pull request #175 from PartialVolume/show_percentage_on_completion
Show percentage completed, on completion of wipe.
2019-12-30 18:21:34 +00:00
PartialVolume
e5a0f85d56 Show percentage completed, on completion of wipe.
Rather than delete percentage complete, show it. Because we were hiding
percentage complete we were not aware of inaccuracies in the percentage
calculation that are introduced when you toggle blanking and
verification on various methods.
2019-12-30 18:18:15 +00:00
PartialVolume
f69aff33a4 Merge pull request #169 from louib/formatting_fixes
Small formatting fix.
2019-12-29 21:30:04 +00:00
louib
d19dc05793 Small formatting fix. 2019-12-29 16:19:17 -05:00
PartialVolume
7a87bafc0f Merge pull request #168 from infrastation/master
add HMG IS5 enhanced and make minor fixups
2019-12-29 20:55:57 +00:00
PartialVolume
615c2ee035 Merge branch 'master' into master 2019-12-29 20:47:14 +00:00
PartialVolume
559bc3db56 Merge pull request #167 from louib/formatting_pass_2
Formatting pass 2
2019-12-29 20:17:20 +00:00
Denis Ovsienko
04fe9f217e add an initial implementation of HMG IS5 enhanced
I could not find the original specification of this standard, although
many proprietary implementations exist (or claim to exist). Also there
are many 3rd-party descriptions of the method, which often differ in one
or another detail, but after some reading I could conclude that the most
likely definition should be as follows:

1. Fill the device with zeroes, do not verify.
2. Fill the device with ones, do not verify.
3. Fill the device with a PRNG stream, do verify.

In other words, this is a simplified version of nwipe's "dodshort".
2019-12-28 22:41:32 +00:00
Denis Ovsienko
ead64479f4 remove duplicate "h" from nwipe_options_short[] 2019-12-28 22:09:50 +00:00
Denis Ovsienko
e2c9d030de fixup list formatting for --verify in the man page 2019-12-28 22:09:50 +00:00
Denis Ovsienko
f866d84e3d fixup descriptions of --noblank
Both display_help() and nwipe_options_parse() are consistent about the
--noblank option, in that it exists and has no short form. Make the man
page and nwipe_gui_noblank() indicate that correctly. Mention that "ops2"
never blanks the device regardless of the option.
2019-12-28 22:09:50 +00:00
Denis Ovsienko
97c736e630 fixup a comment in method.c 2019-12-28 22:09:50 +00:00
Denis Ovsienko
c3679f9d3b fixup PRNG names in README.md 2019-12-28 22:09:50 +00:00
louib
e180154320 Update else styling. 2019-12-28 13:21:42 -05:00
louib
ff357298bd Activate CI on pull requests. 2019-12-28 13:18:41 -05:00
louib
cd0d9e028b Activate temp code format checks. 2019-12-28 13:15:02 -05:00
louib
25116c2046 Formatting options module. 2019-12-28 13:11:47 -05:00
PartialVolume
d5fe1c096a Merge pull request #164 from louib/formatting_pass_1
Formatting pass 1
2019-12-28 17:50:15 +00:00
louib
254ef3236e Rename sources variable in makefile. 2019-12-28 12:28:19 -05:00
PartialVolume
719bfa66f6 Merge pull request #166 from louib/update_zero_fill_doc
Updated zero-fill documentation.
2019-12-27 19:57:48 +00:00
louib
a384bd75fd Updated zero-fill documentation. 2019-12-27 13:55:16 -05:00
PartialVolume
ddc4f9eaa2 Merge pull request #165 from louib/rename_quick_erase
Rename Quick Erase for Zero Fill
2019-12-27 18:26:11 +00:00
louib
f212192155 Rename Quick Erase for Zero Fill 2019-12-27 12:21:20 -05:00
louib
494d269936 Formatting nwipe.c and nwipe.h 2019-12-26 14:04:38 -05:00
louib
f1baadb4de Setup code formatting with make. 2019-12-26 14:00:17 -05:00
PartialVolume
8e196eb830 Merge pull request #163 from louib/help_typos
Fixed typos in help message.
2019-12-23 22:56:49 +00:00
louib
d8749ab9da Fixed typos in help message. 2019-12-23 17:35:42 -05:00
PartialVolume
89598f3de9 Merge pull request #159 from PartialVolume/fix_missing_log_messages_when_wipe_selected_then_CNTRL-C_abort
Fix missing log lines
2019-12-15 18:22:14 +00:00
PartialVolume
8bb3f9ff14 Fix missing log lines
Change code so that there is only one place where the log is flushed on
exit from the ncurses gui. Prior to this patch the flush was done twice
which resulted in duplicated lines and missing lines. The
log_current_element variable was being initialised after the first flush.
This caused subsequent writes to nwipe to write log_lines pointers passed
the end of the pointer array causing memory corruption and resulting in the
occassional segfault on attempts to print the log array.
2019-12-15 18:14:27 +00:00
PartialVolume
8d02bfe6f8 Merge pull request #157 from PartialVolume/fix_segfault_and_missing_log_lines
Fix segfault & missing log lines
2019-12-10 23:32:16 +00:00
PartialVolume
a215aa14fa Fix segfault & missing log lines
This patch fixes a segfault that occurs when a logfile is specified.
The segfault occurred on exit of nwipe. It did not affect the wipe
process.

This patch also fixes a related issue, at the end of a wipe some
of the log lines were missing on stdout, this occurred when a log
file was not specified as an option.
2019-12-10 23:29:42 +00:00
PartialVolume
1091a5291f Merge pull request #155 from PartialVolume/fix_implicit_declaration_of_fdatasync
Fixes warning "Implicit declaration of function 'fdatasync' is invalid in C99"
2019-12-08 22:37:53 +00:00
PartialVolume
4666f17930 Fixes Implicit declaration of function 'fdatasync' is invalid in C99 2019-12-08 22:26:09 +00:00
PartialVolume
c7a565dbc8 Merge pull request #153 from martijnvanbrummelen/PartialVolume-patch_add_apt-get_update_to-ci_update-16.04.yml-1
Update ci_update-16.04.yml
2019-12-08 11:57:13 +00:00
PartialVolume
f1f1002207 Update ci_update-16.04.yml
As I did with ci.yml (ubuntu-latest) use apt-get update prior to installing system dependencies else CI will fail with missing dependencies when upstream versions change.
2019-12-08 11:56:11 +00:00
PartialVolume
dd9e97ec52 Merge pull request #152 from PartialVolume/gui_status_function_uses_too_much_CPU
Runtime statistics uses too much CPU
2019-12-08 11:46:39 +00:00
PartialVolume
11a0c2de6b Runtime statistics uses too much CPU
During testing a single drive two cores consistently run at close to 100%,
one core at 100% and the other varying between 80-100%. This shouldn't be
the case. Although there would be two threads running, i.e. the gui status
thread and the disk drives wipe thread I would have expected the amount of
CPU required to calculate the on screen stats to be insignificant as they
are only updated once a second.

To reduce the gui stats thread to near zero% while still maintaining the
stats update at one second I inserted an nanosleep interval of 100ms. This
now means that only the one core now shows at 80-100% while all other cores
are close to zero.
2019-12-08 11:40:14 +00:00
PartialVolume
68c3cfe5ca Delete example_wipe.png
No longer required.
2019-12-05 00:05:50 +00:00
PartialVolume
1717958843 Add animated gif 2019-12-05 00:02:29 +00:00
PartialVolume
01648108a0 Update README.md with animated gif
Example in animated gif format.
2019-12-04 23:59:49 +00:00
PartialVolume
b102bee6fa Update version.c
Make the change in both version strings.
2019-12-04 22:09:12 +00:00
PartialVolume
551836e092 Update version.c with release candidate versioning
To avoid confusion, the master code should have the version number in the title bar. The version number shown in the master should be the version number of the next (unreleased version) followed by the suffix rc1. As an example, the current official released version is 0.26 so in the master title bar the version should be 0.27rc1, i.e. the release candidate for the proposed release 0.27.
2019-12-04 22:07:59 +00:00
PartialVolume
4dc84a727c Update version.c, Simplify the title text 2019-12-04 21:50:48 +00:00
PartialVolume
3c55dda2f4 Update README.md, two methods
run from src folder or installed copy
2019-12-03 23:01:30 +00:00
PartialVolume
52bcea8ee1 Update README.md with info on running 2019-12-03 22:55:50 +00:00
PartialVolume
0e15c16cac Update README.md, multiple disk wipe info 2019-12-03 22:18:10 +00:00
PartialVolume
01bc6b92b7 Less bright border ! 2019-12-03 21:55:22 +00:00
PartialVolume
6858e42fcf Update README.md with usage info.
i.e. command line or GUI.
2019-12-03 21:49:02 +00:00
PartialVolume
70b7497734 Add border to image 2019-12-03 21:41:03 +00:00
PartialVolume
178bc558fa Add an example of nwipe in GUI mode 2019-12-03 21:40:27 +00:00
PartialVolume
c0dc1e9ff7 Add example of how nwipe looks during a wipe 2019-12-03 21:33:42 +00:00
PartialVolume
bc5bfb73a7 Create example_wipe.png 2019-12-03 21:26:47 +00:00
PartialVolume
e37ccd4fdb Update readme.md URLs to Parted Magic and Shredos 2019-12-03 20:50:12 +00:00
PartialVolume
48c01f7cfa Update readme with wipe methods 2019-12-03 20:40:45 +00:00
PartialVolume
5004c15481 Merge pull request #144 from PartialVolume/add_error_checking_code_tidy_up
Add error checking code to pthread_mutex_lock functions
2019-12-01 22:26:07 +00:00
PartialVolume
3110267373 Add error checking code to pthread_mutex_lock functions
Move flush of logs into final cleanup function
Minor alteration to one or two error messages
2019-12-01 22:22:47 +00:00
PartialVolume
82e4d1b2ea Merge pull request #136 from louib/backspace_as_return
Update footers for key commands.
2019-11-30 23:14:55 +00:00
PartialVolume
a16a67d84e Merge pull request #143 from martijnvanbrummelen/PartialVolume-patch-1
Update ci.yml with apt-get update
2019-11-30 19:56:41 +00:00
PartialVolume
881ddcf0cb Update ci.yml 2019-11-30 19:49:40 +00:00
PartialVolume
1360196be2 Merge pull request #142 from martijnvanbrummelen/PartialVolume-patch-2
Update Readme with CI workflow ubuntu.16.04 badge
2019-11-30 17:55:33 +00:00
PartialVolume
91dfc37574 Update Readme with CI workflow ubuntu.16.04 badge 2019-11-30 17:54:49 +00:00
PartialVolume
675dd694a3 Rename ci_ubuntu-16.04 to ci_ubuntu-16.04.yml 2019-11-30 17:50:56 +00:00
PartialVolume
3ab826f11d Merge pull request #141 from martijnvanbrummelen/PartialVolume-patch-1
Create ci_ubuntu-16.04
2019-11-30 17:48:06 +00:00
PartialVolume
2cd8fce66a Create ci_ubuntu-16.04
Add workflow for ubuntu 16.04 test
2019-11-30 17:47:25 +00:00
PartialVolume
649cc09da0 Merge pull request #140 from martijnvanbrummelen/PartialVolume-patch-1
warning: logical 'or' of collectively exhaustive tests is always true
2019-11-30 17:20:25 +00:00
PartialVolume
c064a66115 warning: logical 'or' of collectively exhaustive tests is always true
If using || in the while statement and if 'MAX_DRIVE_PATH_LENGTH' was exceeded the while loop would loop indefinitely.
2019-11-30 17:07:14 +00:00
PartialVolume
000ebe6deb Merge pull request #137 from louib/exit_invalid_option
Exit on invalid long option.
2019-11-24 17:11:13 +00:00
PartialVolume
8a7ca91da6 Update URL with correct workflow name
i.e underscores
2019-11-24 17:00:52 +00:00
PartialVolume
404962e6fc Update README.md
Update URL to badge for new workflow name
2019-11-24 16:57:09 +00:00
PartialVolume
f96f17b0a6 Update ci.yml
Maybe better to use ubuntu-latest so we don't need to update every so often.
2019-11-24 16:51:15 +00:00
louib
d3ddd8d2ac Exit on invalid long option. 2019-11-24 11:14:28 -05:00
louib
974f323857 Update footers for key commands.
Update the footers for the commands available in each
screen. Also added the possibility to cancel from the
rounds screen. It was possible to cancel with backspace
from the other screens (method prng etc) but this was not
displayed in the footers. Added the `Ctrl-C` command
to all the footers since this is a global command.
Added the `Left` command to the rounds screen, since it
was implemented but not documented.
Also made sure the Ctrl-C was placed at the end on every
footer.
2019-11-24 10:52:22 -05:00
PartialVolume
4f6354919b Merge pull request #135 from louib/github-ci
Adding GitHub CI build process.
2019-11-24 08:25:39 +00:00
louib
2a7d07676b Adding CI badge 2019-11-23 21:31:45 -05:00
louib
06aecbb8f8 Adding GitHub CI build process. 2019-11-19 19:00:49 -05:00
PartialVolume
353a577282 Merge pull request #133 from louib/glibc_deprecated_warnings
Suppress warnings from glibc macros.
2019-11-19 12:44:10 +00:00
louib
5bf579d5b2 Suppress warnings from glibc macros. 2019-11-16 18:25:34 -05:00
PartialVolume
607a244bbf Make it clear 0.27 is a pending release 2019-11-14 11:32:56 +00:00
PartialVolume
d770f219b9 Merge pull request #132 from PartialVolume/fix_segfault_on_CNTRL-C_at_end_wipe_take3
Fix segfault on control c at end wipe
2019-11-14 01:27:33 +00:00
PartialVolume
1090ac5d83 Merge branch 'master' into fix_segfault_on_CNTRL-C_at_end_wipe_take3 2019-11-14 01:26:20 +00:00
PartialVolume
4241485e6a Fix segfault on Control-C, after a successful wipe
Symptoms: If you control-C to exit nwipe at the end of a successful
wipe you would get a segmentation fault. If nwipe log data was being
sent to stdout rather than to a log file, then you would not see the
log in the terminal windows after nwipe had exited. This patch fixes
those problems by creating a tri-state wipe flag for each wipe
thread. The main thread after having launched the wipe threads
will wait for ALL wipe flags to report that the wipe routine has
completed and the thread has exited. Only at that time does the
main() routine then proceed with joining the threads and waiting
for the join to confirm the thread has indeed exited. This join
is important as the thread will not actually exit until the OS
has flushed the disk buffers. Currently nwipe does not use O_SYNC
where data is sent straight to disk. Therefore it's important
to wait for data to be flushed before exiting nwipe. Part of this
patch is introducing a "please wait .. disks are being flushed"
prior to exiting nwipe otherwise it might look like nwipe had
hung. A disk flush in terms of how long it takes, can be from
instantly to 30 seconds or more, depending on how much system
memory you have, when the last sync occurred and if you have
changed the sync option from it's default. Something else to
note is that when all wipes have finished nwipe displays "Enter
To Exit" on the status line at the bottom of the screen. I
believe typing 'enter' rather than control-c did not produce a
segmentation fault. Irrespective, both methods of exiting nwipe
have been tested and confirmed to now work correctly. Tested
overnight with two drives using multiple wipe methods,
verification and blanking.
2019-11-14 01:07:08 +00:00
PartialVolume
dd3828008d Add notification of cache flush on CNTRL-C exit 2019-11-14 01:07:08 +00:00
PartialVolume
4f72927146 Merge pull request #130 from louib/verify_option_documentation
Add documentation for verify
2019-11-14 00:03:51 +00:00
louib
a5715eeca4 Add documentation for verify 2019-11-13 18:35:12 -05:00
PartialVolume
214ff8fb7a Merge pull request #128 from Legogizmo/Verify_Method
Added Verify Method
2019-11-13 23:03:51 +00:00
Legogizmo
94a9437166 Fixed the Error count issue 2019-11-13 14:30:20 -06:00
Legogizmo
a216fa2c24 Added Verify Method
and fixed other bugs.
2019-11-13 10:59:44 -06:00
PartialVolume
08d61dc9f1 Merge pull request #124 from PartialVolume/fix_control-C_segfault_after_successful_wipe
Fix segfault on Control-C, after a successful wipe
2019-11-11 12:54:59 +00:00
PartialVolume
f6cf615a12 Fix segfault on Control-C, after a successful wipe
Symptoms: If you control-C to exit nwipe at the end of a successful
wipe you would get a segmentation fault. If nwipe log data was being
sent to stdout rather than to a log file, then you would not see the
log in the terminal windows after nwipe had exited. This patch fixes
those problems by creating a tri-state wipe flag for each wipe
thread. The main thread after having launched the wipe threads
will wait for ALL wipe flags to report that the wipe routine has
completed and the thread has exited. Only at that time does the
main() routine then proceed with joining the threads and waiting
for the join to confirm the thread has indeed exited. This join
is important as the thread will not actually exit until the OS
has flushed the disk buffers. Currently nwipe does not use O_SYNC
where data is sent straight to disk. Therefore it's important
to wait for data to be flushed before exiting nwipe. Part of this
patch is introducing a "please wait .. disks are being flushed"
prior to exiting nwipe otherwise it might look like nwipe had
hung. A disk flush in terms of how long it takes, can be from
instantly to 30 seconds or more, depending on how much system
memory you have, when the last sync occurred and if you have
changed the sync option from it's default. Something else to
note is that when all wipes have finished nwipe displays "Enter
To Exit" on the status line at the bottom of the screen. I
believe typing 'enter' rather than control-c did not produce a
segmentation fault. Irrespective, both methods of exiting nwipe
have been tested and confirmed to now work correctly. Tested
overnight with two drives using multiple wipe methods,
verification and blanking.
2019-11-11 12:34:28 +00:00
PartialVolume
df36255e06 Merge pull request #123 from PartialVolume/add_notification_of_cache_flush
Add notification of cache flush on CNTRL-C exit
2019-11-10 11:55:12 +00:00
PartialVolume
602cdcaa58 Add notification of cache flush on CNTRL-C exit 2019-11-10 11:42:26 +00:00
PartialVolume
95b30f6286 Merge pull request #122 from PartialVolume/update_README.md_with_dmidecode
Add dmidecode as an optional package to README.md
2019-11-09 21:10:14 +00:00
PartialVolume
b4d82ec19b Add dmidecode as an optional package to README.md 2019-11-09 21:06:08 +00:00
PartialVolume
d968225417 Merge pull request #121 from louib/cleanup_top_level_doc
Cleanup top-level documentation
2019-11-09 20:23:28 +00:00
louib
46f8cc352d Cleanup top-level documentation
Moved most of the documentation from `README` to
`README.md`, and added MarkDown formatting when
required. Also move the release notes to a
`CHANGELOG.md`, and made sure the formatting
was consistent.
2019-11-09 10:39:22 -05:00
PartialVolume
42e58bbd22 Merge pull request #120 from louib/clang_format_dont_sort_includes
Do not sort includes on clang-format
2019-11-08 22:35:39 +00:00
louib
10028b6f95 Do not sort includes on clang-format 2019-11-08 17:06:52 -05:00
PartialVolume
7d70fa5dc5 Merge pull request #119 from PartialVolume/fix_header_order
Fix order of include files in options.c
2019-11-08 18:02:03 +00:00
PartialVolume
53b1c6ba62 Fix order of include files in options.c
After running clang on options.c the includes were reordered. This caused the compilation to fail with multiple errors.
2019-11-08 18:00:24 +00:00
PartialVolume
88ce0b7494 Merge pull request #105 from Legogizmo/SyncChanges
Sync changes
2019-11-08 13:21:31 +00:00
PartialVolume
2a056b7bfa Changed sync from 0 (at end) to every 1000000 blks
Instead of defaulting to only calling fdatasync at the end of a wipe, it now defaults to calling fdatasync every 1000000 blocks. This shows a unresponsive drive far quicker and also allows wipe threads to complete and be cancelled within a couple of seconds if a wipe is aborted with control-c.
2019-11-08 13:18:50 +00:00
Legogizmo
f9f0ec605c Merge branch 'master' into SyncChanges 2019-11-07 14:09:07 -06:00
PartialVolume
9331061cbf Merge pull request #112 from louib/clang_format
First clang-format file version.
2019-11-07 19:47:01 +00:00
PartialVolume
2402ca0602 Merge branch 'master' into clang_format 2019-11-07 19:33:32 +00:00
Legogizmo
7db0bd733e Merge branch 'master' into SyncChanges 2019-11-07 11:22:43 -06:00
PartialVolume
128dfb3a4e Merge pull request #116 from PartialVolume/fix_drive_parsing_and_success_status
Fix drive parsing and success status
2019-11-06 20:23:32 +00:00
PartialVolume
5199fb1793 Fix wipe status saying Success when it never even started.
Capitalise success and failure messages in GUI and log to make them stand out
2019-11-06 20:03:39 +00:00
PartialVolume
f6c1cab28a Have nwipe continue with following devices even if one fails 2019-11-06 14:13:33 +00:00
PartialVolume
4b9ae33171 Merge pull request #114 from PartialVolume/limit_help_line_length_to_80_characters
Limit help text line length to 80 characters
2019-11-05 23:32:01 +00:00
PartialVolume
d04ae940b6 Limit help text line length to 80 characters
1. When running nwipe in a 80x24 terminal such as ALT-F2 or shredos the line length needs to limited to 80 characters otherwise the text looks misaligned.
2. Added a line between each option to make it more legible.
2019-11-05 22:56:58 +00:00
PartialVolume
74c05fe290 Merge pull request #113 from PartialVolume/fix_dmidecode_error_reporting
Fix error reporting when accessing dmidecode.
2019-11-04 22:48:02 +00:00
PartialVolume
766d8020c6 Fix error reporting when accessing dmidecode.
This fix allows nwipe to log an error, specifically the exit code of dmidecode if the exit code
is not 0.

For instance if dmidecode is not installed on a system, then dmidecode reports the following
[2019/11/04 22:12:50] nwipe: info: nwipe_log_sysinfo: dmidecode failed, "dmidecode -s bios-version" exit status = 127

nwipe does not abort on this error but does log the error and continue.
2019-11-04 22:39:20 +00:00
louib
76f097c272 First clang-format file version. 2019-11-03 11:38:41 -05:00
PartialVolume
5e2d55ba7f Merge pull request #110 from louib/ac_deprecated_init
Fix AutoConf deprecated warning
2019-11-03 01:10:19 +00:00
louib
7c025040b4 Fix AutoConf deprecated warning
This fixes the following AC warning:
```
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:6: https://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
```

As per the deprecation notice, using `AM_INIT_AUTOMAKE` for setting the
version is mostly obsolete because the package and version can be obtained
from Autoconf’s `AC_INIT` macro.
2019-11-02 19:24:25 -04:00
PartialVolume
661785294c Merge pull request #109 from louib/documentation
Fix typos in README and comments.
2019-11-02 22:51:07 +00:00
louib
7b1a5b98a7 Fix typos in README and comments. 2019-11-02 18:33:36 -04:00
Legogizmo
e1475d70ff Update context.h 2019-10-21 11:21:15 -05:00
Legogizmo
a75c29f973 Changed how often fdatasyncs occur.
Changed what the sync option does.
Stopped nwipe from changing the disk blocksize.
Added periodic fdatasyncs within the write loops in pass.c
2019-10-21 11:16:19 -05:00
Martijn van Brummelen
721c8de743 Merge pull request #100 from PartialVolume/add_exclude_drive_to_man_page
Add details of exclude drive option to man page
2019-09-13 09:29:00 +02:00
PartialVolume
4acad452ae Add details of exclude drive option to man page 2019-09-10 22:38:56 +01:00
Martijn van Brummelen
37dfb1a2b6 new release 0.26 2019-09-04 08:51:37 +02:00
Martijn van Brummelen
55783c0b8d Update configure.ac 2019-09-04 08:21:10 +02:00
Martijn van Brummelen
52d0508b23 Update nwipe.1 2019-09-04 08:20:37 +02:00
Martijn van Brummelen
d2a66e0047 Merge pull request #99 from PartialVolume/log_system_info
Log system's hardware as described in the system BIOS according to th…
2019-09-04 08:18:47 +02:00
Martijn van Brummelen
11ed6b1472 Merge pull request #71 from PartialVolume/exclude-drive-181116
Enhancement: Add exclude drive option
2019-09-04 08:18:32 +02:00
PartialVolume
0fec3a1213 Log system's hardware as described in the system BIOS according to the SMBIOS/DMI standard.
Uses dmidecode with search keywords arguments. dmidecode -s to see available keywords.
2019-08-31 09:55:08 +01:00
Martijn van Brummelen
b341d1dab0 Merge pull request #93 from PartialVolume/Fedora_package_update_to_readme
Update readme with Fedora package requirements
2018-11-28 12:26:24 +01:00
Nick Law
c92a87860d Update readme with Fedora package requirements 2018-11-28 11:08:03 +00:00
Martijn van Brummelen
545491940e Merge pull request #92 from PartialVolume/update_readme_and_readme.md
Update Readme with package requirements
2018-11-28 08:43:39 +01:00
Nick Law
cd16c2e86b Update Readme with package requirements 2018-11-27 21:56:14 +00:00
Martijn van Brummelen
00469644d8 Merge pull request #89 from PartialVolume/Fix_segfault_that_shows_up_in_Fedora32bit_on_exit
Fix segfault on immediate CNTRL-C exit, shows in Fedora32 bit
2018-11-27 10:08:09 +01:00
Martijn van Brummelen
ac680b4225 Merge pull request #90 from PartialVolume/Update_Fedora_workaround
Update Fedora workaround
2018-11-27 10:07:38 +01:00
Nick Law
c58ab04ff6 Update Fedora workaround 2018-11-25 23:55:11 +00:00
Nick Law
bb91f093a3 Fix segfault on immediate CNTRL-C exit, shows in Fedora32 bit 2018-11-25 21:53:21 +00:00
Martijn van Brummelen
025a02e87c Merge pull request #86 from PartialVolume/netinet_header_removal
Use stdint.h, ncurses.h and panel.h instead of netinet/in.h
2018-11-25 20:53:24 +01:00
Martijn van Brummelen
68cad1b640 Merge pull request #84 from PartialVolume/va_list_ap_was_opened_but_not_closed_by_va_end
Close va_list 'ap' using (va_end( ap ) on failures
2018-11-25 20:52:47 +01:00
Martijn van Brummelen
54f643559f Merge pull request #83 from PartialVolume/warning_variable_wy_set_but_not_used_in_nwipe_gui_title
(void) unused wy, to silence compiler warning
2018-11-25 20:52:16 +01:00
Nick Law
cd3716f260 Use stdint.h, ncurses.h and panel.h instead of netinet/in.h 2018-11-24 23:32:20 +00:00
Nick Law
43172a9741 Close va_list 'ap' using (va_end( ap ) on failures 2018-11-24 13:29:11 +00:00
Nick Law
10221fb2a9 (void) unused wy, to silence compiler warning 2018-11-23 21:09:24 +00:00
Martijn van Brummelen
9b821292ea Merge pull request #82 from PartialVolume/Unused_variables_in_NWIPE_PRNG_READ_SIGNATURE_in_prng.c
(void) unused variables in func.nwipe_isaac_read()
2018-11-23 19:45:22 +01:00
Nick Law
6b350a2348 (void) unused variables in func.nwipe_isaac_read() 2018-11-23 17:13:14 +00:00
Martijn van Brummelen
6ec7826692 Merge pull request #80 from PartialVolume/nwipe.h_is_not_guarded_against_multiple_inclusions
Put Function prototypes inside #ifndef/#define/#endif macro guard
2018-11-23 16:20:51 +01:00
Nick Law
00e9350dd6 Put Function prototypes inside #ifndef/#define/#endif macro guard 2018-11-23 12:56:20 +00:00
Martijn van Brummelen
c46e0c8ba4 Merge pull request #79 from PartialVolume/deallocate_memory_used_by_logging.c
De-allocate memory used by the log functions
2018-11-23 10:38:38 +01:00
Nick Law
af1b470456 De-allocate memory used by the log functions 2018-11-22 20:33:47 +00:00
Martijn van Brummelen
ae51d548d4 Merge pull request #78 from PartialVolume/reduce_log_allocation_memory_requirements
Fix log message buffer overflow & reduce memory requirements.
2018-11-22 07:06:29 +01:00
Nick Law
5f712f3b0c Fix log message buffer overflow, reduce memory requirements. 2018-11-22 02:01:11 +00:00
Martijn van Brummelen
99778f187d Merge pull request #76 from PartialVolume/return_status_of_malloc_not_checked
Malloc return status not checked in nwipe_log()
2018-11-21 18:21:25 +01:00
Nick Law
528bb9fd6a Malloc return status not checked in nwipe_log() 2018-11-21 17:14:29 +00:00
Martijn van Brummelen
08215f3fb2 Merge pull request #72 from PartialVolume/common_realloc_mistake_causing_memory_leak
Common realloc mistake: nulled but not freed
2018-11-21 07:31:49 +01:00
Nick Law
f20e7c6b74 Common realloc mistake: nulled but not freed 2018-11-21 00:27:12 +00:00
Nick Law
27bb409efa Enhancement: Add exclude drive option 2018-11-20 16:03:32 +00:00
Martijn van Brummelen
cfd75a918c Merge pull request #68 from PartialVolume/Fixes_implicit_declaration_of_function_fileno
Fixes implicit declaration of function fileno()
2018-11-20 16:15:33 +01:00
Martijn van Brummelen
f56977930a Merge pull request #70 from PartialVolume/memory_leak_b_in_pass.c
Memory leak:b in pass.c
2018-11-20 16:14:58 +01:00
Nick Law
fa0d72cbaf Memory leak:b in pass.c 2018-11-20 14:14:29 +00:00
Nick Law
42a114abc0 Fixes implicit declaration of function fileno() 2018-11-19 23:38:12 +00:00
Martijn van Brummelen
58d4733273 Merge pull request #65 from PartialVolume/Fixes-uninitialized-variable-warning
Fix uninitialized variable 'keystroke' in nwipe_gui_verify()
2018-11-17 11:23:03 +01:00
Martijn van Brummelen
fe4fdaee93 Merge pull request #66 from PartialVolume/Fixes-uninitialized-variable-keystroke-in-nwipe-gui-prng
Fixes uninitialized variable 'keystroke' in nwipe_gui_prng
2018-11-17 11:21:58 +01:00
Nick Law
157797c1ca Fixes uninitialized variable 'keystroke' in nwipe_gui_prng 2018-11-16 22:35:52 +00:00
Nick Law
396896e16c Fix uninitialized variable 'keystroke' in nwipe_gui_verify() 2018-11-16 22:16:17 +00:00
Martijn van Brummelen
5cb6003fc0 Fixes spurious character at the end of serial no string. 2018-11-16 22:35:32 +01:00
Martijn van Brummelen
b2bee8ac83 Fixes uninitialized variable warning 2018-11-16 22:20:48 +01:00
Martijn van Brummelen
4606834286 Variable 'keystroke' is used uninitialized 2018-11-16 21:27:42 +01:00
Martijn van Brummelen
ed5ca0fce7 Merge pull request #64 from PartialVolume/Fix-serial-numbers-for-ATA-SCSI-devices
Fix non display of serial numbers for ATA/SCSI devices
2018-11-16 21:14:49 +01:00
Nick Law
9c69bc0e1a Fix non display of serial numbers for ATA/SCSI devices 2018-11-16 11:13:49 +00:00
Martijn van Brummelen
a049c871b6 Merge pull request #63 from PartialVolume/NL-patch-1-pointer-d-undeclared
Pointer d undeclared
2018-11-13 11:46:02 +01:00
Nick Law
f960da3f4a Pointer d undeclared
The statment free(d), should not be in nwipe_random_pass().
2018-11-03 09:47:43 +00:00
Martijn van Brummelen
81850bde42 Fixes uninitialized variable 2018-10-05 23:23:16 +02:00
Martijn van Brummelen
e92ac3a870 fix cast/serial number 2018-10-05 23:11:30 +02:00
Martijn van Brummelen
0ecc90786d fix cast 2018-10-05 23:07:06 +02:00
Martijn van Brummelen
5912d0f57a check right pointer 2018-10-05 23:02:19 +02:00
Martijn van Brummelen
e16da663a1 fix more memory leaks 2018-10-05 22:58:58 +02:00
Martijn van Brummelen
a9ed8a091a fix memory leaks 2018-10-05 22:53:05 +02:00
Martijn van Brummelen
dd74c429b0 fix segfault by initializing nwipe_gui_thread 2018-10-05 22:35:41 +02:00
Martijn van Brummelen
baab603809 Version 0.25(change footer) 2018-10-05 22:20:09 +02:00
Martijn van Brummelen
0fa21d4c04 Merge pull request #43 from infrastation/master
fix a couple minor issues in the man page
2018-08-08 10:15:16 +02:00
Denis Ovsienko
3bc0235d38 fix a couple minor issues in the man page 2018-07-07 23:57:52 +01:00
Martijn van Brummelen
533fa56de8 change version to 0.24 2017-12-06 20:44:12 +01:00
Martijn van Brummelen
011901b28e remove tar ball. 2017-12-06 20:33:17 +01:00
Martijn van Brummelen
b47fe001b3 add autoconf tarball 2017-12-06 20:29:58 +01:00
Martijn van Brummelen
3638eae8d4 change version number and add friendly throughput 2017-12-06 20:28:09 +01:00
Martijn van Brummelen
b0bc174d32 pre-0.24 2017-12-06 20:09:47 +01:00
Martijn van Brummelen
8f5c05506f v0.23 2017-12-05 20:07:30 +01:00
Martijn van Brummelen
23c69f34c1 Merge pull request #35 from kelderek/kelderek-patch4
added #include <sys/ioctl.h> so it can get device name
2017-12-05 20:01:22 +01:00
kelderek
0b1cb83013 added #include <sys/ioctl.h> so it can get device name 2017-12-04 17:33:09 -05:00
martijn
17f23ba03b remove unused variable 2017-12-03 20:28:09 +01:00
martijn
22665fa781 include version.h 2017-12-03 19:31:17 +01:00
martijn
95dc8abcf3 fix 32bit issues 2017-12-03 19:07:31 +01:00
Martijn van Brummelen
fd55f48267 add gitignore file 2017-12-02 20:18:53 +01:00
Martijn van Brummelen
d9ba357722 add friendly disk size 2017-12-02 19:46:38 +01:00
Martijn
8a85d7e96f remove testfile 2017-12-02 18:31:02 +01:00
Martijn
cac9b17f9b update version in manpage 2017-12-02 18:27:29 +01:00
Martijn
37109daae7 change spelling fixes github bug #31 2017-12-02 18:03:39 +01:00
Martijn
052852d475 change version year to 2017 2017-12-02 18:02:34 +01:00
Martijn
4b20e7ca76 add test file 2017-12-02 17:58:06 +01:00
Martijn van Brummelen
c8a5a16108 place files in normal location 2017-02-21 22:31:11 +01:00
Martijn van Brummelen
4e64cab3c3 use localtime instead of gmtime for logging 2017-02-13 13:40:00 +01:00
Martijn van Brummelen
5f65683f63 Merge branch 'master' of ssh://github.com/martijnvanbrummelen/nwipe 2017-02-12 23:00:51 +01:00
Martijn van Brummelen
7b170bb444 Revert "Revert "bump version to 0.19""
This reverts commit b808b8402c.
2017-02-12 23:00:24 +01:00
Martijn van Brummelen
464bf788c5 Oops 2017-02-12 22:30:00 +01:00
Martijn van Brummelen
16e78b8523 disable "Kill the GUI thread" 2017-02-12 22:23:28 +01:00
Martijn van Brummelen
f71b23afc4 Merge branch 'master' of ssh://github.com/martijnvanbrummelen/nwipe 2017-02-12 21:20:18 +01:00
Martijn van Brummelen
e7d9ff73fe remove unused netinet/in.h 2017-02-12 20:14:55 +01:00
Martijn van Brummelen
1fce0eb936 make code more readable 2017-02-12 19:53:32 +01:00
Martijn van Brummelen
72c5cd8a0f forgot to include version.h in gui.c 2017-02-12 19:23:26 +01:00
Martijn van Brummelen
0f06e91ce5 forgot ; 2017-02-12 19:20:06 +01:00
Martijn van Brummelen
0f26c8ea68 use banner and update manpage 2017-02-12 19:05:36 +01:00
Martijn van Brummelen
9c63eef565 Version 0.21 2016-08-24 15:21:30 +02:00
Martijn van Brummelen
db9e7ef1aa Merge pull request #22 from nbassler/master
Fix ETA not updating properly and bad total throughput display
2016-08-24 15:58:56 +02:00
Niels Bassler
7039f381af Fix total throughtput display, which showed cummulative throughput, and not current througput. Fix also ETA, which would never decrease. 2016-08-21 19:48:54 +02:00
Martijn van Brummelen
b808b8402c Revert "bump version to 0.19"
This reverts commit 263d5d161f.
2016-08-04 10:55:42 +02:00
Martijn van Brummelen
c6fa743f15 Update README/Version 2016-08-04 09:27:48 +02:00
Martijn van Brummelen
61e8e4663f Merge branch 'vuntz-panel-headers' 2016-08-04 09:14:52 +02:00
Martijn van Brummelen
ea198137de Merge branch 'panel-headers' of https://github.com/vuntz/nwipe into vuntz-panel-headers 2016-08-04 09:14:37 +02:00
Martijn van Brummelen
263d5d161f bump version to 0.19 2016-08-04 07:37:37 +02:00
Martijn van Brummelen
15c444e2eb Build on Fedora 2016-08-03 22:36:20 +02:00
Martijn van Brummelen
1e1eadbc0a version 19 2016-08-03 22:24:58 +02:00
martijn van brummelen
d01b00b4f8 Update Release 0.18 2016-07-27 09:33:17 +02:00
martijn van brummelen
3c0c8408f6 remove test file 2016-07-27 09:00:39 +02:00
martijn van brummelen
a619de6134 test 2016-07-27 08:52:42 +02:00
Martijn van Brummelen
3176688f3e Merge pull request #13 from charles-dyfis-net/issues/12
Add libintl, libuuid dependencies to allow parted static link (#12)
2016-07-27 08:07:03 +02:00
Martijn van Brummelen
b03f063e89 Merge pull request #6 from vuntz/kill-warnings
Remove more compiler warnings
2016-07-27 08:05:51 +02:00
Martijn van Brummelen
f9fd45f129 Merge pull request #9 from dmshaw/master
Add "--nosignals" option to nwipe
Automake needs the dist_ prefix to include man pages in 'make dist'
2016-07-27 08:04:50 +02:00
Martijn van Brummelen
d10dca3bed Merge pull request #14 from charles-dyfis-net/issues/11
Move from loff_t to off64_t for musl libc support (#11)
2016-07-27 08:03:26 +02:00
Martijn van Brummelen
8fa0d8c1f4 Merge pull request #18 from TheSqrtMinus1/master
fixed grammar
2016-07-27 08:01:01 +02:00
gabe
47ff866968 fixed grammar 2016-03-15 10:48:13 -04:00
Charles Duffy
edfabad8a1 Add libintl, libuuid dependencies to allow parted static link (#12)
libparted requires libuuid; both require libintl. Static builds currently fail
with link errors due to these missing dependencies.
2015-10-17 15:18:16 -05:00
Charles Duffy
2f44978db4 Move from loff_t to off64_t for musl libc support (#11)
Using musl libc, the loff_t type is unavailable. This is only exported by the
kernel when building with GNU_SOURCE, so there's an argument to be made that
it's desired behavior; see http://www.openwall.com/lists/musl/2013/01/23/6 for
discussion on this point.
2015-10-17 15:15:54 -05:00
David Shaw
fbe6e9d150 Automake needs the dist_ prefix to include man pages in 'make dist' 2015-06-04 14:46:58 -04:00
David Shaw
3ba8d3814b Add "--nosignals" option to tell nwipe to ignore signals during a
wipe.  Intended for use inside scripts where we don't want users to be
able to kill a wipe partway through.
2015-06-04 14:36:36 -04:00
Martijn
8a9a718221 remove test file 2014-10-19 21:49:22 +02:00
Martijn
a86f366147 Missed if statement 2014-10-19 21:15:22 +02:00
Martijn
e1627b3dc5 Patch nwipe.c to fix Debian bug #755473 (thanks Mark Feenstra). 2014-10-19 14:38:15 +02:00
Martijn
167e4787b7 Change start key to S instead of F10. 2014-10-19 14:23:36 +02:00
Martijn
5a63140baf Update version to 0.17 2014-10-19 14:19:44 +02:00
Martijn
35009577ca Remove control reaches end of non-void function" warnings(Thanks Vincent Untz). 2014-10-19 14:04:36 +02:00
Martijn
2b65e93207 Remove unused variables (thanks Vincent Untz). 2014-10-19 13:56:44 +02:00
Martijn
69dda249c2 add test 2014-10-19 13:51:02 +02:00
Vincent Untz
124ec1e4a9 Do not use variable before we set it 2014-09-09 19:11:19 +02:00
Vincent Untz
57c14286db Ensure variable is initialized 2014-09-09 19:10:51 +02:00
Vincent Untz
ae5d2355cb Remove unused variables 2014-09-09 19:10:44 +02:00
Vincent Untz
51d33b9f61 Fix build when panel header is not in /usr/include
When there's no pkg-config file for the panel library, the build breaks
if the header is not in /usr/include.

At least in openSUSE, we have /usr/include/ncurses.h and
/usr/include/ncurses/panel.h.
2014-09-09 18:19:05 +02:00
Andrew Beverley
86b7b32e37 Update versioning info to v0.16 2014-05-15 09:25:26 +01:00
Andrew Beverley
ee99425d6d Allow building with clang compiler 2014-05-15 09:22:29 +01:00
37 changed files with 6606 additions and 4618 deletions

80
.clang-format Normal file
View File

@@ -0,0 +1,80 @@
---
Language: Cpp
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterFunction: true
AfterControlStatement: true
AfterEnum: false
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: true
IndentBraces: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ContinuationIndentWidth: 4
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

24
.github/workflows/ci_ubuntu_16.04.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: ci_ubuntu_16.04
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v1
- name: updating available system dependencies
run: sudo apt-get update
- name: installing system dependencies
run: sudo apt-get install -y build-essential pkg-config automake libncurses5-dev autotools-dev libparted-dev dmidecode clang-format-5.0
- name: creating autoconf files
run: ./init.sh
- name: configuring
run: ./configure CFLAGS='-O0 -g -Wall -Wextra'
- name: compiling
run: make
# Changing the path should no longer be necessary when clang-format6 is installed.
- name: verifying code style
run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format

24
.github/workflows/ci_ubuntu_latest.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: ci_ubuntu_latest
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: updating available system dependencies
run: sudo apt-get update
- name: installing system dependencies
run: sudo apt-get install -y build-essential pkg-config automake libncurses5-dev autotools-dev libparted-dev dmidecode clang-format-5.0
- name: creating autoconf files
run: ./init.sh
- name: configuring
run: ./configure CFLAGS='-O0 -g -Wall -Wextra'
- name: compiling
run: make
# Changing the path should no longer be necessary when clang-format6 is installed.
- name: verifying code style
run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format

22
.gitignore vendored Normal file
View File

@@ -0,0 +1,22 @@
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
install-sh
man/Makefile
man/Makefile.in
missing
src/**/.deps/
src/**/.dirstamp
*.o
src/Makefile
src/Makefile.in
src/nwipe
stamp-h1

171
CHANGELOG.md Normal file
View File

@@ -0,0 +1,171 @@
RELEASE NOTES
=============
v0.28
-----------------------
- Fix premature exit when terminal resized on completion of wipes (Thanks PartialVolume)
- Fix GUI when terminal is resized, currently not handled correctly causing missing or incorrectly sized ncurses windows/panels (Thanks PartialVolume)
- Fix GUI screen flicker under various situations. [#200](https://github.com/martijnvanbrummelen/nwipe/pull/200) Fixes [#115](https://github.com/martijnvanbrummelen/nwipe/issues/115) (Thanks PartialVolume)
- Fix responsivness of screen during wipe when resized. Info is updated every 10th/sec. Key presses are more responsive. (Thanks PartialVolume)
- Fix compiler warning regarding buffer overflow. Fixes [#202](https://github.com/martijnvanbrummelen/nwipe/issues/202) (Thanks PartialVolume)
- Fix Man page (Thanks martijnvanbrummelen)
- Fix individual device throughput. On completion of a wipe instead of the throughput calculation stopping for a completed wipe, it would continue to calculate resulting in a particular drives throughtput slowly dropping until eventually it reached zero. The overall throughput was not affected. (Thanks PartialVolume)
v0.27
-----------------------
- Add `verify` method to verify a disk is zero filled [#128](https://github.com/martijnvanbrummelen/nwipe/pull/128) (Thanks Legogizmo)
- Add new HMG IS5 enhanced wipe method [#168](https://github.com/martijnvanbrummelen/nwipe/pull/168) (Thanks infrastation)
- Fix percentage progress and show on completion of wipe (Thanks PartialVolume)
- Implement clang-format support (Thanks louib)
- Implement more frequent disk sync support (Thanks Legogizmo)
- Format command line help to 80 character line length [#114](https://github.com/martijnvanbrummelen/nwipe/pull/114) (Thanks PartialVolume)
- Fix nwipe message log and missing messages that was causing segfaults under certain conditions (Thanks PartialVolume)
- Add the Github build CI service and update Readme with build status labels (Thanks louib)
- Miscellaneous smaller fixes
v0.26
-----
- Add exclude drive option (Thanks PartialVolume)
- Log hardware (Thanks PartialVolume)
v0.25
-----
- Correct J=Up K=Down in footer (Thanks PartialVolume)
- Fix segfault initialize `nwipe_gui_thread` (Thanks PartialVolume)
- Fix memory leaks (Thanks PartialVolume)
- Check right pointer (Thanks PartialVolume)
- Fix casting problem (Thanks PartialVolume)
- Fix serial number
- Fixes uninitialized variable warning (Thanks PartialVolume)
v0.24
-----
- use include values for version 0.17
- display throughput value more friendly (Thanks Kelderek)
v0.23
-----
- make serial visible again on 32Bit machines
v0.22
-----
- Update manpage
- use long long for device size
- Use `ped_unit_format_byte` function to display(friendly) size of device
v0.21
-----
- Fix ETA not updating properly and bad total throughput display. (Thanks Niels Bassler).
v0.20
-----
- Fix build when panel header is not in `/usr/include` (Thanks Vincent Untz).
v0.19
-----
- Fix building on Fedora(Unknown `off64_t`) bug #19.
- Use PRNG instead of zero's bug #7. (Thanks xambroz).
v0.18
-----
- Fixed grammar.
- Move from `loff_t` to `off64_t` for musl libc support.
- Add `--nosignals` option.
- Automake needs the `dist_` prefix to include man pages in `make dist`.
- Remove more compiler warnings.
- Add libintl, libuuid dependencies to allow parted static link
v0.17
-----
- Remove control reaches end of non-void function" warnings (Thanks Vincent Untz).
- Remove unused variables (Thanks Vincent Untz).
- Change start key to 'S' instead of F10 (closes debian bug #755474).
- Fix problem with unusable device (Closes debian bug #755473).
v0.16
-----
- Fix problems building with clang compiler (Thanks Martijn van Brummelen)
v0.15
-----
- Add more detailed information to status page when wiping
- Add ability to send SIGUSR1 to print wiping current status to log
- Fixed problem with status bar disappearing on narrow windows (Github issue #1)
v0.14
-----
- Added explicit check for ncurses (required for Fedora). See bug 3604008.
v0.13
-----
- Added nowait option (patch 3601259 - thanks David Shaw).
- Added nogui option.
- Updated man page and help command for above options and autonuke.
- Added pkg-config check for ncurses (patch 3603140 - thanks Alon Bar-Lev).
v0.12
-----
- Added ability to specify device on command line (patch 3587144).
- Fixed segfault for -p option (patch 3587132).
v0.11
-----
- Fixed bug 3568750. Not closing devices after initial scan.
v0.10
-----
- Fixed bug 3553851. Not exiting on terminal kill. Fixed for all areas of
program including wiping.
v0.09
-----
- Added feature #3545971. Display device name.
- Added feature #3496858. Option to not perform a final blanking pass.
v0.08
-----
- Fixed bug #3501746 whereby "wipe finished" was displayed too early
v0.07
-----
- Added threading synchronisation for logging
- Fixed bug #3486927 (incorrect Sourceforge URL)
v0.06
-----
- Added man page (thanks Michal Ambroz <rebus@seznam.cz>)
- Updated GPL licence and FSF address (thanks Michal Ambroz <rebus@seznam.cz>)
v0.05
-----
- Added sequence number to disk selection
- Added check for ncurses header files in subdir
- Fixed screen corruption bug introduced in 0.04
- Fixed occasional seg fault on start
- Introduced dynamic array allocation for devices, with no hard limit
- Minor updates to configure.ac
v0.04
-----
- Removed references to DBAN in options.c
- Added log file name option (-l|--logfile)
- If no log file specified all messages go to STDOUT
- Incorrect success message after an interruption fixed
- Improved labelling of disks with no partition table
- Added help command
- Added version command
- Added command 'b' to blank screen during wipe
- Compilation needs to include panel library
KNOWN BUG - display sometimes becomes corrupted after starting wipe
v0.03
-----
- Added quit option label (ctrl-c)
- Removed further references to DWIPE
- Added GPL V2 licence file (COPYING)
v0.02
-----
- Fixed segfault that happened during multiple disk wipes

View File

@@ -1,2 +1,9 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src man
# The set of files to be formatted.
FORMATSOURCES = src/*.c src/*.h
format:
clang-format -i -style=file $(FORMATSOURCES)
check-format:
clang-format -i -style=file $(FORMATSOURCES) && git diff --exit-code

102
README
View File

@@ -1,102 +0,0 @@
Installation
============
First bootstrap the source tree:
./init.sh
The install using the standard:
./configure
make
make install
The ncurses, pthreads and parted libraries are required for compiling.
For any problems, please use the Github page:
https://github.com/abeverley/nwipe
Andy Beverley
RELEASE NOTES
=============
v0.15
=====
- Add more detailed information to status page when wiping
- Add ability to send SIGUSR1 to print wiping current status to log
- Fixed problem with status bar disappearing on narrow windows (Github issue #1)
v0.14
=====
- Added explicit check for ncurses (required for Fedora). See bug 3604008.
v0.13
=====
- Added nowait option (patch 3601259 - thanks David Shaw).
- Added nogui option.
- Updated man page and help command for above options and autonuke.
- Added pkg-config check for ncurses (patch 3603140 - thanks Alon Bar-Lev).
v0.12
=====
- Added ability to specify device on command line (patch 3587144).
- Fixed segfault for -p option (patch 3587132).
v0.11
=====
- Fixed bug 3568750. Not closing devices after initial scan.
v0.10
=====
- Fixed bug 3553851. Not exiting on terminal kill. Fixed for all areas of
program including wiping.
v0.09
=====
- Added feature #3545971. Display device name.
- Added feature #3496858. Option to not perform a final blanking pass.
v0.08
=====
- Fixed bug #3501746 whereby "wipe finished" was displayed too early
v0.07
=====
- Added threading synchronisation for logging
- Fixed bug #3486927 (incorrect Sourceforge URL)
v0.06
=====
- Added man page (thanks Michal Ambroz <rebus@seznam.cz>)
- Updated GPL licence and FSF address (thanks Michal Ambroz <rebus@seznam.cz>)
v0.05
=====
- Added sequence number to disk selection
- Added check for ncurses header files in subdir
- Fixed screen corruption bug introduced in 0.04
- Fixed occasional seg fault on start
- Introduced dynamic array allocation for devices, with no hard limit
- Minor updates to configure.ac
v0.04
=====
- Removed references to DBAN in options.c
- Added log file name option (-l|--logfile)
- If no log file specified all messages go to STDOUT
- Incorrect success message after an interruption fixed
- Improved labelling of disks with no partition table
- Added help command
- Added version command
- Added command 'b' to blank screen during wipe
- Compilation needs to include panel library
KNOWN BUG - display sometimes becomes corrupted after starting wipe
v0.03
=====
- Added quit option label (ctrl-c)
- Removed further references to DWIPE
- Added GPL V2 licence file (COPYING)
v0.02
=====
- Fixed segfault that happened during multiple disk wipes

139
README.md
View File

@@ -1,15 +1,134 @@
nwipe is a command that will securely erase disks using a variety of
recognised methods. It is a fork of the dwipe command used by
Darik's Boot and Nuke (dban). nwipe is included with partedmagic if
want a quick and easy bootable CD version. nwipe was created out of
a need to run the DBAN dwipe command outside of DBAN, in order to
allow its use with any host distribution, thus giving better hardware
support.
# nwipe
![GitHub CI badge](https://github.com/martijnvanbrummelen/nwipe/workflows/ci_ubuntu_latest/badge.svg)
![GitHub CI badge](https://github.com/martijnvanbrummelen/nwipe/workflows/ci_ubuntu_16.04/badge.svg)
To use from the git repository, first create all the autoconf files with
nwipe is a program that will securely erase disks. It can operate as both a command line
tool without a GUI or with an ncurses GUI as shown in the example below. It can wipe multiple
disks simultaneously.
The user can select from a variety of recognised secure erase methods which include:
* Zero Fill - Fills the device with zeros, 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.
* HMG IS5 enhanced - Secure Sanitisation of Protectively Marked Information or Sensitive Information
It also includes the following pseudo random number generators:
* Mersenne Twister
* 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) and
[ShredOS](https://github.com/nadenislamarre/shredos) if you want a quick and easy bootable CD or USB version.
Nwipe was created out of a need to run the DBAN dwipe command outside
of DBAN, in order to allow its use with any host distribution, thus
giving better hardware support.
![Example wipe](/images/example_wipe.gif)
## Compiling & Installing
`nwipe` requires the following libraries to be installed:
* ncurses
* pthreads
* parted
### Debian & Ubuntu prerequisites
If you are compiling `nwipe` from source, the following libraries will need to be installed first:
```bash
sudo apt install \
build-essential \
pkg-config \
automake \
libncurses5-dev \
autotools-dev \
libparted-dev \
dmidecode
```
### Fedora prerequisites
```bash
sudo bash
dnf update
dnf groupinstall "Development Tools"
dnf groupinstall "C Development Tools and Libraries"
yum install ncurses-devel
yum install parted-devel
yum install dmidecode
```
Note. dmidecode is optional, it provides SMBIOS/DMI host data to stdout or the log file.
### Compilation
For a development setup, see [the hacking section below](#Hacking).
First create all the autoconf files:
```
./init.sh
```
Then do the standard ./configure --prefix=/usr && make && make install
Then compile & install using the following standard commands:
```
./configure
make
make install
```
For release notes please see the [README file](README)
Then run nwipe !
```
cd src
sudo ./nwipe
```
or
```
sudo nwipe
```
### Hacking
If you wish to submit pull requests to this code we would prefer you enable all warnings when compiling.
This can be done using the following compile commands:
```
./configure --prefix=/usr CFLAGS='-O0 -g -Wall -Wextra'
make
make install
```
The `-O0 -g` flags disable optimisations. This is required if you're debugging with
`gdb` in an IDE such as Kdevelop. With these optimisations enabled you won't be
able to see the values of many variables in nwipe, not to mention the IDE won't step
through the code properly.
The `-Wall` and `-Wextra` flags enable all compiler warnings. Please submit code with zero warnings.
Also make sure that your changes are consistent with the coding style defined in the `.clang-format` file, using:
```
make format
```
You will need `clang-format` installed to use the `format` command.
Once done with your coding then the released/patch/fixed code can be compiled,
with all the normal optimisations, using:
```
./configure --prefix=/usr && make && make install
```
## Bugs
Bugs can be reported on GitHub:
https://github.com/martijnvanbrummelen/nwipe
## License
GNU General Public License v2.0

View File

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

BIN
images/example_wipe.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 KiB

View File

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

View File

@@ -1,4 +1,4 @@
.TH NWIPE "1" "March 2014" "nwipe version 0.15" "User Commands"
.TH NWIPE "1" "March 2020" "nwipe version 0.28" "User Commands"
.SH NAME
nwipe \- securely erase disks
.SH SYNOPSIS
@@ -7,7 +7,7 @@ nwipe \- securely erase disks
.SH DESCRIPTION
nwipe is a command that will securely erase disks using a variety of
recognised methods. It is a fork of the dwipe command used by Darik's Boot
and Nuke (dban). nwipe is included with partedmagic if want a quick and
and Nuke (dban). nwipe is included with partedmagic if you want a quick and
easy bootable CD version. nwipe was created out of a need to run the DBAN
dwipe command outside of DBAN, in order to allow its use with any host
distribution, thus giving better hardware support. It is essentially the
@@ -37,9 +37,16 @@ those specified devices immediately.
\fB\-\-sync\fR
Open devices in sync mode
.TP
\fB\-\-noblank\fR
Do not perform the final blanking pass after the wipe (default is to blank,
except when the method is RCMP TSSIT OPS\-II).
.TP
\fB\-\-nowait\fR
Do not wait for a key before exiting (default is to wait).
.TP
\fB\-\-nosignals\fR
Do not allow signals to interrupt a wipe (default is to allow).
.TP
\fB\-\-nogui\fR
Do not show the GUI interface. Can only be used with the autonuke option.
Nowait option is automatically invoked with the nogui option.
@@ -47,9 +54,15 @@ SIGUSR1 can be used to retrieve the current wiping statistics.
.TP
\fB\-\-verify\fR=\fITYPE\fR
Whether to perform verification of erasure (default: last)
.IP
off \- Do not verify
.IP
last \- Verify after the last pass
.IP
all \- Verify every pass
.IP
Please mind that HMG IS5 enhanced always verifies the last (PRNG) pass
regardless of this option.
.TP
\fB\-m\fR, \fB\-\-method\fR=\fIMETHOD\fR
The wiping method (default: dodshort).
@@ -65,6 +78,10 @@ ops2 \- RCMP TSSIT OPS\-II
random / prng / stream \- PRNG Stream
.IP
zero / quick \- Overwrite with zeros
.IP
verify \- Verifies disk is zero filled
.IP
is5enh \- HMG IS5 enhanced
.TP
\fB\-l\fR, \fB\-\-logfile\fR=\fIFILE\fR
Filename to log to. Default is STDOUT
@@ -74,12 +91,16 @@ PRNG option (mersenne|twister|isaac)
.TP
\fB\-r\fR, \fB\-\-rounds\fR=\fINUM\fR
Number of times to wipe the device using the selected method (default: 1)
.TP
\fB\-e\fR, \fB\-\-exclude\fR=\fIDEVICES\fR
Up to ten comma separated devices to be excluded, examples:
--exclude=/dev/sdc
--exclude=/dev/sdc,/dev/sdd
.SH BUGS
Please see the sourceforge site for the latest list
(http://nwipe.sourceforge.net)
Please see the GitHub site for the latest list
(https://github.com/martijnvanbrummelen/nwipe/issues)
.SH AUTHOR
Nwipe was released by Andy Beverley <andy@andybev.com>
as modified version of dwipe from DBAN by Darik Horn <dajhorn-dban@vanadac.com>.
Nwipe is developed by Martijn van Brummelen <github@brumit.nl>
.SH "SEE ALSO"
.BR shred (1),
.BR dwipe (1),

View File

@@ -6,4 +6,6 @@ AM_LDFLAGS =
# this lists the binaries to produce, the (non-PHONY, binary) targets in
# the previous manual Makefile
bin_PROGRAMS = nwipe
nwipe_SOURCES = context.h isaac_rand.c logging.h options.h prng.h nwipe.c gui.c isaac_rand.h method.h pass.c device.c gui.h isaac_standard.h mt19937ar-cok.c nwipe.h mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c version.h
nwipe_SOURCES = context.h isaac_rand/isaac_rand.c logging.h options.h prng.h nwipe.c gui.c isaac_rand/isaac_rand.h method.h pass.c device.c gui.h isaac_rand/isaac_standard.h mt19937ar-cok/mt19937ar-cok.c nwipe.h mt19937ar-cok/mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c version.h
nwipe_CFLAGS = $(PARTED_CFLAGS)
nwipe_LDADD = $(PARTED_LIBS)

View File

@@ -2,7 +2,7 @@
* context.h: The internal state representation of nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
@@ -25,120 +25,130 @@
#include "prng.h"
typedef enum nwipe_device_t_
{
NWIPE_DEVICE_UNKNOWN = 0, /* Unknown device. */
NWIPE_DEVICE_IDE,
NWIPE_DEVICE_SCSI,
NWIPE_DEVICE_COMPAQ, /* Unimplemented. */
NWIPE_DEVICE_USB, /* Unimplemented. */
NWIPE_DEVICE_IEEE1394 /* Unimplemented. */
typedef enum nwipe_device_t_ {
NWIPE_DEVICE_UNKNOWN = 0, // Unknown device.
NWIPE_DEVICE_IDE,
NWIPE_DEVICE_SCSI,
NWIPE_DEVICE_COMPAQ, // Unimplemented.
NWIPE_DEVICE_USB, // Unimplemented.
NWIPE_DEVICE_IEEE1394 // Unimplemented.
} nwipe_device_t;
typedef enum nwipe_pass_t_
{
NWIPE_PASS_NONE = 0, /* Not running. */
NWIPE_PASS_WRITE, /* Writing patterns to the device. */
NWIPE_PASS_VERIFY, /* Verifying a pass. */
NWIPE_PASS_FINAL_BLANK, /* Filling the device with zeros. */
NWIPE_PASS_FINAL_OPS2 /* Special case for nwipe_ops2. */
typedef enum nwipe_pass_t_ {
NWIPE_PASS_NONE = 0, // Not running.
NWIPE_PASS_WRITE, // Writing patterns to the device.
NWIPE_PASS_VERIFY, // Verifying a pass.
NWIPE_PASS_FINAL_BLANK, // Filling the device with zeros.
NWIPE_PASS_FINAL_OPS2 // Special case for nwipe_ops2.
} nwipe_pass_t;
typedef enum nwipe_select_t_
{
NWIPE_SELECT_NONE = 0, /* Unused. */
NWIPE_SELECT_TRUE, /* Wipe this device. */
NWIPE_SELECT_TRUE_PARENT, /* A parent of this device has been selected, so the wipe is implied. */
NWIPE_SELECT_FALSE, /* Do not wipe this device. */
NWIPE_SELECT_FALSE_CHILD, /* A child of this device has been selected, so we can't wipe this device. */
NWIPE_SELECT_DISABLED /* Do not wipe this device and do not allow it to be selected. */
typedef enum nwipe_select_t_ {
NWIPE_SELECT_NONE = 0, // Unused.
NWIPE_SELECT_TRUE, // Wipe this device.
NWIPE_SELECT_TRUE_PARENT, // A parent of this device has been selected, so the wipe is implied.
NWIPE_SELECT_FALSE, // Do not wipe this device.
NWIPE_SELECT_FALSE_CHILD, // A child of this device has been selected, so we can't wipe this device.
NWIPE_SELECT_DISABLED // Do not wipe this device and do not allow it to be selected.
} nwipe_select_t;
#define NWIPE_KNOB_SPEEDRING_SIZE 30
#define NWIPE_KNOB_SPEEDRING_GRANULARITY 10
#define NWIPE_KNOB_SPEEDRING_SIZE 30
#define NWIPE_KNOB_SPEEDRING_GRANULARITY 10
typedef struct nwipe_speedring_t_
{
u64 bytes[NWIPE_KNOB_SPEEDRING_SIZE];
u64 bytestotal;
u64 byteslast;
time_t times[NWIPE_KNOB_SPEEDRING_SIZE];
time_t timestotal;
time_t timeslast;
u32 position;
u64 bytes[NWIPE_KNOB_SPEEDRING_SIZE];
u64 bytestotal;
u64 byteslast;
time_t times[NWIPE_KNOB_SPEEDRING_SIZE];
time_t timestotal;
time_t timeslast;
u32 position;
} nwipe_speedring_t;
#define NWIPE_DEVICE_LABEL_LENGTH 200
typedef struct nwipe_context_t_
{
int block_size; /* The soft block size reported the device. */
int device_bus; /* The device bus number. */
int device_fd; /* The file descriptor of the device file being wiped. */
int device_host; /* The host number. */
struct hd_driveid device_id; /* The WIN_IDENTIFY data for IDE drives. */
int device_lun; /* The device logical unit number. */
int device_major; /* The major device number. */
int device_minor; /* The minor device number. */
int device_part; /* The device partition or slice number. */
char* device_name; /* The device file name. */
loff_t device_size; /* The device size in bytes. */
struct stat device_stat; /* The device file state from fstat(). */
nwipe_device_t device_type; /* Indicates an IDE, SCSI, or Compaq SMART device. */
int device_target; /* The device target. */
u64 eta; /* The estimated number of seconds until method completion. */
int entropy_fd; /* The entropy source. Usually /dev/urandom. */
char* label; /* The string that we will show the user. */
int pass_count; /* The number of passes performed by the working wipe method. */
u64 pass_done; /* The number of bytes that have already been i/o'd in this pass. */
u64 pass_errors; /* The number of errors across all passes. */
u64 pass_size; /* The total number of i/o bytes across all passes. */
nwipe_pass_t pass_type; /* The type of the current working pass. */
int pass_working; /* The current working pass. */
nwipe_prng_t* prng; /* The PRNG implementation. */
nwipe_entropy_t prng_seed; /* The random data that is used to seed the PRNG. */
void* prng_state; /* The private internal state of the PRNG. */
int result; /* The process return value. */
int round_count; /* The number of rounds performed by the working wipe method. */
u64 round_done; /* The number of bytes that have already been i/o'd. */
u64 round_errors; /* The number of errors across all rounds. */
u64 round_size; /* The total number of i/o bytes across all rounds. */
double round_percent; /* The percentage complete across all rounds. */
int round_working; /* The current working round. */
int sector_size; /* The hard sector size reported by the device. */
nwipe_select_t select; /* Indicates whether this device should be wiped. */
int signal; /* Set when the child is killed by a signal. */
nwipe_speedring_t speedring; /* Ring buffer for computing the rolling throughput average. */
short sync_status; /* A flag to indicate when the method is syncing. */
pthread_t thread; /* The ID of the thread. */
u64 throughput; /* Average throughput in bytes per second. */
u64 verify_errors; /* The number of verification errors across all passes. */
struct hd_driveid identity; /* The serial number of the drive (where applicable) */
/*
* Device fields
*/
int device_block_size; // The soft block size reported by the device.
int device_sector_size; // The hard sector size reported by the device.
int device_bus; // The device bus number.
int device_fd; // The file descriptor of the device file being wiped.
int device_host; // The host number.
struct hd_driveid device_id; // The WIN_IDENTIFY data for IDE drives.
int device_lun; // The device logical unit number.
int device_major; // The major device number.
int device_minor; // The minor device number.
int device_part; // The device partition or slice number.
char* device_name; // The device file name.
long long device_size; // The device size in bytes.
char* device_size_text; // The device size in a more (human)readable format.
char* device_model; // The model of the device.
char device_label[NWIPE_DEVICE_LABEL_LENGTH]; // The label (name, model, size and serial) of the device.
struct stat device_stat; // The device file state from fstat().
nwipe_device_t device_type; // Indicates an IDE, SCSI, or Compaq SMART device.
char device_serial_no[21]; // Serial number(processed, 20 characters plus null termination) of the device.
int device_target; // The device target.
u64 eta; // The estimated number of seconds until method completion.
int entropy_fd; // The entropy source. Usually /dev/urandom.
int pass_count; // The number of passes performed by the working wipe method.
u64 pass_done; // The number of bytes that have already been i/o'd in this pass.
u64 pass_errors; // The number of errors across all passes.
u64 pass_size; // The total number of i/o bytes across all passes.
nwipe_pass_t pass_type; // The type of the current working pass.
int pass_working; // The current working pass.
nwipe_prng_t* prng; // The PRNG implementation.
nwipe_entropy_t prng_seed; // The random data that is used to seed the PRNG.
void* prng_state; // The private internal state of the PRNG.
int result; // The process return value.
int round_count; // The number of rounds performed by the working wipe method.
u64 round_done; // The number of bytes that have already been i/o'd.
u64 round_errors; // The number of errors across all rounds.
u64 round_size; // The total number of i/o bytes across all rounds.
double round_percent; // The percentage complete across all rounds.
int round_working; // The current working round.
nwipe_select_t select; // Indicates whether this device should be wiped.
int signal; // Set when the child is killed by a signal.
nwipe_speedring_t speedring; // Ring buffer for computing the rolling throughput average.
short sync_status; // A flag to indicate when the method is syncing.
pthread_t thread; // The ID of the thread.
u64 throughput; // Average throughput in bytes per second.
u64 verify_errors; // The number of verification errors across all passes.
int wipe_status; // Wipe finished = 0, wipe in progress = 1, wipe yet to start = -1.
/*
* Identity contains the raw serial number of the drive
* (where applicable), however, for use within nwipe use the
* processed serial_no[21] string above. To access serial no. use
* c[i]->serial_no) and not c[i]->identity.serial_no);
*/
struct hd_driveid identity;
} nwipe_context_t;
/* We use 2 data structs to pass data between threads. */
/* The first contains any required values: */
/* Values cannot form part of the second array below, hence the need for this. */
/*
* We use 2 data structs to pass data between threads.
* The first contains any required values.
* Values cannot form part of the second array below, hence the need for this.
*/
typedef struct
{
int nwipe_enumerated; /* The number of devices available. */
int nwipe_selected; /* The number of devices being wiped. */
time_t maxeta; /* The estimated runtime of the slowest device. */
u64 throughput; /* Total throughput */
u64 errors; /* The combined number of errors of all processes. */
pthread_t *gui_thread; /* The ID of GUI thread. */
int nwipe_enumerated; // The number of devices available.
int nwipe_selected; // The number of devices being wiped.
time_t maxeta; // The estimated runtime of the slowest device.
u64 throughput; // Total throughput.
u64 errors; // The combined number of errors of all processes.
pthread_t* gui_thread; // The ID of GUI thread.
} nwipe_misc_thread_data_t;
/* The second points to the first structure, as well as the structure of all the devices */
typedef struct
/*
* The second points to the first structure, as well as the structure of all the devices
*/
typedef struct
{
nwipe_context_t **c; /* Pointer to the nwipe context structure. */
nwipe_misc_thread_data_t *nwipe_misc_thread_data; /* Pointer to the misc structure above. */
nwipe_context_t** c; // Pointer to the nwipe context structure.
nwipe_misc_thread_data_t* nwipe_misc_thread_data; // Pointer to the misc structure above.
} nwipe_thread_data_ptr_t;
#endif /* CONTEXT_H_ */
/* eof */

View File

@@ -2,9 +2,9 @@
* device.c: Device routines for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 2.
@@ -16,120 +16,248 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
/* Why is this needed? Segfaults without it */
#include <netinet/in.h>
#include <stdint.h>
#include "nwipe.h"
#include "context.h"
#include "method.h"
#include "options.h"
#include "logging.h"
#include <sys/ioctl.h>
#include <linux/hdreg.h> // Drive specific defs
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <parted/parted.h>
#include <parted/debug.h>
#include <parted/debug.h>
int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount );
char* trim( char* str );
int nwipe_device_scan( nwipe_context_t*** c )
{
/**
* Scans the the filesystem for storage device names.
*
* @parameter device_names A reference to a null array pointer.
* @modifies device_names Populates device_names with an array of nwipe_contect_t
* @returns The number of strings in the device_names array.
*
*/
/**
* Scans the filesystem for storage device names.
*
* @parameter device_names A reference to a null array pointer.
* @modifies device_names Populates device_names with an array of nwipe_contect_t
* @returns The number of strings in the device_names array.
*
*/
PedDevice* dev = NULL;
ped_device_probe_all();
int dcount = 0;
PedDevice* dev = NULL;
ped_device_probe_all();
while ((dev = ped_device_get_next (dev)))
{
if (check_device(c, dev, dcount))
dcount++;
}
int dcount = 0;
/* Return the number of devices that were found. */
return dcount;
while( ( dev = ped_device_get_next( dev ) ) )
{
if( check_device( c, dev, dcount ) )
dcount++;
}
/* Return the number of devices that were found. */
return dcount;
} /* nwipe_device_scan */
int nwipe_device_get( nwipe_context_t*** c, char **devnamelist, int ndevnames )
int nwipe_device_get( nwipe_context_t*** c, char** devnamelist, int ndevnames )
{
/**
* Gets information about devices
*
* @parameter device_names A reference to a null array pointer.
* @parameter devnamelist An array of string pointers to the device names
* @parameter ndevnames Number of elements in devnamelist
* @modifies device_names Populates device_names with an array of nwipe_contect_t
* @returns The number of strings in the device_names array.
*
*/
/**
* Gets information about devices
*
* @parameter device_names A reference to a null array pointer.
* @parameter devnamelist An array of string pointers to the device names
* @parameter ndevnames Number of elements in devnamelist
* @modifies device_names Populates device_names with an array of nwipe_contect_t
* @returns The number of strings in the device_names array.
*
*/
PedDevice* dev = NULL;
int i;
int dcount = 0;
PedDevice* dev = NULL;
for(i = 0; i < ndevnames; i++) {
int i;
int dcount = 0;
dev = ped_device_get(devnamelist[i]);
if (!dev)
break;
for( i = 0; i < ndevnames; i++ )
{
if (check_device(c, dev, dcount))
dcount++;
}
dev = ped_device_get( devnamelist[i] );
if( !dev )
{
nwipe_log( NWIPE_LOG_WARNING, "Device %s not found", devnamelist[i] );
continue;
}
/* Return the number of devices that were found. */
return dcount;
if( check_device( c, dev, dcount ) )
dcount++;
}
/* Return the number of devices that were found. */
return dcount;
} /* nwipe_device_get */
int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
{
/* Populate this struct, then assign it to overall array of structs. */
nwipe_context_t* next_device;
/* Populate this struct, then assign it to overall array of structs. */
nwipe_context_t* next_device;
int fd;
int idx;
/* Try opening the device to see if it's valid. Close on completion. */
if (!ped_device_open(dev))
return 0;
ped_device_close(dev);
/* New device, reallocate memory for additional struct pointer */
*c = realloc (*c, (dcount+1) * sizeof(nwipe_context_t *));
next_device = malloc (sizeof(nwipe_context_t));
/* Check the allocation. */
if( ! next_device )
/* Check whether this drive is on the excluded drive list ? */
idx = 0;
while( idx < 10 )
{
if( !strcmp( dev->path, nwipe_options.exclude[idx++] ) )
{
nwipe_perror( errno, __FUNCTION__, "malloc" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to create the array of enumeration contexts." );
return 0;
nwipe_log( NWIPE_LOG_NOTICE, "Device %s excluded as per command line option -e", dev->path );
return 0;
}
}
/* Zero the allocation. */
memset( next_device , 0, sizeof( nwipe_context_t ) );
/* Try opening the device to see if it's valid. Close on completion. */
if( !ped_device_open( dev ) )
{
nwipe_log( NWIPE_LOG_FATAL, "Unable to open device" );
return 0;
}
ped_device_close( dev );
/* Get device information */
next_device->label = dev->model;
next_device->device_name = dev->path;
next_device->device_size = dev->length * dev->sector_size;
/* Attempt to get serial number of device. */
ioctl(next_device->device_fd, HDIO_GET_IDENTITY, &next_device->identity);
/* New device, reallocate memory for additional struct pointer */
*c = realloc( *c, ( dcount + 1 ) * sizeof( nwipe_context_t* ) );
(*c)[dcount] = next_device;
return 1;
next_device = malloc( sizeof( nwipe_context_t ) );
/* Check the allocation. */
if( !next_device )
{
nwipe_perror( errno, __FUNCTION__, "malloc" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to create the array of enumeration contexts." );
return 0;
}
/* Zero the allocation. */
memset( next_device, 0, sizeof( nwipe_context_t ) );
/* Get device information */
next_device->device_model = dev->model;
next_device->device_name = dev->path;
next_device->device_size = dev->length * dev->sector_size;
next_device->device_size_text = ped_unit_format_byte( dev, dev->length * dev->sector_size );
next_device->result = -2;
/* Attempt to get serial number of device. */
if( ( fd = open( next_device->device_name = dev->path, O_RDONLY ) ) == ERR )
{
nwipe_log( NWIPE_LOG_WARNING, "Unable to open device %s to obtain serial number", next_device->device_name );
}
/*
* We don't check the ioctl return status because there are plenty of situations where a serial number may not be
* returned by ioctl such as USB drives, logical volumes, encryted volumes, so the log file would have multiple
* benign ioctl errors reported which isn't necessarily a problem.
*/
ioctl( fd, HDIO_GET_IDENTITY, &next_device->identity );
close( fd );
for( idx = 0; idx < 20; idx++ )
{
next_device->device_serial_no[idx] = next_device->identity.serial_no[idx];
}
// Terminate the string.
next_device->device_serial_no[20] = 0;
// Remove leading/trailing whitespace from serial number and left justify.
trim( (char*) next_device->device_serial_no );
if( strlen( (const char*) next_device->device_serial_no ) )
{
snprintf( next_device->device_label,
NWIPE_DEVICE_LABEL_LENGTH,
"%s (%s) - %s S/N:%s",
next_device->device_name,
next_device->device_size_text,
next_device->device_model,
next_device->device_serial_no );
}
else
{
snprintf( next_device->device_label,
NWIPE_DEVICE_LABEL_LENGTH,
"%s (%s) - %s",
next_device->device_name,
next_device->device_size_text,
next_device->device_model );
}
nwipe_log( NWIPE_LOG_INFO,
"Found drive model=\"%s\", device path=\"%s\", size=\"%s\", serial number=\"%s\"",
next_device->device_model,
next_device->device_name,
next_device->device_size_text,
next_device->device_serial_no );
( *c )[dcount] = next_device;
return 1;
}
/* eof */
/* Remove leading/training whitespace from a string and left justify result */
char* trim( char* str )
{
size_t len = 0;
char* frontp = str;
char* endp = NULL;
if( str == NULL )
{
return NULL;
}
if( str[0] == '\0' )
{
return str;
}
len = strlen( str );
endp = str + len;
/*
* Move the front and back pointers to address the first non-whitespace
* characters from each end.
*/
while( isspace( (unsigned char) *frontp ) )
{
++frontp;
}
if( endp != frontp )
{
while( isspace( (unsigned char) *( --endp ) ) && endp != frontp )
{
}
}
if( str + len - 1 != endp )
*( endp + 1 ) = '\0';
else if( frontp != str && endp == frontp )
*str = '\0';
/*
* Shift the string so that it starts at str so that if it's dynamically
* allocated, we can still free it on the returned pointer. Note the reuse
* of endp to mean the front of the string buffer now.
*/
endp = str;
if( frontp != str )
{
while( *frontp )
{
*endp++ = *frontp++;
}
*endp = '\0';
}
return str;
}

View File

@@ -2,7 +2,7 @@
* device.h: Device routines for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,18 +16,15 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef DEVICE_H_
#define DEVICE_H_
void nwipe_device_identify( nwipe_context_t* c ); /* Get hardware information about the device. */
int nwipe_device_scan( nwipe_context_t*** c ); /* Find devices that we can wipe. */
int nwipe_device_get( nwipe_context_t*** c, char **devnamelist, int ndevnames ); /* Get info about devices to wipe */
void nwipe_device_identify( nwipe_context_t* c ); // Get hardware information about the device.
int nwipe_device_scan( nwipe_context_t*** c ); // Find devices that we can wipe.
int nwipe_device_get( nwipe_context_t*** c, char** devnamelist, int ndevnames ); // Get info about devices to wipe.
#endif /* DEVICE_H_ */
/* eof */

4330
src/gui.c

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* gui.h: An ncurses GUI for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,29 +16,32 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef GUI_H_
#define GUI_H_
void nwipe_gui_free( void ); /* Stop the GUI. */
void nwipe_gui_init( void ); /* Start the GUI. */
void nwipe_gui_select( int count, nwipe_context_t** c ); /* Select devices to wipe. */
void *nwipe_gui_status( void *ptr ); /* Update operation progress. */
void nwipe_gui_method( void ); /* Change the method option. */
void nwipe_gui_options( void ); /* Update the options window. */
void nwipe_gui_prng( void ); /* Change the prng option. */
void nwipe_gui_rounds( void ); /* Change the rounds option. */
void nwipe_gui_verify( void ); /* Change the verify option. */
void nwipe_gui_noblank( void ); /* Change the noblank option. */
void nwipe_gui_free( void ); // Stop the GUI.
void nwipe_gui_init( void ); // Start the GUI.
void nwipe_gui_create_main_window( void ); // Create the main window
void nwipe_gui_create_header_window( void ); // Create the header window
void nwipe_gui_create_footer_window( const char* ); // Create the footer window and write text
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(
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.
void nwipe_gui_method( void ); // Change the method option.
void nwipe_gui_options( void ); // Update the options window.
void nwipe_gui_prng( void ); // Change the prng option.
void nwipe_gui_rounds( void ); // Change the rounds option.
void nwipe_gui_verify( void ); // Change the verify option.
void nwipe_gui_noblank( void ); // Change the noblank option.
int compute_stats(void *ptr);
int compute_stats( void* ptr );
void nwipe_update_speedring( nwipe_speedring_t* speedring, u64 speedring_done, time_t speedring_now );
#endif /* GUI_H_ */
/* eof */

View File

@@ -29,8 +29,10 @@ void isaac(ctx)
randctx *ctx;
{
register ub4 a,b,x,y,*m,*mm,*m2,*r,*mend;
mm=ctx->randmem; r=ctx->randrsl;
a = ctx->randa; b = ctx->randb + (++ctx->randc);
mm=ctx->randmem;
r=ctx->randrsl;
a = ctx->randa;
b = ctx->randb + (++ctx->randc);
for (m = mm, mend = m2 = m+(RANDSIZ/2); m<mend; )
{
rngstep( a<<13, a, b, mm, m, m2, r, x);
@@ -84,20 +86,44 @@ word flag;
/* initialize using the contents of r[] as the seed */
for (i=0; i<RANDSIZ; i+=8)
{
a+=r[i ]; b+=r[i+1]; c+=r[i+2]; d+=r[i+3];
e+=r[i+4]; f+=r[i+5]; g+=r[i+6]; h+=r[i+7];
a+=r[i ];
b+=r[i+1];
c+=r[i+2];
d+=r[i+3];
e+=r[i+4];
f+=r[i+5];
g+=r[i+6];
h+=r[i+7];
mix(a,b,c,d,e,f,g,h);
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
m[i ]=a;
m[i+1]=b;
m[i+2]=c;
m[i+3]=d;
m[i+4]=e;
m[i+5]=f;
m[i+6]=g;
m[i+7]=h;
}
/* do a second pass to make all of the seed affect all of m */
for (i=0; i<RANDSIZ; i+=8)
{
a+=m[i ]; b+=m[i+1]; c+=m[i+2]; d+=m[i+3];
e+=m[i+4]; f+=m[i+5]; g+=m[i+6]; h+=m[i+7];
a+=m[i ];
b+=m[i+1];
c+=m[i+2];
d+=m[i+3];
e+=m[i+4];
f+=m[i+5];
g+=m[i+6];
h+=m[i+7];
mix(a,b,c,d,e,f,g,h);
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
m[i ]=a;
m[i+1]=b;
m[i+2]=c;
m[i+3]=d;
m[i+4]=e;
m[i+5]=f;
m[i+6]=g;
m[i+7]=h;
}
}
else
@@ -106,8 +132,14 @@ word flag;
for (i=0; i<RANDSIZ; i+=8)
{
mix(a,b,c,d,e,f,g,h);
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
m[i ]=a;
m[i+1]=b;
m[i+2]=c;
m[i+3]=d;
m[i+4]=e;
m[i+5]=f;
m[i+6]=g;
m[i+7]=h;
}
}

View File

@@ -2,7 +2,7 @@
* logging.c: Logging facilities for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 2.
@@ -14,11 +14,21 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#include "stdio.h"
#include "stdlib.h"
#include "stdarg.h"
#include "nwipe.h"
#include "context.h"
#include "method.h"
@@ -26,197 +36,438 @@
#include "options.h"
#include "logging.h"
int const MAX_LOG_LINE_CHARS = 512;
/* Global array to hold log values to print when logging to STDOUT */
char **log_lines;
char** log_lines;
int log_current_element = 0;
int log_elements_allocated = 0;
int log_elements_displayed = 0;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
void nwipe_log( nwipe_log_t level, const char* format, ... )
{
/**
* Writes a message to the program log file.
*
*/
/**
* Writes a message to the program log file.
*
*/
char** result;
char* malloc_result;
char message_buffer[MAX_LOG_LINE_CHARS * sizeof( char )];
int chars_written;
/* A time buffer. */
time_t t;
int message_buffer_length;
int r; /* result buffer */
/* A pointer to the system time struct. */
struct tm* p;
/* A time buffer. */
time_t t;
/* Get the current time. */
t = time( NULL );
p = gmtime( &t );
/* A pointer to the system time struct. */
struct tm* p;
r = pthread_mutex_lock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_lock failed. Code %i \n", r );
return;
}
pthread_mutex_lock( &mutex1 );
/* Get the current time. */
t = time( NULL );
p = localtime( &t );
/* Increase the current log element pointer - we will write here */
if (log_current_element == log_elements_allocated) {
log_elements_allocated++;
log_lines = (char **) realloc (log_lines, (log_elements_allocated) * sizeof(char *));
log_lines[log_current_element] = malloc(MAX_LOG_LINE_CHARS * sizeof(char));
}
/* Position of writing to current log string */
int line_current_pos = 0;
/* Position of writing to current log string */
int line_current_pos = 0;
/* Print the date. The rc script uses the same format. */
line_current_pos = snprintf( log_lines[log_current_element], MAX_LOG_LINE_CHARS, "[%i/%02i/%02i %02i:%02i:%02i] nwipe: ", \
1900 + p->tm_year, 1 + p->tm_mon, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec );
/* Print the date. The rc script uses the same format. */
chars_written = snprintf( message_buffer,
MAX_LOG_LINE_CHARS,
"[%i/%02i/%02i %02i:%02i:%02i] nwipe: ",
1900 + p->tm_year,
1 + p->tm_mon,
p->tm_mday,
p->tm_hour,
p->tm_min,
p->tm_sec );
switch( level )
{
/*
* Has the end of the buffer been reached ?, snprintf returns the number of characters that would have been
* written if MAX_LOG_LINE_CHARS had not been reached, it does not return the actual characters written in
* all circumstances, hence why we need to check whether it's greater than MAX_LOG_LINE_CHARS and if so set
* it to MAX_LOG_LINE_CHARS, preventing a buffer overrun further down this function.
*/
case NWIPE_LOG_NONE:
/* Do nothing. */
break;
/* check if there was a complete failure to write this part of the message, in which case return */
if( chars_written < 0 )
{
fprintf( stderr, "nwipe_log: snprintf error when writing log line to memory.\n" );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
return;
}
}
else
{
if( ( line_current_pos + chars_written ) > MAX_LOG_LINE_CHARS )
{
fprintf( stderr,
"nwipe_log: Warning! The log line has been truncated as it exceeded %i characters\n",
MAX_LOG_LINE_CHARS );
line_current_pos = MAX_LOG_LINE_CHARS;
}
else
{
line_current_pos += chars_written;
}
}
case NWIPE_LOG_DEBUG:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "debug: " );
break;
if( line_current_pos < MAX_LOG_LINE_CHARS )
{
switch( level )
{
case NWIPE_LOG_INFO:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "info: " );
break;
case NWIPE_LOG_NONE:
/* Do nothing. */
break;
case NWIPE_LOG_NOTICE:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "notice: " );
break;
case NWIPE_LOG_DEBUG:
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "debug: " );
break;
case NWIPE_LOG_WARNING:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "warning: " );
break;
case NWIPE_LOG_INFO:
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "info: " );
break;
case NWIPE_LOG_ERROR:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "error: " );
break;
case NWIPE_LOG_NOTICE:
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "notice: " );
break;
case NWIPE_LOG_FATAL:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "fatal: " );
break;
case NWIPE_LOG_WARNING:
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "warning: " );
break;
case NWIPE_LOG_SANITY:
/* TODO: Request that the user report the log. */
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "sanity: " );
break;
case NWIPE_LOG_ERROR:
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "error: " );
break;
default:
line_current_pos += snprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, "level %i: ", level );
case NWIPE_LOG_FATAL:
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "fatal: " );
break;
}
case NWIPE_LOG_SANITY:
/* TODO: Request that the user report the log. */
chars_written =
snprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "sanity: " );
break;
/* The variable argument pointer. */
va_list ap;
default:
chars_written = snprintf(
message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos, "level %i: ", level );
}
/* Fetch the argument list. */
va_start( ap, format );
/*
* Has the end of the buffer been reached ?
*/
if( chars_written < 0 )
{
fprintf( stderr, "nwipe_log: snprintf error when writing log line to memory.\n" );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
return;
}
}
else
{
if( ( line_current_pos + chars_written ) > MAX_LOG_LINE_CHARS )
{
fprintf( stderr,
"nwipe_log: Warning! The log line has been truncated as it exceeded %i characters\n",
MAX_LOG_LINE_CHARS );
line_current_pos = MAX_LOG_LINE_CHARS;
}
else
{
line_current_pos += chars_written;
}
}
}
/* Print the event. */
line_current_pos += vsnprintf( log_lines[log_current_element] + line_current_pos, MAX_LOG_LINE_CHARS, format, ap );
/* The variable argument pointer. */
va_list ap;
/*
if( level >= NWIPE_LOG_WARNING )
{
vfprintf( stderr, format, ap );
}
*/
/* Fetch the argument list. */
va_start( ap, format );
/* Release the argument list. */
va_end( ap );
/* Print the event. */
if( line_current_pos < MAX_LOG_LINE_CHARS )
{
chars_written =
vsnprintf( message_buffer + line_current_pos, MAX_LOG_LINE_CHARS - line_current_pos - 1, format, ap );
/*
if( level >= NWIPE_LOG_WARNING )
{
fprintf( stderr, "\n" );
}
*/
if( chars_written < 0 )
{
fprintf( stderr, "nwipe_log: snprintf error when writing log line to memory.\n" );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
va_end( ap );
return;
}
}
else
{
if( ( line_current_pos + chars_written ) > MAX_LOG_LINE_CHARS )
{
fprintf( stderr,
"nwipe_log: Warning! The log line has been truncated as it exceeded %i characters\n",
MAX_LOG_LINE_CHARS );
line_current_pos = MAX_LOG_LINE_CHARS;
}
else
{
line_current_pos += chars_written;
}
}
}
/* A result buffer. */
int r;
fflush( stdout );
/* Increase the current log element pointer - we will write here, deallocation is done in cleanup() in nwipe.c */
if( log_current_element == log_elements_allocated )
{
log_elements_allocated++;
result = realloc( log_lines, ( log_elements_allocated ) * sizeof( char* ) );
if( result == NULL )
{
fprintf( stderr, "nwipe_log: realloc failed when adding a log line.\n" );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
va_end( ap );
return;
}
}
log_lines = result;
/* The log file pointer. */
FILE* fp;
/* Allocate memory for storing a single log message, deallocation is done in cleanup() in nwipe.c */
message_buffer_length = strlen( message_buffer ) * sizeof( char );
malloc_result = malloc( ( message_buffer_length + 1 ) * sizeof( char ) );
if( malloc_result == NULL )
{
fprintf( stderr, "nwipe_log: malloc failed when adding a log line.\n" );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
va_end( ap );
return;
}
}
log_lines[log_current_element] = malloc_result;
}
/* The log file descriptor. */
int fd;
strcpy( log_lines[log_current_element], message_buffer );
/*
if( level >= NWIPE_LOG_WARNING )
{
vfprintf( stderr, format, ap );
}
*/
if (nwipe_options.logfile[0] == '\0')
{
if (nwipe_options.nogui)
{
printf( "%s\n", log_lines[log_current_element] );
}
else
{
log_current_element++;
}
} else
{
/* Open the log file for appending. */
fp = fopen( nwipe_options.logfile, "a" );
/* Release the argument list. */
va_end( ap );
if( fp == NULL )
{
fprintf( stderr, "nwipe_log: Unable to open '%s' for logging.\n", nwipe_options.logfile );
return;
}
/* Get the file descriptor of the log file. */
fd = fileno( fp );
/*
if( level >= NWIPE_LOG_WARNING )
{
fprintf( stderr, "\n" );
}
*/
/* Block and lock. */
r = flock( fd, LOCK_EX );
/* The log file pointer. */
FILE* fp;
if( r != 0 )
{
perror( "nwipe_log: flock:" );
fprintf( stderr, "nwipe_log: Unable to lock '%s' for logging.\n", nwipe_options.logfile );
return;
}
/* The log file descriptor. */
int fd;
fprintf( fp, "%s\n", log_lines[log_current_element] );
if( nwipe_options.logfile[0] == '\0' )
{
if( nwipe_options.nogui )
{
printf( "%s\n", log_lines[log_current_element] );
log_elements_displayed++;
}
}
else
{
/* Open the log file for appending. */
fp = fopen( nwipe_options.logfile, "a" );
/* Unlock the file. */
r = flock( fd, LOCK_UN );
if( fp == NULL )
{
fprintf( stderr, "nwipe_log: Unable to open '%s' for logging.\n", nwipe_options.logfile );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
return;
}
}
if( r != 0 )
{
perror( "nwipe_log: flock:" );
fprintf( stderr, "Error: Unable to unlock '%s' after logging.\n", nwipe_options.logfile );
}
/* Get the file descriptor of the log file. */
fd = fileno( fp );
/* Close the stream. */
r = fclose( fp );
/* Block and lock. */
r = flock( fd, LOCK_EX );
if( r != 0 )
{
perror( "nwipe_log: fclose:" );
fprintf( stderr, "Error: Unable to close '%s' after logging.\n", nwipe_options.logfile );
}
}
pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
perror( "nwipe_log: flock:" );
fprintf( stderr, "nwipe_log: Unable to lock '%s' for logging.\n", nwipe_options.logfile );
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
/* Unlock the file. */
r = flock( fd, LOCK_UN );
fclose( fp );
return;
}
}
fprintf( fp, "%s\n", log_lines[log_current_element] );
/* Unlock the file. */
r = flock( fd, LOCK_UN );
if( r != 0 )
{
perror( "nwipe_log: flock:" );
fprintf( stderr, "Error: Unable to unlock '%s' after logging.\n", nwipe_options.logfile );
}
/* Close the stream. */
r = fclose( fp );
if( r != 0 )
{
perror( "nwipe_log: fclose:" );
fprintf( stderr, "Error: Unable to close '%s' after logging.\n", nwipe_options.logfile );
}
}
log_current_element++;
r = pthread_mutex_unlock( &mutex1 );
if( r != 0 )
{
fprintf( stderr, "nwipe_log: pthread_mutex_unlock failed. Code %i \n", r );
}
return;
} /* nwipe_log */
void nwipe_perror( int nwipe_errno, const char* f, const char* s )
{
/**
* Wrapper for perror().
*
* We may wish to tweak or squelch this later.
*
*/
/**
* Wrapper for perror().
*
* We may wish to tweak or squelch this later.
*
*/
nwipe_log( NWIPE_LOG_ERROR, "%s: %s: %s", f, s, strerror( nwipe_errno ) );
nwipe_log( NWIPE_LOG_ERROR, "%s: %s: %s", f, s, strerror( nwipe_errno ) );
} /* nwipe_perror */
/* eof */
int nwipe_log_sysinfo()
{
FILE* fp;
char path[256];
int len;
int r; // A result buffer.
/*
* Remove or add keywords to be searched, depending on what information is to
* be logged, making sure the last entry in the array is a NULL string. To remove
* an entry simply comment out the keyword with //
*/
char dmidecode_keywords[][24] = {
"bios-version",
"bios-release-date",
"system-manufacturer",
"system-product-name",
"system-version",
"system-serial-number",
"system-uuid",
"baseboard-manufacturer",
"baseboard-product-name",
"baseboard-version",
"baseboard-serial-number",
"baseboard-asset-tag",
"chassis-manufacturer",
"chassis-type",
"chassis-version",
"chassis-serial-number",
"chassis-asset-tag",
"processor-family",
"processor-manufacturer",
"processor-version",
"processor-frequency",
"" // terminates the keyword array. DO NOT REMOVE
};
char dmidecode_command[] = "dmidecode -s %s";
char cmd[sizeof( dmidecode_keywords ) + sizeof( dmidecode_command )];
unsigned int keywords_idx;
keywords_idx = 0;
/* Run the dmidecode command to retrieve each dmidecode keyword, one at a time */
while( dmidecode_keywords[keywords_idx][0] != 0 )
{
sprintf( cmd, dmidecode_command, &dmidecode_keywords[keywords_idx][0] );
fp = popen( cmd, "r" );
if( fp == NULL )
{
nwipe_log( NWIPE_LOG_INFO, "nwipe_log_sysinfo: Failed to create stream to %s", cmd );
return 1;
}
/* Read the output a line at a time - output it. */
while( fgets( path, sizeof( path ) - 1, fp ) != NULL )
{
/* Remove any trailing return from the string, as nwipe_log automatically adds a return */
len = strlen( path );
if( path[len - 1] == '\n' )
{
path[len - 1] = 0;
}
nwipe_log( NWIPE_LOG_INFO, "%s = %s", &dmidecode_keywords[keywords_idx][0], path );
}
/* close */
r = pclose( fp );
if( r > 0 )
{
nwipe_log( NWIPE_LOG_INFO,
"nwipe_log_sysinfo(): dmidecode failed, \"%s\" exit status = %u",
cmd,
WEXITSTATUS( r ) );
return 1;
}
keywords_idx++;
}
return 0;
}

View File

@@ -14,34 +14,29 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef LOGGING_H_
#define LOGGING_H_
typedef enum nwipe_log_t_
{
NWIPE_LOG_NONE = 0,
NWIPE_LOG_DEBUG, /* TODO: Very verbose logging. */
NWIPE_LOG_INFO, /* TODO: Verbose logging. */
NWIPE_LOG_NOTICE, /* Most logging happens at this level. */
NWIPE_LOG_WARNING, /* Things that the user should know about. */
NWIPE_LOG_ERROR, /* Non-fatal errors that result in failure. */
NWIPE_LOG_FATAL, /* Errors that cause the program to exit. */
NWIPE_LOG_SANITY /* Programming errors. */
/* Maximum size of a log message */
#define MAX_LOG_LINE_CHARS 512
typedef enum nwipe_log_t_ {
NWIPE_LOG_NONE = 0,
NWIPE_LOG_DEBUG, // TODO: Very verbose logging.
NWIPE_LOG_INFO, // TODO: Verbose logging.
NWIPE_LOG_NOTICE, // Most logging happens at this level.
NWIPE_LOG_WARNING, // Things that the user should know about.
NWIPE_LOG_ERROR, // Non-fatal errors that result in failure.
NWIPE_LOG_FATAL, // Errors that cause the program to exit.
NWIPE_LOG_SANITY // Programming errors.
} nwipe_log_t;
void nwipe_log( nwipe_log_t level, const char* format, ... );
void nwipe_perror( int nwipe_errno, const char* f, const char* s );
/* Global array to hold log values to print when logging to STDOUT */
//extern char **log_lines;
//extern int log_current_element;
//extern int log_elements_allocated;
int nwipe_log_sysinfo();
#endif /* LOGGING_H_ */
/* eof */

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* methods.c: Method implementations for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,43 +16,43 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef METHOD_H_
#define METHOD_H_
/* The argument list for nwipe methods. */
#define NWIPE_METHOD_SIGNATURE nwipe_context_t* c
typedef enum nwipe_verify_t_
{
NWIPE_VERIFY_NONE = 0, /* Do not read anything back from the device. */
NWIPE_VERIFY_LAST, /* Check the last pass. */
NWIPE_VERIFY_ALL, /* Check all passes. */
typedef enum nwipe_verify_t_ {
NWIPE_VERIFY_NONE = 0, // Do not read anything back from the device.
NWIPE_VERIFY_LAST, // Check the last pass.
NWIPE_VERIFY_ALL, // Check all passes.
} nwipe_verify_t;
/* The typedef of the function that will do the wipe. */
typedef int(*nwipe_method_t)( void *ptr );
typedef int ( *nwipe_method_t )( void* ptr );
typedef struct /* nwipe_pattern_t */
typedef struct
{
int length; /* Length of the pattern in bytes, -1 means random. */
char* s; /* The actual bytes of the pattern. */
int length; // Length of the pattern in bytes, -1 means random.
char* s; // The actual bytes of the pattern.
} nwipe_pattern_t;
const char* nwipe_method_label( void* method );
int nwipe_runmethod( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* patterns );
void *nwipe_dod522022m( void *ptr );
void *nwipe_dodshort( void *ptr );
void *nwipe_gutmann( void *ptr );
void *nwipe_ops2( void *ptr );
void *nwipe_random( void *ptr );
void *nwipe_zero( void *ptr );
void* nwipe_dod522022m( void* ptr );
void* nwipe_dodshort( void* ptr );
void* nwipe_gutmann( void* ptr );
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 calculate_round_size( nwipe_context_t* );
#endif /* METHOD_H_ */
/* eof */

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/*
/*.
* nwipe.h: The header file of the nwipe program.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,13 +16,16 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef NWIPE_H_
#define NWIPE_H_
/* Function prototypes */
int cleanup();
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
@@ -31,6 +34,15 @@
#define _FILE_OFFSET_BITS 64
#endif
/* workaround for Fedora */
#ifndef off64_t
#ifndef off_t
#define off64_t int64_t
#else
#define off64_t off_t
#endif
#endif
/* Busybox headers. */
#ifdef BB_VER
#include "busybox.h"
@@ -60,18 +72,22 @@
extern int errno;
/* Global array to hold log values to print when logging to STDOUT */
extern char **log_lines;
extern int log_current_element;
extern int log_elements_allocated;
extern pthread_mutex_t mutex1;
/* char **log_lines;
int log_current_element = 0;
int log_elements_allocated = 0;
int log_elements_displayed = 0;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; */
/* Ncurses headers. Assume panel.h is in same place.*/
/* Ncurses headers. */
#ifdef NCURSES_IN_SUBDIR
#include <ncurses/ncurses.h>
#include <ncurses/panel.h>
#include <ncurses/ncurses.h>
#else
#include <ncurses.h>
#include <panel.h>
#include <ncurses.h>
#endif
#ifdef PANEL_IN_SUBDIR
#include <ncurses/panel.h>
#else
#include <panel.h>
#endif
/* Kernel device headers. */
@@ -79,24 +95,22 @@ extern pthread_mutex_t mutex1;
/* These types are usually defined in <asm/types.h> for __KERNEL__ code. */
typedef unsigned long long u64;
typedef unsigned long u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef unsigned long u32;
typedef unsigned short u16;
typedef unsigned char u8;
/* This is required for ioctl BLKGETSIZE64, but it conflicts with <wait.h>. */
/* #include <linux/fs.h> */
/* Define ioctls that cannot be included. */
#define BLKSSZGET _IO(0x12,104)
#define BLKBSZGET _IOR(0x12,112,size_t)
#define BLKBSZSET _IOW(0x12,113,size_t)
#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64))
#define BLKSSZGET _IO( 0x12, 104 )
#define BLKBSZGET _IOR( 0x12, 112, size_t )
#define BLKBSZSET _IOW( 0x12, 113, size_t )
#define BLKGETSIZE64 _IOR( 0x12, 114, sizeof( u64 ) )
/* This is required for ioctl FDFLUSH. */
#include <linux/fd.h>
void *signal_hand(void *);
void* signal_hand( void* );
#endif /* NWIPE_H_ */
/* eof */

View File

@@ -1,10 +1,10 @@
/*
* options.c: Command line processing routines for nwipe.
* options.c: Command line processing routines for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 2.
@@ -16,11 +16,10 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include "nwipe.h"
#include "context.h"
#include "method.h"
@@ -34,370 +33,448 @@ nwipe_options_t nwipe_options;
int nwipe_options_parse( int argc, char** argv )
{
extern char* optarg; /* The working getopt option argument. */
extern int optind; /* The working getopt index into argv. */
extern int optopt; /* The last unhandled getopt option. */
extern int opterr; /* The last getopt error number. */
extern char* optarg; // The working getopt option argument.
extern int optind; // The working getopt index into argv.
extern int optopt; // The last unhandled getopt option.
extern int opterr; // The last getopt error number.
extern nwipe_prng_t nwipe_twister;
extern nwipe_prng_t nwipe_isaac;
/* The maximum banner size, including the null. */
const int nwipe_banner_size = 81;
/* The getopt() result holder. */
int nwipe_opt;
/* Array index variable. */
int i;
/* The list of acceptable short options. */
char nwipe_options_short [] = "Vhl:hm:p:r:";
/* 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 },
/* A GNU standard option. Corresponds to the 'h' short option. */
{ "help", no_argument, 0, 'h' },
/* The wipe method. Corresponds to the 'm' short option. */
{ "method", required_argument, 0, 'm' },
/* Log file. Corresponds to the 'l' short option. */
{ "logfile", required_argument, 0, 'l' },
/* The Pseudo Random Number Generator. */
{ "prng", required_argument, 0, 'p' },
/* The number of times to run the method. */
{ "rounds", required_argument, 0, 'r' },
/* Whether to blank the disk after wiping. */
{ "noblank", no_argument, 0, 0 },
/* Whether to exit after wiping or wait for a keypress. */
{ "nowait", no_argument, 0, 0 },
/* Whether to exit after wiping or wait for a keypress. */
{ "nogui", no_argument, 0, 0 },
/* A flag to indicate whether the devices whould be opened in sync mode. */
{ "sync", no_argument, 0, 0 },
/* Verify that wipe patterns are being written to the device. */
{ "verify", required_argument, 0, 0 },
/* Display program version. */
{ "version", no_argument, 0, 'V' },
/* Requisite padding for getopt(). */
{ 0, 0, 0, 0 }
};
/* Note that COLS isn't available until ncurses is initialized. */
nwipe_options.banner = malloc( nwipe_banner_size );
/* Set the default product banner. */
/* TODO: Add version constant. */
strncpy ( nwipe_options.banner, program_name, nwipe_banner_size);
strncat ( nwipe_options.banner, " ", nwipe_banner_size - strlen (nwipe_options.banner) - 1);
strncat ( nwipe_options.banner, version_string, nwipe_banner_size - strlen (nwipe_options.banner) - 1);
strncat ( nwipe_options.banner, " (based on DBAN's dwipe - Darik's Wipe)", nwipe_banner_size - strlen (nwipe_options.banner) - 1);
/* Set default options. */
nwipe_options.autonuke = 0;
nwipe_options.method = &nwipe_dodshort;
nwipe_options.prng = &nwipe_twister;
nwipe_options.rounds = 1;
nwipe_options.noblank = 0;
nwipe_options.nowait = 0;
nwipe_options.nogui = 0;
nwipe_options.sync = 0;
nwipe_options.verify = NWIPE_VERIFY_LAST;
memset( nwipe_options.logfile, '\0', sizeof(nwipe_options.logfile) );
/* Parse command line options. */
while( 1 )
{
/* Get the next command line option with (3)getopt. */
nwipe_opt = getopt_long( argc, argv, nwipe_options_short, nwipe_options_long, &i );
/* Break when we have processed all of the given options. */
if( nwipe_opt < 0 ) { break; }
switch( nwipe_opt )
{
case 0: /* Long options without short counterparts. */
if( strcmp( nwipe_options_long[i].name, "autonuke" ) == 0 )
{
nwipe_options.autonuke = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "noblank" ) == 0 )
{
nwipe_options.noblank = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "nowait" ) == 0 )
{
nwipe_options.nowait = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "nogui" ) == 0 )
{
nwipe_options.nogui = 1;
nwipe_options.nowait = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "sync" ) == 0 )
{
nwipe_options.sync = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "verify" ) == 0 )
{
if( strcmp( optarg, "0" ) == 0 || strcmp( optarg, "off" ) == 0 )
{
nwipe_options.verify = NWIPE_VERIFY_NONE;
break;
}
if( strcmp( optarg, "1" ) == 0 || strcmp( optarg, "last" ) == 0 )
{
nwipe_options.verify = NWIPE_VERIFY_LAST;
break;
}
if( strcmp( optarg, "2" ) == 0 || strcmp( optarg, "all" ) == 0 )
{
nwipe_options.verify = NWIPE_VERIFY_ALL;
break;
}
/* Else we do not know this verification level. */
fprintf( stderr, "Error: Unknown verification level '%s'.\n", optarg );
exit( EINVAL );
}
case 'm': /* Method option. */
if( strcmp( optarg, "dod522022m" ) == 0 || strcmp( optarg, "dod" ) == 0 )
{
nwipe_options.method = &nwipe_dod522022m;
break;
}
if( strcmp( optarg, "dodshort" ) == 0 || strcmp( optarg, "dod3pass" ) == 0 )
{
nwipe_options.method = &nwipe_dodshort;
break;
}
if( strcmp( optarg, "gutmann" ) == 0 )
{
nwipe_options.method = &nwipe_gutmann;
break;
}
if( strcmp( optarg, "ops2" ) == 0 )
{
nwipe_options.method = &nwipe_ops2;
break;
}
if( strcmp( optarg, "random" ) == 0
|| strcmp( optarg, "prng" ) == 0
|| strcmp( optarg, "stream" ) == 0
)
{
nwipe_options.method= &nwipe_random;
break;
}
if( strcmp( optarg, "zero" ) == 0 || strcmp( optarg, "quick" ) == 0 )
{
nwipe_options.method = &nwipe_zero;
break;
}
/* Else we do not know this wipe method. */
fprintf( stderr, "Error: Unknown wipe method '%s'.\n", optarg );
exit( EINVAL );
case 'l': /* Log file option. */
nwipe_options.logfile[strlen(optarg)] = '\0';
strncpy(nwipe_options.logfile, optarg, sizeof(nwipe_options.logfile));
break;
case 'h': /* Display help. */
display_help();
break;
case 'p': /* PRNG option. */
if( strcmp( optarg, "mersenne" ) == 0
|| strcmp( optarg, "twister" ) == 0
)
{
nwipe_options.prng = &nwipe_twister;
break;
}
if( strcmp( optarg, "isaac" ) == 0 )
{
nwipe_options.prng = &nwipe_isaac;
break;
}
/* Else we do not know this PRNG. */
fprintf( stderr, "Error: Unknown prng '%s'.\n", optarg );
exit( EINVAL );
case 'r': /* Rounds option. */
if( sscanf( optarg, " %i", &nwipe_options.rounds ) != 1 \
|| nwipe_options.rounds < 1
)
{
fprintf( stderr, "Error: The rounds argument must be a postive integer.\n" );
exit( EINVAL );
}
break;
case 'V': /* Rounds option. */
printf ( "%s version %s\n", program_name, version_string );
exit( EXIT_SUCCESS );
default:
/* Bogus command line argument. */
display_help();
exit( EINVAL );
} /* method */
} /* command line options */
/* Return the number of options that were processed. */
return optind;
} /* nwipe_options_parse */
extern nwipe_prng_t nwipe_twister;
extern nwipe_prng_t nwipe_isaac;
/* The getopt() result holder. */
int nwipe_opt;
/* Excluded drive indexes */
int idx_drive_chr;
int idx_optarg;
int idx_drive;
/* Array index variable. */
int i;
/* The list of acceptable short options. */
char nwipe_options_short[] = "Vhl:m:p:r:e:";
/* 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},
/* A GNU standard option. Corresponds to the 'h' short option. */
{"help", no_argument, 0, 'h'},
/* The wipe method. Corresponds to the 'm' short option. */
{"method", required_argument, 0, 'm'},
/* Log file. Corresponds to the 'l' short option. */
{"logfile", required_argument, 0, 'l'},
/* Exclude devices, comma separated list */
{"exclude", required_argument, 0, 'e'},
/* The Pseudo Random Number Generator. */
{"prng", required_argument, 0, 'p'},
/* The number of times to run the method. */
{"rounds", required_argument, 0, 'r'},
/* Whether to blank the disk after wiping. */
{"noblank", no_argument, 0, 0},
/* Whether to exit after wiping or wait for a keypress. */
{"nowait", no_argument, 0, 0},
/* Whether to allow signals to interrupt a wipe. */
{"nosignals", no_argument, 0, 0},
/* Whether to exit after wiping or wait for a keypress. */
{"nogui", no_argument, 0, 0},
/* A flag to indicate whether the devices whould be opened in sync mode. */
{"sync", required_argument, 0, 0},
/* Verify that wipe patterns are being written to the device. */
{"verify", required_argument, 0, 0},
/* Display program version. */
{"version", no_argument, 0, 'V'},
/* Requisite padding for getopt(). */
{0, 0, 0, 0}};
/* Set default options. */
nwipe_options.autonuke = 0;
nwipe_options.method = &nwipe_dodshort;
nwipe_options.prng = &nwipe_twister;
nwipe_options.rounds = 1;
nwipe_options.noblank = 0;
nwipe_options.nowait = 0;
nwipe_options.nosignals = 0;
nwipe_options.nogui = 0;
nwipe_options.sync = 100000;
nwipe_options.verify = NWIPE_VERIFY_LAST;
memset( nwipe_options.logfile, '\0', sizeof( nwipe_options.logfile ) );
/* Initialise each of the strings in the excluded drives array */
for( i = 0; i < MAX_NUMBER_EXCLUDED_DRIVES; i++ )
{
nwipe_options.exclude[i][0] = 0;
}
/* Parse command line options. */
while( 1 )
{
/* Get the next command line option with (3)getopt. */
nwipe_opt = getopt_long( argc, argv, nwipe_options_short, nwipe_options_long, &i );
/* Break when we have processed all of the given options. */
if( nwipe_opt < 0 )
{
break;
}
switch( nwipe_opt )
{
case 0: /* Long options without short counterparts. */
if( strcmp( nwipe_options_long[i].name, "autonuke" ) == 0 )
{
nwipe_options.autonuke = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "noblank" ) == 0 )
{
nwipe_options.noblank = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "nowait" ) == 0 )
{
nwipe_options.nowait = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "nosignals" ) == 0 )
{
nwipe_options.nosignals = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "nogui" ) == 0 )
{
nwipe_options.nogui = 1;
nwipe_options.nowait = 1;
break;
}
if( strcmp( nwipe_options_long[i].name, "sync" ) == 0 )
{
if( sscanf( optarg, " %i", &nwipe_options.sync ) != 1 || nwipe_options.sync < 1 )
{
fprintf( stderr, "Error: The sync argument must be a positive integer.\n" );
exit( EINVAL );
}
break;
}
if( strcmp( nwipe_options_long[i].name, "verify" ) == 0 )
{
if( strcmp( optarg, "0" ) == 0 || strcmp( optarg, "off" ) == 0 )
{
nwipe_options.verify = NWIPE_VERIFY_NONE;
break;
}
if( strcmp( optarg, "1" ) == 0 || strcmp( optarg, "last" ) == 0 )
{
nwipe_options.verify = NWIPE_VERIFY_LAST;
break;
}
if( strcmp( optarg, "2" ) == 0 || strcmp( optarg, "all" ) == 0 )
{
nwipe_options.verify = NWIPE_VERIFY_ALL;
break;
}
/* Else we do not know this verification level. */
fprintf( stderr, "Error: Unknown verification level '%s'.\n", optarg );
exit( EINVAL );
}
/* getopt_long should raise on invalid option, so we should never get here. */
exit( EINVAL );
case 'm': /* Method option. */
if( strcmp( optarg, "dod522022m" ) == 0 || strcmp( optarg, "dod" ) == 0 )
{
nwipe_options.method = &nwipe_dod522022m;
break;
}
if( strcmp( optarg, "dodshort" ) == 0 || strcmp( optarg, "dod3pass" ) == 0 )
{
nwipe_options.method = &nwipe_dodshort;
break;
}
if( strcmp( optarg, "gutmann" ) == 0 )
{
nwipe_options.method = &nwipe_gutmann;
break;
}
if( strcmp( optarg, "ops2" ) == 0 )
{
nwipe_options.method = &nwipe_ops2;
break;
}
if( strcmp( optarg, "random" ) == 0 || strcmp( optarg, "prng" ) == 0
|| strcmp( optarg, "stream" ) == 0 )
{
nwipe_options.method = &nwipe_random;
break;
}
if( strcmp( optarg, "zero" ) == 0 || strcmp( optarg, "quick" ) == 0 )
{
nwipe_options.method = &nwipe_zero;
break;
}
if( strcmp( optarg, "verify" ) == 0 )
{
nwipe_options.method = &nwipe_verify;
break;
}
if( strcmp( optarg, "is5enh" ) == 0 )
{
nwipe_options.method = &nwipe_is5enh;
break;
}
/* Else we do not know this wipe method. */
fprintf( stderr, "Error: Unknown wipe method '%s'.\n", optarg );
exit( EINVAL );
case 'l': /* Log file option. */
nwipe_options.logfile[strlen( optarg )] = '\0';
strncpy( nwipe_options.logfile, optarg, sizeof( nwipe_options.logfile ) );
break;
case 'e': /* exclude drives option */
idx_drive_chr = 0;
idx_optarg = 0;
idx_drive = 0;
/* Create an array of excluded drives from the comma separated string */
while( optarg[idx_optarg] != 0 && idx_drive < MAX_NUMBER_EXCLUDED_DRIVES )
{
/* drop the leading '=' character if used */
if( optarg[idx_optarg] == '=' && idx_optarg == 0 )
{
idx_optarg++;
continue;
}
if( optarg[idx_optarg] == ',' )
{
/* terminate string and move onto next drive */
nwipe_options.exclude[idx_drive++][idx_drive_chr] = 0;
idx_drive_chr = 0;
idx_optarg++;
}
else
{
if( idx_drive_chr < MAX_DRIVE_PATH_LENGTH )
{
nwipe_options.exclude[idx_drive][idx_drive_chr++] = optarg[idx_optarg++];
}
else
{
/* This section deals with file names that exceed MAX_DRIVE_PATH_LENGTH */
nwipe_options.exclude[idx_drive][idx_drive_chr] = 0;
while( optarg[idx_optarg] != 0 && optarg[idx_optarg] != ',' )
{
idx_optarg++;
}
}
}
}
break;
case 'h': /* Display help. */
display_help();
break;
case 'p': /* PRNG option. */
if( strcmp( optarg, "mersenne" ) == 0 || strcmp( optarg, "twister" ) == 0 )
{
nwipe_options.prng = &nwipe_twister;
break;
}
if( strcmp( optarg, "isaac" ) == 0 )
{
nwipe_options.prng = &nwipe_isaac;
break;
}
/* Else we do not know this PRNG. */
fprintf( stderr, "Error: Unknown prng '%s'.\n", optarg );
exit( EINVAL );
case 'r': /* Rounds option. */
if( sscanf( optarg, " %i", &nwipe_options.rounds ) != 1 || nwipe_options.rounds < 1 )
{
fprintf( stderr, "Error: The rounds argument must be a positive integer.\n" );
exit( EINVAL );
}
break;
case 'V': /* Version option. */
printf( "%s version %s\n", program_name, version_string );
exit( EXIT_SUCCESS );
default:
/* Bogus command line argument. */
display_help();
exit( EINVAL );
} /* method */
} /* command line options */
/* Return the number of options that were processed. */
return optind;
}
void nwipe_options_log( void )
{
/**
* Prints a manifest of options to the log.
*
*/
/**
* Prints a manifest of options to the log.
*/
nwipe_log( NWIPE_LOG_NOTICE, "Program options are set as follows..." );
nwipe_log( NWIPE_LOG_NOTICE, "Program options are set as follows..." );
if( nwipe_options.autonuke )
{
nwipe_log( NWIPE_LOG_NOTICE, " autonuke = %i (on)", nwipe_options.autonuke );
}
if( nwipe_options.autonuke )
{
nwipe_log( NWIPE_LOG_NOTICE, " autonuke = %i (on)", nwipe_options.autonuke );
}
else
{
nwipe_log( NWIPE_LOG_NOTICE, " autonuke = %i (off)", nwipe_options.autonuke );
}
else
{
nwipe_log( NWIPE_LOG_NOTICE, " autonuke = %i (off)", nwipe_options.autonuke );
}
if( nwipe_options.noblank )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not perform a final blank pass" );
}
if( nwipe_options.noblank )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not perform a final blank pass" );
}
if( nwipe_options.nowait )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not wait for a key before exiting" );
}
if( nwipe_options.nowait )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not wait for a key before exiting" );
}
if( nwipe_options.nosignals )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not allow signals to interrupt a wipe" );
}
if( nwipe_options.nogui )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not show GUI interface" );
}
if( nwipe_options.nogui )
{
nwipe_log( NWIPE_LOG_NOTICE, " do not show GUI interface" );
}
nwipe_log( NWIPE_LOG_NOTICE, " banner = %s", nwipe_options.banner );
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 );
nwipe_log( NWIPE_LOG_NOTICE, " banner = %s", banner );
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 );
switch( nwipe_options.verify )
{
case NWIPE_VERIFY_NONE:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i (off)", nwipe_options.verify );
break;
switch( nwipe_options.verify )
{
case NWIPE_VERIFY_NONE:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i (off)", nwipe_options.verify );
break;
case NWIPE_VERIFY_LAST:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i (last pass)", nwipe_options.verify );
break;
case NWIPE_VERIFY_LAST:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i (last pass)", nwipe_options.verify );
break;
case NWIPE_VERIFY_ALL:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i (all passes)", nwipe_options.verify );
break;
case NWIPE_VERIFY_ALL:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i (all passes)", nwipe_options.verify );
break;
default:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i", nwipe_options.verify );
break;
}
} /* nwipe_options_log */
/**
* display_help
* displays the help section to STDOUT and exits
*/
void
display_help()
{
printf("Usage: %s [options] [device1] [device2] ...\n", program_name);
printf("Options:\n" );
puts(" -V, --version Prints the version number");
puts(" -h, --help Prints this help");
puts(" --autonuke If no devices have been specified on the command line, starts wiping all");
puts(" devices immediately. If devices have been specified, starts wiping only");
puts(" those specified devices immediately.");
puts(" --sync Open devices in sync mode");
puts(" --verify=TYPE Whether to perform verification of erasure (default: last)");
puts(" off - Do not verify");
puts(" last - Verify after the last pass");
puts(" all - Verify every pass");
puts(" -m, --method=METHOD The wiping method (default: dodshort). See man page for more details.");
puts(" dod522022m / dod - 7 pass DOD 5220.22-M method");
puts(" dodshort / dod3pass - 3 pass DOD method");
puts(" gutmann - Peter Gutmann's Algorithm");
puts(" ops2 - RCMP TSSIT OPS-II");
puts(" random / prng / stream - PRNG Stream");
puts(" zero / quick - Overwrite with zeros");
puts(" -l, --logfile=FILE Filename to log to. Default is STDOUT");
puts(" -p, --prng=METHOD PRNG option (mersenne|twister|isaac)" );
puts(" -r, --rounds=NUM Number of times to wipe the device using the selected method (default: 1)" );
puts(" --noblank Do not blank disk after wipe (default is to complete a final blank pass)" );
puts(" --nowait Do not wait for a key before exiting (default is to wait)" );
puts(" --nogui Do not show the GUI interface. Automatically invokes the nowait option" );
puts(" Must be used with --autonuke option. Send SIGUSR1 to log current stats");
puts("");
exit( EXIT_SUCCESS );
default:
nwipe_log( NWIPE_LOG_NOTICE, " verify = %i", nwipe_options.verify );
break;
}
}
/* eof */
void display_help()
{
/**
* displays the help section to STDOUT and exits.
*/
printf( "Usage: %s [options] [device1] [device2] ...\n", program_name );
printf( "Options:\n" );
/* Limit line length to a maximum of 80 characters so it looks good in 80x25 terminals i.e shredos */
/* ___12345678901234567890123456789012345678901234567890123456789012345678901234567890< Do not exceed */
puts( " -V, --version Prints the version number\n" );
puts( " -h, --help Prints this help\n" );
puts( " --autonuke If no devices have been specified on the command line," );
puts( " starts wiping all devices immediately. If devices have" );
puts( " been specified, starts wiping only those specified" );
puts( " devices immediately.\n" );
puts( " --sync=NUM Will perform a sync after NUM writes (default: 0)" );
puts( " 0 - fdatasync after the disk is completely written" );
puts( " 1 - fdatasync after every write" );
puts( " 1000000 - fdatasync after 1000000 writes ect." );
puts( " --verify=TYPE Whether to perform verification of erasure" );
puts( " (default: last)" );
puts( " off - Do not verify" );
puts( " last - Verify after the last pass" );
puts( " all - Verify every pass\n" );
puts( " -m, --method=METHOD The wiping method. See man page for more details." );
puts( " (default: dodshort)" );
puts( " dod522022m / dod - 7 pass DOD 5220.22-M method" );
puts( " dodshort / dod3pass - 3 pass DOD method" );
puts( " gutmann - Peter Gutmann's Algorithm" );
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( " -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( " (default is to complete a final blank pass)\n" );
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( " (default is to allow)\n" );
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( " -e, --exclude=DEVICES Up to ten comma separated devices to be excluded" );
puts( " --exclude=/dev/sdc" );
puts( " --exclude=/dev/sdc,/dev/sdd" );
puts( " --exclude=/dev/sdc,/dev/sdd,/dev/mapper/cryptswap1\n" );
puts( "" );
exit( EXIT_SUCCESS );
}

View File

@@ -2,7 +2,7 @@
* options.h: Command line processing routines for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,26 +16,27 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef OPTIONS_H_
#define OPTIONS_H_
/* Program knobs. */
#define NWIPE_KNOB_ENTROPY "/dev/urandom"
#define NWIPE_KNOB_IDENTITY_SIZE 512
#define NWIPE_KNOB_LABEL_SIZE 128
#define NWIPE_KNOB_LOADAVG "/proc/loadavg"
#define NWIPE_KNOB_LOG_BUFFERSIZE 1024 /* Maximum length of a log event. */
#define NWIPE_KNOB_PARTITIONS "/proc/partitions"
#define NWIPE_KNOB_PARTITIONS_PREFIX "/dev/"
#define NWIPE_KNOB_PRNG_STATE_LENGTH 512 /* 128 words */
#define NWIPE_KNOB_SCSI "/proc/scsi/scsi"
#define NWIPE_KNOB_SLEEP 1
#define NWIPE_KNOB_STAT "/proc/stat"
#define NWIPE_KNOB_ENTROPY "/dev/urandom"
#define NWIPE_KNOB_IDENTITY_SIZE 512
#define NWIPE_KNOB_LABEL_SIZE 128
#define NWIPE_KNOB_LOADAVG "/proc/loadavg"
#define NWIPE_KNOB_LOG_BUFFERSIZE 1024 // Maximum length of a log event.
#define NWIPE_KNOB_PARTITIONS "/proc/partitions"
#define NWIPE_KNOB_PARTITIONS_PREFIX "/dev/"
#define NWIPE_KNOB_PRNG_STATE_LENGTH 512 // 128 words
#define NWIPE_KNOB_SCSI "/proc/scsi/scsi"
#define NWIPE_KNOB_SLEEP 1
#define NWIPE_KNOB_STAT "/proc/stat"
#define MAX_NUMBER_EXCLUDED_DRIVES 10
#define MAX_DRIVE_PATH_LENGTH 200 // e.g. /dev/sda is only 8 characters long, so 200 should be plenty.
/* Function prototypes for loading options from the environment and command line. */
int nwipe_options_parse( int argc, char** argv );
@@ -44,24 +45,23 @@ void nwipe_options_log( void );
/* Function to display help text */
void display_help();
typedef struct /* nwipe_options_t */
typedef struct
{
int autonuke; /* Do not prompt the user for confirmation when set. */
int noblank; /* Do not perform a final blanking pass. */
int nowait; /* Do not wait for a final key before exiting. */
int nogui ; /* Do not show the GUI. */
char* banner; /* The product banner shown on the top line of the screen. */
// nwipe_method_t method; /* A function pointer to the wipe method that will be used. */
void* method; /* A function pointer to the wipe method that will be used. */
char logfile[FILENAME_MAX]; /* The filename to log the output to */
nwipe_prng_t* prng; /* The pseudo random number generator implementation. */
int rounds; /* The number of times that the wipe method should be called. */
int sync; /* A flag to indicate whether writes should be sync'd. */
nwipe_verify_t verify; /* A flag to indicate whether writes should be verified. */
int autonuke; // Do not prompt the user for confirmation when set.
int noblank; // Do not perform a final blanking pass.
int nowait; // Do not wait for a final key before exiting.
int nosignals; // Do not allow signals to interrupt a wipe.
int nogui; // Do not show the GUI.
char* banner; // The product banner shown on the top line of the screen.
void* method; // A function pointer to the wipe method that will be used.
char logfile[FILENAME_MAX]; // The filename to log the output to.
char exclude[MAX_NUMBER_EXCLUDED_DRIVES][MAX_DRIVE_PATH_LENGTH]; // Drives excluded from the search.
nwipe_prng_t* prng; // The pseudo random number generator implementation.
int rounds; // The number of times that the wipe method should be called.
int sync; // A flag to indicate whether and how often writes should be sync'd.
nwipe_verify_t verify; // A flag to indicate whether writes should be verified.
} nwipe_options_t;
extern nwipe_options_t nwipe_options;
#endif /* OPTIONS_H_ */
/* eof */

1191
src/pass.c

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* pass.h: Routines that read and write patterns to block devices.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -16,20 +16,18 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef PASS_H_
#define PASS_H_
int nwipe_random_pass ( nwipe_context_t* c );
int nwipe_random_pass( nwipe_context_t* c );
int nwipe_random_verify( nwipe_context_t* c );
int nwipe_static_pass ( nwipe_context_t* c, nwipe_pattern_t* pattern );
int nwipe_static_pass( nwipe_context_t* c, nwipe_pattern_t* pattern );
int nwipe_static_verify( nwipe_context_t* c, nwipe_pattern_t* pattern );
void test_functionn( int count, nwipe_context_t** c );
#endif /* PASS_H_ */
/* eof */

View File

@@ -2,7 +2,7 @@
* prng.c: Pseudo Random Number Generator abstractions for nwipe.
*
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 2.
@@ -14,120 +14,139 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "nwipe.h"
#include "prng.h"
#include "logging.h"
#include "mt19937ar-cok.h"
#include "isaac_rand.h"
#include "mt19937ar-cok/mt19937ar-cok.h"
#include "isaac_rand/isaac_rand.h"
nwipe_prng_t nwipe_twister =
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};
int nwipe_u32tobuffer( u8* buffer, u32 rand, int len )
{
"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
};
/*
* Print given number of bytes from unsigned integer number to a byte stream buffer starting with low-endian.
*/
int i;
u8 c; // single char
if( len > sizeof( u32 ) )
{
nwipe_log( NWIPE_LOG_FATAL, "Tried to print longer number than the value passed." );
len = sizeof( u32 );
}
for( i = 0; i < len; i++ )
{
c = rand & 0xFFUL;
rand = rand >> 8;
buffer[i] = c;
}
return 0;
}
int nwipe_twister_init( NWIPE_PRNG_INIT_SIGNATURE )
{
if( *state == NULL )
{
/* This is the first time that we have been called. */
*state = malloc( sizeof( twister_state_t ) );
}
twister_init( (twister_state_t*)*state, (u32*)( seed->s ), seed->length / sizeof( u32 ) );
return 0;
if( *state == NULL )
{
/* This is the first time that we have been called. */
*state = malloc( sizeof( twister_state_t ) );
}
twister_init( (twister_state_t*) *state, (u32*) ( seed->s ), seed->length / sizeof( u32 ) );
return 0;
}
int nwipe_twister_read( NWIPE_PRNG_READ_SIGNATURE )
{
u32 ii;
u32 words = count / sizeof( u32 );
u32 remain = count % sizeof( u32 );
u32 i = 0;
u32 ii;
u32 words = count / SIZE_OF_TWISTER; // the values of twister_genrand_int32 is strictly 4 bytes
u32 remain = count % SIZE_OF_TWISTER; // the values of twister_genrand_int32 is strictly 4 bytes
/* Twister returns 4-bytes per call, so cast the buffer into words. */
for( ii = 0; ii < words; ++ii )
{
((u32*)buffer)[ii] = twister_genrand_int32( (twister_state_t*)*state );
}
/* Twister returns 4-bytes per call, so progress by 4 bytes. */
for( ii = 0; ii < words; ++ii )
{
nwipe_u32tobuffer( (u8*) ( buffer + i ), twister_genrand_int32( (twister_state_t*) *state ), SIZE_OF_TWISTER );
i = i + SIZE_OF_TWISTER;
}
/* Fill the buffer tail if the count is not evenly divided by the size of u32. */
for( ii = 1; ii <= remain; ++ii )
{
/* Notice how three bytes are discarded by doing this. */
((u8*)buffer)[count-ii] = twister_genrand_int32( (twister_state_t*)*state );
}
return 0;
/* If there is some remainder copy only relevant number of bytes to not
* overflow the buffer. */
if( remain > 0 )
{
nwipe_u32tobuffer( (u8*) ( buffer + i ), twister_genrand_int32( (twister_state_t*) *state ), remain );
}
return 0;
}
int nwipe_isaac_init( NWIPE_PRNG_INIT_SIGNATURE )
{
int count;
randctx* isaac_state = *state;
int count;
randctx* isaac_state = *state;
if( *state == NULL )
{
/* This is the first time that we have been called. */
*state = malloc( sizeof( randctx ) );
isaac_state = *state;
if( *state == NULL )
{
/* This is the first time that we have been called. */
*state = malloc( sizeof( randctx ) );
isaac_state = *state;
/* Check the memory allocation. */
if( isaac_state == 0 )
{
nwipe_perror( errno, __FUNCTION__, "malloc" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to allocate memory for the isaac state." );
return -1;
}
}
/* Check the memory allocation. */
if( isaac_state == 0 )
{
nwipe_perror( errno, __FUNCTION__, "malloc" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to allocate memory for the isaac state." );
return -1;
}
}
/* Take the minimum of the isaac seed size and available entropy. */
if( sizeof( isaac_state->randrsl ) < seed->length )
{
count = sizeof( isaac_state->randrsl );
}
else
{
memset( isaac_state->randrsl, 0, sizeof( isaac_state->randrsl ) );
count = seed->length;
}
/* Take the minimum of the isaac seed size and available entropy. */
if( sizeof( isaac_state->randrsl ) < seed->length )
{
count = sizeof( isaac_state->randrsl );
}
else
{
memset( isaac_state->randrsl, 0, sizeof( isaac_state->randrsl ) );
count = seed->length;
}
if( count == 0 )
{
/* Start ISACC without a seed. */
randinit( isaac_state, 0 );
}
else
{
/* Seed the ISAAC state with entropy. */
memcpy( isaac_state->randrsl, seed->s, count );
if( count == 0 )
{
/* Start ISACC without a seed. */
randinit( isaac_state, 0 );
}
else
{
/* Seed the ISAAC state with entropy. */
memcpy( isaac_state->randrsl, seed->s, count );
/* The second parameter indicates that randrsl is non-empty. */
randinit( isaac_state, 1 );
}
/* The second parameter indicates that randrsl is non-empty. */
randinit( isaac_state, 1 );
}
return 0;
return 0;
}
int nwipe_isaac_read( NWIPE_PRNG_READ_SIGNATURE )
{
return 0;
}
/* 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.
*/
/* eof */
(void) state;
(void) buffer;
(void) count;
return 0;
}

View File

@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
@@ -22,25 +22,25 @@
#define PRNG_H_
/* A chunk of random data. */
typedef struct /* nwipe_entropy_t */
typedef struct
{
size_t length; /* Length of the entropy string in bytes. */
u8* s; /* The actual bytes of the entropy string. */
size_t length; // Length of the entropy string in bytes.
u8* s; // The actual bytes of the entropy string.
} nwipe_entropy_t;
#define NWIPE_PRNG_INIT_SIGNATURE void** state, nwipe_entropy_t* seed
#define NWIPE_PRNG_READ_SIGNATURE void** state, void* buffer, size_t count
#define NWIPE_PRNG_INIT_SIGNATURE void **state, nwipe_entropy_t *seed
#define NWIPE_PRNG_READ_SIGNATURE void **state, void *buffer, size_t count
/* Function pointers for PRNG actions. */
typedef int(*nwipe_prng_init_t)( NWIPE_PRNG_INIT_SIGNATURE );
typedef int(*nwipe_prng_read_t)( NWIPE_PRNG_READ_SIGNATURE );
typedef int ( *nwipe_prng_init_t )( NWIPE_PRNG_INIT_SIGNATURE );
typedef int ( *nwipe_prng_read_t )( NWIPE_PRNG_READ_SIGNATURE );
/* The generic PRNG definition. */
typedef struct /* nwipe_prng_t */
typedef struct
{
const char* label; /* The name of the pseudo random number generator. */
nwipe_prng_init_t init; /* Inialize the prng state with the seed. */
nwipe_prng_read_t read; /* Read data from the prng. */
const char* label; // The name of the pseudo random number generator.
nwipe_prng_init_t init; // Inialize the prng state with the seed.
nwipe_prng_read_t read; // Read data from the prng.
} nwipe_prng_t;
/* Mersenne Twister prototypes. */
@@ -51,6 +51,7 @@ int nwipe_twister_read( NWIPE_PRNG_READ_SIGNATURE );
int nwipe_isaac_init( NWIPE_PRNG_INIT_SIGNATURE );
int nwipe_isaac_read( NWIPE_PRNG_READ_SIGNATURE );
#endif /* PRNG_H_ */
/* Size of the twister is not derived from the architecture, but it is strictly 4 bytes */
#define SIZE_OF_TWISTER 4
/* eof */
#endif /* PRNG_H_ */

View File

@@ -1,16 +1,17 @@
/**
* version_string and program_name are used by siege
* and configure; author_name and email_address are
* used by configure to dynamically assign those values
* and configure; author_name and email_address are
* used by configure to dynamically assign those values
* to documentation files.
*/
const char *version_string = "0.15";
const char *program_name = "nwipe";
const char *author_name = "Andy Beverley";
const char *email_address = "andy@andybev.com";
const char *years = "2012";
const char *copyright = "Copyright Darik Horn <dajhorn-dban@vanadac.com>\n\
const char* version_string = "0.28";
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* 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.28";

View File

@@ -1,10 +1,11 @@
#ifndef __VERSION_H
#define __VERSION_H
extern char *version_string;
extern char *program_name;
extern char *author_name;
extern char *email_address;
extern char *copyright;
extern char* version_string;
extern char* program_name;
extern char* author_name;
extern char* email_address;
extern char* copyright;
extern char* banner;
#endif/*__VERSION_H*/
#endif /*__VERSION_H*/