summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-09-29 14:55:26 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2013-10-20 13:30:22 -0700
commitff9009abb830741b94d39c0bc8f98a15dbf464e2 (patch)
treecdfb149a63779495f13c86b41a0b3bd508f40b88
parentacbd4dedc88325c4799d5f4df8a2f8bc0a040479 (diff)
downloadpycrypto-ff9009abb830741b94d39c0bc8f98a15dbf464e2.tar.gz
Make MODE_OPENPGP accept uppercase 'IV' parameter.
This is for consistency with the rest of PyCrypto. Closes: https://bugs.launchpad.net/pycrypto/+bug/1132550
-rw-r--r--lib/Crypto/Cipher/blockalgo.py9
1 files changed, 8 insertions, 1 deletions
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")