|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65157 openssl module doesn't see all available ciphers
Submitted: 2013-06-28 10:15 UTC Modified: 2013-07-05 08:58 UTC
From: eugene at zhegan dot in Assigned:
Status: No Feedback Package: OpenSSL related
PHP Version: 5.3.26 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-06-28 10:15 UTC] eugene at zhegan dot in
Openssl doesn't see al available ciphers.
In order to not get bored, please read the last part, and then, if you are still 
not bored, you can read following part, in order to understand how to get GOST 
ciphers in PHP.

Missing cipher is GOST R 34.10-2001.

I have an fresh upstream OpenSLL, which now is by default built with GOST 
encryption. I want to use GOST encryption (actually, I have to use it, because 
I'm from Russia, and FSB/KGB/God knows who is forcing to use it). OpenSSL > 
1.0.0 is built with GOST encryption, but in order to actually enable it, you 
have to use a configuration file which mentions it. This is the first problem, 
still unresolved in the PHP, howevere there are several workarounds (all of the 
contail OPENSSL_config() call added somewhere).

I have a curl from upstream built with OPENSSL_config() call, and a curl PHP 
module loaded before openssl module (so, no openssl modifuication is needed).


Why I think it's missing:

Because openssl has it:

/usr/local/openssl/bin/openssl ciphers aGOST01

(according to its manual - "aGOST01 - cipher suites
using GOST R 34.10-2001 authentication.")

Curl also has it:

/usr/local/curl/bin/curl --engine gost --ciphers GOST2001-GOST89-GOST89
curl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3
alert handshake failure

I got a failure, but when the non-existent cipher suite is used, the
error is different:

/usr/local/curl/bin/curl --engine gost --ciphers GOST2001-GOST89-GOST666
curl: (59) failed setting cipher list

So, openssl has it, curl has it, but for some reason php doesn't.
openssl_get_md_methods() shows a couple of GOST digest but not GOST R

array(30) {
  string(3) "DSA"
  string(7) "DSA-SHA"
  string(17) "GOST 28147-89 MAC"
  string(15) "GOST R 34.11-94"
  string(3) "MD4"
  string(3) "MD5"
  string(4) "MDC2"
  string(9) "RIPEMD160"
  string(3) "SHA"
  string(4) "SHA1"
  string(6) "SHA224"
  string(6) "SHA256"
  string(6) "SHA384"
  string(6) "SHA512"
  string(13) "dsaEncryption"
  string(10) "dsaWithSHA"
  string(15) "ecdsa-with-SHA1"
  string(8) "gost-mac"
  string(3) "md4"
  string(3) "md5"
  string(9) "md_gost94"
  string(4) "mdc2"
  string(9) "ripemd160"
  string(3) "sha"
  string(4) "sha1"
  string(6) "sha224"
  string(6) "sha256"
  string(6) "sha384"
  string(6) "sha512"
  string(9) "whirlpool"

The code 

$encres = openssl_digest("123", "GOST R 34.11-94");
echo $encres;

gives this:


And the code:

encres = openssl_digest("123", "GOST R 34.10-2001");
echo $encres;

gives this:

PHP Warning:  openssl_digest(): Unknown signature algorithm in 
/home/emz/ciphers.php on line 6

Test script:
        $encres = openssl_digest("123", "GOST R 34.10-2001");
        echo $encres;

Expected result:
I expect GOST R 34.10-2001 to be shown in the cipher list and openssl_digest() 
gives me encrypted string.

Actual result:
In fact, GOST R 34.10-2001 is not shown in the output of the 
openssl_get_md_methods(), and openssl_digest() is giving me the error:

PHP Warning:  openssl_digest(): Unknown signature algorithm in 
/home/emz/ciphers.php on line 6


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-28 15:45 UTC]
-Status: Open +Status: Feedback
 [2013-06-28 15:45 UTC]
I really doubt the reported issue has something to do with PHP. Looking at the 
code behind openssl_digest - PHP is just a wrapper, the lookup for a digest 
method is done by the openssl library. See  

Could you please check whether PHP is linked with the openssl instance you 
expect? Also whether the correct .so is used on runtime. Please be aware also - 
some engines can require to be loaded and configured through openssl.cnf, be 
sure the right config file is used.
 [2013-07-05 08:58 UTC]
-Status: Feedback +Status: No Feedback
 [2013-07-05 08:58 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

 [2013-07-25 12:32 UTC] eugene at zhegan dot in
Here's the test you requested (same machine as above):

# ldd `which php` (0x00007fff5ddff000) => /lib/x86_64-linux-gnu/ 
(0x00007fe2da09e000) => /lib/x86_64-linux-gnu/ 
(0x00007fe2d9e87000) => /lib/x86_64-linux-gnu/ (0x00007fe2d9c7e000) => /usr/lib/ (0x00007fe2d9a4c000) => /usr/lib/x86_64-linux-gnu/ 
(0x00007fe2d9843000) => /lib/x86_64-linux-gnu/ (0x00007fe2d963e000) => /usr/lib/ (0x00007fe2d93b6000) => /usr/lib/ (0x00007fe2d919f000) => /lib/ (0x00007fe2d8f78000) => /usr/lib/ (0x00007fe2d8d55000) => /usr/local/openssl/lib/ 
(0x00007fe2d897b000) => /usr/local/openssl/lib/ 
(0x00007fe2d8711000) => /usr/lib/ 
(0x00007fe2d82f4000) => /lib/x86_64-linux-gnu/ 
(0x00007fe2d80d8000) => /lib/x86_64-linux-gnu/ (0x00007fe2d7ebf000) => /lib/x86_64-linux-gnu/ (0x00007fe2d7bc1000) => /usr/lib/x86_64-linux-gnu/ 
(0x00007fe2d7a5f000) => /lib/x86_64-linux-gnu/ (0x00007fe2d76b1000)
        /lib64/ (0x00007fe2da2de000) => /lib/x86_64-linux-gnu/ (0x00007fe2d748e000)

I can not agree (thoough I understand I can be wrong) - openssl clearly shows it 
has the cipher, curl agrees.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 10:01:32 2024 UTC