Bläddra i källkod

Result is discardable

Marcin Krzyzanowski 6 år sedan
förälder
incheckning
874280173e

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

@@ -229,6 +229,7 @@ class CCMModeWorker: StreamModeWorker, SeekableModeWorker, CounterModeWorker, Fi
         return plaintext
     }
 
+    @discardableResult
     func willDecryptLast(bytes ciphertext: ArraySlice<UInt8>) throws -> ArraySlice<UInt8> {
         // get tag of additionalBufferSize size
         // `ciphertext` contains at least additionalBufferSize bytes

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

@@ -51,6 +51,7 @@ public protocol FinalizingEncryptModeWorker: CipherModeWorker {
 public protocol FinalizingDecryptModeWorker: CipherModeWorker {
     // Called before decryption, hence input is ciphertext.
     // ciphertext is either a last block, or a tag (for stream workers)
+    @discardableResult
     mutating func willDecryptLast(bytes ciphertext: ArraySlice<UInt8>) throws -> ArraySlice<UInt8>
     // Called after decryption, hence input is ciphertext
     mutating func didDecryptLast(bytes plaintext: ArraySlice<UInt8>) throws -> ArraySlice<UInt8>

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

@@ -186,6 +186,7 @@ final class GCMModeWorker: BlockModeWorker, FinalizingEncryptModeWorker, Finaliz
     // The authenticated decryption operation has five inputs: K, IV , C, A, and T. It has only a single
     // output, either the plaintext value P or a special symbol FAIL that indicates that the inputs are not
     // authentic.
+    @discardableResult
     func willDecryptLast(bytes ciphertext: ArraySlice<UInt8>) throws -> ArraySlice<UInt8> {
         // Validate tag
         switch mode {