ソースを参照

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

This fixes krzyzanowskim/CryptoSwift#261
Pascal Pfiffner 9 年 前
コミット
37fe63b284
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
         }
 
-        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
         }