1109 Commits

Author SHA1 Message Date
PartialVolume
3bf91223b9 Update nwipe.8
Update date
v0.40
2026-02-03 10:14:02 +00:00
PartialVolume
7993947977 Update nwipe.8
Updated release date
2026-02-02 23:17:56 +00:00
PartialVolume
2e24184122 Update CHANGELOG.md
Update v0.40 release notes
2026-02-02 23:16:06 +00:00
PartialVolume
0fe2a32ec4 Merge pull request #709 from PartialVolume/update-host-tag-selection-for-pdf
Added an option in the config menu to toggle visibility of host UUID & host S/N in the PDF.
2026-02-02 01:06:53 +00:00
PartialVolume
9ffa4513a6 Added an extra option in the config menu to toggle visability of host UUID & host S/N in the PDF. Also changed the functionality of Tag visability. If the user enters a custom tag in the config menu it will automatically be displayed in the PDF, if you remove the custom tag, then the tag field disappears from the PDF. The command line option --pdftag, now only enables the tag field. To enable visibility of host UUID & host S/N this must be enabled in the config menu. Any change is saved to nwipe.conf and is reinstated next time nwipe starts. 2026-02-02 00:58:27 +00:00
PartialVolume
26ece7a052 Merge pull request #706 from Knogle/further-additions-for-auto-selection-for-prng-and-benchmark-no-gui-option
Further additions for auto selection for prng and benchmark no gui option
2026-01-04 13:58:13 +00:00
PartialVolume
e964dbab09 Update prng.c
Removed an unnecessary "Testing ....prng" printf to improve output clarity.
2026-01-04 13:17:29 +00:00
Fabian Druschke
7df282386e Removed annoying Testing PRNG.. printfs during init 2026-01-04 12:59:16 +01:00
Fabian Druschke
951bb5642d options: make PRNG auto-selection the default, add manual/default opt-out
PRNG auto-selection is now enabled by default when no --prng option is
specified. On startup, nwipe benchmarks the available PRNGs and selects
the fastest one for the current hardware.

To disable auto-selection, a new opt-out mode is introduced:
  --prng=default   (alias: --prng=manual)

This keeps the previous behaviour by using the built-in, CPU-based PRNG
selection without running benchmarks.

Explicit PRNG selections (e.g. --prng=isaac, --prng=aes_ctr_prng) also
disable auto-selection automatically.

Benchmark timing defaults are adjusted accordingly:
- auto-selection defaults to a short benchmark run
- --prng-benchmark-only keeps a longer default duration

This improves out-of-the-box performance while preserving full user
control and backwards compatibility.
2026-01-04 00:32:42 +01:00
Fabian Druschke
02f5d3273a prng: print benchmark progress live and show PRNG activity immediately
The PRNG auto-selection benchmark previously ran silently and only printed
results at the end. As a result, there was a noticeable delay (several
seconds) between starting nwipe and any visible output, making it appear
as if the program was stalled.

This change moves the output into the benchmark loop itself:

- Print "Analysing PRNG performance:" immediately when benchmarking starts
- Show a classic rotating cursor (-\|/) while benchmarks are running
- Print "Testing <PRNG> performance..." before each PRNG is benchmarked
- Print each PRNG’s result (MB/s or failure) immediately after it finishes

The existing nwipe_prng_benchmark_all() API is preserved for compatibility.
A new nwipe_prng_benchmark_all_live() function provides the live output
behaviour and is used for --prng=auto.

This makes startup progress visible, improves UX, and aligns behaviour
with the original maintainer’s expectations.
2026-01-04 00:25:28 +01:00
PartialVolume
75378ca87f Merge pull request #700 from Knogle/auto-selection-for-prng-and-benchmark-no-gui-option
prng, gui: add PRNG benchmarking, auto-selection and CLI support
2026-01-03 21:51:49 +00:00
PartialVolume
c8860875b3 Merge pull request #705 from PartialVolume/require-strict-long-options
Require strict input of long form options

This fixes potential issues caused by getopt_long() when it allows abbreviated input of the long form options. For instance, previously if a user had accidentally typed --auto, because maybe they had meant to type --autopoweroff or prng=auto, getopt_long() would have allowed --auto as a valid option but the code would have interpreted --auto as meaning
-autonuke with very unfortunate consequences in terms of wiping all the discs attached to your system.

Not allowing strict parsing of options has been an issue in getopt_long() since 2008. However the changes I have made in this code now prevent any abbreviations to long form options and expect strict adherence to the options as presented in nwipe's help page (nwipe --help) and man pages.
2026-01-03 21:47:49 +00:00
PartialVolume
096a201a66 Require strict input of long form options
This fixes potential issues caused by getopt_long()
when it allows abbreviated input of the long form
options. For instance, previously if a user had
accidentally typed --auto, because maybe they had
meant to type --autopoweroff or prng=auto, getopt_long()
would have allowed --auto as a valid option but the
code would have interpreted --auto as meaning
-autonuke with very unfortunate consequences in terms
of wiping all the discs attached to your system.

Not allowing strict parsing of options has been an
issue in getopt_long() since 2008. However the changes
I have made in this code now prevent any abbreviations
to long form options and expect strict adherence to the
options as presented in nwipe's help page (nwipe --help)
and man pages.
2026-01-03 21:39:25 +00:00
PartialVolume
ef04909ffe Merge pull request #704 from PartialVolume/fix_sync_occuring_in_directIO_when_no_command_line_arguments
Fix_direct I/O, fdatasync
2026-01-02 23:56:32 +00:00
PartialVolume
94548ad739 Fix_direct I/O, fdatasync
This fixes the following problems.
1. Fdatasync is incorrectly called when in direct I/O mode when
no --directio command line option is present, i.e when it
automatically determines whether direct or cached should be used.
2. When multiple drives are wiped if any of those drives do not
support direct I/O then they would have would have had fdatasync
incorrectly disabled. There was no record of I/O mode on a per
drive basis.
3. Direct I/O on a static pass always called fdatasync as there
was no code present to set the SyncRate to 0 when in direct I/O
mode.
2026-01-02 23:13:01 +00:00
PartialVolume
3c15a420e3 Check autonuke and nogui for valid values
Because autonuke can do a lot of damage we
need to be sure it's value is 1 before letting
it auto wipe. The previous code was assuming
any non zero value was TRUE. In the case of a bug
or memory corruption this could cause an
unintended auto wipe of all discs.
2025-12-31 14:01:56 +01:00
Fabian Druschke
c323e73984 Prints PRNG benchmark results to stdout 2025-12-31 11:16:31 +01:00
PartialVolume
f6840105b0 Improve str_truncate
Check start_column <  wcols and issue error
Reduce output length by 1 to take care a
situation where output_length maybe provided
by strlen which excludes the null terminator
and sizeof which may or may count the terminator.
2025-12-31 11:06:53 +01:00
PartialVolume
bd1e8af845 Merge pull request #702 from PartialVolume/improve_str_truncate_function
Improve str_truncate
2025-12-31 00:37:16 +00:00
PartialVolume
07f59467a1 Improve str_truncate
Check start_column <  wcols and issue error
Reduce output length by 1 to take care a
situation where output_length maybe provided
by strlen which excludes the null terminator
and sizeof which may or may count the terminator.
2025-12-31 00:19:37 +00:00
PartialVolume
a3727d7d21 Merge pull request #701 from PartialVolume/improve_integrity_of_autonuke_option_selection
Check autonuke and nogui for valid values
2025-12-30 21:15:55 +00:00
PartialVolume
9c91d19d14 Check autonuke and nogui for valid values
Because autonuke can do a lot of damage we
need to be sure it's value is 1 before letting
it auto wipe. The previous code was assuming
any non zero value was TRUE. In the case of a bug
or memory corruption this could cause an
unintended auto wipe of all discs.
2025-12-29 23:27:01 +00:00
Fabian Druschke
fea3d8c303 prng, gui: add PRNG benchmarking, auto-selection and CLI support
This change introduces a comprehensive PRNG benchmarking and auto-selection
framework, available both in the ncurses GUI and via the command line.

A new interactive “PRNG Benchmark” menu (key: 'b') has been added to the GUI.
It benchmarks all available PRNG engines using a RAM-only workload and
displays a sorted leaderboard showing sustained throughput in MB/s.

In addition, a new automatic PRNG selection mode is implemented:

  --prng=auto

When enabled, nwipe benchmarks all available PRNGs at startup and
automatically selects the fastest PRNG for the current hardware. This
selection happens before device scanning and does not alter any wipe
semantics or security guarantees.

For non-GUI and diagnostic use, a standalone benchmark mode is also added:

  --prng-benchmark

This runs the same RAM-only PRNG benchmark, prints a sorted leaderboard
to stdout and the log, and exits without scanning or wiping any devices.
It is fully compatible with --nogui.

Key features:
- Unified PRNG benchmark core shared by GUI, auto-selection and CLI modes
- RAM-only benchmark using aligned multi-megabyte buffers
- Deterministic in-memory seeding (benchmark-only, not used for wiping)
- Sorted leaderboard showing MB/s per PRNG
- Automatic fastest-PRNG selection via --prng=auto (opt-in)
- Interactive GUI benchmark view with dimmed informational styling
- No impact on wipe logic, data security or default behaviour

This change improves transparency, diagnostics and performance tuning
across a wide range of hardware platforms, while keeping all new behaviour
explicitly opt-in.
2025-12-19 00:59:45 +01:00
PartialVolume
f8f64ba7e7 Merge pull request #699 from PartialVolume/update_prng_text
Reformat layout of PRNG help text.
2025-12-18 21:24:19 +00:00
PartialVolume
dcdca64db7 Reformat layout of PRNG help text.
The help text for all prngs was formatted
so that it is consistent in terms of layout
and positioning with the help text
as displayed by the methods help text.
Specifically so that it still remains
legible with a 80x25 legacy (nomodset)
terminal.

Also added the ability to run the prng
benchmark from within the prng selection
screen.
2025-12-18 21:18:12 +00:00
PartialVolume
394ba386e5 Merge pull request #697 from Knogle/device-pci-root-tree-implement
gui: add device topology view with sysfs tree (ACS line drawing)
2025-12-17 00:10:13 +00:00
PartialVolume
8e291d5bbb Update gui.c
Removed redundant snprintf commands
2025-12-17 00:03:07 +00:00
PartialVolume
76f928c73d Merge pull request #698 from Knogle/benchmark-mode
gui: add interactive PRNG benchmark mode (RAM-only throughput)
2025-12-16 23:00:50 +00:00
Fabian Druschke
ee3441f32c Removed dimmed text for visibility reasons 2025-12-16 22:55:07 +01:00
Fabian Druschke
1aaae91e88 gui: add interactive PRNG benchmark mode (RAM-only throughput)
Add a new interactive PRNG benchmark mode to the ncurses GUI, opened
with the 'o' key from the main device selection screen.

The benchmark runs all available PRNG engines in a RAM-only loop,
measuring sustained throughput in MB/s by generating keystream data
into an aligned memory buffer. Results are collected and displayed as
a sorted leaderboard, making relative PRNG performance immediately
visible.

Key features:
- New modal “PRNG Benchmark” GUI view (o to open, ESC to return)
- RAM-only throughput test (~1s per PRNG by default)
- Aligned multi-megabyte buffer to reduce syscall and cache artefacts
- Deterministic in-memory seeding for reproducible results
- Sorted leaderboard showing MB/s per PRNG

This mode is intended for diagnostics, comparison, and performance
validation of PRNG implementations and does not affect any wipe logic
or security properties.
2025-12-16 12:30:39 +01:00
Fabian Druschke
c50019abc3 gui: add device topology view with sysfs tree (ACS line drawing)
Add a new GUI “device topology” view, opened with the 't' key from the
device selection screen.

The new view displays the kernel sysfs path of the selected disk as an
indented tree, similar to “lspci -tv”, making it easy to see which
controller, bus, and port a device is attached to.

Key features:
- Modal device topology view (t to open, ESC to return)
- Tree rendering based on /sys/block/<dev> → /sys/devices/... hierarchy
- Portable ncurses ACS line-drawing characters (no UTF-8 dependency)
- Optional PCI controller naming via lspci when available
- Dimmed (A_DIM) text style to visually distinguish the informational view

This improves safety and usability on systems with multiple controllers
by clearly showing the physical attachment path of each drive without
changing wipe behaviour.
2025-12-15 23:43:45 +01:00
PartialVolume
b8f567bcfe Merge pull request #696 from PartialVolume/add-user-defined-tag-to-report
Allow custom text on PDF report.
2025-12-14 22:41:41 +00:00
PartialVolume
65ff9ff64c Allow custom text on PDF report.
Allows user-defined text or tags to be embedded
in the PDF report. The tag data is stored in
nwipe.conf and may be entered via the customer
and organisation preview screen, when enabled,
or directly through the config screen. Press
C on drive selection screen.

Inclusion of this tag in the generated PDF
report requires the pdftag option to be enabled
in the configuration screen or specified explicitly
using the --pdftag command-line argument when
invoking nwipe.
2025-12-14 22:23:00 +00:00
Fabian Druschke
4defd2235a Refactor CPUID/AES-NI detection into cpu_features module and hide AES-CTR PRNG on unsupported platforms (#695)
* Refactor CPUID/AES-NI detection into cpu_features module and hide AES-CTR PRNG on unsupported platforms

This commit improves CPU feature handling and PRNG selection logic in three ways:

1. Introduces a dedicated cpu_features.c/.h module that encapsulates CPUID and
   AES-NI detection. The previous duplicated inline implementations scattered
   across multiple files have been removed to prevent multiple-definition issues
   and ensure consistent CPU capability probing.

2. The AES-CTR PRNG is now selectable only when the running platform supports
   AES-NI. The ncurses GUI automatically hides the AES-CTR option when AES-NI
   is not available, preventing users from choosing a PRNG that would fall back
   to software mode or incur unnecessary slowdown. CLI selection
   (--prng=aes_ctr_prng) is also blocked on non-AES-NI CPUs with a clear error.

3. All modules (options, GUI, PRNG initialisation) now use the central
   has_aes_ni() function, ensuring uniform and future-proof feature detection.

* cpu_features.* missing in commit

* AES-CTR not removed, but disabled when not available on platform
2025-12-11 22:46:13 +00:00
PartialVolume
9f6f465230 Merge pull request #693 from Knogle/create-pdf-folder-if-not-existent
feat(pdf): automatically create PDF report directory if missing and improve permission model
2025-12-09 15:48:43 +00:00
Fabian Druschke
1f68f35dc5 Fixed formatting. 2025-12-09 16:20:22 +01:00
Fabian Druschke
c235349288 Added testfile probe to check if destination directory is writable 2025-12-09 16:19:32 +01:00
Fabian Druschke
26e5cb9894 feat(pdf): automatically create PDF report directory if missing and improve permission model
This commit enhances the handling of the `-P /path` / `--PDFreportpath` option by
ensuring that nwipe can create the specified directory if it does not already
exist. Previously, nwipe simply called `access(path, W_OK)` and exited with a
generic “not a writeable directory” error if the directory did not exist or was
not writable. This caused ambiguity and prevented the use of custom report paths
without pre-creating them externally.

Key improvements:

- Added a new helper function `nwipe_ensure_directory()` that:
  - Differentiates between “non-existent”, “not a directory”, and “not writable”.
  - Attempts to create the directory recursively (`mkdir -p` style) when absent.
  - Creates directories with mode 0755 so other users can read/list directory contents.
  - Performs final verification that the directory exists, is a directory, and writable.

- Replaced the previous simple `access()` check in `nwipe.c` with the new
  directory-ensure logic.

- Introduces clearer and more helpful error messages when directory creation or
  permission checks fail.

Benefits:

- Users can now safely specify custom report paths (e.g. `-P /reports` or
  USB-mounted paths) without requiring manual pre-creation.
- Eliminates ambiguous error reporting and improves overall user experience.
- Maintains backward-compatible behavior when the target directory already exists.
2025-12-09 10:40:06 +01:00
PartialVolume
3b6b6e0040 Merge pull request #692 from PartialVolume/Bump_version
Bump to V0.40, update CHANGELOG.md
2025-12-08 21:32:49 +00:00
PartialVolume
fc308b3f34 Bump to V0.40, update CHANGELOG.md 2025-12-08 21:26:19 +00:00
PartialVolume
6eae95b995 Merge pull request #655 from deamen/master
Add static linking libraries that are required by parted 3.6
2025-12-07 16:23:47 +00:00
PartialVolume
047de16d96 Merge pull request #683 from Knogle/feature/large-io-buffers-direct-io
Improve wipe I/O throughput with large aligned buffers and optional O_DIRECT
2025-11-29 21:07:53 +00:00
Fabian Druschke
57e337537d Fixed formatting 2025-11-29 21:00:27 +01:00
Fabian Druschke
f28bb3d3d6 Fixed missing bracket in src/options.c 2025-11-29 21:00:07 +01:00
PartialVolume
bc2643c72a Merge pull request #690 from Knogle/avoid-ui-breaking-serial
device: sanitize serial numbers and fix uninitialized/fallback handling
2025-11-28 23:16:04 +00:00
Fabian Druschke
b79530c292 Fixed uninitialized io_blocksize in random pass 2025-11-28 21:38:53 +01:00
Fabian Druschke
5f47df370e Removed german comments. 2025-11-28 16:09:07 +01:00
Fabian Druschke
9a70d23e4a device: sanitize serial numbers and fix uninitialized/fallback handling
This patch fixes several issues that could cause garbage or control
characters to appear in the ncurses UI when displaying device serial
numbers.

Key changes:
- Added nwipe_normalize_serial() to strip control characters, non-ASCII
  bytes and trim whitespace from all serial numbers before they are
  shown in the UI.
- Initialize the serialnumber buffer in
  nwipe_get_device_bus_type_and_serialno() to avoid passing undefined
  data back to check_device() when no valid "Serial Number:" field is
  found.
- Prevent ioctl(HDIO_GET_IDENTITY) from being called on an invalid file
  descriptor when open() fails.
- Ensure consistent null termination and sanitize the final
  device_serial_no regardless of whether it came from HDIO, smartctl
  output, or quiet-mode anonymization.

These fixes resolve cases where devices (especially virtual/QEMU or
USB-attached drives) could report malformed or unexpected serial
strings, resulting in UI corruption such as extra characters, ^A, or
line wrapping.
2025-11-28 12:32:43 +01:00
Fabian Druschke
259ee26273 - Fix uninitialized use of io_blocksize in nwipe_random_pass() by computing
the effective I/O block size before any sync-rate logic is executed.

- Add new helper function `nwipe_compute_sync_rate_for_device()` to `pass.c`,
  converting legacy `--sync` semantics (sync * st_blksize) into a per-write
  sync interval based on the actual `io_blocksize`, and disabling periodic
  syncing when using direct I/O.

- Update both `nwipe_random_pass()` and `nwipe_static_pass()` to use the new
  helper, ensuring consistent and correct sync behaviour for all cached-I/O
  passes and removing duplicated sync-calculation logic.
2025-11-27 23:02:28 +01:00
PartialVolume
121624478f Merge pull request #688 from Knogle/update-man
Update README and manpage
2025-11-27 17:38:16 +00:00