Commit Graph

926 Commits

Author SHA1 Message Date
Jakub Zelenka
ad028ebc11 Use new range checks in openssl ext 2015-08-26 19:55:29 +01:00
Jakub Zelenka
c39336d1d8 Fix bug #55259 (openssl extension does not get the DH parameters from DH key resource) 2015-08-25 20:26:11 +01:00
Anatol Belski
78b2b1d6f7 fix test
backport from master
2015-08-23 17:27:55 +02:00
Jakub Zelenka
7ad1703413 Add overflow check for openssl_pkcs12_read 2015-08-20 19:29:54 +01:00
Jakub Zelenka
c3f0c87564 Add overflow checks for openssl_pkey_* functions 2015-08-19 20:10:14 +01:00
Jakub Zelenka
478ecc674b Move overflow checks in openssl_pbkdf2 2015-08-19 20:06:58 +01:00
Jakub Zelenka
6a201b3651 Use macros for openssl overflow checks
It reduces code duplications
2015-08-18 20:17:04 +01:00
Jakub Zelenka
618c327a56 Fix possible overflow in openssl_pbkdf2
Especially key_length would lead to the crash if it overflowed
to the negative value.
2015-08-18 19:46:59 +01:00
Jakub Zelenka
c4a98e876c Check and use correct signature_len type for EVP_VerifyFinal 2015-08-17 18:43:02 +01:00
Jakub Zelenka
f3abea9f91 Fix some int overflows in openssl
There might be more. I just did a quick check for enc/dec, rand
and one BN call.
2015-08-16 15:43:00 +01:00
Stanislav Malyshev
ed709d5aa0 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  fix test
  update NEWS
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	ext/soap/php_http.c
	ext/spl/spl_observer.c
2015-08-04 15:29:13 -07:00
Stanislav Malyshev
69ed3969dd Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	.gitignore
	ext/date/php_date.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
2015-08-04 14:10:57 -07:00
Stanislav Malyshev
16023f3e3b Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes 2015-07-26 17:43:16 -07:00
Stanislav Malyshev
97047e7665 Merge branch 'PHP-5.6'
* PHP-5.6:
  update NEWS
  fix test
  update NEWS
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	Zend/zend_exceptions.c
	ext/date/php_date.c
	ext/openssl/openssl.c
	ext/phar/phar_internal.h
	ext/soap/php_http.c
	ext/spl/spl_array.c
	ext/spl/spl_dllist.c
	ext/spl/spl_observer.c
	ext/standard/tests/serialize/bug69152.phpt
	sapi/cli/tests/005.phpt
2015-08-04 16:14:24 -07:00
Anatol Belski
545b364d56 remove TSRMLS_*
either remains or merged in from PHP5
2015-08-02 13:42:01 +02:00
Anatol Belski
b281211979 fix backport mistake
in 5.6 it has to be explicitly copied to avoid double free
2015-07-03 16:21:02 +02:00
Anatol Belski
d870683d6b backport c01943bffc into 5.6 2015-07-03 11:16:02 +02:00
Anatol Belski
c01943bffc fix improper behavior
openssl_spki_export() is documented to return string, but it's
obviously not achieved writing it to stdout :)
2015-07-03 10:15:52 +02:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Tjerk Meesters
03a670eaaa Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed #69882: OpenSSL error "key values mismatch" after openssl_pkcs12_read with extra certs
2015-06-26 06:03:29 +08:00
Tjerk Meesters
2ff3dafccf Fixed #69882: OpenSSL error "key values mismatch" after openssl_pkcs12_read with extra certs
Squashed commit of the following:

commit a64c1d9bc4
Author: Tomasz Sawicki <falundir@gmail.com>
Date:   Wed Jun 24 08:49:37 2015 +0200

    Fix #69882: OpenSSL error "key values mismatch" after openssl_pkcs12_read with extra certs

    The "key values mismatch" error is triggered in openssl_pkcs12_read by
    PKCS12_parse, because it uses X509_check_private_key to separate main
    certificate (which corresponds to private key) from extra certificates.
    Extra certificates usually comes first (p12 contents are reversed as
    stack) and X509_check_private_key triggers X509_R_KEY_VALUES_MISMATCH
    error.
    The fix pops "key values mismatch" error from OpenSSL error stack for
    each extra certificate if there are any.
2015-06-26 05:33:28 +08:00
Nikita Popov
8a83aed458 Drop duplicate object-to-type notices
We already generate a recoverable fatal for these earlier, no need
to throw an additional notice.
2015-06-22 16:25:32 +02:00
Nikita Popov
5d3cf577aa Make convert_to_* safe with rc>1
This only involves switching zval_dtor to zval_ptr_dtor for arrays
and making the convert_to_object for arrays a bit more generic.

All the other changes outside zend_operators.c just make use of
this new ability (use COPY instead of DUP).

What's still missing: Proper references handling. I've seen many
convert_to* calls that will break when a reference is used.

Also fixes bug #69788.
2015-06-11 23:23:57 +02:00
Radu Brănișcan
0c7634fcc7 Corrected line comment 5256
From the text "dectupt" to "decrypt"
2015-05-23 11:11:58 +02:00
Anatol Belski
c93a360661 fix _timezone usage for vc14 2015-05-10 18:17:24 +02:00
Rasmus Lerdorf
741382d968 Remove SSLv3 test dependencies
SSLv3 is going away. Debian8 already ships with an openssl
with no SSLv3 support which was causing these tests to fail.

Conflicts:
	ext/openssl/tests/session_meta_capture.phpt
2015-05-05 10:40:55 +02:00
Nikita Popov
2a87a42cd4 Dropped CN_match and SNI_server_name context options 2015-04-24 18:18:18 +02:00
Stanislav Malyshev
cb9f58d046 Merge branch 'pull-request/1203'
* pull-request/1203:
  Update openssl.c
2015-04-18 19:32:14 -07:00
Remi Collet
9340c5b347 Merge branch 'PHP-5.6'
* PHP-5.6:
  skip test when xml not available
2015-04-17 15:21:03 +02:00
Remi Collet
342acbe1c6 skip test when xml not available 2015-04-17 15:20:22 +02:00
Daniel Lowrey
4f07330e79 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix Bug #69402: Reading empty SSL stream hangs until timeout

Conflicts:
	ext/openssl/xp_ssl.c
2015-04-14 09:27:37 -06:00
Daniel Lowrey
81f356b4ae Fix Bug #69402: Reading empty SSL stream hangs until timeout 2015-04-14 09:25:11 -06:00
Daniel Lowrey
601d60a978 Fix Bug #69402: Reading empty SSL stream hangs until timeout 2015-04-14 09:24:40 -06:00
Kalle Sommer Nielsen
156ac232cb Fix test for systems where openssl's time_t have an offset set 2015-04-09 19:57:44 +02:00
Kalle Sommer Nielsen
8d3c4e5988 Fix test on systems where EOL isn't "\n", like Windows 2015-04-08 23:56:29 +02:00
Dmitry Stogov
5ba72e5f80 Fixed resource leak 2015-04-08 23:37:05 +03:00
Rasmus Lerdorf
32484e3f5f Remove SSLv3 test dependencies
SSLv3 is going away. Debian8 already ships with an openssl
with no SSLv3 support which was causing these tests to fail.
2015-04-08 09:55:55 -07:00
Eric F
321bafccde Update openssl.c
Adding additional checks for sslv3.
2015-03-30 01:30:09 +02:00
Leigh
456f4a78d2 Add RAND_egd check for compiling against LibreSSL 2015-03-27 13:33:22 +01:00
Leigh
a04ab4b54b Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Add RAND_egd check for compiling against LibreSSL
2015-03-27 13:26:48 +01:00
Leigh
1b2d58a364 Add RAND_egd check for compiling against LibreSSL 2015-03-27 13:24:36 +01:00
Anatol Belski
19360f386e cleanup mod version macros, round 3 2015-03-23 20:54:55 +01:00
Dmitry Stogov
8633685675 Use specialized macro for string zval creation 2015-03-12 16:53:51 +03:00
Daniel Lowrey
589374d027 Merge branch 'PHP-5.6'
* PHP-5.6:
  Don't block on crypto data inside stream_select()
2015-03-11 09:45:28 -06:00
Daniel Lowrey
c661121459 Don't block on crypto data inside stream_select() 2015-03-11 09:44:07 -06:00
Daniel Lowrey
4a336f5d0b Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix bug# 69215 (Crypto servers should send client CA list)

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-10 18:18:19 -06:00
Daniel Lowrey
3f6b12795c Fix bug# 69215 (Crypto servers should send client CA list) 2015-03-10 18:13:10 -06:00
Daniel Lowrey
c5c4d22c10 Deprecate "session_meta_capture" SSL context option
Meta data about encrypted streams is now available as part of the
"crypto" key in the array returned by stream_get_meta_data(). This
update deprecates the use of the "session_meta_capture" ssl
context option in encrypted streams.
2015-03-09 23:15:57 -06:00
Daniel Lowrey
2dec21634c Revert "Add stream_socket_crypto_info() function"
This reverts commit 13acb7ec65.

With the added capability to negotiate application layer protocols
via the TLS ALPN extension userland needs a method to access the
negotiated protocol on a given stream. The reverted commit added
a new stream_socket_crypto_info() function for this purpose.

This original approach was discarded in favor of using the
already-existing stream_get_meta_data() API which specifically
exists for just such purposes and requires the addition of no new
functions.
2015-03-09 23:15:57 -06:00
Daniel Lowrey
676a5059b2 Add crypto info to stream_get_meta_data() result on encrypted streams
A "crypto" key is added to the output of stream_get_meta_data() calls
when invoked using a stream on which crypto is currently active. The
new key's associated array contains the following keys:

 - protocol (string e.g. TLSv1.2, TLSv1.1, etc)
 - cipher_name (string)
 - cipher_bits (int)
 - cipher_version (string)

If the TLS ALPN extension was used to successfully negotiate an
application protocol that protocol's identifier is stored in the
following key:

 - alpn_protocol

If no ALPN protocol was negotiated the "alpn_protocol" key is not
present in the crypto meta data array. More meta information
concerning the stream's active encryption state may be added in the
future.
2015-03-09 23:15:57 -06:00
Daniel Lowrey
748433e7bc Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix crypto stream timeout regressions

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-09 16:02:04 -06:00
Daniel Lowrey
69691cc8ca Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix crypto stream timeout regressions
2015-03-09 15:55:33 -06:00
Daniel Lowrey
bbfd4a5e62 Fix crypto stream timeout regressions 2015-03-09 15:53:26 -06:00
Daniel Lowrey
00c35cb6a5 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed bug #69197 (openssl_pkcs7_sign handles default value incorrectly)

Conflicts:
	ext/openssl/openssl.c
2015-03-06 11:31:04 -07:00
Daniel Lowrey
0928bad9ac Fixed bug #69197 (openssl_pkcs7_sign handles default value incorrectly) 2015-03-06 11:29:56 -07:00
Anatol Belski
be7371f9ff fix data type 2015-03-06 16:49:08 +01:00
Daniel Lowrey
eef261f0e4 Update test to run locally instead of remotely 2015-03-05 22:01:15 -07:00
Daniel Lowrey
e82878a200 Update test to run locally instead of remotely 2015-03-05 22:00:38 -07:00
Daniel Lowrey
88cfc6ccb6 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix stream_select() issue with OpenSSL buffer

Conflicts:
	main/streams/streams.c
2015-03-05 17:53:04 -07:00
Chris Wright
e7df9d710c Fix stream_select() issue with OpenSSL buffer
Ensure data from OpenSSL internal buffer has been
transfered to PHP stream buffer before a select()
emulation operation is performed

Addresses bug #65137
https://bugs.php.net/bug.php?id=65137

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-05 17:18:14 -07:00
Daniel Lowrey
ca24d19a89 Really fix zts this time 2015-03-05 14:09:25 -07:00
Daniel Lowrey
927b137c1b Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix ZTS
  Fix ZTS build

Conflicts:
	ext/openssl/openssl.c
	ext/openssl/xp_ssl.c
2015-03-05 12:24:04 -07:00
Daniel Lowrey
c985ec737d Fix ZTS 2015-03-05 12:19:15 -07:00
Daniel Lowrey
010f17534f Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix ZTS build
2015-03-05 12:13:33 -07:00
Daniel Lowrey
e892f5382f Fix ZTS build 2015-03-05 12:12:55 -07:00
Daniel Lowrey
c34ee4b146 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix bug #67403 (Add signatureType to openssl_x509_parse)
  5.5.24 now

Conflicts:
	ext/openssl/openssl.c
2015-03-05 10:27:11 -07:00
Daniel Lowrey
5939de35a8 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix bug #67403 (Add signatureType to openssl_x509_parse)
  5.5.24 now

Conflicts:
	configure.in
	main/php_version.h
2015-03-05 10:21:32 -07:00
Daniel Lowrey
94140afa69 Fix bug #67403 (Add signatureType to openssl_x509_parse) 2015-03-05 10:09:06 -07:00
Daniel Lowrey
73de105481 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed bug #68265 (SAN match fails with trailing DNS dot)
2015-03-04 23:56:36 -07:00
Daniel Lowrey
65a9a5ca12 Fixed bug #68265 (SAN match fails with trailing DNS dot) 2015-03-04 23:55:42 -07:00
Daniel Lowrey
fe29b8134c Merge branch 'PHP-5.6'
* PHP-5.6:
  hexadecimal is case*in*sensitive

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-04 23:00:59 -07:00
Daniel Lowrey
1de1ff75f5 Merge branch 'PHP-5.6' of https://github.com/bjori/php-src into PHP-5.6
* 'PHP-5.6' of https://github.com/bjori/php-src:
  hexadecimal is case*in*sensitive
2015-03-04 22:55:22 -07:00
Daniel Lowrey
94a70b98a6 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed bug #68879 (IP Address fields in subjectAltNames not used)
  Fix broken test

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-04 22:42:25 -07:00
Daniel Lowrey
5dcace058a Fixed bug #68879 (IP Address fields in subjectAltNames not used) 2015-03-04 22:39:25 -07:00
Daniel Lowrey
ca766e0787 Fix broken test 2015-03-04 22:37:07 -07:00
Hannes Magnusson
3c2c029bfd hexadecimal is case*in*sensitive 2015-03-04 16:03:45 -08:00
Daniel Lowrey
b5d97140c0 Merge branch 'tls-alpn'
* tls-alpn:
  Improve test to target specific issue
  Misc updates/cleanup
  Add TLS ALPN extension support in crypto client/server streams
  Add stream_socket_crypto_info() function
  Update for compatibility with newer openssl libs
2015-03-04 13:56:58 -07:00
Daniel Lowrey
5de64a29e6 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed bug #68920 (use strict peer_fingerprint input checks)

Conflicts:
	ext/openssl/xp_ssl.c
2015-03-04 12:50:35 -07:00
Daniel Lowrey
241f3c34b8 Fixed bug #68920 (use strict peer_fingerprint input checks) 2015-03-04 12:47:46 -07:00
Daniel Lowrey
8680fc8331 Improve test to target specific issue 2015-03-04 10:23:46 -05:00
Daniel Lowrey
a39b1898fe Misc updates/cleanup 2015-03-04 09:24:27 -05:00
Daniel Lowrey
3e841470c9 Add TLS ALPN extension support in crypto client/server streams 2015-02-28 17:41:30 -05:00
Daniel Lowrey
13acb7ec65 Add stream_socket_crypto_info() function 2015-02-28 17:41:29 -05:00
Daniel Lowrey
3ff36c265f Update for OpenSSL 1.0.2 compatibility 2015-02-28 17:41:29 -05:00
Jakub Zelenka
0676f39ee4 Remove unnecessary resource checks in openssl ext
The resource val is already checking Z_TYPE_P(val) == IS_RESOURCE.
There is no need to call extended resource fetch functions though.
2015-02-17 20:46:36 +00:00
Xinchen Hui
10fe317300 Merge branch 'PHP-5.6'
Conflicts:
	ext/openssl/openssl.c
2015-02-16 14:18:08 +08:00
Xinchen Hui
8309988111 Fixed bug #68912 (Segmentation fault at openssl_spki_new) 2015-02-16 14:16:52 +08:00
Anatol Belski
c17e007a29 Merge branch 'PHP-5.6'
* PHP-5.6:
  fix condition
2015-02-13 13:40:37 +01:00
Anatol Belski
b3d28d14d6 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix condition
2015-02-13 13:40:10 +01:00
Anatol Belski
5ff77b005b fix condition 2015-02-13 13:39:46 +01:00
Daniel Lowrey
712712e8d6 Merge branch 'PHP-5.6'
Conflicts:
	ext/openssl/xp_ssl.c
2015-02-09 15:14:47 -05:00
Daniel Lowrey
fb2314798e Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	ext/openssl/xp_ssl.c
2015-02-09 11:44:09 -05:00
Daniel Lowrey
1eef4f2a0c Miscellaneous cleanup 2015-02-09 11:42:17 -05:00
Brad Broerman
dddbe0fc33 Update xp_ssl.c
Added TSRMLS_CC to php_openssl_sockop_io calls.
2015-02-04 10:13:36 -05:00
Xinchen Hui
e98caf27ea found type is unnecessary 2015-02-02 14:45:19 +08:00
Xinchen Hui
942809909e Cleanup resource handling APIs 2015-02-02 13:23:16 +08:00
Michael Wallner
3c4540dec9 fix warnings 2015-01-30 22:49:44 +01:00
Anatol Belski
8d054be62f fix datatype mismatches, improve error checks 2015-01-30 14:36:33 +01:00
Anatol Belski
085907d168 fix datatype mismatches, improved error checks 2015-01-30 13:52:11 +01:00
Anatol Belski
3acdbaeba0 fix datatype mismatch warns, improve error check 2015-01-30 12:14:27 +01:00