Commit graph

1691 commits

Author SHA1 Message Date
Gabriel Caruso
255e08ac56
Revert "Make build work with newer OpenSSL"
This reverts commit 5f90134bb6.
2023-01-03 13:00:44 -03:00
Stanislav Malyshev
5f90134bb6 Make build work with newer OpenSSL 2022-12-18 22:52:30 -07:00
Jakub Zelenka
fa1b6ab5db Fix GH-8430: OpenSSL compiled with old disgests does not build
Specifically no-md2, no-md4 or no-rmd160 were not supported
2022-10-22 22:11:05 +01:00
Jakub Zelenka
84dcf578b1
Fix GH-9339: OpenSSL oid_file path check warning contains uninitialized path 2022-08-17 19:49:36 +01:00
Jakub Zelenka
d9ff5e079f
Fix GH-8472: stream_socket_accept result may have incorrect metadata 2022-08-07 14:17:38 +01:00
Jakub Zelenka
2f78c1f9d9 Fix and improve OpenSSL VCWD path checking test for bug #50293 2022-06-09 23:01:52 +01:00
Jakub Zelenka
cb9a48a0c5
Pass signature to openssl_verify in bug81713 test 2022-06-09 20:09:08 +01:00
Jakub Zelenka
b765d4cd41 Fix bug #50293 and #81713: file path checking in OpenSSL functions
It introduces a single function to check file paths passed to OpenSSL
functions. It expands the path, check null bytes and finally does
an open basedir check.
2022-06-09 19:49:59 +01:00
Mikko Pesari
16bf8331e0
Fix openssl_csr_export() stub
Closes GH-8362.
2022-04-13 15:20:58 +02:00
Christoph M. Becker
2c2b0abd4a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix openssl_x509_checkpurpose_basic.phpt
2021-12-12 14:27:07 +01:00
Christoph M. Becker
98175fc7f1
Fix openssl_x509_checkpurpose_basic.phpt
This test fails because san-cert.pem and san-ca.pem have expired.  We
fix that by using the CertificateGenerator to generate temporary certs
during the test run.  Since san-cert.pem and san-ca.pem have been
identical, we only generate one certificate.

Closes GH-7763.
2021-12-12 14:26:17 +01:00
Christoph M. Becker
b29e85a0da
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #75725: ./configure: detecting RAND_egd
2021-11-22 14:13:52 +01:00
Дилян Палаузов
60fe575ce3
Fix #75725: ./configure: detecting RAND_egd
Closes GH-7668.
2021-11-22 14:11:07 +01:00
Christoph M. Becker
5628afb782
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81327: Error build openssl extension on php 7.4.22
2021-08-04 18:44:06 +02:00
Christoph M. Becker
6724d5d4c2
Fix #81327: Error build openssl extension on php 7.4.22
The recent fix for bug 52093 is not compatible with LibreSSL ≥ 2.7.0,
which we recognize as mostly OpenSSL 1.1.0 compatible, but they still
do not support `ASN1_INTEGER_set_int64()`.

Closes GH-7339.
2021-08-04 18:41:04 +02:00
Christoph M. Becker
5b0a46908c
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #52093: openssl_csr_sign truncates $serial
2021-07-01 15:43:52 +02:00
Christoph M. Becker
334387bb70
Fix #52093: openssl_csr_sign truncates $serial
We use `ASN1_INTEGER_set_int64()` if supported[1], to avoid the
truncation of the integer.

[1] <https://www.openssl.org/docs/man1.1.0/man3/ASN1_INTEGER_set_int64.html#HISTORY>

Closes GH-7209.
2021-07-01 15:42:02 +02:00
Christoph M. Becker
876bf8800a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix test wrt. OPENSSL_CONF
2021-06-13 16:54:52 +02:00
Christoph M. Becker
d15e10d7ab
Fix test wrt. OPENSSL_CONF
This test is supposed to verify the path of the default OpenSSL config
file; it will fail, though, if OPENSSL_CONF is explicitly set, so we
explicitly unset this environment variable for this test.
2021-06-13 16:53:45 +02:00
Christoph M. Becker
108105b2c6
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76694: native Windows cert verification uses CN as sever name
2021-05-31 14:36:57 +02:00
Christoph M. Becker
7fd48264de
Fix #76694: native Windows cert verification uses CN as sever name
This is not guaranteed to work, since the actual server name may only
be given as SAN.  Since we're doing the peer verification later anyway
(using the respective context options as appropriate), there is no need
to even supply a server name when verifying against the Windows cert
store.

Closes GH-7060.
2021-05-31 14:35:17 +02:00
Vincent JARDIN
bb0107b63d openssl_pkcs7_read: input is data not filename
The argument should be an input string and not a filename.

Fix: https://github.com/php/doc-en/pull/559
Suggested-by: George Peter Banyard <girgias@php.net>

Closes GH-6942.
2021-05-05 09:49:53 +02:00
Jakub Zelenka
4dca1140cf Merge branch 'PHP-7.4' into PHP-8.0 2021-03-21 21:21:05 +00:00
Jakub Zelenka
bc7ea73da5 Use ServerClientTestCase in a test for default_socket_timeout=-1 2021-03-21 21:19:40 +00:00
Nikita Popov
703bbf5210 Downgrade security level in tests using TLS < 1.2
A few additional tests have been added on master that require
lower security level.

(cherry picked from commit c2a6395dcb)
2021-03-15 14:11:12 +01:00
Remi Collet
18071aaa08 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  skip test with openssl < 1.1.0
2021-02-25 13:54:19 +01:00
Remi Collet
ae0585c98e skip test with openssl < 1.1.0
The test fails, but without any crash
(this test is designed to catch a crash)
2021-02-25 13:52:35 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Nikita Popov
4fb8252186 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Suppress OpenSSL error on missing optional config
2021-02-16 10:12:42 +01:00
Nikita Popov
7566742754 Suppress OpenSSL error on missing optional config
openssl_pkey_new() fetches various options from the config file --
most of these are optional, and not specifying them is not an error
condition from the perspective of the user. Unfortunately, the
CONF_get_string() API pushes an error when accessing a key that
doesn't exist (_CONF_get_string does not, but that is presumably a
private API). This commit adds a helper php_openssl_conf_get_string()
that automatically clears the error in this case. I've found that
OpenSSL occasionally does the same thing internally:
22040fb790/apps/req.c (L515-L517)

Closes GH-6699.
2021-02-16 10:11:00 +01:00
Nikita Popov
f43097a2d7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80747
2021-02-15 15:34:21 +01:00
Nikita Popov
64b1085464 Fixed bug #80747
If RSA key generation fails, actually report that failure.
2021-02-15 15:34:01 +01:00
Nikita Popov
af7445b9ac Try to fix intermittent failures of stream_server_reneg_limit.phpt on macos
Make sure the server has started up before we try to connect to it.
2021-01-04 14:31:42 +01:00
Nikita Popov
32cd5a1bc8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Next attempt to fix bug #80368
2020-11-30 15:17:27 +01:00
Nikita Popov
ecee3f1209 Next attempt to fix bug #80368
Apparently treating LibreSSL as OpenSSL 1.1 is not just something
we did in our code, it's something that upstream LibreSSL claims,
despite not actually being compatible. Duh.

Check for EVP_CIPH_OCB_MODE instead, which should reliably
determine support...
2020-11-30 15:15:59 +01:00
Jakub Zelenka
a87d620543 Merge branch 'PHP-7.4' into PHP-8.0 2020-11-27 16:35:16 +00:00
Jakub Zelenka
b855907f54 Merge branch 'PHP-7.3' into PHP-7.4 2020-11-27 16:33:47 +00:00
Jakub Zelenka
685708160e Fix test for bug62890 to not depend on system cert store 2020-11-27 16:32:43 +00:00
Nikita Popov
f4e1768e21 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80368
2020-11-27 10:58:34 +01:00
Nikita Popov
0f579fd7c8 Fixed bug #80368
We assume that usually LibreSSL supports everything OpenSSL 1.1 does.
In this instance, this is not the case.
2020-11-27 10:57:19 +01:00
Nikita Popov
87d2bb7424 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix CCM tag length setting for old OpenSSL versions
2020-10-20 10:52:50 +02:00
Nikita Popov
1359f793ee Fix CCM tag length setting for old OpenSSL versions
While OpenSSL 1.1 allows unconditionally setting the CCM tag length
even for decryption, some older versions apparently do not. As such,
we do need to treat CCM and OCB separately after all.
2020-10-20 10:50:50 +02:00
Nikita Popov
7727a02276 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #79983: Add support for OCB mode
2020-10-19 11:09:17 +02:00
Nikita Popov
750a74ed9c Fix bug #79983: Add support for OCB mode
OCB mode ciphers were already exposed to openssl_encrypt/decrypt,
but misbehaved, because they were not treated as AEAD ciphers.
From that perspective, OCB should be treated the same way as GCM.
In OpenSSL 1.1 the necessary controls were unified under
EVP_CTRL_AEAD_* (and OCB is only supported since OpenSSL 1.1).

Closes GH-6337.
2020-10-19 11:09:00 +02:00
Nikita Popov
251af7329f Fix nullability of openssl_cms_sign() parameter 2020-10-14 11:34:15 +02:00
Nikita Popov
2540f68d0e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Allow passing $tag for non-authenticated encryption
2020-10-14 10:56:51 +02:00
Nikita Popov
6c6a58e930 Allow passing $tag for non-authenticated encryption
openssl_encrypt() currently throws a warning if the $tag out
parameter is passed for a non-authenticated cipher. This violates
the principle that a function should behave the same if a parameter
is not passed, and if the default value is passed for the parameter.

I believe this warning should simply be dropped and the $tag be
populated with null, as is already the case. Otherwise, it is not
possible to use openssl_encrypt() in generic wrapper APIs, that are
compatible with both authenticated and non-authenticated encryption.

Closes GH-6333.
2020-10-14 10:54:06 +02:00
Nikita Popov
2cd2ca8884 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Add missing X509 purpose constants"
2020-10-12 12:56:21 +02:00
Nikita Popov
41e4a77077 Revert "Add missing X509 purpose constants"
This reverts commit 1e53e14bc3.

This fails on Travis.
2020-10-12 12:56:07 +02:00
Nikita Popov
da60849fa1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add missing X509 purpose constants
2020-10-12 11:53:22 +02:00