Skip to content

Add X509 purpose constant #6312

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 2 commits into from
Closed

Add X509 purpose constant #6312

wants to merge 2 commits into from

Conversation

vjardin
Copy link
Contributor

@vjardin vjardin commented Oct 9, 2020

X509_PURPOSE_OCSP_HELPER, X509_PURPOSE_TIMESTAMP_SIGN are available from
OpenSSL for many years:

  • X509_PURPOSE_OCSP_HELPER, since 2001
  • X509_PURPOSE_TIMESTAMP_SIGN, since 2006

@nikic
Copy link
Member

nikic commented Oct 10, 2020

Looks like a reasonable addition. Any concerns from @bukka?

@carusogabriel carusogabriel modified the milestone: PHP 8.1 Oct 10, 2020
@vjardin
Copy link
Contributor Author

vjardin commented Oct 10, 2020

What's about a backport for previous PHP Releases: 7.4, 8.0 ? If you want, I can build the patch, it'll be an easy one.

@bukka
Copy link
Member

bukka commented Oct 10, 2020

Just a minor comment but seems reasonable. It's quite straight forward and self contained so I would be fine with targeting 7.4 if there are no objections.

@vjardin you don't need to provide extra patch. You can just change the base branch which should do.

X509_PURPOSE_OCSP_HELPER, X509_PURPOSE_TIMESTAMP_SIGN are available from
OpenSSL for many years:
  - X509_PURPOSE_OCSP_HELPER, since 2001
  - X509_PURPOSE_TIMESTAMP_SIGN, since 2006
Let's get it enabled for any case.

Suggested-by: Jakub Zelenka
@vjardin
Copy link
Contributor Author

vjardin commented Oct 11, 2020

@bukka Thanks regarding 7.4 I am not used with PHP maintenance process: should I wait for these 2 patches to be applied to openssl/master first before getting it in 7.4 ?

Regarding the change of the base branch, how does it work with github ? Should I provide it thru a specific pull request ? I'll maybe wrong, but it seem easier for a maintainer to apply it, doesn't it ?

I am ready to help...

@Girgias Girgias changed the base branch from master to PHP-7.3 October 11, 2020 14:03
@Girgias Girgias changed the base branch from PHP-7.3 to master October 11, 2020 14:03
@Girgias
Copy link
Member

Girgias commented Oct 11, 2020

@bukka Thanks regarding 7.4 I am not used with PHP maintenance process: should I wait for these 2 patches to be applied to openssl/master first before getting it in 7.4 ?

Regarding the change of the base branch, how does it work with github ? Should I provide it thru a specific pull request ? I'll maybe wrong, but it seem easier for a maintainer to apply it, doesn't it ?

I am ready to help...

Change the base branch of this PR in the GitHub interface. However GitHub doesn't seem to be smart enough to do a rebase. After having done it next to the title of the PR there is an edit button which allows you to change the base branch.

We need to merge up anyway so it makes no sense to add this first on master (which is now PHP 8.1) when the whole point is to backport it. The person merging will take care of merging it into all the maintained version branches.

@php-pulls php-pulls closed this in 1e53e14 Oct 12, 2020
@nikic
Copy link
Member

nikic commented Oct 12, 2020

I've applied this patch to PHP-7.4 and upwards.

@nikic
Copy link
Member

nikic commented Oct 12, 2020

I had to revert this change, because it fails on Travis on the PHP-7.4 branch:

========DIFF========
046+ bool(true)
053- bool(false)
069+ bool(true)
069- bool(false)
========DONE========
FAIL int openssl_x509_checkpurpose ( mixed $x509cert , int $purpose [, array $cainfo = array() [, string $untrustedfile ]] ) function [ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt]

It does work locally and on Azure though. Possibly there is an OpenSSL version dependence in the test?

@nikic nikic reopened this Oct 12, 2020
@vjardin
Copy link
Contributor Author

vjardin commented Oct 12, 2020

Any openssl since 2006 should be good enough. By the way, from the Travis logs I can see, it is OK. Please, do you have a URL with some traces I can analyse ?

@nikic
Copy link
Member

nikic commented Oct 12, 2020

@vjardin
Copy link
Contributor Author

vjardin commented Oct 12, 2020

Thanks,:the latest one https://travis-ci.org/github/php/php-src/builds/734972098 has been OK. How can I run my own Travis environment, close to the Travis one in order to analyse the gap with the failing one https://travis-ci.org/github/php/php-src/builds/734957779 ?

@nikic
Copy link
Member

nikic commented Oct 12, 2020

@vjardin The relevant difference (I assume) is that this PR against master uses bionic, while PHP-7.4 uses xenial.

@vjardin
Copy link
Contributor Author

vjardin commented Oct 15, 2020

Right, it fails on Xenial (16.04) while it is OK on 18.04 on 20.04. It seems that OpenSSL 1.1+ is required which is strange since these features are defined for years within OpenSSL. I could not find the proper bug fix into OpenSSL's git yet.

  • 16.04/openssl: OpenSSL 1.0.2g 1 Mar 2016

  • 18.04/openssl: OpenSSL 1.1.1 11 Sep 2018

  • 20.04/openssl: OpenSSL 1.1.1f 31 Mar 2020

Should I "ifdef" it so it compiles only when OpenSSL 1.1 is available ?

@bukka
Copy link
Member

bukka commented Oct 18, 2020

The constants are present as it wouldn't compile otherwise. I think this will be more about the checking logic that might have changed in OpenSSL 1.1.0.

It would be good if you can compile it against 1.0.2 and check which constant is causing that and what was changed in OpenSSL to cause that. Then you can modify the test accordingly if it's expected.

@cmb69
Copy link
Member

cmb69 commented Dec 2, 2021

I wanted to suggest to just merge that in a branch which requires OpenSSL ≥ 1.1, but even master still supports OpenSSL ≥ 1.0.2. Does that make sense?

@bukka
Copy link
Member

bukka commented Dec 13, 2021

I wanted to suggest to just merge that in a branch which requires OpenSSL ≥ 1.1, but even master still supports OpenSSL ≥ 1.0.2. Does that make sense?

@cmb69 yeah we have discussed it and think Remi was against dropping the support as 1.0.2 is still supported by RHEL 7 IIRC.

@cmb69
Copy link
Member

cmb69 commented Dec 13, 2021

@cmb69 yeah we have discussed it and think Remi was against dropping the support as 1.0.2 is still supported by RHEL 7 IIRC.

@remicollet, can you confirm? Is this still relevant for PHP 8.2?

@cmb69
Copy link
Member

cmb69 commented Dec 28, 2021

Oh, indeed, CentOS 7 defaults to OpenSSL 1.0.2, and receives maintainance updates till 2024-06-30. :(

Anyhow, @vjardin, are you planning to work on this PR?

@vjardin
Copy link
Contributor Author

vjardin commented Dec 29, 2021

Oh, indeed, CentOS 7 defaults to OpenSSL 1.0.2, and receives maintainance updates till 2024-06-30. :(

Anyhow, @vjardin, are you planning to work on this PR?

No, I do not plan. It has been lasting for too long. You are welcomed to take over this topic or to close it.

@cmb69
Copy link
Member

cmb69 commented Dec 29, 2021

Yeah, sorry, we're bad at addressing PRs.

Anyhow, @bukka, what do you think about this? Is this worth pursuing?

@bukka
Copy link
Member

bukka commented Dec 29, 2021

Yeah I think it's useful. It's fine to leave it open. I have got it on my list but there are lots of other higher priority things before that so it might take some time.

vjardin added a commit to vjardin/php-src that referenced this pull request Jan 14, 2024
Let's get it enabled for any case.

Suggested-by: Jakub Zelenka
  php#6312 (comment)
@vjardin
Copy link
Contributor Author

vjardin commented Jan 14, 2024

let's close without merging this pull request, more to come with #13149

@vjardin vjardin closed this Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants