-
Notifications
You must be signed in to change notification settings - Fork 5
Adapt to OpenSSL 1.1.0 #3
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
Conversation
OpenSSL 1.1.0 hid structure internals and provided methods for reading and writing them. This patch adapts to the changes so that it's possible to build it against the new as well as as old OpenSSL library. Because the new OpenSSL does not support setting each prime number separately, this patch fakes somes otherwise undefined values. This looks ugly but this cannot be done better. I recommend to add new Perl subroutines for setting the prime numbers in a bulk as new OpenSSL does. These will be a strightforward binding with less code and higher performance. CPAN RT#118346
I am getting this failure on MS Windows + openssl-1.1.0b:
I will try to investigate it a bit more. |
What do you think about dcd4020 ? |
On Tue, Nov 01, 2016 at 08:10:06AM -0700, kmx wrote:
$ perl -Iblib/{lib,arch} t/10-selftest.t Running under perl version 5.024000 for linuxCurrent time local: Tue Nov 1 16:49:13 2016Current time GMT: Tue Nov 1 15:49:13 2016Using Test.pm version 1.28_01q not prime at t/10-selftest.t line 12. That could be caused by Fedora's OpenSSL patches applied on top. I will have |
I have found https://www.openssl.org/news/cl110.txt
And this https://www.openssl.org/docs/man1.1.0/crypto/DSA_generate_parameters.html
so the added test for |
According: https://www.openssl.org/docs/man1.1.0/crypto/DSA_generate_parameters_ex.html
so I have changed the test to
But I do not understand why |
Maybe you should use DSA_generate_parameters_ex() with new OpenSSL. The
DSA_generate_parameters() is deprecated there.
Nonetheless the issue on my system has different cause because it returns
error from OpenSSL, not a croak from the length check in DSA.xs. Even with
you latest commit.
|
On Tue, Nov 01, 2016 at 11:45:13AM -0700, kmx wrote:
|
On Wed, Nov 02, 2016 at 09:57:32AM +0100, Petr Pisar wrote:
The issue on my system is very probably caused by FIPS patches that Fedora Moreover the perl code fails from with "fooo", "fo" and even with "abc". It I grepped OpenSSL-1.1.0b sources for DSA_generate_parameters_ex() calls and I will ask OpenSSL maintainer in Fedora. |
With openssl-1.1.0b built for MS Win/64bit without any patches I see the failure also with "foo". |
On Wed, Nov 02, 2016 at 08:38:52AM -0700:
The reason why old OpenSSL worked for any seed while the new one fails is that Therefore do not bother with the "foo" case. Once Fedora's OpenSSL gets fixed, I will try your code again. Maybe it will be -- Petr |
Do you think we should put the test:
inside #if block like this:
or keep the seed_len test also for older openssl? |
I would remove the checks for seed length completely and let it on OpenSSL.
(Otherwise you had to follow OpenSSL for any internal changes to match the
range checks.)
If you care about silent OpenSSL failures without an error code, I would only
rephrase the croak message after DSA_generate_parameters() to indicate that
a possible reason is invalid seed length with reference to the OpenSSL manual
page.
But if you want to cover this case in the Perl binding, I would keep the
check only for the new OpenSSL as you suggested.
…-- Petr
|
On Thu, Nov 03, 2016 at 02:33:10PM +0100, Petr Pisar wrote:
Fedora OpenSSL maintainer described the fix like this: use a random seed if the supplied one did not generate valid Therefore Fedora's OpenSSL does not fail with any seed now. This of course |
I have released 0.18 with slightly modified handling of NULL retval from DSA_generate_parameters see d370b5a |
OpenSSL 1.1.0 hid structure internals and provided methods for reading
and writing them. This patch adapts to the changes so that it's
possible to build it against the new as well as as old OpenSSL
library.
Because the new OpenSSL does not support setting each prime number
separately, this patch fakes somes otherwise undefined values. This
looks ugly but this cannot be done better.
I recommend to add new Perl subroutines for setting the prime numbers in a
bulk as new OpenSSL does. These will be a strightforward binding with
less code and higher performance.
CPAN RT#118346