Skip to content

Commit

Permalink
Fix replication issue reported in #41
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jan 26, 2019
1 parent 984d034 commit 005fa92
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Chronicle/Process/Replicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ protected function appendToChain(array $entry): bool
$db->rollBack();
throw new SecurityViolation('Invalid Ed25519 signature provided by source Chronicle.');
}
if (!isset($entry['summaryhash'])) {
if (!isset($entry['summary'])) {
$db->rollBack();
throw new SecurityViolation('No summary hash provided');
}
$entry['summaryhash'] =& $entry['summary'];
}

/* Update the Blakechain */
$blakechain->appendData(
Expand All @@ -180,7 +187,7 @@ protected function appendToChain(array $entry): bool
);

/* If the summary hash we calculated doesn't match what was given, abort */
if (!\hash_equals($entry['summary'], $blakechain->getSummaryHash())) {
if (!\hash_equals($entry['summaryhash'], $blakechain->getSummaryHash())) {
$db->rollBack();
throw new SecurityViolation(
'Invalid summary hash. Expected ' . $entry['summary'] .
Expand Down

0 comments on commit 005fa92

Please sign in to comment.