Browse Source

Check against instance-level `iv` in AES.init()

This fixes krzyzanowskim/CryptoSwift#261
Pascal Pfiffner 9 years ago
parent
commit
37fe63b284
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Sources/CryptoSwift/AES.swift

+ 1 - 1
Sources/CryptoSwift/AES.swift

@@ -102,7 +102,7 @@ final public class AES: BlockCipher {
             self.iv = defaultIV
         }
 
-        if (blockMode.options.contains(.InitializationVectorRequired) && iv?.count != AES.blockSize) {
+        if (blockMode.options.contains(.InitializationVectorRequired) && self.iv.count != AES.blockSize) {
             assert(false, "Block size and Initialization Vector must be the same length!")
             throw Error.InvalidInitializationVector
         }