Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Improve openssl ext to generate EC keys with custom EC parameters
This change extends supported parameter when generating EC keys. Specifically following parameters are now supported: p, a, b, order, generator, seed, cofactory, g_x, g_y, x, y and d. Those parameters can be passed to ec field in openssl_pkey_new options. It also fixes some issues openssl_pkey_get_details related to SM2 support. Closes GH-9991
- Loading branch information
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eno-CN @bukka this test is failing in Fedora <= 37 / RHEL <= 8 (ok on Fedora 38 and RHEL 9)
On this system
Test output:
Can you please:
add a skip for missing EC ?
or use another more common EC ?
or split the test for this specific EC ?
P.S. after more tests, seems the used EC is
"secp224r1"which is available... need to understand whyopenssl_pkey_newfails...0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remicollet What version of the OpenSSL library are you using?
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also provide OpenSSL config options so we can verify the fix...
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenSSL Version https://rpms.remirepo.net/rpmphp/zoom.php?rpm=openssl
Strangely, it fails with 3.0.9 on Fedora 37 and passes with the same version on Fedora 38
I was thinking all our tests use the ext/openssl/tests/openssl.cnf ?
See openssl.txt
P.S. despite same version, applied patches are very different
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asking Fedora OpenSSL maintainer about this in https://bugzilla.redhat.com/2223953
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From OpenSSL maintainer:
So I will ignore this test during RPM build.
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eno-CN and @bukka
FYI, RPM build will include a patch to always warn when
curve_nameis missing (to avoid user frustration on silently failing function)See https://git.remirepo.net/cgit/rpms/scl-php83/php.git/plain/php-8.3.0-openssl-ec-param.patch?id=16bfe8481842870229de0c47d55091cef3d2e6ad
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should instead check in build if it is supported and if not and used, it should have warning describing that the feature is not enabled. Might be also good to introduce some user space constant so users can check the support.
0dadd66There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bukka
There may be a risk of security vulnerabilities here, but I'm unsure if any special handling is needed for unrepaired versions of OpenSSL.
If necessary, it may be required to introduce macro definitions to indicate "support for explicit elliptic curve parameters" and then perform conditional compilation in the necessary places (such as creating private keys, parsing public and private keys, etc.) to fix security vulnerabilities.
CVE-2022-0778