Browse Source

Function types cannot have argument label

Marcin Krzyżanowski 9 years ago
parent
commit
3f0b2815eb

+ 1 - 1
Sources/CryptoSwift/BlockMode/BlockMode.swift

@@ -6,7 +6,7 @@
 //  Copyright © 2016 Marcin Krzyzanowski. All rights reserved.
 //
 
-typealias CipherOperationOnBlock = (block: Array<UInt8>) -> Array<UInt8>?
+typealias CipherOperationOnBlock = (_ block: Array<UInt8>) -> Array<UInt8>?
 
 public enum BlockMode {
     case ECB, CBC, PCBC, CFB, OFB, CTR

+ 2 - 2
Sources/CryptoSwift/BlockMode/CBC.swift

@@ -21,7 +21,7 @@ struct CBCModeWorker: BlockModeWorker {
     }
 
     mutating func encrypt(_ plaintext: Array<UInt8>) -> Array<UInt8> {
-        guard let ciphertext = cipherOperation(block: xor(prev ?? iv, plaintext)) else {
+        guard let ciphertext = cipherOperation(xor(prev ?? iv, plaintext)) else {
             return plaintext
         }
         prev = ciphertext
@@ -29,7 +29,7 @@ struct CBCModeWorker: BlockModeWorker {
     }
 
     mutating func decrypt(_ ciphertext: Array<UInt8>) -> Array<UInt8> {
-        guard let plaintext = cipherOperation(block: ciphertext) else {
+        guard let plaintext = cipherOperation(ciphertext) else {
             return ciphertext
         }
         let result = xor(prev ?? iv, plaintext)

+ 2 - 2
Sources/CryptoSwift/BlockMode/CFB.swift

@@ -21,7 +21,7 @@ struct CFBModeWorker: BlockModeWorker {
     }
 
     mutating func encrypt(_ plaintext: Array<UInt8>) -> Array<UInt8> {
-        guard let ciphertext = cipherOperation(block: prev ?? iv) else {
+        guard let ciphertext = cipherOperation(prev ?? iv) else {
             return plaintext
         }
         prev = xor(plaintext, ciphertext)
@@ -29,7 +29,7 @@ struct CFBModeWorker: BlockModeWorker {
     }
 
     mutating func decrypt(_ ciphertext: Array<UInt8>) -> Array<UInt8> {
-        guard let plaintext = cipherOperation(block: prev ?? iv) else {
+        guard let plaintext = cipherOperation(prev ?? iv) else {
             return ciphertext
         }
         let result = xor(plaintext, ciphertext)

+ 1 - 1
Sources/CryptoSwift/BlockMode/CTR.swift

@@ -24,7 +24,7 @@ struct CTRModeWorker: RandomAccessBlockModeWorker {
         let nonce = buildNonce(iv, counter: UInt64(counter))
         counter = counter + 1
 
-        guard let ciphertext = cipherOperation(block: nonce) else {
+        guard let ciphertext = cipherOperation(nonce) else {
             return plaintext
         }
 

+ 1 - 1
Sources/CryptoSwift/BlockMode/ECB.swift

@@ -17,7 +17,7 @@ struct ECBModeWorker: BlockModeWorker {
     }
 
     mutating func encrypt(_ plaintext: Array<UInt8>) -> Array<UInt8> {
-        guard let ciphertext = cipherOperation(block: plaintext) else {
+        guard let ciphertext = cipherOperation(plaintext) else {
             return plaintext
         }
         return ciphertext

+ 2 - 2
Sources/CryptoSwift/BlockMode/OFB.swift

@@ -21,7 +21,7 @@ struct OFBModeWorker: BlockModeWorker {
     }
 
     mutating func encrypt(_ plaintext: Array<UInt8>) -> Array<UInt8> {
-        guard let ciphertext = cipherOperation(block: prev ?? iv) else {
+        guard let ciphertext = cipherOperation(prev ?? iv) else {
             return plaintext
         }
         prev = ciphertext
@@ -29,7 +29,7 @@ struct OFBModeWorker: BlockModeWorker {
     }
 
     mutating func decrypt(_ ciphertext: Array<UInt8>) -> Array<UInt8> {
-        guard let decrypted = cipherOperation(block: prev ?? iv) else {
+        guard let decrypted = cipherOperation(prev ?? iv) else {
             return ciphertext
         }
         let plaintext = xor(decrypted, ciphertext)

+ 2 - 2
Sources/CryptoSwift/BlockMode/PCBC.swift

@@ -21,7 +21,7 @@ struct PCBCModeWorker: BlockModeWorker {
     }
 
     mutating func encrypt(_ plaintext: Array<UInt8>) -> Array<UInt8> {
-        guard let ciphertext = cipherOperation(block: xor(prev ?? iv, plaintext)) else {
+        guard let ciphertext = cipherOperation(xor(prev ?? iv, plaintext)) else {
             return plaintext
         }
         prev = xor(plaintext, ciphertext)
@@ -29,7 +29,7 @@ struct PCBCModeWorker: BlockModeWorker {
     }
 
     mutating func decrypt(_ ciphertext: Array<UInt8>) -> Array<UInt8> {
-        guard let plaintext = cipherOperation(block: ciphertext) else {
+        guard let plaintext = cipherOperation(ciphertext) else {
             return ciphertext
         }
         let result = xor(prev ?? iv, plaintext)