?
avatar mbabker
mbabker
2 Aug 2016

As of PHP 7.1, the mcrypt extension has been deprecated and will stop being distributed as part of the core PHP package in a future release. Usage of mcrypt_* functions emits E_DEPRECATED messages as seen in this Travis-CI build for the Framework's Crypt package.

To prepare for this, Joomla core should begin planning for ways to replace uses of the mcrypt extension as practical, either by introducing new API endpoints (i.e in the JCrypt class chain if we keep rolling our own crypto) or introducing switches in places where mcrypt_* functions are used standalone.

avatar mbabker mbabker - open - 2 Aug 2016
avatar brianteeman brianteeman - change - 2 Aug 2016
Category External Library Libraries
avatar brianteeman brianteeman - change - 2 Aug 2016
Labels Added: ?
avatar PhilETaylor
PhilETaylor - comment - 7 Aug 2016

I guess the start of this then would be

  • Identify the methods that implement/consume mcrypt in the Joomla code,
  • Document those,
  • unit test them in their current state
  • Refactor out the use of mcrypt
  • Ensure tests still run
  • TEST TEST TEST TEST TEST
  • TEST
  • TEST

?

avatar PhilETaylor
PhilETaylor - comment - 7 Aug 2016

This will also need @nikosdion help as mcrypt appears in the updater/restore.php etc.

avatar brianteeman brianteeman - change - 7 Aug 2016
Status New Confirmed
avatar nikosdion
nikosdion - comment - 7 Aug 2016

Um, if mcrypt is no longer supported how do we implement AES encryption in PHP? Native PHP code is orders of magnitude slower.

Edit: I mean that we'd have to go through the OpenSSL extension which is even less popular than mcrypt. This is going to be "fun" on shared hosts. Especially those running PHP 5.3. We need to raise the minimum PHP requirement to 5.5 or 5.6 if we want people to run Joomla on configurations that have a chance of providing an alternative. Otherwise we will have a problem, especially with data migration of extensions using Joomla's crypto functions.

avatar PhilETaylor
PhilETaylor - comment - 7 Aug 2016

See. I knew it was important to tag @nikosdion ;-)

avatar nikosdion
nikosdion - comment - 7 Aug 2016

FWIW the restore.php only uses mcrypt out of context of the Joomla Update (extracting JPS archives). The part used during the update is native PHP code implementing AES-CTR, used to encrypt the serialized extraction engine state with a server side key and send encrypted instructions to the JavaScript side (which also implements AES-CTR in native JavaScript).

avatar mbabker
mbabker - comment - 7 Aug 2016

Um, if mcrypt is no longer supported how do we implement AES encryption in PHP?

According to the RFC I linked OpenSSL can handle AES encryption. Not sure about many details beyond that but that seems to be the primary recommendation from Scott.

avatar nikosdion
nikosdion - comment - 7 Aug 2016

Hence I edited my reply (sorry; just having my first coffee of the day). While OpenSSL handles AES encryption the extension itself is not as widely deployed as mcrypt on older PHP installs. So it's not a matter of replacing code but adding if-blocks to use what is available. If you want to be very conservative we'd also need a full native implementation so the order of preference would be:

  • OpenSSL
  • mcrypt
  • native code (slow) The only thing I'm not sure is whether we can find a native AES implementation compatible with GPL 2.

On a different note, there is one place in Joomla where replacing mcrypt will be tricky: FOF2. It's obsolete and I'm not going to maintain it. The good news is that nobody seems to be using that code.

avatar brianteeman
brianteeman - comment - 23 Aug 2016

@nikosdion has updated FOF2

[HIGH] mcrypt is deprecated in PHP 7.1. This will cause Two Factor Authentication to fail under PHP 7.1 unless you apply this PR.

So the "tricky" bit has already been done :)

avatar andrepereiradasilva
andrepereiradasilva - comment - 3 Sep 2016

Just an aditional note, when joomla does not need mcrypt anymore i guess the two PR for info on mcrypt installed #9508 and #9532 should be reverted.

avatar mbabker
mbabker - comment - 11 Dec 2016

Remaining mcrypt uses are in deprecated code or third party libraries. Complete enough.

avatar mbabker mbabker - change - 11 Dec 2016
The description was changed
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-12-11 22:59:38
Closed_By mbabker
avatar mbabker mbabker - close - 11 Dec 2016

Add a Comment

Login with GitHub to post a comment