Add check for openssl_pseudo_bytes IV generation

This commit is contained in:
DariusIII
2018-01-16 15:53:19 +01:00
parent 8f42c3e1df
commit 4fb899f15a
2 changed files with 9 additions and 2 deletions
+1
View File
@@ -1,4 +1,5 @@
2018-01-16 DariusIII
* Chg: Add check for openssl_pseudo_bytes IV generation
* Fix: Fix getCBPTableNames function calls
* Fix: Fix call to Releases
* Chg: Use Group model and remove nntmux\Groups class
+8 -2
View File
@@ -399,7 +399,7 @@ class Binaries
// We will use this to subtract so we leave articles for the next time (in case the server doesn't have them yet)
$leaveOver = $this->messageBuffer;
// If this is not a new group, go from our newest to the servers newest.
// If this is not a new group, go from our newest to the servers newest.
} else {
// Set our oldest wanted to our newest local article.
$first = $groupMySQL['last_record'];
@@ -890,6 +890,12 @@ class Binaries
$date = $this->header['Date'] > $now ? $now : $this->header['Date'];
$unixtime = is_numeric($this->header['Date']) ? $date : $now;
$random = openssl_random_pseudo_bytes(16, $isSourceStrong);
if ($isSourceStrong === false || $random === false) {
throw new \RuntimeException('IV generation failed');
}
$collectionID = $this->_pdo->queryInsert(
sprintf(
"
@@ -907,7 +913,7 @@ class Binaries
sha1($this->header['CollectionKey']),
$collMatch['id'],
$xref,
bin2hex(openssl_random_pseudo_bytes(16))
bin2hex($random)
)
);