Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-08-11 20:26:41 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-08-12 10:16:12 +0300
commit11561aab211287e60dc6edcbd72d049840149ba4 (patch)
tree1d93462b4811e17731b63106331dd1d57c4645ba /apps
parent3b3caba521debcfce6b322f7f78a2d82697e5665 (diff)
SSE enhancement
Do not blind concatenate ints. Lets add a _ between them. So that we can distrinquis them properly Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/lib/Crypto/Crypt.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php
index b2fdec513d2..c8311f4cf73 100644
--- a/apps/encryption/lib/Crypto/Crypt.php
+++ b/apps/encryption/lib/Crypto/Crypt.php
@@ -191,7 +191,7 @@ class Crypt {
$this->getCipher());
// Create a signature based on the key as well as the current version
- $sig = $this->createSignature($encryptedContent, $passPhrase.$version.$position);
+ $sig = $this->createSignature($encryptedContent, $passPhrase.'_'.$version.'_'.$position);
// combine content to encrypt the IV identifier and actual IV
$catFile = $this->concatIV($encryptedContent, $iv);
@@ -464,7 +464,13 @@ class Crypt {
$catFile = $this->splitMetaData($keyFileContents, $cipher);
if ($catFile['signature'] !== false) {
- $this->checkSignature($catFile['encrypted'], $passPhrase.$version.$position, $catFile['signature']);
+ try {
+ // First try the new format
+ $this->checkSignature($catFile['encrypted'], $passPhrase . '_' . $version . '_' . $position, $catFile['signature']);
+ } catch (GenericEncryptionException $e) {
+ // For compatibility with old files check the version without _
+ $this->checkSignature($catFile['encrypted'], $passPhrase . $version . $position, $catFile['signature']);
+ }
}
return $this->decrypt($catFile['encrypted'],