]> granicus.if.org Git - php/commitdiff
Use unix NL in all openssl ext tests
authorJakub Zelenka <bukka@php.net>
Thu, 21 Jun 2018 15:43:32 +0000 (16:43 +0100)
committerJakub Zelenka <bukka@php.net>
Thu, 21 Jun 2018 15:43:32 +0000 (16:43 +0100)
ext/openssl/tests/bug61124.phpt
ext/openssl/tests/bug66501.phpt
ext/openssl/tests/bug74903.phpt

index 1f2b073d3e30a26c204490cf5f8d34460817a3d4..f92628757a523fa1dc75ed615fe915460d50d623 100644 (file)
@@ -1,19 +1,19 @@
---TEST--\r
-Bug #61124: Segmentation fault with openssl_decrypt\r
---SKIPIF--\r
-<?php if (!extension_loaded("openssl")) die("skip"); ?>\r
---FILE--\r
-<?php\r
-var_dump(\r
-    openssl_decrypt(\r
-        'kzo w2RMExUTYQXW2Xzxmg==',\r
-        'aes-128-cbc',\r
-        'pass',\r
-        false,\r
-        'pass'\r
-    )\r
-);\r
-?>\r
---EXPECTF--\r
-Warning: openssl_decrypt(): IV passed is only 4 bytes long, cipher expects an IV of precisely 16 bytes, padding with \0 in %s on line %d\r
-bool(false)\r
+--TEST--
+Bug #61124: Segmentation fault with openssl_decrypt
+--SKIPIF--
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(
+    openssl_decrypt(
+        'kzo w2RMExUTYQXW2Xzxmg==',
+        'aes-128-cbc',
+        'pass',
+        false,
+        'pass'
+    )
+);
+?>
+--EXPECTF--
+Warning: openssl_decrypt(): IV passed is only 4 bytes long, cipher expects an IV of precisely 16 bytes, padding with \0 in %s on line %d
+bool(false)
index d6894089a0bd9ac0b8dba28c3376aec54264f16a..3994ebdc3c01d42295570d2f196caa761acb7abf 100644 (file)
@@ -1,24 +1,24 @@
---TEST--\r
-Bug #66501: EC private key support in openssl_sign\r
---SKIPIF--\r
-<?php \r
-if (!extension_loaded("openssl")) die("skip");\r
-if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");\r
-?>\r
---FILE--\r
-<?php\r
-$pkey = 'ASN1 OID: prime256v1\r
------BEGIN EC PARAMETERS-----\r
-BggqhkjOPQMBBw==\r
------END EC PARAMETERS-----\r
------BEGIN EC PRIVATE KEY-----\r
-MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49\r
-AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK\r
-sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==\r
------END EC PRIVATE KEY-----';\r
-$key = openssl_pkey_get_private($pkey);\r
-$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');\r
-var_dump($res);\r
-?>\r
---EXPECTF--\r
-bool(true)\r
+--TEST--
+Bug #66501: EC private key support in openssl_sign
+--SKIPIF--
+<?php 
+if (!extension_loaded("openssl")) die("skip");
+if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
+?>
+--FILE--
+<?php
+$pkey = 'ASN1 OID: prime256v1
+-----BEGIN EC PARAMETERS-----
+BggqhkjOPQMBBw==
+-----END EC PARAMETERS-----
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
+AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
+sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
+-----END EC PRIVATE KEY-----';
+$key = openssl_pkey_get_private($pkey);
+$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
+var_dump($res);
+?>
+--EXPECTF--
+bool(true)
index 2dc06cc0d65b96bbc9178722b3f50f10b09639e0..40b14f0acf4cb134f9ea90a0d1e6c103cf233879 100644 (file)
@@ -1,83 +1,83 @@
---TEST--\r
-Bug #74903 openssl_pkcs7_encrypt() uses different EOL than before\r
---SKIPIF--\r
-<?php \r
-if (!extension_loaded("openssl")) die("skip"); \r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O/vGRI26t4\r
-4XrzVC2w5271UlhFaRiH03BrV+pECVoH4bw+ZIUuGke2xe+LrNkhMNJSGcbB0WDa\r
-Jes+4Gf++AuSXRvMo+xHenfgUWQqYHJPkh5q6gknZ2YDfikFNLdqApXvp0m+FaVP\r
-+F/2HMjQfTITQgkAiEn45s4agQKBgQDGCAZkIUcdyXQTplLE0Zx1/uiTBrQGyzsb\r
-cDgAQIHt19wIRjoGOFatAj6TQ5gUj9Remn12v6d5Wi02i7hlu8V6O1VXLGqqeQ27\r
-0MHBXzrFBVljOz96D7VP5Xx0DB1cGMbtg5ivjd91OUVrwC7fbXE9sfOI1FqlTb7p\r
-6xi9Wl+fmQKBgGdzR/vUfqPOvVcq7gBUaAmb2KcUrj65rU753MJUy2h1EuHHRi1k\r
-07fl+VZD0rALJf7bp6laajcebyLWYGdPXkNwqT8ua7naaOSiogLSiSvXhoKP56PG\r
-H+HNLWwp+lAia2Erky0IWstsow62yWvLDyTCM+QhqlHwnh3TJVvNI1GBAoGAUl+y\r
-MOJ6z5Ql2aqc0UwT1i1Tlxz5s73D93Tlho1Ovp3E5Bg6OK4kt9CwMNe0IhF2GGgQ\r
-+l1cj6kIF6Fk8cR6r46QwDM0p3a1VMPQZNx0+NFxzkot7FsuY26lJyyG5fFUhiXw\r
-VE4ifoN1Mg3+MWg3657jG66hihNd77WgU9uM3TkCgYEAypuvVrfFrrtXnbEUcBHq\r
-mguKumn9miD9DPb6gi8ZaKOddGzw+qFPukiqi7rM3oRMg02evfK/VQC87Gmev663\r
-RV9sQOlB9gNlMOOw/0R3ABEWDoSRCcrLhb6Z5Y72WVnZvpTPO0cDw2i1hyaEM6d+\r
-2WR7c6FhRCLxG0DObEOfiO0=\r
------END PRIVATE KEY-----\r
-";\r
-\r
-$envelopeData = "Test";\r
-\r
-$tmpFileIn = tempnam(sys_get_temp_dir(), 'test');\r
-$tmpFileOut = tempnam(sys_get_temp_dir(), 'test');\r
-file_put_contents($tmpFileIn, $envelopeData);\r
-\r
-openssl_pkcs7_encrypt($tmpFileIn, $tmpFileOut, [$cert], array(), PKCS7_BINARY, OPENSSL_CIPHER_AES_128_CBC);\r
-\r
-$result = file_get_contents($tmpFileOut);\r
-var_dump(strpos($result, "\r\n") === false); // behaviour before 7.2\r
-var_dump(strlen($result) === 847);\r
-\r
-unlink($tmpFileIn);\r
-unlink($tmpFileOut);\r
-\r
-?>\r
-==DONE==\r
---EXPECT--\r
-bool(true)\r
-bool(true)\r
-==DONE==\r
-\r
+--TEST--
+Bug #74903 openssl_pkcs7_encrypt() uses different EOL than before
+--SKIPIF--
+<?php 
+if (!extension_loaded("openssl")) die("skip"); 
+?>
+--FILE--
+<?php
+
+$cert = "-----BEGIN CERTIFICATE-----
+MIIDXDCCAkSgAwIBAgIKq/f5U3FzthdKUzANBgkqhkiG9w0BAQUFADBcMRIwEAYD
+VQQDEwlzZXRhcGRmLWExCTAHBgNVBAoTADEJMAcGA1UECxMAMSMwIQYJKoZIhvcN
+AQkBFhRzdXBwb3J0QHNldGFzaWduLmNvbTELMAkGA1UEBhMCREUwHhcNMTUwOTA4
+MDkzNDExWhcNMjAwOTA4MDkzNDExWjBcMRIwEAYDVQQDEwlzZXRhcGRmLWExCTAH
+BgNVBAoTADEJMAcGA1UECxMAMSMwIQYJKoZIhvcNAQkBFhRzdXBwb3J0QHNldGFz
+aWduLmNvbTELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
+AoIBAQCkmTLvUIYfqAKC1CHVgABlemrFIVRm4JGeB0jIGofyrm3yVwR4YcK0eUmt
+/0nbFfsFsU0/C9dXKZYD42t5YpLFsj666Z1EoU1CfSIW2bf0HaWVJ+oNT5twS3dv
+RTzAcnPM44GxO4y6GUW6un0/bT/MZbFKbb3NI1L0mwY7EoqUXR68XxuHqWETaslm
+Sbp1XvbLsJjgV9X3ihi7JC7A9kEzrKh+RBsXEXwlSv5JO2TUdwq9P4EbjqvgiaV1
+vFNAArioX5pIUIm9ahAm8d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9gNlMOOw/0R3ABEWDoSRCcrLhb6Z5Y72WVnZvpTPO0cDw2i1hyaEM6d+
+2WR7c6FhRCLxG0DObEOfiO0=
+-----END PRIVATE KEY-----
+";
+
+$envelopeData = "Test";
+
+$tmpFileIn = tempnam(sys_get_temp_dir(), 'test');
+$tmpFileOut = tempnam(sys_get_temp_dir(), 'test');
+file_put_contents($tmpFileIn, $envelopeData);
+
+openssl_pkcs7_encrypt($tmpFileIn, $tmpFileOut, [$cert], array(), PKCS7_BINARY, OPENSSL_CIPHER_AES_128_CBC);
+
+$result = file_get_contents($tmpFileOut);
+var_dump(strpos($result, "\r\n") === false); // behaviour before 7.2
+var_dump(strlen($result) === 847);
+
+unlink($tmpFileIn);
+unlink($tmpFileOut);
+
+?>
+==DONE==
+--EXPECT--
+bool(true)
+bool(true)
+==DONE==
+