]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
test: skip ppmd8 aes256 streaming test when no crypto library is present 3335/head
authorJaipaul Cheernam <jaipaul.cheernam@est.tech>
Wed, 29 Jul 2026 13:33:10 +0000 (13:33 +0000)
committerJaipaul Cheernam <jaipaul.cheernam@est.tech>
Wed, 29 Jul 2026 13:37:21 +0000 (13:37 +0000)
test_read_format_zip_ppmd8_aes256_streaming fails with 6 assertion
failures on systems without a crypto library (openssl/nettle/mbedtls)
because it tries to decrypt a pre-built encrypted zipx file without
checking crypto availability first.

Add the same guard used by the other encrypted zip tests in this file.

Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
libarchive/test/test_read_format_zip_zipx_encrypted.c

index f07e1e5c3129d023e4abe86e3280e5a16daaa915..a0a431fb3eecee38f74bb37e57610ede34c09c34 100644 (file)
@@ -257,8 +257,22 @@ DEFINE_TEST(test_read_format_zip_zipx_zstd_encrypted_streaming)
 DEFINE_TEST(test_read_format_zip_ppmd8_aes256_streaming)
 {
        const char *refname = "test_read_format_zip_ppmd8_aes256_streaming.zipx";
+       struct archive *a;
        size_t used;
        char buff[600];
+
+       /* Check if running system has cryptographic functionality. */
+       assert((a = archive_write_new()) != NULL);
+       assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a));
+       assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
+       if (ARCHIVE_OK != archive_write_set_options(a,
+                       "zip:encryption=aes256")) {
+               skipping("This system does not have cryptographic library");
+               archive_write_free(a);
+               return;
+       }
+       archive_write_free(a);
+
        extract_reference_file(refname);
        FILE *f = fopen(refname, "rb");
        used = fread(buff, 1, sizeof(buff), f);