浏览代码

Merge pull request #262 from p2/develop

Check against instance-level `iv` in AES.init()
Marcin Krzyzanowski 9 年之前
父节点
当前提交
aeb5ead25f
共有 1 个文件被更改,包括 1 次插入1 次删除
  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
             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!")
             assert(false, "Block size and Initialization Vector must be the same length!")
             throw Error.InvalidInitializationVector
             throw Error.InvalidInitializationVector
         }
         }