From ff9009abb830741b94d39c0bc8f98a15dbf464e2 Mon Sep 17 00:00:00 2001 From: Dwayne Litzenberger Date: Sun, 29 Sep 2013 14:55:26 -0700 Subject: Make MODE_OPENPGP accept uppercase 'IV' parameter. This is for consistency with the rest of PyCrypto. Closes: https://bugs.launchpad.net/pycrypto/+bug/1132550 --- lib/Crypto/Cipher/blockalgo.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Crypto/Cipher/blockalgo.py b/lib/Crypto/Cipher/blockalgo.py index ba8cfdc..98e0e00 100644 --- a/lib/Crypto/Cipher/blockalgo.py +++ b/lib/Crypto/Cipher/blockalgo.py @@ -526,7 +526,14 @@ class BlockAlgo: self._done_first_block = False self._done_last_block = False - self.IV = _getParameter('iv', 1, args, kwargs) + self.IV = _getParameter('IV', 1, args, kwargs) + if self.IV is None: + # TODO: Decide whether 'IV' or 'iv' should be used going forward, + # and deprecate the other. 'IV' is consistent with the rest of + # PyCrypto, but 'iv' is more common in Python generally. For now, + # we'll support both here. When in doubt, use a positional + # parameter for now. + self.IV = _getParameter('iv', 1, args, kwargs) if not self.IV: raise ValueError("MODE_OPENPGP requires an IV") -- cgit v1.2.1