Skip to content

Commit

Permalink
Result is discardable
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyzanowskim committed Oct 23, 2018
1 parent caeee3a commit 8742801
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/CryptoSwift/BlockMode/CCM.swift
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Sources/CryptoSwift/BlockMode/CipherModeWorker.swift
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions Sources/CryptoSwift/BlockMode/GCM.swift
Expand Up @@ -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 {
Expand Down

0 comments on commit 8742801

Please sign in to comment.