Project

General

Profile

Actions

Bug #24440

closed

Improve the used random generators on *nix platforms

Added by Steffen Gebert almost 14 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2010-12-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

t3lib_div::generateRandomBytes() tries to access /dev/urandom and if it fails, it plays itself with randomness.

For windows operating systems, besids COM, also mcrypt_create_iv() and openssl_random_pseudo_bytes() are checked for availability.

In case of a restrictive open_basedir setting, this causes TYPO3 to decrease performance by not using builtin functions.
The code block should IMHO just be moved out of the } elseif (TYPO3_OS == 'WIN') { clause.

(issue imported from #M16874)


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #23453: Add information about /dev/urandom to INSTALL.txtClosedDmitry Dulepov2010-08-26

Actions
Related to TYPO3 Core - Bug #24410: Parameter for function "mcrypt_create_iv" not correctClosed2010-12-24

Actions
Is duplicate of TYPO3 Core - Bug #23355: Speed up / restructure of random byte generator to address e.g. WIN OS specificsClosed2010-08-05

Actions
Actions #1

Updated by Steffen Gebert almost 14 years ago

An interesting comment in the PHP bug tracker regarding our code:
http://bugs.php.net/bug.php?id=52523#1280851875

<em>About the patch in typo3, this code is wrong. They use urandom on non windows platform, then try alternatives on windows only.

Problem is that they first try COM (very slow), then try with mcrypt_create_iv and overwrite COM output (regardless if it worked well or not). MCrypt also always exists on windows with 5.3+, no need to test it (statically compiled). The openssl code won't be used either (never reached this condition).

However even if the openssl code was used, its logic is wrong. It considers non strong (not crypto safe) output as invalid. But urandom is not crypto safe anyway. They should test for the openssl function in the 1st place then use fopen('urandom') and finally mcrypt and other options. Much better/clean</em>

Actions #2

Updated by Steffen Gebert almost 14 years ago

Resolved as duplicate of #23355

Actions #3

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF