]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Test PBMAC1 with absent PBKDF2 PRF
authorOlivier Chéron <olivier.cheron@gmail.com>
Mon, 30 Sep 2024 19:44:28 +0000 (21:44 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 7 Oct 2024 15:51:54 +0000 (17:51 +0200)
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25568)

test/recipes/80-test_pkcs12.t
test/recipes/80-test_pkcs12_data/pbmac1_sha1_hmac_and_prf.p12 [new file with mode: 0644]

index 9fcfa96542930a819e401cfbe9293d5e82f69703..616de23ffbe310abbd006f8ed2323221a765d952 100644 (file)
@@ -56,7 +56,7 @@ $ENV{OPENSSL_WIN32_UTF8}=1;
 
 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
 
-plan tests => $no_fips ? 45 : 51;
+plan tests => $no_fips ? 46 : 52;
 
 # Test different PKCS#12 formats
 ok(run(test(["pkcs12_format_test"])), "test pkcs12 formats");
@@ -247,6 +247,14 @@ for my $file ("pbmac1_256_256.bad-iter.p12", "pbmac1_256_256.bad-salt.p12", "pbm
         );
 }
 
+# Test pbmac1 pkcs12 file with absent PBKDF2 PRF, usually omitted when selecting sha1
+{
+    my $file = "pbmac1_sha1_hmac_and_prf.p12";
+    my $path = srctop_file("test", "recipes", "80-test_pkcs12_data", $file);
+    ok(run(app(["openssl", "pkcs12", "-in", $path, "-password", "pass:1234", "-noenc"])),
+      "test pbmac1 pkcs12 file $file");
+}
+
 # Test some bad pkcs12 files
 my $bad1 = srctop_file("test", "recipes", "80-test_pkcs12_data", "bad1.p12");
 my $bad2 = srctop_file("test", "recipes", "80-test_pkcs12_data", "bad2.p12");
diff --git a/test/recipes/80-test_pkcs12_data/pbmac1_sha1_hmac_and_prf.p12 b/test/recipes/80-test_pkcs12_data/pbmac1_sha1_hmac_and_prf.p12
new file mode 100644 (file)
index 0000000..d0fe88c
Binary files /dev/null and b/test/recipes/80-test_pkcs12_data/pbmac1_sha1_hmac_and_prf.p12 differ