Print algorithm information in detail output (#75)

* Print algorithm information in detail output
* Update documentation with information about algorithm listing
This commit is contained in:
James Wilson
2022-05-18 13:28:37 -07:00
committed by GitHub
parent a7a7c4750c
commit 86cca0804c
6 changed files with 313 additions and 20 deletions

View File

@@ -124,3 +124,29 @@ Volume Algorithm: 1\n"s};
print_volume_status(oss, reinterpret_cast<const scsi::page_nbes&>(page));
REQUIRE(oss.str() == expected_output);
}
TEST_CASE("Test SCSI get data encryption capabilities output", "[output]")
{
const std::uint8_t page[] {
0x00, 0x10, 0x00, 0x3c, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x14,
0x8a, 0x8c, 0x00, 0x20, 0x00, 0x3c, 0x00, 0x20,
0xed, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x14, 0x02, 0x00, 0x00, 0x14,
0x8a, 0x8f, 0x00, 0x20, 0x00, 0x3c, 0x00, 0x20,
0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x10,
};
const std::string expected_output {"\
Supported algorithms:\n\
1 AES-256-GCM-128\n\
Key descriptors allowed, maximum 32 bytes\n\
Raw decryption mode not allowed\n\
2 AES-256-CCM-128\n\
Key descriptors allowed, fixed 32 bytes\n\
Raw decryption mode allowed, raw read disabled by default\n"s};
std::ostringstream oss;
print_algorithms(oss, reinterpret_cast<const scsi::page_dec&>(page));
REQUIRE(oss.str() == expected_output);
}