Explorar o código

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

This fixes krzyzanowskim/CryptoSwift#261
Pascal Pfiffner %!s(int64=9) %!d(string=hai) anos
pai
achega
37fe63b284
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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
         }