Skip to content

Commit

Permalink
Update documentation for 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-scott committed Mar 17, 2016
1 parent 4663262 commit ff76e1a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
### Version 1.3.0 - 2016-03-18

* Removed `openssl_random_pseudo_bytes()` entirely. If you are using
random_compat in PHP on a Unix-like OS but cannot access
`/dev/urandom`, version 1.3+ will throw an `Exception`. If you want to
trust OpenSSL, feel free to write your own fallback code. e.g.

```php
try {
$bytes = random_bytes(32);
} catch (Exception $ex) {
$strong = false;
$bytes = openssl_random_pseudo_bytes(32, $strong);
if (!$strong) {
throw $ex;
}
}
```

### Version 1.2.2 - 2016-03-11

* To prevent applications from hanging, if `/dev/urandom` is not
Expand Down
8 changes: 1 addition & 7 deletions ERRATA.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ The order is:
2. `fread() /dev/urandom if available`
3. `mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)`
4. `COM('CAPICOM.Utilities.1')->GetRandom()`
5. `openssl_random_pseudo_bytes()`

If libsodium is available, we get random data from it. This is the preferred
method on all OSes, but libsodium is not very widely installed, so other
Expand All @@ -32,9 +31,4 @@ and is not part `libmcrypt`. It actually does the right thing:

If we're on Windows and don't have access to `mcrypt`, we use `CAPICOM.Utilities.1`.

Finally, we use `openssl_random_pseudo_bytes()` **as a last resort**, due to
[PHP bug #70014](https://bugs.php.net/bug.php?id=70014). Internally, this
function calls `RAND_pseudo_bytes()`, which has been [deprecated](https://github.com/paragonie/random_compat/issues/5)
by the OpenSSL team. Furthermore, [it might silently return weak random data](https://github.com/paragonie/random_compat/issues/6#issuecomment-119564973)
if it is called before OpenSSL's **userspace** CSPRNG is seeded. Also,
[you want the OS CSPRNG, not a userspace CSPRNG](http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/).
As of random_compat 1.3, we no longer fall through to OpenSSL.

This comment has been minimized.

Copy link
@vlakoff

vlakoff Mar 18, 2016

Will have to be updated as this change is being moved to 2.0.

This comment has been minimized.

Copy link
@paragonie-scott

paragonie-scott Mar 18, 2016

Author Member

Right. I'll fix that in 2.0.2, whenever that needs to be released.

0 comments on commit ff76e1a

Please sign in to comment.