Repository navigation
Tests: read known data from the test volumes without mounting - #1907
Conversation
idrassi
left a comment
There was a problem hiding this comment.
Thanks for adding this. I'm in favor of the approach, especially keeping the digest of the complete data area. It caught corruption outside DUMMY.TXT in my checks.
Now that #1905 has landed, I would include the big endian workflow integration here. As submitted, this only adds execution to the native Ubuntu workflow. The helper should run in the build job while Volume.a and Platform.a are available; the later jobs receive only the executable.
The linked s390x run is encouraging, but this step took about 123 seconds there, compared with about 12 seconds in the native jobs. To keep the automatic check short, I would use --fixture test.sha512.hc for ordinary runs and check all five fixtures during the full run.
Successful payload reads currently cover AES and Kuznyechik. A fixture using a cascade would be a useful later addition. The existing mount checks should stay, since they exercise the integration with the operating system that direct calls to the volume library don't cover.
The Linux workflow checks the content of the Tests/*.hc volumes by mounting them, which needs root, FUSE and the installed package, and so only runs on x86_64. Add a test that recovers the same data through the volume layer instead, so it also runs on other architectures, e.g. on the big-endian cross build under qemu-user. Tests/volume_read_test.cpp opens a volume read-only and reads its data area with Volume::ReadSectors: in one call, as multi-sector ranges at nonzero offsets with odd sector counts, again with the encryption thread pool running, and one sector at a time; every read must match the first. CPU features are detected as in the application, and the character set is taken from the environment (LC_CTYPE) so that paths with non-ASCII characters work; if that locale is unavailable, the test continues in the C locale and says so. Tests/test_volume_read.py builds it against Volume.a and Platform.a of a finished standard Linux build (CXX and NM can be set for a cross build) and checks the plaintext of every Tests/test.*.hc volume: the FAT boot sector, DUMMY.TXT with the content "Dummy" at the cluster given by the root directory, and a known SHA-256 digest of the whole data area. A volume without a digest, or a digest without a volume, is an error. It runs in the Linux workflow after the .deb build and in the build job of the big-endian workflow (test.sha512.hc only in the automatic check, all volumes in the full run), and requires the thread pool there. Signed-off-by: Ville Takio <ville+git@takio.fi>
|
@idrassi Thanks for the thorough review. Everything is addressed in f64e6e9 (rebased on master after #1905). I also replied to each inline comment.
|
idrassi
left a comment
There was a problem hiding this comment.
Thanks for the update. Looks good to me now.
Follow-up to the suggestion in #1905: a test that reads known volume data through
Volume::ReadSectors, without mounting, so it can run on other architectures too.The Linux workflow already checks the content of the
Tests/*.hcvolumes, but by mounting them, which needs root, FUSE and the installed package, so it only runs on x86_64. This recovers the same data through the volume layer instead; the mount checks stay, as they cover the integration with the operating system.Tests/volume_read_test.cppopens a volume read-only and reads its data area withVolume::ReadSectors: in one call; as multi-sector ranges at nonzero offsets with odd sector counts; again with the encryption thread pool running (whole area and the same ranges); and one sector at a time. Every read must match the first. If the pool does not start (fewer than two processors), that part is reported as skipped, or fails with--require-thread-pool. CPU features are detected as in the application, so the accelerated cipher code is used where available. The character set is taken from the environment (LC_CTYPE) so paths with non-ASCII characters work; if that locale is unavailable, the test continues in the C locale and says so.Tests/test_volume_read.pybuilds it againstVolume.aandPlatform.aof a finished standard Linux build (matching the libstdc++ ABI of the archives; supported configurations are documented in the script) and checks the plaintext of everyTests/test.*.hcvolume:DUMMY.TXTwith the contentDummy, at the cluster given by the root directory;Without
--fixture, a volume without a digest (or a digest without a volume) is an error, so a new fixture can't be left out. For a cross build, setCXXandNMto the cross tools; the program then runs through qemu-user.build-linux.ymlruns it after the.debbuild, which leaves the archives of the console build insrc.build-linux-big-endian.ymlruns it in the build job, where the archives are available:test.sha512.hconly in the automatic check, all five volumes in the full run, on s390x and amd64.Testing (on my fork, with the workflow triggers changed to run on push):
test.sha512.hc): https://github.com/flatstik/VeraCrypt/actions/runs/38079257015répertoirepasses (it failed before withStringConversionFailed);Tests/test.argon2.hcmakes the default run fail;