Browse Source

Check if aad is empty

Marcin Krzyzanowski 6 years ago
parent
commit
f540bee631
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Sources/CryptoSwift/BlockMode/CCM.swift

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

@@ -115,7 +115,7 @@ class CCMModeWorker: StreamModeWorker, SeekableModeWorker, CounterModeWorker, Fi
         let hasAssociatedData = additionalAuthenticatedData != nil && !additionalAuthenticatedData!.isEmpty
         processControlInformation(nonce: self.nonce, tagLength: tagLength, hasAssociatedData: hasAssociatedData)
 
-        if let aad = additionalAuthenticatedData {
+        if let aad = additionalAuthenticatedData, hasAssociatedData {
             process(aad: aad)
         }
     }