summaryrefslogtreecommitdiffstats
path: root/2ef8809ef3beb5f58b81dcff49bdcde4d2cb8426.patch
blob: 12a9208dffd067852b4a1211c9e715a1e907879d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Backported from 7.1 by Remi



From 2ef8809ef3beb5f58b81dcff49bdcde4d2cb8426 Mon Sep 17 00:00:00 2001
From: Jakub Zelenka <bukka@php.net>
Date: Sun, 15 Apr 2018 20:41:23 +0100
Subject: [PATCH] Make openssl_error_string test work in OpenSSL 1.1.1

It was the only failing test
---
 ext/openssl/tests/openssl_error_string_basic.phpt | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt
index 04cc5508a4af..7817fbafb2f0 100644
--- a/ext/openssl/tests/openssl_error_string_basic.phpt
+++ b/ext/openssl/tests/openssl_error_string_basic.phpt
@@ -79,6 +79,9 @@ while (($enc_error_new = openssl_error_string()) !== false) {
 var_dump($error_queue_size);
 echo "\n";
 
+$is_111 = OPENSSL_VERSION_NUMBER >= 0x10101000;
+$err_pem_no_start_line = $is_111 ? '0909006C': '0906D06C';
+
 // PKEY
 echo "PKEY errors\n";
 // file for pkey (file:///) fails when opennig (BIO_new_file)
@@ -86,7 +89,7 @@ echo "PKEY errors\n";
 expect_openssl_errors('openssl_pkey_export_to_file opening', ['02001002', '2006D080']);
 // file or private pkey is not correct PEM - failing PEM_read_bio_PrivateKey
 @openssl_pkey_export_to_file($csr_file, $output_file);
-expect_openssl_errors('openssl_pkey_export_to_file pem', ['0906D06C']);
+expect_openssl_errors('openssl_pkey_export_to_file pem', [$err_pem_no_start_line]);
 // file to export cannot be written
 @openssl_pkey_export_to_file($private_key_file, $invalid_file_for_write);
 expect_openssl_errors('openssl_pkey_export_to_file write', ['2006D002']);
@@ -95,7 +98,7 @@ expect_openssl_errors('openssl_pkey_export_to_file write', ['2006D002']);
 expect_openssl_errors('openssl_pkey_export', ['06065064', '0906A065']);
 // invalid x509 for getting public key
 @openssl_pkey_get_public($private_key_file);
-expect_openssl_errors('openssl_pkey_get_public', ['0906D06C']);
+expect_openssl_errors('openssl_pkey_get_public', [$err_pem_no_start_line]);
 // private encrypt with unknown padding
 @openssl_private_encrypt("data", $crypted, $private_key_file, 1000);
 expect_openssl_errors('openssl_private_encrypt', ['04066076']);
@@ -105,7 +108,7 @@ expect_openssl_errors('openssl_private_decrypt', ['04065072']);
 // public encrypt and decrypt with failed padding check and padding
 @openssl_public_encrypt("data", $crypted, $public_key_file, 1000);
 @openssl_public_decrypt("data", $crypted, $public_key_file);
-expect_openssl_errors('openssl_private_(en|de)crypt padding', ['0906D06C', '04068076', '04067072']);
+expect_openssl_errors('openssl_private_(en|de)crypt padding', [$err_pem_no_start_line, '04068076', '04067072']);
 
 // X509
 echo "X509 errors\n";
@@ -114,7 +117,7 @@ echo "X509 errors\n";
 expect_openssl_errors('openssl_x509_export_to_file open', ['02001002']);
 // file or str cert is not correct PEM - failing PEM_read_bio_X509 or PEM_ASN1_read_bio
 @openssl_x509_export_to_file($csr_file, $output_file);
-expect_openssl_errors('openssl_x509_export_to_file pem', ['0906D06C']);
+expect_openssl_errors('openssl_x509_export_to_file pem', [$err_pem_no_start_line]);
 // file to export cannot be written
 @openssl_x509_export_to_file($crt_file, $invalid_file_for_write);
 expect_openssl_errors('openssl_x509_export_to_file write', ['2006D002']);
@@ -129,7 +132,7 @@ echo "CSR errors\n";
 expect_openssl_errors('openssl_csr_get_subject open', ['02001002', '2006D080']);
 // file or str csr is not correct PEM - failing PEM_read_bio_X509_REQ
 @openssl_csr_get_subject($crt_file);
-expect_openssl_errors('openssl_csr_get_subjec pem', ['0906D06C']);
+expect_openssl_errors('openssl_csr_get_subjec pem', [$err_pem_no_start_line]);
 
 // other possible cuases that are difficult to catch:
 // - ASN1_STRING_to_UTF8 fails in add_assoc_name_entry