Skip to content

Throw an error if encryption is enabled but the algorithm isn't specified#28

Open
MichaelBurge wants to merge 1 commit intoscsitape:masterfrom
MichaelBurge:master
Open

Throw an error if encryption is enabled but the algorithm isn't specified#28
MichaelBurge wants to merge 1 commit intoscsitape:masterfrom
MichaelBurge:master

Conversation

@MichaelBurge
Copy link

@MichaelBurge MichaelBurge commented Dec 8, 2021

When I first tried to use this tool, I forgot to set the -a parameter to specify the encryption algorithm. After comparing strace -e ioctl output with a SCSI command reference manual, I saw that the algorithmIndex wasn't being set and specifying this parameter allowed the drive to accept it.

This change causes this command:

$ sudo stenc -f /dev/nst0 -e on -k backup.key
Provided key length is 256 bits.
Key checksum is 4c7.
Turning on encryption on device '/dev/nst0'...
Sense Code:              Illegal Request (0x05)
 ASC:                    0x26
 ASCQ:                   0x00
 Additional data:        0x00000000000000000000000000000000
 Raw Sense:              0x700005000000001000000000260000ffffff8f000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Error: Turning encryption on for '/dev/nst0' failed!
Usage: stenc --version | -g <length> -k <file> [-kd <description>] | -f <device> [--detail] [-e <on/mixed/rawread/off> [-k <file>] [-kd <description>] [-a <index>] [--protect | --unprotect] [--ckod] ]
Type 'man stenc' for more information.

to instead output:

$ sudo stenc -f /dev/st0 -e on -k backup.key
Error: Encryption enabled but no algorithm index was set. Use 1 for 256-bit AES.
Usage: stenc --version | -g <length> -k <file> [-kd <description>] | -f <device> [--detail] [-e <on/mixed/rawread/off> [-k <file>] [-kd <description>] [-a <index>] [--protect | --unprotect] [--ckod] ]
Type 'man stenc' for more information.

if the -e on, -e mixed, or -e rawread options are set but no algorithm index is set.

…fied. It defaults to 0, and my AES drive expects a 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant