php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71919 openssl_pkey_get_private/public() require 2 calls to openssl_pkey_free()
Submitted: 2016-03-29 12:32 UTC Modified: 2017-10-30 12:37 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: gelenkig at runbox dot com Assigned: bukka (profile)
Status: Closed Package: OpenSSL related
PHP Version: 5.5.33 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gelenkig at runbox dot com
New email:
PHP Version: OS:

 

 [2016-03-29 12:32 UTC] gelenkig at runbox dot com
Description:
------------
This code works as expected:

  $r = openssl_pkey_new();
  // passes
  assert(is_resource($r));
  openssl_pkey_free($r);
  // passes
  assert(!is_resource($r));



Test script:
---------------
This code works wrong:

  $r = openssl_pkey_new();
  openssl_pkey_export($r, $pem);
  openssl_pkey_free($r);
  $r = openssl_pkey_get_private($pem);
  // passes
  assert(is_resource($r));
  openssl_pkey_free($r);
  // assertion below must not pass but it does pass
  assert(is_resource($r));
  openssl_pkey_free($r);
  // passes
  assert(!is_resource($r));

Same wrong behaviour for openssl_pkey_get_public().

Expected result:
----------------
  // either that or openssl_pkey_get_public()
  $r = openssl_pkey_get_private($pem);
  // passes
  assert(is_resource($r));
  openssl_pkey_free($r);
  // passes (in reality DOES NOT)
  assert(is_resource($r));



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-30 12:37 UTC] bukka@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bukka
 [2017-10-30 12:37 UTC] bukka@php.net
This was fixed in 7.0 when extension was ported and is no longer an issue. It is still present in 5.6 but that's just for security related fixes. So closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 01:01:31 2024 UTC