Skip to content

Commit 66221a0

Browse files
committed
Fix code smell issues found by SonarCloud
1 parent 57d0e44 commit 66221a0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Sources/CryptomatorCryptoLib/Cryptor.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ public class Cryptor {
8787
}
8888

8989
public convenience init(masterkey: Masterkey, scheme: CryptorScheme) {
90-
let cryptoSupport = CryptoSupport()
91-
let contentCryptor: ContentCryptor
90+
let defaultCryptoSupport = CryptoSupport()
91+
let chosenContentCryptor: ContentCryptor
9292
switch scheme {
9393
case .sivCtrMac:
94-
contentCryptor = CtrThenHmacContentCryptor(macKey: masterkey.macMasterKey, cryptoSupport: cryptoSupport)
94+
chosenContentCryptor = CtrThenHmacContentCryptor(macKey: masterkey.macMasterKey, cryptoSupport: defaultCryptoSupport)
9595
case .sivGcm:
96-
contentCryptor = GcmContentCryptor()
96+
chosenContentCryptor = GcmContentCryptor()
9797
}
98-
self.init(masterkey: masterkey, cryptoSupport: cryptoSupport, contentCryptor: contentCryptor)
98+
self.init(masterkey: masterkey, cryptoSupport: defaultCryptoSupport, contentCryptor: chosenContentCryptor)
9999
}
100100

101101
// MARK: - Path Encryption and Decryption
@@ -295,7 +295,6 @@ public class Cryptor {
295295
let header = try decryptHeader(ciphertextHeader)
296296

297297
// decrypt and write cleartext content:
298-
let ciphertextChunkSize = contentCryptor.nonceLen + cleartextChunkSize + contentCryptor.tagLen
299298
var chunkNumber: UInt64 = 0
300299
while ciphertextStream.hasBytesAvailable {
301300
try autoreleasepool {

0 commit comments

Comments
 (0)