Skip to content

[Patch v1] Added TLS 1.3 support for PHP #3650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

[Patch v1] Added TLS 1.3 support for PHP #3650

wants to merge 9 commits into from

Conversation

codarrenvelvindron
Copy link

@codarrenvelvindron codarrenvelvindron commented Nov 3, 2018

  • Compiled php with openssl 1.1.1 official
  • Added tls 1.3 support for php
  • Added/Updated test files
  • Ran make tests - OK

Work done during IETF 103 hackathon

~ codarren at cyberstorm.mu ~

@petk petk added the Feature label Nov 3, 2018
@bukka
Copy link
Member

bukka commented Nov 4, 2018

I added some comments which are mainly about missing compatibility with older OpenSSL versions. That's really required as we need to support multiple OpenSSL versions (currently 1.0.1+).

We will also need to address the setting of the cipher suites which works differently for 1.3 - see https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_ciphersuites.html . I think it doesn't need to be addressed in this patch but we shouldn't enable TLS 1.3 by default for now.

@bukka
Copy link
Member

bukka commented Nov 4, 2018

Another reason why we shouldn't enable it by default at this point is that I'm not sure how well it will work with our non-blocking handling that has got some issues and it's a bit mess. So considering that TLSv1.3 sends more non-application data records after the handshake is finished, it might show some bugs.

@codarrenvelvindron
Copy link
Author

codarrenvelvindron commented Nov 8, 2018

@bukka : backwards compatibility with tls <=1.2 works correctly with the fixes.

@bukka
Copy link
Member

bukka commented Nov 18, 2018

@codarrenvelvindron Just tested with OpenSSL 1.1.1 and the session_meta_capture_tlsv13.phpt is failing for me:

001+ Notice: Undefined index: session_meta in /home/jakub/prog/php/master/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 14
001- string(7) "TLSv1.3"
002+ NULL

Is it actually working for you?

@codarrenvelvindron
Copy link
Author

codarrenvelvindron commented Nov 18, 2018

It's working with versions less than 1.1.1 but for >= 1.1.1 the actual test is failing for me as well.

According to the error messages, it seems unable to negotiate a proper cipher for tls 1.3.

Seems we'll have to implement SSL_CTX_set_ciphersuites() in this patch.

@bukka : What do you think?

$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/bug54992.pem'
]]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to replace it with

    $serverCtx = stream_context_create(['ssl' => [
        'local_cert' => __DIR__ . '/bug54992.pem',
        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_3_SERVER,
    ]]);

@bukka
Copy link
Member

bukka commented Dec 2, 2018

@codarrenvelvindron See my comment how to fix it: https://github.com/php/php-src/pull/3650/files#r238112239 . Once you fix it, please squash it and I will test it a bit more and then possibly merge it.

I don't think we need SSL_CTX_set_ciphersuites in this PR as the default is actually fine so it's more nice to have but it can be done later.

@codarrenvelvindron codarrenvelvindron changed the title Added TLS 1.3 support for PHP [Patch v1] Added TLS 1.3 support for PHP Dec 5, 2018
@codarrenvelvindron
Copy link
Author

@bukka
See v2 :
#3700

php-pulls pushed a commit to php/pecl-database-mysql_xdevapi that referenced this pull request Oct 14, 2019
- add support for following secure options: tls-versions, tls-ciphersuites, ssl-ciphers
- improve parsing Uri (e.g. previously in some cases ssl-mode has to always be in front of other secure options)
- improve error messages
- support trying open secure connections in loop for various TLS versions
- still waiting for patches related to TLSv1.3 support in PHP:
php/php-src#3650
php/php-src#3700
php/php-src#3909
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants