15 Commits

Author SHA1 Message Date
James Wilson
7943f1860e Update license headers (#112) 2023-05-14 09:02:36 +02:00
James Wilson
57591d01a9 clang-format and include-what-you-use run (#111) 2023-05-02 06:57:47 +02:00
James Wilson
daa541a654 Update status output format (#108)
* Update format of status output

* Add print_buffer and modernize SCSI debug output using std::for_each
2023-05-01 22:48:54 +02:00
Jonas Stein
8b1756eb89 Add SPDX License information (#96)
Adding license information according to the SPDX stanard.
Used the reuse tool.
Bug: https://github.com/scsitape/stenc/issues/95
2022-08-24 22:41:43 +02:00
James Wilson
a3d03e5211 Use KAD format field (#86) 2022-06-06 00:40:52 +02:00
James Wilson
b2082bf854 Do validation of options against device capabilities (#83)
* Validate options against device capabilities

* Use std::reference_wrapper instead of raw pointers

* Reword error message

* Also validate --(no-)allow-raw-read against device capabilities

* --ckod should do a media check
2022-06-04 18:37:52 +02:00
James Wilson
23f8d829bf Change command line option processing (#82)
* Changes command line option processing:
  - Use getopt_long in libc and support long options
  - GNU style option processing (don't try to enforce non-conflicting options)
  - GNU style usage message
  - Separate encrypt and decrypt settings
  - --unprotect -> --allow-raw-read, --protect -> --no-allow-raw-read for clarification
  - Change reading key file from stdin using --key-file=-
  - Always print detailed status, remove summary "Drive Encryption" line

* Other formatting and style cleanup

* Test output changes
2022-06-01 00:05:46 +02:00
James Wilson
1200fe92ee Use hardcoded CEEM value instead of configure script parameter (#81)
The default CEEM (check external encryption mode) parameter is undocumented, and default of 0 makes behavior vendor-specific. The standard allows for a drive to report an error when trying to read a block that was pre-encrypted before written to the drive, such as is done with a keyless copy of a tape. This sounds like a very rare scenario to need to support. For the widest compatibility with data sources, this should be set to 1 for general-purpose use.
2022-05-28 11:50:08 +02:00
James Wilson
d2b7363769 clang-format run (#77)
* pull updated template .clang-format with `clang-format-14 --style=llvm --dump-config`, move to base directory so it is shared between `src` and `tests`
* tweak to match existing style a little (e.g. K&R style for function braces)
* run on all sources
2022-05-18 23:48:31 +02:00
James Wilson
86cca0804c Print algorithm information in detail output (#75)
* Print algorithm information in detail output
* Update documentation with information about algorithm listing
2022-05-18 22:28:37 +02:00
James Wilson
f5856d7591 Test for key_from_hex_chars (#70) 2022-05-13 23:17:53 +02:00
James Wilson
eeb7d72686 Introduce portable, endian-clean structures using shifts and masks instead of bitfields (#66)
* Introduce portable, endian-clean structures using shifts and masks instead of bitfields
* Modernize SCSIExecute with RAII and exceptions
* Convert SP-IN calls to use the new portable SCSI structures and functions
* Convert SP-OUT code to use the new portable SCSI structures and functions
* Delete bitfield-based code and remove runtime endian check
Closes: https://github.com/scsitape/stenc/issues/63
2022-05-13 22:43:58 +02:00
James Wilson
13cf62cf8b Add unit test coverage of stenc output (#67)
using stream in functions instead of directly writing to cout
2022-05-12 00:40:39 +02:00
James Wilson
13f09ea5aa Remove KeyInfo and use standard library to parse hex strings (#46)
* Remove KeyInfo and use standard library to parse hex strings

* One declaration per line, more useful name of key_from_hex_chars
2022-05-08 21:07:58 +02:00
James Wilson
ff413aac3e Add unit tests and add const 2022-04-24 20:09:08 +02:00