Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 797676 - <dev-lang/php-8.1.0 fails to build against dev-libs/openssl-3: ext/openssl/openssl.c:1224:51: error: ‘RSA_SSLV23_PADDING’ undeclared (first use in this function)
Summary: <dev-lang/php-8.1.0 fails to build against dev-libs/openssl-3: ext/openssl/op...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords: PATCH, PullRequest
: 805167 (view as bug list)
Depends on:
Blocks: openssl-3.0
  Show dependency tree
 
Reported: 2021-06-23 00:49 UTC by Thomas Deutschmann (RETIRED)
Modified: 2023-06-23 21:42 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,157.01 KB, text/plain)
2021-06-23 00:49 UTC, Thomas Deutschmann (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-23 00:49:06 UTC
Created attachment 717759 [details]
build.log

> In file included from /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/main/php.h:439,
>                  from /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/ext/openssl/openssl.c:27:
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/ext/openssl/openssl.c: In function ‘zm_startup_openssl’:
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/ext/openssl/openssl.c:1224:51: error: ‘RSA_SSLV23_PADDING’ undeclared (first use in this function); did you mean ‘RSA_NO_PADDING’?
>  1224 |  REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT);
>       |                                                   ^~~~~~~~~~~~~~~~~~
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/Zend/zend_constants.h:50:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’
>    50 | #define REGISTER_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number)
>       |                                                                                                         ^~~~
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/ext/openssl/openssl.c:1224:51: note: each undeclared identifier is reported only once for each function it appears in
>  1224 |  REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT);
>       |                                                   ^~~~~~~~~~~~~~~~~~
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/Zend/zend_constants.h:50:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’
>    50 | #define REGISTER_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number)
>       |                                                                                                         ^~~~
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/ext/openssl/openssl.c: In function ‘php_openssl_generate_private_key’:
> /var/tmp/portage/dev-lang/php-8.0.7/work/sapis-build/cli/ext/openssl/openssl.c:3687:7: warning: ‘RSA_new’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
>  3687 |       rsaparam = RSA_new();
>       |       ^~~~~~~~

PHP 7.x has same failure.
Comment 1 Vladimir B. Vinogradov 2021-07-21 17:08:45 UTC
Hi.
See also https://bugs.php.net/bug.php?id=81278
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2021-07-30 08:38:34 UTC
*** Bug 805167 has been marked as a duplicate of this bug. ***
Comment 3 Mike Gilbert gentoo-dev 2022-05-17 20:36:02 UTC
A fix landed upstream, and is included in dev-lang/php:8.1.

Older versions are still broken.
Comment 4 Conrad Kostecki gentoo-dev 2022-07-11 22:59:03 UTC
Do we have any chance to get patched somehow php7.4 at least?
Comment 5 Anthony Ryan 2022-07-31 02:21:55 UTC
(In reply to Conrad Kostecki from comment #4)
> Do we have any chance to get patched somehow php7.4 at least?

Upstream discussions indicated that they have no intention of backporting the fix to older releases out of concern for introducing bugs in stable releases.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-18 03:47:48 UTC
Aim is to unmask OpenSSL 3 by end of year.
Comment 7 Michael Orlitzky gentoo-dev 2022-11-18 12:28:50 UTC
(In reply to Sam James from comment #6)
> Aim is to unmask OpenSSL 3 by end of year.

php-7.4 loses security support in 9 days, which sort of solves that problem. For php-8.0, we should probably just add an upper bound on the dependency. Upstream WONTFIXed the request to backport:

  https://github.com/php/php-src/issues/9503
Comment 8 Larry the Git Cow gentoo-dev 2022-11-20 03:21:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd1a44d939cae653057dd20dbad8b3440d8c7e41

commit dd1a44d939cae653057dd20dbad8b3440d8c7e41
Author:     Brian Evans <grknight@gentoo.org>
AuthorDate: 2022-11-20 03:18:47 +0000
Commit:     Brian Evans <grknight@gentoo.org>
CommitDate: 2022-11-20 03:18:47 +0000

    dev-lang/php: Set max openssl version on 7.4 and 8.0 slots
    
    Only affects build time and forced rebuild in place catches installed versions
    
    Closes: https://bugs.gentoo.org/797676
    Bug: https://github.com/php/php-src/issues/9503
    Signed-off-by: Brian Evans <grknight@gentoo.org>

 dev-lang/php/php-7.4.33.ebuild | 2 +-
 dev-lang/php/php-8.0.25.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-20 03:29:10 UTC
(In reply to Michael Orlitzky from comment #7)
> (In reply to Sam James from comment #6)
> > Aim is to unmask OpenSSL 3 by end of year.
> 
> php-7.4 loses security support in 9 days, which sort of solves that problem.
> For php-8.0, we should probably just add an upper bound on the dependency.
> Upstream WONTFIXed the request to backport:
> 
>   https://github.com/php/php-src/issues/9503

Sounds good (late reply ;)) and thanks grknight for handling it. It's better than nothing and it stops folks accidentally upgrading and getting into a death loop.
Comment 10 Hasso Tepper 2022-11-28 12:50:44 UTC
In fact this patch is enough to build PHP-8.0 with openssl-3.0.x:

https://github.com/php/php-src/compare/PHP-8.0...bukka:openssl_30
Comment 11 Michael Orlitzky gentoo-dev 2022-11-28 13:13:33 UTC
(In reply to Hasso Tepper from comment #10)
> In fact this patch is enough to build PHP-8.0 with openssl-3.0.x:
> 
> https://github.com/php/php-src/compare/PHP-8.0...bukka:openssl_30

True, but there have been other bug fixes for openssl-3.x compatibility since that branch was authored, and many commits to the openssl extension more generally that might have different behavior with v3.x but don't mention it in their commit messages.

We're not experts on the PHP/OpenSSL code, so it would be hard to know what is important to backport. And especially for a security-sensitive extension, we would rather avoid risking a repeat of the famous Debian bug: https://jblevins.org/log/ssh-vulnkey

If it ever becomes a major problem we can reconsider, but chances are, php-8.0 won't be the last consumer of openssl-1.x. (It's also not that bad of an upgrade to 8.1 if you've made it to 8.0 already.)
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-22 22:34:54 UTC
(In reply to Michael Orlitzky from comment #11)
> (In reply to Hasso Tepper from comment #10)
> > In fact this patch is enough to build PHP-8.0 with openssl-3.0.x:
> > 
> > https://github.com/php/php-src/compare/PHP-8.0...bukka:openssl_30
> 
> True, but there have been other bug fixes for openssl-3.x compatibility
> since that branch was authored, and many commits to the openssl extension
> more generally that might have different behavior with v3.x but don't
> mention it in their commit messages.
> 
> We're not experts on the PHP/OpenSSL code, so it would be hard to know what
> is important to backport. And especially for a security-sensitive extension,
> we would rather avoid risking a repeat of the famous Debian bug:
> https://jblevins.org/log/ssh-vulnkey
> 
> If it ever becomes a major problem we can reconsider, but chances are,
> php-8.0 won't be the last consumer of openssl-1.x. (It's also not that bad
> of an upgrade to 8.1 if you've made it to 8.0 already.)

OpenSSL 1.1* will be EOL in September. So, we have two choices (more or less):
1. Switch to purely php8.1 as default now (or perhaps php8.0 and php8.1 for a bit, then 8.1, but still in pretty short order)
2. Figure out how other distros who still ship <8.1 have handled it.

For Ruby, we took the equivalent of option 1.
Comment 13 Michael Orlitzky gentoo-dev 2023-06-22 22:54:57 UTC
(In reply to Sam James from comment #12)

> 
> OpenSSL 1.1* will be EOL in September. So, we have two choices (more or
> less):
> 1. Switch to purely php8.1 as default now (or perhaps php8.0 and php8.1 for
> a bit, then 8.1, but still in pretty short order)
> 2. Figure out how other distros who still ship <8.1 have handled it.
> 
> For Ruby, we took the equivalent of option 1.

The PHP project is now empty, and I don't have the bandwidth to work miracles myself, so if it comes down to it, feel free to mask any PHP revdeps of openssl-1.1 along with it.

We have 8.1 stable now so the situation isn't so bad. The real headache is the 7.4 -> 8.0 upgrade I think, and everyone has had plenty of time for that. Afterwards, going from 8.0 to 8.1 should be relatively easy. Regardless, there's only so much we can do.
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-22 23:44:04 UTC
Thanks for the quick reply mjo! Totally understandable and appreciate what you're saying (in particular the licence to do what is needed). I've opened a PR to try switch us to newer defaults.
Comment 15 Larry the Git Cow gentoo-dev 2023-06-23 21:42:05 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf60cddb73476fb9a5c99bd17d69899a134fed40

commit cf60cddb73476fb9a5c99bd17d69899a134fed40
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-06-22 23:06:22 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-23 21:41:33 +0000

    profiles/base: change to PHP_TARGETS="php8-1"
    
    Needed for OpenSSL 3. As noted in the PR, php7-4 is EOL and 8-0 is security-support
    only, so let's zoom ahead to solely 8-1.
    
    Bug: https://bugs.gentoo.org/797676
    Closes: https://github.com/gentoo/gentoo/pull/31579
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/base/make.defaults | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)